天天看点

荔枝派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/目录下。

继续阅读