guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/07: PRELIMINARY: gnu: Add support for 'armhf-linux' system.


From: Mark H. Weaver
Subject: 07/07: PRELIMINARY: gnu: Add support for 'armhf-linux' system.
Date: Thu, 01 Jan 2015 15:50:45 +0000

mhw pushed a commit to branch wip-armhf
in repository guix.

commit bec44cf8e1caae5e826882f0fe5b4a2214bd2a28
Author: Mark H Weaver <address@hidden>
Date:   Wed Dec 31 04:23:12 2014 -0500

    PRELIMINARY: gnu: Add support for 'armhf-linux' system.
    
    Based on preliminary work by John Darrington <address@hidden>.
    
    * 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.
    
    * 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.  Patch #defines for
      GLIBC_DYNAMIC_LINKER* only when the right hand side starts with '"/'.
    
    * 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.
---
 build-aux/download.scm                   |    8 +++++-
 doc/guix.texi                            |    4 +++
 gnu-system.am                            |   13 +++++++++
 gnu/packages/bootstrap.scm               |   44 ++++++++++++++++++++++++++---
 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 ++++++++-
 12 files changed, 109 insertions(+), 19 deletions(-)

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 <address@hidden>
+;;; Copyright © 2014 Mark H Weaver <address@hidden>
 ;;;
 ;;; 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 0073785..85f2da7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3247,6 +3247,10 @@ Intel/AMD @code{x86_64} architecture, Linux-Libre kernel;
 @item i686-linux
 Intel 32-bit architecture (IA32), Linux-Libre kernel;
 
address@hidden 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 725c13f..191b79e 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -490,6 +490,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 =             \
@@ -504,6 +505,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  \
@@ -516,6 +523,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
 
@@ -527,6 +536,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.
@@ -541,6 +551,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 e5d101a..05fa84a 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -160,6 +160,7 @@ check whether everything is alright."
   "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
@@ -189,7 +190,11 @@ check whether everything is alright."
          (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"
@@ -241,6 +246,7 @@ $out/bin/guile --version~%"
 (define %bootstrap-base-urls
   ;; This is where the initial binaries come from.
   '("http://alpha.gnu.org/gnu/guix/bootstrap";
+    "http://www.netris.org/~mhw/guix/bootstrap";     ; 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     "http://www.fdn.fr/~lcourtes/software/guix/packages";))
 
 (define %bootstrap-coreutils&co
@@ -249,7 +255,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
@@ -259,6 +269,9 @@ $out/bin/guile --version~%"
                               ("i686-linux"
                                (base32
                                 
"0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
+                              ("armhf-linux"
+                               (base32
+                                
"0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
                               ("mips64el-linux"
                                (base32
                                 
"072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
@@ -278,7 +291,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
@@ -288,6 +305,9 @@ $out/bin/guile --version~%"
                               ("i686-linux"
                                (base32
                                 
"14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
+                              ("armhf-linux"
+                               (base32
+                                
"1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
                               ("mips64el-linux"
                                (base32
                                 
"1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
@@ -332,7 +352,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)
@@ -342,6 +366,9 @@ $out/bin/guile --version~%"
                         ("i686-linux"
                          (base32
                           
"1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
+                        ("armhf-linux"
+                         (base32
+                          
"18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
                         ("mips64el-linux"
                          (base32
                           
"0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
@@ -403,7 +430,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)
@@ -413,6 +444,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
                         ("i686-linux"
                          (base32
                           
"150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
+                        ("armhf-linux"
+                         (base32
+                          
"06kg0swpr3s7fqbwhh35pjxgiihj70rcgyv4p3k497qgc2541hd3"))
                         ("mips64el-linux"
                          (base32
                           
"1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
diff --git a/gnu/packages/bootstrap/armhf-linux/bash 
b/gnu/packages/bootstrap/armhf-linux/bash
new file mode 100755
index 0000000..212a22c
Binary files /dev/null and b/gnu/packages/bootstrap/armhf-linux/bash differ
diff --git a/gnu/packages/bootstrap/armhf-linux/mkdir 
b/gnu/packages/bootstrap/armhf-linux/mkdir
new file mode 100755
index 0000000..c3e5246
Binary files /dev/null and b/gnu/packages/bootstrap/armhf-linux/mkdir differ
diff --git a/gnu/packages/bootstrap/armhf-linux/tar 
b/gnu/packages/bootstrap/armhf-linux/tar
new file mode 100755
index 0000000..5a6aac8
Binary files /dev/null and b/gnu/packages/bootstrap/armhf-linux/tar differ
diff --git a/gnu/packages/bootstrap/armhf-linux/xz 
b/gnu/packages/bootstrap/armhf-linux/xz
new file mode 100755
index 0000000..a77aebc
Binary files /dev/null and b/gnu/packages/bootstrap/armhf-linux/xz differ
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 <address@hidden>
+;;; Copyright © 2014 Mark H Weaver <address@hidden>
 ;;;
 ;;; 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 66d1c41..2bc8982 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 <https://wiki.debian.org/ArmHardFloatPort/VfpComparison#FPU>
+           "--with-fpu=vfpv3-d16"))
+
         (else
-         ;; TODO: Add `armel.*gnueabi', `hf', etc.
+         ;; TODO: Add `arm.*-gnueabi', etc.
          '())))
 
 (define-public gcc-4.7
@@ -181,8 +190,8 @@ where the OS part is overloaded to denote a specific 
ABI---into GCC
 
                 ;; Fix the dynamic linker's file name.
                 (substitute* (find-files "gcc/config"
-                                         "^linux(64|-elf)?\\.h$")
-                  (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
+                                         "^linux(64|-elf|-eabi)?\\.h$")
+                  (("#define GLIBC_DYNAMIC_LINKER([^ ]*) *\"/.*$" _ suffix)
                    (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
                            suffix
                            (string-append libc ,(glibc-dynamic-linker)))))
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 <address@hidden>
+dnl Copyright © 2014 Mark H Weaver <address@hidden>
 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]