Since kernel 5.3 the firmware loader supports xz compressed firmware files. Compressing the linux-firmware tree would reduce its size considerably, for linux-firmware-20190923 from 470 MB to 145 MB. What would need to be done: * call xz on every firmware file * Introduce check for CONFIG_FW_LOADER_COMPRESS * Determine whether CONFIG_INITRAMFS_SOURCE works with compressed firmware files, and if not warn users * Deal with symlinks in the linux-firmware tree
Created attachment 602702 [details] linux-firmware-20191215.ebuild.patch My attempt to implement it. * No check for CONFIG_FW_LOADER_COMPRESS yet. * Since we are compressing files installed by the package, I thinks using "xz" is not quite appropriate. I've chosen "compress" for now. (In reply to Chí-Thanh Christopher Nguyễn from comment #0) > * Determine whether CONFIG_INITRAMFS_SOURCE works with compressed firmware > files, and if not warn users I don't understand this part.
"-C none" can be used as well. The default is "crc64" which is not supported by the kernel.
(In reply to Alexander Tsoy from comment #1) > (In reply to Chí-Thanh Christopher Nguyễn from comment #0) > > * Determine whether CONFIG_INITRAMFS_SOURCE works with compressed firmware > > files, and if not warn users > I don't understand this part. Ah, got it. CONFIG_INITRAMFS_SOURCE may contain paths to firmware files.
Created attachment 602760 [details] linux-firmware-20191215.ebuild.patch * skip compression of the amd-ucode directory. genkernel and dracut cannot read compressed AMD microcode.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12113f5d57730f8c36d3df433ec7f1606519e360 commit 12113f5d57730f8c36d3df433ec7f1606519e360 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-10-28 16:56:33 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-10-28 17:01:51 +0000 sys-kernel/linux-firmware: add USE=compress This compresses installed firmware with xz. Note that FW_LOADER_COMPRESS must be enabled in the kernel. Closes: https://bugs.gentoo.org/695666 Thanks-to: Alexander Tsoy <alexander@tsoy.me> Signed-off-by: Sam James <sam@gentoo.org> .../linux-firmware-20221012-r1.ebuild | 374 +++++++++++++++++++++ .../linux-firmware/linux-firmware-99999999.ebuild | 34 +- sys-kernel/linux-firmware/metadata.xml | 1 + 3 files changed, 405 insertions(+), 4 deletions(-)