On Wed, Nov 12, 2025 at 07:29:04PM -0800, Andrew Hewus Fresh wrote:
> On Wed, Nov 05, 2025 at 03:51:03PM +1100, Jonathan Gray wrote:
> > On Tue, Nov 04, 2025 at 08:10:44PM -0800, Andrew Hewus Fresh wrote:
> > > I recently got a too-cheap-to-be-a-good-idea Allwinner D1 Nezha.
> > > 
> > > It seems to be this:
> > > https://docs.aw-ol.com/d1/en/d1_dev/
> > > 
> > > However, I dd'd riscv64/install78.img to an SD card and it doesn't Just
> > > Work the way the internet and INSTALL.risc54 seem to indicate it should.
> > > 
> > > I added sun20i-d1-nezha.dtb from dtb-6.14 to /vendor, but it still boots
> > > to Tina Linux.
> > > 
> > > I'm not sure quite what I'm looking for though, although I did finally
> > > get into a uboot prompt.
> > 
> > It looks like the U-Boot it ships with can't be used,
> > and support is not in mainline U-Boot.
> > 
> > Building a replacement is described in:
> > 
> > https://linux-sunxi.org/Allwinner_Nezha
> > https://wiki.freebsd.org/riscv/AllwinnerD1
> > 
> > Not something I've tried.
> 
> This did work.  I followed (mostly) the freebsd.org instructions on a
> FreeBSD machine I had available because a couple of tries compiling
> riscv64-none-elf-gcc on OpenBSD was not easy enough for something that
> might not work.  That said, I got a new u-boot built from the "d1-wip"
> branch and dd'd that on top of an sdcard with install78.img already
> there and it booted right into the installer and allowed me to install
> onto a USB stick.  It does not see the on-board flash or the sdcard, but
> that's OK.
> 
> I did have to install some extra packages not listed on that page into
> the FreeBSD jail to be able to compile, but that wasn't too bad.
> 
>     opensbi riscv64-none-elf-gcc git gmake gcc bison python3
>     py311-setuptools swig


Thanks to @brynet on bsd.network, who pointed out that we do have the
necessary riscv-elf gcc toolchain in ports:

https://bsd.network/@brynet/115540664782541348

I was able to build the new u-boot on OpenBSD.

# pkg_add git riscv-elf-gcc opensbi riscv-elf-gcc gcc gmake swig bison 
py3-setuptools
$ git clone -b d1-wip https://github.com/smaeul/u-boot u-boot-d1
$ cd u-boot-d1
$ gmake CC=egcc nezha_defconfig
$ gmake -j8 CROSS_COMPILE=riscv64-unknown-elf- 
OPENSBI=/usr/local/share/opensbi/generic/fw_dynamic.bin
# dd if=./u-boot-sunxi-with-spl.bin of=/dev/??? bs=1k seek=128 conv=sync

The above needs to `dd` to an sdcard I believe and you need to install
OpenBSD onto a USB stick.


I did try copying sun20i-d1-nezha.dtb from sysutils/dtb to the fat
partition on the sdcard, but it caused memory errors, I assume because
that dtb is for the 2G version and I have the 1G.  Not 100% on that
though.


