Skip to content

Commit

Permalink
Merge branch 'new' into wip-musl
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrilleratplay committed Dec 15, 2020
2 parents e37876a + aecc8ef commit fb42e31
Show file tree
Hide file tree
Showing 45 changed files with 2,354 additions and 1,469 deletions.
49 changes: 49 additions & 0 deletions osresearch/packages.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Tom Hiller <[email protected]>
;;; Copyright © 2020 Andrew Whatson <[email protected]>
;;;
;;; This file is NOT part of GNU Guix.
;;;
;;; 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
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.

(define-module (osresearch packages)
#:use-module ((gnu packages) #:prefix gnu:)
#:use-module (guix diagnostics)
#:use-module (guix i18n)
#:use-module (srfi srfi-1)
#:export (search-patch
search-patches
%patch-path))

(define (search-patch file-name)
"Search the patch FILE-NAME. Raise an error if not found."
(or (search-path (%patch-path) file-name)
(raise (formatted-message (G_ "~a: patch not found")
file-name))))

(define-syntax-rule (search-patches file-name ...)
"Return the list of absolute file names corresponding to each
FILE-NAME found in %PATCH-PATH."
(list (search-patch file-name) ...))

(define %channel-root
(find (lambda (path)
(file-exists? (string-append path "/osresearch/packages.scm")))
%load-path))

(define %patch-path
(make-parameter
(append
(list (string-append %channel-root "/osresearch/packages/patches"))
(gnu:%patch-path))))
124 changes: 124 additions & 0 deletions osresearch/packages/boards/linuxboot-qemu.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
;;; Copyright © 2020 Danny Milosavljevic <[email protected]>
;;;
;;; Heads 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 2 of the License, or (at
;;; your option) any later version.
;;;
;;; Heads 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 Heads. If not, see <http://www.gnu.org/licenses/>.

