diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-16 12:59:47 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-01-16 13:01:46 +0100 |
commit | 80b093752a0d63b8b318de77cb5cd43284a787f0 (patch) | |
tree | d7b42b6531aa288712cf8fbb2cc02594fd838f7f /packages/linux-kernel/build-linux-firmware.sh | |
parent | 180e720cfcbe710b4b0dafabf02d255a6bae49ab (diff) | |
download | vyos-build-80b093752a0d63b8b318de77cb5cd43284a787f0.tar.gz vyos-build-80b093752a0d63b8b318de77cb5cd43284a787f0.zip |
Kernel: T3223: retrieve firmware information from Kernel module binary itself
(cherry picked from commit 062d7e0868d7918d386c11fb4e97f5019c2f66ce)
Diffstat (limited to 'packages/linux-kernel/build-linux-firmware.sh')
-rwxr-xr-x | packages/linux-kernel/build-linux-firmware.sh | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/packages/linux-kernel/build-linux-firmware.sh b/packages/linux-kernel/build-linux-firmware.sh index 4483c9ae..95d8ca56 100755 --- a/packages/linux-kernel/build-linux-firmware.sh +++ b/packages/linux-kernel/build-linux-firmware.sh @@ -12,10 +12,6 @@ LINUX_SRC="linux" LINUX_FIRMWARE="linux-firmware" KERNEL_VAR_FILE=${CWD}/kernel-vars -# Some firmware files might not be easy to extract (e.g. Intel iwlwifi drivers) -# thus we simply ammend them "manually" -ADD_FW_FILES="iwlwifi*" - if [ ! -d ${LINUX_SRC} ]; then echo "Kernel source missing" exit 1 @@ -30,13 +26,12 @@ fi result=() # Retrieve firmware blobs from source files -cd ${LINUX_SRC} -FW_FILES=$(../list-required-firmware.py -c ../x86_64_vyos_defconfig -s drivers/net 2>/dev/null) +FW_FILES=$(find ${LINUX_SRC}/debian/linux-image/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net -name *.ko | xargs modinfo | grep "^firmware:" | awk '{print $2}') # Debian package will use the descriptive Git commit as version GIT_COMMIT=$(cd ${CWD}/${LINUX_FIRMWARE}; git describe --always) VYOS_FIRMWARE_NAME="vyos-linux-firmware" -VYOS_FIRMWARE_DIR="${CWD}/${VYOS_FIRMWARE_NAME}_${GIT_COMMIT}-0_all" +VYOS_FIRMWARE_DIR="${VYOS_FIRMWARE_NAME}_${GIT_COMMIT}-0_all" if [ -d ${VYOS_FIRMWARE_DIR} ]; then # remove Debian package folder and deb file from previous runs rm -rf ${VYOS_FIRMWARE_DIR}* @@ -46,36 +41,22 @@ mkdir -p ${VYOS_FIRMWARE_DIR} # Copy firmware file from linux firmware repository into # assembly folder for the vyos-firmware package SED_REPLACE="s@${CWD}/${LINUX_FIRMWARE}/@@" -for FW_PATH in ${FW_FILES}; do - FW_FILE=$(basename $FW_PATH) - res=() - for tmp in $(find ${CWD}/linux-firmware -type f -name ${FW_FILE} | sed -e ${SED_REPLACE}) - do - res+=( "$tmp" ) - done - - for FILE in ${res[@]}; do +for FILE in ${FW_FILES}; do + if [ -f ${LINUX_FIRMWARE}/${FILE} ]; then FW_DIR="${VYOS_FIRMWARE_DIR}/lib/firmware/$(dirname ${FILE})" mkdir -p ${FW_DIR} echo "I: install firmware: ${FILE}" - cp ${CWD}/linux-firmware/${FILE} ${FW_DIR} - done -done - -# Install additional firmware files that could not be autodiscovered -for FW in ${ADD_FW_FILES} -do - FW_DIR="${VYOS_FIRMWARE_DIR}/lib/firmware/$(dirname ${FW})" - mkdir -p ${FW_DIR} - echo "I: install firmware: ${FW}" - cp ${CWD}/linux-firmware/${FW} ${FW_DIR} + cp ${CWD}/${LINUX_FIRMWARE}/${FILE} ${FW_DIR} + else + echo "I: firmware file not found: ${FILE}" + fi done echo "I: Create linux-firmware package" -cd ${CWD} +rm -f ${VYOS_FIRMWARE_NAME}_*.deb fpm --input-type dir --output-type deb --name ${VYOS_FIRMWARE_NAME} \ --maintainer "VyOS Package Maintainers <maintainers@vyos.net>" \ --description "Binary firmware for various drivers in the Linux kernel" \ - --version ${GIT_COMMIT} --deb-compression gz -C ${VYOS_FIRMWARE_DIR} + --architecture all --version ${GIT_COMMIT} --deb-compression gz -C ${VYOS_FIRMWARE_DIR} rm -rf ${VYOS_FIRMWARE_DIR} |