aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-kernel/images/initramfs-rootfs-image.bb26
-rw-r--r--recipes-support/initrdscripts/files/copy-modules.sh17
-rw-r--r--recipes-support/initrdscripts/initramfs-module-copy-modules_1.0.bb15
3 files changed, 58 insertions, 0 deletions
diff --git a/recipes-kernel/images/initramfs-rootfs-image.bb b/recipes-kernel/images/initramfs-rootfs-image.bb
new file mode 100644
index 0000000..9bc9dc5
--- /dev/null
+++ b/recipes-kernel/images/initramfs-rootfs-image.bb
@@ -0,0 +1,26 @@
+DESCRIPTION = "Ramdisk image for pivoting into rootfs"
+
+PACKAGE_INSTALL = " \
+ base-passwd \
+ initramfs-module-copy-modules \
+ initramfs-module-rootfs \
+ initramfs-module-udev \
+ ${VIRTUAL-RUNTIME_base-utils} \
+ ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS} \
+ ${ROOTFS_BOOTSTRAP_INSTALL} \
+"
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = "debug-tweaks"
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
+IMAGE_ROOTFS_EXTRA_SPACE = "0"
+
+# Exclude all kernel images from the rootfs
+PACKAGE_EXCLUDE = "kernel-image-*"
diff --git a/recipes-support/initrdscripts/files/copy-modules.sh b/recipes-support/initrdscripts/files/copy-modules.sh
new file mode 100644
index 0000000..12dc052
--- /dev/null
+++ b/recipes-support/initrdscripts/files/copy-modules.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright (C) 2022 Linaro Ltd.
+# Licensed on MIT
+
+copy_modules_enabled() {
+ [ -n "${bootparam_copy_modules}" -a -d /lib/modules/`uname -r` ]
+}
+
+copy_modules_run() {
+ if [ -n "$ROOTFS_DIR" ]; then
+ rm -rf $ROOTFS_DIR/lib/modules/`uname -r`
+ mkdir -p $ROOTFS_DIR/lib/modules
+ cp -a /lib/modules/`uname -r` $ROOTFS_DIR/lib/modules
+ else
+ debug "No rootfs has been set"
+ fi
+}
diff --git a/recipes-support/initrdscripts/initramfs-module-copy-modules_1.0.bb b/recipes-support/initrdscripts/initramfs-module-copy-modules_1.0.bb
new file mode 100644
index 0000000..effc7df
--- /dev/null
+++ b/recipes-support/initrdscripts/initramfs-module-copy-modules_1.0.bb
@@ -0,0 +1,15 @@
+SUMMARY = "initramfs-framework module for copying kernel modules from initramfs to rootfs"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS:${PN} = "initramfs-framework-base ${VIRTUAL-RUNTIME_base-utils}"
+
+SRC_URI = "file://copy-modules.sh"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/copy-modules.sh ${D}/init.d/95-copy_modules
+}
+
+FILES:${PN} = "/init.d/"