[Bug 1942260] Re: compress firmware in /lib/firmware
Adrien Nader
1942260 at bugs.launchpad.net
Thu Jul 27 15:13:59 UTC 2023
Have you tried environment variables?
>From the xz manpage:
ENVIRONMENT
xz parses space-separated lists of options from the environment vari‐
ables XZ_DEFAULTS and XZ_OPT, in this order, before parsing the options
from the command line. Note that only options are parsed from the en‐
vironment variables; all non-options are silently ignored. Parsing is
done with getopt_long(3) which is used also for the command line argu‐
ments.
XZ_DEFAULTS
User-specific or system-wide default options. Typically this is
set in a shell initialization script to enable xz's memory usage
limiter by default. Excluding shell initialization scripts and
similar special cases, scripts must never set or unset XZ_DE‐
FAULTS.
XZ_OPT
This is for passing options to xz when it is not possible to set
the options directly on the xz command line. This is the case
when xz is run by a script or tool, for example, GNU tar(1):
XZ_OPT=-2v tar caf foo.tar.xz foo
Scripts may use XZ_OPT, for example, to set script-specific de‐
fault compression options. It is still recommended to allow
users to override XZ_OPT if that is reasonable. For example, in
sh(1) scripts one may use something like this:
XZ_OPT=${XZ_OPT-"-7e"}
export XZ_OPT
>From the zstd manpage:
Environment Variables
Employing environment variables to set parameters has security implica‐
tions. Therefore, this avenue is intentionally limited. Only
ZSTD_CLEVEL and ZSTD_NBTHREADS are currently supported. They set the
compression level and number of threads to use during compression, re‐
spectively.
ZSTD_CLEVEL can be used to set the level between 1 and 19 (the "normal"
range). If the value of ZSTD_CLEVEL is not a valid integer, it will be
ignored with a warning message. ZSTD_CLEVEL just replaces the default
compression level (3).
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to linux-firmware-raspi2 in
Ubuntu.
https://bugs.launchpad.net/bugs/1942260
Title:
compress firmware in /lib/firmware
Status in initramfs-tools package in Ubuntu:
Fix Released
Status in linux-firmware package in Ubuntu:
Confirmed
Status in linux-firmware-raspi2 package in Ubuntu:
Confirmed
Bug description:
-- initramfs-tools
[Impact]
* linux supports xz compressed linux-firmware which saves disk space.
In focal, initramfs-tools only knows how to included uncompressed
firmware files (even when kernel supports loading compressed ones).
Newer releases of linux-firmware may use compressed firmware files
only, in such cases it would be nice for focal's initramfs-tools to
support compressed firmware files in case of partial or incomplete
upgrades (i.e. linux-firmware force installed or upgraded, without
newer initramfs-tools). The proposed changes to initramfs-tools are
backwards and forwards compatible, they prefer to include uncompressed
firmware files; and if missing, include compressed firmware files in
their uncompressed form. Thus maintaining compatibility with any
kernels, irrespective of compressed/uncompressed firmware inputs.
[Test Plan]
* Compress all files shipped by linux-firmware with xz
* Rebuild initrd
* Check that all the same firmware files are still included in the
initramfs, in their uncompressed form as before
[Where problems could occur]
* This SRU is precautionary to prevent accidental installation of
compressed linux-firmware from generating incorrect initramfs. It
should be noted that whilst initramfs-tools would create a compatible
initramfs with any kernels, pre-v5.3 kernels do not support xz
compressed firmware files at runtime. Mixing this new initramfs with
compressed firmwares and pre 5.3 kernels may lead to expectations of
supporting compressed firmware files with them only working at initrd
stage and not at runtime.
[Other Info]
Original bug report
Some facts:
- The linux kernel has supported loading xz compressed firmware since 5.3
- The size of /lib/firmware in impish is ~650Mb (and growing)
- The compressed size of firmware could be ~230Mb
It would be nice to install compressed firmware to save space.
Here are the plans from the Fedora project:
https://fedoraproject.org/wiki/Changes/CompressKernelFirmware
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1942260/+subscriptions
More information about the foundations-bugs
mailing list