Subject: Re: [bug#31404] Add installer support for u-boot imx6 boards.

From: Vagrant Cascadian <[email-masked]>
Date: Fri, 11 May 2018 11:55:22 -0700

On 2018-05-11, Danny Milosavljevic wrote:
> On Thu, 10 May 2018 10:47:54 -0700
> Vagrant Cascadian <[email-masked]> wrote:
>> It should be noted that the offsets for installing u-boot.img on imx6
>> targets conflict with a typical GPT partition table header; works fine
>> with dos partition table headers. I'm not sure what safeguards could be
>> added to detect that. This also may not be unique to imx6 targets
>> (e.g. pine64 u-boot/atf also has a similar issue).
>
> Yeah, and Allwinner A10, A20, R40 etc have the same problem.  I've talked
> to parted upstream about it so that at least the new partition tables are
> not created in a stupid way - but movement is slow.
>
>> Also, the novena patch has a known flaw, in that it requires copying the
>> u-boot.img file to the first partition rather than writing it to a raw
>> offset on the mmc device.
>
> Yeah, I guess it's fine to use mtools in the installer.

The novena also supports loading u-boot.img off of ext2/3/4, so simply
symlinking it to /u-boot.img would work... if / was mounted from the
first microSD partition and /gnu/store was on the same partition. Also,
novena supports SATA, so you'd still need to support putting u-boot.img
on the microSD. Though SPL could be fixed to support loading u-boot.img
off of SATA as well...

Of course, creating a separate fat partition on the microSD would also
work.

>> Not sure how to handle that exactly, as partitioning is typically a
>> manual process in guixsd?
>
> Yeah, for a first step we could just check sanity (in this case check
> whether mcat failed or not).
>
>> If nothing else, merging only the wandboard and mx6cuboxi patches and
>> only including the u-boot target for novena might make sense. Another
>> option would be to patch novena to load u-boot.img from an offset rather
>> than a filesystem, though I doubt that will be accepted in u-boot
>> upstream.
>
> There are lots of boards which need that setup anyway - most notably
> x86_64 UEFI systems - so we have to handle the case anyway.
>
> I vote for using mtools.

Ok, the next immediate change that occurs to me is to make
gnu/bootloaders/u-boot.scm install-u-boot-imx take arguments of weather
to install spl and u-boot.img, defaulting to true in both cases, and
setting the u-boot.img portion to false for novena...

There are also some imx targets which don't have SPL but do install
u-boot.img to the same offset. That can probably be auto-detected by the
presence of the SPL file... maybe that's simpler than a true/false flag.

I'll work on some follow-up patches for those.

> I applied your patches to guix master.

Thanks!

live well,
  vagrant