diff options
author | Jalen Lin <jalen@driversp.com> | 2023-08-31 06:42:10 +0800 |
---|---|---|
committer | Jalen <jalen@driversp.com> | 2023-08-31 11:35:46 +0800 |
commit | 3708563e64a05ec6300583432be9d4ed4f8647ed (patch) | |
tree | ed7956071627bf795bf60888b6b614d90034c8d6 /packages/linux-kernel | |
parent | cd6067baa3554480a0414d73fcc82cc09f9ef8bc (diff) | |
download | vyos-build-3708563e64a05ec6300583432be9d4ed4f8647ed.tar.gz vyos-build-3708563e64a05ec6300583432be9d4ed4f8647ed.zip |
T5529: Fix missing symbolic link in linux-firmware package.
The original does not copy symbolic link.
Fix the following problems.
1. Copy symbolic link to the target folder
2. Follow link to copy the original file. This is for some firmwares link to other place which not mention in modinfo.
(such as brcm/brcmfmac43455-sdio.bin links to cypress/cyfmac43455-sdio.bin. The cypress folder and firmware does not mention in any module.)
Diffstat (limited to 'packages/linux-kernel')
-rwxr-xr-x | packages/linux-kernel/build-linux-firmware.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/linux-kernel/build-linux-firmware.sh b/packages/linux-kernel/build-linux-firmware.sh index d4d263e2..39cb243b 100755 --- a/packages/linux-kernel/build-linux-firmware.sh +++ b/packages/linux-kernel/build-linux-firmware.sh @@ -57,7 +57,7 @@ mkdir -p "${LINUX_FIRMWARE_BUILD_DIR}" SED_REPLACE="s@${CWD}/${LINUX_FIRMWARE}/@@" for FILE_PATTERN in ${FW_FILES}; do find "${LINUX_FIRMWARE_BUILD_DIR}" -path "*/${FILE_PATTERN}" -print0 | while IFS= read -r -d $'\0' FILE; do - TARGET="$(realpath --relative-to="${LINUX_FIRMWARE_BUILD_DIR}" "${FILE}")" + TARGET="$(echo "${FILE}" | sed "s/${LINUX_FIRMWARE_BUILD_DIR}\///g")" TARGET_DIR="${VYOS_FIRMWARE_DIR}/lib/firmware/$(dirname "${TARGET}")" # If file is a symlink install the symlink target as well if [ -h "${FILE}" ]; then @@ -67,7 +67,15 @@ for FILE_PATTERN in ${FW_FILES}; do echo "I: install firmware: ${TARGET}" cp "${CWD}/${LINUX_FIRMWARE_BUILD_DIR}/${TARGET}" "${TARGET_DIR}" - else + # If file links to other folder which this script not cover. Create folder and copy together. + if [ -L "${LINUX_FIRMWARE_BUILD_DIR}/${TARGET}" ]; then + REALPATH_TARGET=$(realpath --relative-to="${CWD}/${LINUX_FIRMWARE_BUILD_DIR}" "${CWD}/${LINUX_FIRMWARE_BUILD_DIR}/${TARGET}") + REALPATH_TARGET_DIR="${VYOS_FIRMWARE_DIR}/lib/firmware/$(dirname "${REALPATH_TARGET}")" + mkdir -p "${REALPATH_TARGET_DIR}" + echo "I: install firmware: ${REALPATH_TARGET}" + cp "${CWD}/${LINUX_FIRMWARE_BUILD_DIR}/${REALPATH_TARGET}" "${REALPATH_TARGET_DIR}" + fi + else echo "I: firmware file not found: ${TARGET}" fi fi |