開始入坑,寫個博客記錄一下自己的歷程。
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完事。。