Skip to content

Commit

Permalink
Merge pull request #697 from lumag/honister-initramfs-rootfs-image
Browse files Browse the repository at this point in the history
Backport initramfs-rootfs-image to the honister branch
  • Loading branch information
lumag authored Dec 10, 2024
2 parents 0074972 + 37be85c commit c972e0f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
26 changes: 26 additions & 0 deletions recipes-kernel/images/initramfs-rootfs-image.bb
Original file line number Diff line number Diff line change
@@ -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-*"
17 changes: 17 additions & 0 deletions recipes-support/initrdscripts/files/copy-modules.sh
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions recipes-support/initrdscripts/initramfs-module-copy-modules_1.0.bb
Original file line number Diff line number Diff line change
@@ -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/"

0 comments on commit c972e0f

Please sign in to comment.