tizen: bootscript: Use set bootmode also for cpio initramfs
[platform/kernel/u-boot.git] / tizen / bootscript / tizen-boot-amlogic-64b.scr
index 5598128..2b159d6 100644 (file)
@@ -74,14 +74,6 @@ if test "${reason}" = "recovery"; then;
        setenv bootmode recovery
 fi
 
-# boot from ram0 if there is sbin
-if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then;
-       setenv rootdev ram0
-else
-       setenv rootdev mmcblk${mmcrootdev}p${mmcrootpart}
-       setenv bootmode normal
-fi
-
 if test -e $bootdev $mmcbootdev:$mmcbootpart $fdtfile2; then;
        setenv console console=ttyAML0,115200n8 earlycon
        setenv fdtfile $fdtfile2
@@ -97,9 +89,6 @@ echo "console: ${console}"
 # Kernel image
 kernel=Image.gz
 
-# To use comdline for using serial console. /* Normal mode */
-setenv bootargs \"root=/dev/${rootdev} rootwait rw no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs ${cmode} usb-xhci.tablesize=2 logo=osd0,loaded ${console} ${boot_args} ${opts}\"
-
 # Find the ramdisk offset and block count
 part start $bootdev $mmcrootdev $ramdiskpart ramdisk_start
 part size $bootdev $mmcrootdev $ramdiskpart ramdisk_size
@@ -108,23 +97,33 @@ part size $bootdev $mmcrootdev $ramdiskpart ramdisk_size
 setexpr ramdisksize $ramdisk_size * 200
 setexpr tizen_kernel_addr_r $ramdisk_addr_r + $ramdisksize
 
+# boot from ram0 if there is sbin or it is initramfs
+if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then;
+       setenv rootdev ram0
+       echo "Loading Ramdisk from partition"${ramdiskpart};
+       mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
+else
+       # Check for gzip (initramfs) magic
+       mmc read $ramdisk_addr_r $ramdisk_start 1;
+       if itest.w *$ramdisk_addr_r == 0x8b1f; then;
+               setenv rootdev ram0
+               echo "Loading initramfs from partition ${ramdiskpart}";
+               mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
+       else
+               setenv rootdev mmcblk${mmcrootdev}p${mmcrootpart}
+               setenv bootmode normal
+       fi
+fi
+
+# To use comdline for using serial console. /* Normal mode */
+setenv bootargs \"root=/dev/${rootdev} rootwait rw no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs ${cmode} usb-xhci.tablesize=2 logo=osd0,loaded ${console} ${boot_args} ${opts}\"
+
 echo "Searching for kernel in" $boot_prefixes; for prefix in $boot_prefixes; do
 if load $bootdev $mmcbootdev:$mmcbootpart $tizen_tmp_kernel_addr_r $prefix$kernel; then;
        echo ${bootmode} "boot";
        echo "Found kernel ${kernel} in ${prefix}";
        unzip ${tizen_tmp_kernel_addr_r} ${tizen_kernel_addr_r};
        load $bootdev $mmcbootdev:$mmcbootpart $fdt_addr_r $fdtfile;
-       if test -e mmc $mmcrootdev:$ramdiskpart sbin/init; then;
-               echo "Loading Ramdisk from partition"${ramdiskpart};
-               mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
-       else
-               # Check for gzip (initramfs) magic
-               mmc read $ramdisk_addr_r $ramdisk_start 1;
-               if itest.w *$ramdisk_addr_r == 0x8b1f; then;
-                       echo "Loading initramfs from partition ${ramdiskpart}";
-                       mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
-               fi
-       fi
        booti $tizen_kernel_addr_r $ramdisk_addr_r:$ramdisksize $fdt_addr_r;
 fi
 done