[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/17: gnu: grub: Add support for Loongson-based machines.
From: |
Mark H. Weaver |
Subject: |
11/17: gnu: grub: Add support for Loongson-based machines. |
Date: |
Fri, 28 Aug 2015 15:56:07 +0000 |
mhw pushed a commit to branch wip-loongson2f
in repository guix.
commit 44cffce491912bfce8e3330cd12eb593e7614384
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 | 60 ++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/gnu-system.am b/gnu-system.am
index 1b62487..4eee3c9 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -478,6 +478,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..d695fd0
--- /dev/null
+++ b/gnu/packages/patches/grub-mips-abi.patch
@@ -0,0 +1,60 @@
+From: Andrei Borzenkov <address@hidden>
+Subject: [PATCH] configure: try to force o32 ABI on MIPS
+
+GRUB expects o32 ABI, in particular used assembly is valid only in this mode.
+Some systems (e.g. GNU Guix) default to using newer n64 or n32 ABI. Try to
+find suitable options to force o32.
+
+For GCC this is simply -mabi=32. While clang supports this option as well,
+o32 ABI is valid for MIPS target and n32/64 ABI are valid for MIPS64 target
+only, so use "-target mips -mabi=32".
+
+Reported-By: Mark H Weaver <address@hidden>
+Also-By: Mark H Weaver <address@hidden>
+
+---
+ configure.ac | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index c864311..2e73b3f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -597,6 +597,35 @@ int main (void);
+ TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian"
+ fi
+
++if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
++ AC_CACHE_CHECK([for options to force MIPS o32 ABI],
grub_cv_target_cc_mips_o32_abi, [
++ grub_cv_target_cc_mips_o32_abi=no
++ for arg in "" "-mabi=32" "-target mips -mabi=32" ; do
++ if test x"$grub_cv_target_cc_mips_o32_abi" != xno ; then
++ break
++ fi
++ CFLAGS="$TARGET_CFLAGS $arg -Werror"
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#if !defined(_ABIO32) || !defined(_MIPS_SIM) || (_MIPS_SIM != _ABIO32)
++#error not o32 ABI
++#endif
++asm (".globl start; start:");
++void __main (void);
++void __main (void) {}
++int main (void);
++]], [[]])],
++ [grub_cv_target_cc_mips_o32_abi="$arg"], [])
++ done
++ ])
++
++ if test x"$grub_cv_target_cc_mips_o32_abi" = xno ; then
++ AC_MSG_ERROR([could not force MIPS o32 ABI])
++ fi
++
++ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mips_o32_abi"
++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mips_o32_abi"
++fi
++
+ AC_CACHE_CHECK([for options to compile assembly],
[grub_cv_cc_target_asm_compile], [
+ test_program=
+ case "x$target_cpu-$platform" in
+--
+tg: (ba218c1..) u/mips-o32 (depends on: master)
- 08/17: gnu: grub: Use modify-phases and other minor cleanups., (continued)
- 08/17: gnu: grub: Use modify-phases and other minor cleanups., Mark H. Weaver, 2015/08/28
- 01/17: system: grub: On MIPS, the linux image name is vmlinuz, not bzImage., Mark H. Weaver, 2015/08/28
- 09/17: gnu: grub: Install documentation., Mark H. Weaver, 2015/08/28
- 06/17: gnu: linux-libre: On MIPS, the linux image name is vmlinuz, not bzImage., Mark H. Weaver, 2015/08/28
- 02/17: system: grub: Adjust eye-candy to work on non-Intel systems., Mark H. Weaver, 2015/08/28
- 12/17: TEMPORARY_HACK: gnu: qemu: Disable tests on MIPS., Mark H. Weaver, 2015/08/28
- 10/17: gnu: grub: Update to 2.02-beta2-500-gba218c1., Mark H. Weaver, 2015/08/28
- 05/17: gnu: linux-libre: Add case for ARCH=mips., Mark H. Weaver, 2015/08/28
- 16/17: NON_INTEL_ONLY: services: xorg: Remove xf86-video-intel., Mark H. Weaver, 2015/08/28
- 14/17: PRELIMINARY: system: grub: Convert grub background using rsvg-convert, not inkscape., Mark H. Weaver, 2015/08/28
- 11/17: gnu: grub: Add support for Loongson-based machines.,
Mark H. Weaver <=
- 15/17: PRELIMINARY: Attempts to get VMs working on MIPS., Mark H. Weaver, 2015/08/28
- 17/17: MIPS_ONLY: Modify installation-os for Loongson., Mark H. Weaver, 2015/08/28
- 13/17: TEMPORARY_HACK: gnu: gst-plugins-base: Disable tests on MIPS and ARM., Mark H. Weaver, 2015/08/28
- 07/17: gnu: Add linux-libre-loongson2f., Mark H. Weaver, 2015/08/28