安装开发环境需要的依赖
sudo apt-get install -y sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio unzip rsync file bc wget python cvs git mercurial rsync subversion android-tools-mkbootimg vim libssl-dev android-tools-fastboot
sudo apt-get -y install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lib32z1 lib32z1-dev lib32stdc++6 libstdc++6 libncurses-dev u-boot-tools
下载系统
$ git clone https://github.com/mangopi-sbc/Tina-Linux.git
$ cd Tina-Linux/
$ git submodule update --init --recursive
// download the static file
$ wget http://dl.mangopi.cc/tina/prebuilt.tar.gz
$ tar xzvf prebuilt.tar.gz
$ wget http://dl.mangopi.cc/tina/dl.tar
$ tar xvf dl.tar
$ wget http://dl.mangopi.cc/tina/toolchain/riscv64-linux-x86_64-20200528.tar.xz -P ./lichee/brandy-2.0/tools/toolchain/
$ wget http://dl.mangopi.cc/tina/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz -P ./lichee/brandy-2.0/tools/toolchain/
编译
### Compile
$ source build/envsetup.sh
$ lunch
```sh
You're building on Linux
Lunch menu... pick a combo:
1. f133_evb1-tina
2. f133_pro-tina
3. t113_evb1-tina
$ 1 or 3
$ muboot
$ make
$ pack
# 更改 CONSOLE 串口
板子上实际用的串口是串口3,系统默认的是串口0.
### 更改Tina-Linux/device/config/chips/t113/configs/evb1/env.cfg
```c
/* 原来的
burn_key=0
earlyprintk=sunxi-uart,0x02500000
initcall_debug=0
console=ttyS0,115200
*/
//更改后的
burn_key=0
earlyprintk=sunxi-uart,0x02500C00
initcall_debug=0
console=ttyS3,115200
串口的基地址需要看手册:T113-S3_User_Manual_V1.3_.pdf
![Q7Z1L59087}WY[M8UKSPI.png](https://img-blog.csdnimg.cn/img_convert/38bd2a7dbf591ce829dffd3a81293733.png#clientId=u4dca2c29-3276-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=312&id=ud32ea6a0&margin=[object Object]&name=Q7Z1L59087}WY[M8UKSPI.png&originHeight=312&originWidth=896&originalType=binary&ratio=1&rotation=0&showTitle=false&size=27623&status=done&style=none&taskId=u539d465f-4521-4201-a3d0-eb6428e6c6e&title=&width=896)
修改Tina-Linux/device/config/chips/t113/configs/evb1/sys_config.fex
//修改后
[uart_para]
uart_debug_port = 3
uart_debug_tx = port:PB06<7><1><default><default>
uart_debug_rx = port:PB07<7><1><default><default>
复用号需要查看:
![CPZH
V
Y
VY
VY8_]UPU)F{HX$17.jpg](https://cdn.nlark.com/yuque/0/2022/jpeg/21741451/1659750021883-81f01f3c-8038-43f2-9f4d-146b60695ac1.jpeg#clientId=u4dca2c29-3276-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=401&id=uaff60339&margin=%5Bobject%20Object%5D&name=CPZH%24VY%248_%5DUPU%29F%7BHX%2417.jpg&originHeight=401&originWidth=1147&originalType=binary&ratio=1&rotation=0&showTitle=false&size=87160&status=done&style=none&taskId=u03ac4e8f-e181-4af6-886d-233f576a8bc&title=&width=1147)
修改UBOOT CONSOLE INDEX
路径:Tina-Linux/lichee/brandy-2.0/u-boot-2018/configs/sun20iw1p1_defconfig
//在最后加入
CONFIG_BAUDRATE=115200
CONFIG_SPECIFY_CONSOLE_INDEX=y
CONFIG_CONS_INDEX=4//串口号+1,例如使用串口0 这就是1;串口2这就是3
修改内核设备树
路径:/home/t113/work_space/Tina-Linux/device/config/chips/t113/configs/evb1/linux-5.4/
&uart0 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart0_pins_a>;
pinctrl-1 = <&uart0_pins_b>;
status = "disabled";
};
&uart1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart1_pins_a>;
pinctrl-1 = <&uart1_pins_b>;
status = "disabled";
};
&uart2 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart2_pins_a>;
pinctrl-1 = <&uart2_pins_b>;
status = "disabled";
};
&uart3 {
compatible = "allwinner,sun20iw1-dsp-uart";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart3_pins_a>;
pinctrl-1 = <&uart3_pins_a>;
status = "okay";
};
uart3_pins_a: uart3_pins@0 { /* For EVB1 board */
pins = "PB06", "PB07";
function = "uart3";
muxsel = <7>;
drive-strength = <10>;
bias-pull-up;
};
内核配置: config-5.4
路径:/home/t113/work_space/Tina-Linux/device/config/chips/t113/configs/evb1/linux-5.4/
CONFIG_DEBUG_SUNXI_UART3=y
CONFIG_DEBUG_UART_PHYS=0x02500c00
CONFIG_DEBUG_UART_VIRT=0xf2500c00
更改分区
路径:/home/t113/work_space/Tina-Linux/device/config/chips/t113/configs/evb1/
/*[partition]
name = rootfs_data
size = 10240
user_type = 0x8000
[partition]
name = UDISK
name = rootfs_data
size = 10240
user_type = 0x8000
*/
改为
[partition]
name = rootfs_data
size = 10240
user_type = 0x8000
[partition]
name = UDISK
size = 10240
user_type = 0x8000
修改完,记得make pack