unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ARM bootloader installation in Guix
@ 2019-09-03  0:29 Danny Milosavljevic
  2019-09-05  8:32 ` Mathieu Othacehe
  0 siblings, 1 reply; 2+ messages in thread
From: Danny Milosavljevic @ 2019-09-03  0:29 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2830 bytes --]

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 project
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 basically
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 compiler
versions etc--also it takes a LOT of time and space to do that, and for something
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 genimage
build the bootloader parts of the image (or the entire image just with empty rootfs).

For that, we would (for example):

* Read configs/orangepi_zero_defconfig to find:
  BR2_TARGET_UBOOT=y
  BR2_TARGET_UBOOT_BOARD_DEFCONFIG="orangepi_zero"
  BR2_TARGET_UBOOT_NEEDS_DTC=y
  BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
  BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
  BR2_TARGET_UBOOT_BOOT_SCRIPT=y
  BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd"
  BR2_PACKAGE_HOST_DOSFSTOOLS=y
  BR2_PACKAGE_HOST_GENIMAGE=y
  BR2_PACKAGE_HOST_MTOOLS=y
  BR2_PACKAGE_HOST_UBOOT_TOOLS=y
  BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
  BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg"

* 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 that
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...)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ARM bootloader installation in Guix
  2019-09-03  0:29 ARM bootloader installation in Guix Danny Milosavljevic
@ 2019-09-05  8:32 ` Mathieu Othacehe
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Othacehe @ 2019-09-05  8:32 UTC (permalink / raw)
  To: guix-devel


Hey Danny,

I think the buildroot based importer and the genimage based installation
are both very good ideas! Combined with the system cross-compilation
serie I'm working on, we could turn Guix into a really nice tool to
configure, build and deploy images for a lot of boards.

I had a quick look to your importer. In the current implementation, the
importer outputs buildroot config strings (under the form BR2_ ...) and
we have to store them in gnu/bootloader/u-boot.scm as input of
make-buildroot-u-boot-package.

Would it be possible to keep the parsing/interpretation of those
buildroot config strings in the importer and directly output something
like:

(make-u-boot-package board triplet ... other relevant options)

this way, we do not depend of buildroot outside the importer?

WDYT?

Mathieu


Danny Milosavljevic writes:

> 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 project
> 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 basically
> 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 compiler
> versions etc--also it takes a LOT of time and space to do that, and for something
> 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 genimage
> build the bootloader parts of the image (or the entire image just with empty rootfs).
>
> For that, we would (for example):
>
> * Read configs/orangepi_zero_defconfig to find:
>   BR2_TARGET_UBOOT=y
>   BR2_TARGET_UBOOT_BOARD_DEFCONFIG="orangepi_zero"
>   BR2_TARGET_UBOOT_NEEDS_DTC=y
>   BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
>   BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
>   BR2_TARGET_UBOOT_BOOT_SCRIPT=y
>   BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd"
>   BR2_PACKAGE_HOST_DOSFSTOOLS=y
>   BR2_PACKAGE_HOST_GENIMAGE=y
>   BR2_PACKAGE_HOST_MTOOLS=y
>   BR2_PACKAGE_HOST_UBOOT_TOOLS=y
>   BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
>   BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg"
>
> * 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 that
> 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...)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-05  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03  0:29 ARM bootloader installation in Guix Danny Milosavljevic
2019-09-05  8:32 ` Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).