bootstrap: Reduced Binary Seed bootstrap for x86_64 too.

* gnu/packages/bootstrap.scm (%bootstrap-inputs): Replace %bootstrap-libc,
%bootstrap-gcc, and %bootstrap-binutils with Mes seeds for x86_64 too.
* gnu/packages/commencement.scm (tcc-boot0, tcc-boot, gcc-mesboot1,
gcc-mesboot1-wrapper, m4-mesboot, %bootstrap-inputs+toolchain,
libstdc++-boot0, gcc-boot0, bison-boot0): For x86_64-linux, use i686-linux
glibc-dynamic-linker and Mes bootstrap settings.
(gcc-boot0-intermediate-wrapped): New variable, extract from
static-bash-for-glibc.
(static-bash-for-glibc): Use it.
(gcc-final): Copy gmp&co phase from gcc-boot0, inherit other arguments
from gcc; avoid i686-linux impersonation from gcc-boot0.
* doc/guix.texi (Bootstrapping, Reduced Binary Seed Bootstrap): Note
x86_64-linux also as Reduced Binary Seed bootstrap.
This commit is contained in:
Jan Nieuwenhuizen 2018-09-19 17:23:09 +02:00
parent a243722c5b
commit eb4434598c
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
3 changed files with 91 additions and 52 deletions

View file

@ -23554,8 +23554,8 @@ Binutils, libc, and the other packages mentioned above---the
These bootstrap binaries are ``taken for granted'', though we can also These bootstrap binaries are ``taken for granted'', though we can also
re-create them if needed (more on that later). re-create them if needed (more on that later).
For @code{i686-linux} the Guix bootstrap process is more elaborate, For @code{i686-linux} and @code{x86_64-linux} the Guix bootstrap process is
@pxref{Reduced Binary Seed Bootstrap}. more elaborate, @pxref{Reduced Binary Seed Bootstrap}.
@unnumberedsubsec Preparing to Use the Bootstrap Binaries @unnumberedsubsec Preparing to Use the Bootstrap Binaries
@ -23725,10 +23725,10 @@ problem: the current combined size of these bootstrap binaries is about 250MB
(@pxref{Bootstrappable Builds,,, mes, Mes Reference Manual}). Auditing or (@pxref{Bootstrappable Builds,,, mes, Mes Reference Manual}). Auditing or
even inspecting these is next to impossible. even inspecting these is next to impossible.
For @code{i686-linux}, Guix now features a ``Reduced Binary Seed'' bootstrap For @code{i686-linux} and @code{x86_64-linux}, Guix now features a ``Reduced
@footnote{We would like to say: ``Full Source Bootstrap'' and while we are Binary Seed'' bootstrap @footnote{We would like to say: ``Full Source
working towards that goal it would be hyperbole to use that term for what we Bootstrap'' and while we are working towards that goal it would be hyperbole
do now.}. to use that term for what we do now.}.
The Reduced Binary Seed bootstrap removes the most critical tools---from a The Reduced Binary Seed bootstrap removes the most critical tools---from a
trust perspective---from the bootstrap binaries: GCC, Binutils and the GNU C trust perspective---from the bootstrap binaries: GCC, Binutils and the GNU C

View file

@ -656,13 +656,14 @@ (define (%bootstrap-inputs)
;; The initial, pre-built inputs. From now on, we can start building our ;; The initial, pre-built inputs. From now on, we can start building our
;; own packages. ;; own packages.
`(,@(match (%current-system) `(,@(match (%current-system)
("i686-linux" `(("linux-libre-headers" ,%bootstrap-linux-libre-headers) ((or "i686-linux" "x86_64-linux")
`(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
("mescc-tools-seed" ,%mescc-tools-seed) ("mescc-tools-seed" ,%mescc-tools-seed)
("mes-seed" ,%mes-seed) ("mes-seed" ,%mes-seed)
("srfi-43" ,%srfi-43 ) ("srfi-43" ,%srfi-43 )
("tinycc-seed" ,%tinycc-seed))) ("tinycc-seed" ,%tinycc-seed)))
(_
(_ `(("libc" ,%bootstrap-glibc) `(("libc" ,%bootstrap-glibc)
("gcc" ,%bootstrap-gcc) ("gcc" ,%bootstrap-gcc)
("binutils" ,%bootstrap-binutils)))) ("binutils" ,%bootstrap-binutils))))
("coreutils&co" ,%bootstrap-coreutils&co) ("coreutils&co" ,%bootstrap-coreutils&co)

