Commit graph

35 commits

Author SHA1 Message Date
Ricardo Martincoski 2d8d5ced10 makedevs: allow leading whitespace for capabilities
Currently makedevs silently ignores extended attributes with leading
whitespace, for example those added to a <PACKAGE>_PERMISSIONS following
the recommended style from check-package.

Makedevs already ignores leading whitespace for normal entries (file
permission changes and device files creation). Do the same for extended
attributes.

Fixes: #11191.

Reported-by: Jean-pierre Cartal <jpcartal@free.fr>
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-08-10 08:25:08 +02:00
Arnout Vandecappelle 0f9c0bf3d5 Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin
Since things are no longer installed in $(HOST_DIR)/usr, the callers
should also not refer to it.

This is a mechanical change with
git grep -l '$(HOST_DIR)/usr/bin' | xargs sed -i 's%$(HOST_DIR)/usr/bin%$(HOST_DIR)/bin%g'

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-07-05 15:19:29 +02:00
Arnout Vandecappelle bdbbc72934 makedevs: support optional files
Add the 'F' file type to makedevs, that allows a file to be optional.
With this option, the line is just silently skipped if the file doesn't
exist (or is not a regular file).

This is useful for _PERMISSIONS where the file can be configured out
by package-specific configuration that is not directly handled by
Buildroot, like busybox.

Cc: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
Cc: Niranjan Reddy <niranjan.reddy@rockwellcollins.com>
Cc: Bryce Ferguson <bryce.ferguson@rockwellcollins.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-07-04 00:54:36 +02:00
Rahul Bedarkar af31c309e7 boot, linux, package: use SPDX short identifier for GPLv2/GPLv2+
We want to use SPDX identifier for license strings as much as possible.
SPDX short identifier for GPLv2/GPLv2+ is GPL-2.0/GPL-2.0+.

This change is done by using following command.
find . -name "*.mk" | xargs sed -ri '/LICENSE( )?[\+:]?=/s/\<GPLv2\>/GPL-2.0/g'

Signed-off-by: Rahul Bedarkar <rahulbedarkar89@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-04-01 15:16:38 +02:00
Peter Korsgaard 8852f08eed Merge branch 'next'
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-12-01 22:29:56 +01:00
Peter Korsgaard 4c6d5e33ae Revert "makedevs: make device node creation idempotent"
This reverts commit c85cd189dc.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-11-27 21:12:24 +01:00
Arnout Vandecappelle 207294ffa9 makedevs: remove target package
The makedevs package is a fork of the makedevs tool from busybox. It is
part of the Buildroot infrastructure, not something that should be used
on the target. It something like this is needed on the target, upstream
busybox should be used. And if one of the Buildroot-specific features
is needed, then that feature should be upstreamed to busybox.

Besides, there were already two things wrong with the target package:
- it didn't take into account the overlap with busybox (no depends on
  BR2_PACKAGE_BUSYBOX_SHOW_OTHERS, no dependency on busybox);
- it didn't take into account the libcap feature.

The target package was introduced more or less accidentally in 81cd9d45
where the intention was to make it more similar to other packages.

So, kill it with fire.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-11-23 23:12:06 +01:00
Arnout Vandecappelle c85cd189dc makedevs: make device node creation idempotent
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>
2016-11-05 23:32:59 +01:00
Arnout Vandecappelle ab1b6f7df4 makedevs: resync device creation with upstream busybox
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>
2016-11-05 23:32:46 +01:00
Thomas Petazzoni 6268be239a makedevs: remove VERSION/SOURCE
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>
2016-07-03 12:52:04 +02:00
Philippe Reynes 688059ebb2 makedevs: add capability support
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>
2016-06-30 12:13:38 +02:00
Yann E. MORIN 95dda394d9 package/makedevs: use the rooted /etc/passwd and /etc/group
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>
2016-02-01 08:02:00 +01:00
Angelo Compagnucci f3b8056960 package/makedevs: fixing missing return type
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>
2015-04-13 14:17:53 +02:00
Angelo Compagnucci 410f9b6013 package/makedevs: add recursive option
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>
2015-04-11 18:02:40 +02:00
Maxime Hadjinlian ba82e50f8d makedevs: Rework README
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>
2014-11-08 23:10:40 +01:00
Gustavo Zacarias 21510bdb0b makedevs: add license information
[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>
2014-07-15 22:51:07 +02:00
Thomas De Schampheleire ad406f6127 makedevs: change version from 'undefined' to 'buildroot-$(BR2_VERSION)'
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>
2014-06-14 19:10:18 +02:00
Maxime Hadjinlian c962338070 packages: replace command install by $(INSTALL)
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>
2014-06-08 17:56:54 +02:00
Thomas De Schampheleire eb7bd9ef61 packages: remove uninstall commands
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-12-06 09:40:40 +01:00
Thomas De Schampheleire bed4e27868 Config.in files: whitespace cleanup
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>
2013-11-11 22:19:30 +01:00
Alexandre Belloni 8dfd59d114 Normalize separator size to 80
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-06-06 22:30:24 +02:00
Arnout Vandecappelle (Essensium/Mind) e1502ebc0c all packages: rename XXXTARGETS to xxx-package
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>
2012-07-17 20:23:05 +02:00
Arnout Vandecappelle (Essensium/Mind) 69e64c42b7 all packages: use new host-xxx-package macros
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>
2012-07-17 20:18:03 +02:00
Julian Lunz 8876b6751e Fix makedevs to allow longer path names
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>
2012-04-08 19:46:52 +02:00
Peter Korsgaard 95af4fbfa5 makedevs: remove compiler warning about used-but-set
Closes #4171

Based on patch by Hector Oron <hector.oron@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-10-09 23:26:39 +02:00
Thomas Petazzoni 0849e8193e package: remove useless arguments from GENTARGETS
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>
2011-09-29 23:09:58 +02:00
Javier Viguera 99ead3c2ea makedevs: minor fix to command's help
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-05-25 17:49:15 +02:00
Thomas Petazzoni 4e005c47e5 Allow several device tables and split in two parts our device table
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>
2011-05-09 16:52:22 +02:00
Peter Korsgaard 707dc469aa makedevs: don't call /bin/sync after creating nodes
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>
2011-03-12 22:27:06 +01:00
Peter Korsgaard 3d0a569412 makedevs: convert to GENTARGETS format
And at the same time fix target build (used host compiler, didn't add
to TARGETS).

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-03-12 22:19:37 +01:00
Thomas De Schampheleire a85971a68b makedevs: fix cases where (start != 0)
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>
2011-02-23 23:37:36 +01:00
Matt Fleming 7879a4ba3f makedevs: Add support for 16-bit major/minor numbers
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>
2011-01-14 22:50:39 +01:00
Peter Korsgaard c7af389523 makedevs: add source targets
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2010-11-19 14:55:36 +01:00
Thomas Petazzoni 81cd9d45ff makedevs: convert to a more normal way of building packages
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-04-19 22:46:39 +02:00
Thomas Petazzoni 5faae48690 makedevs: move to package/
Since target/ doesn't contain any .mk file in subdirectories, also
remove the include in target/Makefile.in.
2010-04-19 22:46:37 +02:00