commit:     a30b7139cfad7261c84345b136c671744e64ec29
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  6 20:22:12 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jul  6 20:59:30 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a30b7139

gen_cmdline.sh: parse_cmdline(): Allow to override AS, AR, NM & Co via CLI

Bug: https://bugs.gentoo.org/786405
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 doc/genkernel.8.txt | 44 +++++++++++++++++++++++++++++++-
 gen_cmdline.sh      | 72 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 genkernel.conf      | 38 +++++++++++++++++++---------
 3 files changed, 135 insertions(+), 19 deletions(-)

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index aa18496..262027b 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -246,15 +246,36 @@ LOW-LEVEL COMPILATION OPTIONS
 *--kernel-as*=<assembler>::
     Assembler to use for the kernel compilation.
 
+*--kernel-ar*=<archiver>::
+    Archiver to use for the kernel compilation.
+
 *--kernel-cc*=<compiler>::
     Compiler to use for the kernel compilation (e.g. distcc).
 
 *--kernel-ld*=<linker>::
     Linker to use for the kernel compilation.
 
-*--kernel-make*=<makeprg>::
+*--kernel-nm*=<nm>::
+    NM utility to use for the kernel compilation.
+
+*--kernel-make*=<makeprog>::
     GNU Make to use for the kernel compilation.
 
+*--kernel-objcopy*=<objcopyprog>::
+    Objcopy utility to use for the kernel compilation.
+
+*--kernel-objdump*=<objdumpprog>::
+    Objdump utility to use for the kernel compilation.
+
+*--kernel-ranlib*=<ranlibprog>::
+    Ranlib utility to use for the kernel compilation.
+
+*--kernel-readelf*=<readelfprog>::
+    Readelf utility to use for the kernel compilation.
+
+*--kernel-strip*=<stripprog>::
+    Strip utility to use for the kernel compilation.
+
 *--kernel-target*=<t>::
     Override default make target (bzImage), note that values
     like *--kernel-target=* are also valid (useful for Xen
@@ -272,6 +293,9 @@ LOW-LEVEL COMPILATION OPTIONS
 *--utils-as*=<assembler>::
     Assembler to use for utilities.
 
+*--utils-ar*=<archiver>::
+    Archiver to use for utilities.
+
 *--utils-cflags*=<cflags>::
     C compiler flags used to compile utilities.
 
@@ -287,6 +311,24 @@ LOW-LEVEL COMPILATION OPTIONS
 *--utils-make*=<makeprog>::
     GNU Make to use for utilities.
 
+*--utils-nm*=<nm>::
+    NM utility to use for utilities.
+
+*--utils-objcopy*=<objcopyprog>::
+    Objcopy utility to use for utilities.
+
+*--utils-objdump*=<objdumpprog>::
+    Objdump utility to use for utilities.
+
+*--utils-ranlib*=<ranlibprog>::
+    Ranlib utility to use for utilities.
+
+*--utils-readelf*=<readelfprof>::
+    Readelf utility to use for utilities.
+
+*--utils-strip*=<striprog>::
+    Strip utility to use for utilities.
+
 *--makeopts*=<makeopts>::
     GNU Make options such as -j2, etc.
 

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 33bf1c5..b35750d 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -87,18 +87,22 @@ longusage() {
   echo "       --cross-compile=<target-triplet>"
   echo "                               Target triple (i.e. aarch64-linux-gnu) 
to build for"
   echo "       --kernel-as=<assembler> Assembler to use for kernel"
+  echo "       --kernel-ar=<archiver>  Archiver to use for kernel"
   echo "       --kernel-cc=<compiler>  Compiler to use for kernel (e.g. 
distcc)"
   echo "       --kernel-ld=<linker>    Linker to use for kernel"
+  echo "       --kernel-nm=<nm>        NM utility to use for kernel"
   echo "       --kernel-make=<makeprg> GNU Make to use for kernel"
   echo "       --kernel-target=<t>     Override default make target (bzImage)"
   echo "       --kernel-binary=<path>  Override default kernel binary path 
(arch/foo/boot/bar)"
   echo "       --kernel-outputdir=<path>"
   echo "                               Save output files outside the source 
tree"
   echo "       --utils-as=<assembler>  Assembler to use for utils"
+  echo "       --utils-ar=<archiver>   Archiver to use for utils"
   echo "       --utils-cc=<compiler>   C Compiler to use for utilities"
   echo "       --utils-cxx=<compiler>  C++ Compiler to use for utilities"
   echo "       --utils-cflags=<cflags> C compiler flags used to compile 
utilities"
   echo "       --utils-ld=<linker>     Linker to use for utils"
+  echo "       --utils-nm=<nm>         NM utility to use for utils"
   echo "       --utils-make=<makeprog> GNU Make to use for utils"
   echo "       --makeopts=<makeopts>   Make options such as -j2, etc ..."
   echo "       --mountboot             Mount BOOTDIR automatically if 
mountable"
@@ -288,6 +292,14 @@ parse_cmdline() {
                        CMD_CROSS_COMPILE="${*#*=}"
                        print_info 3 "CMD_CROSS_COMPILE: ${CMD_CROSS_COMPILE}"
                        ;;
+               --kernel-as=*)
+                       CMD_KERNEL_AS="${*#*=}"
+                       print_info 3 "CMD_KERNEL_AS: ${CMD_KERNEL_AS}"
+                       ;;
+               --kernel-ar=*)
+                       CMD_KERNEL_AR="${*#*=}"
+                       print_info 3 "CMD_KERNEL_AR: ${CMD_KERNEL_AR}"
+                       ;;
                --kernel-cc=*)
                        CMD_KERNEL_CC="${*#*=}"
                        print_info 3 "CMD_KERNEL_CC: ${CMD_KERNEL_CC}"
