guix-commits
[Top][All Lists]
Advanced

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

14/15: gnu: grub: Add support for Loongson-based machines.


From: Mark H. Weaver
Subject: 14/15: gnu: grub: Add support for Loongson-based machines.
Date: Mon, 24 Aug 2015 03:16:35 +0000

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

commit 3015a016c7c7cb92a55a75a49af054a829351940
Author: Mark H Weaver <address@hidden>
Date:   Sat Aug 15 01:31:50 2015 -0400

    gnu: grub: Add support for Loongson-based machines.
    
    * gnu/packages/patches/grub-mips-abi.patch: New file.
    * gnu-system.am (dist_patch_DATA): Add it.
    * gnu/packages/grub.scm (grub)[source]: Add patch.
      [arguments]: Disable tests on MIPS.
      [native-inputs]: Remove qemu and xorriso (for tests) on MIPS.
---
 gnu-system.am                            |    1 +
 gnu/packages/grub.scm                    |   21 +++++++--
 gnu/packages/patches/grub-mips-abi.patch |   68 ++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/gnu-system.am b/gnu-system.am
index 9ef9ad2..5064523 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -475,6 +475,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/gobject-introspection-cc.patch          \
   gnu/packages/patches/gobject-introspection-girepository.patch        \
   gnu/packages/patches/grep-CVE-2015-1345.patch                        \
+  gnu/packages/patches/grub-mips-abi.patch                     \
   gnu/packages/patches/gsl-poly-test-fix-pt1.patch             \
   gnu/packages/patches/gsl-poly-test-fix-pt2.patch             \
   gnu/packages/patches/guile-1.8-cpp-4.5.patch                 \
diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index c76fa22..f1b05df 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -85,10 +85,17 @@
                     (commit (last (string-split version #\g)))))
               (sha256
                (base32
-                "0g7kg4286w84ib31fb52jxpljn345wl3i91xsfizh9b5adcpi9fq"))))
+                "0g7kg4286w84ib31fb52jxpljn345wl3i91xsfizh9b5adcpi9fq"))
+              (patches (list (search-patch "grub-mips-abi.patch")))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags '("--disable-werror")
+     `(,@(if (string-prefix? "mips" (or (%current-target-system)
+                                        (%current-system)))
+             ;; XXX Disable tests on MIPS, to work around the fact that our
+             ;; QEMU package is currently broken on MIPS.
+             '(#:tests? #f)
+             '())
+       #:configure-flags '("--disable-werror")
        #:phases (modify-phases %standard-phases
                   (add-after
                    'unpack 'patch-stuff
@@ -129,8 +136,14 @@
 
        ;; Dependencies for the test suite.  The "real" QEMU is needed here,
        ;; because several targets are used.
-       ("qemu" ,qemu-for-tests)
-       ("xorriso" ,xorriso)))
+       ;;
+       ;; XXX Don't add these on MIPS, since our QEMU package is currently
+       ;; broken on MIPS.
+       ,@(if (not (string-prefix? "mips" (or (%current-target-system)
+                                             (%current-system))))
+             '(("qemu" ,qemu-for-tests)
+               ("xorriso" ,xorriso))
+             '())))
     (home-page "http://www.gnu.org/software/grub/";)
     (synopsis "GRand Unified Boot loader")
     (description
diff --git a/gnu/packages/patches/grub-mips-abi.patch 
b/gnu/packages/patches/grub-mips-abi.patch
new file mode 100644
index 0000000..7ed2fa2
--- /dev/null
+++ b/gnu/packages/patches/grub-mips-abi.patch
@@ -0,0 +1,68 @@
+From b397fa4834b4552e3a7c99ee783aff2ee264b290 Mon Sep 17 00:00:00 2001
+From: Mark H Weaver <address@hidden>
+Date: Sun, 16 Aug 2015 23:44:11 -0400
+Subject: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI.
+
+Include -mabi=32 in CFLAGS_PLATFORM and CCASFLAGS_PLATFORM to compile
+code for the O32 ABI when targetting MIPS, since the MIPS assembly code
+in GRUB assumes this.  This flag is also needed when compiling
+asm-tests/mips.S from configure, because GNU as rejects MIPS register
+names such as $t2 unless the O32 ABI is selected.
+---
+ conf/Makefile.common | 4 ++++
+ configure.ac         | 7 +++++--
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/conf/Makefile.common b/conf/Makefile.common
+index fcb8d2e..bd125da 100644
+--- a/conf/Makefile.common
++++ b/conf/Makefile.common
+@@ -20,6 +20,10 @@ endif
+ if COND_powerpc_ieee1275
+   CFLAGS_PLATFORM += -mcpu=powerpc
+ endif
++if COND_mips
++  CFLAGS_PLATFORM += -mabi=32
++  CCASFLAGS_PLATFORM = -mabi=32
++endif
+ 
+ #FIXME: discover and check XEN headers
+ CPPFLAGS_XEN = -I/usr/include
+diff --git a/configure.ac b/configure.ac
+index c864311..1f5e8a2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2,7 +2,8 @@
+ 
+ # Process this file with autoconf to produce a configure script.
+ 
+-# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software 
Foundation, Inc.
++# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,
++#   2012,2013,2014,2015  Free Software Foundation, Inc.
+ #
+ # This configure.ac is free software; the author
+ # gives unlimited permission to copy and/or distribute it,
+@@ -599,9 +600,11 @@ fi
+ 
+ AC_CACHE_CHECK([for options to compile assembly], 
[grub_cv_cc_target_asm_compile], [
+ test_program=
++test_ccasflags=
+ case "x$target_cpu-$platform" in
+      xmips-* | xmipsel-*)
+         test_program=mips
++        test_ccasflags=-mabi=32
+       ;;
+      xi386-pc)
+        test_program=i386-pc
+@@ -618,7 +621,7 @@ if test x"$test_program" = x ; then
+ else
+   found=no
+   for arg in "" "-no-integrated-as"; do
+-    cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg 
$TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S"
++    cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $test_ccasflags 
$arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S"
+     echo "Running $cmdline" >&AS_MESSAGE_LOG_FD
+     if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
+       grub_cv_cc_target_asm_compile="$arg"
+-- 
+2.4.3
+



reply via email to

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