[arch-projects] [mkinitcpio] [RFC] add_module(): silently ignore built-ins
Dave Reisner
d at falconindy.com
Mon Sep 17 10:10:36 EDT 2012
I like the idea, but the lookup is a bit heavy and there's no caching. I threw
together the below unpolished diff, which is a bit snappier and gets the job
done.
diff --git a/functions b/functions
index 8a270fd..4839f85 100644
--- a/functions
+++ b/functions
@@ -312,6 +312,10 @@ add_module() {
module=${1%.ko*}
+ if (( ${builtins[$module]} )); then
+ return 0
+ fi
+
# skip expensive stuff if this module has already been added
in_array "${module//-/_}" "${ADDED_MODULES[@]}" && return
diff --git a/mkinitcpio b/mkinitcpio
index 5bed94e..61ab328 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -343,6 +343,11 @@ declare -i builderrors=0
set -o functrace
trap '(( $? )) && [[ $FUNCNAME = add_* ]] && (( ++builderrors ))' RETURN
+declare -A builtins
+while IFS=/ read -ra path; do
+ builtins["${path[-1]%.ko}"]=1
+done <"$MODULEDIR/modules.builtin"
+
for hook in "${hooks[@]}"; do
run_build_hook "$hook" || (( ++builderrors ))
done
On Mon, Sep 17, 2012 at 07:38:23AM -0600, Matthew Monaco wrote:
> From: Matthew Monaco <matthew.monaco at 0x01b.net>
>
> ---
> functions | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/functions b/functions
> index eee09ec..6368815 100644
> --- a/functions
> +++ b/functions
> @@ -315,6 +315,10 @@ add_module() {
> # skip expensive stuff if this module has already been added
> in_array "${module//-/_}" "${ADDED_MODULES[@]}" && return
>
> + if grep -q "/$module.ko$" "$MODULEDIR/modules.builtin" 2>/dev/null; then
> + return 0
> + fi
> +
> while IFS=':= ' read -r -d '' field value; do
> case "$field" in
> filename)
> --
> 1.7.12
>
More information about the arch-projects
mailing list