Browse Source

update nixpkgs, use upstream coreboot-toolchain package

main
Milan 3 weeks ago
parent
commit
23fd46de82
  1. 6
      nix/sources.json
  2. 4
      pkgs/coreboot-payload-tianocore/default.nix
  3. 35
      pkgs/coreboot/default.nix
  4. 107
      pkgs/coreboot/files.nix
  5. 11
      pkgs/coreboot/update-shell.nix
  6. 33
      pkgs/coreboot/update.sh

6
nix/sources.json

@ -17,10 +17,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4cd421cdc55bc5c5899a93bdb48782dc66dc32f8",
"sha256": "116lxhns03w56ky5hvpxh4zsagv9zarbhp252hixvhj44d546vzb",
"rev": "93869cdd815e1fef6aa1a506f307198c9bd6a1a7",
"sha256": "1b7qapygrac1bs86bj2wk1wzyi7nb29lkkf2z2qj7krcki4mqjma",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/4cd421cdc55bc5c5899a93bdb48782dc66dc32f8.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/93869cdd815e1fef6aa1a506f307198c9bd6a1a7.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

4
pkgs/coreboot-payload-tianocore/default.nix

@ -5,7 +5,7 @@
, bc
, utillinux
, nasm
, iasl
, acpica-tools
}:
# we can not override the source in edk2, so we had to copy the entire thing
@ -49,7 +49,7 @@ in stdenv.mkDerivation {
pname = "coreboot-payload-tianocore";
inherit version src;
buildInputs = [ bc pythonEnv utillinux nasm iasl ];
buildInputs = [ bc pythonEnv utillinux nasm acpica-tools ];
prePatch = ''
rm -rf BaseTools

35
pkgs/coreboot/default.nix

@ -1,32 +1,8 @@
{ fetchgit, fetchurl, stdenv, m4, flex, bison, zlib, gnat, curl, writeText
, callPackage, lib, corebootConfig ? { CONFIG_PAYLOAD_NONE = "y"; } }:
{ fetchgit, stdenv, writeText , coreboot-toolchain , callPackage, lib
, corebootConfig ? { CONFIG_PAYLOAD_NONE = "y"; }
}:
let
toolchain = stdenv.mkDerivation rec {
pname = "coreboot-toolchain";
inherit (coreboot) version src;
nativeBuildInputs = [ curl stdenv m4 flex bison zlib gnat ];
buildPhase = ''
mkdir -p util/crossgcc/tarballs
${lib.concatMapStringsSep "\n" (
file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}"
) (
callPackage ./files.nix { }
)}
# nasm doesn't like the date set by coreboot
sed "s/SOURCE_DATE_EPOCH := .*/SOURCE_DATE_EPOCH := $SOURCE_DATE_EPOCH/" -i Makefile
make crossgcc-i386 CPUS=$NIX_BUILD_CORES
'';
installPhase = ''
cp -r util/crossgcc $out
'';
};
writeConfig = config: let
filteredConfig = lib.filterAttrs (n: v: v != null) config;
lines =
@ -46,8 +22,7 @@ let
};
postPatch = ''
rm -rf util/crossgcc
cp -r ${toolchain} util/crossgcc
cp -r ${coreboot-toolchain} util/crossgcc/xgcc
chmod u+rwX -R util/crossgcc
patchShebangs util/xcompile/xcompile
'';
@ -64,7 +39,7 @@ let
cp build/coreboot.rom $out
'';
passthru = { inherit toolchain writeConfig corebootConfig; };
passthru = { inherit writeConfig corebootConfig; };
};
in coreboot

107
pkgs/coreboot/files.nix

@ -1,107 +0,0 @@
{ fetchurl }: [
{
name = "gmp-6.2.0.tar.xz";
archive = fetchurl {
sha256 = "09hmg8k63mbfrx1x3yy6y1yzbbq85kw5avbibhcgrg9z3ganr3i5";
url = "https://ftpmirror.gnu.org/gmp/gmp-6.2.0.tar.xz";
};
}
{
name = "mpfr-4.1.0.tar.xz";
archive = fetchurl {
sha256 = "0zwaanakrqjf84lfr5hfsdr7hncwv9wj0mchlr7cmxigfgqs760c";
url = "https://ftpmirror.gnu.org/mpfr/mpfr-4.1.0.tar.xz";
};
}
{
name = "mpc-1.2.0.tar.gz";
archive = fetchurl {
sha256 = "19pxx3gwhwl588v496g3aylhcw91z1dk1d5x3a8ik71sancjs3z9";
url = "https://ftpmirror.gnu.org/mpc/mpc-1.2.0.tar.gz";
};
}
{
name = "gcc-8.3.0.tar.xz";
archive = fetchurl {
sha256 = "0b3xv411xhlnjmin2979nxcbnidgvzqdf4nbhix99x60dkzavfk4";
url = "https://ftpmirror.gnu.org/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz";
};
}
{
name = "binutils-2.35.1.tar.xz";
archive = fetchurl {
sha256 = "01w6xvfy7sjpw8j08k111bnkl27j760bdsi0wjvq44ghkgdr3v9w";
url = "https://ftpmirror.gnu.org/binutils/binutils-2.35.1.tar.xz";
};
}
{
name = "gdb-9.2.tar.xz";
archive = fetchurl {
sha256 = "0mf5fn8v937qwnal4ykn3ji1y2sxk0fa1yfqi679hxmpg6pdf31n";
url = "https://ftpmirror.gnu.org/gdb/gdb-9.2.tar.xz";
};
}
{
name = "acpica-unix2-20200925.tar.gz";
archive = fetchurl {
sha256 = "18n6129fkgj85piid7v4zxxksv3h0amqp4p977vcl9xg3bq0zd2w";
url = "https://acpica.org/sites/acpica/files/acpica-unix2-20200925.tar.gz";
};
}
{
name = "Python-3.8.5.tar.xz";
archive = fetchurl {
sha256 = "1c43dbv9lvlp3ynqmgdi4rh8q94swanhqarqrdx62zmigpakw073";
url = "https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz";
};
}
{
name = "expat-2.2.9.tar.bz2";
archive = fetchurl {
sha256 = "0dx2m58gkj7cadk51lmp54ma7cqjhff4kjmwv8ks80j3vj2301pi";
url = "https://downloads.sourceforge.net/sourceforge/expat/expat-2.2.9-RENAMED-VULNERABLE-PLEASE-USE-2.4.1-INSTEAD.tar.bz2";
};
}
{
name = "llvm-11.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi";
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/llvm-11.0.0.src.tar.xz";
};
}
{
name = "clang-11.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "02ajkij85966vd150iy246mv16dsaph1kfi0y8wnncp8w6nar5hg";
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang-11.0.0.src.tar.xz";
};
}
{
name = "compiler-rt-11.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "0d5j5l8phwqjjscmk8rmqn0i2i0abl537gdbkagl8fjpzy1gyjip";
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/compiler-rt-11.0.0.src.tar.xz";
};
}
{
name = "clang-tools-extra-11.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "02bcwwn54661madhq4nxc069s7p7pj5gpqi8ww50w3anbpviilzy";
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang-tools-extra-11.0.0.src.tar.xz";
};
}
{
name = "cmake-3.18.1.tar.gz";
archive = fetchurl {
sha256 = "0215srmc9l7ygwdpfms8yx0wbd96qgz2d58ykmdiarvysf5k7qy0";
url = "https://cmake.org/files/v3.18/cmake-3.18.1.tar.gz";
};
}
{
name = "nasm-2.15.05.tar.bz2";
archive = fetchurl {
sha256 = "1l1gxs5ncdbgz91lsl4y7w5aapask3w02q9inayb2m5bwlwq6jrw";
url = "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2";
};
}
]

11
pkgs/coreboot/update-shell.nix

@ -1,11 +0,0 @@
let
sources = import ../../nix/sources.nix;
pkgs = import sources.nixpkgs {};
in
with pkgs;
mkShell {
buildInputs = [ nix git cacert getopt nix-update ];
NIX_PATH = "nixpkgs=${sources.nixpkgs}";
}

33
pkgs/coreboot/update.sh

@ -1,33 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash update-shell.nix
set -xe
cd "$(dirname "$0")/../.."
nix-update coreboot $@
src="$(nix-build --no-out-link -A coreboot.src)"
urls=$($src/util/crossgcc/buildgcc -u)
echo '{ fetchurl }: [' > pkgs/coreboot/.files.nix.tmp
for url in $urls
do
name="$(basename $url)"
hash="$(nix-prefetch-url "$url")"
cat << EOF >> pkgs/coreboot/.files.nix.tmp
{
name = "$name";
archive = fetchurl {
sha256 = "$hash";
url = "$url";
};
}
EOF
done
echo ']' >> pkgs/coreboot/.files.nix.tmp
mv pkgs/coreboot/.files.nix.tmp pkgs/coreboot/files.nix
Loading…
Cancel
Save