基本启动过程

芯片启动的全过程大概是:Bootloader->Kernel->RootFS

对于我们这次实验来说,就是:uboot->linux kernel6.1.19->Buildroot

环境准备

本次实验宿主机使用全新的Ubuntu20.04环境,并在完成实验后用户目录下有以下结构的文件夹。

首先需要创建架构。

1
2
3
4
5
6
7
8
9
10
11
12
workspace
- linux
- partitions
-- boot
--- boot.scr
--- suniv-f1c100s-licheepi-nano.dtb
--- zImage
-- root
- u-boot
- modules
- buildroot
- boot.cmd

然后下载所有本次实验会使用到的代码和依赖。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 安装依赖
sudo apt-get install flex bison gcc make gcc-arm-linux-gnueabihf libncurses-dev swig python-dev device-tree-compiler python3-setuptools python3-dev libssl-dev u-boot-tools g++ patch

# 下载Mainline Linux,你可以在https://www.kernel.org寻找最新的LTS版本
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.19.tar.xz
# extract是zsh提供的自动解压指令,可以替换成tar的对应格式解压指令
extract linux-6.1.19.tar.xz
mv linux-6.1.19 linux

# 下载U-Boot,我们这里没有使用LTS版本,你可以进入cd进去后切换到LTS分支
git clone git://git.denx.de/u-boot.git

# 下载Buildroot,你可以在https://buildroot.org/downloads寻找最新的版本
wget https://buildroot.org/downloads/buildroot-2023.02.tar.xz
extract buildroot-2023.02.tar.xz
mv buildroot-2023.02 buildroot

每一章节结束后请返回workspace目录。

编译U-Boot

1
2
3
4
5
6
7
cd u-boot
# 使用荔枝派Nano的默认配置
make CROSS_COMPILE=arm-linux-gnueabihf- licheepi_nano_defconfig
# 编译
make CROSS_COMPILE=arm-linux-gnueabihf-
# 拷贝U-Boot镜像
cp u-boot-sunxi-with-spl.bin ../partitions

接下来我们需要准备U-Boot启动所需的配置文件,将以下内容写入boot.cmd。

1
2
3
4
setenv bootargs console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb
load mmc 0:1 0x80008000 zImage
bootz 0x80008000 - 0x80C00000

接着编译配置文件。

1
mkimage -C none -A arm -T script -d boot.cmd ./partitions/boot/boot.scr

编译Kernel

1
2
3
4
5
cd linux
# 使用linux-sunxi项目的默认配置,该项目主要包含全志各芯片的硬件支持文档和手册
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
# 进入内核配置菜单
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

我们需要修改内核配置菜单中的部分项目,否则在之后会遇到很多问题。

配置位置 操作 用途
System Type -> Platform selection 取消所有勾,勾选ARMv5支持 CPU架构支持
System Type -> Allwinner SoCs 勾选Armv5支持 CPU架构支持,本选项不勾选会影响DTB文件生成
Kernel Features 勾选ARM EABI 不勾选会导致Kernel可以运行,但是无法加载RootFS的Init
1
2
3
4
5
6
7
8
9
10
11
# 编译内核,-j4的4可以修改为你的CPU核心数
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 zImage
# 编译DTB文件,本文件用于Kernel识别外设,是 Mainline Kernel不可缺少的部分,-j4的4可以修改为你的CPU核心数
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 dtbs
# 编译Modules,-j4的4可以修改为你的CPU核心数
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 modules
# 安装模块
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=../modules make modules modules_install
# 拷贝生成的zImage内核镜像和DTB文件
cp arch/arm/boot/zImage ../partitions/boot
cp arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb ../partitions/boot

编译Buildroot

我们使用Buildroot默认的BusyBox程序和GLIBC,如果需要剪裁大小,可以选择其他的C支持库。

