All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] fs/initramfs: fix show-info
@ 2020-03-16 21:55 Yann E. MORIN
  2020-03-17  7:00 ` Thomas De Schampheleire
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yann E. MORIN @ 2020-03-16 21:55 UTC (permalink / raw)
  To: buildroot

The initramfs is not a reall filesystem, so it does not use the
$(rootfs) infrastructure.

As a consequence, the usual rootfs-related variables are not set,
especially the name, type, and dependencies of the (non-)filesystem.

Yet, it is present in the list of rootfs to build, and thus we end
up including it in the output of show-info. But the missing variables
yield an incorrect json:

    "": {
        "type": "",
        "virtual": false,
        "version": "",
        "licenses": "",
        "dl_dir": "",
        "install_target": ,
        "install_staging": ,
        "install_images": ,
        "downloads": [ ],
        "dependencies": [ ],
        "reverse_dependencies": [ ]
    },

First, the object key is empty; second, the install_target,
install_staging, and install_images values are empty, which is not
valid (if they were null, that be OK though). Third, this is clearly
the layout of a 'package' entry, not that of a 'rootfs' entry.

An option to fix that would be to actually make use of the rootfs
infra. However, that would mean doing a lot of work for nothing
(there is actually nothing to do, yet the infra would still do a lot
of preparatory and clean up work).

The alternative is pretty simple: declare and set the variables as if
it were a real filesystem, so that show-info can filter it to the
proper layout and can spit out appropriate content (even if fake).

The third option would be to teach show-info (and its internal
implementation, the macro json-info) to ignore specific cases, like
no-name items, or replace empty values with null, or whatnots. This
again would be quite a lot of work for a single occurence.

So we go for the simple faked variables.

We add linux as a dependency, so that the graph-depends also properly
represent the dependency chain, which ends up with something liKe:

              ALL
               |
               v
        rootfs-initramfs
         |            |
         v            v
       linux     rootfs-cpio

which is pretty fitting in the end.

Reported-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 fs/initramfs/initramfs.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk
index c751093214..3b3d4ed8b9 100644
--- a/fs/initramfs/initramfs.mk
+++ b/fs/initramfs/initramfs.mk
@@ -29,3 +29,8 @@ rootfs-initramfs-show-depends:
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
 TARGETS_ROOTFS += rootfs-initramfs
 endif
+
+# Not using the rootfs infra, so fake the variables
+ROOTFS_INITRAMFS_NAME = rootfs-initramfs
+ROOTFS_INITRAMFS_TYPE = rootfs
+ROOTFS_INITRAMFS_DEPENDENCIES = rootfs-cpio linux
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] fs/initramfs: fix show-info
  2020-03-16 21:55 [Buildroot] [PATCH] fs/initramfs: fix show-info Yann E. MORIN
@ 2020-03-17  7:00 ` Thomas De Schampheleire
  2020-03-18 21:44 ` Thomas Petazzoni
  2020-03-27 22:15 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas De Schampheleire @ 2020-03-17  7:00 UTC (permalink / raw)
  To: buildroot

El lun., 16 mar. 2020 a las 22:55, Yann E. MORIN
(<yann.morin.1998@free.fr>) escribi?:
>
> The initramfs is not a reall filesystem, so it does not use the
> $(rootfs) infrastructure.
>
> As a consequence, the usual rootfs-related variables are not set,
> especially the name, type, and dependencies of the (non-)filesystem.
>
> Yet, it is present in the list of rootfs to build, and thus we end
> up including it in the output of show-info. But the missing variables
> yield an incorrect json:
>
>     "": {
>         "type": "",
>         "virtual": false,
>         "version": "",
>         "licenses": "",
>         "dl_dir": "",
>         "install_target": ,
>         "install_staging": ,
>         "install_images": ,
>         "downloads": [ ],
>         "dependencies": [ ],
>         "reverse_dependencies": [ ]
>     },
>
> First, the object key is empty; second, the install_target,
> install_staging, and install_images values are empty, which is not
> valid (if they were null, that be OK though). Third, this is clearly
> the layout of a 'package' entry, not that of a 'rootfs' entry.
>
> An option to fix that would be to actually make use of the rootfs
> infra. However, that would mean doing a lot of work for nothing
> (there is actually nothing to do, yet the infra would still do a lot
> of preparatory and clean up work).
>
> The alternative is pretty simple: declare and set the variables as if
> it were a real filesystem, so that show-info can filter it to the
> proper layout and can spit out appropriate content (even if fake).
>
> The third option would be to teach show-info (and its internal
> implementation, the macro json-info) to ignore specific cases, like
> no-name items, or replace empty values with null, or whatnots. This
> again would be quite a lot of work for a single occurence.
>
> So we go for the simple faked variables.
>
> We add linux as a dependency, so that the graph-depends also properly
> represent the dependency chain, which ends up with something liKe:
>
>               ALL
>                |
>                v
>         rootfs-initramfs
>          |            |
>          v            v
>        linux     rootfs-cpio
>
> which is pretty fitting in the end.
>
> Reported-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>  fs/initramfs/initramfs.mk | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk
> index c751093214..3b3d4ed8b9 100644
> --- a/fs/initramfs/initramfs.mk
> +++ b/fs/initramfs/initramfs.mk
> @@ -29,3 +29,8 @@ rootfs-initramfs-show-depends:
>  ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
>  TARGETS_ROOTFS += rootfs-initramfs
>  endif
> +
> +# Not using the rootfs infra, so fake the variables
> +ROOTFS_INITRAMFS_NAME = rootfs-initramfs
> +ROOTFS_INITRAMFS_TYPE = rootfs
> +ROOTFS_INITRAMFS_DEPENDENCIES = rootfs-cpio linux

Thanks!

Tested-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] fs/initramfs: fix show-info
  2020-03-16 21:55 [Buildroot] [PATCH] fs/initramfs: fix show-info Yann E. MORIN
  2020-03-17  7:00 ` Thomas De Schampheleire
