blob: ea2d6be6d69a254cea73b86e20b10541a9f01824 [file] [log] [blame]
Samuel Mendoza-Jonasd5d10af2016-07-19 15:03:56 +10001#!/bin/bash
2# Scan the /lib/firmware directory of the target and delete any firmware
3# binaries that are not in our whitelist
4
5# A whitelist of entire directories or specific binary files
6whitelist=( 'acenic'
7 'bnx2'
8 'bnx2x'
9 'cxgb4'
10 'cxgb3'
11 'e100'
12 'radeon/CAICOS_me.bin'
13 'radeon/CEDAR_rlc.bin'
14 'radeon/CAICOS_mc.bin'
15 'radeon/CAICOS_pfp.bin'
16 'radeon/CEDAR_pfp.bin'
17 'radeon/CAICOS_smc.bin'
18 'radeon/CEDAR_smc.bin'
19 'radeon/CEDAR_me.bin'
Samuel Mendoza-Jonas276e3c52016-08-03 09:47:11 +100020 'radeon/CYPRESS_uvd.bin'
21 'radeon/BTC_rlc.bin')
Samuel Mendoza-Jonasd5d10af2016-07-19 15:03:56 +100022
23if [ -z "${TARGET_DIR}" ] ; then
24 echo "TARGET_DIR not defined, setting to $1"
25 TARGET_DIR=$1
26fi
27
28files=$(find ${TARGET_DIR}/lib/firmware/*)
29for file in ${files};
30do
31 if [ -d $file ] ; then
32 continue
33 fi
34
35 found=0
36 for item in ${whitelist[@]};
37 do
38 if [ "${file/${item}}" != "${file}" ] ; then
39 found=1
40 break
41 fi
42 done
43
44 if [ "${found}" -ne "1" ] ; then
45 rm -v ${file}
46 fi
47done