linux kernel: prefer zstd where possible
Closes #302291
Closes #301536
The following things have changed:
* For 5.7+: ZSWAP compressor uses zstd now.
* For 5.11+: ZRAM compressor uses zstd now.
* For 5.13+: kernel modules are compressed with zstd instead of xz.
* For 5.19+: support zstd-compressed firmware.
The modules-closure functionality needed explicit support for copying
over `.zst` files. Also, the VM image builder used busybox's `insmod`
before which doesn't support zstd. Switched to `kmod` and added xz/zstd
as dependencies for it, similar to how it's done for the actual stage1
in d33e52b253
. The use of `kmod` here
doesn't seem to be such a big deal since it's only a build-time
dependency.
This commit is contained in:
parent
1a2d905c2c
commit
378177d269
|
@ -80,7 +80,7 @@ for module in $(< ~-/closure); do
|
||||||
# of its output.
|
# of its output.
|
||||||
modinfo -b $kernel --set-version "$version" -F firmware $module | grep -v '^name:' | while read -r i; do
|
modinfo -b $kernel --set-version "$version" -F firmware $module | grep -v '^name:' | while read -r i; do
|
||||||
echo "firmware for $module: $i"
|
echo "firmware for $module: $i"
|
||||||
for name in "$i" "$i.xz" ""; do
|
for name in "$i" "$i.xz" "$i.zst" ""; do
|
||||||
[ -z "$name" ] && echo "WARNING: missing firmware $i for module $module"
|
[ -z "$name" ] && echo "WARNING: missing firmware $i for module $module"
|
||||||
if cp -v --parents --no-preserve=mode lib/firmware/$name "$out" 2>/dev/null; then
|
if cp -v --parents --no-preserve=mode lib/firmware/$name "$out" 2>/dev/null; then
|
||||||
break
|
break
|
||||||
|
|
|
@ -40,10 +40,14 @@ rec {
|
||||||
${pkgs.stdenv.cc.libc}/lib/libc.so.* \
|
${pkgs.stdenv.cc.libc}/lib/libc.so.* \
|
||||||
${pkgs.stdenv.cc.libc}/lib/libm.so.* \
|
${pkgs.stdenv.cc.libc}/lib/libm.so.* \
|
||||||
${pkgs.stdenv.cc.libc}/lib/libresolv.so.* \
|
${pkgs.stdenv.cc.libc}/lib/libresolv.so.* \
|
||||||
|
${pkgs.stdenv.cc.libc}/lib/libpthread.so.* \
|
||||||
|
${pkgs.zstd.out}/lib/libzstd.so.* \
|
||||||
|
${pkgs.xz.out}/lib/liblzma.so.* \
|
||||||
$out/lib
|
$out/lib
|
||||||
|
|
||||||
# Copy BusyBox.
|
# Copy BusyBox.
|
||||||
cp -pd ${pkgs.busybox}/bin/* $out/bin
|
cp -pd ${pkgs.busybox}/bin/* $out/bin
|
||||||
|
cp -pd ${pkgs.kmod}/bin/* $out/bin
|
||||||
|
|
||||||
# Run patchelf to make the programs refer to the copied libraries.
|
# Run patchelf to make the programs refer to the copied libraries.
|
||||||
for i in $out/bin/* $out/lib/*; do if ! test -L $i; then nuke-refs $i; fi; done
|
for i in $out/bin/* $out/lib/*; do if ! test -L $i; then nuke-refs $i; fi; done
|
||||||
|
@ -54,6 +58,11 @@ rec {
|
||||||
patchelf --set-interpreter $out/lib/ld-*.so.? --set-rpath $out/lib $i || true
|
patchelf --set-interpreter $out/lib/ld-*.so.? --set-rpath $out/lib $i || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
find $out/lib -type f \! -name 'ld*.so.?' | while read i; do
|
||||||
|
echo "patching $i..."
|
||||||
|
patchelf --set-rpath $out/lib $i
|
||||||
|
done
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -871,12 +871,14 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
zram = {
|
zram = {
|
||||||
ZRAM = module;
|
ZRAM = module;
|
||||||
ZRAM_WRITEBACK = option yes;
|
ZRAM_WRITEBACK = option yes;
|
||||||
ZRAM_MULTI_COMP = whenAtLeast "6.2" yes;
|
ZRAM_MULTI_COMP = whenAtLeast "6.2" yes;
|
||||||
ZSWAP = option yes;
|
ZRAM_DEF_COMP_ZSTD = whenAtLeast "5.11" yes;
|
||||||
ZPOOL = yes;
|
ZSWAP = option yes;
|
||||||
ZBUD = option yes;
|
ZSWAP_COMPRESSOR_DEFAULT_ZSTD = whenAtLeast "5.7" yes;
|
||||||
|
ZPOOL = yes;
|
||||||
|
ZSMALLOC = option yes;
|
||||||
};
|
};
|
||||||
|
|
||||||
brcmfmac = {
|
brcmfmac = {
|
||||||
|
@ -948,8 +950,9 @@ let
|
||||||
THRUSTMASTER_FF = yes;
|
THRUSTMASTER_FF = yes;
|
||||||
ZEROPLUS_FF = yes;
|
ZEROPLUS_FF = yes;
|
||||||
|
|
||||||
MODULE_COMPRESS = whenOlder "5.13" yes;
|
MODULE_COMPRESS = whenOlder "5.13" yes;
|
||||||
MODULE_COMPRESS_XZ = yes;
|
MODULE_COMPRESS_XZ = whenOlder "5.13" yes;
|
||||||
|
MODULE_COMPRESS_ZSTD = whenAtLeast "5.13" yes;
|
||||||
|
|
||||||
SYSVIPC = yes; # System-V IPC
|
SYSVIPC = yes; # System-V IPC
|
||||||
|
|
||||||
|
@ -1124,6 +1127,7 @@ let
|
||||||
FW_LOADER_USER_HELPER_FALLBACK = option no;
|
FW_LOADER_USER_HELPER_FALLBACK = option no;
|
||||||
|
|
||||||
FW_LOADER_COMPRESS = whenAtLeast "5.3" yes;
|
FW_LOADER_COMPRESS = whenAtLeast "5.3" yes;
|
||||||
|
FW_LOADER_COMPRESS_ZSTD = whenAtLeast "5.19" yes;
|
||||||
|
|
||||||
HOTPLUG_PCI_ACPI = yes; # PCI hotplug using ACPI
|
HOTPLUG_PCI_ACPI = yes; # PCI hotplug using ACPI
|
||||||
HOTPLUG_PCI_PCIE = yes; # PCI-Expresscard hotplug support
|
HOTPLUG_PCI_PCIE = yes; # PCI-Expresscard hotplug support
|
||||||
|
|
Loading…
Reference in New Issue
Block a user