Re: [PATCH 11/12] initramfs: refactor the initramfs build rules

Sam Ravnborg
2020-01-04T14:17:00Z

Hi Masahiro.

> > > +else ifeq ($(words $(ramfs-input)),1)
> > > +# If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with
> > > +# .cpio or .cpio.*, use it directly as an initramfs.
> > > +ifneq ($(filter %.cpio,$(ramfs-input)),)
> > > +cpio-data := $(ramfs-input)
> > > +endif
> >
> > This part will now work if the file is named foo.cpio.bar.
> > $(findstring .cpio, should be used and not $(filter %.cpio
> > At least if the comment describes the intended behaviour.
>
>
> The 'foo.cpio.bar' is taken care of
> by ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2)
Clever, I only now realized how this worked.
>
> I admit the comment was confusing.
>
>
> I will clarify the comments as follows:
>
>
>
> # If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with
> # .cpio, use it directly as an initramfs.
> ifneq ($(filter %.cpio,$(ramfs-input)),)
> cpio-data := $(ramfs-input)
> endif
>
> # If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with
> # .cpio.*, use it directly as an initramfs, and avoid double compression.
> ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2)
> cpio-data := $(ramfs-input)
> compress-y := shipped
> endif

Looks good.

Sam