Open JohnAZoidberg opened 2 years ago
Seems we need to add this tool to build a TOC1 image: https://github.com/smaeul/u-boot/commit/fe858f9adcc321ef384b18349c3fa68ae6d8ee70
https://linux-sunxi.org/Allwinner_Nezha#Mainline_U-Boot
boot0 expects to load a TOC1 image containing OpenSBI and U-Boot (and a DTB). This is similar to, but incompatible with, mainline U-Boot SPL, which expects a FIT image.
The version of mkimage you just compiled contains rudimentary support for making TOC1 images. Since a TOC1 can contain multiple items, we must create a config file telling mkimage where to find them. Use the following content, adjusting the path to OpenSBI as needed:
[opensbi] file = ../opensbi/build/platform/generic/firmware/fw_dynamic.bin addr = 0x40000000 [dtb] file = arch/riscv/dts/sun20i-d1-nezha.dtb addr = 0x44000000 [u-boot] file = u-boot-nodtb.bin addr = 0x4a000000
Now, continuing in the U-Boot build directory, create the TOC1:
vim toc1.cfg # or your editor of choice; see above tools/mkimage -T sunxi_toc1 -d toc1.cfg u-boot.toc1
You should get output that looks like this:
Allwinner TOC1 Image Size: 592896 bytes Contents: 3 items 00000000:00000490 Headers 00000600:00018720 => 40000000 opensbi 00018e00:00007387 => 44000000 dtb 00020200:00070820 => 4a000000 u-boot
Now you can write this TOC1 to your SD card. Note the large (16+ MiB) offset! You will need to leave a gap before your first partition; 20 MiB should be plenty. (Or you can change UBOOT_START_SECTOR_IN_SDMMC in include/spare_head.h in boot0.)
sudo dd if=u-boot.toc1 of=/dev/sdX bs=512 seek=32800
UART baud rates
Additional TODO: Create a PPI/protocol to control GPIOs. Could use the same headers as: https://github.com/MarvellEmbeddedProcessors/edk2/blob/master/Omap35xxPkg/Gpio/Gpio.c
Instruction set:
RV64IMAFDCVU
(RV64GCV
) Official Website (chinese): https://d1.docs.aw-ol.com/ Linux branch: https://github.com/smaeul/linux/commits/riscv/d1-wip U-Boot branch: https://github.com/smaeul/u-boot/tree/d1-wipD1 Manual: https://dl.linux-sunxi.org/D1/D1_User_Manual_V0.1_Draft_Version.pdf Sunxi D1 Wiki page: https://linux-sunxi.org/D1 Sunxi Nezha Wiki page: https://linux-sunxi.org/Allwinner_Nezha Nezha Schematics: https://dl.linux-sunxi.org/D1/D1_Nezha_development_board_schematic_diagram_20210224.pdf Fedora wiki: https://fedoraproject.org/wiki/Architectures/RISC-V/Allwinner xfel: https://github.com/xboot/xfel xfel tutorial: https://github.com/xboot/xboot/blob/master/src/arch/riscv64/mach-d1/README-en-US.md
Model after RaspberryPi3/4 support:
WIP Branch:
Status: No work done yet
Information
Features
PcdFwStartAddress
(0x40000000),PcdFwEndAddress
(auto calulated)PcdHartCount
(1),PcdBootHartId
(0),PcdBootableHartNumber
(1)0x14000000
compatible with SiFive, generic OpenSBI platform gets it via DT)0x10000000
compatible with SiFive, generic OpenSBI platform gets it via DT)Memory Map
Interrupts
LED at 9.12 (page 1270)
Compatible with industry-standard 16450/16550 UARTs
Boot Source (2.2.3.1 Boot ROM (BROM), 3.3 BROM System)
Boot:
Device Trees
https://github.com/smaeul/u-boot/blob/65f26c1c94521c9e54ddceb4d463a0e21ce13047/arch/riscv/dts/sun20i-d1-nezha.dts