Skip to content

Commit

Permalink
First movement to get the raspberrypi stdenv building.
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and viric committed Dec 26, 2012
1 parent 1af2ada commit 1b29d29
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 8 deletions.
4 changes: 3 additions & 1 deletion pkgs/development/compilers/gcc/4.6/default.nix
Expand Up @@ -294,7 +294,9 @@ stdenv.mkDerivation ({
${if langAda then " --enable-libada" else ""}
${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
";
" + (if (cross == null && stdenv.platform.name == "raspberrypi") then
"--with-arch=armv6 --with-fpu=vfp --with-float=hard --with-mode=arm" else "");
# ^ This above is out of "" because we don't want to rebuild stdenv in other archs

targetConfig = if (cross != null) then cross.config else null;

Expand Down
18 changes: 16 additions & 2 deletions pkgs/development/libraries/glibc/2.13/common.nix
Expand Up @@ -8,7 +8,7 @@ cross :
, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
, mig ? null, fetchgit ? null
, profilingLibraries ? false, meta
, preConfigure ? "", ... }@args :
, preConfigure ? "", recentGcc ? true, ... }@args :

let
# For GNU/Hurd, see below.
Expand Down Expand Up @@ -120,11 +120,21 @@ 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") ||
(!recentGcc && stdenv.platform.name == "raspberrypi")) [
"--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 && recentGcc && stdenv.platform.name == "raspberrypi") [
"--host=arm-linux-gnueabihf"
"--build=arm-linux-gnueabihf"
"--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"
Expand Down Expand Up @@ -192,6 +202,10 @@ stdenv.mkDerivation ({
configureScript="`pwd`/../$sourceRoot/configure"
${preConfigure}
'' + stdenv.lib.optionalString (cross == null
&& recentGcc
&& stdenv.platform.name == "raspberrypi") ''
configureFlagsArray=("CFLAGS=-march=armv6 -mfpu=vfp -mhard-float")
'';

meta = {
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/glibc/2.13/default.nix
Expand Up @@ -5,6 +5,7 @@
, profilingLibraries ? false
, gccCross ? null
, debugSymbols ? false
, recentGcc ? true
}:

assert stdenv.gcc.gcc != null;
Expand All @@ -19,7 +20,7 @@ in
+ stdenv.lib.optionalString debugSymbols "-debug";

inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
gccCross;
gccCross recentGcc;

builder = ./builder.sh;

Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/default.nix
Expand Up @@ -55,6 +55,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
Expand Down
2 changes: 2 additions & 0 deletions pkgs/stdenv/generic/default.nix
Expand Up @@ -87,6 +87,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
Expand Down Expand Up @@ -120,6 +121,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
Expand Down
13 changes: 9 additions & 4 deletions pkgs/stdenv/linux/default.nix
Expand Up @@ -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/armv5tel
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";
Expand Down Expand Up @@ -57,7 +58,7 @@ rec {
builder = bootstrapFiles.sh;

args =
if system == "armv5tel-linux"
if (system == "armv5tel-linux" || system == "arm6l-linux")
then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
else [ ./scripts/unpack-bootstrap-tools.sh ];

Expand Down Expand Up @@ -189,7 +190,7 @@ rec {

# 5) Build Glibc with the bootstrap tools. The result is the full,
# dynamically linked, final Glibc.
stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc;
stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc.override { recentGcc = false; };


# 6) Construct a third stdenv identical to the 2nd, except that
Expand All @@ -201,19 +202,23 @@ rec {
coreutils = bootstrapTools;
libc = stdenvLinuxGlibc;
};
overrides = pkgs: {
overrides = pkgs: ({
glibc = stdenvLinuxGlibc;
inherit (stdenvLinuxBoot1Pkgs) perl;
} // (if (platform ? name && platform.name != "raspberrypi") then {
# Link GCC statically against GMP etc. This makes sense because
# these builds of the libraries are only used by GCC, so it
# reduces the size of the stdenv closure.

# On raspberry pi we can't do that, because libgcc/libstdc++ are made
# without hardfp, and can't be linked with the new hardfp code in gcc.
gmp = pkgs.gmp.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
mpfr = pkgs.mpfr.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
mpc = pkgs.mpc.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
isl = pkgs.isl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
cloog = pkgs.cloog.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
ppl = pkgs.ppl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
};
} else {}));
inherit fetchurl;
};

Expand Down
98 changes: 98 additions & 0 deletions pkgs/top-level/platforms.nix
Expand Up @@ -126,6 +126,104 @@ 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";
};

guruplug = sheevaplug // {
# Define `CONFIG_MACH_GURUPLUG' (see
# <http://kerneltrap.org/mailarchive/git-commits-head/2010/5/19/33618>)
Expand Down

0 comments on commit 1b29d29

Please sign in to comment.