Re: [OSS-Tools] [dt-utils] Release 2023.11.0

2023-11-27 Thread Roland Hieber
On Fri, Nov 24, 2023 at 01:09:40PM +0100, Ahmad Fatoum wrote:
> On 24.11.23 12:04, Roland Hieber wrote:
> > Hi,
> > 
> > I've just release dt-utils version 2023.11.0. You can download it at the
> > usual location:
> > 
> > 
> > https://public.pengutronix.de/software/dt-utils/dt-utils-2023.08.0.tar.xz
> 
> https://public.pengutronix.de/software/dt-utils/dt-utils-2023.11.0.tar.xz

Oh yes, thank you, you're correct… so much for re-using old release
mails… 

 - Roland

> > The file checksums are as follows:
> > 
> > * MD5:4aa4ef310c76a2baa5df62254f0b7453
> > * SHA1:   3d9556c78c3894ef13fbf9b58eb66d1c11950563
> > * SHA256: d224d941c076c143f43d59cd7c6e1c522926064a31ac34a67720632ddecb6b53
> 
> Hashes are correct though.
> 
> Thanks for the release!
> Ahmad
> 
> > 
> > A small bugfix release, mainly consisting of the following commit:
> > 
> > * commit b67e96895f52 "libdt: prefer first found disk when looking for
> >   block devices"
> >   When using barebox-state on boards with a barbeox-state partition on
> >   an eMMC device, it could happen that barebox-state tried to find a GPT
> >   partition on /dev/mmcblkXbootN instead of /dev/mmcblkX, obviously
> >   failing to find a matching partition there, and quitting without any
> >   further action. This commit restores the old behaviour of using the
> >   first found MMC device (/dev/mmcblkX) instead of the last one.
> >   Although this is not completely future-proof, it has worked for years
> >   and serves a good stop-gap solution for now.
> > 
> > A few more housekeeping and maintenance commits:
> > 
> > * commit feca1c1ffdaa "README: provide git format.subjectPrefix line to 
> > copy"
> > * commit 1cd62596dbd7 "meson: align libdt-utils version with autotools'"
> > 
> > This release includes contributions by Ahmad Fatoum, Enrico Jörns, Leonard
> > Göhrs, and Roland Hieber. Thank you to all contributors!
> > 
> 
> -- 
> Pengutronix e.K.   |     |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH] libdt: prefer first found disk when looking for block devices

2023-11-24 Thread Roland Hieber
On Mon, Nov 06, 2023 at 12:04:05PM +0100, Ahmad Fatoum wrote:
> Recent rework introduced a regression for state located in the eMMC
> user area described by DT fixed partitions. Whereas before, the first
> device with type "disk" was taken, dt-utils will now iterate over all
> devices to try to find a matching GPT partition. If it doesn't find any,
> it will instead take the last device with type "disk", which will be the
> second boot partition for eMMC devices leading barebox-state to access
> /dev/mmcblkXboot1 instead of /dev/mmcblkX.
> 
> Let's fix this regression by restoring the old behavior of preferring the
> first disk. This may not be totally future proof, but it worked ok for
> years and a better solution can always be added later with a regular
> release.
> 
> Reported-by: Leonard Göhrs 
> Signed-off-by: Ahmad Fatoum 
> ---
>  src/libdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, this patch is now released in v2023.11.0.

 - Roland

> diff --git a/src/libdt.c b/src/libdt.c
> index 650b40467587..72e8ab41e09b 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2301,7 +2301,7 @@ static int cdev_from_block_device(struct udev_device 
> *dev,
>   devtype = udev_device_get_devtype(part);
>   if (!devtype)
>   continue;
> - if (!strcmp(devtype, "disk")) {
> + if (!strcmp(devtype, "disk") && !best_match) {
>   best_match = part;
>  
>   /* Should we try to find a matching partition first? */
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH dt-utils] README: provide git format.subjectPrefix line to copy

2023-11-24 Thread Roland Hieber
On Mon, Nov 06, 2023 at 12:29:53PM +0100, Ahmad Fatoum wrote:
> The oss-tools list is shared between a number of projects, so we should
> always use a subject prefix to make it clear where the patch applies.
> 
> The README already notes that and references the git man page, but it's
> more convenient to just provide a command line that can be directly
> copied and pasted.
> 
> Cc: Bastian Krause 
> Signed-off-by: Ahmad Fatoum 
> ---
>  README | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

Thanks, this patch is now released in v2023.11.0.

 - Roland

> diff --git a/README b/README
> index d68e6dacae6c..c6ef99c10b00 100644
> --- a/README
> +++ b/README
> @@ -44,8 +44,10 @@ The Git web view for this software can be found at:
><https://git.pengutronix.de/cgit/tools/dt-utils>
>  
>  Any patches should be sent to the mailing list above. Please prefix your
> -subject with "[PATCH dt-utils]" (when sending patches with Git, see the
> -git-config manpage for the option format.subjectPrefix).
> +subject with "[PATCH dt-utils]". This can be configured in Git with:
> +
> +git config format.subjectPrefix "PATCH dt-utils"
> +
>  Mails sent to this mailing list are also archived at
>  
><https://lore.pengutronix.de/oss-tools/>
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH dt-utils v2] meson: align libdt-utils version with autotools'

2023-11-24 Thread Roland Hieber
On Mon, Nov 06, 2023 at 02:49:07PM +0100, Ahmad Fatoum wrote:
> Makefile.am has following defines for libtool versioning:
> 
>   LIBDT_CURRENT=6
>   LIBDT_REVISION=0
>   LIBDT_AGE=0
> 
> along with a comment on how the values were chosen. Copy the comment and
> the values into the meson.build as well, so appropriate symlinks
> pointing at the versioned library are created. We forego the extra
> complexity of having a common file that's read from both build systems
> as we are intent on phasing out autotools anyway, once wrinkles such as
> what's fixed here are ironed out.
> 
> The translation from libtool versioning to major/minor/revision as
> expected by meson is taken from GNOME's gcab[1]. More information
> about libtool versioning is available in its documentation[2].
> 
> [1]: https://gitlab.gnome.org/GNOME/gcab/-/commit/2c8048f74ec8c088397
> [2]: 
> https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
> 
> Reported-by: Enrico Jörns 
> Signed-off-by: Ahmad Fatoum 

Thanks, this patch is now released in v2023.11.0.

 - Roland

> ---
> v1 -> v2:
>   - set library version major as current - age
> ---
>  meson.build | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 9579e712dfea..6489e4c4d52e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -122,6 +122,18 @@ versiondep = declare_dependency(sources: version_h)
>  
>  meson.add_dist_script('version-gen', meson.project_version())
>  
> +# If the library source code has changed at all since the last release,
> +#   then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
> +# If any interfaces have been added/removed/changed since the last release,
> +#   then increment current, and set revision to 0.
> +# If any public interfaces have been added since the last public release,
> +#   then increment age.
> +# If any interfaces have been removed or changed since the last release,
> +#   then set age to 0.
> +lt_current = 6
> +lt_revision = 0
> +lt_age = 0
> +
>  mapfile = 'src/libdt-utils.sym'
>  libdt_ld_flags = 
> '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
>  
> @@ -133,6 +145,7 @@ libdt = shared_library('dt-utils',
>c_args : ['-include', meson.current_build_dir() / 'version.h'],
>dependencies : [udevdep, versiondep],
>gnu_symbol_visibility : 'default',
> +  version: '@0@.@1@.@2@'.format(lt_current - lt_age, lt_age, lt_revision),
>install : true)
>  
>  executable('barebox-state',
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



[OSS-Tools] [dt-utils] Release 2023.11.0

2023-11-24 Thread Roland Hieber
Hi,

I've just release dt-utils version 2023.11.0. You can download it at the
usual location:

https://public.pengutronix.de/software/dt-utils/dt-utils-2023.08.0.tar.xz

The file checksums are as follows:

* MD5:4aa4ef310c76a2baa5df62254f0b7453
* SHA1:   3d9556c78c3894ef13fbf9b58eb66d1c11950563
* SHA256: d224d941c076c143f43d59cd7c6e1c522926064a31ac34a67720632ddecb6b53

A small bugfix release, mainly consisting of the following commit:

* commit b67e96895f52 "libdt: prefer first found disk when looking for
  block devices"
  When using barebox-state on boards with a barbeox-state partition on
  an eMMC device, it could happen that barebox-state tried to find a GPT
  partition on /dev/mmcblkXbootN instead of /dev/mmcblkX, obviously
  failing to find a matching partition there, and quitting without any
  further action. This commit restores the old behaviour of using the
  first found MMC device (/dev/mmcblkX) instead of the last one.
  Although this is not completely future-proof, it has worked for years
  and serves a good stop-gap solution for now.

A few more housekeeping and maintenance commits:

* commit feca1c1ffdaa "README: provide git format.subjectPrefix line to copy"
* commit 1cd62596dbd7 "meson: align libdt-utils version with autotools'"

This release includes contributions by Ahmad Fatoum, Enrico Jörns, Leonard
Göhrs, and Roland Hieber. Thank you to all contributors!

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH dt-utils] meson: align libdt-utils version with autotools'

2023-11-06 Thread Roland Hieber
On Mon, Nov 06, 2023 at 01:12:48PM +0100, Enrico Jörns wrote:
> Am Montag, dem 06.11.2023 um 13:04 +0100 schrieb Roland Hieber:
> > On Mon, Nov 06, 2023 at 12:58:22PM +0100, Ahmad Fatoum wrote:
> > > Makefile.am has:
> > > 
> > >   LIBDT_CURRENT=6
> > >   LIBDT_REVISION=0
> > >   LIBDT_AGE=0
> > > 
> > > along with a comment on how the values were chosen. Copy the comment and
> > > the values into the meson.build as well, so appropriate symlinks
> > > pointing at the versioned library are created. We forego the extra
> > > complexity of having a common file that's read from both build systems
> > > as we are intent on phasing out autotools anyway, once wrinkles such as
> > > what's fixed here are ironed out.
> > > 
> > > Reported-by: Enrico Jörns 
> > > Signed-off-by: Ahmad Fatoum 
> > 
> > Reviewed-by: Roland Hieber 
> > 
> > > ---
> > >  meson.build | 9 +
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 9579e712dfea..9894d7311bb3 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -133,6 +133,15 @@ libdt = shared_library('dt-utils',
> > >    c_args : ['-include', meson.current_build_dir() / 'version.h'],
> > >    dependencies : [udevdep, versiondep],
> > >    gnu_symbol_visibility : 'default',
> > > +# If the library source code has changed at all since the last release,
> > > +#   then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
> > > +# If any interfaces have been added/removed/changed since the last 
> > > release,
> > > +#   then increment current, and set revision to 0.
> 
> Does this make sense?
> Isn't "current" meant to mark *incompatible* public API changes?
> This might be valid for "removed" or "changed", but not for "added".
> 
> How does "interfaces" differ from "public interfaces" below?
> 
> Regards, Enrico
> 
> > > +# If any public interfaces have been added since the last public release,
> > > +#   then increment age.
> > > +# If any interfaces have been removed or changed since the last release,
> > > +#   then set age to 0.
> > > +  version: '6.0.0',

Wait. Enrico has a point. The "version" field in meson has the usual
"major.minor.patch" semantics [1], which does not relate to autotools'
current/revision/age scheme, which in autotools is used to calculate the
soversion (by some strange formula that I can never memorise). meson
however assumes the major number as soversion if nothing else is
specified.

Also [2] notes:

  > To set the version of the library, libtool provides the
  > -version-info parameter, which accepts three numbers, separated by
  > colons, that are called respectively, current, revision and age.
  > Both their name and their behaviour, nowadays, have to be considered
  > fully arbitrary, as the explanation provided in the official
  > documentation is confusing to say the least, and can be, in some
  > cases, considered completely wrong. 

As we want to get rid of autotools in the foreseeable future anyway, I
suggest that we drop the current/revision/age scheme and use semantic
versioning instead (i.e., increase major for ABI-incompatible changes,
increase minor for ABI-compatible new features, increase patch for
ABI-compatible bugfixes), which for versions like "6.1.2" results in
library names like "libdt-utils.so.6.1.2" and soversion of 6.

  [1]: 
https://mesonbuild.com/Reference-manual_functions.html#shared_library_version
  [2]: https://autotools.info/libtool/version.html#idm1602

(Please disregard my premature Reviewed-by.)

 - Roland

> > >    install : true)
> > >  
> > >  executable('barebox-state',
> > > -- 
> > > 2.39.2
> > > 
> > > 
> > > 
> > 
> 
> -- 
> Pengutronix e.K.   | Enrico Jörns|
> Embedded Linux Consulting & Support| https://www.pengutronix.de/ |
> Steuerwalder Str. 21   | Phone: +49-5121-206917-180  |
> 31137 Hildesheim, Germany  | Fax:   +49-5121-206917-9|
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH dt-utils] meson: align libdt-utils version with autotools'

2023-11-06 Thread Roland Hieber
On Mon, Nov 06, 2023 at 12:58:22PM +0100, Ahmad Fatoum wrote:
> Makefile.am has:
> 
>   LIBDT_CURRENT=6
>   LIBDT_REVISION=0
>   LIBDT_AGE=0
> 
> along with a comment on how the values were chosen. Copy the comment and
> the values into the meson.build as well, so appropriate symlinks
> pointing at the versioned library are created. We forego the extra
> complexity of having a common file that's read from both build systems
> as we are intent on phasing out autotools anyway, once wrinkles such as
> what's fixed here are ironed out.
> 
> Reported-by: Enrico Jörns 
> Signed-off-by: Ahmad Fatoum 

Reviewed-by: Roland Hieber 

> ---
>  meson.build | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 9579e712dfea..9894d7311bb3 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -133,6 +133,15 @@ libdt = shared_library('dt-utils',
>c_args : ['-include', meson.current_build_dir() / 'version.h'],
>dependencies : [udevdep, versiondep],
>gnu_symbol_visibility : 'default',
> +# If the library source code has changed at all since the last release,
> +#   then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
> +# If any interfaces have been added/removed/changed since the last release,
> +#   then increment current, and set revision to 0.
> +# If any public interfaces have been added since the last public release,
> +#   then increment age.
> +# If any interfaces have been removed or changed since the last release,
> +#   then set age to 0.
> +  version: '6.0.0',
>install : true)
>  
>  executable('barebox-state',
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH] libdt: prefer first found disk when looking for block devices

2023-11-06 Thread Roland Hieber
On Mon, Nov 06, 2023 at 12:04:05PM +0100, Ahmad Fatoum wrote:
> Recent rework introduced a regression for state located in the eMMC
> user area described by DT fixed partitions. Whereas before, the first
> device with type "disk" was taken, dt-utils will now iterate over all
> devices to try to find a matching GPT partition. If it doesn't find any,
> it will instead take the last device with type "disk", which will be the
> second boot partition for eMMC devices leading barebox-state to access
> /dev/mmcblkXboot1 instead of /dev/mmcblkX.
> 
> Let's fix this regression by restoring the old behavior of preferring the
> first disk. This may not be totally future proof, but it worked ok for
> years and a better solution can always be added later with a regular
> release.
> 
> Reported-by: Leonard Göhrs 
> Signed-off-by: Ahmad Fatoum 

Tested-by: Roland Hieber  [riot,imx6s-riotboard]

> ---
>  src/libdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index 650b40467587..72e8ab41e09b 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2301,7 +2301,7 @@ static int cdev_from_block_device(struct udev_device 
> *dev,
>   devtype = udev_device_get_devtype(part);
>   if (!devtype)
>   continue;
> - if (!strcmp(devtype, "disk")) {
> + if (!strcmp(devtype, "disk") && !best_match) {
>       best_match = part;
>  
>   /* Should we try to find a matching partition first? */
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH dt-utils] README: provide git format.subjectPrefix line to copy

2023-11-06 Thread Roland Hieber
On Mon, Nov 06, 2023 at 12:29:53PM +0100, Ahmad Fatoum wrote:
> The oss-tools list is shared between a number of projects, so we should
> always use a subject prefix to make it clear where the patch applies.
> 
> The README already notes that and references the git man page, but it's
> more convenient to just provide a command line that can be directly
> copied and pasted.
> 
> Cc: Bastian Krause 
> Signed-off-by: Ahmad Fatoum 

Reviewed-by: Roland Hieber 

> ---
>  README | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/README b/README
> index d68e6dacae6c..c6ef99c10b00 100644
> --- a/README
> +++ b/README
> @@ -44,8 +44,10 @@ The Git web view for this software can be found at:
><https://git.pengutronix.de/cgit/tools/dt-utils>
>  
>  Any patches should be sent to the mailing list above. Please prefix your
> -subject with "[PATCH dt-utils]" (when sending patches with Git, see the
> -git-config manpage for the option format.subjectPrefix).
> +subject with "[PATCH dt-utils]". This can be configured in Git with:
> +
> +git config format.subjectPrefix "PATCH dt-utils"
> +
>  Mails sent to this mailing list are also archived at
>  
><https://lore.pengutronix.de/oss-tools/>
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



[OSS-Tools] [dt-utils] Release 2023.08.0

2023-08-01 Thread Roland Hieber
Hi,

I've just release dt-utils version 2023.03.0. You can download it at the
usual location:

https://public.pengutronix.de/software/dt-utils/dt-utils-2023.08.0.tar.xz

The file checksums are as follows:

* MD5:ba7ed63c6e9bfc9c39e090c3bc1fb8c2
* SHA1:   e7cb21e9b4dda104eefec98e632f255e6cdc68b0
* SHA256: 15cda6fdbaaf08711e55b49db4479f3af48660b812d8d587ec9b3fffaa13a0f7

This release includes contributions by Ahmad Fatoum, Alexander Shiyan,
Christian Eggers, Marco Felsch, Michael Olbrich, Roland Hieber, Sascha Hauer,
Ulrich Ölmann, Uwe Kleine-König, and Yegor Yefremov.

Possibly breaking changes
-

(none known)

New features


* commit f80d96b15978 "libdt: add support for barebox,storage-by-uuid" added
  support for specifying barebox-state backend nodes in the device tree using
  the 'barebox,storage-by-uuid' compatible. The similarly-named Barebox driver
  looks for a storage device matching the given UUID, and when found registers a
  new device for it. This makes it possible to use GPT and MBR partitions as
  state backends without re-stating their respective partition tables in the
  device tree.

* commit bfa8e8eab135 "state: automatically find state.dtb in the ESP"
  implemented auto-detection of device trees on the EFI System Partition in
  /boot or /efi (the usual ESP mount points on most Linux distributions).

* barebox-state can now auto-detect state partitions on GPT if they have the
  Partition Type GUID 4778ed65-bf42-45fa-9c5b-287a1dc4aab1, which corresponds to
  a feature merged in Barebox v2023.07.0 (see commits leading up to
  <https://git.pengutronix.de/cgit/barebox/commit/?id=776714d9570253c46635>).
  - commit 2bab30b7d653 "libdt: add of_property_write_strings support"
  - commit c4ea02e5fb6e "libdt: generalize of_find_device_by_uuid for scoped 
lookup of all UUIDs"
  - commit 7de908382bed "libdt: fix of_get_devicepath looking up sibling if 
device unavailable"
  - commit 03a6d0146f5a "state: backend: direct: open block device in read-only 
mode if possible"
  - commit 86233cfe9ba5 "libdt: factor out u64 sysattr parsing into helper"
  - commit c458361777ab "libdt: drop broken if-branch"
  - commit cff3f1c19d78 "libdt: factor out __of_cdev_find helper"
  - commit 7a71beff497e "libdt: use block device partition instead of parent if 
found"
  - commit 72970a627990 "state: align with barebox use of of_cdev_find"
  - commit 5059165acd2b "libdt: use of_find_device_by_uuid for partuuid lookup"
  - commit b32cb1c15c42 "state: allow lookup of barebox state partition by Type 
GUID"

* commit 0976c48731ef "state: add option to lock device node" implemented
  locking the device node directly via flock() in the barebox-state tool instead
  of writing a lock file to the /run directory. This helps on systems that don't
  have a world-writeable /run. Currently the behaviour is disabled by default
  and can be enabled by the ./configure --enable-lock-device option and the
  'lock-device' option in meson.

* Meson was added as a build system. The support is currently experimental, but
  the plan is to phase out autotools in the future, but for now the old way of
  building the project will stay in place. See the updated instruction in the
  README for how to build dt-utils and run the new unit tests.
  - commit bc6e5d24916f "Add meson as build system"
  - commit 4e7ad815b856 "meson: options: use defaults of type boolean for 
boolean options"
  - commit 6dc8b1a948cf "meson: set optimization level to -O2 by default"
  - commit fc97420e830c "Makefile: include meson files in the dist tarball"

* There is now an initial set of unit tests, see the README on how to run them.
  - commit e5c524875a91 "meson: add simple integration test"
  - commit be44af10aa91 "libdt: add CONFIG_TEST_LOOPBACK"
  - commit 69a223619e28 "test: add barebox-state loop block device tests"
  - commit 885bb2feac99 "test: add test case with non-existent /dev/file"

* All files now have machine-readable license and copyright information, and the
  project conforms to the REUSE specification (see <https://reuse.software/>).
  You can build a Software Bill of Materials in SPDX format by running the
  'reuse spdx' command.
  - commit 893c6c9f628f "treewide: add SPDX identifiers to files with 
GPL-2.0-only license"
  - commit c1880166d1e3 "treewide: add SPDX identifiers to files with 
GPL-2.0-or-later license"
  - commit af84fa465d69 "treewide: add SPDX identifiers to files with 
GPL-3.0-or-later license"
  - commit fa56be74c3bd "treewide: add SPDX identifier to file with Zlib 
license"
  - commit 6c7ccb22ea30 "treewide: add CC0-1.0 SPDX identifiers for trivial 
files"
  - commit 75b7b2bce1d9 "treewide: add GPL-2.0-only

Re: [OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2023-08-01 Thread Roland Hieber
On Tue, Aug 01, 2023 at 12:10:18PM +0200, Roland Hieber wrote:
> 
> On Fri, 26 Mar 2021 22:06:44 +0100, Roland Hieber wrote:
> > 
> 
> 
> Applied, thanks!
> 
> [1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license
>   commit: c1880166d1e34efcf606297c8189b228aa78f78a
> [2/4] treewide: add SPDX identifiers to files with GPL-2.0-only license
>   commit: 893c6c9f628fed614537fd548b7a851d2d9ee868
> [3/4] treewide: add SPDX identifier to files with Zlib license
>   (no commit info)
> [4/4] treewide: add SPDX identifiers to files without license
>   (no commit info)

Oops. Seems like the "Auto-Thankanator gun" of 'b4 ty' misfired here…
Sorry for the noise.

 - Roland

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH dt-utils] README: clarify the need for "real names" with the DCO process

2023-08-01 Thread Roland Hieber


On Mon, 31 Jul 2023 10:51:29 +0200, Roland Hieber wrote:
> The Linux kernel recently changed the wording of "real names" to "known
> identities" (see commit d4563201f33a022fc035, 2023-02-26, Linus
> Torvalds: "Documentation: simplify and clarify DCO contribution example
> language"). In fact, we already credit contributors in our Git history
> by names that are probably not their "real names". Follow the reasoning
> in the kernel guidelines in that regard, and adapt our wording
> accordingly.
> 
> [...]

Applied, thanks!

[1/1] README: clarify the need for "real names" with the DCO process
      commit: 0b194c865e3f4fdf4c60df9ef84d46246bac8608

Best regards,
-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |





Re: [OSS-Tools] [PATCH dt-utils v2 0/9] make project conform to the REUSE specification

2023-08-01 Thread Roland Hieber


On Mon, 31 Jul 2023 11:11:22 +0200, Roland Hieber wrote:
> The REUSE specification [1] makes it possible to distribute license
> information in a machine-readable manner, and build a Software Bill of
> Material from the source files, by building on top of the SPDX
> specification. Make it so that the 'reuse lint' command reports
> compliance with the spec.
> 
>   [1]: https://reuse.software/spec/
> 
> [...]

Applied, thanks!

[1/9] treewide: add SPDX identifiers to files with GPL-2.0-only license
  commit: 893c6c9f628fed614537fd548b7a851d2d9ee868
[2/9] treewide: add SPDX identifiers to files with GPL-2.0-or-later license
  commit: c1880166d1e34efcf606297c8189b228aa78f78a
[3/9] treewide: add SPDX identifiers to files with GPL-3.0-or-later license
  commit: af84fa465d6968bd978b3af4e94aa82e735fe516
[4/9] treewide: add SPDX identifier to file with Zlib license
  commit: fa56be74c3bd991a40384e9be4a485f3febea19e
[5/9] treewide: add CC0-1.0 SPDX identifiers for trivial files
  commit: 6c7ccb22ea30ee28d42679a7ba66c0199f135db1
[6/9] treewide: add GPL-2.0-only SPDX identifiers to files without license
  commit: 75b7b2bce1d9ff437fff505f8d811ac5858d81f1
[7/9] treewide: add trivial copyright headers
  commit: 95d6b5c4c95d70fa23d95dfd0457d491d867ef86
[8/9] DCO: add SPDX license information
  commit: 18416bd75b83b605c0537683dda4f9ff14d06eec
[9/9] README: mention compatibility with the REUSE specification
  commit: 681180373d82e0bdf623833b8f786e79e4a41550

Best regards,
-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |





Re: [OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2023-08-01 Thread Roland Hieber


On Fri, 26 Mar 2021 22:06:44 +0100, Roland Hieber wrote:
> 


Applied, thanks!

[1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license
  commit: c1880166d1e34efcf606297c8189b228aa78f78a
[2/4] treewide: add SPDX identifiers to files with GPL-2.0-only license
  commit: 893c6c9f628fed614537fd548b7a851d2d9ee868
[3/4] treewide: add SPDX identifier to files with Zlib license
  (no commit info)
[4/4] treewide: add SPDX identifiers to files without license
  (no commit info)

Best regards,
-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |





Re: [OSS-Tools] [PATCH 1/3] meson: options: use defaults of type boolean for boolean options

2023-08-01 Thread Roland Hieber


On Mon, 12 Jun 2023 14:07:52 +0200, Ahmad Fatoum wrote:
> Building with newer meson versions alerts us that specifying defaults
> with a string type for non-string types is deprecated. This type
> confusion was not intentional, so fix that.
> 
> 

Applied, thanks!

[1/3] meson: options: use defaults of type boolean for boolean options
  commit: 4e7ad815b856bfd4758097d3bb8cd79ea82d5653
[2/3] test: add test case with non-existent /dev/file
  commit: 885bb2feac99a05711f2f51fe8e781a5f890239c
[3/3] meson: set optimization level to -O2 by default
  commit: 6dc8b1a948cf063334f4cc6ecef05e769981590a

Best regards,
-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |





[OSS-Tools] [PATCH dt-utils v2 2/9] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2023-07-31 Thread Roland Hieber
Use the same license text as for GPL-2.0-only, but with different
boilerplate headers.

Signed-off-by: Roland Hieber 
--
PATCH v2:
 * add LICENSES/GPL-2.0-or-later.txt
 * don't remove boilerplate license headers, see my own comment:
   
https://lore.pengutronix.org/oss-tools/20210331100305.e4klllzxx4p7y...@pengutronix.de
   and the REUSE FAQ: https://reuse.software/faq/#edit-copyright-and-licensing

PATCH v1: 
https://lore.pengutronix.org/oss-tools/20210326210647.8648-1-...@pengutronix.de
---
 LICENSES/GPL-2.0-or-later.txt   | 351 
 src/barebox-state/state.c   |   1 +
 src/barebox-state/state_variables.c |   1 +
 src/base64.c|   3 +-
 src/crypto/sha1.c   |   1 +
 src/crypto/sha2.c   |   1 +
 src/linux/uuid.h|   1 +
 test/sharness.sh|   1 +
 8 files changed, 358 insertions(+), 2 deletions(-)
 create mode 100644 LICENSES/GPL-2.0-or-later.txt

diff --git a/LICENSES/GPL-2.0-or-later.txt b/LICENSES/GPL-2.0-or-later.txt
new file mode 100644
index ..7fe1b477516e
--- /dev/null
+++ b/LICENSES/GPL-2.0-or-later.txt
@@ -0,0 +1,351 @@
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+
+   GNU GENERAL PUBLIC LICENSE
+  Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+   Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such progr

[OSS-Tools] [PATCH dt-utils v2 7/9] treewide: add trivial copyright headers

2023-07-31 Thread Roland Hieber
'reuse lint' warns about files without copyright information, and
refuses to give us the spec compliance checkmark. Add trivial copyright
lines to all remaining files that don't have any yet.

Signed-off-by: Roland Hieber 
---
PATCH v2: new in series v2
---
 .gitignore  | 1 +
 Makefile.am | 1 +
 NEWS| 1 +
 autogen.sh  | 1 +
 configure.ac| 1 +
 m4/.gitignore   | 1 +
 meson_options.txt   | 1 +
 scripts/barebox-mark-successful-boot.sh | 1 +
 src/.gitignore  | 1 +
 src/asm/unaligned.h | 1 +
 src/barebox-state.h | 2 ++
 src/barebox-state/state.h   | 1 +
 src/base64.h| 2 ++
 src/crc.h   | 1 +
 src/crypto/sha.h| 1 +
 src/driver.h| 1 +
 src/dt/common.h | 2 ++
 src/dt/dt.h | 2 ++
 src/dt/fdt.h| 2 ++
 src/dt/list.h   | 2 ++
 src/dtblint.h   | 1 +
 src/fdt.h   | 2 ++
 src/fdtdump.c   | 2 ++
 src/fs.h| 1 +
 src/init.h  | 1 +
 src/libbb.h | 2 ++
 src/libdt-utils.sym | 1 +
 src/libfile.h   | 1 +
 src/linux/err.h | 1 +
 src/linux/list.h| 1 +
 src/linux/mtd/mtd-abi.h | 1 +
 src/module.h| 1 +
 src/mtd/mtd-peb.h   | 1 +
 src/net.h   | 1 +
 src/of.h| 1 +
 src/printk.h| 1 +
 src/state.h | 1 +
 test/01-fixed-partition-no-gpt.dts  | 1 +
 test/02-fixed-partition-before-gpt-partition.dts| 1 +
 test/03-fixed-partition-is-gpt-partition.dts| 1 +
 test/04-gpt-partition-by-partuuid.dts   | 1 +
 test/05-gpt-partition-by-typeuuid.dts   | 1 +
 test/06-fixed-partition-by-diskuuid.dts | 1 +
 test/07-raw-disk-fail.dts   | 1 +
 test/08-gpt-disk-no-typeuuid-fail.dts   | 1 +
 test/09-no-disk-fail.dts| 1 +
 test/31-fixed-partition-overlaps-two-gpt-partitions.dts | 1 +
 ...32-fixed-partition-overlaps-two-gpt-partitions-partially.dts | 1 +
 test/33-fixed-partition-part-of-gpt-partition.dts   | 1 +
 test/barebox-state.dtsi | 1 +
 test/barebox-state.t| 1 +
 test/crc32.c| 1 +
 test/gpt-no-typeuuid.config | 1 +
 test/gpt.config | 1 +
 test/meson.build| 1 +
 test/raw.config | 1 +
 version-gen | 1 +
 version.h.in| 1 +
 58 files changed, 67 insertions(+)

diff --git a/.gitignore b/.gitignore
index f6afc0defbfa..c7b8d9da6ac2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
+# Copyright 2013-2023 The DT-Utils Authors 
 *~
 *.o
 .deps/
diff --git a/Makefile.am b/Makefile.am
index 960ac4902af5..7b27a37e43ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
+# Copyright 2013-2023 The DT-Utils Authors 
 
 EXTRA_DIST = DCO
 CLEANFILES =
diff --git a/NEWS b/NEWS
index fa169f9498d6..e7b6c4afda46 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4

[OSS-Tools] [PATCH dt-utils v2 3/9] treewide: add SPDX identifiers to files with GPL-3.0-or-later license

2023-07-31 Thread Roland Hieber
Use GPL-3.0-or-later license text from the SPDX website [1], and add the
boilerplate headers.

  [1]: https://spdx.org/licenses/GPL-3.0-or-later

Signed-off-by: Roland Hieber 
---
PATCH v2: new in series v2
---
 LICENSES/GPL-3.0-or-later.txt | 672 ++
 check-news.sh |   2 +-
 2 files changed, 673 insertions(+), 1 deletion(-)
 create mode 100644 LICENSES/GPL-3.0-or-later.txt

diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt
new file mode 100644
index ..45edb014fd52
--- /dev/null
+++ b/LICENSES/GPL-3.0-or-later.txt
@@ -0,0 +1,672 @@
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+
+GNU GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+
+Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+Preamble
+
+The GNU General Public License is a free, copyleft license for software
+and other kinds of works.
+
+The licenses for most software and other practical works are designed to
+take away your freedom to share and change the works. By contrast, the
+GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.
+Our General Public Licenses are designed to make sure that you have the
+freedom to distribute copies of free software (and charge for them if
+you wish), that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs, and that you know you can do these things.
+
+To protect your rights, we need to prevent others from denying you these
+rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis
+or for a fee, you must pass on to the recipients the same freedoms that
+you received. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1)
+assert copyright on the software, and (2) offer you this License giving
+you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of protecting
+users' freedom to change the software. The systematic pattern of such
+abuse occurs in the area of products for individuals to use, which is
+precisely where it is most unacceptable. Therefore, we have designed
+this version of the GPL to prohibit the practice for those products. If
+such problems arise substantially in other domains, we stand ready to
+extend this provision to those domains in future versions of the GPL, as
+needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+TERMS AND CONDITIONS
+
+0. Definitions.
+
+“This License” refers to version 3 of the GNU General Public License.
+
+“Copyright” also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+“The Program” refers to any copyrightable work licensed

[OSS-Tools] [PATCH dt-utils v2 6/9] treewide: add GPL-2.0-only SPDX identifiers to files without license

2023-07-31 Thread Roland Hieber
The dt-utils project license has effectively been GPL-2.0-only since
commit 2b39a389428224d96bbb (2014-11-27, Sascha Hauer: "COPYING: Change
to GPLv2"). Reflect this in the file headers so the license stays with
the code in case files get copied around.

Link: 
https://git.pengutronix.de/cgit/tools/dt-utils/commit/?id=2b39a389428224d96bbb
Signed-off-by: Roland Hieber 
---
PATCH v2:
 * rebase to next branch and add remaining files

PATCH v1: 
https://lore.pengutronix.org/oss-tools/20210326210647.8648-4-...@pengutronix.de
---
 .gitignore  | 1 +
 Makefile.am | 2 ++
 NEWS| 2 ++
 README  | 2 ++
 autogen.sh  | 1 +
 configure.ac| 2 ++
 m4/.gitignore   | 1 +
 meson.build | 1 +
 meson_options.txt   | 1 +
 scripts/barebox-mark-successful-boot.sh | 1 +
 src/.gitignore  | 1 +
 src/barebox-state.h | 1 +
 src/base64.h| 1 +
 src/crypto/sha.h| 1 +
 src/dt/common.h | 1 +
 src/dt/dt.h | 1 +
 src/dt/fdt.h| 1 +
 src/dt/list.h   | 1 +
 src/dtblint.h   | 1 +
 src/fdt.h   | 1 +
 src/fdtdump.c   | 1 +
 src/fs.h| 1 +
 src/libbb.h | 1 +
 src/libdt-utils.sym | 1 +
 src/linux/list.h| 1 +
 src/linux/mtd/mtd-abi.h | 1 +
 src/of.h| 1 +
 src/printk.h| 1 +
 src/state.h | 1 +
 test/01-fixed-partition-no-gpt.dts  | 1 +
 test/02-fixed-partition-before-gpt-partition.dts| 1 +
 test/03-fixed-partition-is-gpt-partition.dts| 1 +
 test/04-gpt-partition-by-partuuid.dts   | 1 +
 test/05-gpt-partition-by-typeuuid.dts   | 1 +
 test/06-fixed-partition-by-diskuuid.dts | 1 +
 test/07-raw-disk-fail.dts   | 1 +
 test/08-gpt-disk-no-typeuuid-fail.dts   | 1 +
 test/09-no-disk-fail.dts| 1 +
 test/31-fixed-partition-overlaps-two-gpt-partitions.dts | 1 +
 ...32-fixed-partition-overlaps-two-gpt-partitions-partially.dts | 1 +
 test/33-fixed-partition-part-of-gpt-partition.dts   | 1 +
 test/barebox-state.dtsi | 1 +
 test/barebox-state.t| 1 +
 test/crc32.c| 1 +
 test/gpt-no-typeuuid.config | 1 +
 test/gpt.config | 1 +
 test/meson.build| 1 +
 test/raw.config | 1 +
 version-gen | 1 +
 version.h.in| 1 +
 50 files changed, 54 insertions(+)

diff --git a/.gitignore b/.gitignore
index 22060feceab3..f6afc0defbfa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 *~
 *.o
 .deps/
diff --git a/Makefile.am b/Makefile.am
index d3077317ce9a..960ac4902af5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 EXTRA_DIST = DCO
 CLEANFILES =
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
diff --git a/NEWS b/NEWS
index e27f5efe20ac..fa169f9498d6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 dt-utils 2021.03.0
 ==
 
diff --git a/README b/README
index acfd2c171286..3f53b47c03f8 100644
--- a/README
+++ b/README
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 Utilities to work with device trees in Linux userspace
 
 The following tools are avail

[OSS-Tools] [PATCH dt-utils v2 4/9] treewide: add SPDX identifier to file with Zlib license

2023-07-31 Thread Roland Hieber
We don't have any zlib.h anyway, so the line in src/crc32.c is
meaningless. Add Zlib license from the SPDX website [1].

  [1]: https://spdx.org/licenses/Zlib.html

Reviewed-by: Uwe Kleine-König 
Signed-off-by: Roland Hieber 
---
PATCH v2:
 * add LICENSES/Zlib.txt

PATCH v1: 
https://lore.pengutronix.org/oss-tools/20210326210647.8648-3-...@pengutronix.de
---
 LICENSES/Zlib.txt | 19 +++
 src/crc32.c   |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 LICENSES/Zlib.txt

diff --git a/LICENSES/Zlib.txt b/LICENSES/Zlib.txt
new file mode 100644
index ..4dd43e509207
--- /dev/null
+++ b/LICENSES/Zlib.txt
@@ -0,0 +1,19 @@
+zlib License
+
+This software is provided 'as-is', without any express or implied warranty.  In
+no event will the authors be held liable for any damages arising from the use 
of
+this software.
+
+Permission is granted to anyone to use this software for any purpose, including
+commercial applications, and to alter it and redistribute it freely, subject to
+the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim
+   that you wrote the original software. If you use this software in a product,
+   an acknowledgment in the product documentation would be appreciated but is
+   not required.
+
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source distribution.
diff --git a/src/crc32.c b/src/crc32.c
index 8273d3465f6f..469dac3a5b27 100644
--- a/src/crc32.c
+++ b/src/crc32.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: Zlib */
 /*
  * This file is derived from crc32.c from the zlib-1.1.3 distribution
  * by Jean-loup Gailly and Mark Adler.
@@ -5,7 +6,6 @@
 
 /* crc32.c -- compute the CRC-32 of a data stream
  * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
 #include 
-- 
2.39.2




[OSS-Tools] [PATCH dt-utils v2 0/9] make project conform to the REUSE specification

2023-07-31 Thread Roland Hieber
The REUSE specification [1] makes it possible to distribute license
information in a machine-readable manner, and build a Software Bill of
Material from the source files, by building on top of the SPDX
specification. Make it so that the 'reuse lint' command reports
compliance with the spec.

  [1]: https://reuse.software/spec/

The result looks fairly similar to other projects using SPDX, like the
Linux kernel. All files have copyright and license information, and
the texts of all software licenses used in the project are available in
the LICENSES folder. The 'reuse spdx' command then prints out a SBoM in
SPDX format.

Roland Hieber (9):
  treewide: add SPDX identifiers to files with GPL-2.0-only license
  treewide: add SPDX identifiers to files with GPL-2.0-or-later license
  treewide: add SPDX identifiers to files with GPL-3.0-or-later license
  treewide: add SPDX identifier to file with Zlib license
  treewide: add CC0-1.0 SPDX identifiers for trivial files
  treewide: add GPL-2.0-only SPDX identifiers to files without license
  treewide: add trivial copyright headers
  DCO: add SPDX license information
  README: mention compatibility with the REUSE specification

 .gitignore|   2 +
 COPYING   | 281 +---
 DCO   |   2 +
 LICENSES/CC0-1.0.txt  | 121 
 LICENSES/GPL-2.0-only.txt | 350 +
 LICENSES/GPL-2.0-or-later.txt | 351 +
 LICENSES/GPL-3.0-or-later.txt | 672 ++
 LICENSES/LicenseRef-DCO.txt   |   2 +
 LICENSES/Zlib.txt |  19 +
 Makefile.am   |   3 +
 NEWS  |   3 +
 README|   6 +
 autogen.sh|   2 +
 check-news.sh |   2 +-
 configure.ac  |   3 +
 m4/.gitignore |   2 +
 meson.build   |   1 +
 meson_options.txt |   2 +
 scripts/barebox-mark-successful-boot.sh   |   2 +
 src/.gitignore|   2 +
 src/asm/unaligned.h   |   2 +
 src/barebox-state.c   |   1 +
 src/barebox-state.h   |   3 +
 src/barebox-state/backend_bucket_circular.c   |   1 +
 src/barebox-state/backend_bucket_direct.c |   1 +
 src/barebox-state/backend_format_dtb.c|   1 +
 src/barebox-state/backend_format_raw.c|   1 +
 src/barebox-state/backend_storage.c   |   1 +
 src/barebox-state/state.c |   1 +
 src/barebox-state/state.h |   1 +
 src/barebox-state/state_variables.c   |   1 +
 src/base64.c  |   3 +-
 src/base64.h  |   3 +
 src/crc.h |   2 +
 src/crc32.c   |   2 +-
 src/crypto/digest.c   |   1 +
 src/crypto/hmac.c |   3 +-
 src/crypto/internal.h |   3 +-
 src/crypto/keystore.h |   1 +
 src/crypto/sha.h  |   2 +
 src/crypto/sha1.c |   1 +
 src/crypto/sha2.c |   1 +
 src/digest.h  |   1 +
 src/driver.h  |   2 +
 src/dt/common.h   |   3 +
 src/dt/dt.h   |   3 +
 src/dt/fdt.h  |   3 +
 src/dt/list.h |   3 +
 src/dtblint-imx-pinmux.c  |   1 +
 src/dtblint.c |   1 +
 src/dtblint.h |   2 +
 src/fdt.c |   1 +
 src/fdt.h |   3 +
 src/fdtdump.c |   3 +
 src/fs.h  |   2 +
 src/init.h|   2 +
 src/keystore-blob.c   |   1 +
 src/libbb.h   |   3 +
 src/libdt-utils.sym   |   2 +
 src/libdt.c   |   1 +
 src/libfile.h |   2 +
 src/linux/err.h   |   2 +
 src/linux/list.h  |   2 +
 src/linux/mtd/mtd-abi.h   |   2 +
 src/linux/uuid.h  |   1 +
 src/module.h  |   2 +
 src/mtd/mtd-peb.h |   2 +
 src/net.h |   2 +
 src/of.h

[OSS-Tools] [PATCH dt-utils v2 1/9] treewide: add SPDX identifiers to files with GPL-2.0-only license

2023-07-31 Thread Roland Hieber
Move the GPL-2.0 license text to the new LICENSES folder, where it will
reside next to all other licenses. Add the rest of the license too (see
FSF FAQ [1]) and clean up the hard page breaks in the process.

Add the standard license dedication and warranty disclaimer too for
completeness sake, so we can easily reference the full license terms by
using its SPDX identifier, and don't have to carry around the
boilerplate headers in the future. However, keep the already existing
license headers in files, as recommended in the REUSE FAQ [2].

"COPYING" is probably still referenced somewhere, so make it point to
the new location of the GPL.

Link: [1] https://www.gnu.org/licenses/gpl-faq.html#GPLOmitPreamble
Link: [2] https://reuse.software/faq/#edit-copyright-and-licensing
Signed-off-by: Roland Hieber 
--
PATCH v2:
 * move COPYING to LICENSES/GPL-2.0-only.txt
 * use the complete GPL-2.0 text
 * don't remove boilerplate license headers from files

PATCH v1: 
https://lore.pengutronix.org/oss-tools/20210326210647.8648-2-...@pengutronix.de
---
 COPYING | 281 +---
 LICENSES/GPL-2.0-only.txt   | 350 
 src/barebox-state.c |   1 +
 src/barebox-state/backend_bucket_circular.c |   1 +
 src/barebox-state/backend_bucket_direct.c   |   1 +
 src/barebox-state/backend_format_dtb.c  |   1 +
 src/barebox-state/backend_format_raw.c  |   1 +
 src/barebox-state/backend_storage.c |   1 +
 src/crypto/digest.c |   1 +
 src/crypto/hmac.c   |   3 +-
 src/crypto/internal.h   |   3 +-
 src/crypto/keystore.h   |   1 +
 src/digest.h|   1 +
 src/dtblint-imx-pinmux.c|   1 +
 src/dtblint.c   |   1 +
 src/fdt.c   |   1 +
 src/keystore-blob.c |   1 +
 src/libdt.c |   1 +
 18 files changed, 367 insertions(+), 284 deletions(-)
 mode change 100644 => 12 COPYING
 create mode 100644 LICENSES/GPL-2.0-only.txt

diff --git a/COPYING b/COPYING
deleted file mode 100644
index 5a965fbc58c9..
--- a/COPYING
+++ /dev/null
@@ -1,280 +0,0 @@
-   GNU GENERAL PUBLIC LICENSE
-  Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-   Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually 

[OSS-Tools] [PATCH dt-utils v2 8/9] DCO: add SPDX license information

2023-07-31 Thread Roland Hieber
There is nothing prefabricated yet, so use a custom LicenseRef instead.

Signed-off-by: Roland Hieber 
---
PATCH v2: new in series v2
---
 DCO | 2 ++
 LICENSES/LicenseRef-DCO.txt | 2 ++
 2 files changed, 4 insertions(+)
 create mode 100644 LICENSES/LicenseRef-DCO.txt

diff --git a/DCO b/DCO
index 8201f992154a..75e56dd2683f 100644
--- a/DCO
+++ b/DCO
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LicenseRef-DCO
+
 Developer Certificate of Origin
 Version 1.1
 
diff --git a/LICENSES/LicenseRef-DCO.txt b/LICENSES/LicenseRef-DCO.txt
new file mode 100644
index ..b5b12d7c360b
--- /dev/null
+++ b/LICENSES/LicenseRef-DCO.txt
@@ -0,0 +1,2 @@
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
-- 
2.39.2




[OSS-Tools] [PATCH dt-utils v2 9/9] README: mention compatibility with the REUSE specification

2023-07-31 Thread Roland Hieber
Signed-off-by: Roland Hieber 
---
PATCH v2: new in series v2
---
 README | 4 
 1 file changed, 4 insertions(+)

diff --git a/README b/README
index 3f53b47c03f8..9a0ab79c0167 100644
--- a/README
+++ b/README
@@ -75,3 +75,7 @@ This program is distributed in the hope that it will be 
useful, but WITHOUT ANY
 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 PARTICULAR PURPOSE. See the GNU General Public License (the file COPYING
 bundled with this software) for more details.
+
+The dt-utils project conforms to the REUSE specification. You can use the
+'reuse' tool to get a Software Bill of Materials in SPDX format. For more
+information, see <https://reuse.software/>.
-- 
2.39.2




[OSS-Tools] [PATCH dt-utils v2 5/9] treewide: add CC0-1.0 SPDX identifiers for trivial files

2023-07-31 Thread Roland Hieber
Add license text from the SPDX website [1].

  [1]: https://spdx.org/licenses/CC0-1.0.html

Signed-off-by: Roland Hieber 
---
PATCH v2: new in series v2
---
 LICENSES/CC0-1.0.txt | 121 +++
 src/asm/unaligned.h  |   1 +
 src/crc.h|   1 +
 src/driver.h |   1 +
 src/init.h   |   1 +
 src/libfile.h|   1 +
 src/linux/err.h  |   1 +
 src/module.h |   1 +
 src/mtd/mtd-peb.h|   1 +
 src/net.h|   1 +
 10 files changed, 130 insertions(+)
 create mode 100644 LICENSES/CC0-1.0.txt

diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt
new file mode 100644
index ..0e259d42c996
--- /dev/null
+++ b/LICENSES/CC0-1.0.txt
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+  i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+  v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs 

[OSS-Tools] [PATCH dt-utils] README: clarify the need for "real names" with the DCO process

2023-07-31 Thread Roland Hieber
The Linux kernel recently changed the wording of "real names" to "known
identities" (see commit d4563201f33a022fc035, 2023-02-26, Linus
Torvalds: "Documentation: simplify and clarify DCO contribution example
language"). In fact, we already credit contributors in our Git history
by names that are probably not their "real names". Follow the reasoning
in the kernel guidelines in that regard, and adapt our wording
accordingly.

Link: https://git.kernel.org/torvalds/c/d4563201f33a022fc035
Signed-off-by: Roland Hieber 
---
 README | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README b/README
index acfd2c171286..428c459f7f79 100644
--- a/README
+++ b/README
@@ -57,8 +57,8 @@ By adding a Signed-off-by line (e.g. using `git commit -s`) 
saying
 
   Signed-off-by: Random J Developer 
 
-(using your real name and e-mail address), you state that your contributions
-are in line with the DCO.
+(using your known identity), you state that your contributions are in line with
+the DCO.
 
 License
 ---
-- 
2.39.2




Re: [OSS-Tools] [PATCH 3/3] meson: set optimization level to -O2 by default

2023-07-27 Thread Roland Hieber
On Mon, Jun 12, 2023 at 02:07:54PM +0200, Ahmad Fatoum wrote:
> From: Ahmad Fatoum 
> 
> We shouldn't expect users to override optimization levels, so let's have
> a sensible default.
> 
> Signed-off-by: Ahmad Fatoum 

Reviewed-by: Roland Hieber 

> ---
>  meson.build | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meson.build b/meson.build
> index be92446f137a..e03e1dbf6e85 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -9,6 +9,7 @@ project(
>default_options: [
>  'c_std=gnu11',
>  'warning_level=2',
> +'optimization=2',
>],
>    license : 'GPL-2.0-only',
>  )
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 2/3] test: add test case with non-existent /dev/file

2023-07-27 Thread Roland Hieber
On Mon, Jun 12, 2023 at 02:07:53PM +0200, Ahmad Fatoum wrote:
> From: Ahmad Fatoum 
> 
> When backend points at a device that couldn't be resolved, barebox-state
> should fail instead of taking another device.
> 
> This is meant to address issues like the one fixed by commit
> e7d71f099659 ("libdt: fix of_get_devicepath looking up sibling if
> device unavailable"), but the error case there can't be reproduced
> exactly, because loop devices have no common parent. Still one test
> is better than no test until we start testing in Qemu.
> 
> Signed-off-by: Ahmad Fatoum 

Reviewed-by: Roland Hieber 

> ---
>  test/09-no-disk-fail.dts | 26 ++
>  1 file changed, 26 insertions(+)
>  create mode 100644 test/09-no-disk-fail.dts
> 
> diff --git a/test/09-no-disk-fail.dts b/test/09-no-disk-fail.dts
> new file mode 100644
> index ..49cfa852525d
> --- /dev/null
> +++ b/test/09-no-disk-fail.dts
> @@ -0,0 +1,26 @@
> +/dts-v1/;
> +
> +#include "barebox-state.dtsi"
> +
> +/ {
> + expected-dev = "";
> +
> + disk: loopfile0 {
> + compatible = "barebox,hostfile";
> + barebox,filename = "/dev/barebox-state-dev-does-not-exist";
> + barebox,blockdev;
> + };
> +
> + otherdisk: loopfile1 {
> + compatible = "barebox,hostfile";
> + barebox,filename = __GPT_LOOPDEV__;
> + barebox,blockdev;
> + };
> +};
> +
> + {
> + backend = <>;
> + backend-type = "raw";
> + backend-stridesize = <0x40>;
> + backend-storage-type = "direct";
> +};
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 1/3] meson: options: use defaults of type boolean for boolean options

2023-07-27 Thread Roland Hieber
On Mon, Jun 12, 2023 at 02:07:52PM +0200, Ahmad Fatoum wrote:
> From: Ahmad Fatoum 
> 
> Building with newer meson versions alerts us that specifying defaults
> with a string type for non-string types is deprecated. This type
> confusion was not intentional, so fix that.
> 
> Signed-off-by: Ahmad Fatoum 
> ---

Reviewed-by: Roland Hieber 

>  meson_options.txt | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/meson_options.txt b/meson_options.txt
> index f80643aa6c73..04d9854a4b1b 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -2,24 +2,24 @@
>  option(
>'state-backward-compatibility',
>type : 'boolean',
> -  value : 'false',
> +  value : false,
>description : 'barebox-state: when using the "direct" storage backend, 
> keep the on-disk format readable by barebox <= v2016.08.0')
>  
>  option(
>'lock-device',
>type : 'boolean',
> -  value : 'false',
> +  value : false,
>description : 'lock device node instead of creating lockfile in /run')
>  
>  # build options
>  option(
>'barebox-state',
>type : 'boolean',
> -  value : 'true',
> +  value : true,
>description : 'Build barebox-state utility')
>  
>  option(
>'tests',
>type : 'boolean',
> -  value : 'true',
> +  value : true,
>description : 'Enable/Disable test suite')
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH v2 0/8] state: allow lookup of barebox state partition by Type GUID

2023-07-03 Thread Roland Hieber
On Wed, Jun 07, 2023 at 02:16:20PM +0200, Ahmad Fatoum wrote:
> This implements the binding extension introduced to barebox here:
> https://lore.barebox.org/barebox/20230607120714.3083182-1-a.fat...@pengutronix.de/T/#t
> 
> With this, barebox,state backend can optionally point at a device
> instead of a partition. If this device is GPT-partitioned and has
> a partition with a specific partition type GUID of
> 
>   4778ed65-bf42-45fa-9c5b-287a1dc4aab1
> 
> It will be taken.
> 
> This series also fixes an annoying issue of barebox-state triggering
> udev on every access, because the root block device corresponding
> to the device tree node was opened r/w.
> 
> barebox-state will now open the disk read-only if possible and if
> a partition exists that fits the barebox state location, it will
> be opened instead.
> 
> v1 -> v2:
>   - added Uwe's Reviewed-by
>   - fix typo spotted by Roland
>   - Rebase on top of next
>   - Sync with v2 of barebox series:
> - fix typo (Sascha)
> - define new cdev_find_child_by_gpt_typeuuid helper (Marco)
>   - handle case of iterating over partitions before disk in
> cdev_from_block_device

Looks good to me now.

Reviewed-by: Roland Hieber 

> 
> Ahmad Fatoum (8):
>   state: backend: direct: open block device in read-only mode if
> possible
>   libdt: factor out u64 sysattr parsing into helper
>   libdt: drop broken if-branch
>   libdt: factor out __of_cdev_find helper
>   libdt: use block device partition instead of parent if found
>   state: align with barebox use of of_cdev_find
>   libdt: use of_find_device_by_uuid for partuuid lookup
>   state: allow lookup of barebox state partition by Type GUID
> 
>  src/barebox-state/backend_bucket_direct.c |   5 +-
>  src/barebox-state/backend_storage.c   |   2 +-
>  src/barebox-state/state.c |  52 +++-
>  src/barebox-state/state.h |   3 +-
>  src/dt/common.h   |   8 +
>  src/dt/dt.h   |   7 +
>  src/libdt-utils.sym   |   4 +
>  src/libdt.c   | 336 ++
>  src/linux/uuid.h  |  24 ++
>  src/state.h       |   4 +
>  10 files changed, 368 insertions(+), 77 deletions(-)
>  create mode 100644 src/linux/uuid.h
> 
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH] libdt: generalize of_find_device_by_uuid for scoped lookup of all UUIDs

2023-06-14 Thread Roland Hieber
On Wed, Jun 07, 2023 at 01:00:29PM +0200, Ahmad Fatoum wrote:
> Hello Roland,
> 
> On 07.06.23 10:33, Roland Hieber wrote:
> > On Mon, Jun 05, 2023 at 04:32:36PM +0200, Ahmad Fatoum wrote:
> >> Despite the generic name, of_find_device_by_uuid only handled
> >> ID_PART_TABLE_UUID (diskuuid) and ID_PART_ENTRY_UUID (partuuid),
> >> but not ID_PART_ENTRY_TYPE (GPT Partition Type UUID).
> >>
> >> In preparation for doing Type UUID lookups, adjust of_find_device_by_uuid
> >> to support all three types of GPT UUIDs.
> >>
> >> Signed-off-by: Ahmad Fatoum 
> >> ---
> >> This patch is the missing prerequisite for my GPT Type UUID series.
> >> ---
> >>  src/libdt.c | 30 +++---
> >>  1 file changed, 19 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/src/libdt.c b/src/libdt.c
> >> index e54d7fb5649d..2c994c647ac9 100644
> >> --- a/src/libdt.c
> >> +++ b/src/libdt.c
> >> @@ -2405,7 +2405,9 @@ out:
> >>return dev;
> >>  }
> >>  
> >> -static struct udev_device *of_find_device_by_uuid(const char *uuid)
> >> +static struct udev_device *of_find_device_by_uuid(struct udev_device 
> >> *parent,
> >> +const char *uuid,
> >> +bool type_uuid)
> >>  {
> >>struct udev *udev;
> >>struct udev_enumerate *enumerate;
> >> @@ -2418,12 +2420,15 @@ static struct udev_device 
> >> *of_find_device_by_uuid(const char *uuid)
> >>}
> >>  
> >>enumerate = udev_enumerate_new(udev);
> >> +  if (parent)
> >> +  udev_enumerate_add_match_parent(enumerate, parent);
> >>udev_enumerate_add_match_subsystem(enumerate, "block");
> >>udev_enumerate_scan_devices(enumerate);
> >>devices = udev_enumerate_get_list_entry(enumerate);
> >>udev_list_entry_foreach(dev_list_entry, devices) {
> >>const char *path, *devtype, *dev_uuid;
> >>struct udev_device *device;
> >> +  const char *property;
> >>  
> >>path = udev_list_entry_get_name(dev_list_entry);
> >>device = udev_device_new_from_syspath(udev, path);
> >> @@ -2432,16 +2437,19 @@ static struct udev_device 
> >> *of_find_device_by_uuid(const char *uuid)
> >>devtype = udev_device_get_devtype(device);
> >>if (!devtype)
> >>continue;
> >> -  if (!strcmp(devtype, "disk")) {
> >> -  dev_uuid = udev_device_get_property_value(device, 
> >> "ID_PART_TABLE_UUID");
> >> -  if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> >> -  return device;
> >> -  } else if (!strcmp(devtype, "partition")) {
> >> -  dev_uuid = udev_device_get_property_value(device, 
> >> "ID_PART_ENTRY_UUID");
> >> -  if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> >> -  return device;
> >> -  }
> >>  
> >> +  if (type_uuid)
> >> +  property = "ID_PART_ENTRY_TYPE";
> >> +  else if (!strcmp(devtype, "disk"))
> >> +  property = "ID_PART_TABLE_UUID";
> >> +  else if (!strcmp(devtype, "partition"))
> >> +  property = "ID_PART_ENTRY_UUID";
> >> +  else
> >> +  continue;
> >> +
> >> +  dev_uuid = udev_device_get_property_value(device, property);
> >> +  if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> >> +  return device;
> > 
> > I wonder if we can't simply add a udev_enumerate_add_match_property
> > above to do the filtering for us instead of iterating over the match
> > entries ourselves.
> 
> I didn't know about udev_enumerate_add_match_property. Are multiple filters
> OR'd or AND'd? For the !type_uuid case we need to check one or the other
> property.

Sorry, I don't know either… it looks to me like they are ANDed, but the
documentation is a bit sparse on the udev side…

 - Roland

> 
> > But the patch is correct, so:
> > Reviewed-by: Roland Hieber 
> 
> Thanks. I have applied this patch and will keep 
> udev_enumerate_add_match_property
> in mind for future rework.
&

Re: [OSS-Tools] [PATCH] libdt: generalize of_find_device_by_uuid for scoped lookup of all UUIDs

2023-06-07 Thread Roland Hieber
On Mon, Jun 05, 2023 at 04:32:36PM +0200, Ahmad Fatoum wrote:
> Despite the generic name, of_find_device_by_uuid only handled
> ID_PART_TABLE_UUID (diskuuid) and ID_PART_ENTRY_UUID (partuuid),
> but not ID_PART_ENTRY_TYPE (GPT Partition Type UUID).
> 
> In preparation for doing Type UUID lookups, adjust of_find_device_by_uuid
> to support all three types of GPT UUIDs.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
> This patch is the missing prerequisite for my GPT Type UUID series.
> ---
>  src/libdt.c | 30 +++---
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index e54d7fb5649d..2c994c647ac9 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2405,7 +2405,9 @@ out:
>   return dev;
>  }
>  
> -static struct udev_device *of_find_device_by_uuid(const char *uuid)
> +static struct udev_device *of_find_device_by_uuid(struct udev_device *parent,
> +   const char *uuid,
> +   bool type_uuid)
>  {
>   struct udev *udev;
>   struct udev_enumerate *enumerate;
> @@ -2418,12 +2420,15 @@ static struct udev_device 
> *of_find_device_by_uuid(const char *uuid)
>   }
>  
>   enumerate = udev_enumerate_new(udev);
> + if (parent)
> + udev_enumerate_add_match_parent(enumerate, parent);
>   udev_enumerate_add_match_subsystem(enumerate, "block");
>   udev_enumerate_scan_devices(enumerate);
>   devices = udev_enumerate_get_list_entry(enumerate);
>   udev_list_entry_foreach(dev_list_entry, devices) {
>   const char *path, *devtype, *dev_uuid;
>   struct udev_device *device;
> + const char *property;
>  
>   path = udev_list_entry_get_name(dev_list_entry);
>   device = udev_device_new_from_syspath(udev, path);
> @@ -2432,16 +2437,19 @@ static struct udev_device 
> *of_find_device_by_uuid(const char *uuid)
>   devtype = udev_device_get_devtype(device);
>   if (!devtype)
>   continue;
> - if (!strcmp(devtype, "disk")) {
> - dev_uuid = udev_device_get_property_value(device, 
> "ID_PART_TABLE_UUID");
> - if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> - return device;
> - } else if (!strcmp(devtype, "partition")) {
> - dev_uuid = udev_device_get_property_value(device, 
> "ID_PART_ENTRY_UUID");
> - if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> - return device;
> - }
>  
> + if (type_uuid)
> + property = "ID_PART_ENTRY_TYPE";
> + else if (!strcmp(devtype, "disk"))
> + property = "ID_PART_TABLE_UUID";
> + else if (!strcmp(devtype, "partition"))
> + property = "ID_PART_ENTRY_UUID";
> + else
> + continue;
> +
> + dev_uuid = udev_device_get_property_value(device, property);
> + if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> + return device;

I wonder if we can't simply add a udev_enumerate_add_match_property
above to do the filtering for us instead of iterating over the match
entries ourselves.

But the patch is correct, so:
Reviewed-by: Roland Hieber 

>   }
>   return NULL;
>  }
> @@ -2540,7 +2548,7 @@ int of_get_devicepath(struct device_node 
> *partition_node, char **devpath, off_t
>   node->full_name);
>   return -ENODEV;
>   }
> - dev = of_find_device_by_uuid(uuid);
> + dev = of_find_device_by_uuid(NULL, uuid, false);
>   if (!dev) {
>   fprintf(stderr, "%s: cannot find device for uuid %s\n", 
> __func__,
>   uuid);
> -- 
> 2.39.2
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH fixup 1/2] libdt: remove ultimately unused variables

2023-06-05 Thread Roland Hieber
On Mon, Jun 05, 2023 at 02:31:01PM +0200, Ahmad Fatoum wrote:
> On 05.06.23 11:30, Ahmad Fatoum wrote:
> >> I'm not completely sure which version of the code you are referencing
> >> here because I cannot find that context, but …
> > 
> > I replied on mol's series with two fixups that should be squashed. One of 
> > them
> > removes *outdir, which is written, but never read.
> 
> Sorry, I was confused. Please find attached a patch that actually applies on 
> v4.
> The other fixup was out-of-place.

Yep, looks correct to me now.

 - Roland

> 
> 
> -- 8< -
> 
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index de8209ce53ae..019a7555a6f6 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2363,7 +2363,6 @@ static struct udev_device *of_find_device_by_uuid(const 
> char *uuid)
> struct udev *udev;
> struct udev_enumerate *enumerate;
> struct udev_list_entry *devices, *dev_list_entry;
> -   int ret = 0;
> 
> udev = udev_new();
> if (!udev) {
> @@ -2376,7 +2375,7 @@ static struct udev_device *of_find_device_by_uuid(const 
> char *uuid)
> udev_enumerate_scan_devices(enumerate);
> devices = udev_enumerate_get_list_entry(enumerate);
> udev_list_entry_foreach(dev_list_entry, devices) {
> -   const char *path, *devtype, *outpath, *dev_uuid;
> +   const char *path, *devtype, *dev_uuid;
> struct udev_device *device;
> 
> path = udev_list_entry_get_name(dev_list_entry);
> @@ -2388,16 +2387,12 @@ static struct udev_device 
> *of_find_device_by_uuid(const char *uuid)
> continue;
> if (!strcmp(devtype, "disk")) {
> dev_uuid = udev_device_get_property_value(device, 
> "ID_PART_TABLE_UUID");
> -   if (dev_uuid && !strcasecmp(dev_uuid, uuid)) {
> -   outpath = udev_device_get_devnode(device);
> +   if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> return device;
> -   }
> } else if (!strcmp(devtype, "partition")) {
> dev_uuid = udev_device_get_property_value(device, 
> "ID_PART_ENTRY_UUID");
> -   if (dev_uuid && !strcasecmp(dev_uuid, uuid)) {
> -   outpath = udev_device_get_devnode(device);
> +   if (dev_uuid && !strcasecmp(dev_uuid, uuid))
> return device;
> -   }
> }
> 
> }
> 
> 
> -- 
> Pengutronix e.K.       | |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 0/5] Add meson support and first test suite

2023-06-05 Thread Roland Hieber
On Wed, May 31, 2023 at 05:31:20PM +0200, Ahmad Fatoum wrote:
> The barebox,state binding is quite complex and we have a lot of udev
> parsing code that can only be exercised by manually running
> barebox-state on the target. Make development less error prone, by
> adding tests for the block device bindings. EEPROM and MTD can
> follow later.
> 
> Tests are executed by meson as a runner. Patches to teach autotools
> to do the same are welcome, although I think we should follow RAUC's
> steps and eventually deprecate autotools once meson is on par.

Yes.

> The obvious wart is that we build with -fvisibility=hidden on autotools,
> but with meson the same visibility option results in linker errors.
> 
> I have no idea why yet, but that should only make meson-built
> libdt-utils a bit slower without functional change.
> 
> Ahmad Fatoum (5):
>   Add meson as build system
>   state: add option to lock device node
>   meson: add simple integration test
>   libdt: add CONFIG_TEST_LOOPBACK
>   test: add barebox-state loop block device tests

For all:
Tested-by: Roland Hieber 

> 
>  .gitignore|   2 +
>  README|  21 +
>  check-news.sh |  82 ++
>  configure.ac  |  11 +
>  meson.build   | 163 
>  meson_options.txt |  25 +
>  src/barebox-state.c   |  30 +-
>  src/barebox-state/state.c |   4 +
>  src/barebox-state/state.h |  21 +
>  src/dt/dt.h   |   1 -
>  src/libdt.c   |  50 +-
>  test/01-fixed-partition-no-gpt.dts|  34 +
>  ...2-fixed-partition-before-gpt-partition.dts |  34 +
>  test/03-fixed-partition-is-gpt-partition.dts  |  34 +
>  test/04-gpt-partition-by-partuuid.dts |  31 +
>  test/05-gpt-partition-by-typeuuid.dts |  23 +
>  test/06-fixed-partition-by-diskuuid.dts   |  33 +
>  test/07-raw-disk-fail.dts |  18 +
>  test/08-gpt-disk-no-typeuuid-fail.dts |  18 +
>  ...-partition-overlaps-two-gpt-partitions.dts |  34 +
>  ...-overlaps-two-gpt-partitions-partially.dts |  34 +
>  ...-fixed-partition-part-of-gpt-partition.dts |  34 +
>  test/barebox-state.dtsi   |  53 ++
>  test/barebox-state.t  | 229 +
>  test/crc32.c  |  18 +
>  test/gpt-no-typeuuid.config   |  33 +
>  test/gpt.config   |  35 +
>  test/meson.build  |  36 +
>  test/raw.config   |  24 +
>  test/sharness.sh  | 857 ++
>  version-gen   |   3 +
>  version.h.in  |   3 +
>  32 files changed, 2012 insertions(+), 16 deletions(-)
>  create mode 100755 check-news.sh
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 test/01-fixed-partition-no-gpt.dts
>  create mode 100644 test/02-fixed-partition-before-gpt-partition.dts
>  create mode 100644 test/03-fixed-partition-is-gpt-partition.dts
>  create mode 100644 test/04-gpt-partition-by-partuuid.dts
>  create mode 100644 test/05-gpt-partition-by-typeuuid.dts
>  create mode 100644 test/06-fixed-partition-by-diskuuid.dts
>  create mode 100644 test/07-raw-disk-fail.dts
>  create mode 100644 test/08-gpt-disk-no-typeuuid-fail.dts
>  create mode 100644 test/31-fixed-partition-overlaps-two-gpt-partitions.dts
>  create mode 100644 
> test/32-fixed-partition-overlaps-two-gpt-partitions-partially.dts
>  create mode 100644 test/33-fixed-partition-part-of-gpt-partition.dts
>  create mode 100644 test/barebox-state.dtsi
>  create mode 100755 test/barebox-state.t
>  create mode 100644 test/crc32.c
>  create mode 100644 test/gpt-no-typeuuid.config
>  create mode 100644 test/gpt.config
>  create mode 100644 test/meson.build
>  create mode 100644 test/raw.config
>  create mode 100755 test/sharness.sh
>  create mode 100755 version-gen
>  create mode 100644 version.h.in
> 
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH fixup 1/2] libdt: remove ultimately unused variables

2023-06-05 Thread Roland Hieber
On Wed, May 31, 2023 at 05:13:32PM +0200, Ahmad Fatoum wrote:
> These variables were recently added, but are unused. Drop them.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  src/libdt.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index 44491a5e739b..302ca7a76375 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2365,7 +2365,6 @@ static struct udev_device 
> *of_find_device_by_uuid(struct udev_device *parent,
>   struct udev *udev;
>   struct udev_enumerate *enumerate;
>   struct udev_list_entry *devices, *dev_list_entry;
> - int ret = 0;
>  
>   udev = udev_new();
>   if (!udev) {
> @@ -2380,7 +2379,7 @@ static struct udev_device 
> *of_find_device_by_uuid(struct udev_device *parent,
>   udev_enumerate_scan_devices(enumerate);
>   devices = udev_enumerate_get_list_entry(enumerate);
>   udev_list_entry_foreach(dev_list_entry, devices) {
> - const char *path, *devtype, *outpath, *dev_uuid;
> + const char *path, *devtype, *dev_uuid;
>   struct udev_device *device;
>   const char *property;
>  
> @@ -2400,10 +2399,8 @@ static struct udev_device 
> *of_find_device_by_uuid(struct udev_device *parent,
>   property = "ID_PART_ENTRY_UUID";

I'm not completely sure which version of the code you are referencing
here because I cannot find that context, but …

>   dev_uuid = udev_device_get_property_value(device, property);
> - if (dev_uuid && !strcasecmp(dev_uuid, uuid)) {
> - outpath = udev_device_get_devnode(device);

in mol's v4 patch there's another "outpath" occurrence in the
'if (!strcmp(devtype, "disk"))' block above that.

 - Roland

> + if (dev_uuid && !strcasecmp(dev_uuid, uuid))
>   return device;
> - }
>   }
>   return NULL;
>  }
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 5/8] libdt: use block device partition instead of parent if found

2023-06-05 Thread Roland Hieber
On Wed, May 31, 2023 at 05:22:50PM +0200, Ahmad Fatoum wrote:
> Linux doesn't parse MTD fixed-partitions described in the device tree
> for block devices and EEPROMs. For block devices, The dt-utils work around
> this by doing the lookup in userspace and then arrive at the parent block
> device along with an offset that is passed along. We can do better
> though: If there's a partition block device that contains the region
> we are interested in, we should just be using that.
> 
> This avoids the issue of triggering a reread of the partition table
> after writing barebox state because udev is notified that we had
> been opening the whole block device writable.
> 
> Tested-by: Ulrich Ölmann 
> Signed-off-by: Ahmad Fatoum 
> ---
>  src/libdt.c | 60 +++--
>  1 file changed, 45 insertions(+), 15 deletions(-)
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index 440fcbd32fb4..e90ac5e26273 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2212,23 +2212,29 @@ static int udev_device_parse_sysattr_u64(struct 
> udev_device *dev, const char *at
>   return 0;
>  }
>  
> +/* True if A completely contains B */
> +static bool region_contains(loff_t starta, loff_t enda,
> + loff_t startb, loff_t endb)
> +{
> +return starta <= startb && enda >= endb;
> +}
> +
>  /*
> - * device_find_block_device - extract device path from udev block device
> + * cdev_from_block_device - Populate cdev from udev block device
>   *
>   * @dev: the udev_device to extract information from
> - * @devpath: returns the devicepath under which the block device is 
> accessible
> + * @cdev:the cdev output parameter to populate
>   *
>   * returns 0 for success or negative error value on failure.
>   */
> -int device_find_block_device(struct udev_device *dev,
> - char **devpath)
> +static int cdev_from_block_device(struct udev_device *dev,
> +   struct cdev *cdev)
>  {
>  
>   struct udev *udev;
>   struct udev_enumerate *enumerate;
>   struct udev_list_entry *devices, *dev_list_entry;
> - struct udev_device *part;
> - const char *outpath;
> + struct udev_device *part, *best_match = NULL;
>   int ret;
>  
>   udev = udev_new();
> @@ -2252,19 +2258,43 @@ int device_find_block_device(struct udev_device *dev,
>   if (!devtype)
>   continue;
>   if (!strcmp(devtype, "disk")) {
> - outpath = udev_device_get_devnode(part);
> - *devpath = strdup(outpath);
> - ret = 0;
> - goto out;
> + best_match = part;
> +
> + /* Should we try to find  a matching partition first? */

Nitpick: double space ;-)

 - Roland

> + if (!cdev->size)
> + break;
> + } else if (cdev->size && !strcmp(devtype, "partition")) {
> + u64 partstart, partsize;
> +
> + ret = udev_device_parse_sysattr_u64(part, "start", 
> );
> + if (ret)
> + continue;
> +
> + ret = udev_device_parse_sysattr_u64(part, "size", 
> );
> + if (ret)
> + continue;
> +
> + /* start/size sys attributes are always in 512-byte 
> units */
> + partstart *= 512;
> + partsize *= 512;
> +
> + if (!region_contains(partstart, partstart + partsize,
> +  cdev->offset, cdev->offset + 
> cdev->size))
> + continue;
> +
> + best_match = part;
> + cdev->offset -= partstart;
> + break;
>   }
>   }
> - ret = -ENODEV;
>  
> -out:
> + if (best_match)
> + cdev->devpath = strdup(udev_device_get_devnode(best_match));
> +
>   udev_enumerate_unref(enumerate);
>   udev_unref(udev);
>  
> - return ret;
> + return best_match ? 0 : -ENODEV;
>  }
>  
>  /*
> @@ -2604,10 +2634,10 @@ static int __of_cdev_find(struct device_node 
> *partition_node, struct cdev *cdev)
>  
>   return of_parse_partition(partition_node, >offset, 
> >size);
>   } else {
> - ret = device_find_block_device(dev, >devpath);
> + ret = of_parse_partition(partition_node, >offset, 
> >siz

Re: [OSS-Tools] [PATCH 2/8] libdt: factor out u64 sysattr parsing into helper

2023-06-02 Thread Roland Hieber
On Fri, Jun 02, 2023 at 03:16:13PM +0200, Roland Hieber wrote:
> On Wed, May 31, 2023 at 05:22:47PM +0200, Ahmad Fatoum wrote:
> > We will need to parse two more sysattrs in a follow-up patch, so factor
> > this out for reuse. While at it switch to 64-bit strtoull: This may
> > be more useful for future users and unlike atol doesn't invoke undefined
> > behavior when parsing fails.
> > 
> > Signed-off-by: Ahmad Fatoum 
> > ---
> >  src/libdt.c | 42 +++---
> >  1 file changed, 35 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/libdt.c b/src/libdt.c
> > index 2c994c647ac9..580b0b0ba769 100644
> > --- a/src/libdt.c
> > +++ b/src/libdt.c
> > @@ -2179,6 +2179,33 @@ static struct udev_device 
> > *device_find_mtd_partition(struct udev_device *dev,
> > return NULL;
> >  }
> >  
> > +/*
> 
> Use /** here so API doc generators could potentially  pick it up (even
> if we don't build API docs right now, but all other functions are
> documented the same way).

OK disregard that, not all functions have /** comments */ above them, so
this is a separate issue.

  - Roland

> > + * udev_device_parse_sysattr_u64 - parse sysattr value as unsigned 64-bit 
> > integer
> > + * @dev:   the udev_device to extract the attribute from
> > + * @attr:  name of the attribute to lookup
> > + * @outvalue:  returns the value parsed out of the attribute
> > + *
> > + * returns 0 for success or negative error value on failure.
> > + */
> > +static int udev_device_parse_sysattr_u64(struct udev_device *dev, const 
> > char *attr,
> > +   u64 *outvalue)
> > +{
> > +   char *endptr;
> > +   u64 value;
> > +   const char *str;
> > +
> > +   str = udev_device_get_sysattr_value(dev, attr);
> > +   if (!str)
> > +   return -EINVAL;
> > +
> > +   value = strtoull(str, , 0);
> > +   if (!*str || *endptr)
> > +   return -EINVAL;
> > +
> > +   *outvalue = value;
> > +   return 0;
> > +}
> > +
> >  /*
> >   * device_find_block_device - extract device path from udev block device
> >   *
> > @@ -2305,24 +2332,25 @@ static int udev_device_is_eeprom(struct udev_device 
> > *dev)
> >   * udev_parse_mtd - get information from a mtd udev_device
> >   * @dev:   the udev_device to extract information from
> >   * @devpath:   returns the devicepath under which the mtd device is 
> > accessible
> > - * @size:  returns the size of the mtd device
> > + * @outsize:   returns the size of the mtd device
> >   *
> >   * returns 0 for success or negative error value on failure. *devpath
> >   * will be valid on success and must be freed after usage.
> >   */
> > -static int udev_parse_mtd(struct udev_device *dev, char **devpath, size_t 
> > *size)
> > +static int udev_parse_mtd(struct udev_device *dev, char **devpath, size_t 
> > *outsize)
> >  {
> > -   const char *sizestr;
> > const char *outpath;
> > +   u64 size;
> > +   int ret;
> >  
> > if (!udev_device_is_mtd(dev))
> > return -EINVAL;
> >  
> > -   sizestr = udev_device_get_sysattr_value(dev, "size");
> > -   if (!sizestr)
> > -   return -EINVAL;
> > +   ret = udev_device_parse_sysattr_u64(dev, "size", );
> > +   if (ret)
> > +   return ret;
> >  
> > -   *size = atol(sizestr);
> > +   *outsize = size;
> >  
> > outpath = udev_device_get_devnode(dev);
> > if (!outpath)
> > -- 
> > 2.39.2
> > 
> > 
> > 
> 
> -- 
> Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
> Steuerwalder Str. 21 | https://www.pengutronix.de/ |
> 31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 2/8] libdt: factor out u64 sysattr parsing into helper

2023-06-02 Thread Roland Hieber
On Wed, May 31, 2023 at 05:22:47PM +0200, Ahmad Fatoum wrote:
> We will need to parse two more sysattrs in a follow-up patch, so factor
> this out for reuse. While at it switch to 64-bit strtoull: This may
> be more useful for future users and unlike atol doesn't invoke undefined
> behavior when parsing fails.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  src/libdt.c | 42 +++---
>  1 file changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index 2c994c647ac9..580b0b0ba769 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2179,6 +2179,33 @@ static struct udev_device 
> *device_find_mtd_partition(struct udev_device *dev,
>   return NULL;
>  }
>  
> +/*

Use /** here so API doc generators could potentially  pick it up (even
if we don't build API docs right now, but all other functions are
documented the same way).

 - Roland

> + * udev_device_parse_sysattr_u64 - parse sysattr value as unsigned 64-bit 
> integer
> + * @dev: the udev_device to extract the attribute from
> + * @attr:name of the attribute to lookup
> + * @outvalue:returns the value parsed out of the attribute
> + *
> + * returns 0 for success or negative error value on failure.
> + */
> +static int udev_device_parse_sysattr_u64(struct udev_device *dev, const char 
> *attr,
> + u64 *outvalue)
> +{
> + char *endptr;
> + u64 value;
> + const char *str;
> +
> + str = udev_device_get_sysattr_value(dev, attr);
> + if (!str)
> + return -EINVAL;
> +
> + value = strtoull(str, , 0);
> + if (!*str || *endptr)
> + return -EINVAL;
> +
> + *outvalue = value;
> + return 0;
> +}
> +
>  /*
>   * device_find_block_device - extract device path from udev block device
>   *
> @@ -2305,24 +2332,25 @@ static int udev_device_is_eeprom(struct udev_device 
> *dev)
>   * udev_parse_mtd - get information from a mtd udev_device
>   * @dev: the udev_device to extract information from
>   * @devpath: returns the devicepath under which the mtd device is accessible
> - * @size:returns the size of the mtd device
> + * @outsize: returns the size of the mtd device
>   *
>   * returns 0 for success or negative error value on failure. *devpath
>   * will be valid on success and must be freed after usage.
>   */
> -static int udev_parse_mtd(struct udev_device *dev, char **devpath, size_t 
> *size)
> +static int udev_parse_mtd(struct udev_device *dev, char **devpath, size_t 
> *outsize)
>  {
> - const char *sizestr;
>   const char *outpath;
> + u64 size;
> + int ret;
>  
>   if (!udev_device_is_mtd(dev))
>   return -EINVAL;
>  
> - sizestr = udev_device_get_sysattr_value(dev, "size");
> - if (!sizestr)
> - return -EINVAL;
> + ret = udev_device_parse_sysattr_u64(dev, "size", );
> + if (ret)
> + return ret;
>  
> - *size = atol(sizestr);
> + *outsize = size;
>  
>   outpath = udev_device_get_devnode(dev);
>   if (!outpath)
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 5/5] barebox-state: fix use after free in error path

2023-06-02 Thread Roland Hieber
For the whole series:

Reviewed-by: Roland Hieber 

On Wed, May 31, 2023 at 05:10:15PM +0200, Ahmad Fatoum wrote:
> blob_bin is freed a few lines above unconditionally, so freeing it
> again in the error path will cause a double free.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  src/keystore-blob.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/keystore-blob.c b/src/keystore-blob.c
> index ed6ecb4eaa25..8ec07f0a3d56 100644
> --- a/src/keystore-blob.c
> +++ b/src/keystore-blob.c
> @@ -81,10 +81,8 @@ int keystore_get_secret(const char *name, const unsigned 
> char **key, int *key_le
>  
>   /* payload */
>   fd = open(blob_gen_payload, O_RDONLY);
> - if (fd < 0) {
> - free(blob_bin);
> + if (fd < 0)
>   return -errno;
> - }
>  
>   payload = xzalloc(len);
>   len = read(fd, payload, len);
> -- 
> 2.39.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH v4 0/3] improve barebox-state support on EFI system

2022-05-15 Thread Roland Hieber
On Wed, May 11, 2022 at 10:21:22AM +0200, Michael Olbrich wrote:
> Hi,
> 
> so the discussion on the barebox ML resulted in a different binding for
> this. Sascha has sent patches for that[1]. This is now mainline in Barebox.
> 
> So while this is 'v4' for this topic, all the patches except the last one
> are actually different, so please drop the old series that is still present
> in the next branch.

I noticed that you dropped the deep probe patch from your v2 to v4 too,
but I think I will keep it to reduce the diff between barebox' and
dt-utils' state.c, even if it's a noop on the userland side.

 - Roland

> v2 had some Bugs that have been fixed in v3.
> Added some improvements as suggested by Ahmad in v4.
> 
> In the device-tree it now looks like this:
> 
> --
> / {
> [...]
> state: state {
> [...]
> backend = <_state>;
> [...]
> };
> 
> disk {
> compatible = "barebox,storage-by-uuid";
> uuid = "deadbeaf";
> 
> partitions {
> compatible = "fixed-partitions";
> #address-cells = <2>;
> #size-cells = <2>;
> 
> barebox_state: state@30 {
> label = "barebox-state";
> reg = <0x0 0x30 0x0 0x10>;
> };
> };
> };
> };
> --
> 
> Regards,
> Michael
> 
> [1] 
> https://lore.barebox.org/barebox/20220207094953.949868-1-s.ha...@pengutronix.de/T/#t
> 
> Michael Olbrich (3):
>   libdt: only requires a partname for mtd
>   libdt: add support for barebox,storage-by-uuid
>   state: automatically find state.dtb in the ESP
> 
>  src/barebox-state.c | 25 +
>  src/libdt.c | 91 ++---
>  2 files changed, 103 insertions(+), 13 deletions(-)
> 
> -- 
> 2.30.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH v4 2/3] libdt: add support for barebox, storage-by-uuid

2022-05-15 Thread Roland Hieber
On Wed, May 11, 2022 at 10:21:24AM +0200, Michael Olbrich wrote:
> Signed-off-by: Michael Olbrich 
> ---
> 
> changes in v3:
> uuid comparison fixed:
>  - compare the correct uuids
>  - don't crash when no uuid is present
> 
> changes in v4:
> use strcasecmp() to make the uuid check case insensitive.
> 
>  src/libdt.c | 74 +
>  1 file changed, 69 insertions(+), 5 deletions(-)
> 
> diff --git a/src/libdt.c b/src/libdt.c
> index 48c31931e8a1..4076d9a2f4a3 100644
> --- a/src/libdt.c
> +++ b/src/libdt.c
> @@ -2358,6 +2358,52 @@ out:
>   return dev;
>  }
>  
> +static struct udev_device *of_find_device_by_uuid(const char *uuid)
> +{
> + struct udev *udev;
> + struct udev_enumerate *enumerate;
> + struct udev_list_entry *devices, *dev_list_entry;
> + int ret = 0;
> +
> + udev = udev_new();

According to the udev docs, I think this should be udev_unref()ed
somewhere, see for example in of_find_mtd_device() above.

Hmm… looking through the existing code there are more places which could
profit from an udev_unref()…

> + if (!udev) {
> +   fprintf(stderr, "Can't create udev\n");
> +   return NULL;
> + }
> +
> + enumerate = udev_enumerate_new(udev);
> + udev_enumerate_add_match_subsystem(enumerate, "block");
> + udev_enumerate_scan_devices(enumerate);
> + devices = udev_enumerate_get_list_entry(enumerate);
> + udev_list_entry_foreach(dev_list_entry, devices) {
> + const char *path, *devtype, *outpath, *dev_uuid;
> + struct udev_device *device;
> +
> + path = udev_list_entry_get_name(dev_list_entry);
> + device = udev_device_new_from_syspath(udev, path);
> +

Same for a udev_device_unref(), somewhere…?

 - Roland

> + /* distinguish device (disk) from partitions */
> + devtype = udev_device_get_devtype(device);
> + if (!devtype)
> + continue;
> + if (!strcmp(devtype, "disk")) {
> + dev_uuid = udev_device_get_property_value(device, 
> "ID_PART_TABLE_UUID");
> + if (dev_uuid && !strcasecmp(dev_uuid, uuid)) {
> + outpath = udev_device_get_devnode(device);
> + return device;
> + }
> + } else if (!strcmp(devtype, "partition")) {
> + dev_uuid = udev_device_get_property_value(device, 
> "ID_PART_ENTRY_UUID");
> + if (dev_uuid && !strcasecmp(dev_uuid, uuid)) {
> + outpath = udev_device_get_devnode(device);
> + return device;
> + }
> + }
> +
> + }
> + return NULL;
> +}
> +
>  /*
>   * of_get_devicepath - get information how to access device corresponding to 
> a device_node
>   * @partition_node:  The device_node which shall be accessed
> @@ -2443,11 +2489,29 @@ int of_get_devicepath(struct device_node 
> *partition_node, char **devpath, off_t
>   if (!strcmp(node->name, "partitions"))
>   node = node->parent;
>  
> - dev = of_find_device_by_node_path(node->full_name);
> - if (!dev) {
> - fprintf(stderr, "%s: cannot find device from node %s\n", 
> __func__,
> - node->full_name);
> - return -ENODEV;
> + if (of_device_is_compatible(node, "barebox,storage-by-uuid")) {
> + const char *uuid;
> +
> + ret = of_property_read_string(node, "uuid", );
> + if (ret) {
> + fprintf(stderr, "%s: missing uuid property for %s\n", 
> __func__,
> + node->full_name);
> + return -ENODEV;
> + }
> + dev = of_find_device_by_uuid(uuid);
> + if (!dev) {
> + fprintf(stderr, "%s: cannot find device for uuid %s\n", 
> __func__,
> + uuid);
> +     return -ENODEV;
> + }
> + }
> + else {
> + dev = of_find_device_by_node_path(node->full_name);
> + if (!dev) {
> + fprintf(stderr, "%s: cannot find device from node 
> %s\n", __func__,
> + node->full_name);
> + return -ENODEV;
> + }
>   }
>  
>   mtd = of_find_mtd_device(dev);
> -- 
> 2.30.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |



Re: [OSS-Tools] [PATCH 0/4] improve barebox-state support on EFI system

2022-02-05 Thread Roland Hieber
On Mon, Jan 24, 2022 at 12:21:39PM +0100, Michael Olbrich wrote:
> Hi,
> 
> This adds support for backend-diskuuid / backend-offset. The corresponding
> barebox patches can be found here:
> https://lore.barebox.org/barebox/20220124100458.2924679-1-m.olbr...@pengutronix.de/
> 
> The mount point for the ESP is quite standardized. So let barebox-state
> look there if nothing is found in sysfs/procfs. This way, barebox-state
> works on EFI without manually specifying the dtb file.
> 
> Michael
> 
> Michael Olbrich (4):
>   state: support deep probe
>   state: implement helper to find device path from diskuuid
>   state: support backend-diskuuid / backend-offset
>   state: automatically find state.dtb in the ESP

Thanks. Applied all of them to the 'next' branch, let me know if there
are any new comments on the barebox part of patch 3/4 that need adapting
to dt-utils.

 - Roland


-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2021-03-31 Thread Roland Hieber
On Wed, Mar 31, 2021 at 12:03:05PM +0200, Roland Hieber wrote:
> On Tue, Mar 30, 2021 at 07:31:24PM +0200, Ahmad Fatoum wrote:
> > If Zlib says "This notice may not be removed or altered from any
> > source distribution.", I interpret this as meaning that we need to ship
> > the full text as part of the source distribution and only a
> > SPDX-License-Identifier that can be looked up on a website somewhere doesn't
> > suffice.
> 
> Yes. Hmm. GPL says a similar thing in Clause 1 ("keep intact all the
> notices that refer to this License and to the absence of any warranty").
> When thinking about it, I'd rather keep the original comment headers
> intact and only add an SPDX license tag, and I don't understand why
> these notices were removed in Linux when Linux moved to SPDX
> identifiers. I also didn't find any reasoning on this.

Only this entry in the REUSE FAQ, which recommends to leave the
copyright notices intact.
https://reuse.software/faq/#edit-copyright-and-licensing

 - Roland

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2021-03-31 Thread Roland Hieber
On Tue, Mar 30, 2021 at 07:31:24PM +0200, Ahmad Fatoum wrote:
> Hello Roland,
> 
> On 30.03.21 17:53, Roland Hieber wrote:
> > On Tue, Mar 30, 2021 at 03:50:19PM +0200, Ahmad Fatoum wrote:
> >> Hello,
> >>
> >> On 30.03.21 15:30, Uwe Kleine-König wrote:
> >>> Hello,
> >>>
> >>> On Tue, Mar 30, 2021 at 01:22:26PM +0200, Ahmad Fatoum wrote:
> >>>> On 30.03.21 13:08, Roland Hieber wrote:
> >>>>> Uwe, could I get a Reviewed-by from you for these four patches? :-)
> >>>>
> >>>> We must still carry the full license texts in the project (cf. Linux
> >>>> LICENSES/). This is missing here, no?
> >>>
> >>> well, it depends on what you want to achieve. If you want to become SPDX
> >>> conformant this is indeed necessary. IMHO the conversion from several
> >>> different boilerplate license specifications to a single line is
> >>> beneficial even if the full licenses are not (yet) in the project.
> >>
> >> If the code says that the license terms need to be distributed along
> >> with the software, you are violating the license terms, if you don't
> >> abide by this. This is unrelated to SPDX-Conformance.
> > 
> > Nothing in the license headers or in the GPL or in the Zlib license says
> > that we have to distribute the license text along with the source code.
> > On the contrary, there are even some versions of GPL license headers
> > that have a clause "if you didn't a license text along with the
> > software, write to the FSF at $ADDRESS".

Apparently I was wrong about this, see GPL Clause 1.

> If Zlib says "This notice may not be removed or altered from any
> source distribution.", I interpret this as meaning that we need to ship
> the full text as part of the source distribution and only a
> SPDX-License-Identifier that can be looked up on a website somewhere doesn't
> suffice.

Yes. Hmm. GPL says a similar thing in Clause 1 ("keep intact all the
notices that refer to this License and to the absence of any warranty").
When thinking about it, I'd rather keep the original comment headers
intact and only add an SPDX license tag, and I don't understand why
these notices were removed in Linux when Linux moved to SPDX
identifiers. I also didn't find any reasoning on this.

 - Roland

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2021-03-30 Thread Roland Hieber
On Tue, Mar 30, 2021 at 03:50:19PM +0200, Ahmad Fatoum wrote:
> Hello,
> 
> On 30.03.21 15:30, Uwe Kleine-König wrote:
> > Hello,
> > 
> > On Tue, Mar 30, 2021 at 01:22:26PM +0200, Ahmad Fatoum wrote:
> >> On 30.03.21 13:08, Roland Hieber wrote:
> >>> Uwe, could I get a Reviewed-by from you for these four patches? :-)
> >>
> >> We must still carry the full license texts in the project (cf. Linux
> >> LICENSES/). This is missing here, no?
> > 
> > well, it depends on what you want to achieve. If you want to become SPDX
> > conformant this is indeed necessary. IMHO the conversion from several
> > different boilerplate license specifications to a single line is
> > beneficial even if the full licenses are not (yet) in the project.
> 
> If the code says that the license terms need to be distributed along
> with the software, you are violating the license terms, if you don't
> abide by this. This is unrelated to SPDX-Conformance.

Nothing in the license headers or in the GPL or in the Zlib license says
that we have to distribute the license text along with the source code.
On the contrary, there are even some versions of GPL license headers
that have a clause "if you didn't a license text along with the
software, write to the FSF at $ADDRESS".

But it is needed for REUSE [1] compliance, so I intend to move COPYING
into LICENSES/ nevertheless, and add the Zlib too. Thanks for catching
this.

[1]: https://reuse.software/

 - Roland

> > So I don't regret having given my Review-tags.
> 
> Reviewing is fine, but before applying license text removal, the full
> license texts need to be located in full somewhere in the source tree.
> 
> Cheers,
> Ahmad
> 
> > 
> > Best regards
> > Uwe
> > 
> 
> -- 
> Pengutronix e.K.   | |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2021-03-30 Thread Roland Hieber
Uwe, could I get a Reviewed-by from you for these four patches? :-)

 - Roland

On Fri, Mar 26, 2021 at 10:06:44PM +0100, Roland Hieber wrote:
> Signed-off-by: Roland Hieber 
> ---
>  sizes.h | 12 +---
>  src/barebox-state/state.c   | 11 +--
>  src/barebox-state/state_variables.c | 11 +--
>  src/base64.c|  3 +--
>  src/crypto/sha1.c   |  7 +--
>  src/crypto/sha2.c   |  7 +--
>  6 files changed, 6 insertions(+), 45 deletions(-)
> 
> diff --git a/sizes.h b/sizes.h
> index 6f91e9b4bd23..a73bb87e4b5b 100644
> --- a/sizes.h
> +++ b/sizes.h
> @@ -1,14 +1,4 @@
> -/*
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
> - * GNU General Public License for more details.
> - */
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>  /*  Size defintions
>   *  Copyright (C) ARM Limited 1998. All rights reserved.
>   */
> diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
> index f528b3e19f21..e3825d6aeab2 100644
> --- a/src/barebox-state/state.c
> +++ b/src/barebox-state/state.c
> @@ -1,17 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>  /*
>   * Copyright (C) 2012-2014 Pengutronix, Jan Luebbe 
>   * Copyright (C) 2013-2014 Pengutronix, Sascha Hauer 
>   * Copyright (C) 2015 Pengutronix, Marc Kleine-Budde 
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
>   */
>  
>  #include 
> diff --git a/src/barebox-state/state_variables.c 
> b/src/barebox-state/state_variables.c
> index 16f630f57f9f..429f1f0a3479 100644
> --- a/src/barebox-state/state_variables.c
> +++ b/src/barebox-state/state_variables.c
> @@ -1,17 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>  /*
>   * Copyright (C) 2012-2014 Pengutronix, Jan Luebbe 
>   * Copyright (C) 2013-2014 Pengutronix, Sascha Hauer 
>   * Copyright (C) 2015 Pengutronix, Marc Kleine-Budde 
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
>   */
>  
>  #include 
> diff --git a/src/base64.c b/src/base64.c
> index 6c02174d6377..5c7f9e884965 100644
> --- a/src/base64.c
> +++ b/src/base64.c
> @@ -1,11 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>  /*
>   * Code based on busybox-1.23.2
>   *
>   * Copyright 2003, Glenn McGrath
>   * Copyright 2006, Rob Landley 
>   * Copyright 2010, Denys Vlasenko
> - *
> - * Licensed under GPLv2 or later, see file LICENSE in this tarball for 
> details.
>   */
>  
>  #include 
> diff --git a/src/crypto/sha1.c b/src/crypto/sha1.c
> index cbde4d28e475..a66f4f2505d2 100644
> --- a/src/crypto/sha1.c
> +++ b/src/crypto/sha1.c
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>  /*
>   * Cryptographic API.
>   *
> @@ -9,12 +10,6 @@
>   * Copyright (c) Alan Smithee.
>   * Copyright (c) Andrew McDonald 
>   * Copyright (c) Jean-Francois Dive 
> - *
> - * This program is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License as published by the Free
> - * Software Foundation; either version 2 of the License, or (at your option)
> - * any later version.
> - *
>   */
>  
>  #include 
> diff --git a/src/crypto/sha2.c b/src/crypto/sha2.c
> index cb0f11c77ea0..4b3da0c9d230 100644
>

[OSS-Tools] [dt-utils] Release 2021.03.0

2021-03-26 Thread Roland Hieber
Hi,

after a much too long time (sorry for this), I've just release dt-utils
version 2021.03.0. You can download it at the usual location:

https://public.pengutronix.de/software/dt-utils/dt-utils-2021.03.0.tar.xz

The file checksums are as follows:

* MD5:acf0b5e3b18e40e6172b67fbad2e52fb
* SHA1:   d505643ff8c690bde8e89be81b2718e6cbf2eace
* SHA256: 36a56924e356250988315cd8761fde52832e6d4934323aca2827ff93fa12907f

This release includes contributions from Ahmad Fatoum, Andrey Smirnov,
Enrico Jorns, Jan Luebbe, Jan Remmet, Jookia, Juergen Borleis, Kim
Christensen, Lucas Stach, Roland Hieber, Sascha Hauer, Stefan Agner,
Steffen Trumtrar, Ulrich Ölmann, Uwe Kleine-König and Xogium. Thanks to
all contributors!

Possibly breaking changes
-

* commit a6ca873a368d "Don't install a pkg-config file for libdt"
  libdt isn't supposed to be installed as a system library as nobody
  wants to care about things like a stable API. Also the generated .pc
  file was completely bogus as it added "-labc" to the linker instead of
  -ldt-utils.

* commit 2dbca4c3284b "state: keep backward compatibility"
  This changes barebox-state's default behaviour.
  Previous variants of the state variable set did not contain metadata.
  The read function in the 'direct' storage backend honors this, but the
  write function doesn't, which makes an update of the state variable
  set impossible.
  This commit introduces the new compile time option
  '--enable-state-backward-compatibility' to ./configure, which is
  disabled by default. If this compile time option is enabled,
  barebox-state will keep the storage in a format that can be read by
  barebox <= v2016.08.0 when writing variables into a 'direct' storage
  backend, or fail if this requirement cannot be guaranteed.

* commit d1e4783c0051 "follow the Developer's Certificate of Origin",
  commit 886f13aa31a6 "Makefile: add ./DCO to the dist tarball"
  (see files README and DCO)

New features


* libdt:
  - commit af85ab844b1d "libdt: support finding devices by partuuid",
commit 9f3915824bc7 "libdt: support upper-case hexadecimals in value
of partuuid property"
This allows specifying partitions in devicetree that are actually
not described in the devicetree to allow referencing them, e.g.:
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
state_part: state {
partuuid = "21367da7-c51f-499f-9aad-e1f366992365";
};
};
  - commit 4826dcbce749 "libdt: enumerate amba bus as well"
Make barebox-state usable on STM32MP1, which probes the SD/MMC host
controller over amba, not the platform bus as most other ARM
systems.

* barebox-state:
  - add new options --quiet, --force, and --version
. commit 52221e50b0df "barebox-state: complete cmdline options"
. commit 15786485ab8b "barebox-state: add cmdline option "--version""
  - commit 74cd46affa37 "barebox-state: get devicetree from file"
Adds an -i/--input argument to barebox-state to allow passing a
devicetree as a file instead of using it from the system. This can
be used for example on systems that do not use device trees (such as
x86) but where we want to use a dtb blob for describing the state
storage and format.
  - commit 0a75604bc61f "barebox-state: have the --set option to avoid
writes if possible"
Previously, barebox-state --set would always dirty the state when
successful. Users seeking to conserve write cycles thus have to
--get the variable in question first to check whether to write it.
Make life of such users easier by having barebox-state support this
out-of-the-box.

* dtblint:
  - commit 38d7af00e6cb "dtblint: check reset-gpio-active-high +
reset-gpio for matching polarity"
  - commit 8498644efe82 "dtblint: add support for fsl,imx6dl-iomuxc"
  - commit a75ea34157c5 "dtblint: fsl,iomuxc: improve check for reserved
bits"

Bug Fixes
-

* barebox-state:
  - commit 99918b8f3ad2 "barebox-state: fix usage of multiple state
instances"
This makes concurrent calls to barebox-state with the following
syntax possible:
$ barebox-state --get blue.x &
$ barebox-state --get yellow.y &
  - commit 634317cc9120 "state: backend_bucket_circular: fix double
free()"
  - commit ef73553a "state: Fix lseek error check in
state_backend_bucket_direct_read()"
  - commit d59af7f22ab4 "state: Fix lseek error check in
state_backend_bucket_direct_write()"
  - commit f234f3ec9498 "state: Fix lseek error check in
state_mtd_peb_read()"
  - commit b85142e1cbd4 "state: Fix lseek error check in
state_mtd

[OSS-Tools] [PATCH dt-utils 2/4] treewide: add SPDX identifiers to files with GPL-2.0-only license

2021-03-26 Thread Roland Hieber
Signed-off-by: Roland Hieber 
---
 src/barebox-state.c | 10 +-
 src/barebox-state/backend_bucket_circular.c | 11 +--
 src/barebox-state/backend_bucket_direct.c   | 11 +--
 src/barebox-state/backend_format_dtb.c  | 11 +--
 src/barebox-state/backend_format_raw.c  | 11 +--
 src/barebox-state/backend_storage.c | 11 +--
 src/crypto/digest.c | 12 +---
 src/crypto/hmac.c   |  3 +--
 src/crypto/internal.h   |  3 +--
 src/crypto/keystore.h   | 12 +---
 src/digest.h| 12 +---
 src/dtblint-imx-pinmux.c|  5 +
 src/dtblint.c   |  5 +
 src/fdt.c   | 10 +-
 src/keystore-blob.c |  5 +
 src/libdt.c | 10 +-
 16 files changed, 16 insertions(+), 126 deletions(-)

diff --git a/src/barebox-state.c b/src/barebox-state.c
index 334aed6f3d43..d96fe02f1f53 100644
--- a/src/barebox-state.c
+++ b/src/barebox-state.c
@@ -1,16 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * state.c - state handling tool
  *
  * Copyright (c) 2014 Sascha Hauer , Pengutronix
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include 
diff --git a/src/barebox-state/backend_bucket_circular.c 
b/src/barebox-state/backend_bucket_circular.c
index 735510e0d36b..bab001534aa1 100644
--- a/src/barebox-state/backend_bucket_circular.c
+++ b/src/barebox-state/backend_bucket_circular.c
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2016 Pengutronix, Markus Pargmann 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #include 
diff --git a/src/barebox-state/backend_bucket_direct.c 
b/src/barebox-state/backend_bucket_direct.c
index 4522f0170f3d..1d930396ea4c 100644
--- a/src/barebox-state/backend_bucket_direct.c
+++ b/src/barebox-state/backend_bucket_direct.c
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2016 Pengutronix, Markus Pargmann 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #include 
diff --git a/src/barebox-state/backend_format_dtb.c 
b/src/barebox-state/backend_format_dtb.c
index 48f30db1f5f9..a078f528f6ef 100644
--- a/src/barebox-state/backend_format_dtb.c
+++ b/src/barebox-state/backend_format_dtb.c
@@ -1,18 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2012-2014 Pengutronix, Jan Luebbe 
  * Copyright (C) 2013-2014 Pengutronix, Sascha Hauer 
  * Copyright (C) 2015 Pengutronix, Marc Kleine-Budde 
  * Copyright (C) 2016 Pengutronix, Markus Pargmann 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #include 
diff --git a/src/barebox-state/backend_format_raw.c 
b/src/barebox-state/backend_format_raw.c
index 5a71149d3443..16815155d00d 100644
--- a/src/barebox-state/backend_format_raw.c
+++ b/src/barebox-state/backend_format_raw.c
@@ -1,18 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2012-2014 Pengutronix, Jan Luebbe 
  * Copyright (C) 2013-2014 Pengutronix, Sascha Hauer 
  * Copyright (C) 2015 Pengutronix, Marc Kleine-Budde 
  * Copyright (C) 2016 Pengutronix, Markus Pargmann 
- *
- * This program is free software

[OSS-Tools] [PATCH dt-utils 3/4] treewide: add SPDX identifier to files with Zlib license

2021-03-26 Thread Roland Hieber
Signed-off-by: Roland Hieber 
---
 src/crc32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/crc32.c b/src/crc32.c
index 8d4dddcf6129..6d534c996050 100644
--- a/src/crc32.c
+++ b/src/crc32.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: Zlib */
 /*
  * This file is derived from crc32.c from the zlib-1.1.3 distribution
  * by Jean-loup Gailly and Mark Adler.
@@ -5,7 +6,6 @@
 
 /* crc32.c -- compute the CRC-32 of a data stream
  * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
 #include 
-- 
2.29.2


___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


[OSS-Tools] [PATCH dt-utils 1/4] treewide: add SPDX identifiers to files with GPL-2.0-or-later license

2021-03-26 Thread Roland Hieber
Signed-off-by: Roland Hieber 
---
 sizes.h | 12 +---
 src/barebox-state/state.c   | 11 +--
 src/barebox-state/state_variables.c | 11 +--
 src/base64.c|  3 +--
 src/crypto/sha1.c   |  7 +--
 src/crypto/sha2.c   |  7 +--
 6 files changed, 6 insertions(+), 45 deletions(-)

diff --git a/sizes.h b/sizes.h
index 6f91e9b4bd23..a73bb87e4b5b 100644
--- a/sizes.h
+++ b/sizes.h
@@ -1,14 +1,4 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*  Size defintions
  *  Copyright (C) ARM Limited 1998. All rights reserved.
  */
diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
index f528b3e19f21..e3825d6aeab2 100644
--- a/src/barebox-state/state.c
+++ b/src/barebox-state/state.c
@@ -1,17 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2012-2014 Pengutronix, Jan Luebbe 
  * Copyright (C) 2013-2014 Pengutronix, Sascha Hauer 
  * Copyright (C) 2015 Pengutronix, Marc Kleine-Budde 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include 
diff --git a/src/barebox-state/state_variables.c 
b/src/barebox-state/state_variables.c
index 16f630f57f9f..429f1f0a3479 100644
--- a/src/barebox-state/state_variables.c
+++ b/src/barebox-state/state_variables.c
@@ -1,17 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2012-2014 Pengutronix, Jan Luebbe 
  * Copyright (C) 2013-2014 Pengutronix, Sascha Hauer 
  * Copyright (C) 2015 Pengutronix, Marc Kleine-Budde 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include 
diff --git a/src/base64.c b/src/base64.c
index 6c02174d6377..5c7f9e884965 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -1,11 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Code based on busybox-1.23.2
  *
  * Copyright 2003, Glenn McGrath
  * Copyright 2006, Rob Landley 
  * Copyright 2010, Denys Vlasenko
- *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
 #include 
diff --git a/src/crypto/sha1.c b/src/crypto/sha1.c
index cbde4d28e475..a66f4f2505d2 100644
--- a/src/crypto/sha1.c
+++ b/src/crypto/sha1.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Cryptographic API.
  *
@@ -9,12 +10,6 @@
  * Copyright (c) Alan Smithee.
  * Copyright (c) Andrew McDonald 
  * Copyright (c) Jean-Francois Dive 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
  */
 
 #include 
diff --git a/src/crypto/sha2.c b/src/crypto/sha2.c
index cb0f11c77ea0..4b3da0c9d230 100644
--- a/src/crypto/sha2.c
+++ b/src/crypto/sha2.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Cryptographic API.
  *
@@ -10,12 +11,6 @@
  * Copyright (c) Andrew McDonald 
  * Copyright (c) 2002 James Morris 
  * SHA224 Support Copyright 2007 Intel Corporation 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
  */
 
 #include 
-- 
2.29.2


___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


[OSS-Tools] [PATCH dt-utils 4/4] treewide: add SPDX identifiers to files without license

2021-03-26 Thread Roland Hieber
The project license has been GPL-2.0-only since commit
2b39a389428224d96bbb (2014-11-27, Sascha Hauer: "COPYING: Change to
GPLv2"). Reflect this in the file headers.

Signed-off-by: Roland Hieber 
---
 Makefile.am | 2 ++
 NEWS| 2 ++
 README  | 2 ++
 autogen.sh  | 1 +
 configure.ac| 2 ++
 scripts/barebox-mark-successful-boot.sh | 1 +
 src/barebox-state.h | 2 ++
 src/barebox-state/state.h   | 2 ++
 src/base64.h| 2 ++
 src/crypto/sha.h| 1 +
 src/dt/common.h | 2 ++
 src/dt/dt.h | 2 ++
 src/dt/fdt.h| 2 ++
 src/dt/list.h   | 2 ++
 src/dtblint.h   | 1 +
 src/fdt.h   | 2 ++
 src/fdtdump.c   | 2 ++
 src/fs.h| 2 ++
 src/libbb.h | 2 ++
 src/linux/list.h| 1 +
 src/linux/mtd/mtd-abi.h | 1 +
 src/of.h| 1 +
 src/printk.h| 1 +
 src/state.h | 1 +
 24 files changed, 39 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index d3077317ce9a..960ac4902af5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 EXTRA_DIST = DCO
 CLEANFILES =
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
diff --git a/NEWS b/NEWS
index e27f5efe20ac..fa169f9498d6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 dt-utils 2021.03.0
 ==
 
diff --git a/README b/README
index 20c9e3484ed2..c56f4c549d0a 100644
--- a/README
+++ b/README
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 Utilities to work with device trees in Linux userspace
 
 The following tools are available:
diff --git a/autogen.sh b/autogen.sh
index 0d60b0a96e9a..0c0353a20edd 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,4 +1,5 @@
 #!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0-only
 
 if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
 cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
diff --git a/configure.ac b/configure.ac
index 16cbbd075321..87668587ad40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 AC_PREREQ(2.60)
 AC_INIT([dt-utils],
 [2021.03.0],
diff --git a/scripts/barebox-mark-successful-boot.sh 
b/scripts/barebox-mark-successful-boot.sh
index 3120f57450fa..8aecabfc1912 100644
--- a/scripts/barebox-mark-successful-boot.sh
+++ b/scripts/barebox-mark-successful-boot.sh
@@ -1,4 +1,5 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
 
 DEFAULT_REMAINING_ATTEMPTS=3
 DEFAULT_PRIORITY=20
diff --git a/src/barebox-state.h b/src/barebox-state.h
index a0f49a549649..d007fc4ea191 100644
--- a/src/barebox-state.h
+++ b/src/barebox-state.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #ifndef __BAREBOX_STATE__
 #define __BAREBOX_STATE__
 
diff --git a/src/barebox-state/state.h b/src/barebox-state/state.h
index 912d6d484823..47d8442f184e 100644
--- a/src/barebox-state/state.h
+++ b/src/barebox-state/state.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #include 
 #include 
 #include 
diff --git a/src/base64.h b/src/base64.h
index 6ce0885822da..e0bbe4baa819 100644
--- a/src/base64.h
+++ b/src/base64.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #ifndef __BASE64_H
 #define __BASE64_H
 
diff --git a/src/crypto/sha.h b/src/crypto/sha.h
index 190f8a0e0242..355bb76171c8 100644
--- a/src/crypto/sha.h
+++ b/src/crypto/sha.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Common values for SHA algorithms
  */
diff --git a/src/dt/common.h b/src/dt/common.h
index c3c4f53fc216..3efe43b5cd5a 100644
--- a/src/dt/common.h
+++ b/src/dt/common.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #ifndef __DT_COMMON_H
 #define __DT_COMMON_H
 
diff --git a/src/dt/dt.h b/src/dt/dt.h
index 4ae24ba8bf7a..2fbb4e0f8059 100644
--- a/src/dt/dt.h
+++ b/src/dt/dt.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #ifndef __DT_DT_H
 #define __DT_DT_H
 
diff --git a/src/dt/fdt.h b/src/dt/fdt.h
index 35278e30304b..cfa153077a32 100644
--- a/src/dt/fdt.h
+++ b/src/dt/fdt.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #ifndef _FDT_H
 #define _FDT_H
 
diff --git a/src/dt/list.h b/src/dt/list.h
index c17b5d4b9ba1..87c5e1cb3a23 100644
--- a/src/dt/list.h
+++ b/src/dt/list.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
 #ifndef _LINUX_LIST_H
 #define _LINUX_LIST_H
 
diff --git a/src/dtblint.h b/src/dtblint.h
index 4efd5865a988..896bfe8ba9f5 100644
-

Re: [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile

2021-03-16 Thread Roland Hieber
On Fri, Nov 13, 2020 at 10:42:33AM +0100, Stefan Agner wrote:
> The current location /var/lock is considered legacy (at least by
> systemd). Just use /run to store the lockfile and append the usual .lock
> suffix.
> 
> Signed-off-by: Stefan Agner 
> ---
>  src/barebox-state.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Thanks! This one was the only one of the three that git-am would take,
and I also applied Ahmad's Tested-by from the other thread.

 - Roland

> 
> diff --git a/src/barebox-state.c b/src/barebox-state.c
> index 946a8db..16a8c9f 100644
> --- a/src/barebox-state.c
> +++ b/src/barebox-state.c
> @@ -38,6 +38,8 @@
>  #include 
>  #include 
>  
> +#define BAREBOX_STATE_LOCKFILE "/run/barebox-state.lock"
> +
>  struct state_variable;
>  
>  static int __state_uint8_set(struct state_variable *var, const char *val);
> @@ -505,15 +507,15 @@ int main(int argc, char *argv[])
>   ++nr_states;
>   }
>  
> - lock_fd = open("/var/lock/barebox-state", O_CREAT | O_RDWR, 0600);
> + lock_fd = open(BAREBOX_STATE_LOCKFILE, O_CREAT | O_RDWR, 0600);
>   if (lock_fd < 0) {
> - pr_err("Failed to open lock-file /var/lock/barebox-state\n");
> + pr_err("Failed to open lock-file " BAREBOX_STATE_LOCKFILE "\n");
>   exit(1);
>   }
>  
>   ret = flock(lock_fd, LOCK_EX);
>   if (ret < 0) {
> - pr_err("Failed to lock /var/lock/barebox-state: %m\n");
> + pr_err("Failed to lock " BAREBOX_STATE_LOCKFILE ": %m\n");
>   close(lock_fd);
>   exit(1);
>   }
> -- 
> 2.29.2
> 
> 
> ___
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH v2] barebox-state: have the --set option to avoid writes if possible

2021-03-16 Thread Roland Hieber
On Fri, Nov 13, 2020 at 08:08:56PM +0100, Ahmad Fatoum wrote:
> barebox-state --set always dirties the state when successful. Users
> seeking to conserve write cycles thus have to --get the variable in
> question first to check whether to write it. Make life of such users
> easier by having barebox-state support this out-of-the-box.
> 
> This allows users to fire and forget execute barebox-state.
> 
> This arguably should have been the behavior from the beginning,
> the state implementation shared by barebox and dt-utils already
> marks the state dirty if buckets appear corrupted on probe, so
> there is no extra benefit in always executing the write.
> 
> The comparison to determine whether the state should be dirtied
> does an extra allocation in interest of clarity.
> This overhead is deemed negligible compared to I/O and it makes
> the code easier to follow.
> 
> Suggested-by: Jan Lübbe 
> Signed-off-by: Ahmad Fatoum 
> ---
> v1 -> v2:
>   - incorporate Jan's (off-list) suggestion to just change --set
> behavior. state implementation already dirties state if a
> bucket is corrupt, so there is really no valid use case for
> not conserving writes by default.
> ---
>  src/barebox-state.c | 9 +
>  1 file changed, 9 insertions(+)

Thanks, applied.

 - Roland

> 
> diff --git a/src/barebox-state.c b/src/barebox-state.c
> index cd56ce7192c3..7b5c0dae00dd 100644
> --- a/src/barebox-state.c
> +++ b/src/barebox-state.c
> @@ -283,6 +283,7 @@ static int state_set_var(struct state *state, const char 
> *var, const char *val)
>  {
>   struct state_variable *sv;
>   struct variable_str_type *vtype;
> + char *oldval;
>   int ret;
>  
>   sv = state_find_var(state, var);
> @@ -296,6 +297,14 @@ static int state_set_var(struct state *state, const char 
> *var, const char *val)
>   if (!vtype->set)
>   return -EPERM;
>  
> + oldval = vtype->get(sv);
> + if (!IS_ERR(oldval)) {
> + bool equal = strcmp(oldval, val) == 0;
> + free(oldval);
> + if (equal)
> + return 0;
> + }
> +
>   ret = vtype->set(sv, val);
>   if (ret)
>   return ret;
> -- 
> 2.28.0
> 
> 
> ___
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH] libdt: enumerate amba bus as well

2021-03-16 Thread Roland Hieber
On Wed, Feb 10, 2021 at 10:31:44AM +0100, Jan Lübbe wrote:
> On Thu, 2020-10-08 at 17:09 +0200, Ahmad Fatoum wrote:
> > The STM32MP1 probes the SD/MMC host controller over amba, not
> > the platform bus as most other ARM systems. Enumerate amba as well,
> > so we can use barebox-state on that SoC.
> > 
> > Reported-by: Jookia 
> > Tested-by: Xogium 
> > Signed-off-by: Ahmad Fatoum 
> 
> Works on my STM32MP1DK2.
> 
> Tested-by: Jan Luebbe 

Thanks, applied.

 - Roland

> 
> > ---
> >  src/libdt.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/libdt.c b/src/libdt.c
> > index 01f0a6941aa2..342313f8aed7 100644
> > --- a/src/libdt.c
> > +++ b/src/libdt.c
> > @@ -2057,6 +2057,7 @@ static void of_scan_udev_devices(void)
> >     udev_enumerate_add_match_subsystem(enumerate, "i2c");
> >     udev_enumerate_add_match_subsystem(enumerate, "spi");
> >     udev_enumerate_add_match_subsystem(enumerate, "mtd");
> > +   udev_enumerate_add_match_subsystem(enumerate, "amba");
> >     udev_enumerate_scan_devices(enumerate);
> >     devices = udev_enumerate_get_list_entry(enumerate);
> >  
> > 
> > 
> > 
> 
> -- 
> Pengutronix e.K.   | |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany      | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 
> 
> ___
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils v5 0/2] barebox-state: get devicetree from file

2021-03-16 Thread Roland Hieber
On Thu, Oct 24, 2019 at 04:24:49PM +0200, Ahmad Fatoum wrote:
> For use on systems that don't normally have a device tree, like x86,
> it would be nice to be able to pass barebox_state the path to a device
> tree blob directly, which is what this patch set does.
> 
> Cheers
> Ahmad
> 
> Changes in v5:
>   - Rebased onto current master
>   - Added commit to handle non-lower-case partuuids
>   - Fixed use after free by not allocating dynamic memory
>   
> Ahmad Fatoum (1):
>   libdt: support upper-case hexadecimals in value of partuuid property
> 
> Steffen Trumtrar (1):
>   barebox-state: get devicetree from file

Thanks, applied.

 - Roland

> 
>  src/barebox-state.c | 41 +
>  src/barebox-state.h |  2 +-
>  src/keystore-blob.c |  2 +-
>  src/libdt.c | 12 +++-
>  4 files changed, 46 insertions(+), 11 deletions(-)
> 
> -- 
> 2.23.0
> 
> 
> _______
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils v5 0/2] barebox-state: get devicetree from file

2020-07-09 Thread Roland Hieber
On Thu, Jul 09, 2020 at 03:20:02PM +0200, Ahmad Fatoum wrote:
> On 10/24/19 4:24 PM, Ahmad Fatoum wrote:
> > For use on systems that don't normally have a device tree, like x86,
> > it would be nice to be able to pass barebox_state the path to a device
> > tree blob directly, which is what this patch set does.
> 
> Gentle ping.

Yes, sorry. It's planned for next week.

> > Cheers
> > Ahmad
> > 
> > Changes in v5:
> >   - Rebased onto current master
> >   - Added commit to handle non-lower-case partuuids
> >   - Fixed use after free by not allocating dynamic memory
> > 
> > Ahmad Fatoum (1):
> >   libdt: support upper-case hexadecimals in value of partuuid property
> > 
> > Steffen Trumtrar (1):
> >   barebox-state: get devicetree from file
> > 
> >  src/barebox-state.c | 41 +
> >  src/barebox-state.h |  2 +-
> >  src/keystore-blob.c |  2 +-
> >  src/libdt.c | 12 +++-
> >  4 files changed, 46 insertions(+), 11 deletions(-)
> > 
> 
> -- 
> Pengutronix e.K.   | |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 
> ___
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de
> 

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils] barebox-mark-successful-boot: adopt naming from barebox

2020-01-19 Thread Roland Hieber
On Fri, Dec 13, 2019 at 01:23:55PM +0100, Christoph Fritz wrote:
> On Thu, 2019-12-12 at 13:07 +0100, Roland Hieber wrote:
> > On Thu, Dec 12, 2019 at 12:50:19PM +0100, Roland Hieber wrote:
> > > On Wed, Dec 11, 2019 at 12:25:11PM +0100, Enrico Joerns wrote:
> > > > On 11/16/19 1:44 PM, Christoph Fritz wrote:
> > > > > This patch is adopting current barebox default naming scheme.
> > > > > 
> > > > > Signed-off-by: Christoph Fritz 
> > > > > ---
> > > > >   scripts/barebox-mark-successful-boot.sh | 4 ++--
> > > > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/scripts/barebox-mark-successful-boot.sh 
> > > > > b/scripts/barebox-mark-successful-boot.sh
> > > > > index 3120f57..9286a63 100644
> > > > > --- a/scripts/barebox-mark-successful-boot.sh
> > > > > +++ b/scripts/barebox-mark-successful-boot.sh
> > > > > @@ -3,12 +3,12 @@
> > > > >   DEFAULT_REMAINING_ATTEMPTS=3
> > > > >   DEFAULT_PRIORITY=20
> > > > > -system=$(sed /proc/cmdline -ne "s/\(^\|.* \)bootstate.active=\([^ 
> > > > > ]*\).*/\2/p")
> > > > > +system=$(sed /proc/cmdline -ne "s/\(^\|.* \)bootchooser.active=\([^ 
> > > > > ]*\).*/\2/p")
> > > > >   if [ -z "${system}" ]; then
> > > > >   echo "unable to detect system partition" >&2
> > > > >   exit 1
> > > > >   fi
> > > > > -barebox-state -n /state \
> > > > > +barebox-state -n state \
> > > > >   -s 
> > > > > "bootstate.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}"
> > > > >  \
> > > > >   -s "bootstate.${system}.priority=${DEFAULT_PRIORITY}"
> > > > > 
> > > > 
> > > > Thanks for your patch, I didn't even remember that we have a script for 
> > > > this ;)
> > > > 
> > > > For me, the changes look reasonable. Any concerns? Roland?
> > > 
> > > Hmm. My barebox 2019.06.0 here still passes the parameter as
> > > "bootstate.active=system0", and I cannot find any commit in barebox
> > > since then that changes this. Can you point me to a commit?
> > 
> > Sorry, that was a barebox version which was heavily patched for
> > backwards compatibility with old kernels and userlands :-/ 
> > 
> > > In any case, we should be compatible to old barebox versions, so both
> > > versions of the parameter name should be accepted.
> > 
> > However this is still the best option I think.
> 
> So in the script you want to check the return value of barebox-state and
> call it with the old parameters to be backward compatible?

