From Fedora Project Wiki
Idea.png
Have a question?
Join the Fedora riscv on IRC in #fedora-riscv[?] on Libera
Xuantie ip.png
Th1520 soc.png

This is a placeholder page to collect all information about running Fedora on T-Head platform.

  • Note: Currently T-Head platform is not officially supported by Fedora community.

Simple HOWTO

Lichee Pi 4A is a single board computer (SBC) powered by Alibaba T-Head TH1520 quad-core RISC-V Xuantie C920 processor @ 2.0 GHz with an Imagination GPU and a 4 TOPS NPU for AI.

Th1520 lpi4a.png

Prebuild Image

We have prebuild image for TH1520 platform.

You can download from here.

For booting it on TH1520 platform, what you need to do just:

Decompress

unxz fedora-disk-multi-desktops_thead_th1520-f38-20230516-002100.n.0-sda.raw.xz

Flash into a SD card (>= 16GB)

sudo wipefs -a /dev/sdX
sudo dd if=fedora-disk-multi-desktops_thead_th1520-f38-20230516-002100.n.0-sda.raw of=/dev/sdX status=progress bs=4M

please use wipefs to clean GPT backup partition table, otherwise you may run into rootfs mounting issue like Architectures/RISC-V/Allwinner/zh-cn#内核无法访挂载rootfs

There is a good GUI tool balena-etcher-electron instead of dd command.

Flash u-boot for the specific board into the EMMC

Once you flash the Image into SD card, you can get the u-boot for the specific board in boot partition. For example, for Lichee Pi 4A, the u-boot binary path is <boot partition>/u-boot-with-spl_lpi4a.bin.

Plaese flash it into EMMC by the fastboot command of android-tools package:

sudo fastboot flash uboot /path/to/u-boot-with-spl_lpi4a.bin ;sudo fastboot reboot
sleep 10
sudo fastboot flash uboot /path/to/u-boot-with-spl_lpi4a.bin ;sudo fastboot reboot

Note: the modified u-boot can boot Fedora Image from SD automatically by

  • 1, import uboot_thead_th1520.env from efi partition
  • 2, import uEnv_thead_th1520.txt from boot partition
  • 3, sysboot with extlinux/extlinux.conf

insert the SD card and power up

Boot Fedora 38 on Sipeed Lichee Pi 4A.png

Hardware info

IP info

T-Head Wujian 600 has been tailored specifically for developing edge SoCs. With enhanced CPU capability and heterogeneous architecture for high-performance embedded and edge products, the platform facilitates the design of SoCs in embedded applications, including home robots, medical imaging and video conferencing. It also includes an optimised software stack to help speed up the rollout of products to the market.

Available for licensing, the platform aims to aid global developers by reducing the development costs and shortening the design cycle of chips, making the mass production of RISC-V based high-performance SoCs a reality.

Soc & Development boardinfo

The Alibaba T-Head TH1520 quad-core Xuantie C920 processor clocked at up to 2.5GHz with a 4 TOPS NPU, and support for 64-bit DDR at up 4266 MT.

The TH1520 is born out of the Wujian 600 platform unveiled by Alibaba in August 2022, and is capable of running desktop-level applications such as Firefox browser and LibreOffice office suite on Fedora 37, 38 and more.

T-Head Yeying 1520 documentation

Software

Boot order linux on th1520.png

Reference source code

Original source code

Tekkaman's REPO

Fedora Image

Firmware boot order

OpenSBI

RISC-V Open Source Supervisor Binary Interface, like arm-TF

Tekkaman's OpenSBI REPO

Build binary
git clone https://github.com/tekkamanninja/opensbi -b master
pushd opensbi
CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic BUILD_INFO=y make
popd

The build/platform/generic/firmware/fw_dynamic.bin will be used to make u-boot.toc1 below.

U-boot

Tekkaman's U-boot REPO

Build binary
git clone https://github.com/tekkamanninja/u-boot -b 
pushd u-boot
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv _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

Flash u-boot.bin to EMMC

sudo fastboot flash uboot /path/to/u-boot-with-spl_lpi4a.bin ;sudo fastboot reboot
sleep 10
sudo fastboot flash uboot /path/to/u-boot-with-spl_lpi4a.bin ;sudo fastboot reboot

Linux kernel from T-Head

[http://]

Linux kernel for upstream

Important reference
  • [https://]

+-----+-----+ | | | +-----+-----+

Build Linux Kernel for TH1520
Checkout Source
git clone https://github.com/
pushd linux
git checkout 
popd

Branches: * are all for TH1520

Config
pushd linux
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv _defconfig
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv menuconfig
popd
Cross Build and install
# RISCV_ROOTFS_BOOT is the mount point of the boot partition in SD card 
# RISCV_ROOTFS_BOOT=/run/media/../boot
# RISCV_ROOTFS  is the mount point of the Fedora rootfs partition in SD card 
# RISCV_ROOTFS=/run/media/../rootfs
pushd linux
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_PATH=${RISCV_ROOTFS_BOOT} zinstall
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_MOD_PATH=${RISCV_ROOTFS} modules_install
popd

Koji System: