Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport initramfs-rootfs-image to the honister branch #697

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/"
Loading