Merge pull request #46769 from samueldr/zhf/grub

Fixes grub1 installer tests
This commit is contained in:
xeji 2018-09-17 19:12:23 +02:00 committed by GitHub
commit 8a2bf1319d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 114 additions and 30 deletions

View File

@ -563,6 +563,7 @@ in {
"swapon -L swap",
"mkfs.ext3 -L nixos /dev/sda2",
"mount LABEL=nixos /mnt",
"mkdir -p /mnt/tmp",
);
'';
grubVersion = 1;

View File

@ -1,52 +1,30 @@
{stdenv, fetchurl, autoreconfHook, texinfo, buggyBiosCDSupport ? true}:
let
in
stdenv.mkDerivation {
name = "grub-0.97-patch-1.12";
name = "grub-0.97-73";
src = fetchurl {
url = ftp://alpha.gnu.org/gnu/grub/grub-0.97.tar.gz;
sha256 = "02r6b52r0nsp6ryqfiqchnl7r1d9smm80sqx24494gmx5p8ia7af";
};
# Lots of patches from Gentoo, in particular splash screen support
# (not the fancy SUSE gfxmenu stuff though). Also a fix for boot
# failures on systems with more than 2 GiB RAM, and for booting from
# ext3 filesystems with 256-byte inodes as well as ext4 filesystems.
gentooPatches = fetchurl {
url = mirror://gentoo/distfiles/grub-0.97-patches-1.12.tar.bz2;
sha256 = "15xc5349hkzl03lbn2cadrmvjrf3s8sn147vv2142cwys9sdzkl0";
};
patches = [
# Properly handle the case of symlinks such as
# /dev/disk/by-label/bla. The symlink resolution code in
# grub-install isn't smart enough.
./symlink.patch
# Provide support for the "savedefault --once" command in the Grub
# shell. KDE uses this to allow rebooting into a non-default
# entry.
(fetchurl {
url = "https://raw.github.com/andatche/centos-grub/master/SOURCES/grub-0.97-once.patch";
sha256 = "1g5qfn8lvl32h4pggdf7dmjqjpi42jblknzakb5h909fi5i1qyw8";
})
] ++ (stdenv.lib.optional buggyBiosCDSupport ./buggybios.patch);
]
++ (stdenv.lib.optional buggyBiosCDSupport ./buggybios.patch)
++ map fetchurl (import ./grub1.patches.nix)
;
# autoreconfHook required for the splashimage patch.
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ texinfo ];
hardeningDisable = [ "stackprotector" ];
prePatch = ''
unpackFile $gentooPatches
rm patch/400_all_grub-0.97-reiser4-20050808-gentoo.patch
for i in patch/*.patch; do
echo "applying patch $i"
patch -p1 < $i || patch -p0 < $i
done
'';
hardeningDisable = [ "format" "stackprotector" ];
passthru.grubTarget = "";

View File

@ -0,0 +1,34 @@
# Generated by grub1-patches.sh
let
prefix = "https://salsa.debian.org/grub-team/grub-legacy/raw/1dad5507d74ef97fdd3c6cf2a028084f6f2850c3/debian/patches";
in
[
{ url = "${prefix}/snapshot.patch"; sha256 = "0ixymrn5w1dq0kkxnzdjwwvhjchgyrlivfvnrfncxcv30v84xzna"; }
{ url = "${prefix}/menu.lst_gnu-hurd.patch"; sha256 = "0mz8dvgmxlyrl28dza1ncfq1xipihxgymw4aw688bgg7xxmw7jbs"; }
{ url = "${prefix}/graphics.patch"; sha256 = "1v9kp832f3rhncfdrd28djhw0zfrznfmiadch33mclnkcxprcqcs"; }
{ url = "${prefix}/raid.patch"; sha256 = "0cq6dz5s7m48g76frvbf296bv4pvqkxqcbydsvs43ymqdsary7hj"; }
{ url = "${prefix}/raid_cciss.patch"; sha256 = "0sy5xvzjsllgbn26nykkq4b69lp1fcwjkjs2kmxq38sk3dzadjfl"; }
{ url = "${prefix}/xfs_freeze.patch"; sha256 = "1wqgj8ar4x4zwa37bj4a7kldiz5v92msigy3cv879nnk6sz4rmhg"; }
{ url = "${prefix}/2gb_limit.patch"; sha256 = "06f9lfl4va3alz87wzli0df5ay0xxlqj2akr2dcay6jr27z6ks29"; }
{ url = "${prefix}/grub-special_device_names.patch"; sha256 = "098608xh20sqdjqf42fm2z23r8xd9ify1v0vmy1j9qhrhk3g9qyz"; }
{ url = "${prefix}/grub-xvd_drives.patch"; sha256 = "13k0m1c1w5d1d4qd1bshjc8kp7qba4agk2j64gb7mg8vfzjd35bj"; }
{ url = "${prefix}/initrd_max_address.patch"; sha256 = "05q90rxdnyncpanhbkrknshkk7g8ff4v8fpk7wj4sg8666d9llg3"; }
{ url = "${prefix}/splashimage_help.patch"; sha256 = "1lj3xh56wf1pdcf0fg585vmggrz7qqfzbhg91qv0rf4snf3ybfvr"; }
{ url = "${prefix}/grub-install_addsyncs.patch"; sha256 = "1dzcpxi806kw3j8mx4amyy4ibc0ir3qhqyyyxz3w43741p351r65"; }
{ url = "${prefix}/grub-install_regexp.patch"; sha256 = "0ph9lb63x858019c25aa3fpsm8rzn00ad8fp88yqqvq0xq2jxq69"; }
{ url = "${prefix}/grub-install_aoe_support.patch"; sha256 = "19szmvg13h2hhijrwbgdszldg26iz7vjnagvajxb7nav7vca6k3n"; }
{ url = "${prefix}/grub-install_xvd.patch"; sha256 = "1cgh731nhs0chj2r2dzh5dcfj5xmap34i3fk0i0aq59j83cwflgz"; }
{ url = "${prefix}/geometry-26kernel.patch"; sha256 = "01vka7jrxrwlj9m1d6schygyh964a3k1rdrm3j9x910xkz74i13n"; }
{ url = "${prefix}/print_func.patch"; sha256 = "0dvrcy1i58fgrv2x1qniqfr5az9b834hm5l94k0cy8ii2nfvk27g"; }
{ url = "${prefix}/mprotect.patch"; sha256 = "0ahgnhgw2b86j024ajs6m3h2fy2shqdssjzz0ahk8ny9f4mnvns6"; }
{ url = "${prefix}/savedefault.patch"; sha256 = "1l6x1s9mxkrf3k4j9dpg7qhvrk816vs70sw073iiisvqspnrz2j3"; }
{ url = "${prefix}/find-grub-dir.patch"; sha256 = "1vkgig4dylji03jflwikhap87lz8l470ck1bhmcy8jh0slg6ndbf"; }
{ url = "${prefix}/intelmac.patch"; sha256 = "04l9mk9xm9ml8vdlpbv3qbj7gbaa0g5k4dl7xp8wm7kmqwxd9l3m"; }
{ url = "${prefix}/crossreference_manpages.patch"; sha256 = "0kd12ck4s4bg414fmllgvq8n4b58i3kgdhmcx6riaz43gg2g2b9p"; }
{ url = "${prefix}/ext3_256byte_inode.patch"; sha256 = "0ay9svbdj7mw8p1ld0iiryg6nhd9hc1xpmr9rqg9990xzmg2h4pi"; }
{ url = "${prefix}/objcopy-absolute.patch"; sha256 = "0hkmicjli7bsmc56kr40ls21v6x3yd188xpwc08dvqxnb0763077"; }
{ url = "${prefix}/no-reorder-functions.patch"; sha256 = "0gmv0nzkqim2901hd0an90kwnr83155qp2zjp52biznad2p415gw"; }
{ url = "${prefix}/modern-automake.patch"; sha256 = "08l3y6cbk6gfj63kpqlpzrlain7nmvki7jjjxq86n7himj078znj"; }
{ url = "${prefix}/no-combine-stack-adjustments.patch"; sha256 = "0h4di8zja0rg45rs02x9qm8q1vxly1bcl6ms08wgdl5ywn6849nr"; }
{ url = "${prefix}/no-pie.patch"; sha256 = "0kshdsclza7lsd31apd28qq04arv42nd6wsj2v6q6jx7f8bgdaqw"; }
]

View File

@ -0,0 +1,70 @@
#!/usr/bin/env nix-shell
#!nix-shell -p nix -i bash --pure
# Does like `maintainers/scripts/debian-patches.sh`, but specialized for
# grub1 patches, and using the new salsa service.
# Most common usage: `pkgs/tools/misc/grub/grub1.patches.sh pkgs/tools/misc/grub/grub1.patches.nix`
# That is, after updating the script with the new list from the series file,
# removing (by commenting) patches as required.
set -e
set -u
# https://salsa.debian.org/grub-team/grub-legacy/tree/master/debian/patches
SERIES=(
snapshot.patch
menu.lst_gnu-hurd.patch
graphics.patch
raid.patch
raid_cciss.patch
xfs_freeze.patch
2gb_limit.patch
grub-special_device_names.patch
grub-xvd_drives.patch
initrd_max_address.patch
splashimage_help.patch
grub-install_addsyncs.patch
grub-install_regexp.patch
grub-install_aoe_support.patch
grub-install_xvd.patch
geometry-26kernel.patch
print_func.patch
mprotect.patch
savedefault.patch
find-grub-dir.patch
intelmac.patch
crossreference_manpages.patch
ext3_256byte_inode.patch
# Breaks on NixOS.
#use_grub-probe_in_grub-install.patch
objcopy-absolute.patch
no-reorder-functions.patch
# We aren't building amd64 binaries, see #244498
#fix_amd64_compile.patch
modern-automake.patch
no-combine-stack-adjustments.patch
no-pie.patch
)
# Revision mapping to current tip of the 0.97-73 branch.
rev="1dad5507d74ef97fdd3c6cf2a028084f6f2850c3"
prefix="https://salsa.debian.org/grub-team/grub-legacy/raw/${rev}/debian/patches"
FILE="$1"
shift
cat <<EOF > "$FILE"
# Generated by grub1-patches.sh
let
prefix = "${prefix}";
in
[
EOF
for PATCH in "${SERIES[@]}"; do
URL="$prefix/$PATCH"
HASH="$(nix-prefetch-url "$URL")"
echo "{ url = \"\${prefix}/$PATCH\"; sha256 = \"$HASH\"; }" >> "$FILE"
done
echo "]" >> "$FILE"

View File

@ -2945,6 +2945,7 @@ with pkgs;
grub = pkgsi686Linux.callPackage ../tools/misc/grub {
buggyBiosCDSupport = config.grub.buggyBiosCDSupport or true;
stdenv = overrideCC stdenv pkgsi686Linux.gcc6;
};
trustedGrub = pkgsi686Linux.callPackage ../tools/misc/grub/trusted.nix { };