summaryrefslogtreecommitdiff
path: root/guix/build-system
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2020-09-14 00:24:13 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2020-09-14 10:15:43 +0200
commit2be5c2652a5fd79089048905ff6be60d74244d7b (patch)
tree55f54b6b4d03aa29e15f8095eb9ee0bbfb8357a8 /guix/build-system
parentf165f7c9cb12f53b11ea5874e7e5bb07ee3beef7 (diff)
build-system: linux-module: Delete some huge items that we probably don't need.
* guix/build-system/linux-module.scm (make-linux-module-builder): Delete some huge items that we probably don't need.
Diffstat (limited to 'guix/build-system')
-rw-r--r--guix/build-system/linux-module.scm29
1 files changed, 28 insertions, 1 deletions
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index 1077215671..fc3d959ce7 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -68,14 +68,41 @@
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(out-lib-build (string-append out "/lib/modules/build")))
+ ;; Delete some huge items that we probably don't need.
;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig,
;; scripts, include, ".config".
(copy-recursively "." out-lib-build)
+ (for-each (lambda (name)
+ (when (file-exists? name)
+ (delete-file-recursively name)))
+ (map (lambda (name)
+ (string-append out-lib-build "/" name))
+ '("arch" ; 137 MB
+ ;"tools" ; 44 MB ; Note: is built by our 'build phase.
+ "tools/testing" ; 14 MB
+ "tools/perf" ; 17 MB
+ "drivers" ; 600 MB
+ "Documentation" ; 52 MB
+ "fs" ; 43 MB
+ "net" ; 33 MB
+ "samples" ; 2 MB
+ "sound"))) ; 40 MB
+ ;; Reinstate arch/**/dts since "scripts/dtc" depends on it.
+ ;; Reinstate arch/**/include directories.
+ ;; Reinstate arch/**/Makefile.
+ ;; Reinstate arch/**/module.lds.
+ (for-each
+ (lambda (name)
+ (mkdir-p (dirname (string-append out-lib-build "/" name)))
+ (copy-recursively name
+ (string-append out-lib-build "/" name)))
+ (append (find-files "arch" "^(dts|include)$" #:directories? #t)
+ (find-files "arch" "^(Makefile|module.lds)$")))
(let* ((linux (assoc-ref inputs "linux")))
(install-file (string-append linux "/System.map")
out-lib-build)
(let ((source (string-append linux "/Module.symvers")))
- (if (file-exists? source)
+ (when (file-exists? source)
(install-file source out-lib-build))))
#t)))))))))