Sorry, this one got lost during christmas holidays… Yes, right, that's
what I was thinking of:

-barebox-state -n /state \ 
- -s "bootstate.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}" 
\
- -s "bootstate.${system}.priority=${DEFAULT_PRIORITY}"
+ if ! barebox-state -n state \  
+  -s 
"bootchooser.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}" \
+  -s "bootchooser.${system}.priority=${DEFAULT_PRIORITY}"
+ then
+ barebox-state -n state \
+ -s 
"bootstate.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}" \
+ -s "bootstate.${system}.priority=${DEFAULT_PRIORITY}"
+ fi

(Also I cannot remember right now whether '-s /state' or '-s state'
makes a difference...)

 - Roland

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils] barebox-mark-successful-boot: adopt naming from barebox

2019-12-12 Thread Roland Hieber
On Thu, Dec 12, 2019 at 12:50:19PM +0100, Roland Hieber wrote:
> On Wed, Dec 11, 2019 at 12:25:11PM +0100, Enrico Joerns wrote:
> > On 11/16/19 1:44 PM, Christoph Fritz wrote:
> > > This patch is adopting current barebox default naming scheme.
> > > 
> > > Signed-off-by: Christoph Fritz 
> > > ---
> > >   scripts/barebox-mark-successful-boot.sh | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/scripts/barebox-mark-successful-boot.sh 
> > > b/scripts/barebox-mark-successful-boot.sh
> > > index 3120f57..9286a63 100644
> > > --- a/scripts/barebox-mark-successful-boot.sh
> > > +++ b/scripts/barebox-mark-successful-boot.sh
> > > @@ -3,12 +3,12 @@
> > >   DEFAULT_REMAINING_ATTEMPTS=3
> > >   DEFAULT_PRIORITY=20
> > > -system=$(sed /proc/cmdline -ne "s/\(^\|.* \)bootstate.active=\([^ 
> > > ]*\).*/\2/p")
> > > +system=$(sed /proc/cmdline -ne "s/\(^\|.* \)bootchooser.active=\([^ 
> > > ]*\).*/\2/p")
> > >   if [ -z "${system}" ]; then
> > >   echo "unable to detect system partition" >&2
> > >   exit 1
> > >   fi
> > > -barebox-state -n /state \
> > > +barebox-state -n state \
> > >   -s 
> > > "bootstate.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}" \
> > >   -s "bootstate.${system}.priority=${DEFAULT_PRIORITY}"
> > > 
> > 
> > Thanks for your patch, I didn't even remember that we have a script for 
> > this ;)
> > 
> > For me, the changes look reasonable. Any concerns? Roland?
> 
> Hmm. My barebox 2019.06.0 here still passes the parameter as
> "bootstate.active=system0", and I cannot find any commit in barebox
> since then that changes this. Can you point me to a commit?

