Patchwork [2/2] Add mkelfimage and support for generating kernel+initrd ELF payloads to OpenEmbedded

login
register
mail settings
Submitter Raymond Danks
Date July 15, 2011, 4:55 p.m.
Message ID <4E207114.2000602@se-eng.com>
Download mbox | patch
Permalink /patch/7661/
State New, archived
Headers show

Comments

Raymond Danks - July 15, 2011, 4:55 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

The second patch contains the necessary commands for adding the image 
type to bitbake.
---
  conf/bitbake.conf |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)

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 = ""
Paul Menzel - July 15, 2011, 6:54 p.m.
Dear Raymond,


thank you for your patch!

Am Freitag, den 15.07.2011, 10:55 -0600 schrieb Raymond Danks:
> 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
> 
> The second patch contains the necessary commands for adding the image 
> type to bitbake.

Please update the summary to just describe the change of this patch.
Maybe also add an example command line on how to use the new
functionality.

> ---
>   conf/bitbake.conf |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
> 
> 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 = ""
> 

As in the first patch, your Signed-off-by line is missing and your
mailer mangled the patch. Please resend as [PATCH 2/2 v2]. (Please
always describe changed between patch iterations under the `---`.


Thanks,

Paul

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 >>