开始入坑,写个博客记录一下自己的历程。
1.开始我看荔枝派官方指南,看了一下发现很蛋疼的问题:网址是:https://www.kancloud.cn/lichee/lichee/227741 前面没问题
第一步:克隆一下文件
mkdir licheepi
cd licheepi
git clone https://github.com/linux-sunxi/linux-sunxi.git git clone https://github.com/linux-sunxi/u-boot-sunxi.git git clone https://github.com/linux-sunxi/sunxi-tools.git
第二步:开始安装依赖
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev \ lib32ncurses5-dev gcc-multilib x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev \ g++-multilib mingw32 tofrodos python-markdown libxml2-utils sudo apt-get install gcc-arm-linux-gnueabihf
这里mingw32安装不了,要修改源
sudo gedit /etc/apt/sources.list deb http://us.archive.ubuntu.com/ubuntu trusty main universe //在sources.list末尾添加,保存 sudo apt-get update sudo apt-get install mingw32
可以写一个c文件 用g++编译运行一下,没问题就安装成功。
第三步:再到本教程所在github工程下的Config_Files里下载荔枝板的配置文件A13-Lichee_defconfig,sun5i-a13-lichee.dts。网址:https://github.com/Lichee-Pi
但是我发现了一个非常蛋疼的问题,我找了半天找不到这个文件。这就很蛋疼了。所以我又找了一篇教程:https://debugdump.com/t_561.html 他是直接克隆lichee pi下的u-boot工程。所以我就重新git一下
git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
-b的意思就是克隆的同时在该文件夹创建一个新的分支,名叫v3s-current,这个名字反正自己随便可以更改。
修改u-boot/include/configs/sun8i.h文件 加入:
#define CONFIG_BOOTCOMMAND "setenv bootm_boot_mode sec; " \ "load mmc 0:1 0x41000000 zImage; " \ "load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb; " \ "bootz 0x41000000 - 0x41800000;" #define CONFIG_BOOTARGS "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw vt.global_cursor_default=0"
这里应该是修改 bootload的串口波特率还有一些堆栈的位置。 接着进入u-boot
cd u-boot ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LicheePi_Zero_800x480LCD_defconfig (群主网店5寸屏) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LicheePi_Zero_480x272LCD_defconfig (通用4.3寸屏) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LicheePi_Zero_defconfig (默认) ARCH=arm make menuconfig 执行编译: ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make 多核编译,避免cpu其他内核打酱油, J后的参数是参与编译的cpu个数: ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -J3
这里编译失败,提示我
./scripts/dtc-version.sh: line 17: dtc: command not found
./scripts/dtc-version.sh: line 18: dtc: command not found
* Your dtc is too old, please upgrade to dtc 1.4 or newer
make: * [checkdtc] Error 1
要更新软件:
apt-get install device-tree-compiler
然后再编译一次
提示
COPY u-boot.bin MKIMAGE u-boot.img COPY u-boot.dtb BINMAN u-boot-sunxi-with-spl.bin OBJCOPY u-boot.srec SYM u-boot.sym MKIMAGE u-boot-dtb.img ./scripts/check-config.sh u-boot.cfg \ ./scripts/config_whitelist.txt . 1>&2
img已经被制作出来了,应该是成功了。
获取设备树:
git clone https://github.com/Lichee-Pi/linux.git -b zero-4.13.y //获取Linux源码(zero-4.13.y分支对网卡支持比较好) cd linux //进入到该目录 make ARCH=arm licheepi_zero_defconfig //生成荔枝派Zero 默认配置文件 arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts //设备树文件(默认不需要修改) make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 //编译内核 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs //编译设备树
4. 根文件系统
1). 下载最新的buildroot稳定版本
官方网站: https://buildroot.org/download.html
长支持版本:buildroot-2017.02.7.tar.gz
最新稳定版:buildroot-2017.08.1.tar.gz
2). 配置buildroot 参数, make menuconfig; make
算了这篇我不想写了,直接参考https://debugdump.com/t_561.html完事。。