> The dmesg (that I haven't looked closely at) is:
> 
> https://dmesgd.nycbug.org/index.cgi?do=view&id=8692
> 
> OpenBSD 7.8-current (GENERIC) #59: Wed Nov 12 10:39:03 MST 2025
>     [email protected]:/usr/src/sys/arch/riscv64/compile/GENERIC
> real mem  = 1073741824 (1024MB)
> avail mem = 1008242688 (961MB)
> SBI: OpenSBI v1.7, SBI Specification Version 3.0
> random: good seed from bootblocks
> mainbus0 at root: Allwinner D1 Nezha
> cpu0 at mainbus0: T-Head arch 0 imp 0 rv64imafdc
> intc0 at cpu0
> cpu0: 32KB 64b/line 128-way L1 I-cache, 32KB 64b/line 256-way L1 D-cache
> "fit-images" at mainbus0 not configured
> "dcxo-clk" at mainbus0 not configured
> simplebus0 at mainbus0: "soc"
> sxipio0 at simplebus0: 88 pins
> sxiccmu0 at simplebus0
> plic0 at simplebus0
> sxitimer0 at simplebus0: 24000 kHz
> sxidog0 at simplebus0
> com0 at simplebus0: dw16550
> com0: console
> com1 at simplebus0: dw16550
> "i2c" at simplebus0 not configured
> "syscon" at simplebus0 not configured
> "dma-controller" at simplebus0 not configured
> "efuse" at simplebus0 not configured
> "crypto" at simplebus0 not configured
> "dram-controller" at simplebus0 not configured
> sximmc0 at simplebus0
> sdmmc0 at sximmc0: 4-bit, sd high-speed, mmc high-speed, dma
> sximmc1 at simplebus0
> sdmmc1 at sximmc1: 4-bit, sd high-speed, mmc high-speed, dma
> "usb" at simplebus0 not configured
> "phy" at simplebus0 not configured
> ehci0 at simplebus0
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "Generic EHCI root hub" rev 
> 2.00/1.00 addr 1
> ohci0 at simplebus0: version 1.0
> ehci1 at simplebus0
> usb1 at ehci1: USB revision 2.0
> uhub1 at usb1 configuration 1 interface 0 "Generic EHCI root hub" rev 
> 2.00/1.00 addr 1
> ohci1 at simplebus0: version 1.0
> dwxe0 at simplebus0: address f6:64:d9:b9:b2:55
> rgephy0 at dwxe0 phy 1: RTL8169S/8110S/8211, rev. 6
> "clock-controller" at simplebus0 not configured
> "mixer" at simplebus0 not configured
> "mixer" at simplebus0 not configured
> "phy" at simplebus0 not configured
> "tcon-top" at simplebus0 not configured
> "lcd-controller" at simplebus0 not configured
> "lcd-controller" at simplebus0 not configured
> "power-controller" at simplebus0 not configured
> "clock-controller" at simplebus0 not configured
> sxirtc0 at simplebus0
> sxidog1 at simplebus0
> sxidog2 at simplebus0
> gpio0 at sxipio0: 32 pins
> gpio1 at sxipio0: 32 pins
> gpio2 at sxipio0: 32 pins
> gpio3 at sxipio0: 32 pins
> gpio4 at sxipio0: 32 pins
> gpio5 at sxipio0: 32 pins
> gpio6 at sxipio0: 32 pins
> usb2 at ohci0: USB revision 1.0
> uhub2 at usb2 configuration 1 interface 0 "Generic OHCI root hub" rev 
> 1.00/1.00 addr 1
> usb3 at ohci1: USB revision 1.0
> uhub3 at usb3 configuration 1 interface 0 "Generic OHCI root hub" rev 
> 1.00/1.00 addr 1
> "opp-table-cpu" at mainbus0 not configured
> "pmu" at mainbus0 not configured
> "vcc" at mainbus0 not configured
> "vcc-3v3" at mainbus0 not configured
> "usbvbus" at mainbus0 not configured
> "vdd-cpu" at mainbus0 not configured
> "wifi-pwrseq" at mainbus0 not configured
> "binman" at mainbus0 not configured
> sdmmc1: can't enable card
> umass0 at uhub1 port 1 configuration 1 interface 0 "USB SanDisk 3.2Gen1" rev 
> 2.10/1.00 addr 2
> umass0: using SCSI over Bulk-Only
> scsibus0 at umass0: 2 targets, initiator 0
> sd0 at scsibus0 targ 1 lun 0: <USB, SanDisk 3.2Gen1, 1.00> removable 
> serial.07815583810786ac2d21
> sd0: 29358MB, 512 bytes/sector, 60125184 sectors
> vscsi0 at root
> scsibus1 at vscsi0: 256 targets
> softraid0 at root
> scsibus2 at softraid0: 256 targets
> root on sd0a (0f83db59e45e7b31.a) swap on sd0b dump on sd0b
> sxiccmu_d1_set_frequency: 0x00000084
> cpu0: clock not implemented
> 

-- 
andrew

The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.

Reply via email to