Subject: bug#37286: Make a faster method to list supported boards.

From: Danny Milosavljevic <[email-masked]>
Date: Tue, 3 Sep 2019 10:57:12 +0200

Hi Jesse,

On Mon, 02 Sep 2019 20:07:53 -0600
Jesse Gibbons <[email-masked]> wrote:

> On Mon, 2019-09-02 at 22:49 +0200, Danny Milosavljevic wrote:
> > Hi,
> > 
> > On Mon, 02 Sep 2019 12:52:49 -0600
> > Jesse Gibbons <[email-masked]> wrote:
> >   
> If the bootloader build fails, which appears necessary to generate the
> list, doesn't the system build fail?

Yes.

> > It would be easy to get the list of supported u-boot targets from the
> > derivation.  It might be that Guix Data Service would help with that
> > (see "More progress with the Guix Data Service" by Christopher
> > Baines).  
> That sounds like an interesting article, but my search engine of choice
> doesn't know where it is. Would you mind providing a link please?

https://lists.gnu.org/archive/html/guix-devel/2019-05/msg00332.html

> The behavior described in the manual is implemented in the make-u-boot-
> package function in gnu/packages/bootloaders.scm, in the replaced
> 'configure phase. If it could be moved from that function to a script
> (maybe guix system list-boards), that would be the best solution IMHO. 

It can't because it's getting the list of supported boards from the
u-boot derivation--which is not available host side.

We could move it to guix/build/list-boards.scm but that won't help us much.

I think what I did (now) in wip-buildroot branch is a good compromise,
but it requires us to manually import buildroot configs from buildroot:

$ guix import buildroot orangepi_zero_plus2_defconfig

And then stick the resulting "bootloader" form into gnu/bootloader/u-boot.scm,
which is also where we can get the list from.  (i.e. have our own "packages"
for the boards)

> At this point, the fastest way to get the list would be "guix package
> -e '((@ (gnu packages bootloaders) make-u-boot-package) "dneboard"
> "arm-linux-gnueabihf")'" and view the end of the resulting log. I
> tested this, and it takes a minute at most. It's still needlessly
> complicated though -- the boards listed are not limited to the triplet.

I know, it's not user-friendly yet.

> How many of these can run on fully free software? I see
> rpi{,2,3,3_32b,0_w} in the list, but last I checked, it has a blobby
> bootloader.

I don't know.

> Where does guix get this list? Is it configured or automatically
> generated?

It's fetched from the u-boot source code, "configs" subdirectory.

In wip-buildroot, it will be fetched from buildroot <https://buildroot.org/>
instead, "configs" subdirectory.

(The reason is that buildroot also contains data about how to install u-boot
to the respective board, but u-boot doesn't)

So the fact that on master it's fetched from u-boot right now is an
implementation detail.