gnu: cross-base: Apply Qualcomm's patches for Binutils and GCC.

This fixes compilation of the ath9k-htc firmware.  Before that, loading
it would result in "Target is unresponsive".  The patches come from
the ath9k-htc firmware source.

* gnu/packages/patches/ath9k-htc-firmware-binutils.patch,
  gnu/packages/patches/ath9k-htc-firmware-gcc.patch: New files.
* gnu-system.am (dist_patch_DATA): Add them.
* gnu/packages/cross-base.scm (package-with-patch): New procedure.
  (cross-binutils): Check whether TARGET starts with "xtensa-", and call
  'package-with-patch' when it does.
  (cross-gcc-patches): New procedure.
  (cross-gcc): Use it to add patches.
This commit is contained in:
Ludovic Courtès 2014-11-11 21:54:41 +01:00
parent 594340bc79
commit 1306b0b003
4 changed files with 29119 additions and 3 deletions

View File

@ -311,6 +311,8 @@ dist_patch_DATA = \
gnu/packages/patches/abiword-wmf-version-lookup-fix.patch \ gnu/packages/patches/abiword-wmf-version-lookup-fix.patch \
gnu/packages/patches/alsa-lib-mips-atomic-fix.patch \ gnu/packages/patches/alsa-lib-mips-atomic-fix.patch \
gnu/packages/patches/apr-skip-getservbyname-test.patch \ gnu/packages/patches/apr-skip-getservbyname-test.patch \
gnu/packages/patches/ath9k-htc-firmware-binutils.patch \
gnu/packages/patches/ath9k-htc-firmware-gcc.patch \
gnu/packages/patches/ath9k-htc-firmware-objcopy.patch \ gnu/packages/patches/ath9k-htc-firmware-objcopy.patch \
gnu/packages/patches/automake-skip-amhello-tests.patch \ gnu/packages/patches/automake-skip-amhello-tests.patch \
gnu/packages/patches/avahi-localstatedir.patch \ gnu/packages/patches/avahi-localstatedir.patch \

View File

