unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob fd69bc1606e06fcdbbeab612332bd24642d82dbb 5367 bytes (raw)
name: gnu/packages/u-boot.scm 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages u-boot)
  #:use-module (guix build-system gnu)
  #:use-module (guix download)
  #:use-module (guix packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module ((gnu packages algebra) #:select (bc))
  #:use-module (gnu packages bison)
  #:use-module (gnu packages cross-base)
  #:use-module (gnu packages flex)
  #:use-module (gnu packages python))

(define-public dtc
  (package
    (name "dtc")
    (version "1.4.1")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://www.kernel.org/pub/software/utils/dtc/"
                    "dtc-" version ".tar.xz"))
              (sha256
               (base32
                "155v52palf5fwfcnq696s41whjk0a5dqx98b7maqzdn7xbc2m6bp"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("bison" ,bison)
       ("flex" ,flex)))
    (arguments
     `(#:make-flags
       (list "CC=gcc" (string-append "PREFIX=" (assoc-ref %outputs "out")))
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-paths
           (lambda _
             (substitute* "Makefile"
               (("/usr/bin/install") "install"))
             (substitute* "Makefile"
               (("PREFIX = \\$\\(HOME\\)") ""))))
         (delete 'configure))))
    (home-page "https://www.devicetree.org")
    (synopsis "Compiles Device Tree Source Files (.dts)")
    (description "dtc compiles Device Tree Source Files to Device Tree Binary Files.
These are hardware (board) description files (used by Linux and BSD).")
    (license license:gpl2+)))

(define u-boot
  (package
    (name "u-boot")
    (version "2016.07")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "ftp://ftp.denx.de/pub/u-boot/"
                    "u-boot-" version ".tar.bz2"))
              (sha256
               (base32
                "0lqj4ckmfqiap8mc6z2d5albs3g2h5mzccbn60hsgxhabhibfkwp"))))
    (native-inputs
     `(("bc" ,bc)
       ("dtc" ,dtc)
       ("python-2" ,python-2)))
    (build-system  gnu-build-system)
    (home-page "http://www.denx.de/wiki/U-Boot/")
    (synopsis "ARM Universal Bootloader")
    (description "U-Boot is an universal bootloader mostly used for ARM boards.
It also initializes the boards (RAM etc).")
    (license license:gpl2+)))

(define (make-u-boot-package board triplet xgcc)
  (package
    (inherit u-boot)
    (name (string-append "u-boot-" (string-downcase board)))
    (native-inputs
     `(("cross-gcc" ,xgcc)
       ("cross-binutils" ,(cross-binutils triplet))
       ,@(package-native-inputs u-boot)))
    (arguments
     `(#:test-target "test"
       #:make-flags
       (list "HOSTCC=gcc" (string-append "CROSS_COMPILE=" ,triplet "-"))
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda* (#:key outputs make-flags #:allow-other-keys)
             (let ((configname (string-append ,board "_defconfig")))
               (if (file-exists? (string-append "configs/" configname))
                   (zero? (apply system* "make" `(,@make-flags ,configname)))
                   (begin
                     (display "Invalid boardname. Valid boardnames would have been:")
                     (newline)
                     (system* "ls" "-1" "configs")
                     #f)))))
         (replace 'install
           (lambda* (#:key outputs make-flags #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (libexec (string-append out "/libexec"))
                    (uboot-files (find-files "." ".*\\.(bin|efi)$")))
               (mkdir-p libexec)
               (for-each
                (lambda (file-path)
                  (let ((target-file-path (string-append libexec "/" file-path)))
                    (mkdir-p (dirname target-file-path))
                    (copy-file file-path target-file-path)))
                uboot-files)))))))))

(define-public u-boot-vexpress_ca9x4
  (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf" xgcc-armhf))

(define-public u-boot-malta
  (make-u-boot-package "malta" "mips64el-linux-gnuabi64" xgcc-mips64el))

(define-public armhf-linux-uboot
  u-boot-vexpress_ca9x4)

(define-public mips64el-linux-uboot
  u-boot-malta)

;; Something should:
;; - create extlinux.conf and put it on the first bootable partition
;;   (the one with the Active flag)
;; - install the u-boot bootloader

debug log:

solving fd69bc1 ...
found fd69bc1 in https://yhetil.org/guix-devel/20160829161626.25216-1-david@craven.ch/
found e9376a4 in https://yhetil.org/guix-devel/20160829144822.3188-1-david@craven.ch/

applying [1/2] https://yhetil.org/guix-devel/20160829144822.3188-1-david@craven.ch/
diff --git a/gnu/packages/u-boot.scm b/gnu/packages/u-boot.scm
new file mode 100644
index 0000000..e9376a4


applying [2/2] https://yhetil.org/guix-devel/20160829161626.25216-1-david@craven.ch/
diff --git a/gnu/packages/u-boot.scm b/gnu/packages/u-boot.scm
index e9376a4..fd69bc1 100644

Checking patch gnu/packages/u-boot.scm...
Applied patch gnu/packages/u-boot.scm cleanly.
Checking patch gnu/packages/u-boot.scm...
Applied patch gnu/packages/u-boot.scm cleanly.

index at:
100644 fd69bc1606e06fcdbbeab612332bd24642d82dbb	gnu/packages/u-boot.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).