Add recipes to build initramfs image
v3 cover Add recipes to build initramfs image
The series aims to add a new recipe which will package boot essential and some other modules in image which can later be used in the boot process of all K3 platforms. This will result in the addition of ~20MB initramfs image in the bootflow.
The motivation behind the work is to probe modules(in boot time) which could not be built in the upstream Linux kernel image, as using it as inbuilt drivers will increase the kernel image size, which is undesirable by the upstream folks.
Hence, build those drivers as modules and package it inside initramfs and later get it probed through initramfs-udev(device manager).
The series will introduce an additional 20MB initramfs image in the bootflow of all K3 platforms regardless of whether any platform chooses to add modules to it or not, so as to keep the bootflow for all devices uniform. Hence, the build/packaging of initrd image is being triggered in k3.inc.
Boot tests for am62axx, am64xx, j721e:
[0]https://gist.github.com/Jamm02/17fd621af1612f42fdaf69d2d9884e70
Changes since V2:
- Changed initrd -> initramfs.
- Remove blanket change for grub.cfg and instead add the initramfs path only.
- Move utils and other includes to RDEPENDS instead of PACKAGE_INSTALL.
Changes since V1:
- Switch to a platform defined module variable instead of having a central one.
- Package initrd.cpio.xz(20 MB) instead of initrd.cpio (90 MB).
- Build the inird image and package it in boot partition only if mainline or mainline next of the Linux kernel is being built.
Moteen Shah (4):
meta-ti-bsp: conf: machine: include: Add common module variable for TI
Initramfs image
recipes-ti: initramfs: Make minimal initramfs image
meta-ti-bsp: wic: Add initramfs path to to grub config
meta-ti-bsp: conf: machine: include: Build initramfs for all K3
platforms
meta-ti-bsp/conf/machine/include/am62axx.inc | 3 ++ meta-ti-bsp/conf/machine/include/j721e.inc | 3 ++ meta-ti-bsp/conf/machine/include/j784s4.inc | 3 ++ meta-ti-bsp/conf/machine/include/k3.inc | 7 +++- meta-ti-bsp/conf/machine/include/ti-soc.inc | 2 ++ .../packagegroup-ti-core-initramfs.bb | 15 +++++++++ .../recipes-ti/initramfs/ti-core-initramfs.bb | 33 +++++++++++++++++++ meta-ti-bsp/wic/sdimage-2part-efi.wks.in | 2 +- 8 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb create mode 100644 meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
Signature · 1 line
2.34.1
PATCH v3 1/4 meta-ti-bsp: conf: machine: include: Add common module variable for TI Initramfs image
Add a new variable in ti-soc.inc which would be populated by individual platforms with the required modules which would later be packaged inside the initramfs image.
--- meta-ti-bsp/conf/machine/include/am62axx.inc | 3 +++ meta-ti-bsp/conf/machine/include/j721e.inc | 3 +++ meta-ti-bsp/conf/machine/include/j784s4.inc | 3 +++ meta-ti-bsp/conf/machine/include/ti-soc.inc | 2 ++ 4 files changed, 11 insertions(+)
meta-ti-bsp/conf/machine/include/am62axx.inc +3 -0
@@ -11,3 +11,6 @@ TFA_BOARD = "lite" OPTEEMACHINE = "k3-am62x" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "cnm-wave-fw" + +TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = "kernel-module-tps6594-i2c" +TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = "kernel-module-tps6594-i2c"
meta-ti-bsp/conf/machine/include/j721e.inc +3 -0
@@ -19,3 +19,6 @@ TI_VXE_VXD_DRIVER = "ti-vxe-vxd-driver" TI_VXE_VXD_DRIVER:bsp-ti-6_6 = "" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "cadence-mhdp-fw vxd-dec-fw ti-eth-fw-j721e ${TI_VXE_VXD_DRIVER}" + +TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " kernel-module-cdns-pltfrm kernel-module-ti-j721e-ufs" +TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " kernel-module-cdns-pltfrm kernel-module-ti-j721e-ufs"
meta-ti-bsp/conf/machine/include/j784s4.inc +3 -0
@@ -13,3 +13,6 @@ TFA_BOARD = "j784s4" OPTEEMACHINE = "k3-j784s4" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "cadence-mhdp-fw cnm-wave-fw ti-eth-fw-j784s4" + +TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " kernel-module-cdns-pltfrm kernel-module-ti-j721e-ufs" +TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " kernel-module-cdns-pltfrm kernel-module-ti-j721e-ufs"
meta-ti-bsp/conf/machine/include/ti-soc.inc +2 -0
@@ -27,3 +27,5 @@ CLASS_DEVICETREE_PREFIX = "${@ 'ti-devicetree-prefix' if d.getVar('KERNEL_DEVICE KERNEL_CLASSES += "${CLASS_DEVICETREE_PREFIX}" IMAGE_CLASSES += "${CLASS_DEVICETREE_PREFIX}" + +TI_INITRAMFS_KERNEL_MODULES ?= ""
Signature · 1 line
2.34.1
PATCH v3 2/4 recipes-ti: initramfs: Make minimal initramfs image
In reply to Moteen ShahIntroduce a new minimal initramfs image which will be used for all K3 devices in the boot flow. The image will package boot essential and other modules which will be modprobed by initramfs-udev once the inbuilt drivers gets probed.
--- .../packagegroup-ti-core-initramfs.bb | 15 +++++++++ .../recipes-ti/initramfs/ti-core-initramfs.bb | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb create mode 100644 meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb new file +15 -0
@@ -0,0 +1,15 @@ +SUMMARY = "Minimal initramfs for boot requirements" + +require recipes-core/packagegroups/packagegroup-core-boot.bb + +RDEPENDS:${PN} += "\ + ${TI_INITRAMFS_KERNEL_MODULES} \ + initramfs-framework-base \ + initramfs-module-udev \ + initramfs-module-nfsrootfs \ + cifs-utils \ + nfs-utils \ + nfs-utils-client \ +" + +RDEPENDS:${PN}:remove = "grub-efi kernel"
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb new file +33 -0
@@ -0,0 +1,33 @@ +SUMMARY = "TI SDK minimal initramfs image" + +DESCRIPTION = "Image meant to probe boot essential modules\ + and other modules to reach the userspace, which cannot be\ + built inside the upstream linux kernel image.\ +" + +LICENSE = "MIT" + +inherit core-image + +IMAGE_NAME = "ti-core-initramfs" + +IMAGE_NAME_SUFFIX = "" + +IMAGE_FEATURES:remove = "package-management" + +INITRAMFS_FSTYPES = "cpio cpio.xz" + +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" + +PACKAGE_INSTALL = "packagegroup-ti-core-initramfs" + +export IMAGE_BASENAME = "${IMAGE_NAME}" + +# To further reduce the size of the rootfs, remove the /boot directory from +# the final image this is usually done by adding RDEPENDS_kernel-base = "" +# in the configuration file. In our case we can't use this method. Instead we +# just wipe out the content of "/boot" before creating the image. +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; " +empty_boot_dir () { + rm -rf ${IMAGE_ROOTFS}/boot/* +}
Signature · 1 line
2.34.1
PATCH v3 3/4 meta-ti-bsp: wic: Add initramfs path to to grub config
In reply to Moteen ShahAdd initrd path to grub.cfg config so that it picks up the initramfs image from the boot partition and includes it in the boot process.
--- meta-ti-bsp/wic/sdimage-2part-efi.wks.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-ti-bsp/wic/sdimage-2part-efi.wks.in +1 -1
@@ -4,5 +4,5 @@ # reserved space. We cannot use a GPT here. bootloader --timeout=3 --append="rootfstype=ext4 ${TI_WKS_BOOTLOADER_APPEND}" -part --source bootimg-efi --sourceparams="loader=${EFI_PROVIDER}" --fstype=vfat --label boot --active --align 1024 --use-uuid --fixed-size 128M +part --source bootimg-efi --sourceparams="loader=${EFI_PROVIDER},initrd=ti-core-initramfs.cpio.xz" --fstype=vfat --label boot --active --align 1024 --use-uuid --fixed-size 128M part / --source rootfs --fstype=ext4 --label root --align 1024 --use-uuid
Signature · 1 line
2.34.1
PATCH v3 4/4 meta-ti-bsp: conf: machine: include: Build initramfs for all K3 platforms
In reply to Moteen ShahTrigger build for initramfs image and package it in the boot partition of all K3 platforms whenever an image recipe is built with upstream kernel(mainline or mainline-next).
--- meta-ti-bsp/conf/machine/include/k3.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
meta-ti-bsp/conf/machine/include/k3.inc +6 -1
@@ -43,7 +43,12 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "ti-pka-fw" IMAGE_FSTYPES += "tar.xz wic.xz wic.bmap" -IMAGE_BOOT_FILES ?= "${SPL_BINARYNAME} u-boot.${UBOOT_SUFFIX} tiboot3.bin tiboot3-*-evm.bin" +BUILD_CORE_INITRD_IMAGE ?= "" +BUILD_CORE_INITRD_IMAGE:bsp-mainline = "ti-core-initramfs:do_image_complete" +BUILD_CORE_INITRD_IMAGE:bsp-next = "ti-core-initramfs:do_image_complete" +do_image_complete[depends] += "${BUILD_CORE_INITRD_IMAGE}" + +IMAGE_BOOT_FILES ?= "${SPL_BINARYNAME} u-boot.${UBOOT_SUFFIX} tiboot3.bin tiboot3-*-evm.bin ti-core-initramfs.cpio.xz" IMAGE_EFI_BOOT_FILES ?= "${IMAGE_BOOT_FILES}" EFI_PROVIDER ?= "grub-efi"
Signature · 1 line
2.34.1
Re: [meta-ti] [master][PATCH 4/4 v3] meta-ti-bsp: conf: machine: include: Build initramfs for all K3 platforms
Quoted 14 lines · Moteen Shah via lists.yoctoproject.org
Trigger build for initramfs image and package it in the boot partition of all K3 platforms whenever an image recipe is built with upstream kernel(mainline or mainline-next).
Signed-off-by Moteen Shah <[email protected]>--- meta-ti-bsp/conf/machine/include/k3.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)meta-ti-bsp/conf/machine/include/k3.inc +0
-0
meta-ti-bsp/conf/machine/include/k3.inc MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "ti-pka-fw" · line 46
Quoted 5 lines
meta-ti-bsp/conf/machine/include/k3.inc +1
-1@@ -43,7 +43,12 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "ti-pka-fw" IMAGE_FSTYPES += "tar.xz wic.xz wic.bmap" -IMAGE_BOOT_FILES ?= "${SPL_BINARYNAME} u-boot.${UBOOT_SUFFIX} tiboot3.bin tiboot3-*-evm.bin" +BUILD_CORE_INITRD_IMAGE ?= ""
The variable name still uses INITRD here - please be consistent.
meta-ti-bsp/conf/machine/include/k3.inc MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "ti-pka-fw" · line 51
Quoted 5 lines
meta-ti-bsp/conf/machine/include/k3.inc +5
-0+BUILD_CORE_INITRD_IMAGE:bsp-mainline = "ti-core-initramfs:do_image_complete" +BUILD_CORE_INITRD_IMAGE:bsp-next = "ti-core-initramfs:do_image_complete" +do_image_complete[depends] += "${BUILD_CORE_INITRD_IMAGE}" + +IMAGE_BOOT_FILES ?= "${SPL_BINARYNAME} u-boot.${UBOOT_SUFFIX} tiboot3.bin tiboot3-*-evm.bin ti-core-initramfs.cpio.xz"
ti-core-initramfs.cpio.xz gets added here unconditionally - what if it's not enabled and is not getting built?
Quoted 5 lines
meta-ti-bsp/conf/machine/include/k3.inc +0
-0IMAGE_EFI_BOOT_FILES ?= "${IMAGE_BOOT_FILES}" EFI_PROVIDER ?= "grub-efi"Signature · 1 line
2.34.1