Skip to contentSkip to conversation

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

PATCH Superseded Ryan Eatmon 1 participant 2 messages Aug 3, 2023

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 .../classes/remove-boot-dir.bbclass           |  9 +++++++
 .../images/tisdk-tiny-initramfs.bb            | 27 +++++++++++++++++++
 .../packagegroup-arago-initramfs.bb           |  5 ++++
 3 files changed, 41 insertions(+)
 create mode 100644 meta-arago-distro/classes/remove-boot-dir.bbclass
 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/classes/remove-boot-dir.bbclass new file +9 -0
new file mode 100644
index 00000000..61c8f22d
@@ -0,0 +1,9 @@
+# Add a ROOTFS_POSTPROCESS_COMMAND that will remove some files from the
+# rootfs for initramfs images.
+
+ROOTFS_POSTPROCESS_COMMAND += "remove_boot_dir;"
+
+remove_boot_dir () {
+    rm -rf ${IMAGE_ROOTFS}/boot
+}
+
meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb new file +27 -0
new file mode 100644
index 00000000..0b8bfba8
@@ -0,0 +1,27 @@
+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
+inherit remove-boot-dir
+
+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"
+
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb new file +5 -0
new file mode 100644
index 00000000..63e3da01
@@ -0,0 +1,5 @@
+
+require recipes-core/packagegroups/packagegroup-core-boot.bb
+
+RDEPENDS:${PN}:remove = "grub-efi kernel"
+
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 tisdk-tiny-image: Remove cpio as an image type

With the creation of tisdk-tiny-initramfs we no longer need this image to create the cpio file. Instead we will need the user to choose to use the initramfs by adding the following to the local.conf at runtime:

INITRAMFS_IMAGE = "tisdk-tiny-initramfs"
INITRAMFS_IMAGE_BUNDLE = "1"

This will bundle the initramfs into the kernel and the tiny-image can be used to boot the system and then flip over to the initramfs.

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