gnu: linux-libre: Add support for cross-compilation.

* gnu/packages/linux.scm (linux-libre): Add support for
  cross-compilation.
This commit is contained in:
David Craven 2016-09-02 18:05:37 +02:00
parent 9416459b72
commit 4b42703ed5
No known key found for this signature in database
GPG Key ID: C5E051C79C0BECDB
1 changed files with 10 additions and 5 deletions

View File

@ -291,18 +291,23 @@ for SYSTEM and optionally VARIANT, or #f if there is no such configuration."
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(replace 'configure (replace 'configure
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs native-inputs target #:allow-other-keys)
;; Avoid introducing timestamps ;; Avoid introducing timestamps
(setenv "KCONFIG_NOTIMESTAMP" "1") (setenv "KCONFIG_NOTIMESTAMP" "1")
(setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH")) (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
;; Set ARCH and CROSS_COMPILE
(let ((arch ,(system->linux-architecture (let ((arch ,(system->linux-architecture
(or (%current-target-system) (or (%current-target-system)
(%current-system))))) (%current-system)))))
(setenv "ARCH" arch)) (setenv "ARCH" arch)
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
(when target
(setenv "CROSS_COMPILE" (string-append target "-"))
(format #t "`CROSS_COMPILE' set to `~a'~%"
(getenv "CROSS_COMPILE"))))
(let ((build (assoc-ref %standard-phases 'build)) (let ((build (assoc-ref %standard-phases 'build))
(config (assoc-ref inputs "kconfig"))) (config (assoc-ref inputs "kconfig")))
@ -334,10 +339,10 @@ for SYSTEM and optionally VARIANT, or #f if there is no such configuration."
(zero? (system* "make" "oldconfig"))))) (zero? (system* "make" "oldconfig")))))
(replace 'install (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(moddir (string-append out "/lib/modules")) (moddir (string-append out "/lib/modules"))
(mit (assoc-ref inputs "module-init-tools"))) (mit (assoc-ref (or native-inputs inputs) "module-init-tools")))
(mkdir-p moddir) (mkdir-p moddir)
(for-each (lambda (file) (for-each (lambda (file)
(copy-file file (copy-file file