rpi: tizen-boot: support the booting without ramdisk image 03/136203/2 accepted/tizen/unified/20170705.162346 submit/tizen/20170705.011711 submit/tizen/20170705.015412
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 28 Jun 2017 11:46:00 +0000 (20:46 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 4 Jul 2017 02:54:32 +0000 (11:54 +0900)
If there is not ramdisk image, target can't be booted.
This modification is supported that target can be booted anyway.

NOTE: Assume that ramdisk partition has "sbin".
If want to mount the MMC device, you have to clear the ramdisk
partition.

Change-Id: Ibae4fd7216d0aa7ca11e92842c099dfc5212b714
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
board/raspberrypi/rpi/tizen-boot.scr

index 4475d58..5b7453e 100644 (file)
@@ -23,11 +23,16 @@ ramdiskpart=8
 bootmode=fota
 else
 ramdiskpart=7
-bootmode=normal
+bootmode=ramdisk
 fi
 
-# Device for booting from ram0
-bootramdev=ram0
+# boot from ram0 if there is sbin
+if test -e $bootdev $mmcrootdev:$ramdiskpart sbin; then;
+rootdev=ram0
+else
+rootdev=mmcblk${mmcrootdev}p${mmcrootpart}
+bootmode=normal
+fi
 
 # Kernel image
 kernel=Image
@@ -35,7 +40,7 @@ setenv fdtfile \"bcm2710-rpi-3-b.dtb\"
 setenv boot_prefixes \"/\"
 
 # To use comdline for using serial console. /* Normal mode */
-setenv bootargs \"8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2709.serial=0xed6687d3 bcm2709.uart_clock=48000000 root=/dev/${bootramdev} rw bootmode=${bootmode} bcm2709.boardrev=0xa02082 rootwait earlyprintk console=ttyS0,115200n8 console=tty1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000\"
+setenv bootargs \"8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2709.serial=0xed6687d3 bcm2709.uart_clock=48000000 root=/dev/${rootdev} rw bootmode=${bootmode} bcm2709.boardrev=0xa02082 rootwait earlyprintk console=ttyS0,115200n8 console=tty1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000\"
 
 # Find the ramdisk offset and block count
 part start $bootdev $ramdiskdev $ramdiskpart ramdisk_start
@@ -46,8 +51,10 @@ if load $bootdev $mmcbootdev:$mmcbootpart $kernel_addr_r $kernel; then;
        echo ${bootmode} "boot";
        load $bootdev $mmcbootdev:$mmcbootpart $fdt_addr_r $fdtfile;
        load $bootdev $mmcbootdev:$mmcbootpart $kernel_addr_r $prefix$kernel;
-       echo "Loading Ramdisk from partition"${ramdiskpart};
-       mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
+       if test -e mmc $mmcrootdev:$ramdiskpart sbin; then;
+               echo "Loading Ramdisk from partition"${ramdiskpart};
+               mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
+       fi
        booti $kernel_addr_r $ramdisk_addr_r:$ramdisksize $fdt_addr_r;
 fi
 done