Merge pull request #6184 from ambrop72/bootstrap-tools-staging
Bootstrap tools improvements to cross-compile for ARM
This commit is contained in:
commit
4b9729f9d9
@ -32,7 +32,7 @@ in
|
|||||||
# Building from a proper gcc staying in the path where it was installed,
|
# Building from a proper gcc staying in the path where it was installed,
|
||||||
# libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
|
# libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
|
||||||
# any special hack.
|
# any special hack.
|
||||||
preInstall = ''
|
preInstall = if cross != null then "" else ''
|
||||||
if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
|
if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
|
||||||
mkdir -p $out/lib
|
mkdir -p $out/lib
|
||||||
cp ${stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
|
cp ${stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ fetchurl, stdenv, gettext }:
|
{ fetchurl, stdenv, gettext, glibc }:
|
||||||
|
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation (rec {
|
||||||
name = "libelf-0.8.13";
|
name = "libelf-0.8.13";
|
||||||
@ -10,6 +10,11 @@ stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
|
# For cross-compiling, native glibc is needed for the "gencat" program.
|
||||||
|
crossAttrs = {
|
||||||
|
nativeBuildInputs = [ glibc ];
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "ELF object file access library";
|
description = "ELF object file access library";
|
||||||
|
|
||||||
|
@ -36,9 +36,8 @@ stdenv.mkDerivation rec {
|
|||||||
./pt-pax-flags-20121023.patch
|
./pt-pax-flags-20121023.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs =
|
nativeBuildInputs = optional gold bison;
|
||||||
[ zlib ]
|
buildInputs = [ zlib ];
|
||||||
++ optional gold bison;
|
|
||||||
|
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{ stdenv, fetchurl, m4, perl }:
|
{ stdenv, fetchurl, m4, perl }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "bison-3.0.2";
|
name = "bison-3.0.4";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://gnu/bison/${name}.tar.gz";
|
url = "mirror://gnu/bison/${name}.tar.gz";
|
||||||
sha256 = "1vc17y6242jlwp0gdj7wsim3nvc1ws7q3j0v3065nz8g9hd9vwnd";
|
sha256 = "b67fd2daae7a64b5ba862c66c07c1addb9e6b1b05c5f2049392cfd8a2172952e";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ m4 perl ];
|
nativeBuildInputs = [ m4 perl ];
|
||||||
|
@ -114,6 +114,7 @@ rec {
|
|||||||
};
|
};
|
||||||
} // {
|
} // {
|
||||||
inherit cross gccCross binutilsCross;
|
inherit cross gccCross binutilsCross;
|
||||||
|
ccCross = gccCross;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
# Use the static tools for armv5tel-linux.
|
|
||||||
(import ./armv5tel.nix) //
|
|
||||||
|
|
||||||
{
|
{
|
||||||
bootstrapTools = {
|
busybox = import <nix/fetchurl.nix> {
|
||||||
# Built from make-bootstrap-tools-crosspi.nix
|
url = https://dl.dropboxusercontent.com/s/4705ffxjrxxqnh2/busybox?dl=0;
|
||||||
# nixpkgs rev eb0422e4c1263a65a9b2b954fe10a1e03d67db3e
|
sha256 = "032maafy4akcdgccpxdxrza29pkcpm81g8kh1hv8bj2rvssly3z2";
|
||||||
url = http://viric.name/tmp/nix/pi/bootstrap-tools.cpio.bz2;
|
executable = true;
|
||||||
sha256 = "1zb27x5h54k51yrvn3sy4wb1qprx8iv2kfbgklxwc0mcxp9b7ccd";
|
};
|
||||||
|
|
||||||
|
bootstrapTools = import <nix/fetchurl.nix> {
|
||||||
|
url = https://dl.dropboxusercontent.com/s/pen8ieymeqqdvqn/bootstrap-tools.tar.xz?dl=0;
|
||||||
|
sha256 = "0kjpjwi6qw82ca02ppsih3bnhc3y150q23k9d56xzscs0xf5d0dv";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
12
pkgs/stdenv/linux/bootstrap/armv7l.nix
Normal file
12
pkgs/stdenv/linux/bootstrap/armv7l.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
busybox = import <nix/fetchurl.nix> {
|
||||||
|
url = https://dl.dropboxusercontent.com/s/rowzme529tc5svq/busybox?dl=0;
|
||||||
|
sha256 = "18793riwv9r1bgz6zv03c84cd0v26gxsm8wd2c7gjrwwyfg46ls4";
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
bootstrapTools = import <nix/fetchurl.nix> {
|
||||||
|
url = https://dl.dropboxusercontent.com/s/3jr4s5449t7zjlj/bootstrap-tools.tar.xz?dl=0;
|
||||||
|
sha256 = "1qyp871dajz5mi3yaw9sndwh4yrh1jj184wjjwaf6dpr3jir4kyd";
|
||||||
|
};
|
||||||
|
}
|
@ -7,16 +7,18 @@
|
|||||||
# The function defaults are for easy testing.
|
# The function defaults are for easy testing.
|
||||||
{ system ? builtins.currentSystem
|
{ system ? builtins.currentSystem
|
||||||
, allPackages ? import ../../top-level/all-packages.nix
|
, allPackages ? import ../../top-level/all-packages.nix
|
||||||
, platform ? null, config ? {}, lib ? (import ../../../lib) }:
|
, platform ? null, config ? {}, lib ? (import ../../../lib)
|
||||||
|
, customBootstrapFiles ? null }:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
bootstrapFiles =
|
bootstrapFiles =
|
||||||
if system == "i686-linux" then import ./bootstrap/i686.nix
|
if customBootstrapFiles != null then customBootstrapFiles
|
||||||
|
else if system == "i686-linux" then import ./bootstrap/i686.nix
|
||||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
|
else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
|
||||||
else if system == "armv5tel-linux" then import ./bootstrap/armv5tel.nix
|
else if system == "armv5tel-linux" then import ./bootstrap/armv5tel.nix
|
||||||
else if system == "armv6l-linux" then import ./bootstrap/armv6l.nix
|
else if system == "armv6l-linux" then import ./bootstrap/armv6l.nix
|
||||||
else if system == "armv7l-linux" then import ./bootstrap/armv6l.nix
|
else if system == "armv7l-linux" then import ./bootstrap/armv7l.nix
|
||||||
else if system == "mips64el-linux" then import ./bootstrap/loongson2f.nix
|
else if system == "mips64el-linux" then import ./bootstrap/loongson2f.nix
|
||||||
else abort "unsupported platform for the pure Linux stdenv";
|
else abort "unsupported platform for the pure Linux stdenv";
|
||||||
|
|
||||||
@ -42,11 +44,7 @@ rec {
|
|||||||
|
|
||||||
builder = bootstrapFiles.busybox;
|
builder = bootstrapFiles.busybox;
|
||||||
|
|
||||||
args =
|
args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];
|
||||||
if system == "armv5tel-linux" || system == "armv6l-linux"
|
|
||||||
|| system == "armv7l-linux"
|
|
||||||
then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
|
|
||||||
else [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];
|
|
||||||
|
|
||||||
tarball = bootstrapFiles.bootstrapTools;
|
tarball = bootstrapFiles.bootstrapTools;
|
||||||
|
|
||||||
@ -298,4 +296,52 @@ rec {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
testBootstrapTools = let
|
||||||
|
defaultPkgs = allPackages { inherit system platform; };
|
||||||
|
in derivation {
|
||||||
|
name = "test-bootstrap-tools";
|
||||||
|
inherit system;
|
||||||
|
builder = bootstrapFiles.busybox;
|
||||||
|
args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
|
||||||
|
|
||||||
|
buildCommand = ''
|
||||||
|
export PATH=${bootstrapTools}/bin
|
||||||
|
|
||||||
|
ls -l
|
||||||
|
mkdir $out
|
||||||
|
mkdir $out/bin
|
||||||
|
sed --version
|
||||||
|
find --version
|
||||||
|
diff --version
|
||||||
|
patch --version
|
||||||
|
make --version
|
||||||
|
awk --version
|
||||||
|
grep --version
|
||||||
|
gcc --version
|
||||||
|
curl --version
|
||||||
|
|
||||||
|
ldlinux=$(echo ${bootstrapTools}/lib/ld-linux*.so.?)
|
||||||
|
export CPP="cpp -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools}"
|
||||||
|
export CC="gcc -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${bootstrapTools}/lib"
|
||||||
|
export CXX="g++ -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${bootstrapTools}/lib"
|
||||||
|
|
||||||
|
echo '#include <stdio.h>' >> foo.c
|
||||||
|
echo '#include <limits.h>' >> foo.c
|
||||||
|
echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
|
||||||
|
$CC -o $out/bin/foo foo.c
|
||||||
|
$out/bin/foo
|
||||||
|
|
||||||
|
echo '#include <iostream>' >> bar.cc
|
||||||
|
echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
|
||||||
|
$CXX -v -o $out/bin/bar bar.cc
|
||||||
|
$out/bin/bar
|
||||||
|
|
||||||
|
tar xvf ${defaultPkgs.hello.src}
|
||||||
|
cd hello-*
|
||||||
|
./configure --prefix=$out
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,26 @@
|
|||||||
{system ? builtins.currentSystem}:
|
{system ? builtins.currentSystem}:
|
||||||
|
|
||||||
|
let buildFor = toolsArch: (
|
||||||
|
|
||||||
let
|
let
|
||||||
pkgsFun = import ../../top-level/all-packages.nix;
|
pkgsFun = import ../../top-level/all-packages.nix;
|
||||||
pkgsNoParams = pkgsFun {};
|
pkgsNoParams = pkgsFun {};
|
||||||
|
|
||||||
|
sheevaplugCrossSystem = {
|
||||||
|
crossSystem = rec {
|
||||||
|
config = "armv5tel-unknown-linux-gnueabi";
|
||||||
|
bigEndian = false;
|
||||||
|
arch = "arm";
|
||||||
|
float = "soft";
|
||||||
|
withTLS = true;
|
||||||
|
libc = "glibc";
|
||||||
|
platform = pkgsNoParams.platforms.sheevaplug;
|
||||||
|
openssl.system = "linux-generic32";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
raspberrypiCrossSystem = {
|
raspberrypiCrossSystem = {
|
||||||
crossSystem = {
|
crossSystem = rec {
|
||||||
config = "armv6l-unknown-linux-gnueabi";
|
config = "armv6l-unknown-linux-gnueabi";
|
||||||
bigEndian = false;
|
bigEndian = false;
|
||||||
arch = "arm";
|
arch = "arm";
|
||||||
@ -14,51 +30,34 @@ let
|
|||||||
libc = "glibc";
|
libc = "glibc";
|
||||||
platform = pkgsNoParams.platforms.raspberrypi;
|
platform = pkgsNoParams.platforms.raspberrypi;
|
||||||
openssl.system = "linux-generic32";
|
openssl.system = "linux-generic32";
|
||||||
gcc = {
|
inherit (platform) gcc;
|
||||||
arch = "armv6";
|
|
||||||
fpu = "vfp";
|
|
||||||
float = "hard";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
raspberrypiCrossSystemUclibc = {
|
beagleboneCrossSystem = {
|
||||||
crossSystem = {
|
crossSystem = rec {
|
||||||
config = "armv6l-unknown-linux-gnueabi";
|
config = "armv7l-unknown-linux-gnueabi";
|
||||||
bigEndian = false;
|
bigEndian = false;
|
||||||
arch = "arm";
|
arch = "arm";
|
||||||
float = "hard";
|
float = "hard";
|
||||||
fpu = "vfp";
|
fpu = "vfpv3-d16";
|
||||||
withTLS = true;
|
withTLS = true;
|
||||||
libc = "uclibc";
|
libc = "glibc";
|
||||||
platform = pkgsNoParams.platforms.raspberrypi;
|
platform = pkgsNoParams.platforms.beaglebone;
|
||||||
openssl.system = "linux-generic32";
|
openssl.system = "linux-generic32";
|
||||||
gcc = {
|
inherit (platform) gcc;
|
||||||
arch = "armv6";
|
|
||||||
fpu = "vfp";
|
|
||||||
float = "hard";
|
|
||||||
};
|
|
||||||
uclibc.extraConfig = ''
|
|
||||||
ARCH_WANTS_BIG_ENDIAN n
|
|
||||||
ARCH_BIG_ENDIAN n
|
|
||||||
ARCH_WANTS_LITTLE_ENDIAN y
|
|
||||||
ARCH_LITTLE_ENDIAN y
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pkgsuclibc = pkgsFun ({inherit system;} // raspberrypiCrossSystemUclibc);
|
selectedCrossSystem =
|
||||||
pkgs = pkgsFun ({inherit system;} // raspberrypiCrossSystem);
|
if toolsArch == "armv5tel" then sheevaplugCrossSystem else
|
||||||
|
if toolsArch == "armv6l" then raspberrypiCrossSystem else
|
||||||
|
if toolsArch == "armv7l" then beagleboneCrossSystem else null;
|
||||||
|
|
||||||
|
pkgs = pkgsFun ({inherit system;} // selectedCrossSystem);
|
||||||
|
|
||||||
inherit (pkgs) stdenv nukeReferences cpio binutilsCross;
|
inherit (pkgs) stdenv nukeReferences cpio binutilsCross;
|
||||||
|
|
||||||
# We want coreutils without ACL support.
|
|
||||||
coreutils_base = pkgs.coreutils.override (args: {
|
|
||||||
aclSupport = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
coreutils_ = coreutils_base.crossDrv;
|
|
||||||
|
|
||||||
glibc = pkgs.libcCross;
|
glibc = pkgs.libcCross;
|
||||||
bash = pkgs.bash.crossDrv;
|
bash = pkgs.bash.crossDrv;
|
||||||
findutils = pkgs.findutils.crossDrv;
|
findutils = pkgs.findutils.crossDrv;
|
||||||
@ -72,9 +71,8 @@ let
|
|||||||
gnumake = pkgs.gnumake.crossDrv;
|
gnumake = pkgs.gnumake.crossDrv;
|
||||||
patch = pkgs.patch.crossDrv;
|
patch = pkgs.patch.crossDrv;
|
||||||
patchelf = pkgs.patchelf.crossDrv;
|
patchelf = pkgs.patchelf.crossDrv;
|
||||||
replace = pkgs.replace.crossDrv;
|
gcc = pkgs.gcc.cc.crossDrv;
|
||||||
gcc = pkgs.gcc;
|
gmpxx = pkgs.gmpxx.crossDrv;
|
||||||
gmp = pkgs.gmp.crossDrv;
|
|
||||||
mpfr = pkgs.mpfr.crossDrv;
|
mpfr = pkgs.mpfr.crossDrv;
|
||||||
ppl = pkgs.ppl.crossDrv;
|
ppl = pkgs.ppl.crossDrv;
|
||||||
cloogppl = pkgs.cloogppl.crossDrv;
|
cloogppl = pkgs.cloogppl.crossDrv;
|
||||||
@ -83,25 +81,38 @@ let
|
|||||||
isl = pkgs.isl.crossDrv;
|
isl = pkgs.isl.crossDrv;
|
||||||
libmpc = pkgs.libmpc.crossDrv;
|
libmpc = pkgs.libmpc.crossDrv;
|
||||||
binutils = pkgs.binutils.crossDrv;
|
binutils = pkgs.binutils.crossDrv;
|
||||||
klibc = pkgs.linuxPackages.klibc.crossDrv;
|
libelf = pkgs.libelf.crossDrv;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
curlStatic = import <nixpkgs/pkgs/tools/networking/curl> {
|
# We want coreutils without ACL support.
|
||||||
stdenv = pkgsuclibc.stdenv;
|
coreutilsMinimal = (pkgs.coreutils.override (args: {
|
||||||
inherit (pkgsuclibc) fetchurl;
|
aclSupport = false;
|
||||||
|
})).crossDrv;
|
||||||
|
|
||||||
|
curlMinimal = (pkgs.curl.override {
|
||||||
zlibSupport = false;
|
zlibSupport = false;
|
||||||
sslSupport = false;
|
sslSupport = false;
|
||||||
linkStatic = true;
|
scpSupport = false;
|
||||||
};
|
}).crossDrv;
|
||||||
|
|
||||||
bzip2Static = import <nixpkgs/pkgs/tools/compression/bzip2> {
|
busyboxMinimal = (pkgs.busybox.override {
|
||||||
stdenv = pkgsuclibc.stdenv;
|
# TBD: uClibc is broken.
|
||||||
inherit (pkgsuclibc) fetchurl;
|
# useUclibc = true;
|
||||||
linkStatic = true;
|
enableStatic = true;
|
||||||
};
|
enableMinimal = true;
|
||||||
|
extraConfig = ''
|
||||||
|
CONFIG_ASH y
|
||||||
|
CONFIG_ASH_BUILTIN_ECHO y
|
||||||
|
CONFIG_ASH_BUILTIN_TEST y
|
||||||
|
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
||||||
|
CONFIG_MKDIR y
|
||||||
|
CONFIG_TAR y
|
||||||
|
CONFIG_UNXZ y
|
||||||
|
'';
|
||||||
|
}).crossDrv;
|
||||||
|
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
|
||||||
@ -128,6 +139,8 @@ rec {
|
|||||||
cp -d ${glibc}/lib/libpthread*.so* $out/lib
|
cp -d ${glibc}/lib/libpthread*.so* $out/lib
|
||||||
cp -d ${glibc}/lib/libnsl*.so* $out/lib
|
cp -d ${glibc}/lib/libnsl*.so* $out/lib
|
||||||
cp -d ${glibc}/lib/libutil*.so* $out/lib
|
cp -d ${glibc}/lib/libutil*.so* $out/lib
|
||||||
|
cp -d ${glibc}/lib/libnss*.so* $out/lib
|
||||||
|
cp -d ${glibc}/lib/libresolv*.so* $out/lib
|
||||||
cp -d ${glibc}/lib/crt?.o $out/lib
|
cp -d ${glibc}/lib/crt?.o $out/lib
|
||||||
|
|
||||||
cp -rL ${glibc}/include $out
|
cp -rL ${glibc}/include $out
|
||||||
@ -140,7 +153,7 @@ rec {
|
|||||||
mv $out/include $out/include-glibc
|
mv $out/include $out/include-glibc
|
||||||
|
|
||||||
# Copy coreutils, bash, etc.
|
# Copy coreutils, bash, etc.
|
||||||
cp ${coreutils_}/bin/* $out/bin
|
cp ${coreutilsMinimal}/bin/* $out/bin
|
||||||
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
|
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
|
||||||
|
|
||||||
cp ${bash}/bin/bash $out/bin
|
cp ${bash}/bin/bash $out/bin
|
||||||
@ -148,7 +161,7 @@ rec {
|
|||||||
cp ${findutils}/bin/xargs $out/bin
|
cp ${findutils}/bin/xargs $out/bin
|
||||||
cp -d ${diffutils}/bin/* $out/bin
|
cp -d ${diffutils}/bin/* $out/bin
|
||||||
cp -d ${gnused}/bin/* $out/bin
|
cp -d ${gnused}/bin/* $out/bin
|
||||||
cp -d ${gnugrep}/bin/* $out/bin
|
cp -d ${gnugrep}/bin/grep $out/bin
|
||||||
cp ${gawk}/bin/gawk $out/bin
|
cp ${gawk}/bin/gawk $out/bin
|
||||||
cp -d ${gawk}/bin/awk $out/bin
|
cp -d ${gawk}/bin/awk $out/bin
|
||||||
cp ${gnutar}/bin/tar $out/bin
|
cp ${gnutar}/bin/tar $out/bin
|
||||||
@ -157,17 +170,18 @@ rec {
|
|||||||
cp -d ${gnumake}/bin/* $out/bin
|
cp -d ${gnumake}/bin/* $out/bin
|
||||||
cp -d ${patch}/bin/* $out/bin
|
cp -d ${patch}/bin/* $out/bin
|
||||||
cp ${patchelf}/bin/* $out/bin
|
cp ${patchelf}/bin/* $out/bin
|
||||||
cp ${replace}/bin/* $out/bin
|
cp ${curlMinimal}/bin/curl $out/bin
|
||||||
|
cp -d ${curlMinimal}/lib/libcurl* $out/lib
|
||||||
|
|
||||||
cp -d ${gnugrep.pcre.crossDrv}/lib/libpcre*.so* $out/lib # needed by grep
|
cp -d ${gnugrep.pcre.crossDrv}/lib/libpcre*.so* $out/lib # needed by grep
|
||||||
|
|
||||||
# Copy what we need of GCC.
|
# Copy what we need of GCC.
|
||||||
cp -d ${gcc.cc.crossDrv}/bin/gcc $out/bin
|
cp -d ${gcc}/bin/gcc $out/bin
|
||||||
cp -d ${gcc.cc.crossDrv}/bin/cpp $out/bin
|
cp -d ${gcc}/bin/cpp $out/bin
|
||||||
cp -d ${gcc.cc.crossDrv}/bin/g++ $out/bin
|
cp -d ${gcc}/bin/g++ $out/bin
|
||||||
cp -d ${gcc.cc.crossDrv}/lib*/libgcc_s.so* $out/lib
|
cp -d ${gcc}/lib*/libgcc_s.so* $out/lib
|
||||||
cp -d ${gcc.cc.crossDrv}/lib*/libstdc++.so* $out/lib
|
cp -d ${gcc}/lib*/libstdc++.so* $out/lib
|
||||||
cp -rd ${gcc.cc.crossDrv}/lib/gcc $out/lib
|
cp -rd ${gcc}/lib/gcc $out/lib
|
||||||
chmod -R u+w $out/lib
|
chmod -R u+w $out/lib
|
||||||
rm -f $out/lib/gcc/*/*/include*/linux
|
rm -f $out/lib/gcc/*/*/include*/linux
|
||||||
rm -f $out/lib/gcc/*/*/include*/sound
|
rm -f $out/lib/gcc/*/*/include*/sound
|
||||||
@ -175,26 +189,31 @@ rec {
|
|||||||
rm -f $out/lib/gcc/*/*/include-fixed/asm
|
rm -f $out/lib/gcc/*/*/include-fixed/asm
|
||||||
rm -rf $out/lib/gcc/*/*/plugin
|
rm -rf $out/lib/gcc/*/*/plugin
|
||||||
#rm -f $out/lib/gcc/*/*/*.a
|
#rm -f $out/lib/gcc/*/*/*.a
|
||||||
cp -rd ${gcc.cc.crossDrv}/libexec/* $out/libexec
|
cp -rd ${gcc}/libexec/* $out/libexec
|
||||||
|
chmod -R u+w $out/libexec
|
||||||
|
rm -rf $out/libexec/gcc/*/*/plugin
|
||||||
mkdir $out/include
|
mkdir $out/include
|
||||||
cp -rd ${gcc.cc.crossDrv}/include/c++ $out/include
|
cp -rd ${gcc}/include/c++ $out/include
|
||||||
chmod -R u+w $out/include
|
chmod -R u+w $out/include
|
||||||
rm -rf $out/include/c++/*/ext/pb_ds
|
rm -rf $out/include/c++/*/ext/pb_ds
|
||||||
rm -rf $out/include/c++/*/ext/parallel
|
rm -rf $out/include/c++/*/ext/parallel
|
||||||
|
|
||||||
cp -d ${gmp}/lib/libgmp*.so* $out/lib
|
cp -d ${gmpxx}/lib/libgmp*.so* $out/lib
|
||||||
cp -d ${mpfr}/lib/libmpfr*.so* $out/lib
|
cp -d ${mpfr}/lib/libmpfr*.so* $out/lib
|
||||||
cp -d ${cloogppl}/lib/libcloog*.so* $out/lib
|
|
||||||
cp -d ${cloog}/lib/libcloog*.so* $out/lib
|
|
||||||
cp -d ${ppl}/lib/libppl*.so* $out/lib
|
|
||||||
cp -d ${isl}/lib/libisl*.so* $out/lib
|
|
||||||
cp -d ${libmpc}/lib/libmpc*.so* $out/lib
|
cp -d ${libmpc}/lib/libmpc*.so* $out/lib
|
||||||
cp -d ${zlib}/lib/libz.so* $out/lib
|
cp -d ${zlib}/lib/libz.so* $out/lib
|
||||||
|
cp -d ${libelf}/lib/libelf.so* $out/lib
|
||||||
|
|
||||||
|
# TBD: Why are these needed for cross but not native tools?
|
||||||
|
cp -d ${cloogppl}/lib/libcloog*.so* $out/lib
|
||||||
|
cp -d ${cloog}/lib/libcloog*.so* $out/lib
|
||||||
|
cp -d ${isl}/lib/libisl*.so* $out/lib
|
||||||
|
|
||||||
# Copy binutils.
|
# Copy binutils.
|
||||||
for i in as ld ar ranlib nm strip readelf objdump; do
|
for i in as ld ar ranlib nm strip readelf objdump; do
|
||||||
cp ${binutils}/bin/$i $out/bin
|
cp ${binutils}/bin/$i $out/bin
|
||||||
done
|
done
|
||||||
|
cp -d ${binutils}/lib/lib*.so* $out/lib
|
||||||
|
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
|
|
||||||
@ -209,26 +228,16 @@ rec {
|
|||||||
nuke-refs $out/bin/*
|
nuke-refs $out/bin/*
|
||||||
nuke-refs $out/lib/*
|
nuke-refs $out/lib/*
|
||||||
nuke-refs $out/libexec/gcc/*/*/*
|
nuke-refs $out/libexec/gcc/*/*/*
|
||||||
nuke-refs $out/libexec/gcc/*/*/*/*
|
|
||||||
|
|
||||||
mkdir $out/.pack
|
mkdir $out/.pack
|
||||||
mv $out/* $out/.pack
|
mv $out/* $out/.pack
|
||||||
mv $out/.pack $out/pack
|
mv $out/.pack $out/pack
|
||||||
|
|
||||||
mkdir $out/on-server
|
mkdir $out/on-server
|
||||||
(cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
|
tar cvfJ $out/on-server/bootstrap-tools.tar.xz -C $out/pack .
|
||||||
|
cp ${busyboxMinimal}/bin/busybox $out/on-server
|
||||||
mkdir $out/in-nixpkgs
|
chmod u+w $out/on-server/busybox
|
||||||
cp ${klibc}/lib/klibc/bin.static/sh $out/in-nixpkgs
|
nuke-refs $out/on-server/busybox
|
||||||
cp ${klibc}/lib/klibc/bin.static/cpio $out/in-nixpkgs
|
|
||||||
cp ${klibc}/lib/klibc/bin.static/mkdir $out/in-nixpkgs
|
|
||||||
cp ${klibc}/lib/klibc/bin.static/ln $out/in-nixpkgs
|
|
||||||
cp ${curlStatic.crossDrv}/bin/curl $out/in-nixpkgs
|
|
||||||
cp ${bzip2Static.crossDrv}/bin/bzip2 $out/in-nixpkgs
|
|
||||||
chmod u+w $out/in-nixpkgs/*
|
|
||||||
$crossConfig-strip $out/in-nixpkgs/*
|
|
||||||
nuke-refs $out/in-nixpkgs/*
|
|
||||||
bzip2 $out/in-nixpkgs/curl
|
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
# The result should not contain any references (store paths) so
|
# The result should not contain any references (store paths) so
|
||||||
@ -237,33 +246,10 @@ rec {
|
|||||||
allowedReferences = [];
|
allowedReferences = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
unpack =
|
|
||||||
|
); in {
|
||||||
stdenv.mkDerivation {
|
armv5tel = buildFor "armv5tel";
|
||||||
name = "unpack";
|
armv6l = buildFor "armv6l";
|
||||||
|
armv7l = buildFor "armv7l";
|
||||||
buildCommand = ''
|
|
||||||
${build}/in-nixpkgs/mkdir $out
|
|
||||||
${build}/in-nixpkgs/bzip2 -d < ${build}/on-server/bootstrap-tools.cpio.bz2 | (cd $out && ${build}/in-nixpkgs/cpio -V -i)
|
|
||||||
|
|
||||||
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
|
|
||||||
echo patching $i
|
|
||||||
if ! test -L $i; then
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
|
|
||||||
$out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath $i
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Fix the libc linker script.
|
|
||||||
for i in $out/lib/libc.so; do
|
|
||||||
cat $i | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $i.tmp
|
|
||||||
mv $i.tmp $i
|
|
||||||
done
|
|
||||||
''; # " */
|
|
||||||
|
|
||||||
allowedReferences = ["out"];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -154,92 +154,12 @@ rec {
|
|||||||
allowedReferences = [];
|
allowedReferences = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test = ((import ./default.nix) {
|
||||||
unpack =
|
|
||||||
|
|
||||||
derivation {
|
|
||||||
name = "unpack";
|
|
||||||
inherit system;
|
inherit system;
|
||||||
builder = "${build}/on-server/busybox";
|
|
||||||
args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
customBootstrapFiles = {
|
||||||
export PATH=${build}/on-server:$out/bin
|
busybox = "${build}/on-server/busybox";
|
||||||
|
bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz";
|
||||||
busybox mkdir $out
|
|
||||||
< ${build}/on-server/bootstrap-tools.tar.xz busybox unxz | busybox tar x -C $out
|
|
||||||
|
|
||||||
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
|
|
||||||
if [ -L "$i" ]; then continue; fi
|
|
||||||
if [ -z "''${i##*/liblto*}" ]; then continue; fi
|
|
||||||
echo patching "$i"
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
|
|
||||||
$out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath "$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
for i in $out/lib/libpcre*; do
|
|
||||||
if [ -L "$i" ]; then continue; fi
|
|
||||||
echo patching "$i"
|
|
||||||
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Fix the libc linker script.
|
|
||||||
for i in $out/lib/libc.so; do
|
|
||||||
cat $i | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $i.tmp
|
|
||||||
mv $i.tmp $i
|
|
||||||
done
|
|
||||||
''; # " */
|
|
||||||
|
|
||||||
allowedReferences = ["out"];
|
|
||||||
};
|
};
|
||||||
|
}).testBootstrapTools;
|
||||||
|
|
||||||
test =
|
|
||||||
|
|
||||||
derivation {
|
|
||||||
name = "test";
|
|
||||||
inherit system;
|
|
||||||
builder = "${build}/on-server/busybox";
|
|
||||||
args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
export PATH=${unpack}/bin
|
|
||||||
ls -l
|
|
||||||
mkdir $out
|
|
||||||
mkdir $out/bin
|
|
||||||
sed --version
|
|
||||||
find --version
|
|
||||||
diff --version
|
|
||||||
patch --version
|
|
||||||
make --version
|
|
||||||
awk --version
|
|
||||||
grep --version
|
|
||||||
gcc --version
|
|
||||||
curl --version
|
|
||||||
|
|
||||||
ldlinux=$(echo ${unpack}/lib/ld-linux*.so.2)
|
|
||||||
|
|
||||||
export CPP="cpp -idirafter ${unpack}/include-glibc -B${unpack}"
|
|
||||||
export CC="gcc -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
|
|
||||||
export CXX="g++ -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
|
|
||||||
|
|
||||||
echo '#include <stdio.h>' >> foo.c
|
|
||||||
echo '#include <limits.h>' >> foo.c
|
|
||||||
echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
|
|
||||||
$CC -o $out/bin/foo foo.c
|
|
||||||
$out/bin/foo
|
|
||||||
|
|
||||||
echo '#include <iostream>' >> bar.cc
|
|
||||||
echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
|
|
||||||
$CXX -v -o $out/bin/bar bar.cc
|
|
||||||
$out/bin/bar
|
|
||||||
|
|
||||||
tar xvf ${hello.src}
|
|
||||||
cd hello-*
|
|
||||||
./configure --prefix=$out
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
''; # */
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
set -e
|
|
||||||
|
|
||||||
# Unpack the bootstrap tools tarball.
|
|
||||||
echo Unpacking the bootstrap tools...
|
|
||||||
$mkdir $out
|
|
||||||
$bzip2 -d < $tarball | (cd $out && $cpio -V -i)
|
|
||||||
|
|
||||||
# Set the ELF interpreter / RPATH in the bootstrap binaries.
|
|
||||||
echo Patching the bootstrap tools...
|
|
||||||
|
|
||||||
# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
|
|
||||||
# use a copy of patchelf.
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.? $out/bin/cp $out/bin/patchelf .
|
|
||||||
|
|
||||||
for i in $out/bin/* $out/libexec/gcc/*/*/* $out/lib/librt*; do
|
|
||||||
if test ${i%.la} != $i; then continue; fi
|
|
||||||
if test ${i%*.so*} != $i; then continue; fi
|
|
||||||
if ! test -f $i; then continue; fi
|
|
||||||
if test -L $i; then continue; fi
|
|
||||||
echo patching $i
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.? \
|
|
||||||
$out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.? --set-rpath $out/lib --force-rpath $i
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.? \
|
|
||||||
$out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.? --set-rpath $out/lib --force-rpath $i
|
|
||||||
done
|
|
||||||
for i in $out/lib/librt* $out/lib/libcloog* $out/lib/libppl* $out/lib/libgmp*; do
|
|
||||||
if ! test -f $i; then continue; fi
|
|
||||||
if test -L $i; then continue; fi
|
|
||||||
echo patching $i
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.? \
|
|
||||||
$out/bin/patchelf --set-rpath $out/lib --force-rpath $i
|
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.? \
|
|
||||||
$out/bin/patchelf --set-rpath $out/lib --force-rpath $i
|
|
||||||
done
|
|
||||||
|
|
||||||
# Fix the libc linker script.
|
|
||||||
export PATH=$out/bin
|
|
||||||
cat $out/lib/libc.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libc.so.tmp
|
|
||||||
mv $out/lib/libc.so.tmp $out/lib/libc.so
|
|
||||||
cat $out/lib/libpthread.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libpthread.so.tmp
|
|
||||||
mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so
|
|
||||||
|
|
||||||
# Provide some additional symlinks.
|
|
||||||
ln -s bash $out/bin/sh
|
|
||||||
ln -s bzip2 $out/bin/bunzip2
|
|
||||||
|
|
||||||
# Mimic the gunzip script as in gzip installations
|
|
||||||
cat > $out/bin/gunzip <<EOF
|
|
||||||
#!$out/bin/sh
|
|
||||||
exec $out/bin/gzip -d "\$@"
|
|
||||||
EOF
|
|
||||||
chmod +x $out/bin/gunzip
|
|
||||||
|
|
||||||
# fetchurl needs curl.
|
|
||||||
bzip2 -d < $curl > $out/bin/curl
|
|
||||||
chmod +x $out/bin/curl
|
|
@ -22,11 +22,11 @@ for i in $out/bin/* $out/libexec/gcc/*/*/*; do
|
|||||||
if [ -L "$i" ]; then continue; fi
|
if [ -L "$i" ]; then continue; fi
|
||||||
if [ -z "${i##*/liblto*}" ]; then continue; fi
|
if [ -z "${i##*/liblto*}" ]; then continue; fi
|
||||||
echo patching "$i"
|
echo patching "$i"
|
||||||
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
|
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
|
||||||
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
|
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in $out/lib/libpcre*; do
|
for i in $out/lib/librt-*.so $out/lib/libpcre*; do
|
||||||
if [ -L "$i" ]; then continue; fi
|
if [ -L "$i" ]; then continue; fi
|
||||||
echo patching "$i"
|
echo patching "$i"
|
||||||
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
|
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
|
||||||
|
@ -72,6 +72,7 @@ let
|
|||||||
platforms = (import ./platforms.nix);
|
platforms = (import ./platforms.nix);
|
||||||
in
|
in
|
||||||
if system == "armv6l-linux" then platforms.raspberrypi
|
if system == "armv6l-linux" then platforms.raspberrypi
|
||||||
|
else if system == "armv7l-linux" then platforms.beaglebone
|
||||||
else if system == "armv5tel-linux" then platforms.sheevaplug
|
else if system == "armv5tel-linux" then platforms.sheevaplug
|
||||||
else if system == "mips64el-linux" then platforms.fuloong2f_n32
|
else if system == "mips64el-linux" then platforms.fuloong2f_n32
|
||||||
else if system == "x86_64-linux" then platforms.pc64
|
else if system == "x86_64-linux" then platforms.pc64
|
||||||
@ -8501,7 +8502,7 @@ let
|
|||||||
cross = assert crossSystem != null; crossSystem;
|
cross = assert crossSystem != null; crossSystem;
|
||||||
});
|
});
|
||||||
|
|
||||||
linuxHeaders26Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.6.32.nix {
|
linuxHeaders26Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/3.12.nix {
|
||||||
inherit stdenv fetchurl perl;
|
inherit stdenv fetchurl perl;
|
||||||
cross = assert crossSystem != null; crossSystem;
|
cross = assert crossSystem != null; crossSystem;
|
||||||
});
|
});
|
||||||
|
@ -372,4 +372,21 @@ rec {
|
|||||||
uboot = null;
|
uboot = null;
|
||||||
gcc.arch = "loongson2f";
|
gcc.arch = "loongson2f";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beaglebone = {
|
||||||
|
name = "beaglebone";
|
||||||
|
kernelMajor = "2.6";
|
||||||
|
kernelHeadersBaseConfig = "omap2plus_defconfig";
|
||||||
|
kernelBaseConfig = "omap2plus_defconfig";
|
||||||
|
kernelArch = "arm";
|
||||||
|
kernelAutoModules = false;
|
||||||
|
kernelExtraConfig = ""; # TBD kernel config
|
||||||
|
kernelTarget = "zImage";
|
||||||
|
uboot = null;
|
||||||
|
gcc = {
|
||||||
|
arch = "armv7-a";
|
||||||
|
fpu = "vfpv3-d16";
|
||||||
|
float = "hard";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user