天天看點

荔枝派Zero (V3s) 主線Linux 核心編譯流程與問題解決一、安裝交叉編譯工具二、下載下傳與編譯Linux源碼:三、問題解決

一、安裝交叉編譯工具

網盤位址:http://pan.baidu.com/s/1hsf22fq

官網位址:https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/

wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz
tar xvf gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz
mv gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf /opt/
vim /etc/bash.bashrc
#添加: PATH="$PATH:/opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin"
arm-linux-gnueabihf-gcc -v
           

官網上2017年5月份哪個版本不知道為啥下載下傳不了,索性用這個版本也一樣。

二、下載下傳與編譯Linux源碼:

建議别用指令下載下傳源碼,比較慢,可以在windows上下載下傳ZIP壓縮包,然後拷貝到Ubuntu。我下載下傳的是最新的5.2,支援較為豐富。

git clone https://github.com/Lichee-Pi/linux.git
cd linux
make ARCH=arm licheepi_zero_defconfig
make ARCH=arm menuconfig  
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 INSTALL_MOD_PATH=out modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 INSTALL_MOD_PATH=out modules_install
           

三、問題解決

1、 fatal error: curses.h: No such file or directory

安裝:

sudo apt install ncurses-dev
           

2、/bin/bash: bison: command not found

sudo apt-get install bison
           

3、fatal error: openssl/bio.h: 沒有那個檔案或目錄

sudo apt-get install libssl-dev
           

4、/bin/sh: flex not found

sudo apt-get install flex
           

正常編譯後會彈出核心配置界面,如果沒有特殊要求,就按照預設配置就行,直接退出,進行下一步。

荔枝派Zero (V3s) 主線Linux 核心編譯流程與問題解決一、安裝交叉編譯工具二、下載下傳與編譯Linux源碼:三、問題解決

編譯完成後,zImage在arch/arm/boot/目錄下,驅動子產品在out/目錄下。

繼續閱讀