Patchwork [2/2,v2] conf/bitbake.conf: Add support for generating kernel+initrd ELF coreboot payloads

login
register
mail settings
Submitter Raymond Danks
Date July 15, 2011, 11:04 p.m.
Message ID <1310771078-18629-2-git-send-email-ray.danks@se-eng.com>
Download mbox | patch
Permalink /patch/7689/
State New, archived
Headers show

Comments

Raymond Danks - July 15, 2011, 11:04 p.m.
On x86, and ELF image file may be stored as a coreboot payload.  This image file may be a kernel or a kernel+initrd.

Documentation on this has been started on the coreboot wiki:
http://www.coreboot.org/Mkelfimage

We have seen success using the mkelfimage utility to construct a kernel+initrd image using the micro-image OpenEmbedded image as an initrd.
http://www.se-eng.com/wiki/index.php/Open_Embedded_Setup

To use, set a new type "elf" to IMAGE_FSTYPES in conf/local.conf on x86 targets:
IMAGE_FSTYPES = "cpio.gz elf"

You may also override the kernel parameters that are embedded in the elf file:
IMAGE_KERNELPARAMS = "ramdisk_size=32768 root=/dev/ram0 rw console="

The image binary ${TMPDIR}/deploy/images/${MACHINE}/*.elf may be added to the coreboot configuration in Kconfig (CONFIG_PAYLOAD_FILE)

Signed-off-by: Raymond Danks <ray.danks@se-eng.com>
---
v2:
 * Update commit summary and log.
   - Include test and usage steps.
 * Add Signed-off-by

 conf/bitbake.conf |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index 66dfaba..1ab72e1 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -375,6 +375,7 @@  IMAGE_BASENAME = "${PN}"
 IMAGE_NAME = "${IMAGE_BASENAME}-${MACHINE}-${DATETIME}"
 IMAGE_LINK_NAME = "${IMAGE_BASENAME}-${MACHINE}"
 IMAGE_EXTRA_SPACE = 10240
+IMAGE_KERNELPARAMS = "ramdisk_size=32768 root=/dev/ram0 rw console="
 
 UBI_VOLNAME ?= "${MACHINE}-rootfs"
 
@@ -406,6 +407,7 @@  IMAGE_CMD_cpio.gz.u-boot = "type cpio >/dev/null; cd ${IMAGE_ROOTFS} && (find .
 IMAGE_CMD_cpio.lzma = "type cpio >/dev/null; cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | xz --format=lzma -c ${XZ_COMPRESSION_LEVEL} --check=${XZ_INTEGRITY_CHECK} >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.lzma) ${EXTRA_IMAGECMD}"
 IMAGE_CMD_ubi = "echo \[ubifs\] > ubinize.cfg ; echo mode=ubi >> ubinize.cfg ; echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img >> ubinize.cfg ; echo vol_id=0 >> ubinize.cfg ; echo vol_type=dynamic >> ubinize.cfg ; echo vol_name=${UBI_VOLNAME} >> ubinize.cfg ; echo vol_flags=autoresize >> ubinize.cfg;mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS} && ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg"
 IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}"
+IMAGE_CMD_elf = "type cpio >/dev/null; cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz) ; rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.elf ;  mkelfImage --append='${IMAGE_KERNELPARAMS}' --kernel=${STAGING_DIR}/${MACHINE}${HOST_VENDOR}-${HOST_OS}/kernel/bzImage --initrd=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.elf ${EXTRA_IMAGECMD}"
 
 EXTRA_IMAGECMD = ""
 EXTRA_IMAGECMD_jffs2 = ""
@@ -440,6 +442,7 @@  IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
 IMAGE_DEPENDS_squashfs-lzma = "squashfs-tools-native"
 IMAGE_DEPENDS_ubi = "mtd-utils-native"
 IMAGE_DEPENDS_ubifs = "mtd-utils-native"
+IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
 
 EXTRA_IMAGEDEPENDS = ""