Port-arm archive

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

installboot(8) support for NetBSD/evbarm



Folks --

I just checked in some changes to installboot(8) that greatly simplify the installation of u-boot binaries onto boot media or into images meant to write to boot media.

Since the requirements for installing u-boot vary from board to board (well, soc to soc), the code that writes the boot loader is data-driven.  The data comes from a known-boards database that ships with the base system that is meant to guide the user to which u-boot package needs to be installed.  installboot(8) then scans for u-boot packages (in /usr/pkg/share/u-boot by default, but this can be overridden by an environment variable or a location specified on the command line).  In order to work with installboot(8), these u-boot packages must include an overlay plist file named installboot.plist that contains the correct procedure for the board / soc as an array of "steps".  I haven't written a man page for the plist file schema yet, but it's documented in a big comment in evboards.c.

Example usage:

bigmac:thorpej$ nbinstallboot -m evbarm -o board=pine64,pinebook arm64.img 
bigmac:thorpej$

List of known boards (apologies if the formatting gets screwed up from my cut-and-paste, here...):

bigmac:thorpej$ nbinstallboot -m evbarm
usage: nbinstallboot [-fnv] [-B s2bno] [-b s1bno] [-m machine] [-o options]
		   [-t fstype] filesystem primary [secondary]
usage: nbinstallboot -c [-fnv] [-m machine] [-o options] [-t fstype] filesystem
usage: nbinstallboot -e [-fnv] [-m machine] [-o options] bootstrap
nbinstallboot: Supported machines are:
	alpha, amd64, amiga, emips, evbarm, ews4800mips, hp300, hppa, i386,
	landisk, macppc, news68k, newsmips, next68k, pmax, sparc, sparc64,
	sun2, sun3, vax, x68k
nbinstallboot: Supported file system types are:
	ffs, raid, raw
nbinstallboot: Valid options are:
	alphasum, append, command=string, console=word, ioaddr=number,
	keymap=word, password=word, resetvideo, speed=number, sunsum,
	timeout=number, modules, bootconf, board=string, dtb=string,
	media=word
Known boards (for -o board=...) are:
bananapi,bpi-r2                Bananapi BPI-R2
cubietech,a80-cubieboard4      Cubietech Cubieboard4
cubietech,cubieboard2          Cubietech Cubieboard2
cubietech,cubietruck           Cubietech Cubietruck
cubietech,cubietruck-plus      Cubietech Cubietruck Plus
friendlyarm,nanopi-m1          FriendlyArm NanoPi M1
friendlyarm,nanopi-neo         FriendlyARM NanoPi NEO
friendlyarm,nanopi-neo-plus2   FriendlyARM NanoPi NEO Plus2
friendlyarm,nanopi-neo2        FriendlyARM NanoPi NEO 2
hardkernel,odroid-c2           Hardkernel ODROID-C2
hardkernel,odroid-xu3          Hardkernel Odroid XU3
lemaker,bananapi               LeMaker Banana Pi
libretech,cc                   Libre Computer Board AML-S905X-CC
merrii,a31-hummingbird         Merrii A31 Hummingbird
nextthing,chip                 NextThing C.H.I.P.
nextthing,chip-pro             NextThing C.H.I.P. Pro
nextthing,pocketchip           NextThing PocketC.H.I.P.
nvidia,jetson-tk1              NVIDIA Tegra124 Jetson TK1
nvidia,p2371-2180              NVIDIA Jetson TX1 Developer Kit
nvidia,p2771-0000              NVIDIA Tegra186 P2771-0000 Development Board
olimex,a10-olinuxino-lime      Olimex A10-OLinuXino-LIME
pine64,pine-h64                Pine H64
pine64,pine64                  Pine64
pine64,pine64-lts              Pine64 LTS
pine64,pine64-plus             Pine64+
pine64,pinebook                Pinebook
pine64,rockpro64               Pine64 RockPro64
pine64,sopine-baseboard        SoPine with baseboard
sinovoip,bpi-m3                Banana Pi BPI-M3
terasic,de0-atlas              Terasic DE-0(Atlas)
ti,am335x-bone                 TI AM335x BeagleBone
ti,am335x-bone-black           TI AM335x BeagleBone Black
ti,omap3-beagle                TI OMAP3 BeagleBoard
xunlong,orangepi-2             Xunlong Orange Pi 2
xunlong,orangepi-one           Xunlong Orange Pi One
xunlong,orangepi-plus2e        Xunlong Orange Pi Plus 2E
xunlong,orangepi-zero          Xunlong Orange Pi Zero
xunlong,orangepi-zero-plus     Xunlong Orange Pi Zero Plus
bigmac:thorpej$ 

...and you can have verbose output, too:

