Skip to content

Instantly share code, notes, and snippets.

@orangecms
Last active January 1, 2023 13:41
Show Gist options
  • Save orangecms/df0d3c15f9e32b5c708c021c4be8857b to your computer and use it in GitHub Desktop.
Save orangecms/df0d3c15f9e32b5c708c021c4be8857b to your computer and use it in GitHub Desktop.
try oreboot on Allwinner D1 (Nezha and Lichee RV)

oreboot on Allwinner D1

You will need to use FEL mode for now and use the xfel tool. On a board with fixed boot media (e.g. SPI flash like on the Nezha), keep the FEL button pressed when powering on to enter FEL mode instead and cancel the regular boot process.

Download

There are prebuilt binaries:

Run

xfel ddr d1
xfel write 0x40000000 oreboot-nezha.bin
xfel exec 0x40000000

Kernel sources

5.18.0-RC

https://github.com/orangecms/linux/tree/5.18-kexec

These are Linux 5.18.0-RC + smaeul's patches + kexec fixes + device tree adjustments for fixed memory size and a DRAM controller/mbus fixup.

config

Use the following defconfig:

ARCH=riscv make d1_defconfig

5.15.5

https://github.com/orangecms/linux/tree/v5.15.5-openwrt

These are Linux 5.15.5 + smaeul's patches + kexec fixes + device trees for Nezha and Lichee RV

There are different device trees for Lichee RV Dock boards as well.

config

https://github.com/oreboot/oreboot/blob/main/src/mainboard/sunxi/nezha/linux.config

#!/bin/sh
set -e
_NAME=u-root-nezha
_DIR=/tmp/$_NAME
_FLAGS=-build=bb
# Get u-root, module workaround is necessary as of now
# see also https://github.com/u-root/u-root#warning-go-modules-are-a-work-in-progress-warning
export GO111MODULE=off
go get -u github.com/u-root/u-root
# Build the initramfs
export GOARCH=riscv64
# The key _must_ be called `key.pub` by convention from `cpud`.
~/go/bin/u-root $_FLAGS -o $_DIR.cpio core boot
# add these for [`cpu`](https://book.linuxboot.org/cpu) support:
# -files ~/.ssh/cpu_rsa.pub:key.pub -files hk \
# github.com/u-root/cpu/cmds/cpud
# https://github.com/u-root/u-root/#compression
xz --check=crc32 -9 --lzma2=dict=1MiB --stdout $_DIR.cpio | \
dd conv=sync bs=512 of=$_DIR.cpio.xz
echo "u-root image ready at: $_DIR.cpio.xz"
echo "Now use this file in Linux! :)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment