u-boot.inc: Add U-Boot ELF install and deploy

Add support for U-Boot recipes to install and deploy the generated ELF
files for each config. The U-Boot ELF's are useful for debugging, and
booting (directly booting, e.g. by JTAG or using QEMU) and complement
the generated binary image.

This additional feature is disabled by default, machines/etc that want
to use it need to set UBOOT_ELF to the corresponding ELF file (generally
u-boot or u-boot.elf depending on the architecture)

(From OE-Core rev: fae697dedf6ab04b7c123ea5615b1003a79c2422)

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Nathan Rossi 2015-09-10 00:13:19 +10:00 committed by Richard Purdie
parent 302ec46650
commit c2165c9741
1 changed files with 62 additions and 1 deletions

View File

@ -29,6 +29,15 @@ UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
UBOOT_MAKE_TARGET ?= "all"
# Output the ELF generated. Some platforms can use the ELF file and directly
# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging
# purposes.
UBOOT_ELF ?= ""
UBOOT_ELF_SUFFIX ?= "elf"
UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}"
UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}"
UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}"
# Some versions of u-boot build an SPL (Second Program Loader) image that
# should be packaged along with the u-boot binary as well as placed in the
# deploy directory. For those versions they can set the following variables
@ -110,6 +119,30 @@ do_install () {
ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
fi
if [ "x${UBOOT_ELF}" != "x" ]
then
if [ "x${UBOOT_CONFIG}" != "x" ]
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 ${S}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
fi
done
unset j
done
unset i
else
install ${S}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
fi
fi
if [ -e ${WORKDIR}/fw_env.config ] ; then
install -d ${D}${sysconfdir}
install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
@ -147,6 +180,8 @@ do_install () {
}
FILES_${PN} = "/boot ${sysconfdir}"
# Ensure the split debug part of any elf files are put into dbg
FILES_${PN}-dbg += "/boot/.debug"
do_deploy () {
if [ "x${UBOOT_CONFIG}" != "x" ]
@ -177,7 +212,33 @@ do_deploy () {
ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
fi
if [ "x${UBOOT_ELF}" != "x" ]
then
if [ "x${UBOOT_CONFIG}" != "x" ]
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 ${S}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
fi
done
unset j
done
unset i
else
install ${S}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
fi
fi
if [ "x${SPL_BINARY}" != "x" ]