From dba8dbdab46ffaf136a87ad7590d3c0984f96e03 Mon Sep 17 00:00:00 2001 From: Tatiana Leon Date: Tue, 21 Mar 2023 17:55:59 +0100 Subject: [PATCH] dualboot: change the way to determine if device is using nand or emmc 'environment' partition is not available in the ccmp15. The solution suggested is read the "/proc/mounts" and check if the 'rootfs' is 'ubifs' mounted. Related to commits 7c07b15370715cdfe76bc68133a00d543eb3b122 and 678eaaf0fc4ce74e67682387e3465eb29659bd47 Signed-off-by: Tatiana Leon --- .../recipes-digi/dualboot/dualboot/dualboot-init | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init b/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init index 1e4337891..63dc75ba0 100644 --- a/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init +++ b/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2021 by Digi International Inc. +# Copyright (C) 2021-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -16,14 +16,16 @@ dualboot_init () { ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)" if [ -z "${ACTIVE_SYSTEM}" ]; then - if grep -qs environment /proc/mtd; then - MTD_BOOT_PART="$(fw_printenv -n mtdbootpart 2>/dev/null)" - fw_setenv active_system "${MTD_BOOT_PART}" - else + # Check if the rootfs is ubifs to determine if it is a nand or emmc device + NANDROOTFS="$(grep -qs '[[:blank:]]\+/[[:blank:]]\+ubifs.*' /proc/mounts 2>/dev/null && echo 1)" + if [ -z "${NANDROOTFS}" ]; then BOOT_PART="$(fw_printenv -n mmcpart 2>/dev/null)" BOOT_DEV="$(fw_printenv -n mmcbootdev 2>/dev/null)" CURRENT_PART="$(sed -ne 's,PARTNAME=,,g;T;p' /sys/class/block/mmcblk"${BOOT_DEV}"p"${BOOT_PART}"/uevent)" fw_setenv active_system "${CURRENT_PART}" + else + MTD_BOOT_PART="$(fw_printenv -n mtdbootpart 2>/dev/null)" + fw_setenv active_system "${MTD_BOOT_PART}" fi fi