[PATCH] build-system: linux-module: Delete some huge items that we probably don't need.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 4 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200911110735.8208-1-dannym@scratchpost.org
* guix/build-system/linux-module.scm (make-linux-module-builder): Delete
some huge items that we probably don't need.
---
guix/build-system/linux-module.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Toggle diff (32 lines)
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index 1077215671..ba47817596 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -68,9 +68,27 @@
(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)
+ (if (file-exists? name)
+ (delete-file-recursively name)))
+ (map
+ (lambda (name)
+ (string-append out-lib-build "/" name))
+ '(;"arch" ; 137 MB ; Note: "scripts/dtc" depends on "arch".
+ ;"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
(let* ((linux (assoc-ref inputs "linux")))
(install-file (string-append linux "/System.map")
out-lib-build)
Danny Milosavljevic wrote 4 years ago
[PATCH v2] build-system: linux-module: Delete some huge items that we probably don't need.
(address . 43332@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200911114643.19958-1-dannym@scratchpost.org
* guix/build-system/linux-module.scm (make-linux-module-builder): Delete
some huge items that we probably don't need.
---
guix/build-system/linux-module.scm | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

Toggle diff (42 lines)
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index 1077215671..14ff774fca 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -68,9 +68,37 @@
(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)
+ (if (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.
+ (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")))
(let* ((linux (assoc-ref inputs "linux")))
(install-file (string-append linux "/System.map")
out-lib-build)
Danny Milosavljevic wrote 4 years ago
(address . 43332@debbugs.gnu.org)
20200911135157.20e8810a@scratchpost.org
v2 reduces the size of linux-module-builder to 176 MiB (from 255 MiB in v1).
However, it needs to do some invasive stuff that is a little more difficult to
maintain than v1.

With v2, the biggest remaining toplevel directories in linux-module-builder are
the following (including sizes in MB as first column):

6 ./lib/modules/build/arch/powerpc
6 ./lib/modules/build/include/uapi/linux
6 ./lib/modules/build/lib
6 ./lib/modules/build/scripts
7 ./lib/modules/build/arch/mips
8 ./lib/modules/build/arch/arm64/boot
8 ./lib/modules/build/arch/arm64/boot/dts
8 ./lib/modules/build/include/uapi
9 ./lib/modules/build/arch/arm64
11 ./lib/modules/build/kernel
13 ./lib/modules/build/tools
14 ./lib/modules/build/include/config
19 ./lib/modules/build/arch/arm/boot
19 ./lib/modules/build/arch/arm/boot/dts
22 ./lib/modules/build/include/linux
23 ./lib/modules/build/arch/arm
59 ./lib/modules/build/include
62 ./lib/modules/build/arch

The total is 176 MiB.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9bZN0ACgkQ5xo1VCww
uqXkDwf/d13DRznDqiGEx/3UnCR9v8jzqrnZ0f1sD6oY4lKhBSScgTs1/ZEQjEcU
smm6HqSU0f3wKfB16+kzFdkk2zqoaSevSV9hNHOTyINQEHpXpPeI/hIQVzjP7nYA
fqLqnnF4iTLDte5bitj/4qbZE+v4Fn54T289qC9hM3PW/dsqH7yYtCATynqBqGMG
N5643AwEvBA6Oy027G6OranMFehwICLydXNeh0ZTgzQ9ULZXMmulACat3GEU6ae6
218GVtYTpTeYs7s/55YxNGOwnIgw8Y7ScxxNq8wgKVZGU4wiiOnqzVxjhceZfNDe
6wrERlPTZgTP72nWmb/gqcKGlL9Mhw==
=QZLw
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 4 years ago
Re: [bug#43332] [PATCH] build-system: linux-module: Delete some huge items that we probably don't need.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 43332@debbugs.gnu.org)
874ko19xo0.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (3 lines)
> * guix/build-system/linux-module.scm (make-linux-module-builder): Delete
> some huge items that we probably don't need.

Yay! I’m fine with either v1 or v2, with one nit:

Toggle quote (18 lines)
> + (for-each
> + (lambda (name)
> + (if (file-exists? name)
> + (delete-file-recursively name)))
> + (map
> + (lambda (name)
> + (string-append out-lib-build "/" name))
> + '(;"arch" ; 137 MB ; Note: "scripts/dtc" depends on "arch".
> + ;"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

Usually the first argument to ‘map’ and ‘for-each’ is on the same line:

(for-each (lambda …)

If you’re afraid of hitting the 80 char limit or something, then I
suggest defining a local procedure.

Also, use ‘when’ instead of a one-arm ‘if’, for clarity.

Thanks!

Ludo’.
Danny Milosavljevic wrote 4 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 43332-done@debbugs.gnu.org)
20200914103051.0c7d0e54@scratchpost.org
Pushed v2 to guix master as commit 2be5c2652a5fd79089048905ff6be60d74244d7b.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9fKjsACgkQ5xo1VCww
uqWCFAf7BvZLHMoHEBd3m+1QRAKLA1QhyFue+RavYREWCQW3vCPw0pF65246Tf9M
Sgk7NyEjX+MCMZJYJF9psvyXX0zSyhricDCMnuqT0/OORa6O0/mPz/Ayor8lU2Qe
HW51e7OdT+n4e4akoo6TlYjdVVoKXTBr+YzPz0geuO+LD4bTTQq9S8JQ3JPOlP9s
zV22JHBEq1S3ZtTIMMSMbuQtpGn7VN8gE6+NsRy95W6lgeRrYtaTXJWBAU4OPxf6
HYWZgBOEAI7xFpfsFPXxy4puP1U5YM2UonqE3BlldavZ2lIDUkMFvjbegEYtMEO1
tAa0jcRbrePtoTG02HIQBtm/CHatVg==
=ktHw
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 43332@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 43332
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help