@ 2020-03-18 21:44 ` Thomas Petazzoni
  2020-03-27 22:15 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2020-03-18 21:44 UTC (permalink / raw)
  To: buildroot

On Mon, 16 Mar 2020 22:55:36 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> The initramfs is not a reall filesystem, so it does not use the
> $(rootfs) infrastructure.
> 
> As a consequence, the usual rootfs-related variables are not set,
> especially the name, type, and dependencies of the (non-)filesystem.
> 
> Yet, it is present in the list of rootfs to build, and thus we end
> up including it in the output of show-info. But the missing variables
> yield an incorrect json:
> 
>     "": {
>         "type": "",
>         "virtual": false,
>         "version": "",
>         "licenses": "",
>         "dl_dir": "",
>         "install_target": ,
>         "install_staging": ,
>         "install_images": ,
>         "downloads": [ ],
>         "dependencies": [ ],
>         "reverse_dependencies": [ ]
>     },
> 
> First, the object key is empty; second, the install_target,
> install_staging, and install_images values are empty, which is not
> valid (if they were null, that be OK though). Third, this is clearly
> the layout of a 'package' entry, not that of a 'rootfs' entry.
> 
> An option to fix that would be to actually make use of the rootfs
> infra. However, that would mean doing a lot of work for nothing
> (there is actually nothing to do, yet the infra would still do a lot
> of preparatory and clean up work).
> 
> The alternative is pretty simple: declare and set the variables as if
> it were a real filesystem, so that show-info can filter it to the
> proper layout and can spit out appropriate content (even if fake).
> 
> The third option would be to teach show-info (and its internal
> implementation, the macro json-info) to ignore specific cases, like
> no-name items, or replace empty values with null, or whatnots. This
> again would be quite a lot of work for a single occurence.
> 
> So we go for the simple faked variables.
> 
> We add linux as a dependency, so that the graph-depends also properly
> represent the dependency chain, which ends up with something liKe:
> 
>               ALL
>                |
>                v
>         rootfs-initramfs
>          |            |
>          v            v
>        linux     rootfs-cpio
> 
> which is pretty fitting in the end.
> 
> Reported-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>  fs/initramfs/initramfs.mk | 5 +++++
>  1 file changed, 5 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] fs/initramfs: fix show-info
  2020-03-16 21:55 [Buildroot] [PATCH] fs/initramfs: fix show-info Yann E. MORIN
  2020-03-17  7:00 ` Thomas De Schampheleire
  2020-03-18 21:44 ` Thomas Petazzoni
@ 2020-03-27 22:15 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2020-03-27 22:15 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > The initramfs is not a reall filesystem, so it does not use the
 > $(rootfs) infrastructure.

 > As a consequence, the usual rootfs-related variables are not set,
 > especially the name, type, and dependencies of the (non-)filesystem.

 > Yet, it is present in the list of rootfs to build, and thus we end
 > up including it in the output of show-info. But the missing variables
 > yield an incorrect json:

 >     "": {
 >         "type": "",
 >         "virtual": false,
 >         "version": "",
 >         "licenses": "",
 >         "dl_dir": "",
 >         "install_target": ,
 >         "install_staging": ,
 >         "install_images": ,
 >         "downloads": [ ],
 >         "dependencies": [ ],
 >         "reverse_dependencies": [ ]
 >     },

 > First, the object key is empty; second, the install_target,
 > install_staging, and install_images values are empty, which is not
 > valid (if they were null, that be OK though). Third, this is clearly
 > the layout of a 'package' entry, not that of a 'rootfs' entry.

 > An option to fix that would be to actually make use of the rootfs
 > infra. However, that would mean doing a lot of work for nothing
 > (there is actually nothing to do, yet the infra would still do a lot
 > of preparatory and clean up work).

 > The alternative is pretty simple: declare and set the variables as if
 > it were a real filesystem, so that show-info can filter it to the
 > proper layout and can spit out appropriate content (even if fake).

 > The third option would be to teach show-info (and its internal
 > implementation, the macro json-info) to ignore specific cases, like
 > no-name items, or replace empty values with null, or whatnots. This
 > again would be quite a lot of work for a single occurence.

 > So we go for the simple faked variables.

 > We add linux as a dependency, so that the graph-depends also properly
 > represent the dependency chain, which ends up with something liKe:

 >               ALL
 >                |
 >                v
 >         rootfs-initramfs
 >          |            |
 >          v            v
 >        linux     rootfs-cpio

 > which is pretty fitting in the end.

 > Reported-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Committed to 2019.11.x and 2020.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-27 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 21:55 [Buildroot] [PATCH] fs/initramfs: fix show-info Yann E. MORIN
2020-03-17  7:00 ` Thomas De Schampheleire
2020-03-18 21:44 ` Thomas Petazzoni
2020-03-27 22:15 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.