diff options
author | Fabio Estevam <festevam@gmail.com> | 2016-11-06 20:43:27 -0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2016-11-07 23:05:34 +0100 |
commit | e3f6475801067c8d0ef0c90a56a357105c5faa34 (patch) | |
tree | 02643d2ecf3dbdd2f3d8ea8a7bbc1be057a8e8f6 /board/freescale/common/imx/post-image.sh | |
parent | 177bbf65669cff25eaff5e0dfbf87ae161ab8803 (diff) | |
download | buildroot-e3f6475801067c8d0ef0c90a56a357105c5faa34.tar.gz buildroot-e3f6475801067c8d0ef0c90a56a357105c5faa34.zip |
freescale: Create the board/freescale/common/imx/ directory
In order to have a better hierarchy for the genimage scripts used by
NXP mx25, mx51, mx53, mx6, mx7 SoCs, let's place them inside the
board/freescale/common/imx/ directory.
This helps in creating a more natural separation between the mxs scripts
that are placed inside the board/freescale/common/mxs/ directory.
Suggested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'board/freescale/common/imx/post-image.sh')
-rwxr-xr-x | board/freescale/common/imx/post-image.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/board/freescale/common/imx/post-image.sh b/board/freescale/common/imx/post-image.sh new file mode 100755 index 0000000000..9e4da82dc7 --- /dev/null +++ b/board/freescale/common/imx/post-image.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# +# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME +# in ${BR_CONFIG}, then prints the corresponding list of file names for the +# genimage configuration file +# +dtb_list() +{ + local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})" + + for dt in $DTB_LIST; do + echo -n "\"$dt.dtb\", " + done +} + +# +# linux_image extracts the Linux image format from BR2_LINUX_KERNEL_UIMAGE in +# ${BR_CONFIG}, then prints the corresponding file name for the genimage +# configuration file +# +linux_image() +{ + if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then + echo "\"uImage\"" + else + echo "\"zImage\"" + fi +} + +main() +{ + local FILES="$(dtb_list) $(linux_image)" + local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)" + local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + + sed -e "s/%FILES%/${FILES}/" \ + board/freescale/common/imx/genimage.cfg.template > ${GENIMAGE_CFG} + + rm -rf "${GENIMAGE_TMP}" + + genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + + rm -f ${GENIMAGE_CFG} + + exit $? +} + +main $@ |