Ubuntu 12.04 64位编译cm-10.2 总结
参考:http://wiki.cyanogenmod.org/w/Build_for_i9300
安装相关库。如git, open sdk, python等;
安装android sdk,需要连接手机获取一些文件,而且手机必需刷cm-10.2的rom.
http://developer.android.com/sdk/index.html
?
安装android sdk 解压android sdk后修改
sudo gedit /etc/hosts/
74.125.237.1 dl-ssl.google.com
执行tool/android update sdk更新后就有platform-tools目录和adb了,执行adb devices查看设备是否已经连接, 下一个cm的rom刷入http://get.cm/?device=i9300 版本和你编译版本一致。
?
1. 不要使用Ubuntu 12.04 32位,太吭了,搞了大半月没有搞定,无耐换装64位系统,1天搞定了。
注意32位下载的代码不要全删掉,把.repo目录压缩一下,大概9G左右,放到windows分区去。再装64位系统,
64位系统安装好后,新建一个目录如cm-10.2, 执行
附件提供了repo, 可以googlecode下载repo 1.19的版本。
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
repo sync
ctrl+x 停掉repo sync, 再把原来备份的.repo/project目录覆盖到cm-10.2/.repo/project目录,这样基本就不用再下以前的代码了,会30分钟左右就下完代码,应该不是下完,repo好像是从.repo/project目录复制到外边cm-10.2目录下,坑人么,搞两份代码。
?
2. Ubuntu12.04基本上要留50个磁盘空间,分区大概如下:
???? /swap???? 交换分区2G(和你的内存大小一样)、
??? /?????????????? 根分区安装系统 大概留8G左右,最小5G,不过还是留大点好防止系统分区太小
??? /home???? home分区,剩下全留全home分区,主要为编译,我剩下的就45G左右
我的分区情况, 代码同步完成后:
Filesystem Size Used Avail Use% Mounted on/dev/sda9 7.4G 4.4G 2.7G 63% /udev 993M 4.0K 993M 1% /devtmpfs 401M 916K 400M 1% /runnone 5.0M 0 5.0M 0% /run/locknone 1002M 156K 1002M 1% /run/shm/dev/sda10 45G 21G 22G 48% /home
?编译完成后:
wv@wv-ThinkPad-SL:~$ df -hFilesystem Size Used Avail Use% Mounted on/dev/sda9 7.4G 4.4G 2.7G 63% /udev 993M 4.0K 993M 1% /devtmpfs 401M 908K 400M 1% /runnone 5.0M 0 5.0M 0% /run/locknone 1002M 156K 1002M 1% /run/shm/dev/sda10 45G 36G 6.5G 85% /homewv@wv-ThinkPad-SL:~$
?
?
3. 编译过程中:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
repo sync
cd cm-10.2/vendor/cm
./get-prebuilts //(这一步是为了下载Term.apk并解压到当前propritary目录) (只需执行一次,以后编译无需执行)
cd ../..
source build/envsetup.sh
breakfast i9300
//(这一步会自动从github下载?? 三星I897[代号captivatemtd]设备的驱动和内核; 注意 必须是CM官方支持升级到cm10.1的设备才能使用这个命令下载到//内核和驱动!!!) (只需执行一次,以后编译无需执行)
?
这步会报错, 因为找不到device i9300
直接到
https://github.com/CyanogenMod/android_device_samsung_i9300
https://github.com/CyanogenMod/android_device_samsung_smdk4412-common
下载后解压到 cm-10.2/device/samsung/i9300和cm-10.2/device/samsung/smdk4412-common
其它设备可以参考
https://github.com/CyanogenMod/android_device_samsung_设备名 从github上下载。
手机上刷9300? cm10.2的rom 并连接上手机,之前要安装androis sdk,
?
cd cm-10.2/device/samsung/i9300chmod a+x extract-files.sh
./extract-files.sh ?? // (这条命令实际上都是组织好的的adb pull,它将真机中的部分库和依赖文件拷贝到本地源码环境,辅助编译!因为部分库和依赖文件的源码我们无法获取,
//相关厂商只提供了这些编译好的东东!这一部很重要,如果跳过,即时编译ROM成功,刷机后手机也跑不起来的!) (只需执行一次,以后编译无需执行)
说明: 如果你不想预先把手机刷成CM10.1,可以以文本打开extract-files.sh,就看到里面其实都是拷贝文件的操作。那么你解压从官方获取的cm10.1的rom压缩包,逐个拷贝相应文件到源码环境相应目录,并编辑相应目录的mk文件,加入 "PRODCUT_COPY_FILES + =..." 这样的语句也是可以的,但是很麻烦!
?
croot
brunch i9300
开始真正的编译,编译过程中没有出现任何问题,大概4个小时左右编译完成。
?
mon.Partition object at 0x29f2710>}fstab_version = (int) 2mkbootimg_args = (str) mkyaffs2_extra_flags = (str) -c 4096 -s 128recovery_api_version = (int) 2recovery_size = (int) 8388608selinux_fc = (str) /tmp/targetfiles-corf9Q/BOOT/RAMDISK/file_contextssystem_size = (int) 1610612736tool_extensions = (str) device/samsung/i9300/../commonuserdata_size = (int) 12381585408using device-specific extensions in device/samsung/commonunable to load device-specific module; assuming nonebuilding image from target_files BOOT... running: mkbootfs -f /tmp/targetfiles-corf9Q/META/boot_filesystem_config.txt /tmp/targetfiles-corf9Q/BOOT/RAMDISK running: minigzip running: mkbootimg --kernel /tmp/targetfiles-corf9Q/BOOT/kernel --cmdline console=ttySAC2,115200 --base 0x40000000 --pagesize 2048 --ramdisk /tmp/tmpktqmNH --output /tmp/tmp33v1T7 running: openssl pkcs8 -in build/target/product/security/testkey.pk8 -inform DER -nocrypt running: java -Xmx2048m -jar /home/wv/source/android/cm-10.2/out/host/linux-x86/framework/signapk.jar -w build/target/product/security/testkey.x509.pem build/target/product/security/testkey.pk8 /tmp/tmpdhEqjX /home/wv/source/android/cm-10.2/out/target/product/i9300/cm_i9300-ota-eng.wv.zipdone.Package Complete: /home/wv/source/android/cm-10.2/out/target/product/i9300/cm-10.2-20130921-UNOFFICIAL-i9300.zipwv@wv-ThinkPad-SL:~/source/android/cm-10.2$?
?
可以看到编译后包!
cm-10.2/out/target/product/i9300/cm-10.2-20130921-UNOFFICIAL-i9300.zip
?
?
参考:
http://www.cnblogs.com/tomsen/archive/2013/06/04/3115460.html
http://wiki.cyanogenmod.org/w/Build_for_i9300
?
?*****************************************************************************************
Other:
?https://gerrit.googlesource.com/git-repo/clone.bundle
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo ~/bin/repo
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
sudo ~/bin/repo init -u https://github.com/CyanogenMod/android.git -b cm-10.2
~/ext-3/android/bin/repo sync -fj16
?
http://www.360doc.com/content/10/0221/10/155970_16310464.shtml
?
?
make:进入目录'/home/wv/android/cm-10.2'
make: *** 没有规则可以创建“out/target/product/generic/obj/EXECUTABLES/netd_intermediates/LINKED/netd”需要的目标“out/target/product/generic/obj/lib/crtbegin_dynamic.o”。 停止。
make:离开目录“/home/wv/android/cm-10.2”
?