Merge pull request #541 from sammj/firenze-firmware
Install radeon firmware binaries on firenze platforms
diff --git a/openpower/configs/firenze_defconfig b/openpower/configs/firenze_defconfig
index 96e7b53..861d8b1 100644
--- a/openpower/configs/firenze_defconfig
+++ b/openpower/configs/firenze_defconfig
@@ -34,7 +34,7 @@
BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
BR2_ROOTFS_OVERLAY="../openpower/overlay"
BR2_ROOTFS_DEVICE_TABLE="../openpower/device_table.txt"
-BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var"
+BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firenze-firmware-whitelist"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4.14"
@@ -48,6 +48,7 @@
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
BR2_PACKAGE_LINUX_FIRMWARE_CXGB4_T4=y
+BR2_PACKAGE_LINUX_FIRMWARE_RADEON=y
BR2_PACKAGE_I2C_TOOLS=y
BR2_PACKAGE_NCURSES_WCHAR=y
BR2_PACKAGE_DROPBEAR=y
diff --git a/openpower/scripts/firenze-firmware-whitelist b/openpower/scripts/firenze-firmware-whitelist
new file mode 100755
index 0000000..801ef8b
--- /dev/null
+++ b/openpower/scripts/firenze-firmware-whitelist
@@ -0,0 +1,46 @@
+#!/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
+whitelist=( 'acenic'
+ 'bnx2'
+ 'bnx2x'
+ 'cxgb4'
+ 'cxgb3'
+ 'e100'
+ 'radeon/CAICOS_me.bin'
+ 'radeon/CEDAR_rlc.bin'
+ 'radeon/CAICOS_mc.bin'
+ 'radeon/CAICOS_pfp.bin'
+ 'radeon/CEDAR_pfp.bin'
+ 'radeon/CAICOS_smc.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