commit:     c9855842ac422b8d3a6e7265b6a3c00efe3891e7
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 12 13:48:30 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Oct 12 13:48:30 2016 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c9855842

FIRMWARE_INSTALL control option.

Prefer sys-kernel/linux-firmware to be installed and used rather than
always running firmware_install and overwriting the root copy.

Defaults to FIRMWARE_INSTALL=no, with ebuild updated to RDEPEND on
sys-kernel/linux-firmware, via IUSE='+firmware'

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 doc/genkernel.8.txt  |  4 ++++
 gen_cmdline.sh       |  6 ++++++
 gen_compile.sh       | 20 ++++++++++++--------
 gen_determineargs.sh |  1 +
 genkernel.conf       |  4 ++++
 5 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index bab1034..071eecc 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -384,6 +384,10 @@ OUTPUT SETTINGS
     Specifies specific firmware files to copy. This overrides *--firmware-dir*.
     For multiple files, separate the filenames with a comma.
 
+*--*[*no-*]*firmware-install*::
+    Enable or disables installation of firmware onto root filesystem.
+       Installing sys-kernel/linux-firmware should be preferred instead.
+
 *--*[*no-*]*integrated-initramfs*::
        Builds or does not build the generated initramfs into the kernel instead
        of keeping it as a separate file.

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 94ff68c..e9f323c 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -160,6 +160,8 @@ longusage() {
   echo "                               Specifies specific firmware files to 
copy. This"
   echo "                               overrides --firmware-dir. For multiple 
files,"
   echo "                               separate the filenames with a comma"
+  echo "       --firmware-install"
+  echo "                               Enable installation firmware onto root 
filesystem."
   echo "       --integrated-initramfs, --no-integrated-initramfs"
   echo "                               Include/exclude the generated initramfs 
in the kernel"
   echo "                               instead of keeping it as a separate 
file"
@@ -600,6 +602,10 @@ parse_cmdline() {
                        CMD_FIRMWARE=1
                        print_info 2 "CMD_FIRMWARE_FILES: ${CMD_FIRMWARE_FILES}"
                        ;;
+               --firmware-install|--no-firmware-install)
+                       CMD_FIRMWARE_INSTALL=`parse_optbool "$*"`
+                       print_info 2 "CMD_FIRMWARE_INSTALL: 
${CMD_FIRMWARE_INSTALL}"
+                       ;;
                --integrated-initramfs|--no-integrated-initramfs)
                        CMD_INTEGRATED_INITRAMFS=`parse_optbool "$*"`
                        print_info 2 
"CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}"

diff --git a/gen_compile.sh b/gen_compile.sh
index 0bb1399..3a77a75 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -333,15 +333,19 @@ compile_kernel() {
                compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
        fi
 
-       local firmware_in_kernel_line=`fgrep CONFIG_FIRMWARE_IN_KERNEL 
"${KERNEL_OUTPUTDIR}"/.config`
-       if [ -n "${firmware_in_kernel_line}" -a "${firmware_in_kernel_line}" != 
CONFIG_FIRMWARE_IN_KERNEL=y ]
-       then
-               print_info 1 "        >> Installing firmware ('make 
firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..."
-               [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
-               [ "${INSTALL_FW_PATH}" != '' ] && export INSTALL_FW_PATH
-               MAKEOPTS="${MAKEOPTS} -j1" compile_generic "firmware_install" 
kernel
+       if isTrue "${FIRMWARE_INSTALL}" ; then
+               local firmware_in_kernel_line=`fgrep CONFIG_FIRMWARE_IN_KERNEL 
"${KERNEL_OUTPUTDIR}"/.config`
+               if [ -n "${firmware_in_kernel_line}" -a 
"${firmware_in_kernel_line}" != CONFIG_FIRMWARE_IN_KERNEL=y ]
+               then
+                       print_info 1 "        >> Installing firmware ('make 
firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..."
+                       [ "${INSTALL_MOD_PATH}" != '' ] && export 
INSTALL_MOD_PATH
+                       [ "${INSTALL_FW_PATH}" != '' ] && export INSTALL_FW_PATH
+                       MAKEOPTS="${MAKEOPTS} -j1" compile_generic 
"firmware_install" kernel
+               else
+                       print_info 1 "        >> Not installing firmware as 
it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)..."
+               fi
        else
-               print_info 1 "        >> Not installing firmware as it's 
included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)..."
+               print_info 1 "        >> Not installing firmware as requested 
by configuration FIRMWARE_INSTALL=no..."
        fi
 
        local tmp_kernel_binary=$(find_kernel_binary 
${KERNEL_BINARY_OVERRIDE:-${KERNEL_BINARY}})

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 522996d..5402b45 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -132,6 +132,7 @@ determine_real_args() {
        set_config_with_override BOOL   FIRMWARE             CMD_FIRMWARE
        set_config_with_override STRING FIRMWARE_DIR         CMD_FIRMWARE_DIR   
      "/lib/firmware"
        set_config_with_override STRING FIRMWARE_FILES       CMD_FIRMWARE_FILES
+       set_config_with_override BOOL   FIRMWARE_INSTALL     
CMD_FIRMWARE_INSTALL     "no"
        set_config_with_override BOOL   INTEGRATED_INITRAMFS 
CMD_INTEGRATED_INITRAMFS
        set_config_with_override BOOL   WRAP_INITRD          CMD_WRAP_INITRD
        set_config_with_override BOOL   GENZIMAGE            CMD_GENZIMAGE

diff --git a/genkernel.conf b/genkernel.conf
index 6b974e1..e62d294 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -102,6 +102,10 @@ USECOLOR="yes"
 # Add BTRFS support.
 #BTRFS="no"
 
+# Install firmware onto root filesystem
+# Will conflict with sys-kernel/linux-firmware package
+#FIRMWARE_INSTALL="no"
+
 # Enable copying of firmware into initramfs
 #FIRMWARE="no"
 # Specify directory to pull from

Reply via email to