From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6722331622445678592 X-Received: by 2002:a2e:7d0c:: with SMTP id y12mr4093373ljc.36.1565164798908; Wed, 07 Aug 2019 00:59:58 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:ac2:4a9a:: with SMTP id l26ls884825lfp.2.gmail; Wed, 07 Aug 2019 00:59:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKxSlKG22EGFyfLpzL0rJUS/YwM7HFjtogknWtbTBNn31wVOZKxsh+zhGDtMgZtGuPfUt8 X-Received: by 2002:ac2:5596:: with SMTP id v22mr4931377lfg.132.1565164798460; Wed, 07 Aug 2019 00:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565164798; cv=none; d=google.com; s=arc-20160816; b=m+/6orIIawgxV/ZOQkxr8DN8KyivHgzXZ6eR/Ro2wqxOD2BTuUfy0x6Du6o6MKbSHE YvTpA02RV4i8ifF1pGQ6o5ZZFwU0+bSK73F8xpearrAZXVgtUMkKjAugXvNT6bHyIrzO O28y39o+nev1r6zIViUlp2H572DLXNqQqKcde9tVvz2o5yBlB7ZblO9x3O/M5+0grSI8 a/h+fusvPHdGA8dUk1uY40kb2AdoS1CfLslT3TItqIBEVNi5Bz00CfLHqb/CoHk5nD/K z9BdM78XRA2l0hRmam9DSCy1BE60eqPlcoTxMht6ExIYoCfwzlXXgbOAC7S0fn+vPTOI Jcww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=CUpxVlqYZrV5UcG86axBVGS6EZXfk2ITbC000Ug6Ozg=; b=PUy2k7N09NHBnPDNWTf25yEVgOMJwxo4d8tl1iCnr+J7tFk+F6GWjL+pxK3/IjW4/U Bv/wyF3Di7aHnV8S8Y1oRUIUrX3jym7k+ilVSrxvhwKbQDezDOp6olu/Zl879j5n18Et MEzjJzhvc8Qk4CccpZ2KQ3nNSlD3RQbo+zKxnhFKPMkTAky2xIapcLQAuU+/6KABYYUH prrZHwaHf/mvf8wD7WGLGPZIQL1M/F9lh1NhOaA8pk4RoLy4xY1YgZEuVaxFizeA7A8V o5qaJR3Qh8YKebtYE6uSsz+4nQ+gq6S1j4hcXfe14iNLGuKacrx4qy0nCoeNr8RxLAq4 RHPw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of quirin.gylstorff@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=Quirin.Gylstorff@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id u10si695970lfk.0.2019.08.07.00.59.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 00:59:58 -0700 (PDT) Received-SPF: pass (google.com: domain of quirin.gylstorff@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of quirin.gylstorff@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=Quirin.Gylstorff@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id x777xvYC005479 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 7 Aug 2019 09:59:57 +0200 Received: from debian.ad001.siemens.net ([139.25.68.238]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x777xvsN006946; Wed, 7 Aug 2019 09:59:57 +0200 From: "Q. Gylstorff" To: isar-users@googlegroups.com Cc: Quirin Gylstorff Subject: [PATCH] recipes-support: add fsck to initramfs Date: Wed, 7 Aug 2019 09:59:08 +0200 Message-Id: <20190807075908.17902-1-Quirin.Gylstorff@siemens.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: wFH+8al9UzHG From: Quirin Gylstorff During system start it shall be possible to check all available file systems. As debootstrap has no knowledge of the existing file system it will not add all fsck.* application necessary to the initramfs. This patch adds all file system types given by IMAGE_FILESYSTEM_TYPES to the initramfs. File system types in IMAGE_FILESYSTEM_TYPES are separated with spaces. Signed-off-by: Quirin Gylstorff --- meta/classes/image.bbclass | 1 + .../files/initramfs.fsck.hook.tmpl | 45 +++++++++++++++++++ .../initramfs-fsck-hook/files/postinst | 6 +++ .../initramfs-fsck-hook_0.1.bb | 20 +++++++++ 4 files changed, 72 insertions(+) create mode 100644 meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.hook.tmpl create mode 100644 meta/recipes-support/initramfs-fsck-hook/files/postinst create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook_0.1.bb diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index ec6bd39..4d1feac 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -4,6 +4,7 @@ PF = "${PN}-${DISTRO}-${MACHINE}" IMAGE_INSTALL ?= "" +IMAGE_FILESYSTEM_TYPES ?= "ext4" IMAGE_TYPE ?= "ext4-img" IMAGE_ROOTFS ?= "${WORKDIR}/rootfs" diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.hook.tmpl b/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.hook.tmpl new file mode 100644 index 0000000..366160a --- /dev/null +++ b/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.hook.tmpl @@ -0,0 +1,45 @@ +# This software is a part of ISAR. +# Copyright (C) Siemens AG, 2019 +# +# SPDX-License-Identifier: MIT + +#!/bin/sh +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +. /usr/share/initramfs-tools/scripts/functions +. /usr/share/initramfs-tools/hook-functions + +if [ ! -x /sbin/fsck ]; then + echo "Warning: couldn't find /sbin/fsck!" + exit 0 +fi + +fsck_types="${IMAGE_FILESYSTEM_TYPES}" + +copy_exec /sbin/fsck +copy_exec /sbin/logsave + +for type in $fsck_types; do + if [ "$type" = "unknown" ] ; then + echo "Warning: couldn't identify filesystem type for fsck hook, ignoring." + continue + fi + + if prog="$(command -v fsck.${type})"; then + copy_exec "$prog" + else + echo "Warning: /sbin/fsck.${type} doesn't exist, can't install to initramfs, ignoring." + fi +done diff --git a/meta/recipes-support/initramfs-fsck-hook/files/postinst b/meta/recipes-support/initramfs-fsck-hook/files/postinst new file mode 100644 index 0000000..07bc3d9 --- /dev/null +++ b/meta/recipes-support/initramfs-fsck-hook/files/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +# This software is a part of ISAR. +# Copyright (C) Siemens AG, 2019 +# +# SPDX-License-Identifier: MIT +update-initramfs -u diff --git a/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook_0.1.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook_0.1.bb new file mode 100644 index 0000000..e0da551 --- /dev/null +++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook_0.1.bb @@ -0,0 +1,20 @@ +# This software is a part of ISAR. +# Copyright (C) Siemens AG, 2019 +# +# SPDX-License-Identifier: MIT + + +DESCRIPTION = "Recipe to add fsck hook to the initramfs" + +inherit dpkg-raw +SRC_URI = "file://postinst \ + file://initramfs.fsck.hook.tmpl \ + " + +TEMPLATE_VARS += "IMAGE_FILESYSTEM_TYPES" +TEMPLATE_FILES += "initramfs.fsck.hook.tmpl" + +do_install() { + install -m 0755 -d ${D}/etc/initramfs-tools/hooks + install -m 0740 ${WORKDIR}/initramfs.fsck.hook ${D}/etc/initramfs-tools/hooks/fsck.hook +} -- 2.20.1