荔枝派 Zero 编译记录改

荔枝派 Zero 编译记录

 

开发环境选择

	本次实验采用主线Uboot+主线linux进行。
	系统配置为dts设备树配置。
	主线uboot: https://github.com/Lichee-Pi/u-boot
	主线linux: https://github.com/Lichee-Pi/linux
	实验硬件平台为lichee zero + 480×272分辨率显示屏,8G SD卡。
	编译平台为Ubuntu 16.04 LTS。

 

主线Uboot

1.安装交叉编译器

先安装一些必须的软件以及依赖;

sudo apt-get update
sudo apt-get install iputils-ping vim git wget xz-utils bzip2 gcc device-tree-compiler python time make

 

下载交叉编译器

wget https://releases.linaro.org/components/toolchain/binaries/7.1-2017.08/arm-linux-gnueabihf/gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabihf.tar.xz

 

下载完成后解压并将其移动到/opt/目录下

tar xvf gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabihf.tar.xz
mv gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabihf /opt/

 

添加环境变量

vim /etc/bash.bashrc

  在这里插入图片描述

在bash.bashrc的最后一行添加 PATH="$PATH:/opt/gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabihf/bin"
更新一下

source /etc/bash.bashrc

 

查看版本:arm-linux-gnueabihf-gcc -v
在这里插入图片描述
最后安装一下设备树编译器:sudo apt-get install device-tree-compiler

2.下载编译Uboot

从作者的github上获取源代码:git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
下载完成后进入uboot文件夹
设置一下配置文件:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_480x272LCD_defconfig

进入内核配置选项配置一下所需要的东西,第一次编译使用默认的就可以了

make ARCH=arm menuconfig

 

编译内核:time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log

编译完成后可以在uboot目录下看到刚刚生成的u-boot-sunxi-with-spl.bin文件,稍后将其烧录到SD卡的8K偏移处即可。
在这里插入图片描述

3.Uboot配置

Uboot配置命令:  `make ARCH=arm menuconfig`

其余更详细的配置可参考官网教程。

 

主线Kernel

1.安装交叉编译器

下载交叉编译器

wget https://releases.linaro.org/components/toolchain/binaries/7.1-2017.08/arm-linux-gnueabihf/gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabihf.tar.xz 

 

 

 

2.编译Linux源码

从作者的github上获取源码:

git clone https://github.com/Lichee-Pi/linux.git

 

生成默认配置文件

CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make licheepi_zero_defconfig

 

编译内核

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j9

 

在这里插入图片描述
编译设备树

 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs

 

在这里插入图片描述
zImage在arch/arm/boot/下,驱动模块在out/下

根文件系统buildroot

1.下载安装

安装一些依赖apt-get install linux-headers-$(uname -r)
然后下载根文件系统,下载完后解压

wget https://buildroot.org/downloads/buildroot-2017.08.tar.gz
tar xvf buildroot-2017.08.tar.gz

 

2.配置根文件系统

进入到刚下载的根文件系统文件夹里make menuconfig

cd buildroot-2017.08/
make menuconfig

 

Target options
Target Architecture (ARM (little endian))
Target Architecture Variant (cortex-A7)
在这里插入图片描述
Toolchain
 

在这里插入图片描述

 


选择外部工具链
Toolchain Path:/opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/
Toolchain prefix :arm-linux-gnueabihf
External toolchain gcc version (6.x)
External toolchain kernel headers series (4.6.x)
External toolchain C library (glibc/eglibc)

System configuration
在这里插入图片描述
System configuration里面可以设置主机名,root密码等。

默认失能串口登录,需要修改 /etc/inittab :

ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

Target packages
Target packages 里面可以选择一下软件包等等。

其他的选项可以自行学习一下。

3.编译

执行make命令进行编译。
在这里插入图片描述
编译完成后,在output/images/文件夹下的rootfs.tar就是根文件系统。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值