samsung: platform_boot: add ramdisk booting about autoboot
authorJaehoon Chung <jh80.chung@samsung.com>
Thu, 9 Feb 2017 10:06:39 +0000 (19:06 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 20 Oct 2020 01:35:21 +0000 (10:35 +0900)
If it needs to boot from ramdisk, root device must be /dev/ram0.
But current root device is hard-coding as /dev/mmcblk0p2.

When there is ramdisk image, set to root=/dev/ram0.
Otherwise maintain the current root device(root=/dev/mmcblk0p2).

After this patch, tizen can use the raw ramdisk image without any
converting.

This patch is also maintaining backward compatibility about not using
ramdisk.

Change-Id: I5463cfc8067cfe2f7c591ba689269c8d8ea51a0c
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
include/configs/odroid_xu3.h
include/samsung/platform_boot.h

index 94ae77c..56f5ce0 100644 (file)
@@ -60,6 +60,7 @@
        "zImage fat 0 1;"                   \
        "Image.itb fat 0 1;"                \
        "uInitrd fat 0 1;"                  \
+       "ramdisk.img fat 0 1;"              \
        "boot.scr fat 0 1;"                 \
        "boot.cmd fat 0 1;"                 \
        "exynos5422-odroidxu3.dtb fat 0 1;" \
index 17ec079..996b80c 100644 (file)
 #define PLATFORM_BOOT_INFO \
        "initrdname=uInitrd\0" \
        "initrdaddr=42000000\0" \
+       "initrdsize=800000\0" \
        "fdtaddr=40800000\0" \
+       "root_dev=/dev/mmcblk${mmcrootdev}p${mmcrootpart}\0" \
+       "root_device=setenv root_dev /dev/mmcblk${mmcrootdev}p${mmcrootpart}\0" \
        "loadkernel=load mmc ${mmcbootdev}:${mmcbootpart} ${kerneladdr} " \
                "${kernelname}\0" \
-       "loadinitrd=load mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} " \
-               "${initrdname}\0" \
+       "loadinitrd=" \
+               "if test -e mmc ${mmcbootdev}:${mmcbootpart} ramdisk.img; then " \
+                       "setenv initrdname ramdisk.img;" \
+                       "load mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} " \
+                       "${initrdname};" \
+               "else " \
+                       "load mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} " \
+                       "${initrdname};" \
+               "fi;\0" \
        "loaddtb=load mmc ${mmcbootdev}:${mmcbootpart} ${fdtaddr} " \
                "${fdtfile}\0" \
        "check_ramdisk=" \
                "if run loadinitrd; then " \
-                       "setenv initrd_addr ${initrdaddr};" \
+                       "setenv initrd_addr ${initrdaddr}:${initrdsize}; " \
+                       "setenv root_dev /dev/ram0 rw;" \
                "else " \
                        "setenv initrd_addr -;" \
                "fi;\0" \
@@ -43,7 +54,7 @@
                        "setenv fdt_addr;" \
                "fi;\0" \
        "kernel_args=" \
-               "setenv bootargs root=/dev/mmcblk${mmcrootdev}p${mmcrootpart}" \
+               "setenv bootargs root=${root_dev}" \
                " rootfstype=${rootfstype} rootwait ${console} ${opts}\0" \
        "boot_fit=" \
                "setenv kerneladdr 0x42000000;" \
@@ -69,6 +80,7 @@
                "bootz ${kerneladdr} ${initrd_addr} ${fdt_addr};\0" \
        "autoboot=" \
                "run checkboard;" \
+               "run root_device;" \
                "if test -e mmc 0:${mmcbootpart} Image.itb; then; " \
                        "run boot_fit;" \
                "elif test -e mmc 0:${mmcbootpart} zImage; then; " \