1
2
3
cd buildroot
# 进入配置菜单
make menuconfig
配置位置 操作 用途
Target options Target Arch设置为ARM (little endian) 设置大小端
Target options Target Arch Variant设置为arm926t 设置CPU架构
Toolchain Kernel Headers设置为你下载的LTS版本内核对应的版本号 匹配内核版本
1
2
3
4
5
6
7
8
9
10
# 编译,Buildroot不支持多线程编译,所以不携带-j
make
# 拷贝解压文件系统和内核模块
cp output/images/rootfs.tar ../partitions/root
cd ../partitions/root
extract rootfs.tar
mv rootfs/* ./
rm -rf rootfs
rm rootfs.tar
cp -R ../../modules/* ./

同时修改partitions/root/etc/fstab文件中的ext2为ext4

写入SD卡

请替换CARD_PATH为你的SD卡设备路径,如/dev/sdb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cd partitions
# 清空分区表
dd if=/dev/zero of=CARD_PATH bs=1M count=1
# 写入U-Boot
dd if=u-boot-sunxi-with-spl.bin of=CARD_PATH bs=1024 seek=8
# 写入分区表,请复制除了本行内的内容并执行
blockdev --rereadpt CARD_PATH
cat <<EOT | sfdisk CARD_PATH
1M,16M,c
,,L
EOT
# 格式化
mkfs.vfat 第一个分区路径
mkfs.ext4 第二个分区路径
# 拷贝boot进入第一个分区
mount 第一个分区路径 /mnt
cp -R boot/* /mnt
sync
umount /mnt
# 拷贝rootfs进入第二个分区
mount 第二个分区路径 /mnt
cp -R root/* /mnt
sync
umount /mnt

开机测试

将SD卡安全拔出后插入设备,接入uart0后开机,可以看到U-Boot和Kernel的启动过程并顺利看到sh。

参考文档

https://blog.csdn.net/kencaber/article/details/107575210
https://linux-sunxi.org/Manual_build_howto
https://linux-sunxi.org/Mainline_Kernel_Howto
https://linux-sunxi.org/Manual_build_howto
https://linux-sunxi.org/U-Boot

全志F1C100s使用记录:u-boot & linux & rootfs 编译与烧录测试(基于SD卡)(好详细)

目的

这篇文章中将测试在 F1C100s 中运行Linux系统( 基于SD卡 / TF卡),一些背景资料请查看 《全志F1C100s使用记录:资料索引与基础说明》 这篇文章。

基础准备

硬件准备

测试用开发板可以参考上面文章中电路绘制,或者也可以直接购买荔枝派Nano进行测试。

开发环境

下载安装Ubuntu Desktop(使用版本为20.04):
https://ubuntu.com/download/desktop

安装完成后进行基础环境安装与设置:

1
2
3
4
5
6
7
8
9
10
11
sudo apt update

sudo apt install -y build-essential
sudo apt install -y libusb-1.0-0-dev zlib1g-dev
sudo apt install -y pkg-config
sudo apt install -y python python3 python-dev python3-dev
sudo apt install -y swig
sudo apt install -y libncurses-dev libncurses5-dev
sudo apt install -y libssl-dev
sudo apt install -y kpartx
sudo apt install -y mtd-utils

因为需要从GitHub下载项目所以还要安装git:

1
2
3
4
sudo apt install -y git
# git使用时可能需要设置用户名和邮箱
# git config --global user.name "naisu"
# git config --global user.email naisu@example.com

建立工作目录并进入:

1
2
3
4
# 本文将工作目录设置在用户目录($HOME)下的f1c100s-sdk文件夹中
# cd ~
mkdir f1c100s-sdk
cd f1c100s-sdk/

制作toolchain和rootfs

为了方便这里使用buildroot来制作rootfs,这里有个坑。这里如果使用linaro等组织提供的现成的交叉编译工具链来编译buildroot项目生成rootfs,在使用时系统启动过程中可能会出现 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ,而使用buildroot自己生成的编译工具链就不会出现这个问题了。所以我们这里统一使用buildroot生成的编译工具链。

下载、解压与配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
# cd ~/f1c100s-sdk/
wget https://buildroot.org/downloads/buildroot-2022.02.tar.xz
tar -xJf buildroot-2022.02.tar.xz

# 进入buildroot-2022.02目录
cd buildroot-2022.02/

# 进行配置
# 这里做测试使用,只要配置下目标和工具链即可,详见后面截图
make menuconfig

# 编译
make

编译完成后 output 目录下的 host 目录中就是交叉编译工具链(toolchain); output 目录下的 images 目录中的 rootfs.tar 就是生成的根文件系统。

设置编译工具链

注意PATH使用自己的路径,每次打开终端都需要重新设置:

1
2
3
export ARCH=arm
export CROSS_COMPILE=arm-buildroot-linux-gnueabi-
export PATH=$PATH:/home/nx/f1c100s-sdk/buildroot-2022.02/output/host/bin

u-boot & linux编译

u-boot

下载、配置、编译:

1
2
3
4
5
6
7
8
9
10
11
# cd ~/f1c100s-sdk/
git clone -b nano-lcd800480 --depth=1 https://github.com/Lichee-Pi/u-boot.git

# 进入u-boot目录
cd u-boot/

# 加载配置文件
make licheepi_nano_defconfig

# 修改默认bootcmd
gedit include/configs/suniv.h

需要修改为:

1
#define CONFIG_BOOTCOMMAND "run distro_bootcmd"

然后就可以编译了:

1
2
# 根据电脑配置使用make -jx等加快编译速度
make

编译后当前目录下的 u-boot-sunxi-with-spl.bin 文件就是我们需要的。

boot.scr

根据上面对bootcmd的修改,u-boot启动时会从第一分区读取 boot.scr 文件,并执行其中的脚本。我们可以通过这个来设置要传递给linux内核的参数、来加载内核和设备树、来启动内核。

在uboot目录下新建boot.cmd文件,向其中写入u-boot要执行的脚本:

1
2
3
# cd ~/f1c100s-sdk/u-boot/
touch boot.cmd
gedit boot.cmd

写入以下内容:

1
2
3
4
5
6
7
# 设置传递给内核的bootargs参数
# 读取内核镜像和设备树到内存中指定位置
# 启动内核程序
setenv bootargs console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
load mmc 0:1 0x80008000 zImage
load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb
bootz 0x80008000 - 0x80C00000

使用u-boot编译后tools目录下的 mkimage 工具可以将boot.cmd文件生成为 boot.scr 文件,通过下面命令:

1
2
# arm架构;不压缩;script文件;输入boot.cmd文件;输出boot.scr文件
tools/mkimage -A arm -C none -T script -d boot.cmd boot.scr

生成的 boot.scr 文件就在当前目录下。

linux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# cd ~/f1c100s-sdk/
git clone -b nano-4.14-exp --depth=1 https://github.com/Lichee-Pi/linux.git

# 进入linux目录
cd linux/

# 下载使用荔枝派Nano的linux配置文件
wget https://dl.sipeed.com/fileList/LICHEE/Nano/SDK/config
cp config .config

# 根据需要配置,没有需要的话直接按两下Esc保存退出
make menuconfig

# 编译
# 根据电脑配置使用make -jx等加快编译速度
# 过程中如果出现需要设置的选项全部选n
make

编译后在 arch/arm/boot/ 目录下的 zImage 文件就是压缩后的内核程序;在 arch/arm/boot/dts/ 目录下的 suniv-f1c100s-licheepi-nano.dtbsuniv-f1c100s-licheepi-nano-with-lcd.dtb 文件就是编译后的设备树文件。

测试程序

嵌入式linux开发最终是需要在系统上运行应用程序来实现特定的功能需求,这里编写个基础的应用程序用于测试:

1
2
3
4
5
6
7
8
# cd ~/f1c100s-sdk/
# 建立程序文件夹并进入
mkdir helloworld
cd helloworld/

# 建立程序文件并编写程序
touch helloworld.c
gedit helloworld.c

写入以下内容:

1
2
3
4
5
6
#include 

int main(void)
{
printf("Hello, world!\n");
}

编译生成可执行文件:

1
arm-buildroot-linux-gnueabi-gcc helloworld.c -o helloworld

生成的 helloworld 就是我们需要的可执行文件了。

文件烧录

前面编译生成的内容可以分块分别烧录进SD卡进行测试,也可以将 u-boot & linux & rootfs 整块打包烧录进SD卡进行测试,其实本质上是一样的,这里先进行分块测试的介绍,打包烧录介绍将在后面的章节说明。

1
2
3
# 先将SD卡插入Ubuntu中
# 使用 lsblk 查看SD卡设备号sdX
# 我这里显示为sdb,下面均以此进行说明

分区设置

准备SD卡并按要求分区,空间划分参考本文开头的给出的文章,下面是在Ubuntu终端中进行分区划分示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 如果已经分过区了那么Ubuntu可能会自动挂载
# 逐条使用 sudo umount /dev/sdbn 进行卸载

# 对SD(TF)卡进行分区
sudo fdisk /dev/sdb
# 如果有分区的话可以输入 d 回车依次删除
# 输入 n 新建分区,分区大小根据需要设置即可
# 下面是我新建的两个分区的输入情况
# n回车 回车(p) 回车(1) 回车(2048) +32M回车 (如果有额外提示则Y回车)
# n回车 回车(p) 回车(2) 回车(67584) +200M回车 (如果有额外提示则Y回车)
# 输入 w 回车保存退出,输入使用 lsblk 查看分区情况

# 格式化分区建立文件系统
sudo mkfs.vfat /dev/sdb1
sudo mkfs.ext4 /dev/sdb2

分块烧录

u-boot
u-boot-sunxi-with-spl.bin 文件需要放置在SD卡8k开始的位置上:

1
2
# cd ~/f1c100s-sdk/u-boot/
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8

linux & dtb & boot.scr
这三个放在刚才新建的第一个分区里(sdb1):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 如果分区已挂载到别的地方先进行卸载
# sudo umount /dev/sdb1
# 将分区挂载到 /mnt
sudo mount /dev/sdb1 /mnt

# 拷贝linux和dtb
# cd ~/f1c100s-sdk/linux/
sudo cp arch/arm/boot/zImage /mnt/
sudo cp arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb /mnt/

# 拷贝boot.scr
# cd ~/f1c100s-sdk/u-boot/
sudo cp boot.scr /mnt/

# 保存退出
# sync
# sudo umount /dev/sdb1

rootfs
这个放在刚才新建的第二个分区里(sdb2):

1
2
3
4
5
6
7
8
9
10
11
12
# 如果分区已挂载到别的地方先进行卸载
# sudo umount /dev/sdb2
# 将分区挂载到 /mnt
sudo mount /dev/sdb2 /mnt

# 解压并拷贝rootfs
# cd ~/f1c100s-sdk/buildroot-2022.02/
sudo tar -xf output/images/rootfs.tar -C /mnt/

# 保存退出
# sync
# sudo umount /dev/sdb2

测试程序

1
2
3
4
5
6
7
8
9
10
11
12
# 如果分区已挂载到别的地方先进行卸载
# sudo umount /dev/sdb2
# 将分区挂载到 /mnt
sudo mount /dev/sdb2 /mnt

# 拷贝helloworld
# cd ~/f1c100s-sdk/helloworld/
sudo cp helloworld /mnt/root/

# 保存退出
# sync
# sudo umount /dev/sdb2

上电测试

上电打印信息与应用程序测试结果与关键日志如下:
默认通过UART0 PE0-RX PE1-TX 波特率115200
我这里使用的是F1C200s,所以内存显示为 64 MiB
前面生成的rootfs登陆用户名为root,无密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
U-Boot SPL 2018.01-gd83b2fe-dirty (Mar 15 2022 - 15:52:58)
DRAM: 64 MiB
Trying to boot from MMC1


U-Boot 2018.01-gd83b2fe-dirty (Mar 15 2022 - 15:52:58 +0800) Allwinner Technology

CPU: Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0

省略若干内容……

mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
279 bytes read in 14 ms (18.6 KiB/s)
## Executing script at 80c50000
reading zImage
3841152 bytes read in 200 ms (18.3 MiB/s)
reading suniv-f1c100s-licheepi-nano.dtb
7464 bytes read in 25 ms (291 KiB/s)
## Flattened Device Tree blob at 80c00000
Booting using the fdt blob at 0x80c00000
Loading Device Tree to 816fb000, end 816ffd27 ... OK

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.0-licheepi-nano+ (nx@nx-ubuntu) (gcc version 10.3.0 (Buildroot 2022.02)) #1 Tue Mar 15 16:07:52 CST 2022
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f

省略若干内容……

[ 1.331930] Waiting for root device /dev/mmcblk0p2...
[ 1.375977] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.390277] mmc0: new high speed SDHC card at address aaaa
[ 1.396880] mmcblk0: mmc0:aaaa SC16G 14.8 GiB
[ 1.407742] mmcblk0: p1 p2

省略若干内容……

Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK

省略若干内容……

Welcome to Buildroot
buildroot login: root
# ls
helloworld
# ./helloworld
Hello, world!
#

系统镜像

前面分块烧录在测试的时候用用还行,但是如果是要批量生产或是交给他人使用就不方便了,这个时候可以制作系统成单个系统镜像文件来处理。

前面讲了对SD卡分区等操作,其实不管是分区还是数据拷贝等,最终在SD卡上无非就是一片按照一定顺序存储的数据。把这段数据原模原样的拷贝成一个文件,这就是系统镜像文件,使用的时候只要把这个文件内容拷贝到SD卡上就可以了。

制作镜像文件

从已有SD卡制作镜像文件
如果有已经烧录完成所有内容的SD卡的话直接使用 dd 命令将SD卡内容复制到一个文件即可得到系统镜像文件。比如针对前面流程下的SD卡可以使用下面方式:

1
2
3
4
5
6
7
8
9
10
11
12
# cd ~/f1c100s-sdk/

# 如果分区已挂载到别的地方先进行卸载
# sudo umount /dev/sdb1
# sudo umount /dev/sdb2

# 创建系统镜像文件
touch f1c100s-system-image.bin
# 将SD卡中有用的数据保存镜像文件中
# 大小为 1M(uboot) + 32M(bootfs) + 200M(rootfs) + 2M(多拷贝点,防止不明意外)
# 数据比较大会花点时间
dd if=/dev/sdb of=f1c100s-system-image.bin bs=1M count=235

从编译生成的文件制作
如果还没有烧录好的SD卡也可以直接从编译生成的文件制作

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# cd ~/f1c100s-sdk/
# rm f1c100s-system-image.bin

# 创建系统镜像文件
touch f1c100s-system-image.bin
# 向镜像文件写入空数据固定大小
dd if=/dev/zero of=f1c100s-system-image.bin bs=1M count=235

# 查看可用的设备挂载点
sudo losetup -f
# 我这里显示 /dev/loop13,接下来都以此进行说明
# 将镜像文件挂载到 /dev/loop13
sudo losetup /dev/loop13 f1c100s-system-image.bin

# 对挂载的设备进行分区
sudo fdisk /dev/loop13
# 下面是我新建的两个分区的输入情况
# n回车 回车(p) 回车(1) 回车(2048) +32M回车 (如果有额外提示则Y回车)
# n回车 回车(p) 回车(2) 回车(67584) +200M回车 (如果有额外提示则Y回车)
# 接着 a回车 1回车 (将分区1设置为可启动)
# 输入 w 回车保存退出,会有点问题提示不用管

# 更新分区表
sudo kpartx -av /dev/loop13

# 格式化分区建立文件系统
sudo mkfs.vfat /dev/mapper/loop13p1
sudo mkfs.ext4 /dev/mapper/loop13p2

# 挂载第一个分区向里拷贝linux、dtb、boot.scr
sudo mount /dev/mapper/loop13p1 /mnt
sudo cp linux/arch/arm/boot/zImage /mnt/
sudo cp linux/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb /mnt/
sudo cp u-boot/boot.scr /mnt/
sync
sudo umount /dev/mapper/loop13p1

# 挂载第二个分区向里解压并拷贝rootfs
sudo mount /dev/mapper/loop13p2 /mnt
sudo tar -xf buildroot-2022.02/output/images/rootfs.tar -C /mnt/
# 根据需求也可以拷贝应用程序进去
# sudo cp helloworld/helloworld /mnt/root/
sync
sudo umount /dev/mapper/loop13p2

# 卸载设备
sudo kpartx -d /dev/loop13
sudo losetup -d /dev/loop13

# 向头部写入uboot,注意conv=notrunc选项参数一定不能漏
sudo dd if=u-boot/u-boot-sunxi-with-spl.bin of=f1c100s-system-image.bin bs=1024 seek=8 conv=notrunc

压缩系统镜像
前面生成的系统镜像比较大,不适合存储,可以对镜像镜像压缩:

1
2
3
# cd ~/f1c100s-sdk/
# 将系统镜像以zip方式镜像压缩
zip f1c100s-system-image.zip f1c100s-system-image.bin

使用镜像文件

在Linux上可以直接使用 *dd* 命令将镜像文件写入SD卡中

1
2
3
4
5
6
7
8
9
10
# cd ~/f1c100s-sdk/
# rm f1c100s-system-image.bin
# 如果分区已挂载到别的地方先进行卸载
# sudo umount /dev/sdb1
# sudo umount /dev/sdb2

# 解压镜像文件压缩包
unzip f1c100s-system-image.zip
# 将镜像文件写入SD卡,写入可能较慢
sudo dd if=f1c100s-system-image.bin of=/dev/sdb bs=1M

当然我更加推荐使用工具来烧录,这里推荐使用 BalenaEtcher 工具 ,这个工具支持windos、macos、linux,其官方页面和项目地址分别如下:
https://www.balena.io/etcher/
https://github.com/balena-io/etcher
下面是用这个工具进行烧录的演示:

上面演示了使用BalenaEtcher工具进行烧录和启动测试,其中有两点值得注意的:

  • 原始的.bin后缀名的系统进行经过压缩后变得非常小(235MB > 5.98MB),可见压缩非常有用;
  • BalenaEtcher可以直接使用压缩包进行烧录(比如我上面演示中);

可能会遇到的问题

  • buildroot编译过程中下载文件慢
    buildroot编译过程中会下载很多文件,有可能会下着下着就不动了,或是下载缓慢。首先可以尝试使用 ctrl + c 终止当前工作后再 make ,会从终止的步骤重新开始;
    如果上面的方式不行,那自行查看编译输出信息,其中有文件下载地址的,手动用下载工具进行下载,把下载的内容压缩包或解压后内容放到buildroot的 dl 目录下,然后重复前面步骤;
  • 编译过程中因为缺少文件报错
    百度、必应等查找Ubuntu下安装这些文件的方法;
  • 编译或使用中其它不明的问题
    使用 make clean 或者 make distclean 后重复配置编译过程;

SDK数据包

鉴于整个过程中有很多东西需要下载,部分内容可能下载缓慢,所以将本文中出现的主要的几个项目内容进行了打包,方便将来使用。下载链接如下:
链接:https://pan.baidu.com/s/1BJPKuZJQmczxh82JJOGG_g
提取码:ezrw

下载下来是个zip格式压缩包,解压后得到下面内容(Ubuntu上可以使用 unzip 进行解压):
全志F1C100s使用记录:u-boot & linux & rootfs 编译与烧录测试(基于SD卡)_第5张图片

各个文件说明如下:

文件 说明
helloworld 内部含有helloworld.c文件
buildroot-2022.02.tar.xz 使用 wget https://buildroot.org/downloads/buildroot-2022.02.tar.xz 下载得到的压缩包
buildroot-2022.02-with-dl.tar.xz 根据上面项目 make menuconfig > make > make clean 后的文件夹进行重新打包压缩 其dl文件夹中包含了所有make时需要下载的东西
linux.tar.xz 使用 git clone -b nano-4.14-exp –depth=1 https://github.com/Lichee-Pi/linux.git 下载 得到的linux文件夹中放入使用 wget https://dl.sipeed.com/fileList/LICHEE/Nano/SDK/config 下载的config文件 然后对linux文件夹重新打包
sunxi-tools.tar.xz 使用 git clone -b f1c100s-spiflash –depth=1 https://github.com/Icenowy/sunxi-tools.git 下载 得到的sunxi-tools文件夹重新打包
u-boot.tar.xz 使用 git clone -b nano-lcd800480 –depth=1 https://github.com/Lichee-Pi/u-boot.git 下载 到的u-boot文件夹重新打包

总结

本文基于现有的一些项目,详细记录 u-boot & linux & rootfs 编译与烧录测试( 基于SD卡) 整个流程内容,可以作为进一步的移植、开发与使用的基础。


相关链接(侵删)

  1. 全志F1C100S编译运行Linux全流程记录

  2. 全志F1C100s使用记录:u-boot & linux & rootfs 编译与烧录测试(基于SD卡)


=================我是分割线=================

欢迎到公众号来唠嗑: