2016-09-08 00:29:08 +02:00
|
|
|
#!/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()
|
|
|
|
{
|
2018-04-12 14:35:23 +02:00
|
|
|
local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
|
2016-09-08 00:29:08 +02:00
|
|
|
|
|
|
|
for dt in $DTB_LIST; do
|
2018-04-12 14:35:23 +02:00
|
|
|
echo -n "\"`basename $dt`.dtb\", "
|
2016-09-08 00:29:08 +02:00
|
|
|
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\""
|
2018-04-12 14:35:23 +02:00
|
|
|
elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
|
|
|
|
echo "\"Image\""
|
2016-09-08 00:29:08 +02:00
|
|
|
else
|
|
|
|
echo "\"zImage\""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-09-16 15:12:11 +02:00
|
|
|
genimage_type()
|
|
|
|
{
|
|
|
|
if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
|
|
|
|
echo "genimage.cfg.template_spl"
|
|
|
|
else
|
|
|
|
echo "genimage.cfg.template"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-09-08 00:29:08 +02:00
|
|
|
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}/" \
|
2017-09-16 15:12:11 +02:00
|
|
|
board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}
|
2016-09-08 00:29:08 +02:00
|
|
|
|
|
|
|
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 $@
|