From Fedora Project Wiki
No edit summary
 
(27 intermediate revisions by the same user not shown)
Line 8: Line 8:


[[File:xuantie_ip.png|512px|right]]
[[File:xuantie_ip.png|512px|right]]
[[File:th1520_soc.png|256px|right]]
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 ==
== 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 . This is a placeholder page to collect all information about running Fedora on T-Head platform.
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.  


Not: Currently T-Head platform is not '''officially''' supported by Fedora community.
[[File:th1520_lpi4a.png|512px|right]]


=== Prebuild Image ===
We have prebuild image for TH1520 platform.


=== Prebuild Image ===
You can download from [https://openkoji.iscas.ac.cn/pub/dl/riscv/T-Head/th1520_light/images/ here].
We have prebuild image for TH1520 platform. You can download from [https://openkoji.iscas.ac.cn/pub/dl/riscv/T-Head/th1520_light/images/ here].


For booting it on TH1520 platform, what you need to do just:
For booting it on TH1520 platform, what you need to do just:
Line 23: Line 30:
unxz fedora-disk-multi-desktops_thead_th1520-f38-20230516-002100.n.0-sda.raw.xz
unxz fedora-disk-multi-desktops_thead_th1520-f38-20230516-002100.n.0-sda.raw.xz
</pre>
</pre>
==== Flash into a SD card (>= 16GB) ====
==== Flash into a SD card (>= 16GB) ====
<pre>
<pre>
Line 51: Line 59:


==== insert the SD card and power up ====
==== insert the SD card and power up ====
* default display is HDMI:
* default display is HDMI.
[[File:Fedora38_on_lpi4a.mp4|center|1024px]]
* youtube video: [https://youtu.be/GQQiDCs-yeY Boot Fedora 38 on Sipeed Lichee Pi 4A]
 
[[File:Boot_Fedora_38_on_Sipeed_Lichee_Pi_4A.png|center|1024px]]


== Hardware info ==
== Hardware info ==
Line 61: Line 71:


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.  
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.  
* T-Head: [https://occ.t-head.cn/product/xuantie/4082464366237126656 玄铁 C920 RISC-V]
== 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 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.
Line 66: Line 80:
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.
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 ===
[https://gitee.com/thead-yocto/documents T-Head Yeying 1520 documentation]


T-Head: [https://occ.t-head.cn/product/xuantie/4082464366237126656 玄铁 C920 RISC-V]
* Sipeed: [https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/1_intro.html  LicheePi 4A]
* light-a-val:[https://gitee.com/thead-yocto/documents#machinetarget%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8 TH1520-A EVB documentation]
* beagleV-Ahead : [https://gitee.com/thead-yocto/documents#machinetarget%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8 beagleV Ahead dev board]
* MM  : [https://gitee.com/thead-yocto/documents#machinetarget%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8 M* M* dev board]


== Software ==
== Software ==
[[File: |center|1024px]]
[[File:boot_order_linux_on_th1520.png|center|1024px]]


=== Reference source code ===
=== Reference source code ===
==== Original source code ====
==== Original source code ====
* '''T-Head''': [https:// ]<br>
* '''T-Head u-boot''': [https://gitee.com/thead-yocto/u-boot u-boot.git]<br>
* ''Alternative'': [https:// ]
* '''T-Head kernel''': [https://gitee.com/thead-yocto/kernel kernel.git]<br>
 
==== Tekkaman's REPO ====
==== Tekkaman's REPO ====
* [https://github.com/tekkamanninja/opensbi OpenSBI]
* [https://github.com/tekkamanninja/opensbi OpenSBI]
Line 82: Line 100:
* [https://github.com/tekkamanninja/linux Linux kernel]
* [https://github.com/tekkamanninja/linux Linux kernel]


=== Tekkaman REPOs for '''Fedora Image'''===
=== '''Fedora Image'''===
==== Firmware Build order ====
* [http://openkoji.iscas.ac.cn/kojifiles/work/tasks/7991/1347991/fedora-disk-multi-desktops_thead_th1520-f38-20230516-002100.n.0-sda.raw.xz fedora-disk-multi-desktops_thead_th1520-f38-20230516-002100.n.0-sda.raw.xz]
 
==== Firmware boot order ====
* [https://openkoji.iscas.ac.cn/pub/dl/riscv/T-Head/th1520_light/FW/ u-boot-with-spl.bin for Fedora auto boot]


==== OpenSBI ====
==== OpenSBI ====
Line 94: Line 115:
git clone https://github.com/tekkamanninja/opensbi -b master
git clone https://github.com/tekkamanninja/opensbi -b master
pushd opensbi
pushd opensbi
CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic FW_PIC=y BUILD_INFO=y make
CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic BUILD_INFO=y make
popd
popd
</pre>
</pre>
Line 101: Line 122:


==== U-boot ====
==== 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.


[https://github.com/tekkamanninja/u-boot Tekkaman's U-boot REPO]
[https://github.com/tekkamanninja/u-boot Tekkaman's U-boot REPO]
Line 133: Line 152:
* [https://]
* [https://]


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


===== Build Linux Kernel for TH1520 =====
===== Build Linux Kernel for TH1520 =====
Line 167: Line 189:
</pre>
</pre>


=== How to Build RPM package for TH1520 ===
Koji System:  
 
* [https://openkoji.iscas.ac.cn/koji/  Openkoji system]
==== 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:
 
<pre>
#From spec file
$ rpmbuild -ba ~/rpmbuild/SPECS/pakcage.spec
 
#'''OR''' to build from an existing SRPM file:
$ rpmbuild -ra package.src.rpm
</pre>
 
Please reference to [https://docs.fedoraproject.org/en-US/quick-docs/create-hello-world-rpm/ 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 [[Architectures/RISC-V/Build Bootable Image|RISC-V: Build Bootable Image]]
 
=== How to make TH1520 as a Koji Builder '''WIP'''===
 
If we have already deployed a koji hub(like [https://openkoji.iscas.ac.cn/koji openkoji],then we can add a TH1520 as koji builder.
 
For example:  
* [https://openkoji.iscas.ac.cn/koji/hosts 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
 
<pre>
# dnf install koji-builder
</pre>
 
* 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
<pre>
cp koji_ca_cert.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust
</pre>
 
* add host '''on koji hub (operated by koji hub admin)'''
<pre>
koji add-host <hostname> riscv64
#The *hostname* should be same in authentication certificate.
</pre>
 
* Enable and start kojid
<pre>
systemctl enable --now kojid
</pre>
 
* Verify koji builder online '''on koji hub (operated by koji hub admin)''':
<pre>
koji list-hosts
# After initialization: The new added builder's status should be ready in the list.
</pre>
*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.

Latest revision as of 07:20, 4 August 2023

Have a question?
Join the Fedora riscv on IRC in #fedora-riscv[?] on Libera

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

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

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: