Skip to contentSkip to conversation

tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny

PATCH New Ryan Eatmon 1 participant 2 messages Aug 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny

The initramfs does not need grub-efi or the /boot directory since it does not have to boot the system itself. So create a version of the tiny-image that strips those out and follow the oe-core methodology for initramfs.

---
v4: Remove class for removing boot dir and put the logic in the recipe
instead.

 .../images/tisdk-tiny-initramfs.bb            | 34 +++++++++++++++++++
 .../packagegroup-arago-initramfs.bb           |  4 +++
 2 files changed, 38 insertions(+)
 create mode 100644 meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
 create mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb new file +34 -0
new file mode 100644
index 00000000..551cf67c
@@ -0,0 +1,34 @@
+SUMMARY = "Arago TI SDK super minimal base image for initramfs"
+
+DESCRIPTION = "Image meant for basic boot of linux kernel. Intended as\
+ bare system, this image does not package the kernel in the\
+ standard /boot folder in rootfs. Instead, it provides a base\
+ rootfs allowing kernel to be deployed elsewhere\
+ (tftp/separate boot partition/jtag log etc..) and boot\
+ the image.\
+"
+
+LICENSE = "MIT"
+
+inherit core-image
+
+IMAGE_FEATURES:remove = "package-management"
+
+INITRAMFS_FSTYPES = "cpio cpio.xz"
+INITRAMFS_MAXSIZE = "65536"
+IMAGE_OVERHEAD_FACTOR = "1"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+
+PACKAGE_INSTALL = "packagegroup-arago-initramfs"
+
+export IMAGE_BASENAME = "tisdk-tiny-initramfs"
+
+# 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/*
+}
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb new file +4 -0
new file mode 100644
index 00000000..380cc0e3
@@ -0,0 +1,4 @@
+
+require recipes-core/packagegroups/packagegroup-core-boot.bb
+
+RDEPENDS:${PN}:remove = "grub-efi kernel"
Signature · 1 line
2.17.1
#1 lore raw

PATCH v4 2/2 tisdk-tiny-image: Add dependency on tisdk-tiny-initramfs

Even if we do not tell the build that the initramfs should be bundled into the kernel, we want to build the initramfs with every build so that it can be manually specified through alternative testing schemes.

Also, we no longer want to build the cpio from the tiny-image, that is the purpose of the dedicated tisdk-tiny-initramfs.

---
v3: Remove the cpio from the IMAGE_FSTYPES.
v2: Add this missing patch to the series.

 meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb +2 -2
index 8117ebc5..c8a584bd 100644
@@ -14,10 +14,10 @@ require arago-tiny-image.inc
 
 IMAGE_FEATURES:remove = "package-management"
 
-IMAGE_FSTYPES += "cpio cpio.xz"
-
 IMAGE_INSTALL += " \
 	${ARAGO_TINY_IMAGE_EXTRA_INSTALL} \
 "
 
+DEPENDS += " tisdk-tiny-initramfs"
+
 export IMAGE_BASENAME = "tisdk-tiny-image"
Signature · 1 line
2.17.1