Commit Graph

18 Commits

Author SHA1 Message Date
Yann E. MORIN
eb6e466c10 fs/cpio: allow users to provide their own dracut modules
Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/
as dracut does not offer the possibility to look elsewhere.

Installing files in HOST_DIR/ can do done either from a host-package, or
via a post-built script; there is no overlay like there is for target/.
This is a bit cumbersome.

Additional modules are most probably developped in a relatively tight
loop with the configuration files, so it makes sense to expose both
close together.

Add an option to the fs/cpio filesystem, so users can point to a list
of modules to install.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-02-06 22:46:35 +01:00
Yann E. MORIN
d0b7e11b93 fs/cpio: don't fail systems without /dev/null
We pass all our dracut configuration files via a config dir, but dracut
insists with having one config file. Because we do not want to have to
chose which file we pass (which would then have to be excluded from the
config dir), we just used an arbitrary empty file, and /dev/null seemed
to be a good candidate.

However, some build environments do not have a complete /dev, and may be
missing entries otherwise taken for granted, like /dev/null. This is
especially the case in constrained environments like containers.

Switch away from using /dev/null, and do create an actual empty file
that we can use as the dracut config file.

Fixes:

  https://gitlab.com/buildroot.org/buildroot/-/jobs/3249828364

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-11-01 21:44:49 +01:00
Yann E. MORIN
4fd5d80e9d fs/cpio: accept a list of dracut.conf files
It is not unusual that projects can target multiple boards, and in
such cases, a lot is shared between boards and only the low-level
stuff differ.

Allow users to specify more than one dracut config file to cover
tose cases.

dracut does not accept more than one config file with the -c option,
but it can load more than one from a directory with --confdir. So,
we copy all the config files to a temporary directory and se that as
--confdir. However, we can't drop passing -c, or dracut would read
the system-wide /etc/dracut.conf (not sure if ${prefix} is even used),
which we do not want. So, we use an empty file as -c; /dev/null comes
in handy as an empty file.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2022-09-17 22:13:22 +02:00
Thierry Bultel
d8f0ec7a46 fs/cpio: new option to use dracut tool
Adds an option to invoke the dracut host tool, providing
a configuration file, instead of having a full cpio archive
of the whole target directory.

A default configuration file is provided. It assumes busybox init.
ideally, a different default should be used in case of systemd init, but
that's left for future work.

Signed-off-by: Thierry Bultel <thierry.bultel@linatsea.fr>
[arnout@mind.be: many changes]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[yann.morin.1998@free.fr: some additional fixups]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-08-18 22:49:39 +02:00
Yurii Monakov
4728fdd4c0 fs/cpio: generate reproducible archives
The output of 'find' depends on the directory entries, and is not
ordered. As a consequence, the cpio archive is not reproducible.

Fix that by sorting the output of find. Use the 'C' locale to enforce
reproducibility that does not depend on the locale.

The command line is now pretty long, so we wrap it.

Signed-off-by: Yurii Monakov <monakov.y@gmail.com>
[yann.morin.1998@free.fr:
  - use LC_ALL=C when sorting
  - wrap long line
  - reword commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-06-29 17:57:12 +02:00
Thomas Petazzoni
c4d09c8b18 fs/cpio: fix typo in comment
--reproducible is --reproducible, not --repoducible.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-07-17 08:56:35 +02:00
Atharva Lele
fd544aaebb fs/cpio: make cpio rootfs reproducible
Pass the recommended argument in the CPIO manual to make cpio archives
reproducible.

Reference: https://www.gnu.org/software/cpio/manual/cpio.html#Copy_002dpass-mode

Pre-patch diffoscope output: https://gitlab.com/snippets/1874745
Post-patch: https://gitlab.com/snippets/1874746

We can see that post-patch, the archive related differences are removed.
The differences are arising from utils/bin/getconf. This will have to
be investigated further. However, that is unrelated to cpio.

Signed-off-by: Atharva Lele <itsatharva@gmail.com>
Reviewed-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-07-17 08:53:03 +02:00
Yann E. MORIN
dec061adce fs/cpio: don't extend packages' permissions table
Currently, when we build a cpio filesystem without static devices, we
shoehorn the /dev/console node as if it were specified by a package.

This means that this device is added for all filesystems as well, not
just the cpio. But if we disable cpio, that device is not created for
other filesystems.

This is not very clean, and may break expectations.

Instead, use an explicit mknod as part of the _CMD, as we know it's
going to run under fakeroot.

This is still visible to all filesystems built after cpio, and not to
those built before it, though.

[Peter: ensure /dev exists, simplify comment]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-03-31 20:47:25 +02:00
Yann E. MORIN
b6842c4097 fs: make it behave a bit more like the package infra
Currently, to register a filesystem, one has to call:

    $(eval $(call ROOTFS_TARGET,blabla))

This is very unlike the package infrastructure, where the name of the
package is automatically guessed by the infra.

It turns out that we can now do that for the filesystem infra too.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2018-01-03 21:58:07 +01:00
Yann E. MORIN
9f2ca35998 fs/cpio: use a post-gen hook rather than a post-target rule
We already have a mechanism for running stuff after the filesystem is
generated, and that's called post-gen hooks.

Use those hooks.

Note: for cpio (and unlike ext2 previously), the dependency chain was
correct, in that the post-target rule correctly depended on the image
rule. Nonetheless, we still want to fix it for consistency.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-11-30 11:51:42 +01:00
Jerzy Grzegorek
1769933d98 package: indentation cleanup
Signed-off-by: Jerzy Grzegorek <jerzy.grzegorek@trzebnica.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-26 05:47:05 +01:00
Arnout Vandecappelle
13ae0075a9 uboot-tools: factor out common mkimage infrastructure
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-11 00:37:03 +01:00
Arnout Vandecappelle
3970ebf837 rootfs-cpio: add U-Boot image support
Adds U-Boot image support for cpio root filesystems. This allows you to
use the bootm command in U-Boot to load the rootfs. It makes it possible to
verify the CRC of the initramfs before booting the kernel.

[Spenser: wrote first version of the patch.]
Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-11 00:34:31 +01:00
Jerzy Grzegorek
086f333f39 Normalize separator size to 80
Signed-off-by: Jerzy Grzegorek <jerzy.grzegorek@trzebnica.net>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-06-07 10:54:54 +02:00
Arnout Vandecappelle (Essensium/Mind)
847895d295 fs/common.mk: delay evaluation of variables
This makes things easier to understand and more consistent with the pkg-infra.
For example, it removes the need for '$$@' in the CMD variables of fs/*/*.mk.

It also makes it possible to update the variables later, e.g. in the package
override file.

It also makes sure that the date will be recorded correctly in Yann E. Morin's
patch that logs the MESSAGE macros to a file.

The fs/*/*.mk must be updated as well because the '$@' shouldn't be quoted
anymore in the CMD variables or the hooks.

The $(eval ...) for the dependencies is redundant, because the $(ROOTFS_TARGET)
variable is already eval'd. Note that it is only redundant if the evaluation of
the uses of the variable is also delayed.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-01-20 20:53:29 +01:00
Markos Chandras
e1ebae700a fs/common: Create initial console device
A /dev/console node must be present in rootfs when the Linux kernel
boots otherwise the kernel will print the following warning:
"Warning: unable to open an initial console"

This is because when we use an initramfs the /dev directory is not
populated at this point. This can cause problems when a program
(e.g ldso with early debugging enabled) opens a standard file
descriptor for read/write before these descriptors are actually
created by the init process later on.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2012-11-21 11:31:33 +01:00
Arnout Vandecappelle (Essensium/Mind)
3fac21ef8d cpio: fix boot with dynamic /dev
Devtmpfs doesn't get automounted by the kernel when an initramfs is used.
Since cpio archives are used almost exclusively as an initramfs, the same
fix should be applied to it as for the initramfs.

Cfr. commit 424888e474 and
10a130f91e.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-09-27 22:36:26 +02:00
Thomas Petazzoni
3474716bff Coherent naming for .mk files in fs/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-04-09 11:04:36 +02:00