[isar-cip-core][PATCH v2 1/2] fix: add squashfs hook to enforce load of module


Felix Moessbauer <felix.moessbauer@...>
 

This patch fixes issues when using a stock debian kernel, as this kernel
has no compiled-in support for sqashfs.
By explicitly adding the module to the initramfs we ensure that it is
available.

Signed-off-by: Felix Moessbauer <felix.moessbauer@...>
---
kas/opt/swupdate.yml | 1 +
.../files/squashfs.hook | 25 +++++++++++++++++++
.../initramfs-squashfs-hook_0.1.bb | 24 ++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 recipes-initramfs/initramfs-squashfs-hook/files/squashfs.hook
create mode 100644 recipes-initramfs/initramfs-squashfs-hook/initramfs-squashfs-hook_0.1.bb

diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml
index ea8bac3..b2bff64 100644
--- a/kas/opt/swupdate.yml
+++ b/kas/opt/swupdate.yml
@@ -23,3 +23,4 @@ local_conf_header:
IMAGE_TYPEDEP_wic += "squashfs"
IMAGE_FSTYPES = "wic"
WKS_FILE ?= "${MACHINE}-${SWUPDATE_BOOTLOADER}.wks.in"
+ INITRAMFS_INSTALL_append = " initramfs-squashfs-hook"
diff --git a/recipes-initramfs/initramfs-squashfs-hook/files/squashfs.hook b/recipes-initramfs/initramfs-squashfs-hook/files/squashfs.hook
new file mode 100644
index 0000000..0b9b208
--- /dev/null
+++ b/recipes-initramfs/initramfs-squashfs-hook/files/squashfs.hook
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+# Felix Moessbauer <felix.moessbauer@...>
+#
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+manual_add_modules squashfs
diff --git a/recipes-initramfs/initramfs-squashfs-hook/initramfs-squashfs-hook_0.1.bb b/recipes-initramfs/initramfs-squashfs-hook/initramfs-squashfs-hook_0.1.bb
new file mode 100644
index 0000000..332278f
--- /dev/null
+++ b/recipes-initramfs/initramfs-squashfs-hook/initramfs-squashfs-hook_0.1.bb
@@ -0,0 +1,24 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+# Felix Moessbauer <felix.moessbauer@...>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI += "file://squashfs.hook"
+
+DEBIAN_DEPENDS = "initramfs-tools"
+
+do_install[cleandirs] += " \
+ ${D}/usr/share/initramfs-tools/hooks"
+
+do_install() {
+ install -m 0755 "${WORKDIR}/squashfs.hook" \
+ "${D}/usr/share/initramfs-tools/hooks/squashfs"
+}
--
2.30.2