summaryrefslogtreecommitdiffstats
path: root/package/makedevs
Commit message (Collapse)AuthorAgeFilesLines
* makedevs: make device node creation idempotentArnout Vandecappelle2016-11-051-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use makedevs to create device nodes in the target rootfs. However, this can be called several times, e.g. when building several filesystem images or when rebuilding. When makedevs is called the second time, the device node already exists so mknod() errors out. This wasn't noticed before because fakeroot's mknod() wrapper (incorrectly) does _not_ error out when the file exists already. Now we switched from fakeroot to pseudo, the problem becomes apparent. Before creating the device node, check if it already exists and if so, if it has the correct device type and number. Change of mode and ownership is still done. This approach was preferred over removing the target files before creating them, which would be simpler. However, when e.g. a file exists as a normal file and makedevs specifies it as a device node, that really is an error so we should detect it. The other types don't have to be changed. The 'd' (directory) type is already OK because it already only creates directories if they don't exist yet. The 'f' (file mode) and 'r' (recursive) types only operate on files and directories that exist already. Patch also sent upstream to busybox. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Reported-by: Fabio Estevam <festevam@gmail.com> Tested-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: resync device creation with upstream busyboxArnout Vandecappelle2016-11-051-32/+15
| | | | | | | | | | | | | | | | | | | | | | | In upstream busbyox, the code to create devices has been simplified: the code for a single and for multiple devices is no longer duplicated. Since we are going to change the device creation code next, it's convenient to have only one copy to modify. There are two behavioural changes with this, but they were introduced silently together with other commits in upstream busybox. - When mknod() fails, the chmod was still done. This is pointless so it is no longer done now. - There was a check for mode != -1; however, a mode of -1 would not have worked anyway because all bits would be set for mknod(), which would fail. So this check is redundant. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Tested-by: Fabio Estevam <festevam@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: remove VERSION/SOURCEThomas Petazzoni2016-07-031-5/+0
| | | | | | | | | Now that the package infrastructure doesn't attempt to download a package that has an empty version string, there's no need to define the VERSION and SOURCE variables in the makedevs package. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* makedevs: add capability supportPhilippe Reynes2016-06-302-4/+81
| | | | | | | | | | | | Add the support of capability to makedevs as extended attribute. Now, it's possible to add a line "|xattr <capability>" after a file description to also add a capability to this file. It's possible to add severals capabilities with severals lines. [Peter: extend doc, reword Config.in, extend error message, use HOST_MAKEDEVS_CFLAGS/LDFLAGS for all flags] Signed-off-by: Philippe Reynes <philippe.reynes@sagemcom.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* package/makedevs: use the rooted /etc/passwd and /etc/groupYann E. MORIN2016-02-011-9/+31
| | | | | | | | | | | | | | | | | | | | | Currently, makedevs will query the host's /etc/passwd and /etc/group to resolve usernames and group names. This is inherently flawed, as we can never guarantee that the UIDs will be the same on the target as on the host, or even whether a particular user does exist on the host. This is because getpwnam() and getgrnam() will forcibly read the system's /etc/passwd and /etc/group, and there is no way to tell them to look anywhere else. However, we can use fgetpwent() and fgetgrent() instead, for which we can pass a FILE* stream to read from to get the entries. This means we must implement the scanning-loop ourselves, but fortunately, that's pretty trivial to do. [Peter: swap errno / return value check, use bb_perror_msg_and_die, code style] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* package/makedevs: fixing missing return typeAngelo Compagnucci2015-04-131-1/+1
| | | | | | | This patch fixes a missing return type in bb_recursive function. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* package/makedevs: add recursive optionAngelo Compagnucci2015-04-111-0/+31
| | | | | | | | | | | | This patch adds the option to change owner/permission of a directory recursively. [Thomas: s/folder/directory/, as suggested by Yann.] Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: Rework READMEMaxime Hadjinlian2014-11-081-9/+9
| | | | | | | | | Make all the example as a space separated list. The definition of the different type was modified to look like the same section on the manual. Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* makedevs: add license informationGustavo Zacarias2014-07-151-0/+1
| | | | | | | | | | [Thomas: change license to be GPLv2. The header of makedevs.c is a bit unclear, as it mentions both the GPL and LGPL. But since the code seems to originally be coming from Busybox, assuming GPLv2 is the safest option.] Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: change version from 'undefined' to 'buildroot-$(BR2_VERSION)'Thomas De Schampheleire2014-06-141-0/+2
| | | | | | | | | | | | | | The sources of the makedevs package are shipped with Buildroot, rather than downloaded from an external location. As a result, no explicit version is defined, causing build messages and build directory to show 'undefined' as version. This patch sets the version for makedevs to 'buildroot-$(BR2_VERSION), which would for example expand to 'buildroot-2014.05'. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* packages: replace command install by $(INSTALL)Maxime Hadjinlian2014-06-081-2/+2
| | | | | | Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* packages: remove uninstall commandsThomas De Schampheleire2013-12-061-5/+0
| | | | | Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* Config.in files: whitespace cleanupThomas De Schampheleire2013-11-111-4/+4
| | | | | | | | | | This patch fixes the following whitespace problems in Config.in files: - trailing whitespace - spaces instead of tabs for indentation - help text not indented with tab + 2 spaces Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* Normalize separator size to 80Alexandre Belloni2013-06-061-2/+2
| | | | | Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* all packages: rename XXXTARGETS to xxx-packageArnout Vandecappelle (Essensium/Mind)2012-07-171-1/+1
| | | | | | | | | | | | | Also remove the redundant $(call ...). This is a purely mechanical change, performed with find package linux toolchain boot -name \*.mk | \ xargs sed -i -e 's/$(eval $(call GENTARGETS))/$(eval $(generic-package))/' \ -e 's/$(eval $(call AUTOTARGETS))/$(eval $(autotools-package))/' \ -e 's/$(eval $(call CMAKETARGETS))/$(eval $(cmake-package))/' Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* all packages: use new host-xxx-package macrosArnout Vandecappelle (Essensium/Mind)2012-07-171-1/+1
| | | | | | | | | | | This is a purely mechanical change, performed with find package linux toolchain boot -name \*.mk | \ xargs sed -i -e 's/$(eval $(call GENTARGETS,host))/$(eval $(host-generic-package))/' \ -e 's/$(eval $(call AUTOTARGETS,host))/$(eval $(host-autotools-package))/' \ -e 's/$(eval $(call CMAKETARGETS,host))/$(eval $(host-cmake-package))/' Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Fix makedevs to allow longer path namesJulian Lunz2012-04-081-2/+2
| | | | | | | Makedevs path name is currently limited to 40, changed it to PATH_MAX 4096 from linux/include/linux/limits.h Signed-off-by: Julian Lunz <git@jlunz.de> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: remove compiler warning about used-but-setPeter Korsgaard2011-10-091-1/+1
| | | | | | | Closes #4171 Based on patch by Hector Oron <hector.oron@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* package: remove useless arguments from GENTARGETSThomas Petazzoni2011-09-291-2/+2
| | | | | | | | | | Thanks to the pkgparentdir and pkgname functions, we can rewrite the GENTARGETS macro in a way that avoids the need for each package to repeat its name and the directory in which it is present. [Peter: pkgdir->pkgparentdir] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: minor fix to command's helpJavier Viguera2011-05-251-1/+1
| | | | | Signed-off-by: Javier Viguera <javier.viguera@digi.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* Allow several device tables and split in two parts our device tableThomas Petazzoni2011-05-091-0/+35
| | | | | | | | | | | | | | 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>
* makedevs: don't call /bin/sync after creating nodesPeter Korsgaard2011-03-121-3/+0
| | | | | | | | | | Closes #3475 There's no real reason to sync after creating the device nodes, and it slows down the file system image creating quite a lot on busy systems, so get rid of it. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: convert to GENTARGETS formatPeter Korsgaard2011-03-121-24/+22
| | | | | | | And at the same time fix target build (used host compiler, didn't add to TARGETS). Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: fix cases where (start != 0)Thomas De Schampheleire2011-02-231-5/+13
| | | | | | | | | | | The makedevs script did not always generate the requested set of device names / minor number series. * If start != 0, then requesting (count) devices would generate only (count - start) * If start != 0 && increment != 1, then requesting minors starting with (minor) would generate minors starting with (minor + (start * (increment - 1))) This patch fixes the code and updates the usage text with extra examples. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: Add support for 16-bit major/minor numbersMatt Fleming2011-01-141-2/+2
| | | | | | | | Closes #2647 [Peter: Adjust for the real 12bit majors/20bit minors supported by Linux] Signed-off-by: Matt Fleming <matthew.fleming@imgtec.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: add source targetsPeter Korsgaard2010-11-191-1/+3
| | | | Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: convert to a more normal way of building packagesThomas Petazzoni2010-04-192-14/+24
| | | | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: move to package/Thomas Petazzoni2010-04-192-0/+565
Since target/ doesn't contain any .mk file in subdirectories, also remove the include in target/Makefile.in.
OpenPOWER on IntegriCloud