diff options
author | Milton D. Miller II <miltonm@us.ibm.com> | 2016-01-21 00:36:27 +0300 |
---|---|---|
committer | Milton D. Miller II <miltonm@us.ibm.com> | 2016-01-29 00:45:36 +0300 |
commit | ee7c1206b575b634e27b605664bdaade9dd814ec (patch) | |
tree | 7803040952d124d2f4c1f6a6b0475fbeb683f0ea /meta-phosphor/classes | |
parent | 804897b42a7d354d585ddb5a2748ca4fc1d997ff (diff) | |
download | openbmc-ee7c1206b575b634e27b605664bdaade9dd814ec.tar.xz |
Create image class image-overlay and move phosphor to use it
This commit creates a new class image-overlay based on how the
image-live class is structured. It takes parameters for the base
and overlayed file system types but the initfs only support ext4
over squashfs presently.
It then moves invoking the generation of the flash image from a
post image creation command to a separate task invoked from the
overlay image so that building the initramfs image by itself does
not try to create a flash image.
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Diffstat (limited to 'meta-phosphor/classes')
-rw-r--r-- | meta-phosphor/classes/image-overlay.bbclass | 18 | ||||
-rw-r--r-- | meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass | 55 |
2 files changed, 56 insertions, 17 deletions
diff --git a/meta-phosphor/classes/image-overlay.bbclass b/meta-phosphor/classes/image-overlay.bbclass new file mode 100644 index 0000000000..1c6137d7a1 --- /dev/null +++ b/meta-phosphor/classes/image-overlay.bbclass @@ -0,0 +1,18 @@ + +INITRD_IMAGE ?= "core-image-minimal-initramfs" +INITRD ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.${INITRD_CTYPE}${uboot}" + +IMAGE_BASETYPE ?= "squashfs-xz" +OVERLAY_BASETYPE ?= "ext4" + +IMAGE_TYPES_${PN} += "${IMAGE_BASETYPE}" + +IMAGE_TYPEDEP_overlay = "${IMAGE_BASETYPE} ${OVERLAY_BASETYPE}" +IMAGE_TYPES_MASKED += "overlay" + +ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.${IMAGE_BASETYPE}" + +do_generate_flash[depends] += "${INITRD_IMAGE}:do_rootfs" +do_generate_flash[depends] += "${PN}:do_rootfs" + +addtask generate_flash after do_rootfs before do_build diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass index 835e890c4a..14e9289238 100644 --- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass @@ -4,44 +4,65 @@ inherit image_types_uboot # the image load address and entry point. Override it here. oe_mkimage () { - mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_NAME} \ + mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_BASENAME} \ -a ${INITRD_IMAGE_LOADADDRESS} -e ${INITRD_IMAGE_ENTRYPOINT} \ -d ${DEPLOY_DIR_IMAGE}/$1 ${DEPLOY_DIR_IMAGE}/$1.u-boot } INITRD_IMAGE_ENTRYPOINT ?= "0x40800000" INITRD_IMAGE_LOADADDRESS ?= "${INITRD_IMAGE_ENTRYPOINT}" +INITRD_LINK_NAME = "${INITRD_IMAGE}-${MACHINE}${INITRAMFS_FSTYPE}" FLASH_IMAGE_NAME ?= "flash-${MACHINE}-${DATETIME}" FLASH_IMAGE_LINK ?= "flash-${MACHINE}" FLASH_UBOOT_OFFSET ?= "0" FLASH_KERNEL_OFFSET ?= "512" -FLASH_ROOTFS_OFFSET ?= "3072" +FLASH_INITRD_OFFSET ?= "3072" +FLASH_ROFS_OFFSET ?= "4864" +FLASH_RWFS_OFFSET ?= "28672" +RWFS_SIZE ?= "4096" -IMAGE_POSTPROCESS_COMMAND += "do_generate_flash" +# $(( ${FLASH_SIZE} - ${FLASH_RWFS_OFFSET} )) + +# IMAGE_POSTPROCESS_COMMAND += "do_generate_flash" do_generate_flash() { - kernel="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}" - uboot="${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX}" - rootfs="${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.cpio.${IMAGE_CTYPE}.u-boot" - if [ ! -f $kernel ]; then - bbfatal "Kernel file ${kernel} does not exist" + INITRD_CTYPE=${INITRAMFS_CTYPE} + ddir="${DEPLOY_DIR_IMAGE}" + kernel="${KERNEL_IMAGETYPE}" + uboot="u-boot.${UBOOT_SUFFIX}" + initrd="${INITRD_LINK_NAME}.cpio.${INITRD_CTYPE}" + uinitrd="${initrd}.u-boot" + rootfs="${IMAGE_LINK_NAME}.${IMAGE_BASETYPE}" + rwfs="rwfs.${OVERLAY_BASETYPE}" + + if [ ! -f $ddir/$kernel ]; then + bbfatal "Kernel file ${ddir}/${kernel} does not exist" fi - if [ ! -f $uboot ]; then - bbfatal "U-boot file ${uboot} does not exist" + if [ ! -f $ddir/$uboot ]; then + bbfatal "U-boot file ${ddir}/${uboot} does not exist" fi - if [ ! -f $rootfs ]; then - bbfatal "Rootfs file ${rootfs} does not exist" + if [ ! -f $ddir/$initrd ]; then + bbfatal "initrd file ${ddir}/${initrd} does not exist" fi + if [ ! -f $ddir/$rootfs ]; then + bbfatal "Rootfs file ${ddir}/${rootfs} does not exist" + fi + + oe_mkimage "${initrd}" "${INITRD_CTYPE}" || bbfatal "oe_mkimage initrd" + dd if=/dev/zero of=${ddir}/${rwfs} bs=1k count=${RWFS_SIZE} + mkfs.${OVERLAY_BASETYPE} -b 4096 -F -O^huge_file ${ddir}/${rwfs} || bbfatal "mkfs rwfs" - dst="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_NAME}" + dst="${ddir}/${FLASH_IMAGE_NAME}" rm -rf $dst dd if=/dev/zero of=${dst} bs=1k count=${FLASH_SIZE} - dd if=${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET} - dd if=${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET} - dd if=${rootfs} of=${dst} bs=1k seek=${FLASH_ROOTFS_OFFSET} - dstlink="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_LINK}" + dd if=${ddir}/${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET} + dd if=${ddir}/${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET} + dd if=${ddir}/${uinitrd} of=${dst} bs=1k seek=${FLASH_INITRD_OFFSET} + dd if=${ddir}/${rootfs} of=${dst} bs=1k seek=${FLASH_ROFS_OFFSET} + dd if=${ddir}/${rwfs} of=${dst} bs=1k seek=${FLASH_RWFS_OFFSET} + dstlink="${ddir}/${FLASH_IMAGE_LINK}" rm -rf $dstlink ln -sf ${FLASH_IMAGE_NAME} $dstlink } |