main/postmarketos-initramfs: load modules also from /lib/modules/initramfs.load (MR 4193)

Make it possible to load modules from the file installed by devicepkg-dev,
that will be there when extra modules are needed. This is coded in a
backwards-compatible way, so that it can be independent of the main modules
MR.

The code changes create a new function which takes a list of modules
and possibly a file (that should contain a list of modules too). The
idea is to be able to support also loading modules for initramfs-extra
in the future, and having a similar file would be more convenient than
extracting all the modules each time. In addition, the "[ -d /lib/modules]"
check has been removed. If there's no modules directory, as all
modules might be built-in, modprobe will fail, but that will not be
fatal. This will most likely only exclusively happen in some android
downstream kernel, so it should not be a big concern.
This commit is contained in:
Pablo Correa Gómez 2023-06-27 18:58:11 +02:00 committed by Clayton Craft
parent f3c7308f6f
commit 38ce112cdf
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
3 changed files with 14 additions and 5 deletions

View file

@ -1,7 +1,7 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-initramfs
pkgver=1.1.2
pkgver=1.2.0
pkgrel=0
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
url="https://postmarketos.org"
@ -68,6 +68,6 @@ bed319179bcd0b894d6267c7e73f2890db07bc07df71542936947dfb3bdb17fade8a7b4e7b577f27
399da6e61993f48c8a62c956bb15d294cac10bf003d84257efdf4a213ebc87bb51cdcd75c4675f51c3be832146b8f21a7c769bf3e94f574a5067f001662632a1 00-initramfs-base.dirs
3bc73f3a0d1de210444d9c45fab51fd4520e38b43ffbb76368f8ff854b990aa2f21c6356840c5a48eb9808e834eb885a6d581639a60707c26abf66fc20b70db9 00-initramfs-base.files
e984cd3033ce8752ebc71127828b964b46259a5263c2ebfab32c1394b674bcff464862ff00b8e920d3d31386c54ca0b94f84bc77580d275ecfeea33e76c07ef4 00-initramfs-extra-base.files
7742722dcad144eaa2af154711ba06afba9686a3d7b7ff80329d3e989f72d6105029aac8f32649888e2faafd970f286cbdcf467b6b4c1e12aa0fefdb5929a196 init.sh
0325b91829a45d76c5606fec3af610ac0b138a81586ae3836058a773c10a6ed7c8b9090861cc8554c228956baa27dfe4b9edb5f7104673961649f65a878eb9dc init_functions.sh
5a6252a02f46a4649a5aa7731a3f1bffd6eeca26b36bfd7ba1920dd6c72cceecfe0101da20d2f53850f1394a23f2dc1a61bfcfcf9c99ecdd26aec26df9a72d4e init.sh
a6358ca43f36d84d64da063db456fa7520eeb7bbdb457082e6959995166156245b08d9e7c1098b6f2f52974e7cbcc0b7719e4a0d3400a1d989c9e7b831303bb4 init_functions.sh
"

View file

@ -15,8 +15,8 @@ mount_proc_sys_dev
create_device_nodes
setup_log
setup_firmware_path
# shellcheck disable=SC2154,SC2086
[ -d /lib/modules ] && modprobe -a ${deviceinfo_modules_initfs} usb_f_rndis
# shellcheck disable=SC2154
load_modules /lib/modules/initramfs.load "$deviceinfo_modules_initfs usb_f_rndis"
setup_mdev
setup_dynamic_partitions "${deviceinfo_super_partitions:=}"

View file

@ -59,6 +59,15 @@ setup_firmware_path() {
echo -n /lib/firmware/postmarketos >$SYS
}
# shellcheck disable=SC3043
load_modules() {
local file="$1"
local modules="$2"
[ -f "$file" ] && modules="$modules $(cat "$file")"
# shellcheck disable=SC2086
modprobe -a $modules
}
setup_mdev() {
# Start mdev daemon
mdev -d