diff --git a/aports/main/postmarketos-mkinitfs/APKBUILD b/aports/main/postmarketos-mkinitfs/APKBUILD index 0efbca7d..f071cc80 100644 --- a/aports/main/postmarketos-mkinitfs/APKBUILD +++ b/aports/main/postmarketos-mkinitfs/APKBUILD @@ -1,5 +1,5 @@ pkgname=postmarketos-mkinitfs -pkgver=0.5.8 +pkgver=0.5.9 pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://github.com/postmarketOS" @@ -24,4 +24,4 @@ package() { } sha512sums="500c1e903ca9cf5dfe0102414b086643379d51d848e15eeed89da8ba9f3a286dfba139a29b8312a0df005e159a54ad08c84e078b7d70e6873cabb7d0abda4807 init.sh.in eca1e4647494556be52b3eecffe2db75735006a6c53e8778630949808aabc464281ffa75a8744e22a5512c2de1eb5f92f9eb377a55ca4a7402ba8cc0705df83d init_functions.sh -77adbdc13ed562999ac02a194b2b5237f29704d3c39afa7e27c34f739c701c272a284e9a18d403bb01d02fa5123f006168f21378746a2a5a2d860f9345e51b70 mkinitfs.sh" +6363ca98574cca9a449e1533b7aea6d8a021984e671f5cacd794110d3000153271f377e44b5316c6cc642ee1d20e239a2f5fe126bc527e307dc9257c6932b261 mkinitfs.sh" diff --git a/aports/main/postmarketos-mkinitfs/mkinitfs.sh b/aports/main/postmarketos-mkinitfs/mkinitfs.sh index 3c399f77..6df7458e 100644 --- a/aports/main/postmarketos-mkinitfs/mkinitfs.sh +++ b/aports/main/postmarketos-mkinitfs/mkinitfs.sh @@ -7,9 +7,6 @@ source_deviceinfo() exit 1 fi . /etc/deviceinfo - if [ -z "${deviceinfo_modules_initfs}" ]; then - echo "WARNING: deviceinfo_modules_initfs is empty!" - fi } parse_commandline() @@ -65,7 +62,14 @@ get_modules_by_globs() # That's why postmarketos-mkinitfs depends on kmod get_modules_by_name() { - MODULES="drm_kms_helper drm dm_crypt ext4 \ + { + echo "Scanning kernel module dependencies..." + echo "NOTE: ** modprobe warnings below can be ignored ** if your device does not run the" + echo "mainline kernel yet (most devices!) or if the related kernel options are enabled" + echo "with 'y' instead of 'm' (module)." + } >&2 + + MODULES="drm_kms_helper drm dm_crypt \ ${deviceinfo_modules_initfs}" modprobe \ -a \ @@ -170,25 +174,44 @@ create_cpio_image() | gzip -1 > "$2" } +# Required command check with useful error message +# $1: command (e.g. "mkimage") +# $2: package (e.g. "uboot-tools") +# $3: related deviceinfo variable (e.g. "generate_bootimg") +require_package() +{ + [ "$(command -v "$1")" == "" ] || return + echo "ERROR: 'deviceinfo_$3' is set, but the package '$2' was not" + echo "installed! Please add '$2' to the depends= line of your device's" + echo "APKBUILD. See also: " + exit 1 +} + # Legacy u-boot images create_uboot_files() { [ "${deviceinfo_generate_legacy_uboot_initfs}" == "true" ] || return + require_package "mkimage" "uboot-tools" "generate_legacy_uboot_initfs" + echo "==> initramfs: creating uInitrd" - mkimage -A arm -T ramdisk -C none -n uInitrd -d "$outfile" "${outfile/initramfs-/uInitrd-}" + mkimage -A arm -T ramdisk -C none -n uInitrd -d "$outfile" \ + "${outfile/initramfs-/uInitrd-}" || exit 1 echo "==> kernel: creating uImage" kernelfile="${outfile/initramfs-/vmlinuz-}" if [ -n "${deviceinfo_dtb}" ]; then kernelfile="${kernelfile}-dtb" fi - mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n postmarketos -d $kernelfile "${outfile/initramfs-/uImage-}" + mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 \ + -n postmarketos -d $kernelfile "${outfile/initramfs-/uImage-}" || exit 1 } # Android devices create_bootimg() { [ "${deviceinfo_generate_bootimg}" == "true" ] || return + require_package "mkbootimg" "mkbootimg" "generate_bootimg" + echo "==> initramfs: creating boot.img" _base="${deviceinfo_flash_offset_base}" [ -z "$_base" ] && _base="0x10000000" @@ -200,6 +223,16 @@ create_bootimg() _dt="" if [ "${deviceinfo_bootimg_qcdt}" == "true" ]; then _dt="--dt /boot/dt.img" + if ! [ -e "/boot/dt.img" ]; then + echo "ERROR: File not found: /boot/dt.img, but" + echo "'deviceinfo_bootimg_qcdt' is set. Please verify that your" + echo "device is a QCDT device by analyzing the boot.img file" + echo "(e.g. 'pmbootstrap bootimg_analyze path/to/twrp.img')" + echo "and based on that, set the deviceinfo variable to false or" + echo "adjust your linux APKBUILD to properly generate the dt.img" + echo "file. See also: " + exit 1 + fi fi mkbootimg \ --kernel "${kernelfile}" \ @@ -212,10 +245,11 @@ create_bootimg() --tags_offset "${deviceinfo_flash_offset_tags}" \ --pagesize "${deviceinfo_flash_pagesize}" \ ${_dt} \ - -o "${outfile/initramfs-/boot.img-}" + -o "${outfile/initramfs-/boot.img-}" || exit 1 if [ "${deviceinfo_bootimg_blobpack}" == "true" ]; then echo "==> initramfs: creating blob" - blobpack "${outfile/initramfs-/blob-}" LNX "${outfile/initramfs-/boot.img-}" + blobpack "${outfile/initramfs-/blob-}" LNX \ + "${outfile/initramfs-/boot.img-}" || exit 1 fi } @@ -293,6 +327,10 @@ append_device_tree() dtb="/usr/share/dtb/${deviceinfo_dtb}.dtb" kernel="${outfile/initramfs-/vmlinuz-}" echo "==> kernel: appending device-tree ${deviceinfo_dtb}" + if ! [ -e "$dtb" ]; then + echo "ERROR: File not found: $dtb" + exit 1 + fi cat $kernel $dtb > "${kernel}-dtb" } diff --git a/aports/main/postmarketos-mkinitfs/postmarketos-mkinitfs.trigger b/aports/main/postmarketos-mkinitfs/postmarketos-mkinitfs.trigger index d2390586..5a92f66c 100644 --- a/aports/main/postmarketos-mkinitfs/postmarketos-mkinitfs.trigger +++ b/aports/main/postmarketos-mkinitfs/postmarketos-mkinitfs.trigger @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # $1: kernel flavor rebuild_initfs_flavor() diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index ae74b65c..4952b312 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -162,6 +162,7 @@ necessary_kconfig_options = { "DEVTMPFS": True, "DEVTMPFS_MOUNT": False, "DM_CRYPT": True, + "EXT4_FS": True, "PFT": False, "SYSVIPC": True, "VT": True