commit: c576f99b0bbdb2c938d5b73eee61d876ef7cca88
Author: Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 8 22:09:17 2019 +0000
Commit: Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Mar 8 22:09:17 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c576f99b
Misc improvements for FIRMWARE* handling
Change append_firmware to use a space separated list rather than
comma-separated. Also simplify that code a bit.
Add checks to ensure FIRMWARE_FILES is a space-separated list, and
using relative paths. Adjust genkernel.conf comments to clarify those
requirements.
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>
gen_determineargs.sh | 9 +++++++++
gen_initramfs.sh | 8 +-------
genkernel.conf | 5 +++--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index bd0150a..fee7f75 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -243,5 +243,14 @@ determine_real_args() {
*) gen_die "Invalid microcode '${MICROCODE}',
--microcode=<type> requires one of: no, all, intel, amd" ;;
esac
+ if isTrue "${FIRMWARE}"
+ then
+ for ff in ${FIRMWARE_FILES}; do
+ [[ ${ff} = /* ]] && gen_die "FIRMWARE_FILES should list
paths relative to FIRMWARE_DIR, not absolute."
+ done
+
+ [[ "${FIRMWARE_FILES}" = *,* ]] && gen_die "FIRMWARE_FILES
should be a space-separated list."
+ fi
+
get_KV
}
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index b4200c7..9b8f76c 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -734,15 +734,9 @@ append_firmware() {
cd "${TEMP}/initramfs-firmware-temp"
if [ -n "${FIRMWARE_FILES}" ]
then
- OLD_IFS=$IFS
- IFS=","
pushd ${FIRMWARE_DIR} >/dev/null
- for i in ${FIRMWARE_FILES}
- do
- cp -L --parents "${i}"
${TEMP}/initramfs-firmware-temp/lib/firmware/
- done
+ cp -rL --parents
--target-directory="${TEMP}/initramfs-firmware-temp/lib/firmware/"
${FIRMWARE_FILES}
popd >/dev/null
- IFS=$OLD_IFS
else
cp -a "${FIRMWARE_DIR}"/*
${TEMP}/initramfs-firmware-temp/lib/firmware/
fi
diff --git a/genkernel.conf b/genkernel.conf
index 858a52b..6eae321 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -130,8 +130,9 @@ USECOLOR="yes"
#FIRMWARE="no"
# Specify directory to pull from
#FIRMWARE_DIR="/lib/firmware"
-# Specify firmware files to include, relative to FIRMWARE_DIR. If empty or
-# unset, the full contents of FIRMWARE_DIR will be copied recursively.
+# Specify a space-separated list of firmware files or directories to include,
+# relative to FIRMWARE_DIR. If empty or unset, the full contents of
+# FIRMWARE_DIR will be included.
#FIRMWARE_FILES=""
# Enable disklabel support (copies blkid to initrd)