@@ -296,14 +308,34 @@ parse_cmdline() {
                        CMD_KERNEL_LD="${*#*=}"
                        print_info 3 "CMD_KERNEL_LD: ${CMD_KERNEL_LD}"
                        ;;
-               --kernel-as=*)
-                       CMD_KERNEL_AS="${*#*=}"
-                       print_info 3 "CMD_KERNEL_AS: ${CMD_KERNEL_AS}"
+               --kernel-nm=*)
+                       CMD_KERNEL_NM="${*#*=}"
+                       print_info 3 "CMD_KERNEL_NM: ${CMD_KERNEL_NM}"
                        ;;
                --kernel-make=*)
                        CMD_KERNEL_MAKE="${*#*=}"
                        print_info 3 "CMD_KERNEL_MAKE: ${CMD_KERNEL_MAKE}"
                        ;;
+               --kernel-objcopy=*)
+                       CMD_KERNEL_OBJCOPY="${*#*=}"
+                       print_info 3 "CMD_KERNEL_OBJCOPY: ${CMD_KERNEL_OBJCOPY}"
+                       ;;
+               --kernel-objdump=*)
+                       CMD_KERNEL_OBJDUMP="${*#*=}"
+                       print_info 3 "CMD_KERNEL_OBJDUMP: ${CMD_KERNEL_OBJDUMP}"
+                       ;;
+               --kernel-ranlib=*)
+                       CMD_KERNEL_RANLIB="${*#*=}"
+                       print_info 3 "CMD_KERNEL_RANLIB: ${CMD_KERNEL_RANLIB}"
+                       ;;
+               --kernel-readelf=*)
+                       CMD_KERNEL_READELF="${*#*=}"
+                       print_info 3 "CMD_KERNEL_READELF: ${CMD_KERNEL_READELF}"
+                       ;;
+               --kernel-strip=*)
+                       CMD_KERNEL_STRIP="${*#*=}"
+                       print_info 3 "CMD_KERNEL_STRIP: ${CMD_KERNEL_STRIP}"
+                       ;;
                --kernel-target=*)
                        KERNEL_MAKE_DIRECTIVE_OVERRIDE="${*#*=}"
                        print_info 3 "KERNEL_MAKE_DIRECTIVE_OVERRIDE: 
${KERNEL_MAKE_DIRECTIVE_OVERRIDE}"
@@ -316,6 +348,14 @@ parse_cmdline() {
                        CMD_KERNEL_OUTPUTDIR="${*#*=}"
                        print_info 3 "CMD_KERNEL_OUTPUTDIR: 
${CMD_KERNEL_OUTPUTDIR}"
                        ;;
+               --utils-as=*)
+                       CMD_UTILS_AS="${*#*=}"
+                       print_info 3 "CMD_UTILS_AS: ${CMD_UTILS_AS}"
+                       ;;
+               --utils-ar=*)
+                       CMD_UTILS_AR="${*#*=}"
+                       print_info 3 "CMD_UTILS_AR: ${CMD_UTILS_AR}"
+                       ;;
                --utils-cc=*)
                        CMD_UTILS_CC="${*#*=}"
                        print_info 3 "CMD_UTILS_CC: ${CMD_UTILS_CC}"
