這篇文章描述了使用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