Merge branch 'pi-stdenv-updates' into stdenv-updates

This adds raspberry pi support. I've almost tested all.

Should fix https://github.com/NixOS/nixpkgs/issues/234
This commit is contained in:
Lluís Batlle i Rossell 2012-12-31 16:03:16 +00:00
commit d16f4bb3ed
17 changed files with 668 additions and 153 deletions

View File

@ -28,7 +28,7 @@ if test -z "$nativeLibc"; then
echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
echo "-L$libc/lib -rpath $libc/lib -rpath-link $libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld

View File

@ -31,7 +31,7 @@ if test -z "$nativeLibc"; then
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld
# (the *last* value counts, so ours should come first).
echo "-dynamic-linker $dynamicLinker" > $out/nix-support/libc-ldflags-before
echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before
fi
if test -n "$nativeTools"; then

View File

@ -85,7 +85,8 @@ stdenv.mkDerivation {
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
if stdenv.isArm then "ld-linux.so.3" else
# ARM with a wildcard, which can be "" or "-armhf".
if stdenv.isArm then "ld-linux*.so.3" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
if stdenv.system == "mips64el-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform")

View File

@ -87,68 +87,90 @@ let version = "4.6.3";
javaAwtGtk = langJava && gtk != null;
/* Cross-gcc settings */
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
crossMingw = (cross != null && cross.libc == "msvcrt");
/* Platform flags */
platformFlags = let
gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv;
gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv;
gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv;
gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv;
gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
in
(withArch +
withCpu +
withAbi +
withFpu +
withFloat);
crossConfigureFlags =
"--target=${cross.config}" +
withArch +
withCpu +
withAbi +
(if crossMingw && crossStageStatic then
" --with-headers=${libcCross}/include" +
" --with-gcc" +
" --with-gnu-as" +
" --with-gnu-ld" +
" --with-gnu-ld" +
" --disable-shared" +
" --disable-nls" +
" --disable-debug" +
" --enable-sjlj-exceptions" +
" --enable-threads=win32" +
" --disable-win32-registry"
else if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-libquadmath" +
" --disable-shared" +
" --disable-decimal-float" # libdecnumber requires libc
else
" --with-headers=${libcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
(if crossMingw then
" --enable-threads=win32" +
" --enable-sjlj-exceptions" +
" --enable-hash-synchronization" +
" --disable-libssp" +
" --disable-nls" +
" --with-dwarf2" +
# I think noone uses shared gcc libs in mingw, so we better do the same.
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
/* Cross-gcc settings */
crossMingw = (cross != null && cross.libc == "msvcrt");
crossConfigureFlags = let
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
in
"--target=${cross.config}" +
withArch +
withCpu +
withAbi +
withFpu +
(if crossMingw && crossStageStatic then
" --with-headers=${libcCross}/include" +
" --with-gcc" +
" --with-gnu-as" +
" --with-gnu-ld" +
" --with-gnu-ld" +
" --disable-shared" +
(if cross.config == "x86_64-w64-mingw32" then
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else "")
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
" --disable-libgomp" else "") +
" --enable-threads=posix" +
" --enable-nls" +
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
);
" --disable-nls" +
" --disable-debug" +
" --enable-sjlj-exceptions" +
" --enable-threads=win32" +
" --disable-win32-registry"
else if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-libquadmath" +
" --disable-shared" +
" --disable-decimal-float" # libdecnumber requires libc
else
" --with-headers=${libcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
(if crossMingw then
" --enable-threads=win32" +
" --enable-sjlj-exceptions" +
" --enable-hash-synchronization" +
" --disable-libssp" +
" --disable-nls" +
" --with-dwarf2" +
# I think noone uses shared gcc libs in mingw, so we better do the same.
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
" --disable-shared" +
(if cross.config == "x86_64-w64-mingw32" then
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else "")
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
" --disable-libgomp" else "") +
" --enable-threads=posix" +
" --enable-nls" +
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
);
stageNameAddon = if crossStageStatic then "-stage-static" else
"-stage-final";
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
@ -291,12 +313,11 @@ stdenv.mkDerivation ({
)
)
}
${ # Trick that should be taken out once we have a mips64el-linux not loongson2f
if cross == null && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" else ""}
${if langAda then " --enable-libada" else ""}
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
${if !bootstrap then "--disable-bootstrap" else ""}
${if cross == null then platformFlags else ""}
";
targetConfig = if cross != null then cross.config else null;

View File

@ -71,7 +71,7 @@ if test "$noSysDirs" = "1"; then
unset CPATH
if test -z "$crossStageStatic"; then
EXTRA_TARGET_CFLAGS="-B${libcCross}/lib -idirafter ${libcCross}/include"
EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib"
EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib -Wl,-rpath,${libcCross}/lib -Wl,-rpath-link,${libcCross}/lib"
fi
else
if test -z "$NIX_GCC_CROSS"; then
@ -95,7 +95,9 @@ if test "$noSysDirs" = "1"; then
NIX_FIXINC_DUMMY_CROSS=$(cat $NIX_GCC_CROSS/nix-support/orig-libc)/include
# The path to the Glibc binaries such as `crti.o'.
glibc_libdir="$(cat $NIX_GCC_CROSS/nix-support/orig-libc)/lib"
glibc_dir="$(cat $NIX_GCC_CROSS/nix-support/orig-libc)"
glibc_libdir="$glibc_dir/lib"
configureFlags="$configureFlags --with-native-system-header-dir=$glibc_dir/include"
extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"

View File

@ -85,71 +85,99 @@ let version = "4.7.2";
javaAwtGtk = langJava && gtk != null;
/* Cross-gcc settings */
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
crossMingw = (cross != null && cross.libc == "msvcrt");
/* Platform flags */
platformFlags = let
gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv;
gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv;
gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv;
gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv;
gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv;
gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
in
(withArch +
withCpu +
withAbi +
withFpu +
withFloat +
withMode);
crossConfigureFlags =
"--target=${cross.config}" +
withArch +
withCpu +
withAbi +
withMode +
(if crossMingw && crossStageStatic then
" --with-headers=${libcCross}/include" +
" --with-gcc" +
" --with-gnu-as" +
" --with-gnu-ld" +
" --with-gnu-ld" +
" --disable-shared" +
" --disable-nls" +
" --disable-debug" +
" --enable-sjlj-exceptions" +
" --enable-threads=win32" +
" --disable-win32-registry"
else if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-libquadmath" +
" --disable-shared" +
" --disable-decimal-float" # libdecnumber requires libc
else
" --with-headers=${libcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
(if crossMingw then
" --enable-threads=win32" +
" --enable-sjlj-exceptions" +
" --enable-hash-synchronization" +
" --disable-libssp" +
" --disable-nls" +
" --with-dwarf2" +
# I think noone uses shared gcc libs in mingw, so we better do the same.
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
/* Cross-gcc settings */
crossMingw = (cross != null && cross.libc == "msvcrt");
crossConfigureFlags = let
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross;
gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
in
"--target=${cross.config}" +
withArch +
withCpu +
withAbi +
withFpu +
withFloat +
withMode +
(if crossMingw && crossStageStatic then
" --with-headers=${libcCross}/include" +
" --with-gcc" +
" --with-gnu-as" +
" --with-gnu-ld" +
" --with-gnu-ld" +
" --disable-shared" +
(if cross.config == "x86_64-w64-mingw32" then
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else "")
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
" --disable-libgomp" else "") +
" --enable-threads=posix" +
" --enable-nls" +
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
);
" --disable-nls" +
" --disable-debug" +
" --enable-sjlj-exceptions" +
" --enable-threads=win32" +
" --disable-win32-registry"
else if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-libquadmath" +
" --disable-shared" +
" --disable-decimal-float" # libdecnumber requires libc
else
" --with-headers=${libcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
(if crossMingw then
" --enable-threads=win32" +
" --enable-sjlj-exceptions" +
" --enable-hash-synchronization" +
" --disable-libssp" +
" --disable-nls" +
" --with-dwarf2" +
# I think noone uses shared gcc libs in mingw, so we better do the same.
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
" --disable-shared" +
(if cross.config == "x86_64-w64-mingw32" then
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else "")
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
" --disable-libgomp" else "") +
" --enable-threads=posix" +
" --enable-nls" +
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
);
stageNameAddon = if crossStageStatic then "-stage-static" else
"-stage-final";
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
@ -296,12 +324,11 @@ stdenv.mkDerivation ({
${if (stdenv ? glibc && cross == null)
then " --with-native-system-header-dir=${stdenv.glibc}/include"
else ""}
${ # Trick that should be taken out once we have a mips64el-linux not loongson2f
if cross == null && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" else ""}
${if langAda then " --enable-libada" else ""}
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
${if !bootstrap then "--disable-bootstrap" else ""}
${if cross == null then platformFlags else ""}
";
targetConfig = if cross != null then cross.config else null;
@ -315,7 +342,18 @@ stdenv.mkDerivation ({
then "install-strip"
else "install";
crossAttrs = {
crossAttrs = let
xgccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null stdenv.cross;
xgccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null stdenv.cross;
xgccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null stdenv.cross;
xgccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null stdenv.cross;
xgccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null stdenv.cross;
xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else "";
xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else "";
xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else "";
xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else "";
xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else "";
in {
AR = "${stdenv.cross.config}-ar";
LD = "${stdenv.cross.config}-ld";
CC = "${stdenv.cross.config}-gcc";
@ -354,9 +392,12 @@ stdenv.mkDerivation ({
)
}
${if langAda then " --enable-libada" else ""}
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
--target=${stdenv.cross.config}
${xwithArch}
${xwithCpu}
${xwithAbi}
${xwithFpu}
${xwithFloat}
'';
buildFlags = "";
};

View File

@ -120,11 +120,20 @@ stdenv.mkDerivation ({
&& cross.platform.kernelMajor == "2.6") [
"--enable-kernel=2.6.0"
"--with-__thread"
] ++ stdenv.lib.optionals stdenv.isArm [
] ++ stdenv.lib.optionals (cross == null &&
(stdenv.system == "armv5tel-linux")) [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
# To avoid linking with -lgcc_s (dynamic link)
# so the glibc does not depend on its compiler store path
"libc_cv_as_needed=no"
] ++ stdenv.lib.optionals (cross == null && stdenv.platform.name == "raspberrypi") [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--with-fp"
# To avoid linking with -lgcc_s (dynamic link)
# so the glibc does not depend on its compiler store path
"libc_cv_as_needed=no"

View File

@ -79,10 +79,10 @@ stdenv.mkDerivation ({
&& cross.platform.kernelMajor == "2.6") [
"--enable-kernel=2.6.0"
"--with-__thread"
] ++ stdenv.lib.optionals stdenv.isArm [
] ++ stdenv.lib.optionals (cross == null && stdenv.isArm) [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
# To avoid linking with -lgcc_s (dynamic link)
# so the glibc does not depend on its compiler store path
"libc_cv_as_needed=no"

View File

@ -0,0 +1,42 @@
args @ {
stdenv, fetchgit, extraConfig ? "" , perl, mktemp, module_init_tools, ...
}:
let
configWithPlatform = kernelPlatform :
''
${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
${extraConfig}
'';
in
import ./generic.nix (
rec {
version = "3.6.y";
testing = false;
preConfigure = ''
substituteInPlace scripts/depmod.sh --replace '-b "$INSTALL_MOD_PATH"' ""
'';
src = fetchgit {
url = https://github.com/raspberrypi/linux;
rev = "6e1f8bce970043a658d15f9350eb85152fd5fc4e";
sha256 = "";
};
config = configWithPlatform stdenv.platform;
configCross = configWithPlatform stdenv.cross.platform;
features.iwlwifi = true;
#features.efiBootStub = true;
#features.needsCifsUtils = true;
#features.canDisableNetfilterConntrackHelpers = true;
#features.netfilterRPFilter = true;
fetchurl = null;
}
// removeAttrs args ["extraConfig"]
)

View File

@ -56,6 +56,7 @@ rec {
if stdenvType == "i686-linux" then stdenvLinux else
if stdenvType == "x86_64-linux" then stdenvLinux else
if stdenvType == "armv5tel-linux" then stdenvLinux else
if stdenvType == "armv6l-linux" then stdenvLinux else
if stdenvType == "armv7l-linux" then stdenvLinux else
if stdenvType == "mips64el-linux" then stdenvLinux else
if stdenvType == "powerpc-linux" then /* stdenvLinux */ stdenvNative else

View File

@ -88,6 +88,7 @@ let
|| result.system == "x86_64-linux"
|| result.system == "powerpc-linux"
|| result.system == "armv5tel-linux"
|| result.system == "armv6l-linux"
|| result.system == "armv7l-linux"
|| result.system == "mips64el-linux";
isGNU = result.system == "i686-gnu"; # GNU/Hurd
@ -121,6 +122,7 @@ let
isMips = result.system == "mips-linux"
|| result.system == "mips64el-linux";
isArm = result.system == "armv5tel-linux"
|| result.system == "armv6l-linux"
|| result.system == "armv7l-linux";
# Utility function: allow stdenv to be easily regenerated with

View File

@ -0,0 +1,15 @@
{
sh = ../armv5tel/sh;
bzip2 = ../armv5tel/bzip2;
mkdir = ../armv5tel/mkdir;
cpio = ../armv5tel/cpio;
ln = ../armv5tel/ln;
curl = ../armv5tel/curl.bz2;
bootstrapTools = {
# Built from make-bootstrap-tools-crosspi.nix
# nixpkgs rev eb0422e4c1263a65a9b2b954fe10a1e03d67db3e
url = http://viric.name/tmp/nix/pi/bootstrap-tools.cpio.bz2;
sha256 = "1zb27x5h54k51yrvn3sy4wb1qprx8iv2kfbgklxwc0mcxp9b7ccd";
};
}

View File

@ -16,6 +16,7 @@ rec {
else if system == "x86_64-linux" then import ./bootstrap/x86_64
else if system == "powerpc-linux" then import ./bootstrap/powerpc
else if system == "armv5tel-linux" then import ./bootstrap/armv5tel
else if system == "armv6l-linux" then import ./bootstrap/armv6l
else if system == "armv7l-linux" then import ./bootstrap/armv5tel
else if system == "mips64el-linux" then import ./bootstrap/loongson2f
else abort "unsupported platform for the pure Linux stdenv";
@ -57,7 +58,7 @@ rec {
builder = bootstrapFiles.sh;
args =
if system == "armv5tel-linux"
if (system == "armv5tel-linux" || system == "armv6l-linux")
then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
else [ ./scripts/unpack-bootstrap-tools.sh ];
@ -273,7 +274,7 @@ rec {
inherit (stdenvLinuxBoot3Pkgs) binutils;
inherit (stdenvLinuxBoot4Pkgs) coreutils;
libc = stdenvLinuxGlibc;
gcc = stdenvLinuxBoot3Pkgs.gcc.gcc;
gcc = stdenvLinuxBoot4.gcc.gcc;
shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash";
name = "";
};

View File

@ -0,0 +1,269 @@
{system ? builtins.currentSystem}:
let
pkgsFun = import ../../top-level/all-packages.nix;
pkgsNoParams = pkgsFun {};
raspberrypiCrossSystem = {
crossSystem = {
config = "armv6l-unknown-linux-gnueabi";
bigEndian = false;
arch = "arm";
float = "hard";
fpu = "vfp";
withTLS = true;
libc = "glibc";
platform = pkgsNoParams.platforms.raspberrypi;
openssl.system = "linux-generic32";
gcc = {
arch = "armv6";
fpu = "vfp";
float = "hard";
};
};
};
raspberrypiCrossSystemUclibc = {
crossSystem = {
config = "armv6l-unknown-linux-gnueabi";
bigEndian = false;
arch = "arm";
float = "hard";
fpu = "vfp";
withTLS = true;
libc = "uclibc";
platform = pkgsNoParams.platforms.raspberrypi;
openssl.system = "linux-generic32";
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);
pkgs = pkgsFun ({inherit system;} // raspberrypiCrossSystem);
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;
bash = pkgs.bash.crossDrv;
findutils = pkgs.findutils.crossDrv;
diffutils = pkgs.diffutils.crossDrv;
gnused = pkgs.gnused.crossDrv;
gnugrep = pkgs.gnugrep.crossDrv;
gawk = pkgs.gawk.crossDrv;
gnutar = pkgs.gnutar.crossDrv;
gzip = pkgs.gzip.crossDrv;
bzip2 = pkgs.bzip2.crossDrv;
gnumake = pkgs.gnumake.crossDrv;
patch = pkgs.patch.crossDrv;
patchelf = pkgs.patchelf.crossDrv;
replace = pkgs.replace.crossDrv;
gcc = pkgs.gcc47;
gmp = pkgs.gmp.crossDrv;
mpfr = pkgs.mpfr.crossDrv;
ppl = pkgs.ppl.crossDrv;
cloogppl = pkgs.cloogppl.crossDrv;
cloog = pkgs.cloog.crossDrv;
zlib = pkgs.zlib.crossDrv;
isl = pkgs.isl.crossDrv;
mpc = pkgs.mpc.crossDrv;
binutils = pkgs.binutils.crossDrv;
klibc = pkgs.klibc.crossDrv;
in
rec {
curlStatic = import <nixpkgs/pkgs/tools/networking/curl> {
stdenv = pkgsuclibc.stdenv;
inherit (pkgsuclibc) fetchurl;
zlibSupport = false;
sslSupport = false;
linkStatic = true;
};
bzip2Static = import <nixpkgs/pkgs/tools/compression/bzip2> {
stdenv = pkgsuclibc.stdenv;
inherit (pkgsuclibc) fetchurl;
linkStatic = true;
};
inherit pkgs;
build =
stdenv.mkDerivation {
name = "build";
buildInputs = [nukeReferences cpio binutilsCross];
crossConfig = stdenv.cross.config;
buildCommand = ''
set -x
ensureDir $out/bin $out/lib $out/libexec
# Copy what we need of Glibc.
cp -d ${glibc}/lib/ld-*.so* $out/lib
cp -d ${glibc}/lib/libc*.so* $out/lib
cp -d ${glibc}/lib/libc_nonshared.a $out/lib
cp -d ${glibc}/lib/libm*.so* $out/lib
cp -d ${glibc}/lib/libdl*.so* $out/lib
cp -d ${glibc}/lib/librt*.so* $out/lib
cp -d ${glibc}/lib/libpthread*.so* $out/lib
cp -d ${glibc}/lib/libnsl*.so* $out/lib
cp -d ${glibc}/lib/libutil*.so* $out/lib
cp -d ${glibc}/lib/crt?.o $out/lib
cp -rL ${glibc}/include $out
chmod -R u+w $out/include
# Hopefully we won't need these.
rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
find $out/include -name .install -exec rm {} \;
find $out/include -name ..install.cmd -exec rm {} \;
mv $out/include $out/include-glibc
# Copy coreutils, bash, etc.
cp ${coreutils_}/bin/* $out/bin
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
cp ${bash}/bin/bash $out/bin
cp ${findutils}/bin/find $out/bin
cp ${findutils}/bin/xargs $out/bin
cp -d ${diffutils}/bin/* $out/bin
cp -d ${gnused}/bin/* $out/bin
cp -d ${gnugrep}/bin/* $out/bin
cp ${gawk}/bin/gawk $out/bin
cp -d ${gawk}/bin/awk $out/bin
cp ${gnutar}/bin/tar $out/bin
cp ${gzip}/bin/gzip $out/bin
cp ${bzip2}/bin/bzip2 $out/bin
cp -d ${gnumake}/bin/* $out/bin
cp -d ${patch}/bin/* $out/bin
cp ${patchelf}/bin/* $out/bin
cp ${replace}/bin/* $out/bin
cp -d ${gnugrep.pcre.crossDrv}/lib/libpcre*.so* $out/lib # needed by grep
# Copy what we need of GCC.
cp -d ${gcc.gcc.crossDrv}/bin/gcc $out/bin
cp -d ${gcc.gcc.crossDrv}/bin/cpp $out/bin
cp -d ${gcc.gcc.crossDrv}/bin/g++ $out/bin
cp -d ${gcc.gcc.crossDrv}/lib*/libgcc_s.so* $out/lib
cp -d ${gcc.gcc.crossDrv}/lib*/libstdc++.so* $out/lib
cp -rd ${gcc.gcc.crossDrv}/lib/gcc $out/lib
chmod -R u+w $out/lib
rm -f $out/lib/gcc/*/*/include*/linux
rm -f $out/lib/gcc/*/*/include*/sound
rm -rf $out/lib/gcc/*/*/include*/root
rm -f $out/lib/gcc/*/*/include-fixed/asm
rm -rf $out/lib/gcc/*/*/plugin
#rm -f $out/lib/gcc/*/*/*.a
cp -rd ${gcc.gcc.crossDrv}/libexec/* $out/libexec
mkdir $out/include
cp -rd ${gcc.gcc.crossDrv}/include/c++ $out/include
chmod -R u+w $out/include
rm -rf $out/include/c++/*/ext/pb_ds
rm -rf $out/include/c++/*/ext/parallel
cp -d ${gmp}/lib/libgmp*.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 ${mpc}/lib/libmpc*.so* $out/lib
cp -d ${zlib}/lib/libz.so* $out/lib
# Copy binutils.
for i in as ld ar ranlib nm strip readelf objdump; do
cp ${binutils}/bin/$i $out/bin
done
chmod -R u+w $out
# Strip executables even further.
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
if test -x $i -a ! -L $i; then
chmod +w $i
$crossConfig-strip -s $i || true
fi
done
nuke-refs $out/bin/*
nuke-refs $out/lib/*
nuke-refs $out/libexec/gcc/*/*/*
nuke-refs $out/libexec/gcc/*/*/*/*
mkdir $out/.pack
mv $out/* $out/.pack
mv $out/.pack $out/pack
mkdir $out/on-server
(cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
mkdir $out/in-nixpkgs
cp ${klibc}/lib/klibc/bin.static/sh $out/in-nixpkgs
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
# that we can safely copy them out of the store and to other
# locations in the store.
allowedReferences = [];
};
unpack =
stdenv.mkDerivation {
name = "unpack";
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"];
};
}

View File

@ -13,22 +13,24 @@ echo Patching the bootstrap tools...
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
if ! test -L $i; then
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
fi
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/libppl* $out/lib/libgmp*; do
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
if ! test -L $i; then
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
fi
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.

View File

@ -5904,6 +5904,10 @@ let
];
};
linux_3_6_rpi = makeOverridable (import ../os-specific/linux/kernel/linux-rpi-3.6.nix) {
inherit fetchgit stdenv perl mktemp module_init_tools ubootChooser;
};
/* Linux kernel modules are inherently tied to a specific kernel. So
rather than provide specific instances of those packages for a
specific kernel, we have a function that builds those packages
@ -6031,6 +6035,7 @@ let
linuxPackages_3_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_4 pkgs.linuxPackages_3_4);
linuxPackages_3_5 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_5 pkgs.linuxPackages_3_5);
linuxPackages_3_6 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_6 pkgs.linuxPackages_3_6);
linuxPackages_3_6_rpi = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_6_rpi pkgs.linuxPackages_3_6_rpi);
linuxPackages_3_7 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_7 pkgs.linuxPackages_3_7);
# The current default kernel / kernel modules.

View File

@ -126,6 +126,109 @@ rec {
ubootConfig = "sheevaplug_config";
};
raspberrypi = {
name = "raspberrypi";
kernelMajor = "2.6";
kernelHeadersBaseConfig = "kirkwood_defconfig";
kernelBaseConfig = "bcmrpi_defconfig";
kernelArch = "arm";
kernelAutoModules = false;
kernelExtraConfig =
''
BLK_DEV_RAM y
BLK_DEV_INITRD y
BLK_DEV_CRYPTOLOOP m
BLK_DEV_DM m
DM_CRYPT m
MD y
REISERFS_FS m
BTRFS_FS m
XFS_FS m
JFS_FS m
EXT4_FS m
USB_STORAGE_CYPRESS_ATACB m
# mv cesa requires this sw fallback, for mv-sha1
CRYPTO_SHA1 y
IP_PNP y
IP_PNP_DHCP y
NFS_FS y
ROOT_NFS y
TUN m
NFS_V4 y
NFS_V4_1 y
NFS_FSCACHE y
NFSD m
NFSD_V2_ACL y
NFSD_V3 y
NFSD_V3_ACL y
NFSD_V4 y
NETFILTER y
IP_NF_IPTABLES y
IP_NF_FILTER y
IP_NF_MATCH_ADDRTYPE y
IP_NF_TARGET_LOG y
IP_NF_MANGLE y
IPV6 m
VLAN_8021Q m
CIFS y
CIFS_XATTR y
CIFS_POSIX y
CIFS_FSCACHE y
CIFS_ACL y
WATCHDOG y
WATCHDOG_CORE y
ORION_WATCHDOG m
ZRAM m
NETCONSOLE m
# Fail to build
DRM n
SCSI_ADVANSYS n
USB_ISP1362_HCD n
SND_SOC n
SND_ALI5451 n
FB_SAVAGE n
SCSI_NSP32 n
ATA_SFF n
SUNGEM n
IRDA n
ATM_HE n
SCSI_ACARD n
BLK_DEV_CMD640_ENHANCED n
FUSE_FS m
# nixos mounts some cgroup
CGROUPS y
# Latencytop
LATENCYTOP y
# Ubi for the mtd
MTD_UBI y
UBIFS_FS y
UBIFS_FS_XATTR y
UBIFS_FS_ADVANCED_COMPR y
UBIFS_FS_LZO y
UBIFS_FS_ZLIB y
UBIFS_FS_DEBUG n
'';
kernelTarget = "uImage";
uboot = "sheevaplug";
# Only for uboot = uboot :
ubootConfig = "sheevaplug_config";
gcc = {
arch = "armv6";
fpu = "vfp";
float = "hard";
};
};
guruplug = sheevaplug // {
# Define `CONFIG_MACH_GURUPLUG' (see
# <http://kerneltrap.org/mailarchive/git-commits-head/2010/5/19/33618>)
@ -275,5 +378,6 @@ rec {
'';
kernelTarget = "vmlinux";
uboot = null;
gcc.arch = "loongson2f";
};
}