虚拟机开发环境搭建

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1.qtcreator工具安装
tar -jxvf apt-qtcreator.tar.bz2
cd apt/archives/
sudo dpkg -i *
在虚拟机即可打开qtcreator

2.android开发环境搭建
1.创建android源代码目录
1.1 mkdir /home/tarena/workdir/android/
1.2 安装bison
1.3 拷贝
cp bison.tar.bz2/home/tarena/workdir/android/
1.4 解压
cd /home/tarena/workdir/android
tar -jxvf bison.tar.bz2
1.5 安装bison
cd bison
dpkg -i *

2.安装jdk
cp jdk-6u35-linux-i586.bin /home/tarena/workdir/android
cd /home/tarena/workdir/android
chmod 777 jdk-6u35-linux-i586.bin
sudo ./jdk-6u35-linux-i586.bin

3.在/etc/profile最后添加如下环境变量内容
sudo vim /etc/profile
export JAVA_HOME=/home/tarena/workdir/android/jdk1.6.0_35
export JRE_HOME=/home/tarena/workdir/android/jdk1.6.0_35/jre
export PATH=/home/tarena/workdir/android/jdk1.6.0_35/bin:$PATH
export CLASSPATH=.:/home/tarena/workdir/android/jdk1.6.0_35/lib:/home/tarena/workdir/android/jdk1.6.0_35/jre/lib

source /etc/profile
4.编译android源代码
4.1解压缩
cp CW210_rootfs.tar.bz2 /home/tarena/workdir/android
cd /home/tarena/workdir/android
tar -jxvf CW210_rootfs.tar.bz2

4.2 编译
source build/envsetup.sh
lunch
选择smdkv210
make -j4

4.3编译错误解决(这些问题大部分都可以在google官方网站有所显示!):
4.3.1 gperf命令没有,提示如下:
sh: 1: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
sh: 1: gperf: not found
calling gperf failed: 32512 at makevalues.pl line 89.

解决方法:
sudo apt-get install gperf 或者dpkg -i gperf_3.0.3-1ubuntu1_i386.deb

4.3.2 没有安装zlib库,提示如下:
external/clearsilver/cgi/cgi.c:22:18: 致命错误: zlib.h:没有那个文件或目录

解决办法:
sudo apt-get install zlib1g-dev 或者dpkg -i zlib1g-dev_1%3a1.2.3.4.dfsg-3ubuntu4_i386.deb

4.3.3 编译选项,提示:
pl::trackMe(bool, bool)’的‘this’实参时丢弃了类型限定 [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIESibutils_intermediates/RefBase.o] 错误 1

解决办法:
vim frameworks/base/libs/utils/Android.mk
将LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
修改为:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

4.3.4 编译器版本问题,提示如下:
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1

解决办法:
vim build/core/combo/HOST_linux-x86.mk
将HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
修改为HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_S

OURCE=0

4.3.5 内存不足,提示如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x4042f9b6, pid=5492, tid=2838862656
#
# JRE version: 6.0_35-b10
# Java VM: Java HotSpot(TM) Client VM (20.10-b01 mixed mode linux-x86 )
# Problematic frame:
# V [libjvm.so+0x2299b6] instanceKlass::oop_follow_contents(oopDesc*)+0x86
#
# An error report file with more information is saved as:
# /home/tarena/workdir/android/CW210_android_2.3_v0.2/hs_err_pid5492.log
#
# If you would like to submit a bug report, please visit:
# /webapps/bugreport/crash.jsp
#
make: *** [out/target/common/obj/APPS/Contacts_intermediates/noproguard.classes-with-local.dex] 已放弃 (core dumped)

解决办法:
重新编译make -j{cpu}个数 ,比如make -j4

5.目标文件
ramdisk(根文件系统):
out/target/product/smdkv210/ramdisk.img

system.img(用户应用程序目录)
out/target/product/smdkv210/system.img

6. uboot
6.1 编译uboot
cp u-boot_CW210_1.3.4_20120628.tar.bz2 /home/tarena/workdir/android/uboot/
cd /home/tarena/workdir/android/uboot/
tar -jxvf u-boot_CW210_1.3.4_20120628.tar.bz2
cd u-boot_CW210_1.3.4

make distclean
make CW210_config
make all

6.2 目标文件 u-boot.bin

7. kernel
7.1 编译内核源码
cp kernel_2.6.35.7_CW210_android.tar.gz /home/tarena/workdir/android/kernel/
cd /home/tarena/workdir/android/kernel/
tar -zxvf kernel_2.6.35.7_CW210_android.tar.gz

8.拷贝adb,fastboot工具到linux系统中:
cd CW210_android_2.3_V0.2 //进入android源代码目录中
sudo cp out/host/linux-x86/bin/adb /usr/bin/
sudo cp out/host/linux-x86/bin/fastboot /usr/bin/

9.测试adb
通过USB,将PC和TPAD连接起来,如果使用虚拟机,会提示安装USB驱动,直接点击安装即可。
然后点击虚拟机右下方的“S5P-OTG-USB”,点击"connect",
然后在linux中断输入:
adb devices //前提是TPAD正常启动android系统
提示:
0123456789ABCDEF device //说明设备已经找到
//如果你的手机也是android手机,也可以连接手机测试!

重启开发板:
adb reboot

具体可以查看adb帮助

6.烧写镜像
6.1 fastboot模式烧写
进入uboot命令行模式,键入fastboot命令,提示出现:
CW210 # fastboot
Fastboot: employ default partition information
[Partition table on NAND]
ptn 0 name='bootloader' start=0x0 len=0x100000(~1024KB)
ptn 1 name='recovery' start=0x100000 len=0x500000(~5120KB)
ptn 2 name='kernel' start=0x600000 len=0x500000(~5120KB)
ptn 3 name='ramdisk' start=0xB00000 len=0x30

0000(~3072KB)
ptn 4 name='system' start=0xE00000 len=0x6E00000(~112640KB) (Yaffs)
ptn 5 name='cache' start=0x7C00000 len=0x5000000(~81920KB) (Yaffs)
ptn 6 name='userdata' start=0xCC00000 len=N/A (Yaffs)

6.2 fastboot烧写
在linux命令行终端执行:

6.2.1 烧写uboot
烧写地址 0 ------- 1M
sudo fastboot flash bootloader u-boot.bin

6.2.2 烧写kernel
地址6M-------5M
sudo fastboot flash kernel zImage

6.2.3 烧写ramdisk
地址11M-------14M
sudo fastboot flash ramdisk ramdisk.img

6.2.4 烧写system.img
地方14M ----124M
sudo fastboot flash system system.img

6.2.5 擦出cache和userdata分区
sudo fastboot erase cache
sudo fastboot erase userdata

相关文档
最新文档