From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YyRAJ5VuuF5tMwAA0tVLHw (envelope-from ) for ; Sun, 10 May 2020 21:13:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UNqZE6NuuF41DwAA1q6Kng (envelope-from ) for ; Sun, 10 May 2020 21:14:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 20A28940DC5 for ; Sun, 10 May 2020 21:14:09 +0000 (UTC) Received: from localhost ([::1]:46764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXtGz-0006Ya-TS for larch@yhetil.org; Sun, 10 May 2020 17:14:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXtGs-0006XD-Pz for guix-patches@gnu.org; Sun, 10 May 2020 17:14:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXtGs-0005Vl-Fa for guix-patches@gnu.org; Sun, 10 May 2020 17:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jXtGs-0001IH-AT for guix-patches@gnu.org; Sun, 10 May 2020 17:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 May 2020 21:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41011 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41011@debbugs.gnu.org Received: via spool by 41011-submit@debbugs.gnu.org id=B41011.15891452144928 (code B ref 41011); Sun, 10 May 2020 21:14:02 +0000 Received: (at 41011) by debbugs.gnu.org; 10 May 2020 21:13:34 +0000 Received: from localhost ([127.0.0.1]:50598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXtGQ-0001HQ-EA for submit@debbugs.gnu.org; Sun, 10 May 2020 17:13:34 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:25133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXtGO-0001HB-2X for 41011@debbugs.gnu.org; Sun, 10 May 2020 17:13:33 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id AB3F360494B; Sun, 10 May 2020 21:13:25 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [90.186.146.103]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 40B59604868; Sun, 10 May 2020 21:13:21 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <87a72gi4kz.fsf@gmail.com> Date: Sun, 10 May 2020 23:13:20 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <1179D890-7D6C-43D8-A286-DA7A0F61D585@vodafonemail.de> References: <9AAFEFF4-8ACE-4C95-975F-67C3F4FDAF81@vodafonemail.de> <87a72gi4kz.fsf@gmail.com> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 X-Spam-Score: -0.51 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Scan-Result: default: False [-0.51 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.5392355611974]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; MV_CASE(0.50)[]; DWL_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.08), country: US(-0.00), ip: 209.51.188.17(-0.54)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[90.186.146.103:received]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[stefan-guix@vodafonemail.de,guix-patches-bounces@gnu.org]; ARC_NA(0.00)[]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[vodafonemail.de]; HAS_LIST_UNSUB(-0.01)[]; DNSWL_BLOCKED(0.00)[209.51.188.17:from]; RCVD_TLS_LAST(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: dwBeEmjgdMf7 Hi Mathieu! Thanks for your reply again! :-) > Am 10.05.2020 um 10:20 schrieb Mathieu Othacehe = : >=20 > This patch does not apply here. Could you rebase it on top of master? I=E2=80=99ll try. >> - ;; Intel and EFI systems need to be switched into graphics = mode, whereas >> - ;; most other modern architectures have no other mode and = therefore >> - ;; don't need to be switched. >> - >> - ;; XXX: Do we really need to restrict to x86 systems? We = could imitate >> - ;; what the GRUB default configuration does and decide based = on whether >> - ;; a user provided 'gfxterm' in the terminal-outputs field of = their >> - ;; bootloader-configuration record. >> - (if (string-match "^(x86_64|i[3-6]86)-" system) >> - (format #f " >> + (format #f " >> set gfxmode=3D~a >> insmod all_video >> - insmod gfxterm~%" gfxmode) >> - ""))) >> + insmod gfxterm~%" >> + (string-join >> + (grub-gfxmode (bootloader-theme config)) >> + ";"))) >=20 > Why not enable graphic mode only if 'gfxterm' is provided in > terminal-outputs fields, like suggested by the comment? Good point. Looking into this topic it seem's questionable to me that the default of = (bootloader-configuration (terminal-output =E2=80=A6)) with '(gfxterm) = is grub-specific. This doesn't make sense for other boot-loaders, e.g. = U-Boot. I expect this to be changed in future. ;-) >> + (efi-bootloader-link (string-append "boot" >> + (match arch >> + ("i686" "ia32") >> + ("x86_64" "x64") >> + ("armhf" "arm") >=20 > If cross-building for "arm-linux-gnueabihf", arch will be "arm" and > won't match anything here. Good catch! >> + (catch 'system-error >> + (lambda () (delete-file efi-bootloader-link)) >> + (lambda _ #f)) >=20 > You can use "false-if-exception" here I think. Nice trick. >> + (symlink #$efi-bootloader >> + efi-bootloader-link) >> + (catch 'system-error >> + (lambda () (delete-file store-link)) >> + (lambda _ #f)) >=20 > Same here. Sure. >> +(define* (grub-efi-net-bootloader #:key (target #f) (efi-subdir #f)) >=20 > #f if implicit if omitted. I wasn=E2=80=99t aware of this. >> + (let ((target (or target "boot")) >> + (efi-subdir (or efi-subdir "efi/boot"))) >=20 > It would be better to keep grub-efi-net-bootloader as a variable, like > all other bootloaders. You could default configuration-file to > "boot/efi/boot/grub.cfg" instead? Actually there is a problem with all this in guix: There is (bootloader = (target =E2=80=A6)), which gives the impression that one is able to = freely chose a folder for the bootloader files. However, the path = =E2=80=9C/boot/grub.cfg=E2=80=9D is kind of hard coded. Yes, it=E2=80=99s kind of possible to inherit from grub-efi-bootloader = and overwrite the (configuration-file) field. In a first step this seems = to work. But when e.g. deleting a system generation, in = guix/scripts/system.scm (reinstall-bootloader) there is this code: ;; Use the detected bootloader with default configuration. ;; It will be enough to allow the system to boot. (bootloader-config (bootloader-configuration (bootloader bootloader)))=20 It reads this information form /var/guix/profiles/system/parameters: = (bootloader-name grub-efi-bootloader). With this again the hard-coded path =E2=80=9C/boot/grub.cfg=E2=80=9D of = is used, ignoring any value overwritten in (configuration-file). Another issue is (install-dir (string-append mount-point "/boot")) in = (install-grub-efi), which ignores any (configuration-file) setting, too = =E2=80=93 well, it has no access to that setting =E2=80=93, and implies = at least =E2=80=9C/boot=E2=80=9D to be the prefix of (bootloader (target = =E2=80=A6)).=20 Beside the wish to avoid this hard-coded =E2=80=9C/boot=E2=80=9C = assumption, I made this a function with two parameters for two more = reasons.=20 One is simply to suite my needs. The folder for my tftp server is not = =E2=80=9Cboot=E2=80=9D but =E2=80=9Cboot-nfs=E2=80=9D. For my SBC I=E2=80=99= m using different operating systems from time to time, e.g. LibreELEC. = As I have bad experiences with unreliable micro SD cards and as an nfs = root file system is nice for tinkering, I copy such operating systems = onto my tftp/nfs server. This includes of corse their =E2=80=9Cboot=E2=80=9D= folder. The build-in update functionalities overwrite stuff inside = there. But I need to modify stuff for network booting. To not loose = these modifications during updates and for later comparisons I keep such = modifications in a copy as =E2=80=9Cboot-nfs=E2=80=9D. The other reason is that I=E2=80=99m not sure, if the efi-dir for = network booting should be =E2=80=9Cefi/Guix=E2=80=9D instead of = =E2=80=9Cefi/boot=E2=80=9D in other constellations. U-Boot expects = =E2=80=9Cefi/boot=E2=80=9C over tftp like for a removable media by = default. I guess this can be changed with DNS options. Also for real = UEFI firmware this might be configurable. I don=E2=80=99t know, so I = don=E2=80=99t want these paths to be hard-coded. However, digging up all this and now re-trying to delete a system = generation, I get this error with my new boot-efi-net-bootloader as a = function: stefan@guix ~/development/guix$ sudo guix system delete-generations 151 /var/guix/profiles/system-151-link wird gel=C3=B6scht guix system: error: grub-efi-net-bootloader: no such bootloader So thanks for your hint, it can=E2=80=99t be a function! (Not now =E2=80=A6= ) Bye Stefan