上面是我的微信和QQ群,欢迎新朋友的加入。
原文链接:http://wiki.friendlyarm.com/wiki/index.php/Building_U-boot_and_Linux_for_H5/H3/H2%2B/zh
使用全志原厂BSP
准备工作
访问此处下载地址的sources/nanopi-h3-bsp目录,下载所有压缩文件,使用7-Zip工具解压后得到lichee目录和android目录,请务必保证这2个目录位于同一个目录中,如下:
$ ls ./
android lichee
也可以从github上克隆lichee源码:
$ git clone https://github.com/friendlyarm/h3_lichee.git lichee
注:lichee是全志为其CPU的板级支持包所起的项目名称,里面包含了U-boot,Linux等源码和众多的编译脚本。
7.2.2 安装交叉编译器
访问此处下载地址的toolchain目录,下载交叉编译器gcc-linaro-arm.tar.xz,将该压缩包放置在lichee/brandy/toochain/目录下即可,无需解压。
7.2.3 编译lichee源码
编译全志 H3 的BSP源码包必须使用64bit的Linux PC系统,并安装下列软件包,下列操作均基于Ubuntu-14.04 LTS-64bit:
$ sudo apt-get install gawk git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
编译lichee源码包,执行命令:
$ cd lichee/fa_tools
$ ./build.sh -b nanopi-neo -p linux -t all
该命令会一次性编译好U-boot、Linux内核和模块。
lichee目录里内置了交叉编译器,当进行源码编译时,会自动使用该内置的编译器,所以无需手动安装编译器。
下列命令可以更新TF卡上的U-boot:
$ cd lichee/fa_tools/
$ ./fuse.sh -d /dev/sdX -p linux -t u-boot
/dev/sdX请替换为实际的TF卡设备文件名。
内核boot.img和驱动模块均位于linux-3.4/output目录下,将boot.img拷贝到TF卡的boot分区的根目录即可更新内核。
7.2.4 编译U-boot
注意: 必须先完整地编译整个lichee目录后,才能进行单独编译U-boot的操作。 如果你想单独编译U-boot,可以执行命令:
$ cd lichee/fa_tools/
$ ./build.sh -b nanopi-neo -p linux -t u-boot
下列命令可以更新TF卡上的U-boot:
$ cd lichee/fa_tools/
$ ./fuse.sh -d /dev/sdX -p linux -t u-boot
/dev/sdX请替换为实际的TF卡设备文件名。
7.2.5 编译Linux内核
注意: 必须先完整地编译整个lichee目录后,才能进行单独编译Linux内核的操作。 如果你想单独编译Linux内核,可以执行命令:
$ cd lichee/fa_tools/
$ ./build.sh -b nanopi-neo -p linux -t kernel
编译完成后内核boot.img和驱动模块均位于linux-3.4/output目录下,将boot.img拷贝到TF卡的boot分区的根目录即可。
7.2.6 清理lichee源码
$ cd lichee/fa_tools/
$ ./build.sh -b nanopi-neo -p linux -t clean