On 7/4/24 2:09 AM, Adrian Freihofer wrote:
From: Adrian Freihofer <[email protected]>
Make the fitimage_assemble function usable with absolute paths for the
generated its and the fitImage file.
Later on this will allow to take the linux.bin and the DTB files from
the sstated deploy derectory and write the generated files to a separate
folder with independent sstate-cache handling.
Add 3 comments which are helpful for the next commit.
Signed-off-by: Adrian Freihofer <[email protected]>
---
meta/classes-recipe/kernel-fitimage.bbclass | 49 ++++++++++++++-------
1 file changed, 34 insertions(+), 15 deletions(-)
diff --git a/meta/classes-recipe/kernel-fitimage.bbclass
b/meta/classes-recipe/kernel-fitimage.bbclass
index fbeb20596ea..e084dc57573 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -174,8 +174,9 @@ fitimage_emit_section_kernel() {
ENTRYPOINT="${UBOOT_ENTRYPOINT}"
if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
+ kernel_base=$(basename $3)
ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
- awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
+ awk '$kernel_base=="${UBOOT_ENTRYSYMBOL}" {print
"0x"$1;exit}'`
fi
cat << EOF >> $1
@@ -572,7 +573,7 @@ fitimage_assemble() {
setupcount=""
bootscr_id=""
default_dtb_image=""
- rm -f $1 arch/${ARCH}/boot/$2
+ rm -f "$1" "arch/${ARCH}/boot/$(basename $2)"
if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then
bbfatal "Keys used to sign images and configuration nodes must be
different."
@@ -586,7 +587,7 @@ fitimage_assemble() {
fitimage_emit_section_maint $1 imagestart
uboot_prep_kimage
- fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
+ fitimage_emit_section_kernel $1 $kernelcount "$(readlink -f linux.bin)"
"$linux_comp"
#
# Step 2: Prepare a DTB image section
@@ -610,9 +611,20 @@ fitimage_assemble() {
DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB"
fi
- # Strip off the path component from the filename
+ # Strip off the path component from the filename
if "${@'false' if
oe.types.boolean(d.getVar('KERNEL_DTBVENDORED')) else 'true'}"; then
- DTB=`basename $DTB`
+ DTB=`basename $DTB`
+ fi
+
I'm purely reading the comment here (below). It talks about using the 'deploy'
folder. I'm not sure what current behavior is, but with our (amd fpga) code,
we've tried to completely move away from using ANYTHING out of the deploy
directory. We found it horrible fragile [during the build] because the
do_deploy can be delayed or not executed in some cases. (To be clear that isn't
a bug!)
Instead everything we've done has moved to using the workdir/recipe-sysroot to
access files and components.
+ # Find DTBs without sub-folders when running in deploy
folder
+ if [ ! -e "$DTB_PATH" ]; then
+ DTB=$(basename $DTB)
+ DTB_PATH=$(readlink -f $DTB)
+ fi
+
+ # Fail as early as possible if there is still no DTB
file found
+ if [ ! -e "$DTB_PATH" ]; then
+ bberror "Cannot find the DTB file at $DTB_PATH"
fi
# Set the default dtb image if it exists in the devicetree.
@@ -665,9 +677,8 @@ fitimage_assemble() {
if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
- cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
bootscr_id="${UBOOT_ENV_BINARY}"
- fitimage_emit_section_boot_script $1 "$bootscr_id"
${UBOOT_ENV_BINARY}
+ fitimage_emit_section_boot_script $1 "$bootscr_id"
"${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}"
else
bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not
found."
fi
@@ -676,9 +687,14 @@ fitimage_assemble() {
#
# Step 4: Prepare a setup section. (For x86)
#
+ # Run from kernel build folder (bundled mode)
if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
setupcount=1
fitimage_emit_section_setup $1 $setupcount
${KERNEL_OUTPUT_DIR}/setup.bin
Same comment here about the 'deploy' vs recipe-sysroot. It looks to me like
it's doing all of this in the CWD, but I'm unclear what it has been set to. So
this could be an issue? I think that's why it was KERNEL_OUTPUT_DIR before.
+ # Run from deploy folder (unbundled mode)
+ elif [ -e setup.bin ]; then
+ setupcount=1
+ fitimage_emit_section_setup $1 $setupcount "$(readlink -f
setup.bin)"
fi
#
@@ -751,8 +767,8 @@ fitimage_assemble() {
#
${UBOOT_MKIMAGE} \
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if
len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
- -f $1 \
- ${KERNEL_OUTPUT_DIR}/$2
+ -f "$1" \
+ "$2"
#
# Step 8: Sign the image
@@ -761,7 +777,7 @@ fitimage_assemble() {
${UBOOT_MKIMAGE_SIGN} \
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if
len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
-F -k "${UBOOT_SIGN_KEYDIR}" \
- -r ${KERNEL_OUTPUT_DIR}/$2 \
+ -r "$2" \
${UBOOT_MKIMAGE_SIGN_ARGS}
fi
}
@@ -769,9 +785,9 @@ fitimage_assemble() {
do_assemble_fitimage() {
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
cd ${B}
- fitimage_assemble fit-image.its fitImage-none ""
+ fitimage_assemble fit-image.its "${KERNEL_OUTPUT_DIR}/fitImage-none"
""
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- ln -sf fitImage-none ${B}/${KERNEL_OUTPUT_DIR}/fitImage
+ ln -sf fitImage-none
"${B}/${KERNEL_OUTPUT_DIR}/fitImage"
fi
fi
}
@@ -791,10 +807,10 @@ do_assemble_fitimage_initramfs() {
test -n "${INITRAMFS_IMAGE}" ; then
cd ${B}
if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
- fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its
fitImage-bundle ""
- ln -sf fitImage-bundle
${B}/${KERNEL_OUTPUT_DIR}/fitImage
+ fitimage_assemble "fit-image-${INITRAMFS_IMAGE}.its"
"${KERNEL_OUTPUT_DIR}/fitImage-bundle" ""
+ ln -sf fitImage-bundle
"${B}/${KERNEL_OUTPUT_DIR}/fitImage"
else
- fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its
fitImage-${INITRAMFS_IMAGE} 1
+ fitimage_assemble "fit-image-${INITRAMFS_IMAGE}.its"
"${KERNEL_OUTPUT_DIR}/fitImage-${INITRAMFS_IMAGE}" 1
fi
fi
}
@@ -852,6 +868,7 @@ kernel_do_deploy:append() {
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
+ # deploy the artifacts of do_assemble_fitimage
bbnote "Copying fit-image.its source file..."
install -m 0644 ${B}/fit-image.its
"$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
@@ -866,12 +883,14 @@ kernel_do_deploy:append() {
fi
if [ -n "${INITRAMFS_IMAGE}" ]; then
+ # deploy the artifacts of
do_assemble_fitimage_initramfs for bundled as well as un-bundled mode
bbnote "Copying fit-image-${INITRAMFS_IMAGE}.its source
file..."
install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its
"$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
ln -snf
fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its
"$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
fi
+ # deploy the artifacts of do_assemble_fitimage_initramfs for bundled mode only
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
bbnote "Copying fitImage-${INITRAMFS_IMAGE}
file..."
install -m 0644
${B}/${KERNEL_OUTPUT_DIR}/fitImage-${INITRAMFS_IMAGE}
"$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#201682):
https://lists.openembedded.org/g/openembedded-core/message/201682
Mute This Topic: https://lists.openembedded.org/mt/107033894/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-