diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index 81c9f9145..7c6e6838d 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -1,6 +1,6 @@ pkgname=postmarketos-mkinitfs -pkgver=0.14.0 -pkgrel=2 +pkgver=0.14.1 +pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://postmarketos.org" # multipath-tools: kpartx @@ -41,6 +41,6 @@ check() { sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f3139d00897f69323a916d709ced4297fea8cbd3a13ebae575b873ec9e2cbfae 00-default.modules 7fc6ba96419628850984df3322b73bcf655cba03fe3e97ec7425e66e90f4b2a4de106b5cb2e3d46785a92557334288011334104285e2050c7a8e823b8fa5668c init.sh.in e9bbf6850c0c44f10c8fe66ceb05ed454844646dd937b5fe614810a0cce7c7383febe5ee1b0830217bff71a29621d82aa57adbcd59cb24a72701504887513ff1 init_functions.sh -7201d4640a3e9ead8a47ffd9916b068476b7d950760a84c37e02268c942d49896bc986da6bdee27e832639c90775354d68046a6475205d8d1da995b068120d8f mkinitfs.sh -f46fccdeb02aff3d61c72cf96e62d0f90bbd5f59da0abebd1b4fd7cb0d8d4b73ad88eb8687e00274056f4e0344f5cbc8b513e0780757c49848341c1101cce7c6 mkinitfs_functions.sh +dfc01ee0547ea88b7aa45a005e842b636e9e19bbf1705f3dad53a66d57af7c5c513c092b5469a06d9b00322e56a4d25f1b47e4c5324aafa99f5291679968d1f1 mkinitfs.sh +6f2948e5653076cc5e987a0438b62c0492fbbda911dce8153628bd749987ecbce3bf2f95594a49beda1b9ff851aa368c550f4ea7830cbf6e97784b4289183493 mkinitfs_functions.sh c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh" diff --git a/main/postmarketos-mkinitfs/mkinitfs.sh b/main/postmarketos-mkinitfs/mkinitfs.sh index 67ac5115b..44488ccf0 100644 --- a/main/postmarketos-mkinitfs/mkinitfs.sh +++ b/main/postmarketos-mkinitfs/mkinitfs.sh @@ -31,6 +31,7 @@ install -Dm755 "/usr/share/postmarketos-mkinitfs/init_functions.sh" \ replace_init_variables create_cpio_image "$tmpdir" "$outfile" append_or_copy_dtb +add_mtk_header create_uboot_files create_bootimg diff --git a/main/postmarketos-mkinitfs/mkinitfs_functions.sh b/main/postmarketos-mkinitfs/mkinitfs_functions.sh index 366c371b3..512538bc9 100644 --- a/main/postmarketos-mkinitfs/mkinitfs_functions.sh +++ b/main/postmarketos-mkinitfs/mkinitfs_functions.sh @@ -330,17 +330,16 @@ create_bootimg() _base="${deviceinfo_flash_offset_base}" [ -z "$_base" ] && _base="0x10000000" - if [ "${deviceinfo_bootimg_mtk_mkimage}" = "true" ]; then - require_package "mtk-mkimage" "mtk-mkimage" "bootimg_mtk_mkimage" - mv "$outfile" "$outfile-orig" - mtk-mkimage ROOTFS "$outfile-orig" "$outfile" - fi - # shellcheck disable=SC2039 kernelfile="${outfile/initramfs-/vmlinuz-}" if [ "${deviceinfo_append_dtb}" = "true" ]; then kernelfile="${kernelfile}-dtb" fi + + if [ "${deviceinfo_bootimg_mtk_mkimage}" = "true" ]; then + kernelfile="${kernelfile}-mtk" + fi + _second="" if [ "${deviceinfo_bootimg_dtb_second}" = "true" ]; then if [ -z "${deviceinfo_dtb}" ]; then @@ -427,6 +426,24 @@ append_or_copy_dtb() fi } +# Add Mediatek header to kernel & initramfs +add_mtk_header() +{ + [ "${deviceinfo_bootimg_mtk_mkimage}" = "true" ] || return + require_package "mtk-mkimage" "mtk-mkimage" "bootimg_mtk_mkimage" + + echo "==> initramfs: adding Mediatek header" + mv "$outfile" "$outfile-orig" + mtk-mkimage ROOTFS "$outfile-orig" "$outfile" + rm "$outfile-orig" + + echo "==> kernel: adding Mediatek header" + # shellcheck disable=SC2039 + kernel="${outfile/initramfs-/vmlinuz-}" + rm -f "${kernel}-mtk" + mtk-mkimage KERNEL "$kernel" "${kernel}-mtk" +} + # Create the initramfs-extra archive # $1: outfile generate_initramfs_extra()