Enter debug mode before RW mount 30/246030/1
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 14 Oct 2020 08:41:42 +0000 (17:41 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Thu, 22 Oct 2020 05:35:02 +0000 (14:35 +0900)
- Remounting modifies superblock
  - If dm-verity is applied, it causes kernel panic

Change-Id: I8c003dda95d1a926ad2fa6020b69cf3c51c99d06
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
scripts/fota-init.sh

index f1c4216..06bea9d 100755 (executable)
@@ -168,21 +168,6 @@ do_fota_update() {
                echo "Warning: No signature verifier... Skip it" >> ${INT_LOG_FILE}
        fi
 
-       DEBUG_MODE_FILE=${FAKE_ROOT}/opt/usr/.upgdebug_ro
-       if [ -f ${DEBUG_MODE_FILE} ]; then
-               DEBUG_MODE_FILE_OWNER=$(${LS} -l ${DEBUG_MODE_FILE} | ${CUT} -d " " -f 3)
-               if [ "${DEBUG_MODE_FILE_OWNER}" = "0" ]; then
-                       echo "Enter RO debug mode"
-                       echo "If you want to continue FOTA, please remove ${DEBUG_MODE_FILE}"
-                       # Wait until debug mode file is removed
-                       while [ -f ${DEBUG_MODE_FILE} ]; do
-                               sleep 3
-                       done
-               else
-                       echo "Warning: somebody make non-root debug mode file... ignore it"
-               fi
-       fi
-
        if [ "$FOTA_GUI_ENABLE" = "1" ]; then
                ${UA} ${DELTA_DIR} ${FOTA_TEMP_DIR} 0
        else
@@ -279,6 +264,26 @@ check_for_fota_gui() {
        fi
 }
 
+#------------------------------------------------
+#      check_debug_mode
+#------------------------------------------------
+check_debug_mode() {
+       DEBUG_MODE_FILE=${FAKE_ROOT}/opt/usr/.upgdebug_ro
+       if [ -f ${DEBUG_MODE_FILE} ]; then
+               DEBUG_MODE_FILE_OWNER=$(${LS} -l ${DEBUG_MODE_FILE} | ${CUT} -d " " -f 3)
+               if [ "${DEBUG_MODE_FILE_OWNER}" = "0" ]; then
+                       echo "Enter RO debug mode"
+                       echo "If you want to continue FOTA, please remove ${DEBUG_MODE_FILE}"
+                       # Wait until debug mode file is removed
+                       while [ -f ${DEBUG_MODE_FILE} ]; do
+                               sleep 3
+                       done
+                       echo "Debug mode file is removed. Resume FOTA"
+               else
+                       echo "Warning: somebody make non-root debug mode file... ignore it"
+               fi
+       fi
+}
 
 #------------------------------------------------
 #      Main Routine Start
@@ -289,6 +294,8 @@ mount_partitions
 # For debugging - It should be deleted on Release
 /sbin/agetty -l /bin/bash -n --keep-baud 115200,38400,9600 console linux &
 
+check_debug_mode
+
 init_internal_log
 
 check_for_rw_power_fail