makeInitrd{,NG}: drop legacy U‐Boot image support

Now that ARMv5 no longer uses `uImage`, there’s no point in keeping
around support for this deprecated format that the rest of the NixOS
infrastructure doesn’t handle. Modern U‐Boot setups should not
be affected in any way by this.
This commit is contained in:
Emily
2025-06-25 13:08:36 +01:00
committed by zowoq
parent 0c19eb3e55
commit 38dec9fcff
5 changed files with 21 additions and 67 deletions

View File

@@ -18,6 +18,8 @@
- `boot.vesa` has been removed. It was deprecated in 2020 because Xorg now works better with kernel modesetting. If you still need the legacy VESA 800x600 fallback, set `boot.kernelParams = [ "vga=0x317" "nomodeset" ];` directly.
- Support for the legacy UBoot image format has been removed from the initrd generators, as it is deprecated upstream and no longer used by any platform in Nixpkgs.
- Python 2 has been removed from the top-level package set, as it is long past end-of-life. The `python2`, `python27`, `python2Full`, `python27Full`, `python2Packages`, and `python27Packages` attributes, along with the legacy `python`, `pythonFull`, and `pythonPackages` aliases, now throw an error directing you to `python3`. The `isPy2` and `isPy27` package flags have been removed accordingly. The only remaining Python 2 interpreter is vendored inside the `resholve` package for its `oil` dependency and is not exposed for general use.
## Other Notable Changes {#sec-release-26.11-notable-changes}

View File