Sorry, that was a barebox version which was heavily patched for
backwards compatibility with old kernels and userlands :-/ 

> In any case, we should be compatible to old barebox versions, so both
> versions of the parameter name should be accepted.

However this is still the best option I think.

 - Roland
 
-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils] barebox-mark-successful-boot: adopt naming from barebox

2019-12-12 Thread Roland Hieber
On Wed, Dec 11, 2019 at 12:25:11PM +0100, Enrico Joerns wrote:
> On 11/16/19 1:44 PM, Christoph Fritz wrote:
> > This patch is adopting current barebox default naming scheme.
> > 
> > Signed-off-by: Christoph Fritz 
> > ---
> >   scripts/barebox-mark-successful-boot.sh | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/scripts/barebox-mark-successful-boot.sh 
> > b/scripts/barebox-mark-successful-boot.sh
> > index 3120f57..9286a63 100644
> > --- a/scripts/barebox-mark-successful-boot.sh
> > +++ b/scripts/barebox-mark-successful-boot.sh
> > @@ -3,12 +3,12 @@
> >   DEFAULT_REMAINING_ATTEMPTS=3
> >   DEFAULT_PRIORITY=20
> > -system=$(sed /proc/cmdline -ne "s/\(^\|.* \)bootstate.active=\([^ 
> > ]*\).*/\2/p")
> > +system=$(sed /proc/cmdline -ne "s/\(^\|.* \)bootchooser.active=\([^ 
> > ]*\).*/\2/p")
> >   if [ -z "${system}" ]; then
> > echo "unable to detect system partition" >&2
> > exit 1
> >   fi
> > -barebox-state -n /state \
> > +barebox-state -n state \
> > -s 
> > "bootstate.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}" \
> > -s "bootstate.${system}.priority=${DEFAULT_PRIORITY}"
> > 
> 
> Thanks for your patch, I didn't even remember that we have a script for this 
> ;)
> 
> For me, the changes look reasonable. Any concerns? Roland?

