From 4a9d9c327b501b43c96cb42859329a7d1a9520b5 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 31 Dec 2014 04:23:12 -0500 Subject: [PATCH] gnu: Add support for the 'armhf-linux' system. Based on preliminary work by John Darrington . * gnu/packages/bootstrap/armhf-linux/bash, gnu/packages/bootstrap/armhf-linux/mkdir, gnu/packages/bootstrap/armhf-linux/tar, gnu/packages/bootstrap/armhf-linux/xz: New files. * gnu-system.am (bootstrap_armhf_linuxdir, dist_bootstrap_armhf_linux_DATA) (nodist_bootstrap_armhf_linux_DATA): New variables. (DISTCLEANFILES): Add $(nodist_bootstrap_armhf_linux_DATA). (gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz): New target. * build-aux/download.scm (file-name->uri): Use newer date in URI for armhf-linux. * gnu/packages/bootstrap.scm (raw-build): Use "guile-2.0.11.tar.xz" on armhf-linux. (glibc-dynamic-linker, %bootstrap-coreutils&co, %bootstrap-binutils) (%bootstrap-glibc, %bootstrap-gcc): Add armhf-linux cases. * .gitignore: Add gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz. * gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): Add armhf case. (gcc-4.7)[pre-configure]: Add gcc/config/*/linux-eabi.h to the list of files in which to patch GLIBC_DYNAMIC_LINKER. * gnu/packages/cross-base.scm (xgcc-armhf): New variable. * guix/utils.scm (gnu-triplet->nix-system, nix-system->gnu-triplet): Add armhf cases. * m4/guix.m4 (GUIX_SYSTEM_TYPE): Add armhf case. (GUIX_ASSERT_SUPPORTED_SYSTEM): Add armhf-linux to list of supported systems. * doc/guix.texi (GNU Distribution): Add armhf-linux to the list of supported systems. --- .gitignore | 1 + build-aux/download.scm | 8 +++++- doc/guix.texi | 4 +++ gnu-system.am | 13 ++++++++++ gnu/packages/bootstrap.scm | 43 +++++++++++++++++++++++++++---- gnu/packages/bootstrap/armhf-linux/bash | Bin 0 -> 802224 bytes gnu/packages/bootstrap/armhf-linux/mkdir | Bin 0 -> 401544 bytes gnu/packages/bootstrap/armhf-linux/tar | Bin 0 -> 755356 bytes gnu/packages/bootstrap/armhf-linux/xz | Bin 0 -> 502884 bytes gnu/packages/cross-base.scm | 7 +++++ gnu/packages/gcc.scm | 15 ++++++++--- guix/utils.scm | 24 ++++++++++------- m4/guix.m4 | 13 +++++++++- 13 files changed, 109 insertions(+), 19 deletions(-) create mode 100755 gnu/packages/bootstrap/armhf-linux/bash create mode 100755 gnu/packages/bootstrap/armhf-linux/mkdir create mode 100755 gnu/packages/bootstrap/armhf-linux/tar create mode 100755 gnu/packages/bootstrap/armhf-linux/xz diff --git a/.gitignore b/.gitignore index bcb82aa..3ec3636 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,7 @@ config.cache /doc/version.texi /gnu/packages/bootstrap/x86_64-linux/guile-2.0.9.tar.xz /gnu/packages/bootstrap/i686-linux/guile-2.0.9.tar.xz +/gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz /gnu/packages/bootstrap/mips64el-linux/guile-2.0.9.tar.xz /guix/config.scm /nix/nix-daemon/nix-daemon.cc diff --git a/build-aux/download.scm b/build-aux/download.scm index 50123f5..7a31869 100644 --- a/build-aux/download.scm +++ b/build-aux/download.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013 Ludovic Courtès +;;; Copyright © 2014 Mark H Weaver ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,7 +46,12 @@ (match (string-tokenize file (char-set-complement (char-set #\/))) ((_ ... system basename) (string->uri (string-append %url-base "/" system - "/20131110/" basename))))) + (match system + ("armhf-linux" + "/20150101/") + (_ + "/20131110/")) + basename))))) (match (command-line) ((_ file expected-hash) diff --git a/doc/guix.texi b/doc/guix.texi index 12a1808..75ebfb2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3246,6 +3246,10 @@ Intel/AMD @code{x86_64} architecture, Linux-Libre kernel; @item i686-linux Intel 32-bit architecture (IA32), Linux-Libre kernel; +@item armhf-linux +ARMv7 architecture with hard float, Thumb-2 and VFP3D16 coprocessor, +using the EABI hard-float ABI, and Linux-Libre kernel. + @item mips64el-linux little-endian 64-bit MIPS processors, specifically the Loongson series, n32 application binary interface (ABI), and Linux-Libre kernel. diff --git a/gnu-system.am b/gnu-system.am index 06e96fb..a00b83d 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -495,6 +495,7 @@ dist_patch_DATA = \ bootstrapdir = $(guilemoduledir)/gnu/packages/bootstrap bootstrap_x86_64_linuxdir = $(bootstrapdir)/x86_64-linux bootstrap_i686_linuxdir = $(bootstrapdir)/i686-linux +bootstrap_armhf_linuxdir = $(bootstrapdir)/armhf-linux bootstrap_mips64el_linuxdir = $(bootstrapdir)/mips64el-linux dist_bootstrap_x86_64_linux_DATA = \ @@ -509,6 +510,12 @@ dist_bootstrap_i686_linux_DATA = \ gnu/packages/bootstrap/i686-linux/tar \ gnu/packages/bootstrap/i686-linux/xz +dist_bootstrap_armhf_linux_DATA = \ + gnu/packages/bootstrap/armhf-linux/bash \ + gnu/packages/bootstrap/armhf-linux/mkdir \ + gnu/packages/bootstrap/armhf-linux/tar \ + gnu/packages/bootstrap/armhf-linux/xz + dist_bootstrap_mips64el_linux_DATA = \ gnu/packages/bootstrap/mips64el-linux/bash \ gnu/packages/bootstrap/mips64el-linux/mkdir \ @@ -521,6 +528,8 @@ nodist_bootstrap_x86_64_linux_DATA = \ gnu/packages/bootstrap/x86_64-linux/guile-2.0.9.tar.xz nodist_bootstrap_i686_linux_DATA = \ gnu/packages/bootstrap/i686-linux/guile-2.0.9.tar.xz +nodist_bootstrap_armhf_linux_DATA = \ + gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz nodist_bootstrap_mips64el_linux_DATA = \ gnu/packages/bootstrap/mips64el-linux/guile-2.0.9.tar.xz @@ -532,6 +541,7 @@ set-bootstrap-executable-permissions: DISTCLEANFILES = \ $(nodist_bootstrap_x86_64_linux_DATA) \ $(nodist_bootstrap_i686_linux_DATA) \ + $(nodist_bootstrap_armhf_linux_DATA) \ $(nodist_bootstrap_mips64el_linux_DATA) # Method to download a file from an external source. @@ -546,6 +556,9 @@ gnu/packages/bootstrap/x86_64-linux/guile-2.0.9.tar.xz: gnu/packages/bootstrap/i686-linux/guile-2.0.9.tar.xz: $(MKDIR_P) `dirname "$@"` $(DOWNLOAD_FILE) "$@" "b757cd46bf13ecac83fb8e955fb50096ac2d17bb610ca8eb816f29302a00a846" +gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz: + $(MKDIR_P) `dirname "$@"` + $(DOWNLOAD_FILE) "$@" "e551d05d4d385d6706ab8d574856a087758294dc90ab4c06e70a157a685e23d6" gnu/packages/bootstrap/mips64el-linux/guile-2.0.9.tar.xz: $(MKDIR_P) `dirname "$@"` $(DOWNLOAD_FILE) "$@" "994680f0001346864aa2c2cc5110f380ee7518dcd701c614291682b8e948f73b" diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index f1110d9..8373c4b 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -162,6 +162,7 @@ successful, or false to signal an error." "Return the name of Glibc's dynamic linker for SYSTEM." (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2") ((string=? system "i686-linux") "/lib/ld-linux.so.2") + ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3") ((string=? system "mips64el-linux") "/lib/ld.so.1") ;; XXX: This one is used bare-bones, without a libc, so add a case @@ -191,7 +192,11 @@ successful, or false to signal an error." (xz (->store "xz")) (mkdir (->store "mkdir")) (bash (->store "bash")) - (guile (->store "guile-2.0.9.tar.xz")) + (guile (->store (match system + ("armhf-linux" + "guile-2.0.11.tar.xz") + (_ + "guile-2.0.9.tar.xz")))) (builder (add-text-to-store store "build-bootstrap-guile.sh" @@ -251,7 +256,11 @@ $out/bin/guile --version~%" (origin (method url-fetch) (uri (map (cut string-append <> "/" system - "/20131110/static-binaries.tar.xz") + (match system + ("armhf-linux" + "/20150101/static-binaries.tar.xz") + (_ + "/20131110/static-binaries.tar.xz"))) %bootstrap-base-urls)) (sha256 (match system @@ -261,6 +270,9 @@ $out/bin/guile --version~%" ("i686-linux" (base32 "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak")) + ("armhf-linux" + (base32 + "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5")) ("mips64el-linux" (base32 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753")))))) @@ -280,7 +292,11 @@ $out/bin/guile --version~%" (origin (method url-fetch) (uri (map (cut string-append <> "/" system - "/20131110/binutils-2.23.2.tar.xz") + (match system + ("armhf-linux" + "/20150101/binutils-2.25.tar.xz") + (_ + "/20131110/binutils-2.23.2.tar.xz"))) %bootstrap-base-urls)) (sha256 (match system @@ -290,6 +306,9 @@ $out/bin/guile --version~%" ("i686-linux" (base32 "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9")) + ("armhf-linux" + (base32 + "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q")) ("mips64el-linux" (base32 "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7")))))) @@ -334,7 +353,11 @@ $out/bin/guile --version~%" (origin (method url-fetch) (uri (map (cut string-append <> "/" (%current-system) - "/20131110/glibc-2.18.tar.xz") + (match (%current-system) + ("armhf-linux" + "/20150101/glibc-2.20.tar.xz") + (_ + "/20131110/glibc-2.18.tar.xz"))) %bootstrap-base-urls)) (sha256 (match (%current-system) @@ -344,6 +367,9 @@ $out/bin/guile --version~%" ("i686-linux" (base32 "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w")) + ("armhf-linux" + (base32 + "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn")) ("mips64el-linux" (base32 "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg"))))))))) @@ -405,7 +431,11 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ (origin (method url-fetch) (uri (map (cut string-append <> "/" (%current-system) - "/20131110/gcc-4.8.2.tar.xz") + (match (%current-system) + ("armhf-linux" + "/20150101/gcc-4.8.4.tar.xz") + (_ + "/20131110/gcc-4.8.2.tar.xz"))) %bootstrap-base-urls)) (sha256 (match (%current-system) @@ -415,6 +445,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ ("i686-linux" (base32 "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw")) + ("armhf-linux" + (base32 + "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v")) ("mips64el-linux" (base32 "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks"))))))))) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index a9ae5ee..e582a00 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014 Ludovic Courtès +;;; Copyright © 2014 Mark H Weaver ;;; ;;; This file is part of GNU Guix. ;;; @@ -322,6 +323,12 @@ XBINUTILS and the cross tool chain." ;; Bare-bones Xtensa cross-compiler, used to build the Atheros firmware. (cross-gcc "xtensa-elf")) +(define-public xgcc-armhf + (let ((triplet "arm-linux-gnueabihf")) + (cross-gcc triplet + (cross-binutils triplet) + (cross-libc triplet)))) + ;; (define-public xgcc-armel ;; (let ((triplet "armel-linux-gnueabi")) ;; (cross-gcc triplet diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 0e50757..276b986 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -46,8 +46,17 @@ where the OS part is overloaded to denote a specific ABI---into GCC ;; Triplets recognized by glibc as denoting the N64 ABI; see ;; ports/sysdeps/mips/preconfigure. '("--with-abi=64")) + + ((string-match "^arm.*-gnueabihf$" target) + '("--with-arch=armv7-a" + "--with-float=hard" + "--with-mode=thumb" + + ;; See + "--with-fpu=vfpv3-d16")) + (else - ;; TODO: Add `armel.*gnueabi', `hf', etc. + ;; TODO: Add `arm.*-gnueabi', etc. '()))) (define-public gcc-4.7 @@ -184,14 +193,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC (for-each (lambda (x) (substitute* (find-files "gcc/config" - "^linux(64|-elf)?\\.h$") + "^linux(64|-elf|-eabi)?\\.h$") (("(#define GLIBC_DYNAMIC_LINKER.*)\\\\\n$" _ line) line))) '(1 2 3)) ;; Fix the dynamic linker's file name. (substitute* (find-files "gcc/config" - "^linux(64|-elf)?\\.h$") + "^linux(64|-elf|-eabi)?\\.h$") (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix) (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%" suffix diff --git a/guix/utils.scm b/guix/utils.scm index 7ac586b..75f5065 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -481,14 +481,18 @@ previous value of the keyword argument." #:optional (system (%current-system)) (vendor "unknown")) "Return a guess of the GNU triplet corresponding to Nix system identifier SYSTEM." - (let* ((dash (string-index system #\-)) - (arch (substring system 0 dash)) - (os (substring system (+ 1 dash)))) - (string-append arch - "-" vendor "-" - (if (string=? os "linux") - "linux-gnu" - os)))) + (match system + ("armhf-linux" + (string-append "arm-" vendor "-linux-gnueabihf")) + (_ + (let* ((dash (string-index system #\-)) + (arch (substring system 0 dash)) + (os (substring system (+ 1 dash)))) + (string-append arch + "-" vendor "-" + (if (string=? os "linux") + "linux-gnu" + os)))))) (define (gnu-triplet->nix-system triplet) "Return the Nix system type corresponding to TRIPLET, a GNU triplet as @@ -498,7 +502,9 @@ returned by `config.guess'." (lambda (m) (string-append "i686-" (match:substring m 1)))) (else triplet)))) - (cond ((string-match "^([^-]+)-([^-]+-)?linux-gnu.*" triplet) + (cond ((string-match "^arm[^-]*-([^-]+-)?linux-gnueabihf" triplet) + "armhf-linux") + ((string-match "^([^-]+)-([^-]+-)?linux-gnu.*" triplet) => (lambda (m) ;; Nix omits `-gnu' for GNU/Linux. diff --git a/m4/guix.m4 b/m4/guix.m4 index 19e041a..d441559 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 @@ -1,5 +1,6 @@ dnl GNU Guix --- Functional package management for GNU dnl Copyright © 2012, 2013, 2014 Ludovic Courtès +dnl Copyright © 2014 Mark H Weaver dnl dnl This file is part of GNU Guix. dnl @@ -50,6 +51,16 @@ AC_DEFUN([GUIX_SYSTEM_TYPE], [ machine_name="i686";; amd64) machine_name="x86_64";; + arm*) + # TODO: If not cross-compiling, add a sanity check to make + # sure this build machine has the needed features to + # support executables compiled using our armhf gcc, + # configured with: + # --with-arch=armv7-a + # --with-float=hard + # --with-mode=thumb + # --with-fpu=vfpv3-d16 + machine_name="armhf";; *) machine_name="$host_cpu";; esac @@ -86,7 +97,7 @@ courageous and port the GNU System distribution to it (see # Currently only Linux-based systems are supported, and only on some # platforms. case "$guix_system" in - x86_64-linux|i686-linux|mips64el-linux) + x86_64-linux|i686-linux|armhf-linux|mips64el-linux) ;; *) if test "x$guix_courageous" = "xyes"; then -- 2.1.2