A33环境搭建编译手册
目录
Ubuntu安装 4
制作Ubuntu的USB启动盘 4
安装Ubuntu 6
配置ssh 15
配置vim 15
开启Ubuntu图形界面的root权限 16
配置WINDOWS可用XRDP远程桌面 17
搭建安卓编译开发环境 18
JAVA库下载、安装与配置 19
编译器下载、安装与配置 19
Uboot镜像制作工具下载安装 20
安装编译环境需要的库 20
编译指南 21
编译内核 21
编译lichee 22
编译brandy 23
编译android 24
Android打包 25
登陆http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/,下载USB启动盘制作工具
找到DOWNLOAD UUI,下载
下载后,插入U盘运行(Universal-USB-Installer-1.9.5.9.exe 目前在技术部服务器有提供)
同意协议,下一步
如下图设置,
Step1:选着Linux发行版
Step2:选择ubuntu镜像所在的路径
Step3:选择插入的U盘
Step4:默认选项
确认
制作完成
插入制作好的U盘到电脑,重启,按F12(根据实际情况)进入启动选项菜单,选择从U盘启动。
直至进入Ubuntu试用系统,双击Install Ubuntu图标开始安装,如下图
选择中文
勾选下载更新,勾选安装第三方软件
询问安装类型,建议使用其他选项,可以更好的进行自定义
选择要安装的硬盘进行分区,这里安排是:
500G大小的硬盘
分区 |
挂载点 |
容量 |
第一个分区 |
/ (根分区) |
30G |
第二个分区 |
SWAP |
4G |
第三个分区 |
/opt |
466G(即剩余的容量) |
这么处理,考虑到以后开发相关的都放在opt上,如需重装、升级操作系统,无需破坏开发的资料
操作如下,点击选择目标硬盘的空闲空间,点击添加
如下图设置第一个分区
重复上一步,再添加第二个分区
重复上一步,再添加第三个分区
选择安装启动引导器的设备为硬盘的引导区,点击现在安装
接下来设置时区
设置键盘布局
设置账户信息和计算机信息
等待安装完成
直至提示安装完成,点击重启
重启之后进入系统,弹出更新管理器,选择不升级为14.04,选择安装更新
更新完重启系统
Ctrl+Alt+T打开终端
自动下载配置ssh
sudo apt-get install ssh
在Windows下使用PuTTY即可使用SSH远程登录
vm是vi的升级版本
自动下载配置vim
sudo apt-get install vim
快捷键打开终端
Ctrl+Alt+T
获取root权限
输入sudo -s 输入普通用户登陆的密码,回车获得root权限
修改配置文件/etc/lightdm/lightdm.conf
试用vim打开或者试用gedit打开
vim /etc/lightdm/lightdm.conf
或:
gdit /etc/lightdm/lightdm.conf
编辑后文档内容如下(添加下面加底纹内容):
[SeatDefaults]
greeter-session=unity-greeter
user-session=Ubuntu
greeter-show-manual-login=true
allow-guest=false
设置root用户密码
sudo passwd root
重启后选择登陆root登陆帐号
注:下文开始,如无特殊说明都是在root用户下进行操作
打开终端,自动配置安装xrdp和vnc
apt-get install xrdp vnc4server tightvncserver
打开要远程登录用户的home目录,root用户即/root
cd ~
创建.xsession文件
echo "gnome-session --session=ubuntu-2d" > .xsession
重启xrdp
/etc/init.d/xrdp restart
在Windows下使用远程桌面连接(请根据实际情况输入ip)
输入账号密码
即可登录
登陆:http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
下载jdk-6u45-linux-x64.bin (技术部服务器上有保存)
需要注意的是,现在官方网站上最新的版本的JDK7, 但是这个这个版本是不能用于Android的编译的,一定要去下载JDK6
下载后,修改权限
chmod 777 jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
安装后产生jdk1.6.0_45目录,把它拷贝到/opt/lib/jvm/jdk6/下面
设置环境变量
vim /etc/environment
添加上底纹部分内容
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lib/jvm/jdk6/jdk1.6.0_45/bin:/opt/lib/jvm/jdk6/jdk1.6.0_45/jre/bin"
JAVA_HOME=/opt/lib/jvm/jdk6/jdk1.6.0_45
CLASSPATH=/opt/lib/jvm/jdk6/jdk1.6.0_45/lib
Source环境变量
source /etc/environment
查看JAVA版本验证安装,若能看到版本信息则一般安装完成
java -version
版本信息如下
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
apt-get install uboot-mkimage
apt-get install 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-lts-trusty:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
编译器下载、替换4.4版本
apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib
mv -f /usr/bin/gcc /usr/bin/bak_gcc
mv -f /usr/bin/g++ /usr/bin/bak_g++
ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
ln -s /usr/bin/g++-4.4 /usr/bin/g++
测试一下gcc版本号
gcc -v
版本信息如下
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.7-1ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-1ubuntu2)
编译指南
创建项目文件夹
mkdir /opt/item_A33
解压lichee.tar.gz压缩包
tar -zxvf lichee.tar.gz -C /opt/item_A33/
解压android.tar.gz压缩包
tar -zxvf android.tar.gz -C /opt/item_A33/
进入lichee目录
cd /opt/item_A33/lichee
source buildroot/scripts/mksetup.sh
出现以下设置选项,请依照设置
Welcome to mkscript setup progress
All available chips:
0. sun8iw5p1
Choice: 0
All available platforms:
0. android
1. dragonboard
2. linux
Choice: 0
All available kernel:
0. linux-3.4
Choice: 0
All available boards:
0. evb
1. maple
2. redwood
3. y2
4. y3
Choice: 4
mklichee
编译过程
INFO: ----------------------------------------
INFO: build lichee ...
INFO: chip: sun8iw5p1
INFO: platform: android
INFO: kernel: linux-3.4
INFO: board: y3
INFO: output: out/sun8iw5p1/android/y3
INFO: ----------------------------------------
INFO: build buildroot ...
external toolchain has been installed
INFO: build buildroot OK.
INFO: build kernel ...
INFO: prepare toolchain ...
Building kernel
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h”是最新的。
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm/mach-sunxi/pm/standby/common.o
省略大部分编译过程...
make: Leaving directory `/opt/item_A33/lichee/linux-3.4/modules/mali'
regenerate rootfs cpio
8772 blocks
9475 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...
INFO: build kernel OK.
INFO: build rootfs ...
INFO: skip make rootfs for android
INFO: build rootfs OK.
INFO: ----------------------------------------
INFO: build lichee OK.
INFO: ----------------------------------------
(至此编译成功)
单独编译buildroot
mkbr
编译过程
INFO: build buildroot ...
external toolchain has been installed
INFO: build buildroot OK.
单独编译内核
mkkernel
编译过程
INFO: build kernel ...
INFO: prepare toolchain ...
Building kernel
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h”是最新的。
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm/mach-sunxi/pm/standby/common.o
CC arch/arm/mach-sunxi/pm/standby/standby_clock.o
CC arch/arm/mach-sunxi/pm/standby/standby_ir.o
CC arch/arm/mach-sunxi/pm/standby/standby_key.o
CC arch/arm/mach-sunxi/pm/standby/standby_power.o
CC arch/arm/mach-sunxi/pm/standby/standby_twi.o
CC arch/arm/mach-sunxi/pm/standby/standby_usb.o
AS arch/arm/mach-sunxi/pm/standby/standby_delay.o
CC arch/arm/mach-sunxi/pm/standby/./arisc/standby_arisc.o
CC arch/arm/mach-sunxi/pm/standby/./arisc/arisc_hwmsgbox.o
(省略编译过程.,.)
make: Leaving directory `/opt/item_A33/lichee/linux-3.4/modules/mali'
regenerate rootfs cpio
8772 blocks
9475 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...
INFO: build kernel OK.
(至此,内核编译完成)
Bandy目录中存放的是A33平台的bootloader,该目录为A33启动代码,默认不编译。
编译u-boot
cd lichee/brandy/u-boot-2011.09/
make distclean
make sun8iw5p1_config
make -j2
当编译成功,生成的u-boot-sun8iw5pl.bin文件会自动拷贝到对应的tool目录下,这时候可以直接打包或者其他操作。U-boot-sun8iw5pl.bin启动时是uboot核心可执行程序。
"u-boot-sun8iw5p1.bin" -> "/opt/item_A33/lichee/brandy/u-boot-2011.09/../../tools/pack/chips/sun8iw5p1/bin/u-boot-sun8iw5p1.bin"
编译android前请先编译内核
选择方案
souece build/envsetup.sh
lunch
出现以下设置选项,请依照设置
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_x86-eng
3. aosp_mips-eng
4. vbox_x86-eng
5. aosp_manta-userdebug
6. aosp_deb-userdebug
7. aosp_flo-userdebug
8. aosp_grouper-userdebug
9. aosp_tilapia-userdebug
10. mini_armv7a_neon-userdebug
11. mini_x86-userdebug
12. mini_mips-userdebug
13. aosp_mako-userdebug
14. aosp_hammerhead-userdebug
15. astar_y3-eng
16. astar_y3-user
Which would you like? [aosp_arm-eng] 15
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=astar_y3
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-46-generic-x86_64-with-Ubuntu-12.04-precise
HOST_BUILD_TYPE=release
BUILD_ID=KVT49L
OUT_DIR=out
============================================
拷贝kenrel和modules
extract-bsp
编译android
make -j?
(?表示启用几个进程编译,一般不要超过cpu的核数)
最后显示信息
Install system fs image: out/target/product/astar-y3/system.img
out/target/product/astar-y3/system.img+out/target/product/astar-y3/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=822163584 blocksize=4224 total=591028141 reserve=8308608
cd到android根目录用pack打包
pack
显示以下信息
copying tools file
copying configs file
copying boot resource
copying boot file
packing for android
normal
/opt/item_A33/lichee/tools/pack/pctools/linux/eDragonEx/
/opt/item_A33/lichee/tools/pack/out
Begin Parse sys_partion.fex
Add partion boot-resource.fex BOOT-RESOURCE_FEX
Add partion very boot-resource.fex BOOT-RESOURCE_FEX
FilePath: boot-resource.fex
FileLength=4bec00Add partion env.fex ENV_FEX000000000
Add partion very env.fex ENV_FEX000000000
FilePath: env.fex
FileLength=20000Add partion boot.fex BOOT_FEX00000000
Add partion very boot.fex BOOT_FEX00000000
FilePath: boot.fex
FileLength=afa000Add partion system.fex SYSTEM_FEX000000
Add partion very system.fex SYSTEM_FEX000000
FilePath: system.fex
FileLength=23175bdcAdd partion recovery.fex RECOVERY_FEX0000
Add partion very recovery.fex RECOVERY_FEX0000
FilePath: recovery.fex
FileLength=db2000Add partion diskfs.fex DISKFS_FEX000000
Add partion very diskfs.fex DISKFS_FEX000000
FilePath: diskfs.fex
FileLength=200sys_config.fex Len: 0xf397
config.fex Len: 0x9ac4
split_xxxx.fex Len: 0x200
sys_partition.fex Len: 0xf0a
boot0_nand.fex Len: 0x8000
boot0_sdcard.fex Len: 0x8000
u-boot.fex Len: 0xbc000
fes1.fex Len: 0x1f60
usbtool.fex Len: 0x20600
aultools.fex Len: 0x25d92
aultls32.fex Len: 0x2295a
cardtool.fex Len: 0x14000
cardscript.fex Len: 0x6ea
sunxi_mbr.fex Len: 0x10000
dlinfo.fex Len: 0x4000
arisc.fex Len: 0x2bee9
boot-resource.fex Len: 0x4bec00
Vboot-resource.fex Len: 0x4
env.fex Len: 0x20000
Venv.fex Len: 0x4
boot.fex Len: 0xafa000
Vboot.fex Len: 0x4
system.fex Len: 0x23175bdc
Vsystem.fex Len: 0x4
recovery.fex Len: 0xdb2000
Vrecovery.fex Len: 0x4
diskfs.fex Len: 0x200
Vdiskfs.fex Len: 0x4
BuildImg 0
Dragon execute image.cfg SUCCESS !
----------image is at----------
/opt/item_A33/lichee/tools/pack/sun8iw5p1_android_y3.img
pack finish