summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuuta Liang <yuuta@yuuta.moe>2023-11-06 07:25:22 +0800
committerYuuta Liang <yuuta@yuuta.moe>2023-11-06 07:25:22 +0800
commit2d1909f1b9b70d8f6c501ca683fda0f8f2f49087 (patch)
treea1d31aaf0c391ef0f591d9f47ab79baea3b906a0
parent177c9f5b24ac34aea753f7ce875dc5cc250ce3ef (diff)
downloadkb-2d1909f1b9b70d8f6c501ca683fda0f8f2f49087.tar
kb-2d1909f1b9b70d8f6c501ca683fda0f8f2f49087.tar.gz
kb-2d1909f1b9b70d8f6c501ca683fda0f8f2f49087.tar.bz2
kb-2d1909f1b9b70d8f6c501ca683fda0f8f2f49087.zip
Lichee D1
-rw-r--r--docs/hardware/soc/lichee-d1.md61
-rw-r--r--mkdocs.yml2
2 files changed, 63 insertions, 0 deletions
diff --git a/docs/hardware/soc/lichee-d1.md b/docs/hardware/soc/lichee-d1.md
new file mode 100644
index 0000000..0bfd094
--- /dev/null
+++ b/docs/hardware/soc/lichee-d1.md
@@ -0,0 +1,61 @@
+# Lichee RV D1
+
+## Official Images
+
+The [official images](https://wiki.sipeed.com/hardware/en/lichee/RV/flash.html)
+from AllWinner requires a proprietary tool to flash:
+[PhoneixCard](https://dl.sipeed.com/shareURL/LICHEE/D1/Lichee_RV/tool). You can
+alternatively use the
+[Ubuntu image](https://cdimage.ubuntu.com/releases/23.10/release/ubuntu-23.10-preinstalled-server-riscv64+licheerv.img.xz)
+which is just a plain disk image, or you can use the open-source
+[OpenixCard](https://github.com/YuzukiTsuru/OpenixCard) to deal with the
+official images.
+
+Without a valid bootable SD card, the board will go to FEL mode.
+
+## UART
+
+If you have the dock, then there's no need to solder the on-board UART pins.
+
+See [linux-sunxi.org](https://linux-sunxi.org/Sipeed_Lichee_RV#UART) for the
+pinout.
+
+## OpenSBI and U-Boot
+
+Follow
+[linux-sunxi.org/AllWinner_Nezha](https://linux-sunxi.org/Allwinner_Nezha) for
+how to build mainline OpenSBI and U-Boot.
+
+```shell
+% git clone https://github.com/riscv-software-src/opensbi
+% pushd opensbi
+% make CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic FW_PIC=y
+% popd
+% git clone https://github.com/smaeul/u-boot -b d1-wip
+% pushd u-boot
+% make CROSS_COMPILE=riscv64-linux-gnu- nezha_defconfig
+% make CROSS_COMPILE=riscv64-linux-gnu- OPENSBI=../opensbi/build/platform/generic/firmware/fw_dynamic.bin
+```
+
+The final file is `u-boot-sunxi-with-spl.bin`.
+
+This version of OpenSBI has ethernet support (and it thinks that there're
+ethernet adapters), but in fact the Lichee D1 board doesn't support ethernet.
+
+The U-Boot has UEFI support, and it perfectly boots Grub.
+
+## SPI Starting Location
+
+The hard-coded start location is at 8KiB loc of the SD card. As seen at
+[linux-sunxi.org/Bootable_SD_card](https://linux-sunxi.org/Bootable_SD_card#Bootloader):
+
+```shell
+% dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8
+```
+
+This location conflicts with the GPT header. We can reduce the GPT partition
+entries from 128 to 56. Thus, the first usable LBA is 16, which is exactly
+8KiB. Linux fdisk(1) `x` expert menu can do this.
+
+Make sure to create an empty partition from LBA 16, with 1MiB size. This will
+tell the OS not to override the OpenSBI and U-Boot.
diff --git a/mkdocs.yml b/mkdocs.yml
index 7e5098d..8457576 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -156,3 +156,5 @@ nav:
- coding/risc-v/vector.md
- Hardware:
- hardware/index.md
+ - SoC:
+ - hardware/soc/lichee-d1.md