blob: 2d0fc05fb01dbf9db220c3dd77439d0e170180e1 [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
Joel Stanley182a2e02016-11-14 15:25:41 +10305# A whitelist of entire directories or specific binary files. The trailing
6# slash is required.
7whitelist=( 'acenic/'
8 'bnx2/'
Joel Stanley41a7f1e2016-10-31 23:15:44 +10309 'bnx2x/bnx2x-e2-7.13.1.0.fw'
Joel Stanley182a2e02016-11-14 15:25:41 +103010 'cxgb4/'
11 'cxgb3/'
12 'e100/'
Samuel Mendoza-Jonasd5d10af2016-07-19 15:03:56 +100013 'radeon/CEDAR_rlc.bin'
Samuel Mendoza-Jonasd5d10af2016-07-19 15:03:56 +100014 'radeon/CEDAR_pfp.bin'
Samuel Mendoza-Jonasd5d10af2016-07-19 15:03:56 +100015 'radeon/CEDAR_smc.bin'
16 'radeon/CEDAR_me.bin'
Samuel Mendoza-Jonas379b91c2016-09-13 11:26:16 +100017 'radeon/CYPRESS_uvd.bin')
Samuel Mendoza-Jonasd5d10af2016-07-19 15:03:56 +100018
19if [ -z "${TARGET_DIR}" ] ; then
20 echo "TARGET_DIR not defined, setting to $1"
21 TARGET_DIR=$1
22fi
23
24files=$(find ${TARGET_DIR}/lib/firmware/*)
25for file in ${files};
26do
27 if [ -d $file ] ; then
28 continue
29 fi
30
31 found=0
32 for item in ${whitelist[@]};
33 do
34 if [ "${file/${item}}" != "${file}" ] ; then
35 found=1
36 break
37 fi
38 done
39
40 if [ "${found}" -ne "1" ] ; then
41 rm -v ${file}
42 fi
43done