summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-07-12 09:58:12 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-13 23:28:31 +0100
commitaf8bca244faa8aefb0188609cec50944a410cb25 (patch)
treee6a4eb560f8024648a17930c2793f5a8cf86c88b /meta/classes-recipe
parentf72d264226364a874835fa526ebf31c4a1e05911 (diff)
downloadpoky-af8bca244faa8aefb0188609cec50944a410cb25.tar.gz
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: 4c4f1e020533c26f90e95960745f6de90d77e64e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r--meta/classes-recipe/baremetal-image.bbclass32
1 files changed, 29 insertions, 3 deletions
diff --git a/meta/classes-recipe/baremetal-image.bbclass b/meta/classes-recipe/baremetal-image.bbclass
index 4e7d413626..7938c0a83f 100644
--- a/meta/classes-recipe/baremetal-image.bbclass
+++ b/meta/classes-recipe/baremetal-image.bbclass
@@ -30,6 +30,9 @@ BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}"
30IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}" 30IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}"
31IMAGE_NAME_SUFFIX ?= "" 31IMAGE_NAME_SUFFIX ?= ""
32 32
33IMAGE_OUTPUT_MANIFEST_DIR = "${WORKDIR}/deploy-image-output-manifest"
34IMAGE_OUTPUT_MANIFEST = "${IMAGE_OUTPUT_MANIFEST_DIR}/manifest.json"
35
33do_rootfs[dirs] = "${IMGDEPLOYDIR} ${DEPLOY_DIR_IMAGE}" 36do_rootfs[dirs] = "${IMGDEPLOYDIR} ${DEPLOY_DIR_IMAGE}"
34 37
35do_image(){ 38do_image(){
@@ -37,8 +40,28 @@ do_image(){
37 install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.elf 40 install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.elf
38} 41}
39 42
40do_image_complete(){ 43python do_image_complete(){
41 : 44 from pathlib import Path
45 import json
46
47 data = {
48 "taskname": "do_image",
49 "imagetype": "baremetal-image",
50 "images": []
51 }
52
53 img_deploy_dir = Path(d.getVar("IMGDEPLOYDIR"))
54
55 for child in img_deploy_dir.iterdir():
56 if not child.is_file() or child.is_symlink():
57 continue
58
59 data["images"].append({
60 "filename": child.name,
61 })
62
63 with open(d.getVar("IMAGE_OUTPUT_MANIFEST"), "w") as f:
64 json.dump([data], f)
42} 65}
43 66
44python do_rootfs(){ 67python do_rootfs(){
@@ -62,6 +85,7 @@ python do_rootfs(){
62 bb.utils.mkdirhier(sysconfdir) 85 bb.utils.mkdirhier(sysconfdir)
63 86
64 execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND')) 87 execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND'))
88 execute_pre_post_process(d, d.getVar("ROOTFS_POSTUNINSTALL_COMMAND"))
65} 89}
66 90
67 91
@@ -72,6 +96,8 @@ SSTATE_SKIP_CREATION:task-image-complete = '1'
72do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}" 96do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
73do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" 97do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
74do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}" 98do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
99do_image_complete[sstate-plaindirs] += "${IMAGE_OUTPUT_MANIFEST_DIR}"
100do_image_complete[dirs] += "${IMAGE_OUTPUT_MANIFEST_DIR}"
75addtask do_image_complete after do_image before do_build 101addtask do_image_complete after do_image before do_build
76 102
77python do_image_complete_setscene () { 103python do_image_complete_setscene () {
@@ -140,5 +166,5 @@ python(){
140 else: 166 else:
141 deps += " %s:%s" % (dep, task) 167 deps += " %s:%s" % (dep, task)
142 return deps 168 return deps
143 d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_sysroot')) 169 d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_sysroot'))
144} 170}