linux-initrd: Further strip the static Guile.
‘guile-static-initrd’ weighs in at 46 MiB, compared to 54 MiB for ‘guile-static-stripped’ (15% reduction). * gnu/packages/make-bootstrap.scm (make-guile-static-stripped): Add ‘directories-to-remove’ parameter and honor it. (%guile-static-initrd): New variable. * gnu/system/linux-initrd.scm (expression->initrd): Default to ‘%guile-static-initrd’. * doc/guix.texi (Initial RAM Disk): Adjust accordingly. Change-Id: I2baf06fed7a3698433e7c83b1d7726054a8c746emaster
parent
fb61323dba
commit
5f89f45e74
|
@ -41435,7 +41435,7 @@ program. That gives a lot of flexibility. The
|
||||||
program to run in that initrd.
|
program to run in that initrd.
|
||||||
|
|
||||||
@deffn {Procedure} expression->initrd exp @
|
@deffn {Procedure} expression->initrd exp @
|
||||||
[#:guile %guile-static-stripped] [#:name "guile-initrd"]
|
[#:guile %guile-static-initrd] [#:name "guile-initrd"]
|
||||||
Return as a file-like object a Linux initrd (a gzipped cpio archive)
|
Return as a file-like object a Linux initrd (a gzipped cpio archive)
|
||||||
containing @var{guile} and that evaluates @var{exp}, a G-expression,
|
containing @var{guile} and that evaluates @var{exp}, a G-expression,
|
||||||
upon booting. All the derivations referenced by @var{exp} are
|
upon booting. All the derivations referenced by @var{exp} are
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012-2021, 2023 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012-2021, 2023-2024 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2017, 2021 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2017, 2021 Efraim Flashner <efraim@flashner.co.il>
|
||||||
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||||
;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
|
||||||
|
@ -55,7 +55,8 @@
|
||||||
%guile-bootstrap-tarball
|
%guile-bootstrap-tarball
|
||||||
%bootstrap-tarballs
|
%bootstrap-tarballs
|
||||||
|
|
||||||
%guile-static-stripped))
|
%guile-static-stripped
|
||||||
|
%guile-static-initrd))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;;
|
;;;
|
||||||
|
@ -674,7 +675,8 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
|
||||||
"guile-3.0-linux-syscalls.patch"
|
"guile-3.0-linux-syscalls.patch"
|
||||||
"guile-3.0-relocatable.patch")))
|
"guile-3.0-relocatable.patch")))
|
||||||
|
|
||||||
(define* (make-guile-static-stripped static-guile)
|
(define* (make-guile-static-stripped static-guile
|
||||||
|
#:optional (directories-to-remove '()))
|
||||||
(package
|
(package
|
||||||
(inherit static-guile)
|
(inherit static-guile)
|
||||||
(name (string-append (package-name static-guile) "-stripped"))
|
(name (string-append (package-name static-guile) "-stripped"))
|
||||||
|
@ -702,6 +704,12 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
|
||||||
(mkdir (string-append out "/bin"))
|
(mkdir (string-append out "/bin"))
|
||||||
(copy-file guile1 guile2)
|
(copy-file guile1 guile2)
|
||||||
|
|
||||||
|
;; Optionally remove additional directories.
|
||||||
|
(for-each (lambda (directory)
|
||||||
|
(delete-file-recursively
|
||||||
|
(string-append out "/" directory)))
|
||||||
|
'#$directories-to-remove)
|
||||||
|
|
||||||
;; Verify that the relocated Guile works.
|
;; Verify that the relocated Guile works.
|
||||||
#$@(if (%current-target-system)
|
#$@(if (%current-target-system)
|
||||||
'()
|
'()
|
||||||
|
@ -720,10 +728,29 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
|
||||||
(synopsis "Minimal statically-linked and relocatable Guile")))
|
(synopsis "Minimal statically-linked and relocatable Guile")))
|
||||||
|
|
||||||
(define %guile-static-stripped
|
(define %guile-static-stripped
|
||||||
;; A stripped static Guile 3.0 binary, for use in initrds
|
;; A stripped static Guile 3.0 binary for use during bootstrap.
|
||||||
;; and during bootstrap.
|
|
||||||
(make-guile-static-stripped %guile-static-3.0))
|
(make-guile-static-stripped %guile-static-3.0))
|
||||||
|
|
||||||
|
(define %guile-static-initrd
|
||||||
|
;; A stripped static Guile 3.0 binary for use in initrds. Remove various
|
||||||
|
;; modules that are useless in an initrd. Note: Keep most of language/
|
||||||
|
;; because it is needed for Bournish.
|
||||||
|
(package
|
||||||
|
(inherit
|
||||||
|
(make-guile-static-stripped
|
||||||
|
%guile-static-3.0
|
||||||
|
(append-map (lambda (directory)
|
||||||
|
(list (string-append "lib/guile/3.0/ccache/" directory)
|
||||||
|
(string-append "share/guile/3.0/" directory)))
|
||||||
|
'("language/brainfuck"
|
||||||
|
"language/ecmascript"
|
||||||
|
"language/elisp"
|
||||||
|
"oop"
|
||||||
|
"scripts"
|
||||||
|
"texinfo"
|
||||||
|
"web"))))
|
||||||
|
(name "guile-static-initrd")))
|
||||||
|
|
||||||
(define (tarball-package pkg)
|
(define (tarball-package pkg)
|
||||||
"Return a package containing a tarball of PKG."
|
"Return a package containing a tarball of PKG."
|
||||||
(package
|
(package
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#:use-module ((gnu packages xorg)
|
#:use-module ((gnu packages xorg)
|
||||||
#:select (console-setup xkeyboard-config))
|
#:select (console-setup xkeyboard-config))
|
||||||
#:use-module ((gnu packages make-bootstrap)
|
#:use-module ((gnu packages make-bootstrap)
|
||||||
#:select (%guile-static-stripped))
|
#:select (%guile-static-initrd))
|
||||||
#:use-module (gnu system file-systems)
|
#:use-module (gnu system file-systems)
|
||||||
#:use-module (gnu system mapped-devices)
|
#:use-module (gnu system mapped-devices)
|
||||||
#:use-module (gnu system keyboard)
|
#:use-module (gnu system keyboard)
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
(define* (expression->initrd exp
|
(define* (expression->initrd exp
|
||||||
#:key
|
#:key
|
||||||
(guile %guile-static-stripped)
|
(guile %guile-static-initrd)
|
||||||
(gzip gzip)
|
(gzip gzip)
|
||||||
(name "guile-initrd")
|
(name "guile-initrd")
|
||||||
(system (%current-system)))
|
(system (%current-system)))
|
||||||
|
|
Reference in New Issue