git.iko.soy/typeable/nixpkgs
on master help sign in
trustedGRUB: GRUB 1 based -> GRUB 2 based
commit2285ad1bfa20714daac8ab2f1d3c933598af9c13 authorThomas Strobel <ts468@cam.ac.uk> dateSat 4 Jul 2015, 23:39 (11 years ago) parenta4c7a59
2 files changed+84−21
pkgs/tools/misc/grub/trusted.nix+83−17 pkgs/top-level/all-packages.nix+1−4
pkgs/tools/misc/grub/trusted.nix+83−17
@@ -1,26 +1,92 @@
1−{stdenv, fetchgit, autoconf, automake, buggyBiosCDSupport ? true}:
1+{ stdenv, fetchurl, fetchgit, autogen, flex, bison, python, autoconf, automake
2+, gettext, ncurses, libusb, freetype, qemu, devicemapper
3+}:
24
3−stdenv.mkDerivation {
4− name = "trustedGRUB-1.1.5";
5+with stdenv.lib;
6+let
7+ pcSystems = {
8+ "i686-linux".target = "i386";
9+ "x86_64-linux".target = "i386";
10+ };
11+
12+ inPCSystems = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) pcSystems);
13+
14+ version = "2.0-git-2015-07-04";
15+
16+ unifont_bdf = fetchurl {
17+ url = "http://unifoundry.com/unifont-5.1.20080820.bdf.gz";
18+ sha256 = "0s0qfff6n6282q28nwwblp5x295zd6n71kl43xj40vgvdqxv0fxx";
19+ };
20+
21+ po_src = fetchurl {
22+ name = "grub-2.02-beta2.tar.gz";
23+ url = "http://alpha.gnu.org/gnu/grub/grub-2.02~beta2.tar.gz";
24+ sha256 = "1lr9h3xcx0wwrnkxdnkfjwy08j7g7mdlmmbdip2db4zfgi69h0rm";
25+
26+ };
27+
28+in (
29+
30+stdenv.mkDerivation rec {
31+ name = "trustedGRUB-${version}";
532
633 src = fetchgit {
7− url = "https://github.com/ts468/TrustedGRUB";
8− rev = "954941c17e14c8f7b18e6cd3043ef5f946866f1c";
9− sha256 = "30c21765dc44f02275e66220d6724ec9cd45496226ca28c6db59a9147aa22685";
34+ url = "https://github.com/Sirrix-AG/TrustedGRUB2";
35+ rev = "1865d07bdef7f39916790c77103fb85e99de14a4";
36+ sha256 = "e6bd9edfeb653e98e585fd691a31533b649b2fca1f4a903c70f6ea371014c9f7";
1037 };
1138
12− # Autoconf/automake required for the splashimage patch.
13− buildInputs = [autoconf automake];
39+ nativeBuildInputs = [ autogen flex bison python autoconf automake ];
40+ buildInputs = [ ncurses libusb freetype gettext devicemapper ]
41+ ++ optional doCheck qemu;
42+
43+ preConfigure =
44+ '' for i in "tests/util/"*.in
45+ do
46+ sed -i "$i" -e's|/bin/bash|/bin/sh|g'
47+ done
48+
49+ # Apparently, the QEMU executable is no longer called
50+ # `qemu-system-i386', even on i386.
51+ #
52+ # In addition, use `-nodefaults' to avoid errors like:
53+ #
54+ # chardev: opening backend "stdio" failed
55+ # qemu: could not open serial device 'stdio': Invalid argument
56+ #
57+ # See <http://www.mail-archive.com/qemu-devel@nongnu.org/msg22775.html>.
58+ sed -i "tests/util/grub-shell.in" \
59+ -e's/qemu-system-i386/qemu-system-x86_64 -nodefaults/g'
60+ '';
61+
62+ prePatch =
63+ '' tar zxf ${po_src} grub-2.02~beta2/po
64+ rm -rf po
65+ mv grub-2.02~beta2/po po
66+ sh autogen.sh
67+ gunzip < "${unifont_bdf}" > "unifont.bdf"
68+ sed -i "configure" \
69+ -e "s|/usr/src/unifont.bdf|$PWD/unifont.bdf|g"
70+ '';
71+
72+ patches = [ ./fix-bash-completion.patch ];
73+
74+ # save target that grub is compiled for
75+ grubTarget = if inPCSystems
76+ then "${pcSystems.${stdenv.system}.target}-pc"
77+ else "";
78+
79+ doCheck = false;
80+ enableParallelBuilding = true;
1481
15− preConfigure = ''
16− autoreconf
82+ postInstall = ''
83+ paxmark pms $out/sbin/grub-{probe,bios-setup}
1784 '';
1885
19− meta = {
20− homepage = "http://sourceforge.net/projects/trustedgrub/";
21− repositories.git = https://github.com/ts468/TrustedGRUB;
22− description = "Legacy GRUB bootloader extended with TCG support";
23− platforms = stdenv.lib.platforms.linux;
24− maintainers = with stdenv.lib.maintainers; [ tstrobel ];
86+ meta = with stdenv.lib; {
87+ description = "GRUB 2.0 extended with TCG (TPM) support for integrity measured boot process (trusted boot)";
88+ homepage = https://github.com/Sirrix-AG/TrustedGRUB2;
89+ license = licenses.gpl3Plus;
90+ platforms = platforms.gnu;
2591 };
26−}
92+})
pkgs/top-level/all-packages.nix+1−4
@@ -1702,10 +1702,7 @@ let
17021702 automake = automake112x; # fails with 13 and 14
17031703 };
17041704
1705− trustedGrub = callPackage_i686 ../tools/misc/grub/trusted.nix {
1706− buggyBiosCDSupport = config.grub.buggyBiosCDSupport or true;
1707− automake = automake112x; # fails with 13 and 14
1708− };
1705+ trustedGrub = callPackage_i686 ../tools/misc/grub/trusted.nix { };
17091706
17101707 grub2 = grub2_full;
17111708