confused about use of "INITRD_COMPRESS" lines in top-level Makefile

Ghitulete Razvan razvan.ghitulete at gmail.com
Wed Jun 22 12:28:20 EDT 2016


If you look at the commit introducing that code you can see that it is
meant to actually replace what was a series of if-else if-.... code.
As such, the patch that introduced that snipped did not alter previous
behavior in any way and that is intended behavior.

The reason that is actually the right behavior to start with, is
because you can obviously only have one compression scheme for the
same initrd (obvious reasons, I guess). As such if you select multiple
configuration options, the build system will pick the one it considers
best.

On Mon, Jun 20, 2016 at 2:01 PM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
>
>   currently poring over the initramfs code, and i'm a bit curious
> about the following.
>
>   in usr/Kconfig, all the possible compression protocols can be
> selected, and by default are:
>
> config RD_GZIP
>         bool "Support initial ramdisks compressed using gzip"
>         default y
>         select DECOMPRESS_GZIP
>         help
>           Support loading of a gzip-encoded initial ramdisk or cpio buffer.
>           If unsure, say Y.
>
> config RD_BZIP2
>         bool "Support initial ramdisks compressed using bzip2"
>         default y
>         select DECOMPRESS_BZIP2
>         help
>           Support loading of a bzip2-encoded initial ramdisk or cpio buffer.
>           If unsure, say N.
>
> ... etc etc ...
>
> but in the top-level Makefile, here are the lines that ostensibly
> select which compression to actually use:
>
>   # Select initial ramdisk compression format, default is gzip(1).
>   # This shall be used by the dracut(8) tool while creating an initramfs image.
>   #
>   INITRD_COMPRESS-y                  := gzip
>   INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
>   INITRD_COMPRESS-$(CONFIG_RD_LZMA)  := lzma
>   INITRD_COMPRESS-$(CONFIG_RD_XZ)    := xz
>   INITRD_COMPRESS-$(CONFIG_RD_LZO)   := lzo
>   INITRD_COMPRESS-$(CONFIG_RD_LZ4)   := lz4
>   # do not export INITRD_COMPRESS, since we didn't actually
>   # choose a sane default compression above.
>   # export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
>
> so as i read this, the single compression protocol selected will be
> the last one configured in that list, but where is that variable
> eventually used? where is the build code or utility that examines the
> value eventually set and invokes dracut, as the comment suggests?
>
> rday
>
> --
>
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                         http://crashcourse.ca
>
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
Sincerely,
Razvan Ghitulete



More information about the Kernelnewbies mailing list