Skip to content

Commit

Permalink
XuanTie Linux v1.0.11 Release
Browse files Browse the repository at this point in the history
Signed-off-by: Qinghao Shi <shiqinghao.sqh@alibaba-inc.com>
  • Loading branch information
jamesbeyond committed Jan 5, 2024
1 parent 1a1b2c2 commit 8cba24f
Show file tree
Hide file tree
Showing 210 changed files with 7,930 additions and 549 deletions.
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ wait_for_trigger:
- build.log.xz

.common_build: &common_build
tags:
- thead_build
stage: build
<<: *common_builds

Expand Down Expand Up @@ -500,6 +502,8 @@ wait_for_trigger:
9xx_next_glibc_compat: *common_build

9xx_5.10_glibc_qemu_test:
tags:
- thead_build
dependencies:
- 9xx_5.10_glibc_compat
<<: *9xx_qemu_test
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ifneq ($(INSIDE_SITE),)
BRW_SITE = $(INSIDE_SITE)/buildroot-$(BR2_VERSION).tar.gz
endif

DEFCONFIG = $(CONF)
O ?= $(CONF)
BR2_DL_DIR ?= $(BRW_ROOT)/dl

Expand Down Expand Up @@ -62,5 +63,5 @@ endef
all .DEFAULT:
@$(call DOWNLOAD)
@$(call COPYFILES)
make -C $(BRW_DIR) $(CONF) O=$(BRW_ROOT)/$(O)
make -C $(BRW_ROOT)/$(O) $@
make -C $(BRW_DIR) $(DEFCONFIG) CONF= O=$(BRW_ROOT)/$(O)
make -C $(BRW_ROOT)/$(O) CONF= $@
149 changes: 35 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,141 +8,62 @@ This repositery is based on buildroot official repo and project-specific customi

# Quick Start

## Chip & Board
ICE is a Xuantie C910 based high-performance SoC board developed by T-Head. The ICE SoC has integrated 3 Xuantie C910 cores (RISC-V 64) and 1 GPU core, featuring speed and intelligence with a high cost-effective ratio. The chip can provide 4K@60 HEVC/AVC/JPEG decoding ability and varieties of high-speed interfaces and peripherals for controlling and data exchange; suits for 3D graphics, visual AI, and multimedia processing.

