Background

Intention:
Make it as easy as possible for users to add patches (new features, hotfixes, etc.) to an exisiting (old ) BSP.

Approach:
Use self-installing archive with bash script to add patches to a BSP.

Packaging:
ZIP file with same name (including revision) of target BSP plus extension describing the contents/purpose of the patches, which contains

  • README (= instructions on how to run installer)
  • INSTALLER (= *.run; self-extracting archive running a custom bahs script after extraction)

Details

E.g.

cat <<EOF > README
Target BSP: TQMa335x-BSP-REV0102
Purpose:    Upgrade BSP to accept eMMC 5.0 devices

IMPORTANT:
This patch does not add any features introduced with eMMC 5.0.
It just makes sure eMMC 5.0 devices are detected correctly and can be used properly.

Instructions
============
1. copy/move installer "TQMa335x-BSP-REV0102_add_eMMC5.0_detection.run" to BSP root folder
2. change to BSP root folder
3. execute installer: "./TQMa335x-BSP-REV0102_add_eMMC5.0_detection.run"
EOF
unzip -p ~/workspace/TQMa335x/ARCHIVE/TQMa335x-BSP-REV0102.zip TQMa335x-BSP-REV.0102.tar.gz | tar xvzf -
tar xvf ~/workspace/TQ-ARM-BSP/ARCHIVE/TQ-ARM-BSP-REV.0109.tar.gz 
cat <<EOF > README.TQMa335x_eMMC5.0
Proper detection of eMMC version 5.0 devices added
--> patches/u-boot-2013.07/tqma335x/mmc-add-mmc_version_5_0.patch
EOF
cat <<EOF > TQ_add_eMMC5.0_detection.sh 
#!/bin/bash

TQ_UBOOT_PATCH_PATH="patches/u-boot-2013.07/"
TQ_UBOOT_PATCH_LAST="tqma335x/0032-tqma335x-trigger-cold-reset-to-fix-samsung-ddr3-free.patch"
TQ_UBOOT_PATCH_EMMC="tqma335x/mmc-add-mmc_version_5_0.patch"


apply_patch()
{
	# Setup parameters
	SERIES="${1}series.tqma335x"
	PATCH="$2"
	CONTEXT="$3"
	
	echo -en "Trying to insert \"$PATCH\" into \"$SERIES\" after \"$CONTEXT\" ..."
	
	# Verify prerequisites
	if [ -e "$SERIES" ]
	then
		if grep --quiet $CONTEXT $SERIES
		then
			if grep --quiet $PATCH $SERIES
			then
				echo -e "\nerror: Patch \"$PATCH\" already listed in \"$SERIES\" - aborting!"
				return 3
			fi
		else
			echo -e "\nerror: Cannot find patch \"$CONTEXT\" in \"$SERIES\" - aborting!"
			return 2
		fi
	else
		echo -e "\nerror: \"$SERIES\" does not exist - aborting!"
		return 1
	fi
	
	# Modify series file
	sed -i.bak -e "s|${CONTEXT}|${CONTEXT}\n${PATCH}|" ${SERIES}
	
	if [ -e "${SERIES}.bak" ]
	then
		echo "done!"
	else
		echo "failed"
	fi
}

apply_patch $TQ_UBOOT_PATCH_PATH $TQ_UBOOT_PATCH_EMMC $TQ_UBOOT_PATCH_LAST
let "RETVAL=10*$?"

exit $RETVAL
EOF

e.g.

cp ../SOME_PATH/mmc-add-mmc_version_5_0.patch patches/u-boot-2013.07/tqma335x/

Keep

  • newly created files (i.e. README, script)
  • copied files (i.e. patches) and the folders containing them

Remove

  • anything else
cd TQMa335x-BSP-REV.0102
makeself --current --nocomp . ../TQMa335x-BSP-REV0102_add_eMMC5.0_detection.run "TQMa335x-BSP-REV0102_add_eMMC5.0_detection" ./TQ_add_eMMC5.0_detection.sh
zip -o -0 TQMa335x-BSP-REV0102_add_eMMC5.0_detection.zip TQMa335x-BSP-REV0102_add_eMMC5.0_detection.run README

Disclaimer
TQ-Systems GmbH provides the Board Support Packages (BSP) free of charge. The software included in the shipment has been configured individually for the starter kits. The software is only intended to evaluate the module. The use of the Board Support Packages (BSP) is only allowed within the scope of functionality described by TQ-Systems GmbH. TQ-Systems GmbH does not accept any liability for all further changes of the Board Support Package and for any damage resulting from its use.