Skip to content

main/postmarketos-mkinitfs: fix mkbootimg call for devices w/o dtb

Administrator requested to merge mkinitfs-fix-mkbootimg-arguments into master

On a samsung-kminilte, with this deviceinfo:

deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline=""
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x10000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_heimdall_partition_kernel="BOOT"
deviceinfo_flash_heimdall_partition_system="SYSTEM"
deviceinfo_bootimg_append_seandroidenforce="true"

installing a kernel would fail with this error:

==> initramfs: creating boot.img
usage: mkbootimg
       --kernel <filename>
       [ --ramdisk <filename> ]
       [ --second <2ndbootloader-filename> ]
       [ --dtb <dtb-filename> ]
       [ --recovery_dtbo <recoverydtbo-filename> ]
       [ --recovery_acpio <recoveryacpio-filename> ]
       [ --cmdline <kernel-commandline> ]
       [ --board <boardname> ]
       [ --base <address> ]
       [ --pagesize <pagesize> ]
       [ --dt <dt-filename> ]
       [ --kernel_offset <base offset> ]
       [ --ramdisk_offset <base offset> ]
       [ --second_offset <base offset> ]
       [ --tags_offset <base offset> ]
       [ --dtb_offset <base offset> ]
       [ --os_version <A.B.C version> ]
       [ --os_patch_level <YYYY-MM-DD date> ]
       [ --header_version <version number> ]
       [ --hash <sha1(default)|sha256> ]
       [ --id ]
       -o|--output <filename>
ERROR: postmarketos-mkinitfs-0.12.0-r0.trigger: script exited with error 1

It turns out that when $_second or $_dt isn't set in create_bootimg(), mkbootimg will receive empty strings as arguments.

With this patch, the build works fine for me, but I haven't tested it with any other device. It should work fine though, unless deviceinfo_dtb contains spaces.

Fixes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1905

Edited by Administrator

Merge request reports

Loading