Line 151: | Line 151: | ||
You can build a '''grubriscv64.efi''' by following the page above. Then put it into '''the /EFI/ dir''' of '''the EFI partition''' of SD card. | You can build a '''grubriscv64.efi''' by following the page above. Then put it into '''the /EFI/ dir''' of '''the EFI partition''' of SD card. | ||
[[File:SD Allwinner nezha.png| | [[File:SD Allwinner nezha.png|center|1024px]] | ||
==== Linux kernel for Nezha D1 ==== | ==== Linux kernel for Nezha D1 ==== |
Revision as of 16:24, 5 September 2021
Nezha is a SBC based on Allwinner D1. This is a placeholder page to collect all information about running Fedora on Nezha.
Simple HOWTO
Prebuild Image
we have made the prebuild Fedora Image for Allwinner D1: Fedora-riscv64-d1-developer-xfce-with-esp-Rawhide-20210723-173234.n.0-sda.raw.zst
For booting it on D1, what you need to do just:
Decompress
unzstd Fedora-riscv64-d1-developer-xfce-with-esp-Rawhide-20210723-173234.n.0-sda.raw.zst`
Flash into a SD card (>= 16GB)
sudo dd if=Fedora-riscv64-d1-developer-xfce-with-esp-Rawhide-20210723-173234.n.0-sda.raw of=/dev/sdX status=progress
insert the SD card and power up
- default display is LCD (vertical):
- (optional) switch display to HDMI (1080p mode, vertical)
cd /sys/kernel/debug/dispdbg echo disp0 > name; echo switch1 > command; echo 4 10 0 0 0x4 0x101 0 0 0 8 > param; echo 1 > start;
Hardware info
IP info
T-Head: XuanTie C906 RISC-V
Soc & Development boardinfo
Allwinner: D1 SoC Introduction
Sunxi: D1
Sunxi: Allwinner Nezha
Software
Original source code
Allwinner: Allwinner Customer Service Platform Portal
You need to register and login.
Or you can download then from SUNXI website
FYI: Smaeul's REPO
Tekkaman REPO for Fedora Image
Firmware Build order
SPL(Boot0)
boot0 or SPL (Secondary Program Loader) which the first stage after BootROM, it is responsible for initializing DRAM and loading next stage firmware from storage(Flash or SD).
Using Smaeul SPL directly.
Build binary
git clone https://github.com/smaeul/sun20i_d1_spl pushd sun20i_d1_spl git checkout origin/mainline make CROSS_COMPILE=riscv64-linux-gnu- p=sun20iw1p1 mmc popd
Flash to SD card
pushd sun20i_d1_spl sudo dd if=nboot/boot0_sdcard_sun20iw1p1.bin of=/dev/sdX bs=512 seek=16
OpenSBI
RISC-V Open Source Supervisor Binary Interface, like arm-TF
Using Smaeul's patches, but rebase to the latest upstream OpenSBI, and fix some issue.
Build binary
git clone https://github.com/tekkamanninja/opensbi -b allwinner_d1 pushd opensbi CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic FW_PIC=y make popd
The build/platform/generic/firmware/fw_dynamic.bin will be used to make u-boot.toc1 below.
U-boot
Using Smaeul's patches, but enable more features and add some default env for auto-booting into GRUB, and also rebase to the latest upstream U-boot.
Build binary
git clone https://github.com/tekkamanninja/u-boot -b allwinner_d1 pushd u-boot make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv nezha_defconfig make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv menuconfig make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv u-boot.bin u-boot.dtb popd
The u-boot.bin and u-boot.dtb will be used to make u-boot.toc1 below.
Build u-boot.toc1
- toc1.cfg:
[opensbi] file = fw_dynamic.bin addr = 0x40000000 [dtb] file = u-boot.dtb addr = 0x44000000 [u-boot] file = u-boot.bin addr = 0x4a000000
- build command:
pushd u-boot cp ${PATH_TO_TOC1_CFG}/toc1.cfg ${PATH_TO_OPENSBI}/fw_dynamic.bin . tools/mkimage -T sunxi_toc1 -d toc1.cfg u-boot.toc1 popd
Flash u-boot.toc1 to SD card
pushd u-boot sudo dd if=u-boot.toc1 of=/dev/sdX bs=512 seek=32800
GRUB for RISC-V
Please reference to this page: Architectures/RISC-V/GRUB2
You can build a grubriscv64.efi by following the page above. Then put it into the /EFI/ dir of the EFI partition of SD card.
Linux kernel for Nezha D1
Using the patches from Smaeul/Ren Guo(T-HEAD)/Allwinner Engineers, enable almost all the features for Fedora,and also rebase to the latest upstream kernel master branch.
How to Build your own Fedora Remix Image
Please reference to RISC-V: Build Bootable Image