blob: 801ef8b45f3a4551d5b10360399de3851e442f57 [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'
20 'radeon/CYPRESS_uvd.bin')
21
22if [ -z "${TARGET_DIR}" ] ; then
23 echo "TARGET_DIR not defined, setting to $1"
24 TARGET_DIR=$1
25fi
26
27files=$(find ${TARGET_DIR}/lib/firmware/*)
28for file in ${files};
29do
30 if [ -d $file ] ; then
31 continue
32 fi
33
34 found=0
35 for item in ${whitelist[@]};
36 do
37 if [ "${file/${item}}" != "${file}" ] ; then
38 found=1
39 break
40 fi
41 done
42
43 if [ "${found}" -ne "1" ] ; then
44 rm -v ${file}
45 fi
46done