Hmm. My barebox 2019.06.0 here still passes the parameter as
"bootstate.active=system0", and I cannot find any commit in barebox
since then that changes this. Can you point me to a commit?

In any case, we should be compatible to old barebox versions, so both
versions of the parameter name should be accepted.

 - Roland

-- 
Roland Hieber, Pengutronix e.K.  | r.hie...@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany| Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils 08/13] state: keep backward compatibility

2019-10-22 Thread Roland Hieber
te/backend_bucket_direct.c
> index 5b5506be002e..4522f0170f3d 100644
> --- a/src/barebox-state/backend_bucket_direct.c
> +++ b/src/barebox-state/backend_bucket_direct.c
> @@ -75,6 +75,11 @@ static int state_backend_bucket_direct_read(struct 
> state_backend_storage_bucket
>   } else {
>   if (meta.magic != ~0 && !!meta.magic)
>   bucket->wrong_magic = 1;
> + if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) {
> + dev_err(direct->dev, "No meta data header found\n");
> + dev_dbg(direct->dev, "Enable backward compatibility or 
> increase stride size\n");
> + return -EINVAL;
> + }
>   read_len = direct->max_size;
>   if (lseek(direct->fd, direct->offset, SEEK_SET) !=
>   direct->offset) {
> @@ -110,20 +115,25 @@ static int state_backend_bucket_direct_write(struct 
> state_backend_storage_bucket
>   int ret;
>   struct state_backend_storage_bucket_direct_meta meta;
>  
> - if (len > direct->max_size - sizeof(meta))
> - return -E2BIG;
> -
>   if (lseek(direct->fd, direct->offset, SEEK_SET) != direct->offset) {
>   dev_err(direct->dev, "Failed to seek file, %d\n", -errno);
>   return -errno;
>   }
>  
> - meta.magic = direct_magic;
> - meta.written_length = len;
> - ret = write_full(direct->fd, , sizeof(meta));
> - if (ret < 0) {
> - dev_err(direct->dev, "Failed to write metadata to file, %d\n", 
> ret);
> - return ret;
> + /* write the meta data only if there is head room */
> + if (len <= direct->max_size - sizeof(meta)) {
> + meta.magic = direct_magic;
> + meta.written_length = len;
> + ret = write_full(direct->fd, , sizeof(meta));
> +     if (ret < 0) {
> + dev_err(direct->dev, "Failed to write metadata to file, 
> %d\n", ret);
> + return ret;
> + }
> + } else {
> + if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) {
> + dev_dbg(direct->dev, "Too small stride size: must skip 
> metadata! Increase stride size\n");
> + return -EINVAL;
> + }
>   }
>  
>   ret = write_full(direct->fd, buf, len);
> -- 
> 2.23.0
> 
> 
> ___
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de

-- 
Roland Hieber | r.hie...@pengutronix.de |
Pengutronix e.K.  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils] state: backend_bucket_circular: fix double free()

2019-09-23 Thread Roland Hieber
On Thu, Sep 19, 2019 at 07:16:03AM +0200, Ulrich Ölmann wrote:
> On Wed, Sep 18 2019 at 22:23 +0200, Uwe Kleine-König 
>  wrote:
> > On Wed, Sep 18, 2019 at 04:48:23PM +0200, Ulrich Ölmann wrote:
> >> From: Kim Christensen 
> >>
> >> The function state_mtd_peb_read() is only a user of buf and not its owner, 
> >> hence
> >> it may not deallocate it.
> >>
> >> Signed-off-by: Kim Christensen 
> >> Acked-by: Ulrich Ölmann 
> >
> > Reviewed-by: Uwe Kleine-König 
> 
> Just saw that I erroneously only documented an ACK while I actually did
> a review to approve the patch. So while applying please replace my
> "Acked-by" by an "Reviewed-by".

Did so while applying, thanks!

 - Roland

-- 
Roland Hieber | r.hie...@pengutronix.de |
Pengutronix e.K.  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de


Re: [OSS-Tools] [PATCH dt-utils 00/12] Diverse patches mainly removing bugs and warnings

2019-02-07 Thread Roland Hieber
On Sun, Feb 03, 2019 at 10:47:55PM +0100, Ulrich Ölmann wrote:
> This is a stack of patches that piled up while working on the harmonization of
> the common codebase of barebox and dt-utils.
> Although I already addressed many warnings there is still work to do as you 
> can
> see when building with "-Wall".
> 
> Ulrich Ölmann (12):
>   common: align declarations of dev_add_param_*() functions with barebox
>   of_get_devicepath: again correct comment
>   barebox-state: fix usage of multiple state instances
>   barebox-state: complete cmdline options
>   barebox-state: add cmdline option "--version"
>   barebox-state: remove declaration of __state_uint8_get()
>   barebox-state: remove unused variables
>   keystore-blob: remove unused variable
>   base64: remove unused variable
>   base64: remove duplicate ‘const’ declaration specifier
>   state: fix formatting of "off_t" variables
>   state: fix formatting of "uint32_t" variables
> 
>  src/barebox-state.c | 20 +++-
>  src/barebox-state/backend_bucket_circular.c | 34 ++---
>  src/barebox-state/backend_storage.c | 20 ++--
>  src/base64.c| 17 ++-
>  src/dt/common.h |  8 ++---
>  src/keystore-blob.c |  2 +-
>  src/libdt.c |  7 +++--
>  7 files changed, 51 insertions(+), 57 deletions(-)

Applied all to next, thanks a lot!

 - Roland

-- 
Roland Hieber | r.hie...@pengutronix.de |
Pengutronix e.K.  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de

Re: [OSS-Tools] [PATCH dt-utils] state: fix typo

2019-02-07 Thread Roland Hieber
On Thu, Feb 07, 2019 at 10:23:10AM +0100, Ulrich Ölmann wrote:
> This ports the following barebox commit:
> 
> | commit 69b16bcc850c9eef0f399f531d0b0cfdacb9b4e4
> | Author: Ulrich Ölmann 
> | Date:   Wed Feb 6 11:34:02 2019 +0100
> |
> | common: state: fix typo
> |
> | Signed-off-by: Ulrich Ölmann 
> | Signed-off-by: Sascha Hauer 
> |
> | M   common/state/backend_format_raw.c
> | M   common/state/state.c
> | M   common/state/state.h
> 
> Signed-off-by: Ulrich Ölmann 
> ---
>  src/barebox-state/backend_format_raw.c | 4 ++--
>  src/barebox-state/state.c  | 2 +-
>  src/barebox-state/state.h  | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)

Applied to next, thanks.

 - Roland

> 
> diff --git a/src/barebox-state/backend_format_raw.c 
> b/src/barebox-state/backend_format_raw.c
> index 4369f76e376f..5a71149d3443 100644
> --- a/src/barebox-state/backend_format_raw.c
> +++ b/src/barebox-state/backend_format_raw.c
> @@ -127,7 +127,7 @@ static int backend_format_raw_verify(struct 
> state_backend_format *format,
>   return -EINVAL;
>   }
>  
> - if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) {
> + if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTICATION)) {
>   ret = backend_raw_digest_init(backend_raw);
>   if (ret)
>   return ret;
> @@ -153,7 +153,7 @@ static int backend_format_raw_verify(struct 
> state_backend_format *format,
>  
>   *lenp = header->data_len + sizeof(*header);
>  
> - if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) {
> + if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTICATION)) {
>   const void *hmac = data + header->data_len;
>  
>   /* hmac over header and data */
> diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
> index fd3cbbc54505..e95f91e29cd5 100644
> --- a/src/barebox-state/state.c
> +++ b/src/barebox-state/state.c
> @@ -127,7 +127,7 @@ int state_load(struct state *state)
>  
>  int state_load_no_auth(struct state *state)
>  {
> - return state_do_load(state, STATE_FLAG_NO_AUTHENTIFICATION);
> + return state_do_load(state, STATE_FLAG_NO_AUTHENTICATION);
>  }
>  
>  static int state_format_init(struct state *state, const char *backend_format,
> diff --git a/src/barebox-state/state.h b/src/barebox-state/state.h
> index 3a0662fd2594..912d6d484823 100644
> --- a/src/barebox-state/state.h
> +++ b/src/barebox-state/state.h
> @@ -6,7 +6,7 @@ struct state;
>  struct mtd_info_user;
>  
>  enum state_flags {
> - STATE_FLAG_NO_AUTHENTIFICATION = (1 << 0),
> + STATE_FLAG_NO_AUTHENTICATION = (1 << 0),
>  };
>  
>  enum state_variable_type {
> -- 
> 2.20.1
> 
> 
> ___
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de

-- 
Roland Hieber | r.hie...@pengutronix.de |
Pengutronix e.K.  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de

[OSS-Tools] [dt-utils] Release 2019.01.0

2019-01-28 Thread Roland Hieber
Hi,

I've just released version 2019.01.0 of dt-utils [1]. Highlight of this
release is the harmonization of the barebox-state implementation with
upstream barebox, thanks to Ulrich Ölmann for working on this!

[1]: https://public.pengutronix.de/software/dt-utils/dt-utils-2019.01.0.tar.xz
 
https://public.pengutronix.de/software/dt-utils/dt-utils-2019.01.0.tar.xz.md5
 
https://public.pengutronix.de/software/dt-utils/dt-utils-2019.01.0.tar.xz.sha1
 
https://public.pengutronix.de/software/dt-utils/dt-utils-2019.01.0.tar.xz.sha256

This release includes contributions from Andrey Smirnov, Antony Pavlov,
Daniel Schultz, Enrico Jorns, Ian Abbott, Juergen Borleis, Ladislav
Michl, Lucas Stach, Michael Olbrich, Philipp Zabel, Roland Hieber, Sam
Ravnborg, Sascha Hauer, Ulrich Ölmann, and Uwe Kleine-König. Thanks to
all contributors!

Changes:
* libdt: fix leaks of memory returned by read_file() calls
* libdt: xzalloc: die on failure, like the similar-named kernel function
* libdt: add of_property_write_string() as a convenience function to set
  a property to a string
* libdt: add dev_set_name() as a convenience function to set a device's
  name
* state: harmonize our implementation with upstream barebox:
  - Fixes:
. backend_bucket_circular: fix the case when write size is not a
  power of 2
. backend_bucket_circular: fix length check when reading old state
  format
. backend_bucket_circular: fix two memory leaks
. backend_storage: don't refresh the storage needlessly
. fix error return value when state_new_from_node() cannot resolve a
  phandle
. fix use-after-free in state_backend_format_dtb_pack()
. make finding the backend node more robust by using its
  reproducible name
. remove checks for xzalloc() returning NULL, which cannot happen
. do not complain about missing backend-storage-type, which is
  irrelevant for mtd devices
  - Potentially breaking changes:
. make pointing to the backend using a phandle the only supported
  method
. state nodes without an alias in the /aliases/ node now lead to an
  error. barebox already creates a missing alias in the fixupped
  device tree automatically since v2017.06.0.
. refuse to set the read-only 'dirty' state variable
. remove unused arguments from state_new_from_node()
  - New features:
. add new 'init_from_defaults' state variable to allow detection
  whether a state has been initialized from default values, i.e.
  state_load() failed.
. add an internal variable to protect existing data in a state
  bucket and make updates of the
  state implementation more robust
. add new function state_read_mac() to read a MAC address from state
. notify when the old state format is detected (this was previously
  a debugging message)
. provide an error message when an error occurs in
  state_convert_node_variable()
. add more debugging messages
  - port several changes to barebox's fixup functions, but since device
trees are already fixupped at boot time, this code is never used by
dt-utils
  - some further minor refactoring as well fixing some typos and
documentation comments

-- 
Roland Hieber | r.hie...@pengutronix.de |
Pengutronix e.K.  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de

[OSS-Tools] [dt-utils] Release 2018.05.1

2018-12-14 Thread Roland Hieber
Hi,

I've just rolled a quick bugfix release for dt-utils. It is available at
the usual place [1], now also with checksums [2].

[1]: https://public.pengutronix.de/software/dt-utils/dt-utils-2018.05.1.tar.xz
[2]: 
https://public.pengutronix.de/software/dt-utils/dt-utils-2018.05.1.tar.xz.md5
 
https://public.pengutronix.de/software/dt-utils/dt-utils-2018.05.1.tar.xz.sha1
 
https://public.pengutronix.de/software/dt-utils/dt-utils-2018.05.1.tar.xz.sha256

The full list of changes is very short this time, nevertheless, thanks
to all contributors!

Enrico Joerns (1):
  src: fix compilation for glibc version 2.27.9000-36.fc29 and newer
  configure.ac: change project mail to oss-tools@pengutronix.de

Philipp Rosenberger (1):
  Fix compiler warnings about wrong type conversion in messages.

Roland Hieber (2):
  README: also use oss-tools@pengutronix.de here
  Release v2018.05.0

-- 
Roland Hieber | r.hie...@pengutronix.de |
Pengutronix e.K.  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
OSS-Tools mailing list
OSS-Tools@pengutronix.de