这篇文章描述了使用LeMaker Guitar BSP的方法。LeMaker Guitar BSP的源代码基于炬力的SDK。我们调整了炬力SDK目录结构,修复了其中的一些bug,构建了LeMaker Guitar BSP。它包括了Linux内核(linux-actions),u-boot(u-boot-actions)和owl-action等内容。owl-actions目录包含了针对不同版型的工具软件、脚本和配置文件。
开发环境准备
安装开发需要的库
在编BSP译源代码之前,必须配置一下开发环境,在你的PC机上安装交叉编译工具链和兼容库。
下面的操作步骤在Linux系统下面执行例,如64位的Ubuntu。
Ubuntu12.04LTS 系统
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gcc-4.6-arm-linux-gnueabihf-base g++-4.6-arm-linux-gnueabihf
sudo apt-get install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf \
git wget kpartx fakeroot libncurses5-dev
sudo apt-get install ia32-libs
Ubuntu14.04LTS 系统
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gcc-4.8-arm-linux-gnueabihf-base g++-4.8-arm-linux-gnueabihf
sudo apt-get install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf \
git wget kpartx fakeroot libncurses5-dev
sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6-4.8-dbg
Ubuntu15.04系统
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gcc-4.9-arm-linux-gnueabihf-base g++-4.9-arm-linux-gnueabihf
sudo apt-get install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf \
git wget kpartx fakeroot libncurses5-dev
sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6-4.8-dbg
Linaro Linux工具链
使用Linaro Linux工具链建立开发环境。
cd /opt
wget https://publishing-ap-linaro-org.s3.amazonaws.com/releases/components/toolchain/gcc-linaro/6.2-2016.11/gcc-linaro-6.2-2016.11.tar.xz
tar -xvf gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf.tar.xz
注意:这个Linaro Linux工具链仅支持X86_64(64bit)。
编辑/etc/bash.bashrc,并添加以下内容:
if [ -d /opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf ]; then
PATH=/opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin:":${PATH}"
fi
最后,使用下面的命令更新系统环境变量:
source /etc/bash.bashrc
使用Linux-actions-bsp
下载Linux-actions-bsp
git clone https://github.com/LeMaker/linux-actions-bsp.git
Cloning into 'linux-actions-bsp'...
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 17 (delta 2), reused 12 (delta 0), pack-reused 0
Unpacking objects: 100% (17/17), done.
配置板型
cd linux-actions-bsp/
./configure
Submodule 'linux-actions' (https://github.com/LeMaker/linux-actions.git) registered for path 'linux-actions'
Submodule 'owl-actions' (https://github.com/LeMaker/owl-actions.git) registered for path 'owl-actions'
Submodule 'u-boot-actions' (https://github.com/LeMaker/u-boot-actions.git) registered for path 'u-boot-actions'
Cloning into 'owl-actions'...
remote: Counting objects: 35, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 35 (delta 8), reused 35 (delta 8), pack-reused 0
Unpacking objects: 100% (35/35), done.
Submodule path 'owl-actions': checked out ************************************************
Select board type:
1. lemaker_guitar_bba
2. lemaker_guitar_bbb
3. lemaker_guitar_bbb_plus
4. lemaker_guitar_bbc
5. lemaker_guitar_bbd
Which would you like? [lemaker_guitar_bba] 2
s500 lemaker_guitar_bbb configured. Now run `make`
NOTE:
<1> You'd better run 'make update' before compilation, this will update all subproject.
<2> If you need to compile another board type, run 'make clean' first, and then use './configure' to choose board type.
lemaker_guitar_bba是LeMaker Guitar 底板A型;
lemaker_guitar_bbb是LeMaker Guitar 底板B型;
lemaker_guitar_bbb_plus是LeMaker Guitar 底板B Plus型;
lemaker_guitar_bbc是LeMaker Guitar 底板C型;
lemaker_guitar_bbd是LeMaker Guitar 底板D型。
编译Linux kernel和u-boot
make hwpack
执行“make help”查看所有的编译选项。
make help
Usage:
Optional targets:
make hwpack - Builds platform firmware package
make linux - Builds linux kernel
make linux-clean - Clean linux kernel
make linux-config - Menuconfig
make uboot - Builds u-boot
make uboot-config - Menuconfig
make uboot-clean - Clean uboot
make linux-mrproper
make uboot-mrproper
make update - sync all subproject
make clean - Clean all object files
你可使用“ls”命令查看顶层目录
linux-actions:包含了Linux内核源代码;
u-boot-actions:包含了uboot源代码;
owl-actions:包含了一些工具,脚本和不同板型的配置文件
获取Linux平台固件包
完成编译BSP后,会生成Linux平台固件包,命名为“xxx.hwpack.tar.xz”,这个Linux平台固件包被存放在output目录下面。
你可以利用这个Linux平台固件包制作Linux系统镜像。 更多内容请访问:http://wiki.lemaker.org/LeMaker_Guitar:How_to_make_LeMaker_Guitar_OS_image/zh-hans