From 1b29d29c7610402cb278130f12b27900bb5a99f0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 6 Dec 2012 15:51:52 +0000 Subject: [PATCH] First movement to get the raspberrypi stdenv building. --- .../development/compilers/gcc/4.6/default.nix | 4 +- .../libraries/glibc/2.13/common.nix | 18 +++- .../libraries/glibc/2.13/default.nix | 3 +- pkgs/stdenv/default.nix | 1 + pkgs/stdenv/generic/default.nix | 2 + pkgs/stdenv/linux/default.nix | 13 ++- pkgs/top-level/platforms.nix | 98 +++++++++++++++++++ 7 files changed, 131 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix index e27f1a47f9c..bcdde3ec870 100644 --- a/pkgs/development/compilers/gcc/4.6/default.nix +++ b/pkgs/development/compilers/gcc/4.6/default.nix @@ -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; diff --git a/pkgs/development/libraries/glibc/2.13/common.nix b/pkgs/development/libraries/glibc/2.13/common.nix index 2333e42246b..316c66c5190 100644 --- a/pkgs/development/libraries/glibc/2.13/common.nix +++ b/pkgs/development/libraries/glibc/2.13/common.nix @@ -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. @@ -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" @@ -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 = { diff --git a/pkgs/development/libraries/glibc/2.13/default.nix b/pkgs/development/libraries/glibc/2.13/default.nix index f80ed9372e6..59f8ca647e6 100644 --- a/pkgs/development/libraries/glibc/2.13/default.nix +++ b/pkgs/development/libraries/glibc/2.13/default.nix @@ -5,6 +5,7 @@ , profilingLibraries ? false , gccCross ? null , debugSymbols ? false +, recentGcc ? true }: assert stdenv.gcc.gcc != null; @@ -19,7 +20,7 @@ in + stdenv.lib.optionalString debugSymbols "-debug"; inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries - gccCross; + gccCross recentGcc; builder = ./builder.sh; diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 8e0da288eec..3c75597afca 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -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 diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 20cbb1b455c..ea101ddb075 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -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 @@ -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 diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 3105e76f817..6a202951c7c 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -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"; @@ -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 ]; @@ -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 @@ -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; }; diff --git a/pkgs/top-level/platforms.nix b/pkgs/top-level/platforms.nix index f00ad36f2e4..c53b41958a4 100644 --- a/pkgs/top-level/platforms.nix +++ b/pkgs/top-level/platforms.nix @@ -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 # )