@@ -332,14 +372,34 @@ parse_cmdline() {
                        CMD_UTILS_LD="${*#*=}"
                        print_info 3 "CMD_UTILS_LD: ${CMD_UTILS_LD}"
                        ;;
-               --utils-as=*)
-                       CMD_UTILS_AS="${*#*=}"
-                       print_info 3 "CMD_UTILS_AS: ${CMD_UTILS_AS}"
+               --utils-nm=*)
+                       CMD_UTILS_NM="${*#*=}"
+                       print_info 3 "CMD_UTILS_NM: ${CMD_UTILS_NM}"
                        ;;
                --utils-make=*)
                        CMD_UTILS_MAKE="${*#*=}"
                        print_info 3 "CMD_UTILS_MAKE: ${CMD_UTILS_MAKE}"
                        ;;
+               --utils-objcopy=*)
+                       CMD_UTILS_OBJCOPY="${*#*=}"
+                       print_info 3 "CMD_UTILS_OBJCOPY: ${CMD_UTILS_OBJCOPY}"
+                       ;;
+               --utils-objdump=*)
+                       CMD_UTILS_OBJDUMP="${*#*=}"
+                       print_info 3 "CMD_UTILS_OBJDUMP: ${CMD_UTILS_OBJDUMP}"
+                       ;;
+               --utils-ranlib=*)
+                       CMD_UTILS_RANLIB="${*#*=}"
+                       print_info 3 "CMD_UTILS_RANLIB: ${CMD_UTILS_RANLIB}"
+                       ;;
+               --utils-readelf=*)
+                       CMD_UTILS_READELF="${*#*=}"
+                       print_info 3 "CMD_UTILS_READELF: ${CMD_UTILS_READELF}"
+                       ;;
+               --utils-strip=*)
+                       CMD_UTILS_STRIP="${*#*=}"
+                       print_info 3 "CMD_UTILS_STRIP: ${CMD_UTILS_STRIP}"
+                       ;;
                --makeopts=*)
                        CMD_MAKEOPTS="${*#*=}"
                        print_info 3 "CMD_MAKEOPTS: ${CMD_MAKEOPTS}"

diff --git a/genkernel.conf b/genkernel.conf
index 6c350a6..7d10496 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -193,23 +193,34 @@ NOCOLOR="false"
 
 # =========Low Level Compile Settings=========
 #
-# GNU Make to use for kernel.  See also the --kernel-make command line option.
-#KERNEL_MAKE="make"
+# Assembler to use for the kernel.  See also the --kernel-as command line
+# option.
+#KERNEL_AS="as"
+
+# Archiver to use for the kernel.  See also the --kernel-ar command line
+# option.
+#KERNEL_AR="ar"
 
 # Compiler to use for the kernel (e.g. distcc).  See also the --kernel-cc
 # command line option.
 #KERNEL_CC="gcc"
 
-# Assembler to use for the kernel.  See also the --kernel-as command line
-# option.
-#KERNEL_AS="as"
-
 # Linker to use for the kernel.  See also the --kernel-ld command line option.
 #KERNEL_LD="ld"
 
-# GNU Make to use for the utilities.  See also the --utils-make command line
+# NM utility to use for the kernel.  See also the --kernel-nm command line 
option.
+#KERNEL_NM="nm"
+
+# GNU Make to use for kernel.  See also the --kernel-make command line option.
+#KERNEL_MAKE="make"
+
+# Assembler to use for the utilities.  See also the --utils-as command line
 # option.
-#UTILS_MAKE="make"
+#UTILS_AS="as"
+
+# Archiver to use for the utilities.  See also the --utils-ar command line
+# option.
+#UTILS_AR="ar"
 
 # C Compiler to use for the utilities (e.g. distcc).  See also the --utils-cc
 # command line option.
@@ -219,14 +230,17 @@ NOCOLOR="false"
 # command line option.
 #UTILS_CXX="g++"
 
-# Assembler to use for the utilities.  See also the --utils-as command line
-# option.
-#UTILS_AS="as"
-
 # Linker to use for the utilities.  See also the --utils-ld command line
 # option.
 #UTILS_LD="ld"
 
+# NM utility to use for the utilities.  See also the --utils-nm command line 
option.
+#UTILS_NM="nm"
+
+# GNU Make to use for the utilities.  See also the --utils-make command line
+# option.
+#UTILS_MAKE="make"
+
 # Target triple (i.e. aarch64-linux-gnu) to build for. If you do not
 # cross-compile, leave blank for auto detection.
 #CROSS_COMPILE=""

Reply via email to