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.
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
- default display is HDMI:
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.
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.
Soc & Development boardinfo =
T-Head: 玄铁 C920 RISC-V
Software
WIP WIP WIP
Reference source code
Original source code
- T-Head: [https:// ]
- Alternative: [https:// ]
Tekkaman's REPO
Tekkaman REPOs for Fedora Image
Firmware Build order
OpenSBI
RISC-V Open Source Supervisor Binary Interface, like arm-TF
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
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
How to Build RPM package for TH1520
using rpmbuild on QEMU
How to boot Fedora on QEMU, please reference Architectures/RISC-V/Build Bootable Image#Run_Fedora_on_QEMU
- Boot into Fedora on QEMU, then:
- prepare directory tree: Put spec file to /rpmbuild/SPECS and all source files to /rpmbuild/SOURCES
- For building RPM package:
#From spec file $ rpmbuild -ba ~/rpmbuild/SPECS/pakcage.spec #'''OR''' to build from an existing SRPM file: $ rpmbuild -ra package.src.rpm
Please reference to How to Create a GNU Hello World RPM Package for more RPM info.
using mock with Qemu usermod
We also can build riscv64 RPMS on x86_64 machine by mock and Qemu usermode.[WIP]
How to Build your own Fedora Remix Image
Please reference to RISC-V: Build Bootable Image
How to make TH1520 as a Koji Builder WIP
If we have already deployed a koji hub(like openkoji,then we can add a TH1520 as koji builder.
For example:
- Openkoji hosts
- [https:// example build on TH1520 builder in OpenKoji]
Please follow the simple instruction below:
- NEED: koji CA certificate and builder authentication certificate: They are provided by koji hub admin.
- Install necessary packages
# dnf install koji-builder
- Modifying /etc/kojid.conf
- server=<koji hub XMLRPC server URL>
- topurl=<koji HTT file share URL>
- allowed_scms=<SCM repo rules>
- cert=<builder certificate>
- serverca=<koji CA certificate>
- Trust koji hub's CA cert
cp koji_ca_cert.crt /etc/pki/ca-trust/source/anchors/ update-ca-trust
- add host on koji hub (operated by koji hub admin)
koji add-host <hostname> riscv64 #The *hostname* should be same in authentication certificate.
- Enable and start kojid
systemctl enable --now kojid
- Verify koji builder online on koji hub (operated by koji hub admin):
koji list-hosts # After initialization: The new added builder's status should be ready in the list.
- NOTICE:* builder won't ready until free space on /var/lib/mock is greater than 8GiB, and /var/lib/mock on NFS is not supported. Thus, using a high capacity SD card for builder and resize root file system to adapt all free space on SD is necessary.