class="markdown_views prism-dracula">
2019-02-19 内部培训,补充设计思想等内容。
设计思想
我们启动一个嵌入式Linux系统需要什么,下面这4个是最基本的配置项。
- uboot
- kernel
- 根文件系统
- 设备树
通常的启动流程为:
uboot -> kernel
对于一些SOC来说,它的内部SRAM可能会比较小(比如freescale T2080的512KB),小到无法装载下一个完整的uboot镜像,那么就需要spl(Secondary Program Loader),
它主要负责初始化外部RAM和环境,并加载真正的uboot镜像到外部RAM中来执行。此时的启动流程为:
spl -> uboot -> kernel
另外,根据板卡或者的特性,还需要额外的配置项。比如xilinx zynq,zynq内部包含了一个双核A9 ARM(PS),和一个FPGA(PL),相当于CPU+FPGA的板卡,这里的CPU可以是i.MX8等,FPGA正常工作需要下载配置文件,在CPU FPGA分立的板子上,FPGA配置文件可由自己配置Flash单独加载,在zynq里,这个工作由PS部分负责。xilinx zynq的spl不是uboot中的的spl,而是官方开发的称之为fsbl程序,fsbl可以下载PL,加载uboot,但uboot也可以加载PL,如果zynq里用到PL部分,则启动流程为:
fsbl -> pl -> uboot -> kernel
或,
fsbl -> uboot -> pl -> kernel
对于xilinx zynq ultrascale+,多了pmu(peripheral manage unit)firmware和atf(arm trusted firmware),启动流程为:
fsbl -> pmu firmware -> atf -> uboot -> pl -> kernel
文件目录组织
settings.sh为环境变量脚本,fdk为编译工具,
zc@ubuntu:~/program/fdk$ ls -l
total 120
drwxrwxr-x 6 zc zc 4096 Feb 19 10:17 bsp
drwxrwxr-x 2 zc zc 4096 Dec 25 15:19 etc
-rwxrwxr-x 1 zc zc 109632 Jan 22 20:28 fdk
-rwxrwxr-x 1 zc zc 2344 Jan 22 19:33 settings.sh
bsp目录如下,对应不同的平台的bsp子目录,包含uboot,内核等源代码等。
zc@ubuntu:~/program/fdk$ ls -l bsp
total 16
drwxr-xr-x 6 zc zc 4096 Jan 17 16:20 t2080
drwxrwxr-x 4 zc zc 4096 Jan 8 11:03 x86
drwxrwxr-x 7 zc zc 4096 Jan 17 16:20 zynq
drwxrwxr-x 9 zc zc 4096 Jan 22 20:07 zynqmp
zynqmp平台的bsp,包含所有用到的配置项的源代码。
zc@ubuntu:~/program/fdk$ ls -l bsp/zynqmp/
total 14608
drwxrwxr-x 18 zc zc 4096 Dec 5 17:09 arm-trusted-firmware-v2018.2
drwxrwxr-x 67 zc zc 4096 May 30 2018 device-tree-xlnx-v2018.2
drwxrwxr-x 7 zc zc 4096 Dec 5 17:09 embeddedsw-v2018.2
drwxrwxr-x 26 zc zc 4096 Feb 18 14:29 linux-xlnx-v2018.2
drwxrwxr-x 7 zc zc 4096 Dec 12 16:58 package-v2018.2
-rw-rw-r-- 1 zc zc 181 Jan 17 16:20 readme.txt
-rw-r--r-- 1 zc zc 7428054 Dec 25 09:41 rootfs-v2018.2.cpio.gz
-rw-r--r-- 1 zc zc 7494357 Dec 25 09:41 rootfs-v2018.2.ext4.gz
drwxrwxr-x 25 zc zc 4096 Jan 24 11:40 u-boot-xlnx-v2018.2
zynq平台的bsp,包含所有用到的配置项的源代码。
zc@ubuntu:~/program/fdk$ ls -l bsp/zynq
total 6216
drwxrwxr-x 57 zc zc 4096 Jun 26 2015 device-tree-xlnx-v2015.2.1
drwxrwxr-x 7 zc zc 4096 Dec 5 17:09 embeddedsw-v2018.2
drwxrwxr-x 24 zc zc 4096 Jan 22 20:01 linux-xlnx-v2015.2.1
drwxrwxr-x 7 zc zc 4096 Dec 12 16:58 package-v2015.2.1
-rw-rw-r-- 1 zc zc 181 Jan 17 16:20 readme.txt
-rw-rw-r-- 1 zc zc 6336565 Dec 24 11:04 rootfs-v2015.2.1.cpio.gz
drwxrwxr-x 22 zc zc 4096 Jan 16 19:46 u-boot-xlnx-v2015.2.1
t2080平台的bsp,包含所有用到的配置项的源代码。
zc@ubuntu:~/program/fdk$ ls -l bsp/t2080/
total 32448
drwxrwxr-x 2 zc zc 4096 Dec 5 17:09 device-tree-qoriq-v2.0
drwxrwxr-x 24 zc zc 4096 Feb 14 17:28 linux-qoriq-v2.0
drwxrwxr-x 7 zc zc 4096 Jan 15 19:09 package-v2.0
-rw-rw-r-- 1 zc zc 181 Jan 17 16:20 readme.txt
-rw-r--r-- 1 zc zc 33203510 Jan 15 18:52 rootfs-v2.0.ext2.gz
drwxrwxr-x 22 zc zc 4096 Jan 23 21:22 u-boot-qoriq-v2.0
x86平台的bsp,适用于ubuntu16.04.4操作系统。
zc@ubuntu:~/program/fdk$ ls -l bsp/x86/
total 8
drwxrwxr-x 29 zc zc 4096 Jan 10 16:09 linux-source-4.13.0
drwxrwxr-x 7 zc zc 4096 Jan 8 11:03 package-v16.04.4
revision
2018年11月20日 10:22:40
添加对Xilinx zynqmp petalinux-v2018.2的支持。
zc@ubuntu:~/project/petalinux/zynq-v2015.2.1$ fdk -h
Usage: fdk [OPTION...]
Examples:
fdk -t xilinx -p ~/x.hdf
fdk -t xilinx -p ~/x.hdf -s ~/mwm
fdk -c kernel menu
fdk -c uboot menu
fdk -b all
fdk -b kernel
fdk -b uboot
fdk -d all
fdk -d kernel
fdk -d uboot
fdk -k boot mini
fdk -k boot normal -g ./mwm.bit
fdk -k dftfs ext4
fdk -k rootfs ext4
fdk -k fit zImage
fdk -h
fdk -v
Main operation mode:
-t <target>: project target[xilinx, nxp]
-s <path>: workspace path
-p <path>: hdf path, for target xilinx
-u <component>: update component[fsbl, pmufw, dts]
-c <component> <mode>: config component[uboot, kernel] with mode[init, menu]
-b <component>: build component[all | fsbl, pmufw, atf, uboot, kernel, dtb, dts]
misc[ubootenvtool, modules, modules_install]
-d <component>: clean component[all | fsbl, pmufw, atf, uboot, kernel]
bsp[bsp]
-k <type> <mode>: packet image with type[boot, rootfs, fit]
boot: packet bootloader for xilinx device with mode[mini, normal]
mini: fsbl and uboot for zynq
fsbl, pmufw, atf, uboot for zynqmp
normal: mode[mini] + FPGA bitstream
rootfs: packet rootfs with mode[all | cpio, ext2, ext4]
fsroot: extract rootfs from type[cpio, ext2, ext4]
dftfs: install default rootfs with mode[all | cpio, ext2, ext4]
fsdft: set project rootfs as default rootfs with mode[all | cpio, ext2, ext4]
fsurd: packet rootfs into uboot format[all | cpio, ext2, ext4]
fsapp: install app into project rootfs
fslibso: install lib *.so into project rootfs
fsmod: install module into project rootfs
fsdpm: depmod project rootfs
fit: packet kernel, rootfs and dtb
Image: kernel Image for zynqmp
zImage: kernel zImage for zynq
gzip: compress kernel Image with gzip for zynqmp
uImage: packet kernel into uImage format
-g <path>: bit path, when packet boot image in normal mode
-h: show this help
-v: show version information
zc@ubuntu:~/project/petalinux/zynq-v2015.2.1$ fdk -v
Version:
fdk path: /home/zc/program/fdk
fdk version: 1.0.0
petalinux path: /home/zc/program/petalinux-v2018.2-final
petalinux version: 2018.2
Revision:
fdk is a fast developing kit for embedded linux, target for xilinx[zynq/zynqmp], nxp[t2080]
Time Author Revision
2018-09-17 Zhu Ce Initial release, support xilinx zynqmp with petalinux-v2017.4
2018-10-02 Zhu Ce Add support for xilinx zynq with petalinux-v2017.4
2018-10-05 Zhu Ce Add support for nxp t2080 with qoriq-sdk-2.0
2018-11-01 Zhu Ce Add support for xilinx zynq with petalinux-v2015.2.1
2018-11-20 Zhu Ce Add support for xilinx zynqmp with petalinux-v2018.2
2018年11月01日 11:01:40
添加对Xilinx zynq petalinux-v2015.2.1的支持。
zc@ubuntu:~/project/petalinux/zynq-v2015.2.1$ fdk -h
Usage: fdk [OPTION...]
Examples:
fdk -t xilinx -p ~/x.hdf
fdk -t xilinx -p ~/x.hdf -s ~/mwm
fdk -c kernel menu
fdk -c uboot menu
fdk -b all
fdk -b kernel
fdk -b uboot
fdk -d all
fdk -d kernel
fdk -d uboot
fdk -k boot mini
fdk -k boot normal -g ./mwm.bit
fdk -k dftfs ext4
fdk -k rootfs ext4
fdk -k fit zImage
Main operation mode:
-t <target>: project target[xilinx, nxp]
-s <path>: workspace path
-p <path>: hdf path, for target xilinx
-u <component>: update component[fsbl, pmufw, dts]
-c <component> <mode>: config component[uboot, kernel] with mode[init, menu]
-b <component>: build component[all | fsbl, pmufw, atf, uboot, kernel, dtb, dts]
misc[ubootenvtool]
-d <component>: clean component[all | fsbl, pmufw, atf, uboot, kernel]
bsp[bsp]
-k <type> <mode>: packet image with type[boot, rootfs, fit]
boot: packet bootloader for xilinx device with mode[mini, normal]
mini: fsbl and uboot for zynq
fsbl, pmufw, atf, uboot for zynqmp
normal: mode[mini] + FPGA bitstream
rootfs: packet rootfs with mode[all | cpio, ext4]
dftfs: install default rootfs with mode[all | cpio, ext4]
fit: packet kernel, rootfs and dtb
Image: kernel Image for zynqmp
zImage: kernel zImage for zynq
gzip: compress kernel Image with gzip for zynqmp
uImage: packet kernel into uImage format
urd: packet rootfs into uboot format
-g <path>: bit path, when packet boot image in normal mode
-h: show this help
Revision:
fdk is a fast developing kit for embedded linux, target for xilinx[zynq/zynqmp], nxp[t2080]
Time Author Revision
2018-09-17 Zhu Ce Initial release, support xilinx zynqmp with petalinux-v2017.4
2018-10-02 Zhu Ce Add support for xilinx zynq with petalinux-v2017.4
2018-10-05 Zhu Ce Add support for nxp t2080 with qoriq-sdk-2.0
2018-11-01 Zhu Ce Add support for xilinx zynq with petalinux-v2015.2.1
2018年10月06日 22:54:40
添加对NXP(Freescale) T2080的支持,尚未在项目中验证验证。
zc@ubuntu:~/fdk_develope$ fdk -h
Usage: fdk [OPTION...]
Examples:
fdk -t xilinx -p ~/hdf
fdk -t xilinx -p ~/hdf -s ~/mwm
fdk -c kernel menu
fdk -c uboot menu
fdk -b all
fdk -b kernel
fdk -b uboot
fdk -d all
fdk -d kernel
fdk -d uboot
fdk -k boot mini
fdk -k boot normal -g ./mwm.bit
fdk -k rootfs
fdk -k fit
Main operation mode:
-t <target>: project target[xilinx, nxp]
-s <path>: workspace path
-p <path>: hdf path, for target xilinx
-u <component>: update component[fsbl, pmufw, dts]
-c <component> <mode>: config component[uboot, kernel] with mode[init, menu]
-b <component>: build component[all | fsbl, pmufw, atf, uboot, kernel, dtb, dts]
misc[ubootenvtool]
-d <component>: clean component[all | fsbl, pmufw, atf, uboot, kernel]
bsp[bsp]
-k <type> <mode>: packet image with type[boot, rootfs, fit]
boot: packet bootloader for xilinx device with mode[mini, normal]
mini: fsbl and uboot for zynq
fsbl, pmufw, atf, uboot for zynqmp
normal: mode[mini] + FPGA bitstream
rootfs: packet rootfs with mode[all | cpio, ext4]
fit: packet kernel, rootfs and dtb
-g <path>: bit path, when packet boot image in normal mode
-h: show this help
Revision:
fdk is a fast developing kit for embedded linux, target for xilinx[zynq/zynqmp], nxp[t2080]
Time Author Revision
2018-09-17 Zhu Ce Initial release, support xilinx zynqmp with petalinux-v2017.4
2018-10-02 Zhu Ce Add support for xilinx zynq with petalinux-v2017.4
2018-10-05 Zhu Ce Add support for nxp t2080 with qoriq-sdk-2.0
2018年10月03日 18:54:40
自己实践中总结的一套开发工具,包括了常用的工具集我已经制作好发布在根文件系统中,目前支持Xilinx zynq,Xilinx zynqmp,NXP t2080的支持在下一步开发计划中,目前支持功能如下,
zc@ubuntu:~/fdk_develope$ fdk -h
Usage: fdk [OPTION...]
Examples:
fdk -t xilinx -p ~/hdf
fdk -t xilinx -p ~/hdf -s ~/mwm
fdk -c kernel menu
fdk -c uboot menu
fdk -b all
fdk -b kernel
fdk -b uboot
fdk -d all
fdk -d kernel
fdk -d uboot
fdk -k boot mini
fdk -k boot normal -g ./mwm.bit
fdk -k rootfs
fdk -k fit
Main operation mode:
-t <target>: project target[xilinx, nxp]
-s <path>: workspace path
-p <path>: hdf path, for target xilinx
-u <component>: update component[fsbl, pmufw, dts]
-c <component> <mode>: config component[uboot, kernel] with mode[init, menu]
-b <component>: build component[all | fsbl, pmufw, atf, uboot, kernel, dtb, dts]
misc[ubootenvtool]
-d <component>: clean component[all | fsbl, pmufw, atf, uboot, kernel]
bsp[bsp]
-k <type> <mode>: packet image with type[boot, rootfs, fit]
boot: packet bootloader for xilinx device with mode[mini, normal]
mini: fsbl and uboot for zynq
fsbl, pmufw, atf, uboot for zynqmp
normal: mode[mini] + FPGA bitstream
rootfs: packet rootfs with mode[all | cpio, ext4]
fit: packet kernel, rootfs and dtb
-g <path>: bit path, when packet boot image in normal mode
-h: show this help
Revision:
fdk is a fast developing kit for embedded linux, target for xilinx[zynq/zynqmp], nxp[t2080]
Time Author Revision
2018-09-17 Zhu Ce Initial release, support xilinx zynqmp with petalinux-v2017.4
2018-10-02 Zhu Ce Add support for xilinx zynq with petalinux-v2017.4