add coreboot update script

wip/yesman
Milan Pässler 4 years ago
parent d19854992f
commit aab6439c05
No known key found for this signature in database
GPG Key ID: A6DC6A7CB0B97859
  1. 86
      pkgs/coreboot/default.nix
  2. 137
      pkgs/coreboot/files.nix
  3. 11
      pkgs/coreboot/update-shell.nix
  4. 34
      pkgs/coreboot/update.sh

@ -2,18 +2,12 @@
, callPackage, lib, corebootConfig ? { CONFIG_PAYLOAD_NONE = "y"; } }:
let
version = "4.12";
src = fetchgit {
url = "https://review.coreboot.org/coreboot.git";
rev = "${version}";
fetchSubmodules = true;
sha256 = "1l140zbvn6pkbrr55lymhi4lycimhpy8xgm45shl4zv6a9vjd66z";
};
toolchain = stdenv.mkDerivation rec {
pname = "coreboot-toolchain";
inherit version src;
inherit (coreboot) version src;
nativeBuildInputs = [ curl stdenv m4 flex bison zlib gnat ];
buildPhase = ''
mkdir -p util/crossgcc/tarballs
${lib.concatMapStringsSep "\n"
@ -21,42 +15,50 @@ let
(callPackage ./files.nix { })}
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 =
lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig;
writeConfig = config: let
filteredConfig = lib.filterAttrs (n: v: v != null) config;
lines =
lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig;
configFile = writeText "config" (lib.concatStringsSep "\n" lines);
in configFile;
in stdenv.mkDerivation rec {
pname = "coreboot";
inherit version src;
postPatch = ''
rm -rf util/crossgcc
cp -r ${toolchain} util/crossgcc
chmod u+rwX -R util/crossgcc
patchShebangs util/xcompile/xcompile
'';
configurePhase = ''
runHook preConfigure
cp ${writeConfig corebootConfig} .config
make olddefconfig
runHook postConfigure
'';
installPhase = ''
mkdir -p $out
cp build/coreboot.rom $out
'';
passthru = { inherit toolchain writeConfig corebootConfig; };
}
in configFile;
coreboot = stdenv.mkDerivation rec {
pname = "coreboot";
version = "4.12";
src = fetchgit {
url = "https://review.coreboot.org/coreboot.git";
rev = version;
sha256 = "sha256-35gmd1Jmf0KhLqS+jvyFNTJPSYTV01JyXvMau9cHJNA=";
fetchSubmodules = true;
};
postPatch = ''
rm -rf util/crossgcc
cp -r ${toolchain} util/crossgcc
chmod u+rwX -R util/crossgcc
patchShebangs util/xcompile/xcompile
'';
configurePhase = ''
runHook preConfigure
cp ${writeConfig corebootConfig} .config
make olddefconfig
runHook postConfigure
'';
installPhase = ''
mkdir -p $out
cp build/coreboot.rom $out
'';
passthru = { inherit toolchain writeConfig corebootConfig; };
};
in coreboot

@ -1,67 +1,114 @@
{ fetchurl }:
# from util/crossgcc/buildgcc
[
(rec {
version = "6.1.2";
name = "gmp-${version}.tar.xz";
{ fetchurl }: [
{
name = "gmp-6.1.2.tar.xz";
archive = fetchurl {
sha256 = "04hrwahdxyqdik559604r7wrj9ffklwvipgfxgj4ys4skbl6bdc7";
url = "mirror://gnu/gmp/${name}";
url = "https://ftpmirror.gnu.org/gmp/gmp-6.1.2.tar.xz";
};
})
(rec {
version = "4.0.2";
name = "mpfr-${version}.tar.xz";
}
{
name = "mpfr-4.0.2.tar.xz";
archive = fetchurl {
sha256 = "12m3amcavhpqygc499s3fzqlb8f2j2rr7fkqsm10xbjfc04fffqx";
url = "mirror://gnu/mpfr/${name}";
url = "https://ftpmirror.gnu.org/mpfr/mpfr-4.0.2.tar.xz";
};
})
(rec {
version = "1.1.0";
name = "mpc-${version}.tar.gz";
}
{
name = "mpc-1.1.0.tar.gz";
archive = fetchurl {
sha256 = "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9";
url = "mirror://gnu/mpc/${name}";
url = "https://ftpmirror.gnu.org/mpc/mpc-1.1.0.tar.gz";
};
})
(rec {
version = "8.3.0";
name = "gcc-${version}.tar.xz";
}
{
name = "gcc-8.3.0.tar.xz";
archive = fetchurl {
sha256 = "0b3xv411xhlnjmin2979nxcbnidgvzqdf4nbhix99x60dkzavfk4";
url = "mirror://gnu/gcc/${name}";
url = "https://ftpmirror.gnu.org/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz";
};
})
(rec {
version = "2.33.1";
name = "binutils-${version}.tar.xz";
}
{
name = "binutils-2.33.1.tar.xz";
archive = fetchurl {
sha256 = "1grcf8jaw3i0bk6f9xfzxw3qfgmn6fgkr108isdkbh1y3hnzqrmb";
url = "mirror://gnu/binutils/${name}";
url = "https://ftpmirror.gnu.org/binutils/binutils-2.33.1.tar.xz";
};
})
(rec {
version = "20200110";
name = "acpica-unix2-${version}.tar.gz";
}
{
name = "gdb-8.3.1.tar.xz";
archive = fetchurl {
sha256 = "1i2pjwaafrlz7wqm40b4znr77ai32rjsxkpl2az38yyarpbv8m8y";
url = "https://ftpmirror.gnu.org/gdb/gdb-8.3.1.tar.xz";
};
}
{
name = "acpica-unix2-20200110.tar.gz";
archive = fetchurl {
sha256 = "1hb4g6r7w8s4bhlkk36fmb4qxghnrwvad7f18cpn6zz0b4sjs7za";
url = "https://acpica.org/sites/acpica/files/${name}";
url = "https://acpica.org/sites/acpica/files/acpica-unix2-20200110.tar.gz";
};
}
{
name = "Python-3.8.1.tar.xz";
archive = fetchurl {
sha256 = "1s4lwn5vzsajlc88m6hkghsvnjw4d00l2dsgng0m2w6vyqbl32bm";
url = "https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz";
};
}
{
name = "expat-2.2.9.tar.bz2";
archive = fetchurl {
sha256 = "0dx2m58gkj7cadk51lmp54ma7cqjhff4kjmwv8ks80j3vj2301pi";
url = "https://downloads.sourceforge.net/sourceforge/expat/expat-2.2.9.tar.bz2";
};
}
{
name = "llvm-9.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "117ymdz1by2nkfq1c2p9m4050dp848kbjbiv6nsfj8hzy9f5d86n";
url = "https://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz";
};
}
{
name = "cfe-9.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "0426ma80i41qsgzm1qdz81mjskck426diygxi2k5vji2gkpixa3v";
url = "https://releases.llvm.org/9.0.0/cfe-9.0.0.src.tar.xz";
};
}
{
name = "compiler-rt-9.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "03ni43lbkp63lr3p6sc94dphqmvnz5av5mml0xmk930xvnbcvr2n";
url = "https://releases.llvm.org/9.0.0/compiler-rt-9.0.0.src.tar.xz";
};
}
{
name = "clang-tools-extra-9.0.0.src.tar.xz";
archive = fetchurl {
sha256 = "045cldmcfd8s33wyjlviifgpnw52yqicd6v4ysvdg4i96p78c77a";
url = "https://releases.llvm.org/9.0.0/clang-tools-extra-9.0.0.src.tar.xz";
};
}
{
name = "make-4.2.1.tar.bz2";
archive = fetchurl {
sha256 = "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn";
url = "https://ftpmirror.gnu.org/make/make-4.2.1.tar.bz2";
};
}
{
name = "cmake-3.16.2.tar.gz";
archive = fetchurl {
sha256 = "1ag65ignli58kpmji6gjhj8xw4w1qdr910i99hsvx8hcqrp7h2cc";
url = "https://cmake.org/files/v3.16/cmake-3.16.2.tar.gz";
};
})
(rec {
version = "2.14.02";
name = "nasm-${version}.tar.bz2";
}
{
name = "nasm-2.14.02.tar.bz2";
archive = fetchurl {
sha256 = "1g409sr1kj7v1089s9kv0i4azvddkcwcypnbakfryyi71b3jdz9l";
url = "https://www.nasm.us/pub/nasm/releasebuilds/${version}/${name}";
url = "https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2";
};
})
}
]

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

@ -0,0 +1,34 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash update-shell.nix
set -xe
cd "$(dirname "$0")/../.."
export PATH="/nix/store/yhr5cl61hqqx12zgfq8i3pkg0diq9v5k-nix-update/bin:$PATH"
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