Created
March 23, 2018 18:40
-
-
Save akiernan/3d6954b43270f71a7ae6ba0c8d550008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRC_URI += " \ | |
file://boot.cmd \ | |
" | |
DEPENDS += " \ | |
u-boot-mkimage-native \ | |
u-boot-mkenvimage-native \ | |
" | |
UBOOT_ENV_SUFFIX = "scr" | |
UBOOT_ENV = "boot" | |
do_compile_append() { | |
# When (if) we need a signed boot script, do this | |
# sed -e 's:@WORKDIR@:${WORKDIR}:' ${WORKDIR}/boot.its.in >${TMPDIR}/boot.its | |
# mkimage -f ${TMPDIR}/boot.its ${WORKDIR}/${UBOOT_ENV}.${UBOOT_ENV_SUFFIX} | |
mkimage -A arm -T script -C none -d ${WORKDIR}/boot.cmd ${WORKDIR}/${UBOOT_ENV}.${UBOOT_ENV_SUFFIX} | |
if [ -n "${UBOOT_CONFIG}" ]; then | |
unset i j k | |
for config in ${UBOOT_MACHINE}; do | |
i=$(expr $i + 1); | |
for type in ${UBOOT_CONFIG}; do | |
j=$(expr $j + 1); | |
if [ $j -eq $i ]; then | |
cp ${B}/${config}/env/common.o ${TMPDIR}/uboot.env-${config} | |
${OBJCOPY} -O binary -j ".rodata.default_environment" ${TMPDIR}/uboot.env-${config} | |
tr '\0' '\n' < ${TMPDIR}/uboot.env-${config} | sed -e '/^$/d' > ${B}/${config}/uEnv-${type}.txt | |
rm ${TMPDIR}/uboot.env-${config} | |
mkenvimage -s 131072 -o ${B}/${config}/uboot-${type}.env ${B}/${config}/uEnv-${type}.txt | |
fi | |
done | |
unset j | |
done | |
unset i | |
else | |
cp ${B}/env/common.o ${TMPDIR}/uboot.env | |
${OBJCOPY} -O binary -j ".rodata.default_environment" ${TMPDIR}/uboot.env | |
tr '\0' '\n' < ${TMPDIR}/uboot.env | sed -e '/^$/d' > ${B}/uEnv.txt | |
rm ${TMPDIR}/uboot.env | |
mkenvimage -s 131072 -o ${B}/uboot.env ${B}/uEnv.txt | |
fi | |
} | |
do_install_append() { | |
if [ -n "${UBOOT_CONFIG}" ]; then | |
for config in ${UBOOT_MACHINE}; do | |
i=$(expr $i + 1); | |
for type in ${UBOOT_CONFIG}; do | |
j=$(expr $j + 1); | |
if [ $j -eq $i ]; then | |
install -d ${D}/boot | |
install -m 644 ${B}/${config}/uEnv-${type}.txt ${D}/boot/uEnv-${type}-${PV}-${PR}.txt | |
ln -sf uEnv-${type}-${PV}-${PR}.txt ${D}/boot/uEnv-${type}.txt | |
ln -sf uEnv-${type}-${PV}-${PR}.txt ${D}/boot/uEnv.txt | |
install -m 644 ${B}/${config}/uboot-${type}.env ${D}/boot/uboot-${type}-${PV}-${PR}.env | |
ln -sf uboot-${type}-${PV}-${PR}.env ${D}/boot/uboot-${type}.env | |
ln -sf uboot-${type}-${PV}-${PR}.env ${D}/boot/uboot.env | |
fi | |
done | |
unset j | |
done | |
unset i | |
else | |
install -d ${D}/boot | |
install -m 644 ${B}/uEnv.txt ${D}/boot/uEnv-${MACHINE}-${PV}-${PR}.txt | |
ln -sf uEnv-${MACHINE}-${PV}-${PR}.txt ${D}/boot/uEnv.txt | |
install -m 644 ${B}/uboot.env ${D}/boot/uboot-${MACHINE}-${PV}-${PR}.env | |
ln -sf uboot-${MACHINE}-${PV}-${PR}.env ${D}/boot/uboot.env | |
fi | |
} | |
do_deploy_append() { | |
if [ -n "${UBOOT_CONFIG}" ]; then | |
for config in ${UBOOT_MACHINE}; do | |
i=$(expr $i + 1); | |
for type in ${UBOOT_CONFIG}; do | |
j=$(expr $j + 1); | |
if [ $j -eq $i ]; then | |
install -d ${DEPLOYDIR} | |
install -m 644 ${B}/${config}/uEnv-${type}.txt ${DEPLOYDIR}/uEnv-${type}-${PV}-${PR}.txt | |
ln -sf uEnv-${type}-${PV}-${PR}.txt ${DEPLOYDIR}/uEnv-${type}.txt | |
ln -sf uEnv-${type}-${PV}-${PR}.txt ${DEPLOYDIR}/uEnv.txt | |
install -m 644 ${B}/${config}/uboot-${type}.env ${DEPLOYDIR}/uboot-${type}-${PV}-${PR}.env | |
ln -sf uboot-${type}-${PV}-${PR}.env ${DEPLOYDIR}/uboot-${type}.env | |
ln -sf uboot-${type}-${PV}-${PR}.env ${DEPLOYDIR}/uboot.env | |
fi | |
done | |
unset j | |
done | |
unset i | |
else | |
install -d ${DEPLOYDIR} | |
install -m 644 ${B}/uEnv.txt ${D}/uEnv-${MACHINE}-${PV}-${PR}.txt | |
ln -sf uEnv-${MACHINE}-${PV}-${PR}.txt ${DEPLOYDIR}/uEnv.txt | |
install -m 644 ${B}/uboot.env ${D}/uboot-${MACHINE}-${PV}-${PR}.env | |
ln -sf uboot-${MACHINE}-${PV}-${PR}.env ${DEPLOYDIR}/uboot.env | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment