Print booting information in /proc/cmdline, change function name 61/271961/1
authorSangYoun Kwak <sy.kwak@samsung.com>
Thu, 3 Mar 2022 08:28:42 +0000 (17:28 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Fri, 4 Mar 2022 01:34:57 +0000 (01:34 +0000)
print example
: [fota-init.sh][Info] Initrd-fota booting (/proc/cmdline bootmode=fota partition_ab=a root=/dev/mmcblk1p60)

Change-Id: Ic37dbced7ae60fb5922ca15d8e2aee04a97db70d
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
scripts/fota-init.sh

index b3c972b..00554da 100755 (executable)
@@ -591,9 +591,9 @@ do_fota_update() {
 }
 
 #------------------------------------------------
-#      init_internal_log
+#      clear_internal_log
 #------------------------------------------------
-init_internal_log() {
+clear_internal_log() {
 
        if [ -e "${INT_LOG_FILE}" ]; then
                /bin/rm -fr "${INT_LOG_FILE}"
@@ -747,6 +747,16 @@ prepare_fakeroot() {
 }
 
 #------------------------------------------------
+#      log boot info
+#------------------------------------------------
+function log_boot_info() {
+    CMDLINE_ROOT=$([[ $(</proc/cmdline) =~ (root=[^ ]*) ]]; echo ${BASH_REMATCH[1]})
+    CMDLINE_PARTITION_AB=$([[ $(</proc/cmdline) =~ (partition_ab=[ab]) ]]; echo ${BASH_REMATCH[1]})
+    CMDLINE_BOOTMODE=$([[ $(</proc/cmdline) =~ (bootmode=[^ ]*) ]]; echo ${BASH_REMATCH[1]})
+    log "[Info] Initrd-fota booting (/proc/cmdline $CMDLINE_BOOTMODE $CMDLINE_PARTITION_AB $CMDLINE_ROOT)"
+}
+
+#------------------------------------------------
 #      Main Routine Start
 #------------------------------------------------
 
@@ -759,6 +769,8 @@ if ! mount_partitions ; then
        do_reboot
 fi
 
+log_boot_info
+
 if [ "${P_SLOT}" != "" ]
 then
        log "[Info] FOTA with A/B detected - skip RO update"
@@ -773,7 +785,7 @@ fi
 
 check_debug_mode
 
-init_internal_log
+clear_internal_log
 
 check_for_rw_power_fail