====== 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 ======
===== - Create and change to workspace directory =====
===== - Create README for installer =====
E.g.
cat < 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
===== - Extract target BSP =====
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
===== - Create README for patch =====
cat < 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
===== - Create installer script =====
cat < 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
===== - Copy patch files to corresponding paths =====
e.g.
cp ../SOME_PATH/mmc-add-mmc_version_5_0.patch patches/u-boot-2013.07/tqma335x/
===== - Tidy up =====
Keep
* newly created files (i.e. README, script)
* copied files (i.e. patches) and the folders containing them
Remove
* anything else
===== - Change to BSP root folder =====
cd TQMa335x-BSP-REV.0102
===== - Create self-extracting archive =====
makeself --current --nocomp . ../TQMa335x-BSP-REV0102_add_eMMC5.0_detection.run "TQMa335x-BSP-REV0102_add_eMMC5.0_detection" ./TQ_add_eMMC5.0_detection.sh
===== - Package installer =====
zip -o -0 TQMa335x-BSP-REV0102_add_eMMC5.0_detection.zip TQMa335x-BSP-REV0102_add_eMMC5.0_detection.run README