View file

@ -383,7 +383,8 @@ (define tcc-boot0
(mescc-tools (assoc-ref %build-inputs "mescc-tools")) (mescc-tools (assoc-ref %build-inputs "mescc-tools"))
(libc (assoc-ref %build-inputs "libc")) (libc (assoc-ref %build-inputs "libc"))
(interpreter (if libc (interpreter (if libc
(string-append libc ,(glibc-dynamic-linker)) ;; also for x86_64-linux, we are still on i686-linux
(string-append libc ,(glibc-dynamic-linker "i686-linux"))
(string-append mes "/lib/mes-loader")))) (string-append mes "/lib/mes-loader"))))
(setenv "PATH" (string-append (setenv "PATH" (string-append
coreutils "/bin" coreutils "/bin"
@ -488,7 +489,8 @@ (define tcc-boot
(tcc (assoc-ref %build-inputs "tcc")) (tcc (assoc-ref %build-inputs "tcc"))
(libc (assoc-ref %build-inputs "libc")) (libc (assoc-ref %build-inputs "libc"))
(interpreter (if libc (interpreter (if libc
(string-append libc ,(glibc-dynamic-linker)) ;; also for x86_64-linux, we are still on i686-linux
(string-append libc ,(glibc-dynamic-linker "i686-linux"))
(string-append mes "/lib/mes-loader")))) (string-append mes "/lib/mes-loader"))))
;; unpack ;; unpack
(setenv "PATH" (string-append (setenv "PATH" (string-append
@ -510,7 +512,8 @@ (define tcc-boot
(tcc (assoc-ref %build-inputs "tcc")) (tcc (assoc-ref %build-inputs "tcc"))
(libc (assoc-ref %build-inputs "libc")) (libc (assoc-ref %build-inputs "libc"))
(interpreter (if libc (interpreter (if libc
(string-append libc ,(glibc-dynamic-linker)) ;; also for x86_64-linux, we are still on i686-linux
(string-append libc ,(glibc-dynamic-linker "i686-linux"))
(string-append mes "/lib/mes-loader")))) (string-append mes "/lib/mes-loader"))))
(invoke "tcc" (invoke "tcc"
"-vvv" "-vvv"
@ -1140,7 +1143,7 @@ (define gcc-mesboot1
"-B" libc "/lib " "-B" libc "/lib "
"-Wl,-dynamic-linker " "-Wl,-dynamic-linker "
"-Wl," libc "-Wl," libc
,(glibc-dynamic-linker)))) ,(glibc-dynamic-linker "i686-linux"))))
(list (string-append "LDFLAGS=" ldflags) (list (string-append "LDFLAGS=" ldflags)
(string-append "LDFLAGS_FOR_TARGET=" ldflags)))) (string-append "LDFLAGS_FOR_TARGET=" ldflags))))
((#:phases phases) ((#:phases phases)
@ -1267,7 +1270,8 @@ (define gcc-mesboot1-wrapper
(display (string-append "#! " bash "/bin/bash (display (string-append "#! " bash "/bin/bash
exec " gcc "/bin/" program exec " gcc "/bin/" program
" -Wl,--dynamic-linker" " -Wl,--dynamic-linker"
" -Wl," libc ,(glibc-dynamic-linker) ;; also for x86_64-linux, we are still on i686-linux
" -Wl," libc ,(glibc-dynamic-linker "i686-linux")
" -Wl,--rpath" " -Wl,--rpath"
" -Wl," libc "/lib" " -Wl," libc "/lib"
" \"$@\" " \"$@\"
@ -1552,7 +1556,7 @@ (define m4-mesboot
(sha256 (sha256
(base32 (base32
"1f9bxj176kf3pvs350w2dfs8jgwhminywri5pyn01b11yc4yhsjw")))) "1f9bxj176kf3pvs350w2dfs8jgwhminywri5pyn01b11yc4yhsjw"))))
(supported-systems '("i686-linux")) (supported-systems '("i686-linux" "x86_64-linux"))
(native-inputs `(("mes" ,mes-boot) (native-inputs `(("mes" ,mes-boot)
("tcc" ,tcc-boot))) ("tcc" ,tcc-boot)))
(arguments (arguments
@ -1572,11 +1576,13 @@ (define (%bootstrap-inputs+toolchain)
;; The traditional bootstrap-inputs. For the i686-linux Reduced Binary Seed ;; The traditional bootstrap-inputs. For the i686-linux Reduced Binary Seed
;; the actual reduced set with bootstrapped toolchain. ;; the actual reduced set with bootstrapped toolchain.
(append (match (%current-system) (append (match (%current-system)
("i686-linux" `(("libc" ,glibc-mesboot) ((or "i686-linux" "x86_64-linux")
`(("libc" ,glibc-mesboot)
("binutils" ,binutils-mesboot) ("binutils" ,binutils-mesboot)
("gcc-wrapper" ,gcc-mesboot-wrapper) ("gcc-wrapper" ,gcc-mesboot-wrapper)
("gcc" ,gcc-mesboot))) ("gcc" ,gcc-mesboot)))
(_ '())) (_
'()))
(%bootstrap-inputs))) (%bootstrap-inputs)))
(define gnu-make-boot0 (define gnu-make-boot0
@ -1723,7 +1729,7 @@ (define libstdc++-boot0
#:validate-runpath? #f #:validate-runpath? #f
,@(match (%current-system) ,@(match (%current-system)
("i686-linux" ((or "i686-linux" "x86_64-linux")
(substitute-keyword-arguments (package-arguments lib) (substitute-keyword-arguments (package-arguments lib)
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases `(modify-phases ,phases
@ -1784,6 +1790,17 @@ (define gcc-boot0
(remove (cut string-match (remove (cut string-match
"--(with-system-zlib|enable-languages.*)" <>) "--(with-system-zlib|enable-languages.*)" <>)
,flags))) ,flags)))
((#:make-flags flags)
`(let* ((libc (assoc-ref %build-inputs "libc"))
(libc-native (or (assoc-ref %build-inputs "libc-native")
libc)))
`(,(string-append "LDFLAGS="
"-Wl,-rpath=" libc-native "/lib "
"-Wl,-dynamic-linker "
"-Wl," libc-native ,(glibc-dynamic-linker
(match (%current-system)
("x86_64-linux" "i686-linux")
(_ (%current-system))))))))
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases `(modify-phases ,phases
(add-after 'unpack 'unpack-gmp&co (add-after 'unpack 'unpack-gmp&co
@ -1809,7 +1826,7 @@ (define gcc-boot0
(list gmp-6.0 mpfr mpc)) (list gmp-6.0 mpfr mpc))
#t))) #t)))
,(match (%current-system) ,(match (%current-system)
("i686-linux" ((or "i686-linux" "x86_64-linux")
'(add-after 'build 'libtool-workaround '(add-after 'build 'libtool-workaround
(lambda _ (lambda _
;; libtool: install: /gnu/store/7swwdnq02lqk4xkd8740fxdj1h4va38l-bootstrap-binaries-0/bin/install -c .libs/libcc1.so.0.0.0 /gnu/store/8qf47i99nxz9jvrmq5va0g3q1yvs3x74-gcc-cross-boot0-5.5.0-lib/lib/./libcc1.so.0.0.0 ;; libtool: install: /gnu/store/7swwdnq02lqk4xkd8740fxdj1h4va38l-bootstrap-binaries-0/bin/install -c .libs/libcc1.so.0.0.0 /gnu/store/8qf47i99nxz9jvrmq5va0g3q1yvs3x74-gcc-cross-boot0-5.5.0-lib/lib/./libcc1.so.0.0.0
@ -1817,7 +1834,7 @@ (define gcc-boot0
(system* "touch" (system* "touch"
"libcc1/.libs/libcc1.so.0.0.0" "libcc1/.libs/libcc1.so.0.0.0"
"libcc1/.libs/libcc1plugin.so.0.0.0")))) "libcc1/.libs/libcc1plugin.so.0.0.0"))))
(_ 'identity)) (_ identity))
(add-after 'install 'symlink-libgcc_eh (add-after 'install 'symlink-libgcc_eh
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "lib"))) (let ((out (assoc-ref outputs "lib")))
@ -1904,8 +1921,10 @@ (define bison-boot0
#:make-flags `("ARFLAGS=crD" #:make-flags `("ARFLAGS=crD"
,,(match (%current-system) ,,(match (%current-system)
;; ranlib: '-D': No such file ;; ranlib: '-D': No such file
("i686-linux" "RANLIB=ranlib") ((or "i686-linux" "x86_64-linux")
(_ "RANLIB=ranlib -D")) "RANLIB=ranlib")
(_
"RANLIB=ranlib -D"))
"V=1")))))) "V=1"))))))
(package (package
(inherit (package-with-bootstrap-guile (inherit (package-with-bootstrap-guile
@ -2156,6 +2175,13 @@ (define (wrap-program program)
("bash" ,bash))) ("bash" ,bash)))
(inputs '()))) (inputs '())))
(define (gcc-boot0-intermediate-wrapped)
;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
;; non-cross names.
(cross-gcc-wrapper gcc-boot0 binutils-boot0
glibc-final-with-bootstrap-bash
(car (assoc-ref (%boot1-inputs) "bash"))))
(define static-bash-for-glibc (define static-bash-for-glibc
;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co. ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
(let ((bash (package (let ((bash (package
@ -2177,14 +2203,11 @@ (define static-bash-for-glibc
(package-with-explicit-inputs (package-with-explicit-inputs
bash bash
(lambda _ (lambda _
(let ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 `(("gcc" ,(gcc-boot0-intermediate-wrapped))
glibc-final-with-bootstrap-bash
(car (assoc-ref (%boot1-inputs) "bash")))))
`(("gcc" ,gcc)
("libc" ,glibc-final-with-bootstrap-bash) ("libc" ,glibc-final-with-bootstrap-bash)
("libc:static" ,glibc-final-with-bootstrap-bash "static") ("libc:static" ,glibc-final-with-bootstrap-bash "static")
,@(fold alist-delete (%boot1-inputs) ,@(fold alist-delete (%boot1-inputs)
'("gcc" "libc"))))) '("gcc" "libc"))))
(current-source-location) (current-source-location)
#:guile %bootstrap-guile)))) #:guile %bootstrap-guile))))
@ -2344,17 +2367,7 @@ (define gcc-final
;; positive, so turn it off. ;; positive, so turn it off.
#:validate-runpath? #f #:validate-runpath? #f
;; Build again GMP & co. within GCC's build process, because it's hard ,@(substitute-keyword-arguments (package-arguments gcc)
;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
,@(substitute-keyword-arguments (package-arguments gcc-boot0)
((#:configure-flags boot-flags)
(let loop ((args (package-arguments gcc)))
(match args
((#:configure-flags normal-flags _ ...)
normal-flags)
((_ rest ...)
(loop rest)))))
((#:make-flags flags) ((#:make-flags flags)
;; Since $LIBRARY_PATH is not honored, add the relevant flags. ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
`(let ((zlib (assoc-ref %build-inputs "zlib"))) `(let ((zlib (assoc-ref %build-inputs "zlib")))
@ -2366,8 +2379,33 @@ (define gcc-final
zlib "/lib") zlib "/lib")
flag)) flag))
,flags))) ,flags)))
;; Build again GMP & co. within GCC's build process, because it's hard
;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
((#:phases phases) ((#:phases phases)
`(alist-delete 'symlink-libgcc_eh ,phases))))) `(modify-phases ,phases
(add-after 'unpack 'unpack-gmp&co
(lambda* (#:key inputs #:allow-other-keys)
(let ((gmp (assoc-ref %build-inputs "gmp-source"))
(mpfr (assoc-ref %build-inputs "mpfr-source"))
(mpc (assoc-ref %build-inputs "mpc-source")))
;; To reduce the set of pre-built bootstrap inputs, build
;; GMP & co. from GCC.
(for-each (lambda (source)
(invoke "tar" "xvf" source))
(list gmp mpfr mpc))
;; Create symlinks like `gmp' -> `gmp-x.y.z'.
,@(map (lambda (lib)
;; Drop trailing letters, as gmp-6.0.0a unpacks
;; into gmp-6.0.0.
`(symlink ,(string-trim-right
(package-full-name lib "-")
char-set:letter)
,(package-name lib)))
(list gmp-6.0 mpfr mpc))
#t))))))))
;; This time we want Texinfo, so we get the manual. Add ;; This time we want Texinfo, so we get the manual. Add
;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of