Introduce a minimal initramfs image used to probe boot-essential and
other modules that cannot be built directly into the upstream Linux
kernel image without growing it unnecessarily. ti-soc.inc wires the
enable/trigger logic (ti-core-initramfs.inc) in so any K3 image's
do_image_wic automatically depends on it once
TI_CORE_INITRAMFS_ENABLED is set.

Signed-off-by: Moteen Shah <[email protected]>
---
 .../machine/include/ti-core-initramfs.inc     | 23 ++++++++++++
 meta-ti-bsp/conf/machine/include/ti-soc.inc   |  1 +
 .../packagegroup-ti-core-initramfs.bb         | 25 +++++++++++++
 .../recipes-ti/initramfs/ti-core-initramfs.bb | 37 +++++++++++++++++++
 4 files changed, 86 insertions(+)
 create mode 100644 meta-ti-bsp/conf/machine/include/ti-core-initramfs.inc
 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

diff --git a/meta-ti-bsp/conf/machine/include/ti-core-initramfs.inc 
b/meta-ti-bsp/conf/machine/include/ti-core-initramfs.inc
new file mode 100644
index 00000000..15c05e04
--- /dev/null
+++ b/meta-ti-bsp/conf/machine/include/ti-core-initramfs.inc
@@ -0,0 +1,23 @@
+#------------------------------------------------------------------------------
+#
+# To turn off the ti-core-initramfs.cpio creation just set:
+#
+#   TI_CORE_INITRAMFS_ENABLED = "0"
+#
+#------------------------------------------------------------------------------
+TI_CORE_INITRAMFS_ENABLED ?= "${@ '1' if 
d.getVar('TI_CORE_INITRAMFS_KERNEL_MODULES') or 
d.getVar('TI_CORE_INITRAMFS_EXTRA_INSTALL') or 
bb.utils.contains('DISTRO_FEATURES', 'luks', True, False, d) else '0'}"
+
+TI_CORE_INITRAMFS_KERNEL_MODULES ?= ""
+TI_CORE_INITRAMFS_EXTRA_INSTALL ?= ""
+
+TI_CORE_INITRAMFS_IMAGE = "ti-core-initramfs"
+TI_CORE_INITRAMFS_IMAGE_FILE = "${TI_CORE_INITRAMFS_IMAGE}.cpio.xz"
+
+#------------------------------------------------------------------------------
+# Apply all of the needed changes to create/use the initramfs (if enabled).
+#------------------------------------------------------------------------------
+do_image_wic[depends] += "${@ '${TI_CORE_INITRAMFS_IMAGE}:do_image_complete' 
if d.getVar('TI_CORE_INITRAMFS_ENABLED') == "1" else ''}"
+
+TI_WKS_INITRAMFS ?= "${@ ',initrd=${TI_CORE_INITRAMFS_IMAGE_FILE}' if 
d.getVar('TI_CORE_INITRAMFS_ENABLED') == "1" else ''}"
+
+IMAGE_BOOT_FILES += "${@ '${TI_CORE_INITRAMFS_IMAGE_FILE}' if 
d.getVar('TI_CORE_INITRAMFS_ENABLED') == "1" else ''}"
diff --git a/meta-ti-bsp/conf/machine/include/ti-soc.inc 
b/meta-ti-bsp/conf/machine/include/ti-soc.inc
index 438dd6ab..c4472113 100644
--- a/meta-ti-bsp/conf/machine/include/ti-soc.inc
+++ b/meta-ti-bsp/conf/machine/include/ti-soc.inc
@@ -3,6 +3,7 @@
 SOC_FAMILY = "ti-soc"
 require conf/machine/include/soc-family.inc
 require conf/machine/include/ti-extras.inc
+require conf/machine/include/ti-core-initramfs.inc

 # kernel, initrd load addresses for the fitImage in all TI platforms
 UBOOT_ENTRYPOINT = "0x82000000"
diff --git a/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb 
b/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb
new file mode 100644
index 00000000..a9eff847
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb
@@ -0,0 +1,25 @@
+SUMMARY = "Minimal initramfs for boot requirements"
+
+LICENSE = "MIT"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+inherit packagegroup
+
+TI_CORE_INITRAMFS_KERNEL_MODULES ?= ""
+
+RDEPENDS:${PN} += "\
+    ${TI_CORE_INITRAMFS_KERNEL_MODULES} \
+    ${VIRTUAL-RUNTIME_base-utils} \
+    ${VIRTUAL-RUNTIME_login_manager} \
+    ${VIRTUAL-RUNTIME_init_manager} \
+    ${VIRTUAL-RUNTIME_dev_manager} \
+    ${VIRTUAL-RUNTIME_update-alternatives} \
+    netbase \
+    base-files \
+    base-passwd \
+    initramfs-framework-base \
+    initramfs-module-udev \
+    initramfs-module-nfsrootfs \
+    nfs-utils-mount \
+"
diff --git a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb 
b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
new file mode 100644
index 00000000..0180f09e
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
@@ -0,0 +1,37 @@
+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"
+
+INITRAMFS_FSTYPES = "cpio cpio.xz"
+
+INITRAMFS_MAXSIZE = "131072"
+
+IMAGE_NAME = "ti-core-initramfs"
+
+export IMAGE_BASENAME = "${IMAGE_NAME}"
+
+TI_CORE_INITRAMFS_EXTRA_INSTALL ?= ""
+
+PACKAGE_INSTALL = "\
+    packagegroup-ti-core-initramfs \
+    ${TI_CORE_INITRAMFS_EXTRA_INSTALL} \
+"
+
+# Ensure the initramfs only contains the bare minimum
+IMAGE_FEATURES = ""
+IMAGE_LINGUAS = ""
+
+# on the kernel image.
+PACKAGE_EXCLUDE = "kernel-image-*"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+IMAGE_NAME_SUFFIX ?= ""
+IMAGE_ROOTFS_SIZE = "8192"
+IMAGE_ROOTFS_EXTRA_SPACE = "0"
+
+inherit image
--
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20223): 
https://lists.yoctoproject.org/g/meta-ti/message/20223
Mute This Topic: https://lists.yoctoproject.org/mt/120638760/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to