From b5bd17fa11f2778060ed3ace9d2334f05a469a81 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Fri, 1 Mar 2024 11:14:52 +0100 Subject: [PATCH] tizen: bootscript: add support for loading initramfs from ramdisk partition If initrd-style ramdisk is not detected (no filesystem nor /sbin/init file found), then check ramdisk partition for the gzip magic value and if detected, load it as initramfs image. Signed-off-by: Marek Szyprowski Change-Id: I17933632635b0c20cf672c2484cd714c3739d760 --- tizen/bootscript/tizen-boot-amlogic-64b.scr | 7 +++++++ tizen/bootscript/tizen-boot-rpi4.scr | 7 +++++++ tizen/bootscript/tizen-boot-vf2.scr | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/tizen/bootscript/tizen-boot-amlogic-64b.scr b/tizen/bootscript/tizen-boot-amlogic-64b.scr index 051bd6a..5598128 100644 --- a/tizen/bootscript/tizen-boot-amlogic-64b.scr +++ b/tizen/bootscript/tizen-boot-amlogic-64b.scr @@ -117,6 +117,13 @@ if load $bootdev $mmcbootdev:$mmcbootpart $tizen_tmp_kernel_addr_r $prefix$kerne 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 diff --git a/tizen/bootscript/tizen-boot-rpi4.scr b/tizen/bootscript/tizen-boot-rpi4.scr index d2bb38b..b609554 100644 --- a/tizen/bootscript/tizen-boot-rpi4.scr +++ b/tizen/bootscript/tizen-boot-rpi4.scr @@ -119,6 +119,13 @@ if load $bootdev $mmcbootdev:$mmcbootpart $tizen_kernel_addr_r $prefix$kernel; t if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then; 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; + echo "Loading initramfs from partition ${ramdiskpart}"; + $bootdev read $ramdisk_addr_r $ramdisk_start $ramdisk_size; + fi fi # use fdt already preloaded by the firmware available at $fdt_addr diff --git a/tizen/bootscript/tizen-boot-vf2.scr b/tizen/bootscript/tizen-boot-vf2.scr index a4926c2..1db55e1 100644 --- a/tizen/bootscript/tizen-boot-vf2.scr +++ b/tizen/bootscript/tizen-boot-vf2.scr @@ -148,6 +148,15 @@ if load $devtype $devnum:$distro_bootpart $tizen_kernel_addr_r $prefix$kernel; t 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; + fi fi if test "${board_name}" = "qemu-riscv"; then -- 2.7.4