home: hub: mkinitfs

Download patch

ref: 82002bafa3de220b7bde1cd03e1ac0758a65abc2
parent: 5195422476518ad6fc38c33fc5446c38c0d8556d
author: Dermot Bradley <dermot_bradley@yahoo.com>
date: Tue Apr 12 09:50:55 CDT 2022

mkinitfs.in: ensure when run in chroot that correct kernel version is used

modinfo is called without the "-k version" argument and so when
running mkinitfs inside a chroot where the version of the kernel
package being installed differs from the version of the host
machine's kernel then modinfo is called (to check firmware
requirements) using the wrong kernel version.

Add the "-k" argument to ensure the correct kernel version is used.

NOTE: Busybox's modinfo does not support the "-k" option. Currently
Alpine is using modinfo from the kmod package, however obviously in
the future Busybox's version is to be used this this will break. It
appears the only solution in that scenario would be to add "-k"
support to Busybox's version.

--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -140,7 +140,7 @@
 	# Verify if there are initfs modules
 	_modules=`find "$tmpdir"/lib/modules -type f -name "*.ko*" -print -quit`
 	[ -n "$_modules" ] || return 0
-	find "$tmpdir"/lib/modules -type f -name "*.ko*" | xargs modinfo -F firmware | sort -u | while read FW; do
+	find "$tmpdir"/lib/modules -type f -name "*.ko*" | xargs modinfo -k $kernel -F firmware | sort -u | while read FW; do
 		[ -e "${basedir}/lib/firmware/${FW}" ] && install -pD "${basedir}/lib/firmware/${FW}" "$tmpdir"/lib/firmware/$FW
 	done
 	return 0