Add support for --firmware and --firmware-dir options to include firmware in the initramfs

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@612 67a159dc-881f-0410-a524-ba9dfbe2cb84
cleanup-cruft
Andrew Gaffney 17 years ago
parent c1c0655dbb
commit 6ea20790b7

@ -2,6 +2,11 @@
# Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: $ # $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: 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 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 modules, so that the mdev firmware loading can actually work

@ -117,6 +117,11 @@ longusage() {
echo " --initramfs-overlay=<dir>" echo " --initramfs-overlay=<dir>"
echo " Directory structure to include in the initramfs," echo " Directory structure to include in the initramfs,"
echo " only available on 2.6 kernels" 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() { usage() {
@ -476,6 +481,15 @@ parse_cmdline() {
CMD_LUKS=1 CMD_LUKS=1
print_info 2 "CMD_LUKS: ${CMD_LUKS}" 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) all)
BUILD_KERNEL=1 BUILD_KERNEL=1
BUILD_MODULES=1 BUILD_MODULES=1

@ -114,6 +114,8 @@ determine_real_args() {
set_config_with_override 1 DISKLABEL CMD_DISKLABEL set_config_with_override 1 DISKLABEL CMD_DISKLABEL
set_config_with_override 1 LUKS CMD_LUKS set_config_with_override 1 LUKS CMD_LUKS
set_config_with_override 1 MDADM CMD_MDADM 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=`arch_replace "${BOOTDIR}"`
BOOTDIR=${BOOTDIR%/} # Remove any trailing slash BOOTDIR=${BOOTDIR%/} # Remove any trailing slash

@ -251,6 +251,23 @@ append_overlay(){
cd ${INITRAMFS_OVERLAY} cd ${INITRAMFS_OVERLAY}
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" 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() print_list()
{ {
local x local x
@ -449,6 +466,11 @@ create_initramfs() {
append_data 'blkid' "${DISKLABEL}" append_data 'blkid' "${DISKLABEL}"
append_data 'splash' "${SPLASH}" append_data 'splash' "${SPLASH}"
if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
then
append_data 'firmware'
fi
# This should always be appended last # This should always be appended last
if [ "${INITRAMFS_OVERLAY}" != '' ] if [ "${INITRAMFS_OVERLAY}" != '' ]
then then

@ -69,6 +69,9 @@ USECOLOR="yes"
# Copy /etc/mdadm.conf to initramfs. # Copy /etc/mdadm.conf to initramfs.
# MDADM="no" # MDADM="no"
# Enable copying of firmware into initramfs
# FIRMWARE="no"
# FIRMWARE_DIR="/lib/firmware"
# =========Low Level Compile Settings========= # =========Low Level Compile Settings=========
# #

Loading…
Cancel
Save