(define-module (osresearch packages boards linuxboot-qemu)
#:use-module (osresearch packages linux)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:use-module (gnu packages perl)
#:use-module (gnu packages admin)
#:use-module (gnu packages compression)
#:use-module (gnu packages file)
#:use-module (gnu packages linux)
#:use-module (gnu packages assembly)
#:use-module (gnu packages python)
#:use-module (guix utils))

(define udk2018
(origin
(method git-fetch)
(uri
(git-reference
(url "https://github.com/linuxboot/edk2")
(commit "UDK2018"))) ; branch
(file-name "edk2")
(sha256
(base32 "0s3vljxhbsbdjy2a2ydv0835rhdakvhn8c8p4x4ch29fcrjc3ymf"))))

;; FIXME musl-build-system
(define (heads-linuxboot board)
(package
(name (string-append "heads-linuxboot-" board))
(version "FIXME")
(source (origin
(method git-fetch)
(uri
(git-reference
(url "https://github.com/osresearch/linuxboot")
(commit "b5376a441e8e85cbf722e943bb8294958e87c784")))
(file-name (string-append name "-" version "-checkout"))
(sha256
(base32
"1bdj4m9dvih9fhp5q5c6cp5sphzbpag5gp4bz1p8g9lqi49lb7av"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags
(list "SHELL=bash"
(string-append "CC=" ,(cc-for-target))
"BUILD_CC=gcc"
(string-append "KERNEL=" (assoc-ref %build-inputs "heads-linux") "/bzImage")
(string-append "INITRD=initrd.cpio.xz")
(string-append "BOARD=" ,board))
#:phases
(modify-phases %standard-phases
(replace 'configure
(lambda _
(setenv "SHELL" "bash")
#t))
(add-after 'unpack 'unpack-edk2
(lambda* (#:key inputs #:allow-other-keys)
(copy-recursively (assoc-ref inputs "edk2") "edk2")
;; Delete broken link.
(chmod "edk2/EmulatorPkg/Unix/Host" #o770)
(delete-file "edk2/EmulatorPkg/Unix/Host/X11IncludeHack")
;; The git checkout must be writable for tests.
(for-each make-file-writable (find-files "edk2"))
;; Guix reproducibility had .git deleted, but the Makefile expects it as a (fake) dependency.
(call-with-output-file "edk2/.git"
(const #t))
#t))
(add-after 'unpack-edk2 'build-edk2
(lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "make" "edk2.force" make-flags)
(when (string=? ,board "qemu")
(with-directory-excursion "edk2/OvmfPkg"
(invoke "./build.sh" "-n" (number->string (parallel-job-count)))))))
(add-after 'unpack 'patch-references
(lambda _
(substitute* "dxe/Makefile"
(("/usr/bin/printf") "command printf"))
#t))
(add-after 'unpack 'prepare-initrd
(lambda* (#:key inputs #:allow-other-keys)
(copy-file (string-append (assoc-ref inputs "heads-dev-cpio") "/libexec/dev.cpio")
"initrd.cpio")
;; FIXME: Make sure that initrd.cpio.xz is a multiple of 512 Byte long! (see Heads)
(invoke "xz" "-f" "--check=crc32" "--lzma2=dict=1MiB" "-9"
"initrd.cpio")
#t)))))
(propagated-inputs
`())
(native-inputs
`(("acpica" ,acpica)
("brotli" ,google-brotli)
("edk2" ,udk2018)
("file" ,file)
("libuuid" ,util-linux "lib")
("nasm" ,nasm)
("perl" ,perl)
("python" ,python-2)
("xz" ,xz)))
(inputs
`(
; ("heads-dev-cpio" ,heads-dev-cpio)
("heads-linux" ,heads-linux)))
(synopsis "linuxboot")
(description "FIXME")
(home-page "FIXME")
(license #f)))

(define-public linuxboot-qemu
(heads-linuxboot "qemu"))
77 changes: 77 additions & 0 deletions osresearch/packages/boards/x230.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
;;; Copyright © 2020 Danny Milosavljevic <[email protected]>
;;;
;;; Heads 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 2 of the License, or (at
;;; your option) any later version.
;;;
;;; Heads 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 Heads. If not, see <http://www.gnu.org/licenses/>.


(define-module (osresearch packages boards x230)
#:use-module (osresearch packages cairo)
#:use-module (osresearch packages cryptsetup)
#:use-module (osresearch packages dropbear)
#:use-module (osresearch packages fbwhiptail)
#:use-module (osresearch packages flashrom)
#:use-module (osresearch packages flashtools)
#:use-module (osresearch packages gpg)
#:use-module (osresearch packages kexec)
#:use-module (osresearch packages lvm2)
#:use-module (osresearch packages mbedtls)
#:use-module (osresearch packages pciutils)
#:use-module (osresearch packages popt)
#:use-module (osresearch packages qrencode)
#:use-module (osresearch packages tpmtotp)
#:use-module (osresearch packages util-linux)
#:use-module (gnu packages linux)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system gnu))

(define-public heads-boards-x230
(let ((revision "0")
(commit "671522eff43bbf87e3112ed0075f29fbf1a391fe"))
(package
(name "heads-boards-x230")
(version (git-version "0.1" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/osresearch/heads.git")
(commit commit)))
(file-name (string-append name "-" version "-checkout"))
(sha256
(base32
"1m5yikx3l3s2khdnrbvqdb14khsync0hrkq35bv4h2ydhdmq6s9y"))))
(build-system gnu-build-system)
(inputs
`(("heads-cryptsetup" ,heads-cryptsetup)
("heads-flashrom" ,heads-flashrom)
("heads-flashtools" ,heads-flashtools)
("heads-gpg2" ,heads-gpg2)
("heads-kexec" ,heads-kexec)
("heads-util-linux" ,heads-util-linux "lib")
("heads-lvm2" ,heads-lvm2)
("heads-mbedtls" ,heads-mbedtls)
("heads-pciutils" ,heads-pciutils)
("heads-popt" ,heads-popt)
("heads-qrencode" ,heads-qrencode)
("heads-tpmtotp" ,heads-tpmtotp)
("heads-dropbear" ,heads-dropbear)
("heads-cairo" ,heads-cairo)
("heads-fbwhiptail" ,heads-fbwhiptail)

; TODO CONFIG_LINUX_USBff
))
(synopsis "heads-boards-x230")
(description "This package provides a firmware image to flash to an
X230.")
(home-page "https://github.com/osresearch/heads/")
(license license:gpl2))))
75 changes: 75 additions & 0 deletions osresearch/packages/busybox.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
;;; Copyright © 2020 Danny Milosavljevic <[email protected]>
;;;
;;; Heads 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 2 of the License, or (at
;;; your option) any later version.
;;;
;;; Heads 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 Heads. If not, see <http://www.gnu.org/licenses/>.

(define-module (osresearch packages busybox)
#:use-module (osresearch packages gcc)
#:use-module (gnu packages busybox)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix utils)
#:use-module (gnu packages musl)
#:use-module (gnu packages admin)
#:use-module (gnu packages compression)
#:use-module (gnu packages base)
#:use-module (guix build-system gnu))

(define (package-with-musl base)
(package
(inherit base)
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:implicit-inputs? #f #f)
#f)
((#:disallowed-references disallowed-references '())
(cons glibc disallowed-references))
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'setenv-musl
(lambda _
#t))))))
(native-inputs
`(("musl" ,musl)
("tar" ,tar)
("make" ,gnu-make) ; TODO: gnu-make-final
("coreutils" ,coreutils) ; example user: heads-busybox package.
("xz" ,xz)
("gcc" ,gcc-8.3)
,@(package-native-inputs base)))))

;; FIXME musl-build-system
(define-public heads-busybox
(package-with-musl (package
(inherit busybox)
(name "heads-busybox")
(version "1.31.1")
(source (origin
(method url-fetch)
(uri (string-append "https://busybox.net/downloads/busybox-"
version ".tar.bz2"))
(sha256
(base32
"1659aabzp8w4hayr4z8kcpbk2z1q2wqhw7i1yb0l72b45ykl1yfh"))
(patches
(search-patches
"busybox-1.31.1-fix-build-with-glibc-2.31.patch"))))
(build-system gnu-build-system)
(propagated-inputs
`())
(native-inputs
`(("inetutils" ,inetutils) ; for the tests
("which" ,which) ; for the tests
("zip" ,zip))) ; for the tests
(inputs
`()))))
47 changes: 47 additions & 0 deletions osresearch/packages/cairo.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
;;; Copyright © 2020 Danny Milosavljevic <[email protected]>
;;;
;;; Heads 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 2 of the License, or (at
;;; your option) any later version.
;;;
;;; Heads 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 Heads. If not, see <http://www.gnu.org/licenses/>.

(define-module (osresearch packages cairo)
#:use-module (osresearch packages libpng)
#:use-module (osresearch packages pixman)
#:use-module (gnu packages gtk)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages pkg-config))

;; FIXME musl-build-system
(define-public heads-cairo
(package
(inherit cairo)
(name "heads-cairo")
(version "1.14.12")
(source (origin
(method url-fetch)
(uri
(string-append "https://www.cairographics.org/releases/cairo-"
version ".tar.xz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"05mzyxkvsfc1annjw2dja8vka01ampp9pp93lg09j8hba06g144c"))))
(build-system gnu-build-system)
(propagated-inputs
`(("heads-libpng" ,heads-libpng)
("heads-pixman" ,heads-pixman)))
(native-inputs
`(("pkg-config" ,pkg-config)))
(inputs
`())))
Loading

0 comments on commit fb42e31

Please sign in to comment.