mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
classes-recipe/baremetal-image: Add image file manifest
Downstream tasks may want to know what image files were written so write out a manifest in do_image_complete. The format of the manifest is the same as the one in image.bbclass (From OE-Core rev: e15a9934be84c59fc1bf957a60fa395e521abcfc) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
a905366ee1
commit
35b2b34407
@@ -30,6 +30,9 @@ BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}"
|
|||||||
IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}"
|
IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}"
|
||||||
IMAGE_NAME_SUFFIX ?= ""
|
IMAGE_NAME_SUFFIX ?= ""
|
||||||
|
|
||||||
|
IMAGE_OUTPUT_MANIFEST_DIR = "${WORKDIR}/deploy-image-output-manifest"
|
||||||
|
IMAGE_OUTPUT_MANIFEST = "${IMAGE_OUTPUT_MANIFEST_DIR}/manifest.json"
|
||||||
|
|
||||||
do_rootfs[dirs] = "${IMGDEPLOYDIR} ${DEPLOY_DIR_IMAGE}"
|
do_rootfs[dirs] = "${IMGDEPLOYDIR} ${DEPLOY_DIR_IMAGE}"
|
||||||
|
|
||||||
do_image(){
|
do_image(){
|
||||||
@@ -37,8 +40,28 @@ do_image(){
|
|||||||
install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.elf
|
install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.elf
|
||||||
}
|
}
|
||||||
|
|
||||||
do_image_complete(){
|
python do_image_complete(){
|
||||||
:
|
from pathlib import Path
|
||||||
|
import json
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"taskname": "do_image",
|
||||||
|
"imagetype": "baremetal-image",
|
||||||
|
"images": []
|
||||||
|
}
|
||||||
|
|
||||||
|
img_deploy_dir = Path(d.getVar("IMGDEPLOYDIR"))
|
||||||
|
|
||||||
|
for child in img_deploy_dir.iterdir():
|
||||||
|
if not child.is_file() or child.is_symlink():
|
||||||
|
continue
|
||||||
|
|
||||||
|
data["images"].append({
|
||||||
|
"filename": child.name,
|
||||||
|
})
|
||||||
|
|
||||||
|
with open(d.getVar("IMAGE_OUTPUT_MANIFEST"), "w") as f:
|
||||||
|
json.dump([data], f)
|
||||||
}
|
}
|
||||||
|
|
||||||
python do_rootfs(){
|
python do_rootfs(){
|
||||||
@@ -62,6 +85,7 @@ python do_rootfs(){
|
|||||||
bb.utils.mkdirhier(sysconfdir)
|
bb.utils.mkdirhier(sysconfdir)
|
||||||
|
|
||||||
execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND'))
|
execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND'))
|
||||||
|
execute_pre_post_process(d, d.getVar("ROOTFS_POSTUNINSTALL_COMMAND"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,6 +96,8 @@ SSTATE_SKIP_CREATION:task-image-complete = '1'
|
|||||||
do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
|
do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
|
||||||
do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
|
do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
|
||||||
do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
|
do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
|
||||||
|
do_image_complete[sstate-plaindirs] += "${IMAGE_OUTPUT_MANIFEST_DIR}"
|
||||||
|
do_image_complete[dirs] += "${IMAGE_OUTPUT_MANIFEST_DIR}"
|
||||||
addtask do_image_complete after do_image before do_build
|
addtask do_image_complete after do_image before do_build
|
||||||
|
|
||||||
python do_image_complete_setscene () {
|
python do_image_complete_setscene () {
|
||||||
@@ -140,5 +166,5 @@ python(){
|
|||||||
else:
|
else:
|
||||||
deps += " %s:%s" % (dep, task)
|
deps += " %s:%s" % (dep, task)
|
||||||
return deps
|
return deps
|
||||||
d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_sysroot'))
|
d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_sysroot'))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user