From af42f5bbac929cffbd002c439d9373b7f8ee847c Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Wed, 7 Mar 2018 15:51:14 +0100 Subject: [PATCH] sw-update: fix nrhw20 support --- .../sw-update/am335x-nrhw20/sw_update_config | 5 +++-- recipes-core/sw-update/sw-update/sw-update.sh | 11 ++++++++--- recipes-core/sw-update/sw-update/sw_update_config | 5 +++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/recipes-core/sw-update/sw-update/am335x-nrhw20/sw_update_config b/recipes-core/sw-update/sw-update/am335x-nrhw20/sw_update_config index 207f79a..2f4e06d 100644 --- a/recipes-core/sw-update/sw-update/am335x-nrhw20/sw_update_config +++ b/recipes-core/sw-update/sw-update/am335x-nrhw20/sw_update_config @@ -1,5 +1,6 @@ -PLATFORM_FIRST_PARTITION="/dev/mmcblk1p1" -PLATFORM_SECOND_PARTITION="/dev/mmcblk1p2" +PLATFORM_MAIN_STORAGE="/dev/mmcblk1" +PLATFORM_FIRST_PARTITION=$PLATFORM_MAIN_STORAGE"p1" +PLATFORM_SECOND_PARTITION=$PLATFORM_MAIN_STORAGE"p2" PLATFORM_PROD_COMPATIBILITY= PLATFORM_HW_VERSION= get_active_partition() diff --git a/recipes-core/sw-update/sw-update/sw-update.sh b/recipes-core/sw-update/sw-update/sw-update.sh index 34ffd81..94314b7 100755 --- a/recipes-core/sw-update/sw-update/sw-update.sh +++ b/recipes-core/sw-update/sw-update/sw-update.sh @@ -247,7 +247,7 @@ update_uboot() return fi - dd if=$1 of=/dev/mmcblk0 bs=512 seek=768 &> /dev/null + dd if=$1 of=$PLATFORM_MAIN_STORAGE bs=512 seek=768 &> /dev/null if [ $? -ne 0 ]; then log ERROR "Failed to write u-boot to mmcblk0" return @@ -267,9 +267,9 @@ update_spl() return fi - dd if=$1 of=/dev/mmcblk0 bs=512 seek=256 &> /dev/null + dd if=$1 of=/dev/$PLATFORM_MAIN_STORAGE bs=512 seek=256 &> /dev/null if [ $? -ne 0 ]; then - log ERROR "Failed to write spl to mmcblk0" + log ERROR "Failed to write spl to $PLATFORM_MAIN_STORAGE" return fi log INFO "spl update succeed!" @@ -277,6 +277,11 @@ update_spl() ############################ Start of script ################################### +if [ ! -b $PLATFORM_MAIN_STORAGE ]; then + log ERROR "Storage $PLATFORM_MAIN_STORAGE does not exist, please fix /etc/default/sw_update_config" + exit 1 +fi + while getopts ":l:u:s:h" opt; do case $opt in l) diff --git a/recipes-core/sw-update/sw-update/sw_update_config b/recipes-core/sw-update/sw-update/sw_update_config index fdf8609..64a84c9 100644 --- a/recipes-core/sw-update/sw-update/sw_update_config +++ b/recipes-core/sw-update/sw-update/sw_update_config @@ -1,5 +1,6 @@ -PLATFORM_FIRST_PARTITION="/dev/mmcblk0p1" -PLATFORM_SECOND_PARTITION="/dev/mmcblk0p2" +PLATFORM_MAIN_STORAGE="/dev/mmcblk0" +PLATFORM_FIRST_PARTITION=$PLATFORM_MAIN_STORAGE"p1" +PLATFORM_SECOND_PARTITION=$PLATFORM_MAIN_STORAGE"p2" PLATFORM_PROD_COMPATIBILITY= PLATFORM_HW_VERSION= get_active_partition()