unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#43332] [PATCH] build-system: linux-module: Delete some huge items that we probably don't need.
@ 2020-09-11 11:07 Danny Milosavljevic
  2020-09-11 11:46 ` [bug#43332] [PATCH v2] " Danny Milosavljevic
  2020-09-13 21:25 ` [bug#43332] [PATCH] " Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Danny Milosavljevic @ 2020-09-11 11:07 UTC (permalink / raw)
  To: 43332; +Cc: Danny Milosavljevic

* 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(+)

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)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#43332] [PATCH v2] build-system: linux-module: Delete some huge items that we probably don't need.
  2020-09-11 11:07 [bug#43332] [PATCH] build-system: linux-module: Delete some huge items that we probably don't need Danny Milosavljevic
@ 2020-09-11 11:46 ` Danny Milosavljevic
  2020-09-11 11:51   ` Danny Milosavljevic
  2020-09-13 21:25 ` [bug#43332] [PATCH] " Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Danny Milosavljevic @ 2020-09-11 11:46 UTC (permalink / raw)
  To: 43332; +Cc: Danny Milosavljevic

* 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(+)

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)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#43332] [PATCH v2] build-system: linux-module: Delete some huge items that we probably don't need.
  2020-09-11 11:46 ` [bug#43332] [PATCH v2] " Danny Milosavljevic
@ 2020-09-11 11:51   ` Danny Milosavljevic
  0 siblings, 0 replies; 5+ messages in thread
From: Danny Milosavljevic @ 2020-09-11 11:51 UTC (permalink / raw)
  To: 43332

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

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.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#43332] [PATCH] build-system: linux-module: Delete some huge items that we probably don't need.
  2020-09-11 11:07 [bug#43332] [PATCH] build-system: linux-module: Delete some huge items that we probably don't need Danny Milosavljevic
  2020-09-11 11:46 ` [bug#43332] [PATCH v2] " Danny Milosavljevic
@ 2020-09-13 21:25 ` Ludovic Courtès
  2020-09-14  8:30   ` bug#43332: " Danny Milosavljevic
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2020-09-13 21:25 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 43332

Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * 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:

> +                (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’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#43332: [PATCH] build-system: linux-module: Delete some huge items that we probably don't need.
  2020-09-13 21:25 ` [bug#43332] [PATCH] " Ludovic Courtès
@ 2020-09-14  8:30   ` Danny Milosavljevic
  0 siblings, 0 replies; 5+ messages in thread
From: Danny Milosavljevic @ 2020-09-14  8:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 43332-done

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Pushed v2 to guix master as commit 2be5c2652a5fd79089048905ff6be60d74244d7b.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-14  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 11:07 [bug#43332] [PATCH] build-system: linux-module: Delete some huge items that we probably don't need Danny Milosavljevic
2020-09-11 11:46 ` [bug#43332] [PATCH v2] " Danny Milosavljevic
2020-09-11 11:51   ` Danny Milosavljevic
2020-09-13 21:25 ` [bug#43332] [PATCH] " Ludovic Courtès
2020-09-14  8:30   ` bug#43332: " Danny Milosavljevic

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git