From 1306b0b003a557105d3b27e44052db217c7283d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 11 Nov 2014 21:54:41 +0100 Subject: 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. --- gnu/packages/cross-base.scm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'gnu/packages/cross-base.scm') diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index a91952daca..a68711c91f 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -45,6 +45,12 @@ `(cons ,(string-append "--target=" target) ,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) "Return a cross-Binutils for TARGET." (let ((binutils (package (inherit binutils) @@ -64,7 +70,14 @@ ;; practice the RUNPATH of target libs only refers to ;; target libs, not native libs, so this is safe. `(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) "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. #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 #:optional (xbinutils (cross-binutils target)) libc) "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)) (source (origin (inherit (package-source gcc-4.8)) (patches - (list (search-patch - "gcc-cross-environment-variables.patch"))))) + (cons (search-patch "gcc-cross-environment-variables.patch") + (cross-gcc-patches target))))) ;; For simplicity, use a single output. Otherwise libgcc_s & co. are not ;; found by default, etc. -- cgit v1.2.3