From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: Re: UEFI support in boot image Date: Wed, 19 Apr 2017 23:43:20 +0200 Message-ID: <87inm0t6o7.fsf@fastmail.com> References: <87wpb7ym78.fsf@gnu.org> <87shlqv4pe.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> <87tw65sxvf.fsf@gnu.org> <8760i2lqbf.fsf@fastmail.com> <87vaq0m9ea.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0xNo-0006j1-GV for guix-devel@gnu.org; Wed, 19 Apr 2017 17:43:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0xNj-00007M-Kh for guix-devel@gnu.org; Wed, 19 Apr 2017 17:43:28 -0400 In-Reply-To: <87vaq0m9ea.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: >> @@ -141,7 +141,7 @@ the #:references-graphs parameter of 'derivation'." >> (size partition-size) >> (file-system partition-file-system (default "ext4")) >> (label partition-label (default #f)) >> - (bootable? partition-bootable? (default #f)) >> + (flags partition-flags (default '())) >> (initializer partition-initializer (default (const #t)))) > > So =E2=80=98flags=E2=80=99 must be a list of strings, and each string is = something > Parted recognizes, right? Correct. > It would be slightly nicer to make it a list of symbols. Good idea. >> + (define (find-root-partition partitions) >> + "Return the first partition found with the boot flag set." >> + ;; FIXME: This probably does not work. What's the best way to do th= is? >> + (find (match-lambda >> + (($ _ _ _ _ flags) >> + (member "boot" flags))) >> + partitions)) > > Why wouldn=E2=80=99t it work? LGTM. > > BTW, in this case, I=E2=80=99d recommend using =E2=80=98partition-flags= =E2=80=99 instead of > =E2=80=98match=E2=80=99 with the 4 wildcards; probably safer. :-) > > That said, it=E2=80=99s probably best to keep > > (define (partition-bootable? partition) > (member "boot" (partition-flags partition))) > >> (let* ((partitions (initialize-partition-table device partitions)) >> - (root (find partition-bootable? partitions)) >> + (root (find-root-partition partitions)) > > =E2=80=A6 and keep this line unchanged (=E2=80=98find-foo=E2=80=99 proced= ures are an > anti-pattern in a way.) That's much better indeed. Thanks! >> From 9db90ea41a94ecbe42bba88de1c2e3ac607d5ea4 Mon Sep 17 00:00:00 2001 >> From: Marius Bakke >> Date: Tue, 11 Apr 2017 10:55:22 +0200 >> Subject: [PATCH 2/4] vm: Unconditionally add a small ESP partition. >> >> * gnu/system/vm.scm (qemu-image): Append 20MB FAT32 partition. > > [...] > >> (partitions (list (partition >> (size #$(- disk-image-size >> - (* 10 (expt 2 20)))) >> + (* 30 (expt 2 20)))) >> (label #$file-system-label) >> (file-system #$file-system-type) >> (flags '("boot")) >> - (initializer initialize))))) >> + (initializer initialize)) >> + (partition >> + ;; Append a small FAT32 partition = for >> + ;; use with UEFI bootloaders. >> + (size (* 20 (expt 2 20))) >> + (label "gnu-esp") >> + (file-system "vfat") >> + (flags '("esp")))))) > > Should we do it conditionally, only when targeting UEFI? Probably, but I'm not sure which condition (maybe 'uefi-disk-image'?). Will revisit this once it works :) > (BTW, what=E2=80=99s =E2=80=9Cesp=E2=80=9D?) ESP is short for 'EFI System Partition' (I'll mention this in the code somewhere). UEFI firmwares scans each connected I/O device looking for this partition, which must be flagged as such and FAT-formatted. Thanks for the feedback! I'll keep hammering at this and should hopefully have something usable within a few weeks. Currently, need to figure out why the qemu builder can't find the ISO8859-1 kernel module. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlj32fgACgkQoqBt8qM6 VPpu3wgAjc2YM9ff63y0NbWAhQGpoDodKkf09T8ofLP0X7csWnr9y/kEQnNfOcWb rotCV28U5F5Y6XXZJFxRygVzMjNPD22jrVBOzKCTKVvDH/Zhm3Tj1hliCyHt7Dg9 fGXIP+abTzJVsvEfHElrPCxsB5UkKM3vx9H+99RU8wjaMLWjtnVyuLD5q5s8wr1N 0c8ThbG+KQjRKJdQ7HPdQkWnIZ+40vRYjRHbIuG/cIv8TpzsIylYsQYMGzTdbOBX NPFvuXyOuihYc328Cvtms+Q00mgMLYCCp1IxgJbB6rQ7MlhcbIwZkArgeaIB/pLl ZUIBRK+mdpPFxKLkcWbE5VR1Gs5kSQ== =WmYf -----END PGP SIGNATURE----- --=-=-=--