k2-initramfs: create initramfs image from other packages
RFC 1/1 k2-initramfs: create initramfs image from other packages
* Previously, the k2-initramfs is provided pre-built.
* This recipe can construct the initramfs image from other packages.
* In addition to constructing the image, this recipe also creates a package containing the image so that it may be installed within other filesystem images.
Signed-off-by Jacob Stiffler <[email protected]>
--- .../recipes-core/images/k2-initramfs_1.0.0.bb | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 meta-arago-distro/recipes-core/images/k2-initramfs_1.0.0.bb
meta-arago-distro/recipes-core/images/k2-initramfs_1.0.0.bb new file +89 -0
@@ -0,0 +1,89 @@ +DESCRIPTION = "Keystone2 initramfs with SerDes, QMSS and NETCP PA firmware" + +LICENSE = "TI-TFL" +PACKAGES = "${PN}" + +PR = "r0" + +COMPATIBLE_MACHINE = "keystone" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + + +inherit rootfs_${IMAGE_PKGTYPE} + +PACKAGE_INSTALL = " \ + netcp-pa-fw \ + serdes-fw \ + qmss-pdsp-fw \ +" + + +export IMAGE_BASENAME = "k2-fw-initrd" +export IMAGE_NAME = "${IMAGE_BASENAME}" +export IMAGE_NAME_SUFFIX = "" + +USE_DEVFS = "1" + +# adjust task dependencies +python () { + pkgtype = (d.getVar("IMAGE_PKGTYPE", True) or "") + + package_write_task = 'do_package_write_%s' % pkgtype + + # Remove "do_package_write_*" from recrdeps as that will pull in the + # dependency on this recipe's packaging. + flags = d.getVarFlag('do_rootfs', 'recrdeptask', True) + flags = flags.replace(package_write_task, "") + d.setVarFlag('do_rootfs', 'recrdeptask', flags) + + # Add depends on PACKAGE_INSTALL do_package_write_* + for p in (d.getVar("PACKAGE_INSTALL", True) or "").split(): + flags = d.appendVarFlag('do_rootfs', 'depends', ' %s:%s' % (p, package_write_task)) +} + +# Do the minimal to create a rootfs +fakeroot python do_rootfs () { + from oe.rootfs import create_rootfs + from oe.manifest import create_manifest + + # Generate the initial manifest + create_manifest(d) + + # Generate rootfs + create_rootfs(d) +} +do_rootfs[dirs] = "${TOPDIR}" +do_rootfs[cleandirs] += "${S}" +do_rootfs[umask] = "022" +addtask rootfs before do_install + +# Create the cpio.gz image +do_image() { + local image_base_path="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}" + + cd ${IMAGE_ROOTFS} + + # Only capture the firmwares + (echo .; echo ./lib; find ./lib/firmware; ) | cpio -o -H newc >${image_base_path}.cpio + gzip -f -9 -c ${image_base_path}.cpio > ${image_base_path}.cpio.gz +} +do_image[dirs] = "${TOPDIR}" +do_image[umask] = "022" +addtask do_image after do_rootfs before do_install + +# Now install this image for packaging +do_install() { + local image_base_path="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}" + + install -d ${D}/boot + install -m 0644 ${image_base_path}.cpio.gz ${D}/boot/${IMAGE_BASENAME}.cpio.gz +} + +FILES_${PN} = "/boot" + +do_fetch[noexec] = "1" +do_unpack[noexec] = "1" +do_patch[noexec] = "1" +do_configure[noexec] = "1" +do_compile[noexec] = "1"
Signature · 1 line
2.7.4