path: root/fs/common.mk
Commit message (Collapse)AuthorAgeFilesLines
* infra: consistently use double dollar signs inside inner-xxx-targetsGravatar Thomas De Schampheleire2014-06-141-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inner-xxx-targets in the buildroot package infrastructures are evaluated using $(eval) which causes variable references to be a bit different than in regular make code. As we want most references to be expanded only at the time of the $(eval) we should not use standard references $(VAR) but rather use double dollar signs $$(VAR). This includes function references like $(call), $(subst), etc. The only exception is the reference to pkgdir/pkgname and numbered variables, which are parameters to the inner block: $(1), $(2), etc. This patch introduces consistent usage of double-dollar signs throughout the different inner-xxx-targets blocks. In some cases, this would potentially cause circular references, in particular when the value of HOST_FOO_VAR would be obtained from the corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test is added to check for a host package (the only case where such constructions are relevant; these are not circular). Benefits of these changes are: - behavior of variables is now again as expected. For example, setting $(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while originally it would cause very odd results. - The output of 'make printvars' is now much more useful. This target shows the value of all variables, and the expression that led to that value. However, if the expression was coming from an inner-xxx-targets block, and was using single dollar signs, it would show in printvars as VAR = value (value) while if double dollar signs are used, it would effectively look like VAR = value (actual expression) as is intended. This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME, FOO_SITE_METHOD and FOO_MAKE. The correctness of this patch has been verified using 'make printvars', 'make manual' and 'make legal-info' before and after applying this patch, and comparing the output. Insight-provided-by: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* filesystems: also chown symlinksGravatar Yann E. MORIN2014-06-091-1/+1
| | | | | | | | | | | | | | | | Currently, the symlinks in the generated filesystems will have the UID of the user running the build, because 'chown' does not change the ownership of symlinks, by default. Although the implications are limited, some may not want that UID to leak in the generated filesystems. So, use 'chown -h' so even symlinks get properly chowned. Reported-by: Angelo Dureghello <angelo@barix.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* fs/common.mk: unbreak .xz compression when host-xz isn't builtGravatar Peter Korsgaard2014-06-041-2/+2
| | | | | | | | | | | | | | | | Closes #7160 Since f46f81de1315 (Don't build host-xz needlessly), host-xz is no longer unconditionally built when xz fs compression is requested, so don't explicitly refer to it. Instead, rely on our check-host-xzcat logic to ensure xz is available and set the path to ensure our host variant gets picked up if not available on the build machine. While we're at it, get rid of the now unused XZ variable. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs: use our own tools when calling the fakerooted scriptGravatar Yann E. MORIN2014-05-111-1/+1
| | | | | | | | | | | export PATH=$(BR_PATH) so that the fakerooted script uses our own tools before any of the host-system ones. Reported-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Romain Naour <romain.naour@openwide.fr> Reviewed-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs: use our own mkpasswd when creating usersGravatar Yann E. MORIN2014-05-111-1/+1
| | | | | | | | | | | Export PATH=$(BR_PATH) so that our own mkpasswd is found before any existing host-system one. Reported-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Samuel Martin <s.martin49@gmail.com> Tested-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* system: add ability to pass additional users tables.Gravatar Eric Le Bihan2014-04-211-1/+6
| | | | | | | | | | | | | | | | | | | | A new entry has been added to the "System Configuration" menu to allow the user to set the location of additional user tables (besides the ones defined in packages). A user table is a text file, formatted using the mkusers syntax, which describes the users on the target system, with their UID/GID, home directory, password, etc. The target root file system will be populated according the content of these files. Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> [yann.morin.1998@free.fr: use plural TABLES; we need to remove the intermediate users_table file, as it is no longer generated in one shot, in case a previous run failed and did not remove it] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Don't build host-xz needlesslyGravatar Baruch Siach2014-04-071-1/+0
| | | | | | | | | | | | Since commit d1f325f554cab (xzcat: treat as host prerequisite and build if needed) host-xz is always built when the host does not have xz installed. Removed all other host-xz dependencies. [Peter: don't drop for host-squashfs, as that needs libxz development files] Cc: Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* Makefile: add support for top-level parallel makeGravatar Fabio Porcedda2014-02-141-2/+2
| | | | | | | | | | | | | | To be able to use top-level parallel make we must not depend in a rule on the order of evaluation of the prerequisites, so instead of relyng on the left to right ordering of evaluation of the prerequisites add an explicit rule to describe the dependencies. Add explicit rules to describe the following dependency chain: $(TARGETS) -> target-finalize -> rootfs-* -> target-post-image Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs: ensure $(TARGET_DIR_WARNING_FILE) is writableGravatar Yann E. MORIN2014-01-281-1/+1
| | | | | | | | | | | | | | If the Buildroot tree is read-only, then $(TARGET_DIR_WARNING_FILE) is copied read-only into target/ but we may want to remove it during the build process. This poses no real problem, since target/ itself is guaranteed to be writable, but for good measure, force $(TARGET_DIR_WARNING_FILE) to be writable itself. Reported-by: Danomi Manchego <danomimanchego123@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* fs/common.mk: add host-mkpasswd if PACKAGES_USERS is not emptyGravatar Samuel Martin2014-01-221-1/+2
| | | | | | | | | | | | | | | | | | When using a custom rootfs skeleton, the host-mkpasswd target is not automatically built, even if some packages add users (i.e. when PACKAGES_USERS is not empty). In this case, the rootfs generation may fail because the mkpasswd provided by some distribution does not support all options used in the mkusers script. This patch avoids such trouble by automatically adding the host-mkpasswd package to the dependency list of the rootfs targets if users needs to be created. [Peter: minor rewording of commit message] Signed-off-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* rootfs-common: refactor the common compression commandsGravatar Arnout Vandecappelle2013-11-111-15/+27
| | | | | | | | | This makes the compression extension available in a variable, so it can be used by the fs-specific commands. In this patch, it is used by iso9660. Following patches show more use cases. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* rootfs-common: remove the now unused ROOTFS_<PKG>_POST_GEN_HOOKSGravatar Arnout Vandecappelle2013-11-111-4/+0
| | | | | Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* rootfs-ext2: make the symlink as a _POST_TARGETGravatar Arnout Vandecappelle2013-11-111-1/+1
| | | | | | | This will allow us to remove the unused ROOTFS_$(FSTYPE)_POST_GEN_HOOKS. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* Fix build reproducibility in Make 3.82Gravatar Jérôme Pouiller2013-09-061-1/+1
| | | | | | | | | | | | Make 3.82 no longer sort the result of wildcards (see http://comments.gmane.org/gmane.comp.gnu.make.bugs/4260). This may break build reproducibility. This patch sort results of wildcards to ensure reproducibility. Signed-off-by: Jérôme Pouiller <jezz@sysmic.org> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* packages: add ability for packages to create usersGravatar Yann E. MORIN2013-04-251-0/+3
| | | | | | | | | | | | | | | | Packages that install daemons may need those daemons to run as a non-root, or an otherwise non-system (eg. 'daemon'), user. Add infrastructure for packages to create users, by declaring the FOO_USERS variable that contain a makedev-syntax-like description of the user(s) to add. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Samuel Martin <s.martin49@gmail.com> Cc: Cam Hutchison <camh@xdna.net> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* fs/common: add support for LZO and XZ compression methodsGravatar Gustavo Zacarias2013-04-241-1/+7
| | | | | | | | Add support for LZO and XZ compression methods to cpio, ext2, tar and ubifs filesystem targets. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* fs/common.mk: Strip extra whitespace when device table is emptyGravatar Ezequiel Garcia2013-03-131-2/+2
| | | | | | | | | | | | | | | Since ROOTFS_DEVICE_TABLES is a concatenation of two strings separated by spaces, there will always be a space in it, which means it's never empty. Therefore, when testing for empty, the condition never evaluate to false. The following change fixes this problem; it runs qstrip on the overall combination of the variables, causing the space to be removed if it's the only thing left. Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* fs/common.mk: delay evaluation of variablesGravatar Arnout Vandecappelle (Essensium/Mind)2013-01-201-22/+22
| | | | | | | | | | | | | | | | | | | | | 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>
* Warn the user about the usage of output/target as the root filesystemGravatar Thomas Petazzoni2012-11-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A very common mistake done by our users is that they use output/target/ directory as their root filesystem. Even though this is loudly documented in our Buildroot manual, people don't read documentation, so it is not sufficient. This patch adds a text file named output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM which explains why output/target isn't appropriate to use as the root filesystem. The process is: * At the beginning of the build, right after the skeleton has been copied, support/misc/target-dir-warning.txt is copied to output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM * In the filesystem images creation code, this file is removed before launching fakeroot, and restored right after that, so that this file is not present in the generated root filesystem images. Note that the file has not been added to the default skeleton for two reasons: * It would have annoying to have in our source tree a file named in capital letters inside system/skeleton/ * The proposed way works even if the user uses a custom skeleton. [Peter: fixed typo] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Juha Lumme <juha.lumme@gmail.com> Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* use portable printf instead of echo -e, needed for MacOS X buildhostGravatar Waldemar Brodkorb2012-10-061-2/+2
| | | | | | | | | echo -e is not a portable way to do this, better use printf. Works with MacOS X. Signed-off-by: Waldemar Brodkorb <mail@waldemar-brodkorb.de> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* Remove unused .fakeroot.* mechanismGravatar Thomas Petazzoni2012-04-191-2/+0
| | | | | | | | | | | | | | | | | | | There used to be a mechanism using which packages could leave a .fakeroot.<something> file which could contain commands to be executed within the fakeroot environment. Since this mechanism is no longer used by any package, remove it from the common infrastructure. The latest user was nfs-utils, which used this mechanism to do the "make install" as root, since doing otherwise was not supported. But since 16e7b8255c82815126a2c502c3787d442d254a86, nfs-utils has been upgraded and converted to the package infrastructure, and this hack is no longer necessary. Another past user was the ltp-testsuite package, for the same reason, and since a72a670489547a3ca645ff7c3a0d9c3fb66eab51, the fakeroot hack is no longer needed. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* Add support for package-declared devicesGravatar Maxime Ripard2012-02-011-0/+4
| | | | | | | | | | | Add a way for packages to declare files they need instead of relying only on device tables, which creates files no matter if the package is indeed enabled, as we can see for busybox. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* System config: split static-dev device table setting into seperate optionGravatar Peter Korsgaard2011-07-251-1/+2
| | | | | | | | | | | | | As discussed here: http://lists.busybox.net/pipermail/buildroot/2011-May/043251.html Add BR2_ROOTFS_STATIC_DEVICE_TABLE for the extra device table file(s) to create device nodes in /dev, rather than complicated logic in BR2_ROOTFS_DEVICE_TABLE, making it complicated to move between static and dynamic modes. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* Allow several device tables and split in two parts our device tableGravatar Thomas Petazzoni2011-05-091-4/+6
| | | | | | | | | | | | | | This allows to have a device table for all directories/files and another device table for the device files themselves. Both are needed for static /dev, but only the first one is needed when devtmpfs/mdev/udev are used. We take this opportunity to move the documentation of the device table format in a common location, package/makedevs/README. [Peter: simplify code slightly, fix indentation] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* fs: add extra deps to ROOTFS_*_DEPENDENCIES variablesGravatar Peter Korsgaard2010-11-191-2/+5
| | | | | | Instead of explicitly adding it both places it is used. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* fs: rename make targets to match package/ conventionGravatar Peter Korsgaard2010-11-191-3/+3
| | | | | | | | | Use rootfs-* rather than *-root, to match the convention used under package/ and which fits with the ROOTFS_*_ variables. This will also help with the host dependencies. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* linux: add support for initramfsGravatar Thomas Petazzoni2010-06-221-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Buildroot, the kernel is built and installed *before* the root filesystems are built. This allows the root filesystem to correctly contain the kernel modules that have been installed. However, in the initramfs case, the root filesystem is part of the kernel. Therefore, the kernel should be built *after* the root filesystem (which, in the initramfs case simply builds a text file listing all files/directories/devices/symlinks that should be part of the initramfs). However, this isn't possible as the initramfs text file would lack all kernel modules. So, the solution choosen here is to keep the normal order: kernel is built before the root filesystem is generated, and to add a little quirk to retrigger a kernel compilation after the root filesystem generation. To do so, we add a ROOTFS_$(FSTYPE)_POST_TARGETS variable to the fs/common.mk infrastructure. This allows individual filesystems to set a target name that we should depend on *after* generating the root filesystem itself (contrary to normal ROOTFS_$(FSTYPE)_DEPENDENCIES, on which we depend *before* generating the root filesystem). The initramfs code in fs/initramfs/initramfs.mk uses this to add a dependency on 'linux26-rebuild-with-initramfs'. In linux/linux.mk, we do various things : * If BR2_TARGET_ROOTFS_INITRAMFS is enabled (i.e if initramfs is enabled as a root filesystem type), then we create an empty rootfs.initramfs file (remember that at this point, the root filesystem hasn't been generated) and we adjust the kernel configuration to include an initramfs. Of course, in the initial kernel build, this initramfs will be empty. * In the linux26-rebuild-with-initramfs target, we retrigger a compilation of the kernel image, after removing the initramfs in the kernel sources to make sure it gets properly rebuilt (we've experienced cases were modifying the rootfs.initramfs file wouldn't retrigger the generation of the initramfs at the kernel level). This is fairly quirky, but initramfs really is a special case, so in one way or another, we need a little quirk to solve its specialness. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Add a <fs>-root-show-depends targetGravatar Thomas Petazzoni2010-05-211-0/+3
| | | | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: convert to a more normal way of building packagesGravatar Thomas Petazzoni2010-04-191-1/+1
| | | | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* fs: change the way the device table is configuredGravatar Thomas Petazzoni2010-04-171-2/+3
| | | | | | | | | | | | | | | | Until now, the location of the device table was specified by a variable in board Makefiles. Unfortunately, this variable is not accessible from fs/common.mk, since the target/ code is included *after* fs/common.mk. Anyway, the general idea is to move away from these boards Makefile, and provide configuration option for things like the device table location. Therefore, this patch adds a BR2_ROOTFS_DEVICE_TABLE option which allows to specify which device table should be used. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Move all filesystem generation code to fs/Gravatar Thomas Petazzoni2010-04-091-0/+70
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>