@ -45,6 +45,12 @@
`(cons ,(string-append "--target=" target) `(cons ,(string-append "--target=" target)
,flags)))))) ,flags))))))
(define (package-with-patch original patch)
"Return package ORIGINAL with PATCH applied."
(package (inherit original)
(source (origin (inherit (package-source original))
(patches (list patch))))))
(define (cross-binutils target) (define (cross-binutils target)
"Return a cross-Binutils for TARGET." "Return a cross-Binutils for TARGET."
(let ((binutils (package (inherit binutils) (let ((binutils (package (inherit binutils)
@ -64,7 +70,14 @@
;; practice the RUNPATH of target libs only refers to ;; practice the RUNPATH of target libs only refers to
;; target libs, not native libs, so this is safe. ;; target libs, not native libs, so this is safe.
`(cons "--with-sysroot=/" ,flags))))))) `(cons "--with-sysroot=/" ,flags)))))))
(cross binutils target)))
;; For Xtensa, apply Qualcomm's patch.
(cross (if (string-prefix? "xtensa-" target)
(package-with-patch binutils
(search-patch
"ath9k-htc-firmware-binutils.patch"))
binutils)
target)))
(define (cross-gcc-arguments target libc) (define (cross-gcc-arguments target libc)
"Return build system arguments for a cross-gcc for TARGET, using LIBC (which "Return build system arguments for a cross-gcc for TARGET, using LIBC (which
@ -165,6 +178,13 @@ may be either a libc package or #f.)"
;; for instance. ;; for instance.
#f)))) #f))))
(define (cross-gcc-patches target)
"Return GCC patches needed for TARGET."
(cond ((string-prefix? "xtensa-" target)
;; Patch by Qualcomm needed to build the ath9k-htc firmware.
(list (search-patch "ath9k-htc-firmware-gcc.patch")))
(else '())))
(define* (cross-gcc target (define* (cross-gcc target
#:optional (xbinutils (cross-binutils target)) libc) #:optional (xbinutils (cross-binutils target)) libc)
"Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use
@ -176,8 +196,8 @@ GCC that does not target a libc; otherwise, target that libc."
target)) target))
(source (origin (inherit (package-source gcc-4.8)) (source (origin (inherit (package-source gcc-4.8))
(patches (patches
(list (search-patch (cons (search-patch "gcc-cross-environment-variables.patch")
"gcc-cross-environment-variables.patch"))))) (cross-gcc-patches target)))))
;; For simplicity, use a single output. Otherwise libgcc_s & co. are not ;; For simplicity, use a single output. Otherwise libgcc_s & co. are not
;; found by default, etc. ;; found by default, etc.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,119 @@
This GCC patch is from the ath9k-htc-firmware repository (version 1.3.2).
Not applying it (apparently) leads to miscompiled firmware, and loading it
fails with a "Target is unresponsive" message from the 'ath9k_htc' module.
From c7162b8a3db42e7faf47606d3aa3dd61e64aea17 Mon Sep 17 00:00:00 2001
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Date: Mon, 7 Jan 2013 16:06:28 +0530
Subject: [PATCH] gcc: AR9271/AR7010 config
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
include/xtensa-config.h | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/include/xtensa-config.h b/include/xtensa-config.h
index 30f4f41..fe9b051 100644
--- a/include/xtensa-config.h
+++ b/include/xtensa-config.h
@@ -1,7 +1,7 @@
/* Xtensa configuration settings.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
- Contributed by Bob Wilson (bob.wilson@acm.org) at Tensilica.
+ Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,10 +44,7 @@
#define XCHAL_HAVE_L32R 1
#undef XSHAL_USE_ABSOLUTE_LITERALS
-#define XSHAL_USE_ABSOLUTE_LITERALS 0
-
-#undef XSHAL_HAVE_TEXT_SECTION_LITERALS
-#define XSHAL_HAVE_TEXT_SECTION_LITERALS 1 /* Set if there is some memory that allows both code and literals. */
+#define XSHAL_USE_ABSOLUTE_LITERALS 1
#undef XCHAL_HAVE_MAC16
#define XCHAL_HAVE_MAC16 0
@@ -59,10 +56,10 @@
#define XCHAL_HAVE_MUL32 1
#undef XCHAL_HAVE_MUL32_HIGH
-#define XCHAL_HAVE_MUL32_HIGH 0
+#define XCHAL_HAVE_MUL32_HIGH 1
#undef XCHAL_HAVE_DIV32
-#define XCHAL_HAVE_DIV32 1
+#define XCHAL_HAVE_DIV32 0
#undef XCHAL_HAVE_NSA
#define XCHAL_HAVE_NSA 1
@@ -103,8 +100,6 @@
#undef XCHAL_HAVE_FP_RSQRT
#define XCHAL_HAVE_FP_RSQRT 0
-#undef XCHAL_HAVE_DFP_accel
-#define XCHAL_HAVE_DFP_accel 0
#undef XCHAL_HAVE_WINDOWED
#define XCHAL_HAVE_WINDOWED 1
@@ -119,32 +114,32 @@
#undef XCHAL_ICACHE_SIZE
-#define XCHAL_ICACHE_SIZE 16384
+#define XCHAL_ICACHE_SIZE 0
#undef XCHAL_DCACHE_SIZE
-#define XCHAL_DCACHE_SIZE 16384
+#define XCHAL_DCACHE_SIZE 0
#undef XCHAL_ICACHE_LINESIZE
-#define XCHAL_ICACHE_LINESIZE 32
+#define XCHAL_ICACHE_LINESIZE 16
#undef XCHAL_DCACHE_LINESIZE
-#define XCHAL_DCACHE_LINESIZE 32
+#define XCHAL_DCACHE_LINESIZE 16
#undef XCHAL_ICACHE_LINEWIDTH
-#define XCHAL_ICACHE_LINEWIDTH 5
+#define XCHAL_ICACHE_LINEWIDTH 4
#undef XCHAL_DCACHE_LINEWIDTH
-#define XCHAL_DCACHE_LINEWIDTH 5
+#define XCHAL_DCACHE_LINEWIDTH 4
#undef XCHAL_DCACHE_IS_WRITEBACK
-#define XCHAL_DCACHE_IS_WRITEBACK 1
+#define XCHAL_DCACHE_IS_WRITEBACK 0
#undef XCHAL_HAVE_MMU
#define XCHAL_HAVE_MMU 1
#undef XCHAL_MMU_MIN_PTE_PAGE_SIZE
-#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 12
+#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 29
#undef XCHAL_HAVE_DEBUG
@@ -157,8 +152,11 @@
#define XCHAL_NUM_DBREAK 2
#undef XCHAL_DEBUGLEVEL
-#define XCHAL_DEBUGLEVEL 6
+#define XCHAL_DEBUGLEVEL 4
+
+#undef XCHAL_EXCM_LEVEL
+#define XCHAL_EXCM_LEVEL 3
#undef XCHAL_MAX_INSTRUCTION_SIZE
#define XCHAL_MAX_INSTRUCTION_SIZE 3
--
1.8.1