bigmac:thorpej$ nbinstallboot -v -m evbarm -o board=pine64,pinebook arm64.img 
File system:         arm64.img
Primary bootstrap:   (none)
Loading '/nbsd/tools/share/installboot/evbarm/boards.plist'.
Loading '/nbsd/pkg/share/u-boot/bananapi-r2/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/nanopi-neo2/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/cubietruck/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/nanopi-neo-plus2/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/pocketchip/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/bananapi-m3/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/orangepi-2/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/pinebook/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/nanopi-neo/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/hummingbird-a31/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/beagleboard/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/chip/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/cubieboard2/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/cubieboard4/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/orangepi-zero/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/a10-olinuxino-lime/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/cubietruck-plus/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/sopine-baseboard/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/bananapi/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/nanopi-m1/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/pine-h64/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/pine64/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/beaglebonewhite/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/beagleboneblack/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/chip-pro/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/orangepi-zero-plus/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/rockpro64/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/orangepi-one/installboot.plist'.
Loading '/nbsd/pkg/share/u-boot/orangepi-plus2e/installboot.plist'.
Board: Pinebook
Max u-boot offset (rounded): 643212 (643584)
First free block available for file systems: 1257 (0x4e9)
Writing 'u-boot-sunxi-with-spl.bin' -- 635020 ==> 8192
bigmac:thorpej$ 

I'm going to check in the changes to the u-boot packages in pkgsrc in the coming days.  The AllWinner boards are all basically the same, and I've verified these changes on a couple of different flavors.  I have the procedure for the Beagle family of boards, but I'll need to dig out my BeagleBoard to test it.  Meson, Tegra, and Exynos loaders, I'll need some help with those -- email me off-list if you're an expert on those systems.

Enjoy!

> Begin forwarded message:
> 
> From: Jason R Thorpe <thorpej%netbsd.org@localhost>
> Subject: CVS commit: src
> Date: May 6, 2019 at 10:02:42 PM PDT
> To: source-changes%NetBSD.org@localhost
> Reply-To: source-changes-d%NetBSD.org@localhost
> 
> Module Name:	src
> Committed By:	thorpej
> Date:		Tue May  7 05:02:42 UTC 2019
> 
> Modified Files:
> 	src/distrib/sets/lists/base: mi
> 	src/etc/mtree: NetBSD.dist.base
> 	src/share: Makefile
> 	src/tools/installboot: Makefile
> 	src/usr.sbin/installboot: Makefile installboot.8 installboot.c
> 	    installboot.h machines.c
> Added Files:
> 	src/share/installboot: Makefile
> 	src/share/installboot/evbarm: Makefile boards.plist
> 	src/usr.sbin/installboot: evboards.c evboards.h
> 	src/usr.sbin/installboot/arch: evbarm.c
> 
> Log Message:
> Add installboot(8) support for evbarm (and, in the future, other evb*)
> boards that use u-boot.  A known board database lists boards and their
> respective u-boot packages.  u-boot packages are discovered at run-time
> (in /usr/pkg/share/u-boot, by default).  These packages contain board
> database overlays that describe u-boot installation procedure that's
> specific for that board.
> 
> Support this as a native tool and as a host tool.  The native tool
> will attempt to determine the running board type using OpenFirmware
> calls.  Host tool and native tool alike may also specify a board type
> directly using the "-o board=xxx option" or have installboot(8) determine
> the board type from a device tree blob using "-o dtb=/path/to/board.dtb".
> A "-o media=xxx" option is provided for boards that have different u-boot
> binaries and/or installation procedures for different media types (e.g.
> SDMMC, eMMC, or USB).
> 
> This is trivial to extend to other evb* platforms that use u-boot, even if
> they don't use FDT for autoconfiguration.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.1203 -r1.1204 src/distrib/sets/lists/base/mi
> cvs rdiff -u -r1.196 -r1.197 src/etc/mtree/NetBSD.dist.base
> cvs rdiff -u -r1.35 -r1.36 src/share/Makefile
> cvs rdiff -u -r0 -r1.1 src/share/installboot/Makefile
> cvs rdiff -u -r0 -r1.1 src/share/installboot/evbarm/Makefile \
>    src/share/installboot/evbarm/boards.plist
> cvs rdiff -u -r1.11 -r1.12 src/tools/installboot/Makefile
> cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/installboot/Makefile
> cvs rdiff -u -r0 -r1.1 src/usr.sbin/installboot/evboards.c \
>    src/usr.sbin/installboot/evboards.h
> cvs rdiff -u -r1.95 -r1.96 src/usr.sbin/installboot/installboot.8
> cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/installboot/installboot.c \
>    src/usr.sbin/installboot/installboot.h \
>    src/usr.sbin/installboot/machines.c
> cvs rdiff -u -r0 -r1.1 src/usr.sbin/installboot/arch/evbarm.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

-- thorpej



Home | Main Index | Thread Index | Old Index