From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: ARM bootloader installation in Guix Date: Tue, 3 Sep 2019 02:29:48 +0200 Message-ID: <20190903022948.5127b2ee@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/0USHvaUxnJAq01Y2hAiV=wy"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33817) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4whw-00018j-B8 for guix-devel@gnu.org; Mon, 02 Sep 2019 20:30:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4wht-0000XY-H0 for guix-devel@gnu.org; Mon, 02 Sep 2019 20:30:04 -0400 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: guix-devel@gnu.org --Sig_/0USHvaUxnJAq01Y2hAiV=wy Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, I've been thinking of ways to generalize the bootloader installation for ARM boards. One of the most annoying parts of u-boot is that the u-boot pr= oject does NOT include bootloader installers (something like grub-install does not exist in u-boot). A possible upstream project that builds ARM images is Buildroot (it's basic= ally a Linux distribution). First, it would [probably] be possible to use Buildroot directly, but they = have different policies like using *specific* u-boot versions, toolchain and com= piler versions etc--also it takes a LOT of time and space to do that, and for som= ething as tiny as u-boot that would be kinda silly. A second way would be to use the buildroot config files and "genimage.cfg"s in order to extract (1) which u-boot configuration to use and (2) have geni= mage build the bootloader parts of the image (or the entire image just with empt= y rootfs). For that, we would (for example): * Read configs/orangepi_zero_defconfig to find: BR2_TARGET_UBOOT=3Dy BR2_TARGET_UBOOT_BOARD_DEFCONFIG=3D"orangepi_zero" BR2_TARGET_UBOOT_NEEDS_DTC=3Dy BR2_TARGET_UBOOT_FORMAT_CUSTOM=3Dy BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME=3D"u-boot-sunxi-with-spl.bin" BR2_TARGET_UBOOT_BOOT_SCRIPT=3Dy BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE=3D"board/orangepi/orangepi-zero/boot.= cmd" BR2_PACKAGE_HOST_DOSFSTOOLS=3Dy BR2_PACKAGE_HOST_GENIMAGE=3Dy BR2_PACKAGE_HOST_MTOOLS=3Dy BR2_PACKAGE_HOST_UBOOT_TOOLS=3Dy BR2_ROOTFS_POST_IMAGE_SCRIPT=3D"support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS=3D"-c board/orangepi/orangepi-zero/genimage.c= fg" * Then read board/orangepi/orangepi-zero/genimage.cfg to find: image boot.vfat { ... which files to put there } image sdcard.img { ... which files and partitions to put there } We could reimplement genimage ourselves, but I suggest we just use genimage instead (I've packaged it in guix master). The rootfs size would need to be dynamically adjusted (the "genimage.cfg"s usually specify a fixed size)--not sure how annoying that would be. That way we could generalize u-boot bootloader installation without undue maintenance effort on our side. A possible way forward could be to implement an importer to figure out all the boards to put into gnu/bootloader/u-boot.scm, including an installer th= at uses genimage in order to install the bootloader (and, really, ideally partitions everything else--so it should run much earlier or else we'd have= to do extra modifications that could be avoided). I've started branch "wip-buildroot" in order to do that. To try it out: * Invoke: guix import buildroot sheevaplug_defconfig * Stick the result into gnu/bootloader/u-boot.scm (with appropriate "define= ") * Build system image using it. (It's not finished yet but it should provide a basis for discussion...) --Sig_/0USHvaUxnJAq01Y2hAiV=wy Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl1ts/wACgkQ5xo1VCww uqVAugf/ftnwK08wWHfd9jMVa/m9/msf4O0pTYD4f9EPqZZu592UNYLBsguzOKoF dzP7/uYSaxZhWfOvVamkrHlOLGLJXyi5m8Pz/FNniNdpEpOELmeAzOcTYAvFleZb cC9SsNCaepBrAWyn5aKIK8SwIeXX33/G8WinVdAlDn/NCsfqJf5G3Kxs6tE0SiXZ WTE+w6AdG9V/9uPdbAjes2LNGJAipVWf3WtMfQyE5bKRWZg11bYNsKK4B7N2GJN9 p7iS7L6/Pv91cnVOCZIH+6Z5TgOatdReLytCQGi6XCEMbneJ5FqbvFkxNIO08Byo ybGBwZtJ8YxROjDUc55yEYjADObKsA== =Ufg3 -----END PGP SIGNATURE----- --Sig_/0USHvaUxnJAq01Y2hAiV=wy--