summaryrefslogtreecommitdiffstats
path: root/openpower/scripts/firmware-whitelist
blob: 0dfbec8cd8f555ebbb8bbffd31f00b75d349f9e4 (plain)
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
#!/bin/bash
# Scan the /lib/firmware directory of the target and delete any firmware
# binaries that are not in our whitelist

# A whitelist of entire directories or specific binary files. The trailing
# slash is required.
whitelist=(     'acenic/'
                'bnx2/'
                'bnx2x/bnx2x-e2-7.13.1.0.fw'
                'cxgb4/'
                'cxgb3/'
                'e100/'
                'ql2500_fw.bin'
                'radeon/CEDAR_rlc.bin'
                'radeon/CEDAR_pfp.bin'
                'radeon/CEDAR_smc.bin'
                'radeon/CEDAR_me.bin'
                'radeon/CYPRESS_uvd.bin')

if [ -z "${TARGET_DIR}" ] ; then
        echo "TARGET_DIR not defined, setting to $1"
        TARGET_DIR=$1
fi

files=$(find ${TARGET_DIR}/lib/firmware/*)
for file in ${files};
do
        if [ -d  $file ] ; then
                continue
        fi

        found=0
        for item in ${whitelist[@]};
        do
                if [ "${file/${item}}" != "${file}" ] ; then
                        found=1
                        break
                fi
        done

        if [ "${found}" -ne "1" ] ; then
                rm -v ${file}
        fi
done
OpenPOWER on IntegriCloud