From: Marek Szyprowski Date: Mon, 7 Oct 2024 14:40:28 +0000 (+0200) Subject: tizen: bootscript: amlogic: unpack initramfs and pass its actual size to kernel X-Git-Tag: accepted/tizen/unified/20241126.175211~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ca040041eb8660ed39c56cca5f6cdff043be0fc;p=platform%2Fkernel%2Fu-boot.git tizen: bootscript: amlogic: unpack initramfs and pass its actual size to kernel The initramfs ramdisk image (CPIO compressed archive) is stored on the separate ramdisk/ramdisk-recovery partitions, thus it is not possible to determine size of the compresszed archive. Passing the size of the partition as the size of initramfs image to the kernel instructs the kernel to check if the remaining bytes are another CPIO archive with more initramfs data. Decompressing or interpreting such additional garbage bytes sometimes fails, what results in kernel ignoring the whole initramfs data as broken one and thus breaking the Tizen boot sequence. To avoid such problems and dependency on unknown/garbage data from ramdisk partitions, lets decompres initramfs data (CPIO gzip archive) directly in u-boot and pass the kernel only the single, uncompressed CPIO archive as iniramfs image. In case of Amlogic based boards boot script, kernel load address has to be recalculated and adjusted to next the 4k page boundary. Signed-off-by: Marek Szyprowski Change-Id: I2b1a6e46237ad2de37154154b2a50959aacfa1a1 --- diff --git a/tizen/bootscript/tizen-boot-amlogic-64b.scr b/tizen/bootscript/tizen-boot-amlogic-64b.scr index 2b159d69c6..aa61c37b59 100644 --- a/tizen/bootscript/tizen-boot-amlogic-64b.scr +++ b/tizen/bootscript/tizen-boot-amlogic-64b.scr @@ -109,6 +109,16 @@ else setenv rootdev ram0 echo "Loading initramfs from partition ${ramdiskpart}"; mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size; + setexpr ramdisk2_addr_r $ramdisk_addr_r + $ramdisksize + unzip $ramdisk_addr_r $ramdisk2_addr_r + setenv ramdisksize $filesize + setenv ramdisk_addr_r $ramdisk2_addr_r + setexpr tizen_kernel_addr_r $ramdisk_addr_r + $ramdisksize + + # Round tizen_kernel_addr_r to the next 4k page boundary + setexpr tizen_kernel_addr_r $tizen_kernel_addr_r / 0x1000 + setexpr tizen_kernel_addr_r $tizen_kernel_addr_r + 1 + setexpr tizen_kernel_addr_r $tizen_kernel_addr_r * 0x1000 else setenv rootdev mmcblk${mmcrootdev}p${mmcrootpart} setenv bootmode normal