summaryrefslogtreecommitdiff
path: root/distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2017-12-19 11:16:28 +0100
committerJohn Ogness <john.ogness@linutronix.de>2017-12-19 11:16:28 +0100
commit6e7e1b7172813fc4ecb60597f903dd21a4616159 (patch)
treedbfe0b8f1a3d51c275722ba86d4ffe109ee88aef /distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb
parent270520b4a2eac8725c8575c3180964289722e191 (diff)
update yocto-advanced: sync to devel/manut/yocto
The devel/manut/yocto heavily diverted from master. Sync with latest version 8cd4956a9b48a316eab6dc6d1b1f6cd51362fecf. Signed-off-by: John Ogness <john.ogness@linutronix.de>
Diffstat (limited to 'distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb')
-rw-r--r--distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb62
1 files changed, 62 insertions, 0 deletions
diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb
new file mode 100644
index 0000000..e885d25
--- /dev/null
+++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-bsp/boot/qemu-boot-files.bb
@@ -0,0 +1,62 @@
+# specify build dependencies
+DEPENDS += "linux-basic"
+DEPENDS += "u-boot"
+DEPENDS += "u-boot-mkimage-native"
+DEPENDS += "keys-native"
+
+# fit image configuration file
+SRC_URI = "file://signed-config.its"
+
+# license information
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+# create signed fit image for kernel/devicetree and uimage for qemu booting
+do_compile () {
+ # extract TEXT_BASE from u-boot configuration
+ TEXT_BASE=`grep CONFIG_SYS_TEXT_BASE \
+ ${PKG_CONFIG_SYSROOT_DIR}${datadir}/u-boot/u-boot.cfg | \
+ awk '{print $3}'`
+
+ cp ${DEPLOY_DIR_IMAGE}/devicetree-${DTB} dtb
+ cp ${DEPLOY_DIR_IMAGE}/zImage .
+ cp ${WORKDIR}/signed-config.its .
+
+ # create fit image with signed configuration
+ # and update the dtb to contain the public key
+ uboot-mkimage -f signed-config.its \
+ -k ${STAGING_DIR_NATIVE}${datadir_native}/keys \
+ -K dtb -r image.fit
+
+ # create the final u-boot image by appending the new dtb
+ cat ${DEPLOY_DIR_IMAGE}/u-boot-nodtb.bin dtb > u-boot-dtb.bin
+
+ # pack u-boot into a uimage file so we can
+ # trick qemu into booting u-boot
+ uboot-mkimage -A ${HOST_ARCH} -C none -T kernel -O linux \
+ -d u-boot-dtb.bin -a $TEXT_BASE -e $TEXT_BASE u-boot.uimg
+}
+
+# specify task dependencies for compiling
+# - bitbake only knows about dependencies that are specified
+# otherwise it assumes it can do things in parallel
+# - the build dependencies ${DEPEND} only create a task dependency
+# on do_install (do_deploy comes after do_install)
+# - for linux-basic and u-boot-sample we need to wait for do_deploy
+# to complete because our do_compile uses their deployed files
+do_compile[depends] += "linux-basic:do_deploy"
+do_compile[depends] += "u-boot:do_deploy"
+
+# use the deploy class (poky/meta/deploy.bbclass)
+# - this officially creates a deploy task
+# - this creates and sets ${DEPLOYDIR}
+inherit deploy
+
+# deploy fit image (kernel/devicetree) and uimage (u-boot)
+do_deploy () {
+ install -D -m 0644 image.fit ${DEPLOYDIR}/image.fit
+ install -D -m 0644 u-boot.uimg ${DEPLOYDIR}/u-boot.uimg
+}
+
+# set do_deploy to occur after do_install
+addtask do_deploy after do_install