Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: netbsd-9, boot, EFI and device tree



On Sun, Apr 25, 2021 at 12:31:40PM +0200, tlaronde%polynum.com@localhost wrote:
> On Fri, Apr 23, 2021 at 10:02:37PM +0200, Manuel Bouyer wrote:
> > Hello,
> > I'm starting a new project with an Olimex A20 lime2 board.
> > Up to now I used the old way of loading the kenrel from u-boot, where I can
> > also pass kernel command line and device tree blobs.
> > I though that for this new projet I would start with a fresh install,
> > and so with EFI. But I didn't find much informations about it.
> > 
> > What is the way to load a specific device tree, and set some kernel
> > boot options ?
> 
> From documentation and experiments, the problem is that the BROM on the
> Sunxi SoC (hence the olimex-a20-olinuxino) does not provide an UEFI
> environment, neither a SPL (Second Program Loader) nor a shell.
> 
> The BROM checks for uboot in some locations, in this case on the uSD.
> 
> So one needs to install U-Boot in every case.
> 
> Then U-Boot will act as specified by UEFI, looking in all devices for a 
> FAT partition, looking for a /EFI/BOOT/ directory and, in this
> directory, a EFI program with a standardized name.
> 
> In this case this is bootarm.efi, that is compiled during the building
> of the NetBSD release.
> 
> De facto, if U-Boot has been compiled with the DTS, the only file needed
> is the UEFI second stage bootloader (bootarm.efi for an arm32) and
> that's all.
> 
> So the process is:
> 
> BROM (Sunxi SoC) -> SPL (U-Boot) 
> 	-> (FAT partition)/EFI/BOOT/bootarm.efi (provided by NetBSD)
> 	-> ('a' partition in NetBSD wedge): /netbsd
> 
> Even if it was possible (it is in theory possible) to bypass
> bootarm.efi, letting U-Boot (providing UEFI) directly load an EFI aware
> NetBSD kernel (but it doesn't seem at the moment possible from a
> cursory look), U-Boot is mandatory for this SoC (I don't know if the
> emmc version provides more UEFI i.e. has already U-Boot on it).
> 
> If I'm not mistaken, the "old" way was to provide an U-Boot version of
> the kernel (the *.ub). It is not anymore required, since the EFI second
> stage loader (bootarm.efi) can load the kernel.
> 
> In fact, I have tested with only U-Boot installed and
> /EFI/BOOT/bootarm.efi on the FAT partition of the uSD card, and it
> boots without ado.

Yes, that's how it works.

My problem is that I need a custom device tree (activate SPI2, more
devices on I2C2, and so on). For this I found that there is a
fdtfile variable in u-boot, that contains a dts file name which will
be loaded from /dts/ on the FAT. So this part is solved.

The second issue (but not for this project) is that I need some
kernel command line parameters (console=xxx, root=yyy for example).
With u-boot loading netbsd.ub, I can set this in an u-boot variable.
But I don't know how to do this with the EFI second-stage boot loader.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index