From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eEFIA4VAvWC8JgEAgWs5BA (envelope-from ) for ; Sun, 06 Jun 2021 23:39:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SO8GOoRAvWC1NQAAbx9fmQ (envelope-from ) for ; Sun, 06 Jun 2021 21:39:16 +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 617BE17219 for ; Sun, 6 Jun 2021 23:39:16 +0200 (CEST) Received: from localhost ([::1]:58812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lq0UF-0003g7-7N for larch@yhetil.org; Sun, 06 Jun 2021 17:39:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lq0Tt-0003fy-9g for guix-devel@gnu.org; Sun, 06 Jun 2021 17:38:53 -0400 Received: from cascadia.aikidev.net ([2600:3c01:e000:267:0:a171:de7:c]:37120) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lq0Tq-0006QC-6g for guix-devel@gnu.org; Sun, 06 Jun 2021 17:38:53 -0400 Received: from localhost (71-36-123-233.ptld.qwest.net [71.36.123.233]) (Authenticated sender: vagrant@cascadia.debian.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id 399C81A904 for ; Sun, 6 Jun 2021 14:38:44 -0700 (PDT) From: Vagrant Cascadian To: guix-devel@gnu.org Subject: Supporting *multiple* bootloaders for arm64 on a single install? Date: Sun, 06 Jun 2021 14:38:27 -0700 Message-ID: <87y2bmznak.fsf@ponder> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: none client-ip=2600:3c01:e000:267:0:a171:de7:c; envelope-from=vagrant@debian.org; helo=cascadia.aikidev.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list 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+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623015556; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=TGFLERkZ3ZzlWSFl6FSV+JJy8No67UtM5DvqMWqheoQ=; b=C15D3Go1T3J+Ks5yXeW8WF0s9eGGo5z+O3yWP6p5LjBORpz+8w0r8x4YUEM5VZzh0vNK10 fanGol2kTF1Hmt+0DfHttngk1X05FJjNRQFhrFxMEKftI0guUcToYzXVaasVOPizm70XfY G//aYQCp6FUwESX2CepkNhknUkp12Mq2fGBO3jDHd9S6p0Wdy+E1B91wNuQ9y7nMjlO4uT ai4FVgTFKPJm+2MrA2pZbsruibNN2Xq48NyH8ezACdsxccqCNL1j10RFdeaJRt7sfYw+hz 68/yeKwCdFH7/XOymCoR2vYw40up0LkmrhuTvBa+HDaqgtQgzNnNmCEk7oGuVA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623015556; a=rsa-sha256; cv=none; b=VRm0AsAiL4iTpJb5P0db18cKsAKbXnzAR/OH/GeULi4/R+aTge7YXaxYT+cJoenQZ8qtCX 4kZ+ZaLtBU1kpW+mpEa3QHpHhVpj/HgYBxiGF3L7C33emZIWjJEota+2HynMa9n+V+obwV h3dHPcKpLrUtGu/H07+nlJePK5IEo6DNLgAcqoTWmHDgRuzTpQqh4KuJxgO9+sCjM/aE6a Q018Td2ZoHVrAVsUo6X7UMRha1oCzj9445OLF0O4HoF9Nll/7TJwRjNcxM+vjM+TnEmn7E V/CuN4KF9p42yD2qGVkYy89SSv7g+AYF+Vwj/4DPNrD6YLoWQA8GpghQLuJ88w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.03 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 617BE17219 X-Spam-Score: -3.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: 17DWLBWuPax1 --=-=-= Content-Type: text/plain So, I've managed to get a single image that supports booting both the Pinebook and Pinebook Pro reasonably well! I can pop the microSD card out of one and put it into the other, and it boots! Maybe this is not a big deal to those used to x86, but in the ARM world, it is unfortunately more complicated than one would hope: https://archive.fosdem.org/2019/schedule/event/one_image_to_rule_them_all/ The only problem with my single image for multiple pinebooks variants is it requires manually installing u-boot to different offsets for Pinebook Pro (e.g. idbloader.img at sector 2112 rather than sector 64), as parts of the Pinebook bootloader are installed at overlapping offsets. I don't think it would be terribly hard to create an image that also supports booting EFI! And as u-boot can provide an EFI implementation, it would not be totally unreasonable to want to install both u-boot and EFI in the same system configuration... But as I understand it, guix only supports a single bootloader entry. To support all of the above, I would need three separate bootloader instances... one for Pinebook, one for Pinebook Pro, and lastly a grub-efi bootloader. Installing u-boot-pinebook uses: (define install-allwinner64-u-boot #~(lambda (bootloader root-index image) (let ((spl (string-append bootloader "/libexec/u-boot-sunxi-with-spl.bin")) (u-boot (string-append bootloader "/libexec/u-boot-sunxi-with-spl.fit.itb"))) (write-file-on-device spl (stat:size (stat spl)) image (* 8 1024)) (write-file-on-device u-boot (stat:size (stat u-boot)) image (* 40 1024))))) Installing u-boot-pinebook-pro-rk3399 uses: (define install-rockpro64-rk3399-u-boot #~(lambda (bootloader root-index image) (let ((idb (string-append bootloader "/libexec/idbloader.img")) (u-boot (string-append bootloader "/libexec/u-boot.itb"))) (write-file-on-device idb (stat:size (stat idb)) image (* 64 512)) (write-file-on-device u-boot (stat:size (stat u-boot)) image (* 16384 512))))) (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot) ;; yes, these could be refactored into a single function! But now I need to figure out how to pass a non-default offset for the "idb" part for rockchip platforms. In a system config.scm, you'd define it like so: (bootloader (bootloader-configuration (bootloader u-boot-pinebook-pro-rk3399-bootloader) (target "/dev/mmcblk0"))) u-boot-pinebook-pro-rk3399-bootloader is defined in gnu/bootloader/u-boot.scm, which inherits from u-boot-bootloader, which inherits from extlinux-bootloader in gnu/bootloader/extlinux.scm... And somewhere along the way I've lost track of how we get to install-pinebook-pro-rk3399-u-boot... Is it possible to definte multiple bootloaders currently, or if not, what would need to change to be able to support that? Where would one pass non-default offsets for a given platform? Strictly speaking, the extlinux.conf generation would be optional for an EFI generated image(as u-boot can load grub-efi), although at the moment I'd prefer using extlinux.conf if available as it makes for more consistent matching of device-tree/.dtb file with the running kernel... A related idea would be to generate an EFI bootable image with sufficient emtpy space before the first partition (16MB) and then one could manually install the appropriate u-boot, maybe with some helper scripts to avoid having to do it completely manually... Thoughts, advice, help? :) live well, vagrant --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCYL1AXQAKCRDcUY/If5cW qlYmAP9bN5Bmr4oWjsxffbhxFjPk34Lfhg9nlTRlX6A8Hk6o7QEAyjSksNu1Fqiy XpI+6l67MPRwzXs2yOZLbmL3HfnifAM= =3NGb -----END PGP SIGNATURE----- --=-=-=--