public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] recipes-support: add fsck to initramfs
@ 2019-08-07  7:59 Q. Gylstorff
  2019-08-13 14:36 ` Henning Schild
  0 siblings, 1 reply; 8+ messages in thread
From: Q. Gylstorff @ 2019-08-07  7:59 UTC (permalink / raw)
  To: isar-users; +Cc: Quirin Gylstorff

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

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 <quirin.gylstorff@siemens.com>
---
 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] recipes-support: add fsck to initramfs
  2019-08-07  7:59 [PATCH] recipes-support: add fsck to initramfs Q. Gylstorff
@ 2019-08-13 14:36 ` Henning Schild
  2019-08-13 15:01   ` Jan Kiszka
  2019-08-13 15:31   ` [PATCH] " Claudius Heine
  0 siblings, 2 replies; 8+ messages in thread
From: Henning Schild @ 2019-08-13 14:36 UTC (permalink / raw)
  To: [ext] Q. Gylstorff; +Cc: isar-users, [ext] Claudius Heine

Well it looks like the problem is the missing fstab
line. /usr/share/initramfs-tools/hooks/fsck is looking for that to
decide which fsck to include.

There also seems to be /etc/fstab.d/*.fstab that can be used if we do
not like touching the original fstab. I think Claudius once removed /
from fstab claiming that it was not required.

The package you get from that changes content based on an image
variable. That must not be done. The fstypes would have to become part
of PN or PV ...

I think we should get that fstab line back.

Henning

Am Wed, 7 Aug 2019 09:59:08 +0200
schrieb "[ext] Q. Gylstorff" <Quirin.Gylstorff@siemens.com>:

> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> 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 <quirin.gylstorff@siemens.com>
> ---
>  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 +}


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] recipes-support: add fsck to initramfs
  2019-08-13 14:36 ` Henning Schild
@ 2019-08-13 15:01   ` Jan Kiszka
  2019-08-14 16:31     ` Henning Schild
  2019-08-13 15:31   ` [PATCH] " Claudius Heine
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2019-08-13 15:01 UTC (permalink / raw)
  To: [ext] Henning Schild, [ext] Q. Gylstorff; +Cc: isar-users, [ext] Claudius Heine

On 13.08.19 16:36, [ext] Henning Schild wrote:
> Well it looks like the problem is the missing fstab
> line. /usr/share/initramfs-tools/hooks/fsck is looking for that to
> decide which fsck to include.
> 
> There also seems to be /etc/fstab.d/*.fstab that can be used if we do
> not like touching the original fstab. I think Claudius once removed /
> from fstab claiming that it was not required.
> 
> The package you get from that changes content based on an image
> variable. That must not be done. The fstypes would have to become part
> of PN or PV ...
> 
> I think we should get that fstab line back.

/ is in fstab, but in a generic form. If you add a specific one, you easily 
start duplicating wic. It's a chicken-egg thing: You need the information during 
package installation, but you only have it after imaging.

BTW, there is enable-fsck for partially the same reason (there other is that you 
do want to control whether fsck is run in embedded scenarios).

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] recipes-support: add fsck to initramfs
  2019-08-13 14:36 ` Henning Schild
  2019-08-13 15:01   ` Jan Kiszka
@ 2019-08-13 15:31   ` Claudius Heine
  1 sibling, 0 replies; 8+ messages in thread
From: Claudius Heine @ 2019-08-13 15:31 UTC (permalink / raw)
  To: Henning Schild, [ext] Q. Gylstorff; +Cc: isar-users, [ext] Claudius Heine


[-- Attachment #1.1: Type: text/plain, Size: 5659 bytes --]

Hi Henning

On 13/08/2019 16.36, Henning Schild wrote:
> Well it looks like the problem is the missing fstab
> line. /usr/share/initramfs-tools/hooks/fsck is looking for that to
> decide which fsck to include.
> 
> There also seems to be /etc/fstab.d/*.fstab that can be used if we do
> not like touching the original fstab. I think Claudius once removed /
> from fstab claiming that it was not required.

No, i have not touched the /etc/fstab generation code. That code goes
all the way back, when multistrap was used and the fstab was generated
in the config scripts. I thought about refactoring that and put the idea
out, but I never did.

regards,
Claudius

> 
> The package you get from that changes content based on an image
> variable. That must not be done. The fstypes would have to become part
> of PN or PV ...
> 
> I think we should get that fstab line back.
> 
> Henning
> 
> Am Wed, 7 Aug 2019 09:59:08 +0200
> schrieb "[ext] Q. Gylstorff" <Quirin.Gylstorff@siemens.com>:
> 
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> 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 <quirin.gylstorff@siemens.com>
>> ---
>>  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 +}
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

           PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153
                             Keyserver: hkp://pool.sks-keyservers.net


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 850 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] recipes-support: add fsck to initramfs
  2019-08-13 15:01   ` Jan Kiszka
@ 2019-08-14 16:31     ` Henning Schild
  2019-08-19  7:00       ` Quirin Gylstorff
  0 siblings, 1 reply; 8+ messages in thread
From: Henning Schild @ 2019-08-14 16:31 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: [ext] Q. Gylstorff, isar-users, [ext] Claudius Heine

Am Tue, 13 Aug 2019 17:01:16 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> On 13.08.19 16:36, [ext] Henning Schild wrote:
> > Well it looks like the problem is the missing fstab
> > line. /usr/share/initramfs-tools/hooks/fsck is looking for that to
> > decide which fsck to include.
> > 
> > There also seems to be /etc/fstab.d/*.fstab that can be used if we
> > do not like touching the original fstab. I think Claudius once
> > removed / from fstab claiming that it was not required.
> > 
> > The package you get from that changes content based on an image
> > variable. That must not be done. The fstypes would have to become
> > part of PN or PV ...
> > 
> > I think we should get that fstab line back.  
> 
> / is in fstab, but in a generic form. If you add a specific one, you
> easily start duplicating wic. It's a chicken-egg thing: You need the
> information during package installation, but you only have it after
> imaging.
> 
> BTW, there is enable-fsck for partially the same reason (there other
> is that you do want to control whether fsck is run in embedded
> scenarios).

Fair enough. Let is control which fscks go into the initrd. But i am
afraid we will need one package per file-system. I guess that should be
easy to do with one recipe providing many packages.
And which ones to include would be a matter of

IMAGE_INSTALL += <initrd-fsck-package>-<fstype>

And not a new variable.

At least that sounds like a viable way to implement it.

Henning

> Jan
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] recipes-support: add fsck to initramfs
  2019-08-14 16:31     ` Henning Schild
@ 2019-08-19  7:00       ` Quirin Gylstorff
  2019-08-22 13:07         ` [PATCH v2] " Q. Gylstorff
  0 siblings, 1 reply; 8+ messages in thread
From: Quirin Gylstorff @ 2019-08-19  7:00 UTC (permalink / raw)
  To: Henning Schild, Jan Kiszka; +Cc: isar-users, [ext] Claudius Heine



On 8/14/19 6:31 PM, Henning Schild wrote:
> Am Tue, 13 Aug 2019 17:01:16 +0200
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
>> On 13.08.19 16:36, [ext] Henning Schild wrote:
>>> Well it looks like the problem is the missing fstab
>>> line. /usr/share/initramfs-tools/hooks/fsck is looking for that to
>>> decide which fsck to include.
>>>
>>> There also seems to be /etc/fstab.d/*.fstab that can be used if we
>>> do not like touching the original fstab. I think Claudius once
>>> removed / from fstab claiming that it was not required.
>>>
>>> The package you get from that changes content based on an image
>>> variable. That must not be done. The fstypes would have to become
>>> part of PN or PV ...
>>>
>>> I think we should get that fstab line back.
>>
>> / is in fstab, but in a generic form. If you add a specific one, you
>> easily start duplicating wic. It's a chicken-egg thing: You need the
>> information during package installation, but you only have it after
>> imaging.
>>
>> BTW, there is enable-fsck for partially the same reason (there other
>> is that you do want to control whether fsck is run in embedded
>> scenarios).
> 
> Fair enough. Let is control which fscks go into the initrd. But i am
> afraid we will need one package per file-system. I guess that should be
> easy to do with one recipe providing many packages.
> And which ones to include would be a matter of
> 
> IMAGE_INSTALL += <initrd-fsck-package>-<fstype>
> 
> And not a new variable.
> 
> At least that sounds like a viable way to implement it.
> 

I will look into it.

Quirin

> Henning
> 
>> Jan
>>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] recipes-support: add fsck to initramfs
  2019-08-19  7:00       ` Quirin Gylstorff
@ 2019-08-22 13:07         ` Q. Gylstorff
  2019-09-04 12:32           ` Baurzhan Ismagulov
  0 siblings, 1 reply; 8+ messages in thread
From: Q. Gylstorff @ 2019-08-22 13:07 UTC (permalink / raw)
  To: isar-users; +Cc: Quirin Gylstorff

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

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.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../files/initramfs.fsck.ext4.hook            | 38 +++++++++++++++++++
 .../initramfs-fsck-hook/files/postinst        |  6 +++
 .../initramfs-fsck-hook-ext4_0.1.bb           | 18 +++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
 create mode 100644 meta/recipes-support/initramfs-fsck-hook/files/postinst
 create mode 100644 meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb

diff --git a/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook b/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
new file mode 100644
index 0000000..23f7c28
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/files/initramfs.fsck.ext4.hook
@@ -0,0 +1,38 @@
+# 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="ext4"
+
+copy_exec /sbin/fsck
+copy_exec /sbin/logsave
+
+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
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-ext4_0.1.bb b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb
new file mode 100644
index 0000000..0be52a3
--- /dev/null
+++ b/meta/recipes-support/initramfs-fsck-hook/initramfs-fsck-hook-ext4_0.1.bb
@@ -0,0 +1,18 @@
+# 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.ext4.hook \
+          "
+
+
+do_install() {
+        install -m 0755 -d ${D}/etc/initramfs-tools/hooks
+        install -m 0740 ${WORKDIR}/initramfs.fsck.ext4.hook ${D}/etc/initramfs-tools/hooks/fsck.ext4.hook
+}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] recipes-support: add fsck to initramfs
  2019-08-22 13:07         ` [PATCH v2] " Q. Gylstorff
@ 2019-09-04 12:32           ` Baurzhan Ismagulov
  0 siblings, 0 replies; 8+ messages in thread
From: Baurzhan Ismagulov @ 2019-09-04 12:32 UTC (permalink / raw)
  To: isar-users

On Thu, Aug 22, 2019 at 03:07:13PM +0200, Q. Gylstorff wrote:
> 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.

Applied to next, thanks. I've reformatted the commit message with the line
length of 75, for git log.

With kind regards,
Baurzhan.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-09-04 12:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07  7:59 [PATCH] recipes-support: add fsck to initramfs Q. Gylstorff
2019-08-13 14:36 ` Henning Schild
2019-08-13 15:01   ` Jan Kiszka
2019-08-14 16:31     ` Henning Schild
2019-08-19  7:00       ` Quirin Gylstorff
2019-08-22 13:07         ` [PATCH v2] " Q. Gylstorff
2019-09-04 12:32           ` Baurzhan Ismagulov
2019-08-13 15:31   ` [PATCH] " Claudius Heine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox