From 0f1099eb295c87dccf6c5133b0049eadf794d180 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 9 Jul 2021 16:58:13 +0200 Subject: [rootfs-kernel] kernel module/firmware installer --- core/rootfs/rootfs-kernel/README | 1 + core/rootfs/rootfs-kernel/module.build | 31 +++++++++++++++++++++++++++++++ core/rootfs/rootfs-kernel/module.conf | 1 + 3 files changed, 33 insertions(+) create mode 100644 core/rootfs/rootfs-kernel/README create mode 100644 core/rootfs/rootfs-kernel/module.build create mode 100644 core/rootfs/rootfs-kernel/module.conf (limited to 'core/rootfs') diff --git a/core/rootfs/rootfs-kernel/README b/core/rootfs/rootfs-kernel/README new file mode 100644 index 00000000..87cb6c88 --- /dev/null +++ b/core/rootfs/rootfs-kernel/README @@ -0,0 +1 @@ +-- This module is mostly for the install mode -- diff --git a/core/rootfs/rootfs-kernel/module.build b/core/rootfs/rootfs-kernel/module.build new file mode 100644 index 00000000..0ac57b6f --- /dev/null +++ b/core/rootfs/rootfs-kernel/module.build @@ -0,0 +1,31 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + : +} + +post_copy() { + # first copy kernel + copy_kernel + + # now copy all the firmware and kernel modules + # to preserve the build environment, we copy instead of moving + mkdir -p "${TARGET_BUILD_DIR}/lib" + rsync -aAXv "${KERNEL_BASE_DIR}/lib/firmware" "${TARGET_BUILD_DIR}/lib" || \ + perror "Failed to copy firmware to '${TARGET_BUILD_DIR}/lib'." + rsync -aAXv "${KERNEL_BASE_DIR}/lib/modules" "${TARGET_BUILD_DIR}/lib" || \ + perror "Failed to copy kernel modules to '${TARGET_BUILD_DIR}/lib'." + + # NOTE: if symlinks are present in ./lib/modules//kernel, they + # are likely pointing to mltk's kernel work dir, thus unusable in live + # systems. We just delete those for now. + for LINK in "${TARGET_BUILD_DIR}/lib/modules/${TARGET_KERNEL_LONG}/"{build,source}; do + if [ -h "${LINK}" ]; then + pinfo "Removing '${LINK}' as it won't point to a valid path on live systems." + unlink "${LINK}" || perror "Failed to unlink '${LINK}'." + fi + done +} diff --git a/core/rootfs/rootfs-kernel/module.conf b/core/rootfs/rootfs-kernel/module.conf new file mode 100644 index 00000000..ce993cdd --- /dev/null +++ b/core/rootfs/rootfs-kernel/module.conf @@ -0,0 +1 @@ +REQUIRED_MODULES="kernel" -- cgit v1.2.3-55-g7522