/lib/firmware/scripts/check_firmware is in linux-firmware 1.127.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #!/bin/bash
#
# Check that the firmware files in the kernel match those in this
# repository. Conversely, check that the firmware files in the
# firmware repository are also referenced in a kernel MODULE_FIRMWARE
# definition.
#
if [ ! -f WHENCE ]
then
echo This script must be run from the root of the
echo linux-firmware repository.
exit 1
fi
if [ "${KSRC}" = "" ] || [ ! -f "${KSRC}/MAINTAINERS" ]
then
echo You must set a path to the kernel source tree.
echo Example: KSRC=../linux-2.6 $0
exit 1
fi
#
# Intel IWL firmware file names just gotta be special. Ignore them
# in this check. Plenty of folks will complain if they're missing.
#
BLACKLIST="-e /IWL/d"
#
# Print a list of firmware files referenced in a MODULE_FIRMWARE instance
# that is missing in the linux-firmware repository.
#
let i=0
find ${KSRC} -type f -name "*.[ch]" | xargs grep MODULE_FIRMWARE | grep '"' | \
sed ${BLACKLIST} -e 's/^.*MODULE_FIRMWARE("//' -e 's/".*$//' | while read f
do
if [ ! -f "${f}" ]
then
echo Missing: $f
fi
names[${i#*:}]="$f"
let i=$i+1
done
WHITELIST="-e /LICENSE/d -e /LICENCE/d -e /WHENCE/d -e /\.git/d -e /iwlwifi/d"
#
# Print a list of files found in this linux-firmware repository that are not
# referenced in a MODULE_FIRMWARE instance.
#
find . -type f | sed ${WHITELIST} | while read f
do
let i=0
let found=0
while [ $i -lt ${#names[@]} ]
do
if [ "$f" = "${names[${i}]}"
then
let found=1
let i=${#names[@]}
fi
let i=$i+1
done
if [ ${found} -lt 1 ]
then
echo Could not find $f in any kernel MODULE_FIRMWARE definitions.
fi
done
|