@@ -1,18 +1,15 @@
rec {
cat = {
executable = pkgs: "cat";
ubootName = "none";
extension = ".cpio";
};
gzip = {
executable = pkgs: "${pkgs.gzip}/bin/gzip";
defaultArgs = [ "-9n" ];
ubootName = "gzip";
extension = ".gz";
};
bzip2 = {
executable = pkgs: "${pkgs.bzip2}/bin/bzip2";
ubootName = "bzip2";
extension = ".bz2";
};
xz = {
@@ -29,24 +26,20 @@ rec {
"--check=crc32"
"--lzma1=dict=512KiB"
];
ubootName = "lzma";
extension = ".lzma";
};
lz4 = {
executable = pkgs: "${pkgs.lz4}/bin/lz4";
defaultArgs = [ "-l" ];
ubootName = "lz4";
extension = ".lz4";
};
lzop = {
executable = pkgs: "${pkgs.lzop}/bin/lzop";
ubootName = "lzo";
extension = ".lzo";
};
zstd = {
executable = pkgs: "${pkgs.zstd}/bin/zstd";
defaultArgs = [ "-10" ];
ubootName = "zstd";
extension = ".zst";
};
pigz = gzip // {

View File

@@ -4,14 +4,13 @@ let
# from it.
compressors = import ./initrd-compressor-meta.nix;
# Get the basename of the actual compression program from the whole
# compression command, for the purpose of guessing the u-boot
# compression command, for the purpose of guessing the
# compression type and filename extension.
compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1;
in
{
stdenvNoCC,
cpio,
ubootTools,
lib,
pkgsBuildHost,
makeInitrdNGTool,
@@ -57,22 +56,13 @@ in
# symlinks to store paths.
prepend ? [ ],
# Whether to wrap the initramfs in a u-boot image.
makeUInitrd ? stdenvNoCC.hostPlatform.linux-kernel.target == "uImage",
# If generating a u-boot image, the architecture to use. The default
# guess may not align with u-boot's nomenclature correctly, so it can
# be overridden.
# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list.
uInitrdArch ? stdenvNoCC.hostPlatform.ubootArch,
# The name of the compression, as recognised by u-boot.
# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list.
# If this isn't guessed, you may want to complete the metadata above and send a PR :)
uInitrdCompression ?
_compressorMeta.ubootName
or (throw "Unrecognised compressor ${_compressorName}, please specify uInitrdCompression"),
# Deprecated; remove in 27.05.
makeUInitrd ? null,
uInitrdArch ? null,
uInitrdCompression ? null,
}:
assert lib.assertMsg (makeUInitrd == null && uInitrdArch == null && uInitrdCompression == null)
"makeInitrdNg: UBoot legacy image support has been removed as it is deprecated upstream and ARMv5 kernels no longer default to uImage";
stdenvNoCC.mkDerivation (finalAttrs: {
__structuredAttrs = true;
@@ -83,11 +73,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
inherit
name
extension
makeUInitrd
uInitrdArch
prepend
;
${if makeUInitrd then "uInitrdCompression" else null} = uInitrdCompression;
compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";
contentsJSON = builtins.toJSON contents;
@@ -95,8 +82,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
nativeBuildInputs = [
makeInitrdNGTool
cpio
]
++ lib.optional makeUInitrd ubootTools;
];
buildCommand = ''
mkdir -p ./root/{run,tmp,var/empty}
@@ -109,13 +95,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
done
(cd root && find . -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd")
if [ -n "$makeUInitrd" ]; then
mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img
# Compatibility symlink
ln -sf "initrd.img" "$out/initrd"
else
ln -s "initrd" "$out/initrd$extension"
fi
ln -s "initrd" "$out/initrd$extension"
'';
passthru = {

View File

@@ -10,18 +10,16 @@
# of algorithms.
let
# Some metadata on various compression programs, relevant to naming
# the initramfs file and, if applicable, generating a u-boot image
# from it.
# the initramfs file.
compressors = import ./initrd-compressor-meta.nix;
# Get the basename of the actual compression program from the whole
# compression command, for the purpose of guessing the u-boot
# compression command, for the purpose of guessing the
# compression type and filename extension.
compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1;
in
{
stdenvNoCC,
cpio,
ubootTools,
lib,
pkgsBuildHost,
# Name of the derivation (not of the resulting file!)
@@ -65,22 +63,13 @@ in
# symlinks to store paths.
prepend ? [ ],
# Whether to wrap the initramfs in a u-boot image.
makeUInitrd ? stdenvNoCC.hostPlatform.linux-kernel.target or "dummy" == "uImage",
# If generating a u-boot image, the architecture to use. The default
# guess may not align with u-boot's nomenclature correctly, so it can
# be overridden.
# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list.
uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch,
# The name of the compression, as recognised by u-boot.
# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list.
# If this isn't guessed, you may want to complete the metadata above and send a PR :)
uInitrdCompression ?
_compressorMeta.ubootName
or (throw "Unrecognised compressor ${_compressorName}, please specify uInitrdCompression"),
# Deprecated; remove in 27.05.
makeUInitrd ? null,
uInitrdArch ? null,
uInitrdCompression ? null,
}:
assert lib.assertMsg (makeUInitrd == null && uInitrdArch == null && uInitrdCompression == null)
"makeInitrd: UBoot legacy image support has been removed as it is deprecated upstream and ARMv5 kernels no longer default to uImage";
stdenvNoCC.mkDerivation (finalAttrs: {
__structuredAttrs = true;
@@ -91,18 +80,14 @@ stdenvNoCC.mkDerivation (finalAttrs: {
inherit
name
extension
makeUInitrd
uInitrdArch
prepend
;
${if makeUInitrd then "uInitrdCompression" else null} = uInitrdCompression;
builder = ./make-initrd.sh;
nativeBuildInputs = [
cpio
]
++ lib.optional makeUInitrd ubootTools;
];
compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";

View File

@@ -36,10 +36,4 @@ done
(cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
(cd root && find * .[^.*] -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd")
if [ -n "$makeUInitrd" ]; then
mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img
# Compatibility symlink
ln -sf "initrd.img" "$out/initrd"
else
ln -s "initrd" "$out/initrd$extension"
fi
ln -s "initrd" "$out/initrd$extension"