diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2024-03-21 14:00:53 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2024-03-21 15:29:56 +0900 |
commit | 10e3d70a819b846749d5ba8c1bc65ab75c51bf5a (patch) | |
tree | 4e676a77d9b879875ebb642f71e4873336bcf5f7 | |
parent | 8f78bf12c0eba95ebb203868856899fdcec2935c (diff) | |
download | u-boot-10e3d70a819b846749d5ba8c1bc65ab75c51bf5a.tar.gz u-boot-10e3d70a819b846749d5ba8c1bc65ab75c51bf5a.tar.bz2 u-boot-10e3d70a819b846749d5ba8c1bc65ab75c51bf5a.zip |
tizen: bootscript: Use set bootmode also for cpio initramfsaccepted/tizen/unified/x/20240326.073311accepted/tizen/unified/20240322.174326
When using initramfs, bootmode should be used as it is set,
instead of 'normal'. So, also for cpio initramfs case, use set
bootmode.
Also, adjust script flow to check ramdisk/initramfs only once.
Change-Id: Iac90ee47a8e9f8a89fdd812f7b78bc5f43048198
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
-rw-r--r-- | tizen/bootscript/tizen-boot-amlogic-64b.scr | 43 | ||||
-rw-r--r-- | tizen/bootscript/tizen-boot-rpi4.scr | 51 | ||||
-rw-r--r-- | tizen/bootscript/tizen-boot-vf2.scr | 70 |
3 files changed, 80 insertions, 84 deletions
diff --git a/tizen/bootscript/tizen-boot-amlogic-64b.scr b/tizen/bootscript/tizen-boot-amlogic-64b.scr index 5598128f66..2b159d69c6 100644 --- a/tizen/bootscript/tizen-boot-amlogic-64b.scr +++ b/tizen/bootscript/tizen-boot-amlogic-64b.scr @@ -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 diff --git a/tizen/bootscript/tizen-boot-rpi4.scr b/tizen/bootscript/tizen-boot-rpi4.scr index b609554289..6d0f6a4c3a 100644 --- a/tizen/bootscript/tizen-boot-rpi4.scr +++ b/tizen/bootscript/tizen-boot-rpi4.scr @@ -70,19 +70,6 @@ else setenv ramdiskpart ${partition_fallback} fi -# boot from ram0 if there is sbin -if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then; - setenv rootdev ram0 -else - if test "${bootdev}" = "mmc"; then; - setenv rootdev mmcblk${mmcrootdev}p${mmcrootpart} - fi - if test "${bootdev}" = "usb"; then; - setenv rootdev sda${mmcrootpart} - fi - setenv bootmode normal -fi - # setting console device if noting is set if test -z "${console}"; then; if test "$board_name" = "5 Model B"; then; @@ -102,9 +89,6 @@ echo "console: ${console}" # DT image by model setenv boot_prefixes \"/\" -# To use cmdline for using serial console. /* Normal mode */ -setenv bootargs \"${tizen_bootarg} cgroup_enable=memory root=/dev/${rootdev} rw bootmode=${bootmode} partition_ab=${partition_ab} rootwait ${console} ${opts} ${ip_opt}\" - # Find the ramdisk offset and block count part start $bootdev $mmcrootdev $ramdiskpart ramdisk_start part size $bootdev $mmcrootdev $ramdiskpart ramdisk_size @@ -113,20 +97,35 @@ part size $bootdev $mmcrootdev $ramdiskpart ramdisk_size setexpr ramdisksize $ramdisk_size * 200 setexpr tizen_kernel_addr_r $ramdisk_addr_r + $ramdisksize -echo "Searching for kernel in"; for prefix in $boot_prefixes; do -if load $bootdev $mmcbootdev:$mmcbootpart $tizen_kernel_addr_r $prefix$kernel; then; - echo ${bootmode} "boot"; - if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then; - echo "Loading Ramdisk from partition ${ramdiskpart}"; +# 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}"; + $bootdev read $ramdisk_addr_r $ramdisk_start $ramdisk_size; +else + # Check for gzip (initramfs) magic + $bootdev read $ramdisk_addr_r $ramdisk_start 1; + if itest.w *$ramdisk_addr_r == 0x8b1f; then; + setenv rootdev ram0 + echo "Loading initramfs from partition ${ramdiskpart}"; $bootdev read $ramdisk_addr_r $ramdisk_start $ramdisk_size; else - # Check for gzip (initramfs) magic - $bootdev read $ramdisk_addr_r $ramdisk_start 1; - if itest.w *$ramdisk_addr_r == 0x8b1f; then; - echo "Loading initramfs from partition ${ramdiskpart}"; - $bootdev read $ramdisk_addr_r $ramdisk_start $ramdisk_size; + if test "${bootdev}" = "mmc"; then; + setenv rootdev mmcblk${mmcrootdev}p${mmcrootpart} fi + if test "${bootdev}" = "usb"; then; + setenv rootdev sda${mmcrootpart} + fi + setenv bootmode normal fi +fi + +# To use cmdline for using serial console. /* Normal mode */ +setenv bootargs \"${tizen_bootarg} cgroup_enable=memory root=/dev/${rootdev} rw bootmode=${bootmode} partition_ab=${partition_ab} rootwait ${console} ${opts} ${ip_opt}\" + +echo "Searching for kernel in"; for prefix in $boot_prefixes; do +if load $bootdev $mmcbootdev:$mmcbootpart $tizen_kernel_addr_r $prefix$kernel; then; + echo ${bootmode} "boot"; # use fdt already preloaded by the firmware available at $fdt_addr if test "$kernel" = "zImage"; then; diff --git a/tizen/bootscript/tizen-boot-vf2.scr b/tizen/bootscript/tizen-boot-vf2.scr index 1db55e14fb..6cbe0f70e4 100644 --- a/tizen/bootscript/tizen-boot-vf2.scr +++ b/tizen/bootscript/tizen-boot-vf2.scr @@ -91,25 +91,6 @@ if test "${bootmode}" = "flash"; then; fi fi -# boot from ramdisk if there is sbin -if test -e $devtype $devnum:$ramdiskpart sbin/init; then; - setenv rootdev ram0 -else - if test "${devtype}" = "mmc"; then; - setenv rootdev mmcblk${devnum}p${rootpart} - fi - if test "${devtype}" = "usb"; then; - setenv rootdev sda${rootpart} - fi - if test "${devtype}" = "nvme"; then; - setenv rootdev nvme0n1p${rootpart} - fi - if test "${devtype}" = "virtio"; then; - setenv rootdev vda${rootpart} - fi - setenv bootmode normal -fi - # setting console device if noting is set if test -z "${console}"; then; setenv console "console=ttyS0,115200 earlycon" @@ -128,9 +109,6 @@ fi setenv boot_prefixes \"/\" -# To use cmdline for using serial console. /* Normal mode */ -setenv bootargs \"${tizen_bootarg} root=/dev/${rootdev} rw bootmode=${bootmode} partition_ab=${partition_ab} rootwait ${console} ${opts} ${ip_opt} stmmaceth=chain_mode:1\" - # Find the ramdisk offset and block count part start $devtype $devnum $ramdiskpart ramdisk_start part size $devtype $devnum $ramdiskpart ramdisk_size @@ -139,25 +117,45 @@ part size $devtype $devnum $ramdiskpart ramdisk_size setexpr ramdisksize $ramdisk_size * 200 setexpr tizen_kernel_addr_r $ramdisk_addr_r + $ramdisksize -echo "Searching for kernel in"; for prefix in $boot_prefixes; do -if load $devtype $devnum:$distro_bootpart $tizen_kernel_addr_r $prefix$kernel; then; - echo ${bootmode} "boot"; - - if test -e $devtype $devnum:$ramdiskpart sbin/init; then; - echo "Loading Ramdisk from partition" ${part}; +# boot from ramdisk if there is sbin or it is initramfs +if test -e $devtype $devnum:$ramdiskpart sbin/init; then; + setenv rootdev ram0 + echo "Loading Ramdisk from partition" ${part}; + echo "Environment value of ramdiskpart is" ${ramdiskpart}; + $devtype dev $devnum + $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size; +else + # Check for gzip (initramfs) magic + $devtype dev $devnum; + $devtype read $ramdisk_addr_r $ramdisk_start 1; + if itest.w *$ramdisk_addr_r == 0x8b1f; then; + setenv rootdev ram0 + echo "Loading initramfs from partition ${part}"; echo "Environment value of ramdiskpart is" ${ramdiskpart}; - $devtype dev $devnum $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size; else - # Check for gzip (initramfs) magic - $devtype dev $devnum; - $devtype read $ramdisk_addr_r $ramdisk_start 1; - if itest.w *$ramdisk_addr_r == 0x8b1f; then; - echo "Loading initramfs from partition ${part}"; - echo "Environment value of ramdiskpart is" ${ramdiskpart}; - $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size; + if test "${devtype}" = "mmc"; then; + setenv rootdev mmcblk${devnum}p${rootpart} fi + if test "${devtype}" = "usb"; then; + setenv rootdev sda${rootpart} + fi + if test "${devtype}" = "nvme"; then; + setenv rootdev nvme0n1p${rootpart} + fi + if test "${devtype}" = "virtio"; then; + setenv rootdev vda${rootpart} + fi + setenv bootmode normal fi +fi + +# To use cmdline for using serial console. /* Normal mode */ +setenv bootargs \"${tizen_bootarg} root=/dev/${rootdev} rw bootmode=${bootmode} partition_ab=${partition_ab} rootwait ${console} ${opts} ${ip_opt} stmmaceth=chain_mode:1\" + +echo "Searching for kernel in"; for prefix in $boot_prefixes; do +if load $devtype $devnum:$distro_bootpart $tizen_kernel_addr_r $prefix$kernel; then; + echo ${bootmode} "boot"; if test "${board_name}" = "qemu-riscv"; then # If running in QEMU use the DeviceTree provided by |