![ice.png](https://github.com/T-head-Semi/aosp-riscv/blob/main/resources/ice.jpg?raw=true)

Graph 2. ICE chip

For more information about Xuantie 910 CPU core IP, please check: [**Xuantie C910 introduction**](https://occ.t-head.cn/vendor/cpu/index?spm=a2cl5.14294226.0.0.6700df2098XZyN&id=3806788968558108672)

More detials ref to: [**RVB-ICE**](https://occ.t-head.cn/community/risc_v_en/detail?id=RVB-ICE)

## Build boot.ext4 (kernel + opensbi + dtb) & rootfs

(Tested enviornment - ubuntu 16.04 amd64)
### clone repository

```bash
git clone https://gitlab.com/c-sky/buildroot.git
cd buildroot
make CONF=thead_9xxf_enhanced_5.10_glibc_br_defconfig
export PATH=$PATH:`pwd`/host/opt/ext-toolchain/bin
git clone https://github.com/c-sky/buildroot.git
cd buildroot
```

Then you will get:
```bash
ls -l thead_9xxf_enhanced_5.10_glibc_br_defconfig/images/boot.ext4
ls -l thead_9xxf_enhanced_5.10_glibc_br_defconfig/images/rootfs.ext2
```
### choose a suitable config file

## Build u-boot
Multiple customized config files are provided in folder `configs_enhanced`

```bash
git clone "https://gitee.com/thead-linux/u-boot.git" -b master
make ice_rvb_c910_defconfig
make -j ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-
```
CPU | suitable config file
--- | ---
C910v2 | thead_910v2_enhanced_5.10_glibc_br_defconfig
C920v2 | thead_920v2_enhanced_5.10_glibc_br_defconfig
C906, C908, C910v1 | thead_9xxf_enhanced_5.10_glibc_br_defconfig
C920v1 | thead_9xxv0p7_enhanced_5.10_glibc_br_defconfig
C908v | thead_9xxv_enhanced_5.10_glibc_br_defconfig

Then you will get:
```bash
u-boot-with-spl.bin
```

## Prepare flash tools in host
### Build kernel opensbi & rootfs

Using pip command install thead-tools into your system. (Please using python2)
```bash
sudo apt install python-pip
sudo apt install fastboot

sudo pip install thead-tools
sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple thead-tools
make CONF=thead_9xxf_enhanced_5.10_glibc_br_defconfig
```

## Flash the u-boot

Connect RVB-ICE UART with USB-Type-C to your host PC, ref:
[RVB-ICE Type-C UART](https://occ.t-head.cn/community/risc_v_en/detail?id=RVB-ICE)

Then inside image folder `thead_9xxf_enhanced_5.10_glibc_br_defconfig/images/` you will get:
```bash
root@linux > thead cct uart
uart device list:
/dev/ttyUSB0 - USB-Serial Controller
/dev/ttyUSB1 - USB-Serial Controller

root@linux > thead cct -u /dev/ttyUSB0 list
Wait .....................
CCT Version: 2
memory device list:
dev = ram0 , size = 256.0KB
dev = emmc0 , size = 2.0MB
dev = emmc1 , size = 2.0MB
dev = emmc2 , size = 3.7GB
```

We will put uboot into the emmc0:
fw_jump.bin # OpenSPI with jump address mode
fw_dynamic.bin # OpenSPI with dynamic info mode
Image # Linux Kernel image
rootfs.ext2 # Root filesystem

```bash
thead cct -u /dev/ttyUSB0 download -f u-boot-with-spl.bin -d emmc0
CCT Version: 2
Send file 'u-boot-with-spl.bin' to 21:0 ...
Writing at 0x00009800... (3%)

Reset the board, and you will see:

U-Boot 2020.01-g6cc5d59b0d (Dec 20 2020 - 08:37:37 +0000)

CPU: rv64imafdcvsu
Model: T-HEAD c910 ice
DRAM: 4 GiB
GPU ChipDate is:0x20151217
GPU Frequency is:500000KHz
NPU ChipDate is:0x20190514
DPU ChipDate is:0x20161213
MMC: mmc0@3fffb0000: 0
Loading Environment from MMC... OK
In: serial@3fff73000
Out: serial@3fff73000
Err: serial@3fff73000
Net:
Warning: ethernet@3fffc0000 (eth0) using random MAC address - e6:e2:ea:7a:30:ce
eth0: ethernet@3fffc0000
Hit any key to stop autoboot: 1
```

## Prepare u-boot env setting

In u-boot UART console to setup fastboot UDP server.
### Use Qemu boot Linux

```bash
env default -a

setenv uuid_rootfs "80a5a8e9-c744-491a-93c1-4f4194fd690b"
setenv partitions "name=table,size=2031KB"
setenv partitions "$partitions;name=boot,size=60MiB,type=boot"
setenv partitions "$partitions;name=root,size=-,type=linux,uuid=$uuid_rootfs"
gpt write mmc 0 $partitions

setenv ethaddr 00:a0:a0:a0:a0:a1
setenv ipaddr 192.168.1.100 (Your IP)
setenv netmask 255.255.255.0
saveenv

fastboot udp
./host/csky-qemu/bin/qemu-system-riscv64
-M virt -cpu c910 \
-kernel ./images/fw_jump.bin \
-device loader,file=./images/Image,addr=0x80200000 \
-append "rootwait root=/dev/vda ro" \
-drive file=./images/rootfs.ext2,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-nographic -smp 2
```

## Using fastboot install boot.ext4 & rootfs

```bash
fastboot -s udp:192.168.1.100 flash boot boot.ext4
### Using FPGA boot Linux

fastboot -s udp:192.168.1.100 flash root rootfs.ext2
```
For booting linux with FPGA, dts, gdbinit scripts also will be needed, apart from kernel and rootfs. thoes scripts can be found inside folder `thead_9xxf_enhanced_5.10_glibc_br_defconfig/images/hw`. please referring [documents](https://www.xrvm.cn/document?slug=linux-user-manual) for more details

## Reset the board

Power on the board, you will get:
### See Linux Booting
```bash
[ 1.635084] VFS: Mounted root (ext4 filesystem) readonly on device 254:0.
[ 1.638991] devtmpfs: mounted
Expand Down Expand Up @@ -194,9 +115,9 @@ buildroot login:
```

# Resources
- [https://occ.t-head.cn/community/risc_v_en/detail?id=RVB-ICE](https://occ.t-head.cn/community/risc_v_en/detail?id=RVB-ICE)
- [https://occ.t-head.cn/community/risc_v](https://occ.t-head.cn/community/risc_v)
- [https://occ.t-head.cn/vendor/cpu/cpuList](https://occ.t-head.cn/vendor/cpu/cpuList)
- [https://github.com/T-head-Semi/u-boot](https://github.com/T-head-Semi/u-boot)
- [https://www.xrvm.cn/vendor/cpu/cpuList](https://www.xrvm.cn/vendor/cpu/cpuList)
- [https://www.xrvm.cn/product/list/xuantie](https://www.xrvm.cn/product/list/xuantie)
- [https://www.xrvm.cn/document?slug=linux-user-manual](https://www.xrvm.cn/document?slug=linux-user-manual)
- [https://github.com/T-head-Semi/opensbi](https://github.com/T-head-Semi/opensbi)
- [https://github.com/T-head-Semi/linux](https://github.com/T-head-Semi/linux)

2 changes: 2 additions & 0 deletions board/csky-ci/defconfigs/kernel.svpbmt.fragment
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_BLK_DEV_NBD=m
CONFIG_STD_SVPBMT=y
4 changes: 4 additions & 0 deletions board/csky-ci/defconfigs/kernel.torture-test.fragment
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_RCU_TORTURE_TEST=m
CONFIG_LOCK_TORTURE_TEST=m
CONFIG_TORTURE_TEST=m
CONFIG_BLK_DEV_NBD=m
53 changes: 0 additions & 53 deletions configs_enhanced/thead_910_enhanced_5.1_glibc_br_defconfig

This file was deleted.

56 changes: 0 additions & 56 deletions configs_enhanced/thead_910f_enhanced_5.1_glibc_br_defconfig

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,30 @@ BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y

# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.9.3"
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/c-sky/csky-linux/archive/$(CSKY_LINUX_5_10_RISCV_VERSION).tar.gz"
BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
BR2_LINUX_KERNEL_IMAGE=y
BR2_LINUX_KERNEL_PATCH="package/linux-patch-thead/5.9/"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="package/linux-patch-thead/linux-5.9.config.fragment package/csky-qa/linux-riscv-vdsp.config.fragment package/csky-qa/linux-riscv-xthead.config.fragment board/csky-ci/defconfigs/kernel.pci-9pfs-gpu.fragment"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/csky-ci/defconfigs/kernel.svpbmt.fragment"
BR2_LINUX_KERNEL_INTREE_DTS_NAME="ice light_mpw"
BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT=y

# Bootloader
BR2_TARGET_OPENSBI=y
BR2_TARGET_OPENSBI_USE_PLAT=y

# Toochain Configuration
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://yocbook.oss-cn-hangzhou.aliyuncs.com/depot/toolchains/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="riscv64-unknown-linux-gnu"
BR2_TOOLCHAIN_EXTERNAL_GCC_10=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_10=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TOOLCHAIN_EXTERNAL_INET_RPC=n

# Qemu
BR2_PACKAGE_QEMU_ENHANCED=y
# Gitlab-CI
Expand All @@ -41,17 +54,16 @@ BR2_RISCV_ISA_CUSTOM_RVF=y
BR2_RISCV_ISA_CUSTOM_RVD=y
BR2_RISCV_ISA_CUSTOM_THEAD=y
BR2_RISCV_ABI_LP64D=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1594381796470/riscv64-linux-x86_64-20200702.tar.gz"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="riscv64-unknown-linux-gnu"
BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_1=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y

BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_LINUX_TOOLS_PERF=y
BR2_PACKAGE_NTFS_3G=y
BR2_PACKAGE_NTFS_3G_NTFSPROGS=y
BR2_PACKAGE_HOST_DTC=y
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="package/csky-qa/busybox-riscv.fragment"

BR2_PACKAGE_HOST_UBOOT_TOOLS=y
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/csky-ci/9xx/post-image.sh"
BR2_PACKAGE_HOST_ANDROID_TOOLS=y
BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS=y

Loading

0 comments on commit 8cba24f

Please sign in to comment.