aboutsummaryrefslogtreecommitdiff
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* core: add make-based full-dependency listGravatar Yann E. MORIN2019-03-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when we need to build the full dependency graph, we call make to show the list of packages (make show-targets), and then call it again and again iteratively while it returns new packages. Since calling make will parse the whole set of our Makefiles, this takes quite a bit of time (~4s each here), and the total can get pretty long. However, make being make, already builds the whole dependency tree information, so we can just ask for it. Add a new top-level rule 'show-dependency-tree' that displays the whole set of dependencies for all packages. For each package, its name, type and version is displayed, then all the direct, first-level dependencies are dumped. We choose a format that is not unlike the dot-graph format, because it is both easy to read as a human, and easy to parse as a machine: foo: target 1.2.3 foo -> bar host-meh bar: target virtual bar -> buz buz: target 2.3.4 buz -> host-meh: host virtual host-meh -> host-bleark host-bleark: host 3.4.5 host-bleark -> rootfs-meh: host rootfs-meh -> host-bleark To be noted: rootfs are currently reported as if they were 'host' packages, to stay aligned with how graph-depends currently treats them. Ideally, graph-depends could be enhanced to recognise them separately, but that is another story. For just plain defconfig, which is about the smallest config we can have with an internal toolchain, we already have a seven-fold improvement (with the graph-depends rule modified to not run the pdf generation, to be able to just compare the tree generation): $ time make graph-depends real 0m27.344s $ time make show-dependency-tree real 0m3.848s >From defconfig, C++, wchar, locales, ssp, and allyespackageconfig, tweaked for even more packages (qt5 not qt4, luajit to avoid multi providers, etc...), the timings are (graph-depends still modified to not generate the pdf): $ time make graph-depends real 1m56.459s $ time make show-dependency-tree real 0m5.748s There. I don't think those numbers need any explanation whatsoever; they do speak on their own. OK, for maths sake, the ratio is about twenty-fold. So, "yeah", I guess... ;-) Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/common.mk: make sure that static devices from packages are createdGravatar Thomas Petazzoni2018-12-041-1/+1
| | | | | | | | | | | | | | | | | | | The static devices defined by packages are currently added to the full device table when two conditions are met: (1) ROOTFS_DEVICE_TABLES is non-empty (2) BR2_ROOTFS_DEVICE_CREATION_STATIC=y (2) is obviously correct. However, depending on (1) is not correct: if the user doesn't provide any custom permission table and custom device table, then ROOTFS_DEVICE_TABLES will be empty. So instead, move the addition of the package-defined static devices outside of condition (1), and have it only under condition (2). Reported-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* fs/common.mk: allow user provided permissions to override packages permissionsGravatar Yann E. MORIN2018-12-041-2/+3
| | | | | | | | | Reported-by: Matthew Weber <matthew.weber@rockwellcollins.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Matthew Weber <matthew.weber@rockwellcollins.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* fs/common.mk: rename FULL_DEVICE_TABLE to ROOTFS_FULL_DEVICES_TABLEGravatar Thomas Petazzoni2018-12-041-5/+5
| | | | | | | | | | | | | | | | In commit 6b50f988ad0a6044530b30344d52139da2994237 ("fs/common.mk: rename internal variable"), USERS_TABLE was renamed to ROOTFS_FULL_USERS_TABLE. This commit follows the same direction by renaming the FULL_DEVICE_TABLE variable to ROOTFS_FULL_DEVICE_TABLE. In addition, for consistency, the file itself is renamed full_device_table.txt. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* fs/common.mk: rename internal variableGravatar Yann E. MORIN2018-12-031-4/+6
| | | | | | | | | | In preparation of more renames, rename the variable that points to the final users table. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> [Thomas: as suggested by Arnout, use ROOTFS_FULL_USERS_TABLE instead of ROOTFS_FINAL_USERS_TABLE.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* Merge branch 'next'Gravatar Peter Korsgaard2018-12-021-5/+8
|\ | | | | | | Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
| * fs/common: allow filesystems to set the name of their output fileGravatar Carlos Santos2018-12-011-5/+7
| | | | | | | | | | | | | | | | | | | | | | Some filesystems may want to tweak their output names, rather than using the fixed "rootfs.foo" scheme. Add a ROOTFS_FOO_IMAGE_NAME variable for this purpose. Signed-off-by: Carlos Santos <casantos@datacom.com.br> [yann.morin.1998@free.fr: fix the patch] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
| * Makefile: rework main directory creation logicGravatar Thomas Petazzoni2018-11-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current code, the creation of the main output directories (BUILD_DIR, STAGING_DIR, HOST_DIR, TARGET_DIR, etc.) is done by a global "dirs" target. While this works fine in the current situation, it doesn't work well in a context where per-package host and target directories are used. For example, with the current code and per-package host directories, the output/staging symbolic link ends up being created as a link to the per-package package sysroot directory of the first package being built, instead of the global sysroot. This commit reworks the creation of those directories by having the package/pkg-generic.mk code ensure that the build directory, target directory, host directory, staging directory and binaries directory exist before they are needed. Two new targets, host-finalize and staging-finalize are added in the main Makefile to create the compatibility symlinks for host and staging directories. They will be extended later with additional logic for per-package directories. Thanks to those changes, the global "dirs" target is entirely removed. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* | fs/tar: add support for xattrs (thus capabilties)Gravatar Yann E. MORIN2018-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, tar will not include any extended attribute (xattr) when creating archives, and thus will not store capabilties either (as they are stored in the xattr 'security.capability'). Using option --xattrs is enough to create a tarball with all the xattrs attached to a file. However, extracting all xattrs from a tarball requires that --xattrs-include='*' be used. This is not symetric (but on purpose, as per the documentation), and so is confusing to some. So, we use --xattrs-include='*' to create the archive, so as to be explicit that we want all xattrs to be stored. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Arnout Vandecappelle <arnout@mind.be> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* | fs/common.mk: Fix show-build-orderGravatar Serj Kalichev2018-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | The command "make show-build-order" doesn't show dependencies of rootfs-common target. This patch adds $(ROOTFS_COMMON_DEPENDENCIES) to PACKAGES variable. Signed-off-by: Serj Kalichev <serj.kalichev@gmail.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* | fs: don't use an intermediate tarballGravatar Yann E. MORIN2018-11-131-41/+18
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 118534fe54b (fs: use a common tarball as base for the other filesystems), the filesystem creation is split in two steps, using an intermediate tarball to carry the generic, common finalisations to the per-filesystem finalisation and image creation. However, this intermediate tarball causes an issue with capabilities: they are entirely missing in the generated filesystems. Capabilities are stored in the extended attribute security.capability, which tar by default will not store/restore, unless explicitly told to, e.g. with --xattrs-include='*', which we don't pass. Now, passing this option when creating and extracting the intermediate tarball, both done under fakeroot, will cause fakeroot to report an invalid filetype for files with capabilities. mksquashfs would report such unknown files as a warning, while mkfs.ext2 would fail (with a similar error message), e.g.: File [...]/usr/sbin/getcap has unrecognised filetype 0, ignoring This is due to a poor interaction between tar and fakeroot; running as root the exact same commands we run under fakeroot, works as expected. Unfortunately, short of fixing fakeroot (which would first require understanding the problem in there), we don't have much options. The intermediate tarball was made to avoid redoing the same actions over and over again for each filesystem to build. However, most of the time, only one or two such filesystems would be enabled [0], and those actions are usually pretty lightweight. So, using an intermediate tarball does not provide a big optimisation. The main reason to introduce the intermediate tarball, however, is that it allows to postpone per-filesystem finalisations to be applied only for the corresponding filesystem, not for all of them. So, we get rid of the intermediate tarball, and simply move all of the code to run under fakeroot to the per-filesystem fakeroot script. Instead of extracting the intermediate tarball, we just rsync the original target/ directory, and apply the filesystem finalisations on that copy. The only thing still done in the rootfs-common step is to generate the intermediate files (users file, devices file) that are used in the fakeroot script. Fixes: https://bugs.busybox.net/show_bug.cgi?id=11216 Note: an alternate solution would have been to keep the intermediate tarball to keep most of the common finalisations, and move only the permissions to each filesystem, but that was getting a bit more complex and changed the ordering of permissions and post-fakeroot scripts. Once we bite the bullet of having some common finalisation done in each filesystem, it's easier to just move all of them. [0] Most probsably, users would enable the real filesystem to put on their device, plus the 'tar' filesystem, to be able to easily inspect the content on their development machine. Reported-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* fs/f2fs: simplify overprovision option handlingGravatar Grzegorz Blach2018-11-081-5/+1
| | | | | | | | Setting overprovision to 0 and omitting this option has exactly the same effect. Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: add option to define list of hot file extensionsGravatar Grzegorz Blach2018-11-082-0/+9
| | | | | Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: clarify help messagesGravatar Grzegorz Blach2018-11-081-5/+6
| | | | | | | | | | | For BR2_TARGET_ROOTFS_F2FS_COLD_FILES clarify that extension list must be a coma separated. For BR2_TARGET_ROOTFS_F2FS_OVERPROVISION clarify that the default overprovision ratio is autocalculated according to the partition size. Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs/Config.in: remove consecutive empty linesGravatar Thomas Petazzoni2018-11-031-1/+0
| | | | | | | | This fixes the following check-package warning: fs/f2fs/Config.in:51: consecutive empty lines Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: add option to define list of filesystem featuresGravatar Grzegorz Blach2018-11-032-1/+11
| | | | | | Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> [Thomas: split from the initial patch from Grzegorz] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: add option to define discard policyGravatar Grzegorz Blach2018-11-032-0/+13
| | | | | | Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> [Thomas: split from the initial patch from Grzegorz] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: add option to define overprovision ratioGravatar Grzegorz Blach2018-11-032-1/+17
| | | | | | | Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> [Thomas: split from the initial patch from Grzegorz, reworded Config.in help text] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: add option to define list of cold file extensionsGravatar Grzegorz Blach2018-11-032-1/+10
| | | | | | Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> [Thomas: split from the initial patch from Grzegorz] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/f2fs: add support for creating a f2fs imageGravatar Grzegorz Blach2018-11-033-0/+52
| | | | | | | | | | | | This patch makes possible to create rootfs image using f2fs filesystem. Signed-off-by: Grzegorz Blach <grzegorz@blach.pl> [Thomas: - keep only the minimal functionality, as suggested by Yann E. Morin - use truncate -s instead of dd to create the initial empty image file, as suggested by Yann E. Morin] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/common: always depend on build host-tar if neededGravatar Yann E. MORIN2018-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the filesystems do not depend on building host-tar when it is needed, even though all of them have to extract the intermediate tarball. However, in degenerate (but legally valid) configurations with no user-selectable package selected, host-tar would not be built, so the rootfs images would use whatever improper tar the system has. Add the conditional dependency to host-tar to the rootfs-common intermediate image. Since this is the internal step that all real rootfs generators depend on, they now properly depend on host-tar when needed. In practice, when host-tar is needed, it will always be built before the rootfs images, because it is a dependency of all packages (except a very few, like the skeleton), of which host-fakeroot, which is a mandatory dependency of rootfs-comon anyway. But for consistency sake, let's explicitly add host-tar as a dependency to rootfs-common too. Note that rootfs-tar already had that dependency, and we leave it as-is because it is semantically correct, even if superfluous. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/common: allow custom user table to override package-defined usersGravatar Matt Weber2018-10-201-1/+2
| | | | | | | | | | | | | | | | | | | | | Currently, when a custom user table and a package define the same user, the settings from the package takes precedence over the ones from the custom user table. However, it makes sense to allow the settings from the custom user table take precedence. For example, it would allow redirecting the user's home directory to an alternate location (e.g. away from tmp and into a partition that is persistent). The support/scripts/mkusers script will only retain settings from the latest definition it finds. Thus, by passing the custom user table after the package defined users, it is possible to override the package provided user definitions. Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* fs/btrfs: remove destination file before generationGravatar Yann E. MORIN2018-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | btrfs will happily use an existing destination file if it already exists, increasing its size if needed. Hoever, it will never decrease the size, even if the requested size is smaller than the existing file. So, remove any previously existing destination file before generating the new filesystem. Note: the original submission by Robert did that, but as this case was not obvious, the removal was dropped by a refactoring when the patch was initially applied. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Robert J. Heywood <robert.heywood@codethink.co.uk> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [Thomas: use $@ instead of $(@), use $(RM) instead of rm.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/btrfs: add support for generating a btrfs imageGravatar Robert J. Heywood2018-08-253-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | This patch makes it possible to format the rootfs using btrfs. It introduces the option; BR2_TARGET_ROOTFS_BTRFS. When selected, the user is able to specify the filesystem size, label, options, and node and sector sizes. The new files are based on fs/ext2/{Config.in,ext2.mk} Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> [Thomas: - fix issues pointed by Yann (duplicated empty line, missing quotes around default values for string options) - use -f option so that we don't have to remove the image file before creating it again - use the --byte-count option to set the filesystem size, which avoids the need for doing a "truncate -s" - remove the possible explanation of a mkfs.btrfs error. Indeed, mkfs.btrfs automatically extends the size of the image as needed, so the size passed can never be "too small". - fix check-package warnings in Config.in file.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs: ensure hard links in TARGET_DIR are correctly copied for filesystem inputGravatar Peter Korsgaard2018-05-271-1/+1
| | | | | | | | | | | | | | | | | | | Fixes #11046 Commit bb2a57a17a7 (fs: run packages' filesystem hooks in a copy of target/) changed the file system logic to run file system hooks from packages on a copy of TARGET_DIR, and finally use this copy as input for the file system generation. This copy was done with rsync, which by default does not preserve hard links, leading to an expansion of the file system images when hard links are present. Fix it by passing the -H option to rsync (preserve hard links). Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs/squashfs: add zstd supportGravatar Peter Seiderer2018-04-252-0/+5
| | | | | | Signed-off-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/cramfs: add xip optionGravatar Chris Brandt2018-04-092-0/+28
| | | | | | | | Cramfs now has the ability to XIP all ELF files. Cc: Nicolas Pitre <nico@linaro.org> Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* package/cramfs: change to new site locationGravatar Chris Brandt2018-04-092-3/+3
| | | | | | | | | | | | | | | | | | | | | | As of Linux-4.15, cramfs now has a official maintainer again. Additionally, that person is hosting and maintaining a new version of cramfs-tools. Patches 0001-endian.patch and 0003-fix-missing-types.patch are no longer needed because they have been upstreamed. However, since patch 0002-cygwin_IO.patch is so old, it is being removed until someone that needs it can reapply and test it. At that point, they should submit the changes to the new cramfs-tools maintainer instead of adding the patches back here. Please note that cross-endian support for cramfsck is not supported at this time. Cc: Nicolas Pitre <nico@linaro.org> Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Reviewed-by: Matt Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/*/Config.in: re-wrap help textGravatar Ricardo Martincoski2018-04-015-26/+32
| | | | | | | ... to follow the convention <tab><2 spaces><62 chars>. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/*/Config.in: fix attributes orderGravatar Ricardo Martincoski2018-04-012-4/+4
| | | | | | | ... to follow the convention: type, default, depends on, select, help. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* */Config.in*: remove consecutive empty linesGravatar Ricardo Martincoski2018-04-011-1/+0
| | | | | Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/*/*.mk: fix code styleGravatar Ricardo Martincoski2018-04-012-3/+1
| | | | | | | | The header of the initramfs.mk file fits in one line, so rearrange it. Remove consecutive empty line. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/ubi: use namespace for internal variableGravatar Ricardo Martincoski2018-04-011-3/+3
| | | | | | | | | UBINIZE_CONFIG_FILE_PATH is only used inside this file, so rename it to start with UBI_, following the namespace convention already used by common packages. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs/yaffs2: fix code styleGravatar Ricardo Martincoski2018-04-011-0/+0
| | | | | | | | Rename the .mk to follow the convention. The variables inside it already use the correct name. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* fs: remove intermediate artefactsGravatar Yann E. MORIN2018-03-311-0/+2
| | | | | | | | | | | | | | | | | | | | Each of the intermediate, per-rootfs target directories, as well as the intermediate tarball, can take quite some place, and is mostly a duplication of what's already in target/. The only delta, if any, would be the tweaks made by the filesystem image generations, but those tweaks are most probably only meaningful when seen as root. We normally do not remove intermediate files, but those can be quite large, and are not directly usable by, nor accessible to the user. So, get rid of them once the filesystem has been generated. This does not need to be done in fakeroot. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Arnout Vandecappelle <arnout@mind.be> Tested-by: Matt Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs: get rid of package-provided post-fs hooksGravatar Yann E. MORIN2018-03-311-2/+0
| | | | | | | | | | | | | | | | | Now that the pre-fs ones are run on a transient copy of target/, the post-fs hooks are no longer needed because we no longer need to restore the target/ directory as it is only a internal copy. Remove support for the post-fs hooks, and update the sole package using them. We do not add a legacy check because this was mostly a purely-internal detail that was never really exposed nor documented. 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>
* fs: run packages' filesystem hooks in a copy of target/Gravatar Yann E. MORIN2018-03-311-2/+5
| | | | | | | | | | | | | | | | | | | | Currently, some packages may register hooks to be run just before and just after the generic tarball image is generated, because they need to prepare the filesystem for read-only or read-write operation. However, this means that, if any of the hooks or the image generation fails, the target directory is left in a dangling, inconsistent state. We fix that by doing a copy of target/, run the hooks on that copy, generate the generic tarball image out of that, and get rid of the copy. This way, we can guarantee consistency of the target directory, and we can even ditch support for post-fs hooks (those that restore target/). 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>
* fs: use a common tarball as base for the other filesystemsGravatar Yann E. MORIN2018-03-311-28/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, some filesystems may want to tweak the content of the target directory, create special device nodes etc... This all means that: - the content of the target directory for a specific filesystems may depend on whether another filesystem is enabled or not; for example, cpio will create a /init script or symlink and a /dev/console node; - the filesystems can not be built in parallel, because they may change the content of the target directory while another is being assembled. Furthermore, the same fakeroot script is executed over-and-over-again for each filesystem, to create the device nodes, the users and their homes and files, and setting permissions... We introduce an intermediate tarball, for which we do the full fakeroot shebang. That tarball then serves as the base for the other filesystems, with a very simple fakeroot script that untars the common tarball, and calls the actual filesystem image generator on that. Note that we use a very simple tar command to generate the intermediate tarball, because we are not concerned with reproducibility of the archive itself (only of the archived files). 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>
* fs: introduce a macro for reproducible commandGravatar Yann E. MORIN2018-03-311-3/+7
| | | | | | | 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>
* fs: new intermediate rootfs-common to gather common dependenciesGravatar Yann E. MORIN2018-03-311-4/+19
| | | | | | | | | | | | | | | Before we can create an intermediate tarball for all filesystems, we nedd to move the common dependencies needed to generate that intermediate tarball, rather than leave those dependencies to each filesystem. So, we introduce rootfs-common, which gathers all those common dependencies. 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>
* fs: introduce per-rootfs TARGET_DIR variableGravatar Yann E. MORIN2018-03-311-0/+1
| | | | | | | | | | ... which for now still points to the base target directory, but this is a step forward. 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>
* fs: split per-rootfs dependency lineGravatar Yann E. MORIN2018-03-311-1/+2
| | | | | | | 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>
* fs: use a per-rootfs fakeroot scriptGravatar Yann E. MORIN2018-03-311-3/+3
| | | | | | | | | | | | | | ... and locate that script in a per-rootfs directory. Just like for ROOTFS, this variable will leak down the dependency tree to target-finalize and packages - But it doesn't matter as it isn't used outside fs/. [Peter: extend commit message] 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>
* fs: define per-rootfs directoryGravatar Yann E. MORIN2018-03-311-0/+2
| | | | | | | | | | This will serve in future commits to store pre-rootfs files, like fakeroot script... 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>
* fs: set per-rootfs variable nameGravatar Yann E. MORIN2018-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | Like we do for packages with the PKG variable, set ROOTFS to contain the upper-case name of the rootfs currently being generated. This will be useful in later patches, when we need more per-rootfs variables, like a per-rootfs TARGET_DIR for example. In Makefiles, per-rule variables trickle down the dependency chain, to all dependencies of that rule, so we have to stop ROOTFS as soon as we're not in a rootfs. This means we have to stop it at target-finalize (which is a dependency of all filesystems), and for each package individually, since some packages (host or target) can be direct dependencies of filesystems as well. 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>
* fs/iso9660: rename internal variableGravatar Yann E. MORIN2018-03-311-15/+15
| | | | | | | | | | | | | We're soon to introduce a generic variable with that name, i.e. $(FS_NAME)_TARGET_DIR, so our internal, temporary variable would clash with it. Just rename it. 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>
* fs/cpio: don't extend packages' permissions tableGravatar Yann E. MORIN2018-03-311-2/+4
| | | | | | | | | | | | | | | | | | | | | | | 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>
* fs: run filesystem hooks under fakerootGravatar Yann E. MORIN2018-03-311-1/+2
| | | | | | | | | | | | | | | | | | Currently, the pre-gen hooks of the various filesystems are run before we enter the fakeroot. However, this precludes those hooks from doing actions that require root, like creating a pseudo-device or the likes. So, move those pre-gen hooks under fakeroot. This has currently no side-effect, as they are still called before everything else in the fakeroot script, even the system-wide chown call. 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>
* package/pkg-generic: handle host-tar as an extract dependencyGravatar Thomas Petazzoni2018-03-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves the host-tar dependency handling from DEPENDENCY_HOST_PREREQ to an extract dependency. To achieve that, check-host-tar.mk fills in the BR2_TAR_HOST_DEPENDENCY variable with host-tar if building a host-tar is needed. The name BR2_TAR_HOST_DEPENDENCY has been chosen because it matches the name BR2_CMAKE_HOST_DEPENDENCY already used in check-host-cmake.mk. The BR2_TAR_HOST_DEPENDENCY is added to all packages, except host-tar itself (obviously) and host-skeleton, because we depend on host-skeleton to install host-tar properly in HOST_DIR. In addition, we modify tar.mk to explicitly build host-tar without ccache: since ccache source code is available as a tarball, ccache will obviously depend on host-tar if the system tar is insufficient. Finally, to make things really clean, we also add $(BR2_TAR_HOST_DEPENDENCY) to the dependencies of the tar filesystem format, since it requires tar, so we'd better make sure we have a suitable tar. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: Matt Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs/cpio/init: preserve argumentsGravatar Gaël PORTAY2018-02-261-1/+1
| | | | | | | | | | | Use "$@" instead of $* to preserve arguments containing spaces. The shell expands "$@" as "$1" "$2" "$3"... while it expands $@ as $1 $2 $3. With the second form, we loses spaces in positional parameters. Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com> Reviewed-by: Adrian Perez de Castro <aperez@igalia.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>