Generate /firmware/Contents-firmware

This file is also present in the netinst image and is used by hw-detect
for efficient lookup of firmware files
This commit is contained in:
Roland Clobus 2024-05-26 22:32:54 +02:00
parent 2bc716193d
commit 137b8e2eed
2 changed files with 22 additions and 0 deletions

View File

@ -52,6 +52,14 @@ Firmware_List_From_Contents () {
local PACKAGES
PACKAGES="$(gunzip -c "${CONTENTS_FILE}" | awk '/^(usr\/)?lib\/firmware/ { print $NF }' | sort -u )"
FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} ${PACKAGES}"
if [ -n "${FIRMWARE_DETAILS_FILE}" ]
then
# Use similar formatting as tools/make-firmware-image from debian-cd
# Note: for firmware/Contents-firmware (used by check-missing-firmware.sh from hw-detect),
# the second argument must be the filename of the package.
# That information is not available here and will be added by installer_debian-installer
gunzip -c "${CONTENTS_FILE}" | awk --assign AREA=${_ARCHIVE_AREA} '/^(usr\/)?lib\/firmware/ { printf "/%-54s %s %s\n", $1, $2, AREA }' >> ${FIRMWARE_DETAILS_FILE}
fi
# Don't waste disk space, if not making use of caching
if [ "${LB_CACHE}" != "true" ]

View File

@ -455,6 +455,10 @@ then
Echo_debug "DI_REQ_PACKAGES: %s" "${DI_REQ_PACKAGES}"
Echo_debug "DI_PACKAGES: %s" "${DI_PACKAGES}"
# The file is generated by Firmware_List_From_Contents, ensure a fresh copy
FIRMWARE_DETAILS_FILE="installer_firmware_details.txt"
rm -f ${FIRMWARE_DETAILS_FILE}
# Include firmware packages
if [ "${LB_FIRMWARE_BINARY}" = "true" ]
then
@ -648,12 +652,22 @@ EOF
for _FILE in $(find ../pool -name "${_PACKAGE}_*.deb")
do
ln -sf ${_FILE} ./
if [ -e ../../${FIRMWARE_DETAILS_FILE} ]
then
# Create Contents-firmware similar to tools/make-firmware-image from debian-cd
# This file is used by check-missing-firmware.sh from hw-detect
# Note: the second argument is replaced by the filename of the package
sed --silent -e "s/ [^ ]*\/${_PACKAGE}/ "$(basename ${_FILE})"/p" ../../${FIRMWARE_DETAILS_FILE} >> Contents-firmware
fi
done
done
cd "${OLDPWD}"
fi
# No longer needed
rm -f ${FIRMWARE_DETAILS_FILE}
# Udeb handling
mkdir -p binary.udeb/pool-udeb/main
cd binary.udeb