Add support for --firmware and --firmware-dir options to include firmware in the...
authorAndrew Gaffney <agaffney@gentoo.org>
Mon, 10 Mar 2008 00:38:49 +0000 (00:38 +0000)
committerAndrew Gaffney <agaffney@gentoo.org>
Mon, 10 Mar 2008 00:38:49 +0000 (00:38 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@612 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
gen_cmdline.sh
gen_determineargs.sh
gen_initramfs.sh
genkernel.conf

index c5cde12371684fa560caaa6b8f356a0d81c9460a..928101d79b030083639ef7522f3b765bba66aaf9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  10 Mar 2008; Andrew Gaffney <agaffney@gentoo.org> gen_cmdline.sh,
+  gen_determineargs.sh, gen_initramfs.sh, genkernel.conf:
+  Add support for --firmware and --firmware-dir options to include firmware in
+  the initramfs
+
   09 Mar 2008; Andrew Gaffney <agaffney@gentoo.org> generic/linuxrc:
   Apply patch from Vince C <v_cadet@yahoo.fr> to mount sysfs prior to loading
   modules, so that the mdev firmware loading can actually work
index 44089004741abd0e048e858229524f4a76da3cb7..b556127c72937a98e5b44d05dca6fd500dfc36cb 100755 (executable)
@@ -117,6 +117,11 @@ longusage() {
   echo "       --initramfs-overlay=<dir>"
   echo "                               Directory structure to include in the initramfs,"
   echo "                               only available on 2.6 kernels"
+  echo "       --firmware"
+  echo "                               Enable copying of firmware into initramfs"
+  echo "       --firmware-dir=<dir>"
+  echo "                               Specify directory to copy firmware from (defaults"
+  echo "                               to /lib/firmware)"
 }
 
 usage() {
@@ -476,6 +481,15 @@ parse_cmdline() {
                        CMD_LUKS=1
                        print_info 2 "CMD_LUKS: ${CMD_LUKS}"
                        ;;
+               --firmware)
+                       CMD_FIRMWARE=1
+                       print_info 2 "CMD_FIRMWARE: ${CMD_FIRMWARE}"
+                       ;;
+               --firmware-dir=*)
+                       CMD_FIRMWARE_DIR=`parse_opt "$*"`
+                       CMD_FIRMWARE=1
+                       print_info 2 "CMD_FIRMWARE_DIR: ${CMD_FIRMWARE_DIR}"
+                       ;;
                all)
                        BUILD_KERNEL=1
                        BUILD_MODULES=1
index f0253894dc25b6b83216dfa15faf5bdb553662c4..6a7b8720132d3bea7d496eb745f30c487a670791 100644 (file)
@@ -114,6 +114,8 @@ determine_real_args() {
        set_config_with_override 1 DISKLABEL            CMD_DISKLABEL
        set_config_with_override 1 LUKS                 CMD_LUKS
        set_config_with_override 1 MDADM                CMD_MDADM
+       set_config_with_override 1 FIRMWARE             CMD_FIRMWARE
+       set_config_with_override 2 FIRMWARE_DIR         CMD_FIRMWARE_DIR         "/lib/firmware"
 
                BOOTDIR=`arch_replace "${BOOTDIR}"`
                BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash
index a9ee20f007c6a3bf6af608fe007b1a7255736d24..b5a15bd730ac005843043bb701f100669516d85d 100644 (file)
@@ -251,6 +251,23 @@ append_overlay(){
        cd ${INITRAMFS_OVERLAY}
        find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
 }
+
+append_firmware() {
+       if [ ! -d "${FIRMWARE_DIR}" ]
+       then
+               gen_die "specified firmware directory (${FIRMWARE_DIR}) does not exist"
+       fi
+       if [ -d "${TEMP}/initramfs-firmware-temp" ]
+       then
+               rm -r "${TEMP}/initramfs-firmware-temp/"
+       fi
+       mkdir -p "${TEMP}/initramfs-firmware-temp/lib/firmware"
+       cp -a "${FIRMWARE_DIR}/*" ${TEMP}/initramfs-firmware-temp/lib/firmware/
+       find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
+               || gen_die "appending firmware to cpio"
+       rm -r "${TEMP}/initramfs-firmware-temp/"
+}
+
 print_list()
 {
        local x
@@ -449,6 +466,11 @@ create_initramfs() {
        append_data 'blkid' "${DISKLABEL}"
        append_data 'splash' "${SPLASH}"
 
+       if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
+       then
+               append_data 'firmware'
+       fi
+
        # This should always be appended last
        if [ "${INITRAMFS_OVERLAY}" != '' ]
        then
index 8ab0ac773222265ec74d98952b178149662e707c..305e8e6b81bc759356575bd174402029598428e6 100755 (executable)
@@ -69,6 +69,9 @@ USECOLOR="yes"
 # Copy /etc/mdadm.conf to initramfs.
 # MDADM="no"
 
+# Enable copying of firmware into initramfs
+# FIRMWARE="no"
+# FIRMWARE_DIR="/lib/firmware"
 
 # =========Low Level Compile Settings=========
 #