rpi: tizen-boot: check reboot parameter to determine booting mode
authorJunghoon Kim <jhoon20.kim@samsung.com>
Tue, 25 Jul 2017 06:36:18 +0000 (15:36 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 20 Oct 2020 01:35:22 +0000 (10:35 +0900)
The "reboot-param.bin" file is used for passing reboot parameter. For
example, the word "upgr" means that target should be booted with upgrade
mode.

Check the contents of "reboot-param.bin" file to determine booting mode.

Change-Id: I62a6598f84c677c251df3559da9dd58a545e859c
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
board/raspberrypi/rpi/tizen-boot.scr

index daa0a44..89c1f55 100644 (file)
@@ -4,10 +4,16 @@ mmcbootdev=0
 mmcbootpart=1
 mmcrootdev=0
 mmcrootpart=2
-mmcusrpart=5
+mmcinformpart=9
 
 dummy=0x24000000
-fotaname=fota
+rebootparamfile=reboot-param.bin
+# use the ram address of ramdisk before loading ramdisk image
+rebootparam_addr=0x3a62b000
+# 0x72677075 is ascii code for representing string "upgr"
+upgrade_val=72677075
+# 0x6d726f6e is ascii code for representing string "norm"
+normal_val=6d726f6e
 
 ramdisksize=800000
 
@@ -18,12 +24,22 @@ ramdiskdev=0
 # Device that included the image.
 bootdev=mmc
 
-if test -e $bootdev $mmcbootdev:$mmcusrpart $fotaname; then;
-ramdiskpart=8
-bootmode=fota
+if test -e $bootdev $mmcbootdev:$mmcinformpart $rebootparamfile; then;
+       ext4load $bootdev $mmcbootdev:$mmcinformpart $rebootparam_addr $rebootparamfile;
+       if itest.l *${rebootparam_addr} == ${upgrade_val}; then;
+               ramdiskpart=8
+               bootmode=upgrade
+       elif itest.l *${rebootparam_addr} == ${normal_val}; then;
+               ramdiskpart=7
+               bootmode=ramdisk
+       else
+               echo "This reboot parameter is not supported...";
+               ramdiskpart=7
+               bootmode=ramdisk
+       fi
 else
-ramdiskpart=7
-bootmode=ramdisk
+       ramdiskpart=7
+       bootmode=ramdisk
 fi
 
 # boot from ram0 if there is sbin