From 4e75ca5bae03449edc4915c8b78267976d719d6e Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Thu, 28 Oct 2021 01:13:32 +0200 Subject: [PATCH 1/4] coreboot-toolchain: Disable fetching of submodules Submodules are not needed. Thus, disable fetching of the submodules. Signed-off-by: Felix Singer --- pkgs/development/tools/misc/coreboot-toolchain/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/tools/misc/coreboot-toolchain/default.nix b/pkgs/development/tools/misc/coreboot-toolchain/default.nix index fc8277625a9d..5c64a4cc6dd6 100644 --- a/pkgs/development/tools/misc/coreboot-toolchain/default.nix +++ b/pkgs/development/tools/misc/coreboot-toolchain/default.nix @@ -11,6 +11,7 @@ stdenvNoCC.mkDerivation rec { url = "https://review.coreboot.org/coreboot"; rev = version; sha256 = "00xr74yc0kj9rrqa1a8b7bih865qlp9i4zs67ysavkfrjrwwssxm"; + fetchSubmodules = false; }; nativeBuildInputs = [ bison curl git perl ]; From 60d1033025add04c1f5e14dadeb3180ddef8f0cd Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Thu, 28 Oct 2021 01:32:43 +0200 Subject: [PATCH 2/4] coreboot-toolchain: Rework update script Rework update script so that it needs to be run from the root directory of nixpkgs and get rid of relative paths. Also, move the resulting file `sources.nix` into the package directory. Signed-off-by: Felix Singer --- .../tools/misc/coreboot-toolchain/update.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/misc/coreboot-toolchain/update.sh b/pkgs/development/tools/misc/coreboot-toolchain/update.sh index 6f248359c69b..d4c348a5d0c7 100755 --- a/pkgs/development/tools/misc/coreboot-toolchain/update.sh +++ b/pkgs/development/tools/misc/coreboot-toolchain/update.sh @@ -1,9 +1,14 @@ #!/usr/bin/env nix-shell #!nix-shell --pure -i bash -p nix cacert git getopt -rootdir="../../../../../" +if [ ! -d .git ]; then + echo "This script needs to be run from the root directory of nixpkgs. Exiting." + exit 1 +fi -src="$(nix-build $rootdir --no-out-link -A coreboot-toolchain.src)" +pkg_dir="$(dirname "$0")" + +src="$(nix-build . --no-out-link -A coreboot-toolchain.src)" urls=$($src/util/crossgcc/buildgcc -u) tmp=$(mktemp) @@ -28,4 +33,4 @@ echo ']' >> $tmp sed -ie 's/https\:\/\/ftpmirror\.gnu\.org/mirror\:\/\/gnu/g' $tmp -mv $tmp sources.nix +mv $tmp $pkg_dir/sources.nix From ee2417a226c8631576a508d634b120702a1c9679 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sun, 24 Oct 2021 21:14:30 +0200 Subject: [PATCH 3/4] coreboot-toolchain: 4.14 -> 4.15 Update to latest release. Signed-off-by: Felix Singer --- .../tools/misc/coreboot-toolchain/default.nix | 18 +++++++---- .../tools/misc/coreboot-toolchain/stable.nix | 30 +++++++++---------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/pkgs/development/tools/misc/coreboot-toolchain/default.nix b/pkgs/development/tools/misc/coreboot-toolchain/default.nix index 5c64a4cc6dd6..66f67bf2fd7a 100644 --- a/pkgs/development/tools/misc/coreboot-toolchain/default.nix +++ b/pkgs/development/tools/misc/coreboot-toolchain/default.nix @@ -1,16 +1,24 @@ -{ callPackage, fetchgit, lib, stdenvNoCC -, bison, curl, git, perl -, flex, gnat11, zlib +{ bison +, callPackage +, curl +, fetchgit +, flex +, git +, gnat11 +, lib +, perl +, stdenvNoCC +, zlib }: stdenvNoCC.mkDerivation rec { pname = "coreboot-toolchain"; - version = "4.14"; + version = "4.15"; src = fetchgit { url = "https://review.coreboot.org/coreboot"; rev = version; - sha256 = "00xr74yc0kj9rrqa1a8b7bih865qlp9i4zs67ysavkfrjrwwssxm"; + sha256 = "0y137dhfi0zf9nmyq49ksrad69yspbnsmzc4wjkw3hjwvzgi8j27"; fetchSubmodules = false; }; diff --git a/pkgs/development/tools/misc/coreboot-toolchain/stable.nix b/pkgs/development/tools/misc/coreboot-toolchain/stable.nix index 62c3043cc6cb..9460353873e4 100644 --- a/pkgs/development/tools/misc/coreboot-toolchain/stable.nix +++ b/pkgs/development/tools/misc/coreboot-toolchain/stable.nix @@ -1,9 +1,9 @@ { fetchurl }: [ { - name = "gmp-6.2.0.tar.xz"; + name = "gmp-6.2.1.tar.xz"; archive = fetchurl { - sha256 = "09hmg8k63mbfrx1x3yy6y1yzbbq85kw5avbibhcgrg9z3ganr3i5"; - url = "mirror://gnu/gmp/gmp-6.2.0.tar.xz"; + sha256 = "1wml97fdmpcynsbw9yl77rj29qibfp652d0w3222zlfx5j8jjj7x"; + url = "mirror://gnu/gmp/gmp-6.2.1.tar.xz"; }; } { @@ -14,31 +14,31 @@ }; } { - name = "mpc-1.2.0.tar.gz"; + name = "mpc-1.2.1.tar.gz"; archive = fetchurl { - sha256 = "19pxx3gwhwl588v496g3aylhcw91z1dk1d5x3a8ik71sancjs3z9"; - url = "mirror://gnu/mpc/mpc-1.2.0.tar.gz"; + sha256 = "0n846hqfqvmsmim7qdlms0qr86f1hck19p12nq3g3z2x74n3sl0p"; + url = "mirror://gnu/mpc/mpc-1.2.1.tar.gz"; }; } { - name = "gcc-8.3.0.tar.xz"; + name = "gcc-11.2.0.tar.xz"; archive = fetchurl { - sha256 = "0b3xv411xhlnjmin2979nxcbnidgvzqdf4nbhix99x60dkzavfk4"; - url = "mirror://gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz"; + sha256 = "12zs6vd2rapp42x154m479hg3h3lsafn3xhg06hp5hsldd9xr3nh"; + url = "mirror://gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz"; }; } { - name = "binutils-2.35.1.tar.xz"; + name = "binutils-2.37.tar.xz"; archive = fetchurl { - sha256 = "01w6xvfy7sjpw8j08k111bnkl27j760bdsi0wjvq44ghkgdr3v9w"; - url = "mirror://gnu/binutils/binutils-2.35.1.tar.xz"; + sha256 = "0b53hhgfnafw27y0c3nbmlfidny2cc5km29pnfffd8r0y0j9f3c2"; + url = "mirror://gnu/binutils/binutils-2.37.tar.xz"; }; } { - name = "acpica-unix2-20200925.tar.gz"; + name = "acpica-unix2-20210331.tar.gz"; archive = fetchurl { - sha256 = "18n6129fkgj85piid7v4zxxksv3h0amqp4p977vcl9xg3bq0zd2w"; - url = "https://acpica.org/sites/acpica/files/acpica-unix2-20200925.tar.gz"; + sha256 = "1h98pvc9iy1c49cid0ppjwk5zsy2m1xbvfqb72pkwkrd4rn35arx"; + url = "https://acpica.org/sites/acpica/files/acpica-unix2-20210331.tar.gz"; }; } { From 0faf3230fbb26775d836362867ab5066942e0882 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Thu, 28 Oct 2021 00:41:21 +0200 Subject: [PATCH 4/4] coreboot-toolchain: Improve reproducibility For reproducibility, the toolchain build system appends a specific version string to the usual version string of the tools. Before 4.15, the build system used git for that at runtime and since the .git directory is removed by the NixOS build system, the version string was empty and resulted in `v_`. Now, the toolchain build system prefers using the environment variable `CROSSGCC_VERSION` if set. Thus, extract the version string in the postFetch phase and set `CROSSGCC_VERSION` in the build phase. Signed-off-by: Felix Singer --- .../tools/misc/coreboot-toolchain/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/misc/coreboot-toolchain/default.nix b/pkgs/development/tools/misc/coreboot-toolchain/default.nix index 66f67bf2fd7a..8042fc2522b3 100644 --- a/pkgs/development/tools/misc/coreboot-toolchain/default.nix +++ b/pkgs/development/tools/misc/coreboot-toolchain/default.nix @@ -3,6 +3,7 @@ , curl , fetchgit , flex +, getopt , git , gnat11 , lib @@ -18,8 +19,14 @@ stdenvNoCC.mkDerivation rec { src = fetchgit { url = "https://review.coreboot.org/coreboot"; rev = version; - sha256 = "0y137dhfi0zf9nmyq49ksrad69yspbnsmzc4wjkw3hjwvzgi8j27"; + sha256 = "1qsb2ca22h5f0iwc254qsfm7qcn8967ir8aybdxa1pakgmnfsyp9"; fetchSubmodules = false; + leaveDotGit = true; + postFetch = '' + patchShebangs $out/util/crossgcc/buildgcc + PATH=${lib.makeBinPath [ getopt ]}:$PATH $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version + rm -rf $out/.git + ''; }; nativeBuildInputs = [ bison curl git perl ]; @@ -37,10 +44,11 @@ stdenvNoCC.mkDerivation rec { ) (callPackage ./stable.nix { }) } - patchShebangs util/genbuild_h/genbuild_h.sh util/crossgcc/buildgcc + patchShebangs util/genbuild_h/genbuild_h.sh ''; buildPhase = '' + export CROSSGCC_VERSION=$(cat .crossgcc_version) make crossgcc-i386 CPUS=$NIX_BUILD_CORES DEST=$out '';