[arch-projects] [mkinitcpio][PATCH] check if module is builtin kernel in add_module
When we want to make sure a module is added to initcpio, but the module is built in the kernel, we now get an error the module is not found. Therefore we should check if the module is builtin and don't fail when its found there. example: when sd_mod is built in your kernel you got an error before ==> ERROR: module not found: `sd_mod' but the module can be found in /lib/modules/$KERNELNAME/modules.builtin 'kernel/drivers/scsi/sd_mod.ko' Signed-off-by: BlackEagle <ike.devolder@gmail.com> --- functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions b/functions index 941312f..3051e81 100644 --- a/functions +++ b/functions @@ -400,6 +400,9 @@ add_module() { done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$target" 2>/dev/null) if (( !found )); then + if grep "$target" "$_optmoduleroot/lib/modules/$KERNELVERSION/modules.builtin" > /dev/null 2>&1; then + return 0 + fi (( ign_errors || _addedmodules["$target"] )) && return 0 error "module not found: \`%s'" "$target" return 1 -- 2.14.1
On 09/10/2017 06:21 AM, BlackEagle via arch-projects wrote:
When we want to make sure a module is added to initcpio, but the module is built in the kernel, we now get an error the module is not found. Therefore we should check if the module is builtin and don't fail when its found there.
example: when sd_mod is built in your kernel you got an error before
==> ERROR: module not found: `sd_mod'
but the module can be found in /lib/modules/$KERNELNAME/modules.builtin 'kernel/drivers/scsi/sd_mod.ko'
I'm a bit confused, since I don't get such errors even though I have btrfs as a builtin.
if (( !found )); then + if grep "$target" "$_optmoduleroot/lib/modules/$KERNELVERSION/modules.builtin" > /dev/null 2>&1; then + return 0 + fi (( ign_errors || _addedmodules["$target"] )) && return 0
Specifically, this `|| _addedmodules["$target"]` was added in commit c90eb88f04c6acf621e9682172636fae3d0328ad which fixed temporary errors I was getting.
error "module not found: \`%s'" "$target" return 1 -- 2.14.1
-- Eli Schwartz
On Sun, Sep 10, 2017 at 12:21:11PM +0200, BlackEagle via arch-projects wrote:
When we want to make sure a module is added to initcpio, but the module is built in the kernel, we now get an error the module is not found. Therefore we should check if the module is builtin and don't fail when its found there.
example: when sd_mod is built in your kernel you got an error before
==> ERROR: module not found: `sd_mod'
but the module can be found in /lib/modules/$KERNELNAME/modules.builtin 'kernel/drivers/scsi/sd_mod.ko'
Signed-off-by: BlackEagle <ike.devolder@gmail.com> --- functions | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/functions b/functions index 941312f..3051e81 100644 --- a/functions +++ b/functions @@ -400,6 +400,9 @@ add_module() { done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$target" 2>/dev/null)
if (( !found )); then + if grep "$target" "$_optmoduleroot/lib/modules/$KERNELVERSION/modules.builtin" > /dev/null 2>&1; then + return 0 + fi
But we already use this file to preseed the _addedmodules array and treat builtins as already satisfied: https://git.archlinux.org/mkinitcpio.git/tree/mkinitcpio#n497 Please figure out why this doesn't work for you, or at least provide a simplified case to reproduce the error you're seeing.
(( ign_errors || _addedmodules["$target"] )) && return 0 error "module not found: \`%s'" "$target" return 1 -- 2.14.1
On Sun, Sep 10, 2017 at 05:33:18PM +0000, Dave Reisner wrote:
On Sun, Sep 10, 2017 at 12:21:11PM +0200, BlackEagle via arch-projects wrote:
When we want to make sure a module is added to initcpio, but the module is built in the kernel, we now get an error the module is not found. Therefore we should check if the module is builtin and don't fail when its found there.
example: when sd_mod is built in your kernel you got an error before
==> ERROR: module not found: `sd_mod'
but the module can be found in /lib/modules/$KERNELNAME/modules.builtin 'kernel/drivers/scsi/sd_mod.ko'
Signed-off-by: BlackEagle <ike.devolder@gmail.com> --- functions | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/functions b/functions index 941312f..3051e81 100644 --- a/functions +++ b/functions @@ -400,6 +400,9 @@ add_module() { done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$target" 2>/dev/null)
if (( !found )); then + if grep "$target" "$_optmoduleroot/lib/modules/$KERNELVERSION/modules.builtin" > /dev/null 2>&1; then + return 0 + fi
But we already use this file to preseed the _addedmodules array and treat builtins as already satisfied:
https://git.archlinux.org/mkinitcpio.git/tree/mkinitcpio#n497
Please figure out why this doesn't work for you, or at least provide a simplified case to reproduce the error you're seeing.
(( ign_errors || _addedmodules["$target"] )) && return 0 error "module not found: \`%s'" "$target" return 1 -- 2.14.1
After the discussion on IRC it became clear there is already a fix that is not yet in the stable mkinitcpio package. The proper fix was already added [1] [1] https://git.archlinux.org/mkinitcpio.git/commit/?id=c90eb88f04c6acf621e96821... -- Ike
participants (4)
-
BlackEagle
-
Dave Reisner
-
Eli Schwartz
-
Ike Devolder