Skip to content

Commit 22a841c

Browse files
committed
fastboot: merge initramfs archives via extract+repack (avoid cat)
The current initramfs merge logic concatenates cpio payloads using `cat`. Stream concatenation does not merge filesystem structure and can break early boot path/symlink resolution when firmware and symlinks are split across multiple archives. Replace the `cat` approach with an extract-into-one-dir + repack workflow when firmware_name is provided: - extract ramdisk into a staging rootfs - extract firmware archive into the same staging tree - repack as a single newc cpio.gz (preserving symlinks and hierarchy) If firmware_name is not provided, the template produces the merged output by renaming the original ramdisk artifact to merged-initramfs.cpio.gz. This improves reliability of /lib -> /usr/lib and /lib/firmware resolution during early boot and avoids firmware load failures. Signed-off-by: Tharun Kumar Merugu <mtharu@qti.qualcomm.com>
1 parent cce5324 commit 22a841c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

templates/boot/fastboot.jinja2

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,19 @@
2929
docker:
3030
image: ghcr.io/mwasilew/docker-mkbootimage:master
3131
steps:
32-
- gunzip -c {{ ramdisk_name }} > initramfs-kerneltest-full-image-qcom-armv8a.cpio
3332
{% if firmware_name %}
34-
- gunzip -c {{ firmware_name }} > initramfs-firmware-rb3gen2-image-qcom-armv8a.cpio
35-
- cat initramfs-kerneltest-full-image-qcom-armv8a.cpio initramfs-firmware-rb3gen2-image-qcom-armv8a.cpio > merged-initramfs.cpio
33+
- rm -rf rootfs
34+
- mkdir -p rootfs
35+
- cd rootfs
36+
- apt-get update -q && DEBIAN_FRONTEND=noninteractive apt-get install -y cpio gzip
37+
- gzip -cd ../{{ ramdisk_name }} | cpio -idm --no-absolute-filenames
38+
- gzip -cd ../{{ firmware_name }} | cpio -idm --no-absolute-filenames
39+
- find . -print0 | cpio --null -H newc -o | gzip -9 > ../merged-initramfs.cpio.gz
40+
- cd ..
3641
{% else %}
37-
- cat initramfs-kerneltest-full-image-qcom-armv8a.cpio > merged-initramfs.cpio
42+
# No firmware to merge: rename ramdisk as merged output (destructive)
43+
- mv {{ ramdisk_name }} merged-initramfs.cpio.gz
3844
{% endif %}
39-
- gzip merged-initramfs.cpio
4045
- mkbootimg --header_version 2 --kernel Image --dtb {{ dtb_name }} --cmdline "console=ttyMSM0,115200n8 earlycon qcom_geni_serial.con_enabled=1 kernel.sched_pelt_multiplier=4 mem_sleep_default=s2idle mitigations=auto video=efifb:off" --ramdisk merged-initramfs.cpio.gz --output boot.img
4146
to: downloads
4247

0 commit comments

Comments
 (0)