# 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
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() {
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
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
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
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
# Copy /etc/mdadm.conf to initramfs.
# MDADM="no"
+# Enable copying of firmware into initramfs
+# FIRMWARE="no"
+# FIRMWARE_DIR="/lib/firmware"
# =========Low Level Compile Settings=========
#