python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / board / freescale / common / imx / post-image.sh
blob9e4da82dc7ce54186fc62d1843944cafab0e4dad
1 #!/usr/bin/env bash
4 # dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
5 # in ${BR_CONFIG}, then prints the corresponding list of file names for the
6 # genimage configuration file
8 dtb_list()
10 local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
12 for dt in $DTB_LIST; do
13 echo -n "\"$dt.dtb\", "
14 done
18 # linux_image extracts the Linux image format from BR2_LINUX_KERNEL_UIMAGE in
19 # ${BR_CONFIG}, then prints the corresponding file name for the genimage
20 # configuration file
22 linux_image()
24 if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
25 echo "\"uImage\""
26 else
27 echo "\"zImage\""
31 main()
33 local FILES="$(dtb_list) $(linux_image)"
34 local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
35 local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
37 sed -e "s/%FILES%/${FILES}/" \
38 board/freescale/common/imx/genimage.cfg.template > ${GENIMAGE_CFG}
40 rm -rf "${GENIMAGE_TMP}"
42 genimage \
43 --rootpath "${TARGET_DIR}" \
44 --tmppath "${GENIMAGE_TMP}" \
45 --inputpath "${BINARIES_DIR}" \
46 --outputpath "${BINARIES_DIR}" \
47 --config "${GENIMAGE_CFG}"
49 rm -f ${GENIMAGE_CFG}
51 exit $?
54 main $@