swu-images: cc6ul: add pre-install script to remove enc flag
For CC6UL, when not using rootfs encryption, the "enc" flag must be removed from the "mtdparts" U-Boot variable. https://jira.digi.com/browse/DEL-3685 Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
parent
0a64ff89e4
commit
3cb44334c6
|
|
@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425
|
|||
|
||||
SRC_URI = "file://sw-description"
|
||||
SRC_URI_append_ccimx6 = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), 'file://preinstall_swu.sh', '')}"
|
||||
SRC_URI_append_ccimx6ul = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', 'file://preinstall_swu.sh')}"
|
||||
|
||||
inherit swupdate
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE
|
|||
PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );"
|
||||
PREINST_SCRIPT_DESC = ""
|
||||
PREINST_SCRIPT_DESC_ccimx6sbc = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}"
|
||||
PREINST_SCRIPT_DESC_ccimx6ul = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', '${PREINST_SCRIPT_TEMPLATE}')}"
|
||||
|
||||
python () {
|
||||
img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425
|
|||
|
||||
SRC_URI = "file://sw-description"
|
||||
SRC_URI_append_ccimx6 = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), 'file://preinstall_swu.sh', '')}"
|
||||
SRC_URI_append_ccimx6ul = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', 'file://preinstall_swu.sh')}"
|
||||
|
||||
inherit swupdate
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE
|
|||
PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );"
|
||||
PREINST_SCRIPT_DESC = ""
|
||||
PREINST_SCRIPT_DESC_ccimx6sbc = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}"
|
||||
PREINST_SCRIPT_DESC_ccimx6ul = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', '${PREINST_SCRIPT_TEMPLATE}')}"
|
||||
|
||||
python () {
|
||||
img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
#!/bin/sh
|
||||
#===============================================================================
|
||||
#
|
||||
# pre-install_swu.sh
|
||||
#
|
||||
# Copyright (C) 2017 by Digi International Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
#
|
||||
# !Description: SWUpdate pre-install script to remove the encryption flag from
|
||||
# rootfs
|
||||
#
|
||||
# SWUpdate calls this script before installing the image.
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
# Variables.
|
||||
#------------------------------------------------------------------------------
|
||||
ENV_MTDPARTS="mtdparts"
|
||||
|
||||
# Functions.
|
||||
#------------------------------------------------------------------------------
|
||||
# Function - psplash_message
|
||||
#
|
||||
# Shows the given message in the psplash screen.
|
||||
#
|
||||
# @param ${1} - Message to show.
|
||||
#------------------------------------------------------------------------------
|
||||
psplash_message() {
|
||||
echo "MSG ${1}" > /tmp/psplash_fifo
|
||||
sleep 0.2
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function - psplash_progress
|
||||
#
|
||||
# Sets the psplash progress bar percentage to the given one.
|
||||
#
|
||||
# @param ${1} - Progress percentage.
|
||||
#------------------------------------------------------------------------------
|
||||
psplash_progress() {
|
||||
echo "PROGRESS ${1}" > /tmp/psplash_fifo
|
||||
sleep 0.2
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function - log
|
||||
#
|
||||
# Prints the given text in the console.
|
||||
#
|
||||
# @param ${1} - Text to print.
|
||||
#------------------------------------------------------------------------------
|
||||
log() {
|
||||
echo "[FW UPDATE] ${1}"
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function - log_error
|
||||
#
|
||||
# Prints the given text in the console as an error.
|
||||
#
|
||||
# @param ${1} - Error text to print.
|
||||
#------------------------------------------------------------------------------
|
||||
log_error() {
|
||||
log "[ERROR] ${1}"
|
||||
psplash_message "ERROR: ${1}"
|
||||
psplash_progress "0"
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function - read_uboot_var
|
||||
#
|
||||
# Reads the given U-Boot variable.
|
||||
#
|
||||
# @param ${1} - U-Boot variable to read.
|
||||
# @param ${2} - Where to store the value of the read variable.
|
||||
#------------------------------------------------------------------------------
|
||||
read_uboot_var() {
|
||||
eval "${2}=\"$(fw_printenv -n ${1} 2>/dev/null)\""
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function - set_uboot_var
|
||||
#
|
||||
# Sets the given U-Boot variable.
|
||||
#
|
||||
# @param ${1} - U-Boot variable to set.
|
||||
# @param ${2} - Value to set.
|
||||
#------------------------------------------------------------------------------
|
||||
set_uboot_var() {
|
||||
fw_setenv ${1} ${2} 2>/dev/null
|
||||
}
|
||||
|
||||
# Main
|
||||
#------------------------------------------------------------------------------
|
||||
# Read the mtdparts variable.
|
||||
read_uboot_var "${ENV_MTDPARTS}" MTDPARTS
|
||||
|
||||
# Check if there is any command.
|
||||
if [ -z "${MTDPARTS}" ]; then
|
||||
log_error "No mtdparts found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse the mtdparts value.
|
||||
case "${MTDPARTS}" in
|
||||
*\(rootfs\)enc*)
|
||||
# Remove the flag from the rootfs partition.
|
||||
NEW_MTDPARTS=$(echo "${MTDPARTS}" | sed -e "s/(rootfs)enc/(rootfs)/g")
|
||||
set_uboot_var "${ENV_MTDPARTS}" "${NEW_MTDPARTS}"
|
||||
sync && reboot -f
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
|
||||
|
|
@ -16,4 +16,5 @@ software =
|
|||
sha256 = "@##ROOTIMG_NAME##";
|
||||
}
|
||||
);
|
||||
##PREINSTALL_SCRIPT##
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue