forked from M-Labs/artiq-zynq
build FSBL
This commit is contained in:
parent
11d839d8a6
commit
1211a6d066
|
@ -84,4 +84,6 @@ in
|
||||||
zip -j $out/sd.zip ${zc706-sd}/*
|
zip -j $out/sd.zip ${zc706-sd}/*
|
||||||
echo file binary-dist $out/sd.zip >> $out/nix-support/hydra-build-products
|
echo file binary-dist $out/sd.zip >> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
zc706-fsbl = import ./fsbl.nix { inherit pkgs; };
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ pkgs, board ? "zc706" }:
|
||||||
|
let
|
||||||
|
gnutoolchain = import ./gnutoolchain.nix { inherit pkgs; };
|
||||||
|
in
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
name = "${board}-fsbl";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "Xilinx";
|
||||||
|
repo = "embeddedsw";
|
||||||
|
rev = "65c849ed46c88c67457e1fc742744f96db968ff1";
|
||||||
|
sha256 = "1rvl06ha40dzd6s9aa4sylmksh4xb9dqaxq462lffv1fdk342pda";
|
||||||
|
};
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.gnumake
|
||||||
|
gnutoolchain.binutils
|
||||||
|
gnutoolchain.gcc
|
||||||
|
];
|
||||||
|
patchPhase =
|
||||||
|
''
|
||||||
|
patchShebangs lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh
|
||||||
|
echo 'SEARCH_DIR("${gnutoolchain.newlib}/arm-none-eabi/lib");' >> lib/sw_apps/zynq_fsbl/src/lscript.ld
|
||||||
|
'';
|
||||||
|
buildPhase =
|
||||||
|
''
|
||||||
|
cd lib/sw_apps/zynq_fsbl/src
|
||||||
|
make BOARD=${board}
|
||||||
|
'';
|
||||||
|
installPhase =
|
||||||
|
''
|
||||||
|
mkdir $out
|
||||||
|
cp fsbl.elf $out
|
||||||
|
'';
|
||||||
|
doCheck = false;
|
||||||
|
dontFixup = true;
|
||||||
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
{ pkgs ? import <nixpkgs> }:
|
||||||
|
let
|
||||||
|
|
||||||
|
platform = "arm-none-eabi";
|
||||||
|
|
||||||
|
binutils-pkg = { stdenv, buildPackages
|
||||||
|
, fetchurl, zlib
|
||||||
|
, extraConfigureFlags ? []
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
basename = "binutils";
|
||||||
|
version = "2.30";
|
||||||
|
name = "${basename}-${platform}-${version}";
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://ftp.gnu.org/gnu/binutils/binutils-${version}.tar.bz2";
|
||||||
|
sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg";
|
||||||
|
};
|
||||||
|
configureFlags = [
|
||||||
|
"--enable-deterministic-archives"
|
||||||
|
"--target=${platform}"
|
||||||
|
"--with-cpu=cortex-a9"
|
||||||
|
"--with-fpu=vfpv3"
|
||||||
|
"--with-float=hard"
|
||||||
|
"--with-mode=thumb"
|
||||||
|
] ++ extraConfigureFlags;
|
||||||
|
outputs = [ "out" "info" "man" ];
|
||||||
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||||
|
buildInputs = [ zlib ];
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
meta = {
|
||||||
|
description = "Tools for manipulating binaries (linker, assembler, etc.)";
|
||||||
|
longDescription = ''
|
||||||
|
The GNU Binutils are a collection of binary tools. The main
|
||||||
|
ones are `ld' (the GNU linker) and `as' (the GNU assembler).
|
||||||
|
They also include the BFD (Binary File Descriptor) library,
|
||||||
|
`gprof', `nm', `strip', etc.
|
||||||
|
'';
|
||||||
|
homepage = http://www.gnu.org/software/binutils/;
|
||||||
|
license = stdenv.lib.licenses.gpl3Plus;
|
||||||
|
/* Give binutils a lower priority than gcc-wrapper to prevent a
|
||||||
|
collision due to the ld/as wrappers/symlinks in the latter. */
|
||||||
|
priority = "10";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
gcc-pkg = { stdenv, buildPackages
|
||||||
|
, fetchurl, gmp, mpfr, libmpc, platform-binutils
|
||||||
|
, extraConfigureFlags ? []
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
basename = "gcc";
|
||||||
|
version = "9.1.0";
|
||||||
|
name = "${basename}-${platform}-${version}";
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
|
||||||
|
sha256 = "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr";
|
||||||
|
};
|
||||||
|
preConfigure =
|
||||||
|
''
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
'';
|
||||||
|
configureScript = "../configure";
|
||||||
|
configureFlags =
|
||||||
|
[ "--target=${platform}"
|
||||||
|
"--with-arch=armv7-a"
|
||||||
|
"--with-tune=cortex-a9"
|
||||||
|
"--with-fpu=vfpv3"
|
||||||
|
"--with-float=hard"
|
||||||
|
"--disable-libssp"
|
||||||
|
"--enable-languages=c"
|
||||||
|
"--with-as=${platform-binutils}/bin/${platform}-as"
|
||||||
|
"--with-ld=${platform-binutils}/bin/${platform}-ld" ] ++ extraConfigureFlags;
|
||||||
|
outputs = [ "out" "info" "man" ];
|
||||||
|
hardeningDisable = [ "format" "pie" ];
|
||||||
|
propagatedBuildInputs = [ gmp mpfr libmpc platform-binutils ];
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
dontFixup = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
newlib-pkg = { stdenv, fetchurl, buildPackages, platform-binutils, platform-gcc }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "newlib";
|
||||||
|
version = "3.1.0";
|
||||||
|
src = fetchurl {
|
||||||
|
url = "ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz";
|
||||||
|
sha256 = "0ahh3n079zjp7d9wynggwrnrs27440aac04340chf1p9476a2kzv";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ platform-binutils platform-gcc ];
|
||||||
|
|
||||||
|
configureFlags = [
|
||||||
|
"--target=${platform}"
|
||||||
|
|
||||||
|
"--with-cpu=cortex-a9"
|
||||||
|
"--with-fpu=vfpv3"
|
||||||
|
"--with-float=hard"
|
||||||
|
"--with-mode=thumb"
|
||||||
|
"--enable-interwork"
|
||||||
|
"--disable-multilib"
|
||||||
|
|
||||||
|
"--disable-newlib-supplied-syscalls"
|
||||||
|
"--with-gnu-ld"
|
||||||
|
"--with-gnu-as"
|
||||||
|
"--disable-newlib-io-float"
|
||||||
|
"--disable-werror"
|
||||||
|
];
|
||||||
|
dontFixup = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
in rec {
|
||||||
|
binutils-bootstrap = pkgs.callPackage binutils-pkg { };
|
||||||
|
gcc-bootstrap = pkgs.callPackage gcc-pkg {
|
||||||
|
platform-binutils = binutils-bootstrap;
|
||||||
|
extraConfigureFlags = [ "--disable-libgcc" ];
|
||||||
|
};
|
||||||
|
newlib = pkgs.callPackage newlib-pkg {
|
||||||
|
platform-binutils = binutils-bootstrap;
|
||||||
|
platform-gcc = gcc-bootstrap;
|
||||||
|
};
|
||||||
|
binutils = pkgs.callPackage binutils-pkg {
|
||||||
|
extraConfigureFlags = [ "--with-lib-path=${newlib}/arm-none-eabi/lib" ];
|
||||||
|
};
|
||||||
|
gcc = pkgs.callPackage gcc-pkg {
|
||||||
|
platform-binutils = binutils;
|
||||||
|
extraConfigureFlags = [ "--enable-newlib" "--with-headers=${newlib}/arm-none-eabi/include" ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue