iTOP-4412开发板Android操作系统源码编译过程全纪录
各位朋友大家好,首先在这里感谢迅为道长的支持,帮助和鼓励!
感谢广东海洋大学朋友的无私奉献和指导!
2016年,年初,经过各位大侠的热情指导和帮助,现在我使用讯为iTOP4412开发板,终于顺利生成如下四个文件:
1. system.img 210040 KB
2. ramdisk-uboot.img 901 KB
3. u-boot-iTOP-4412.bin 515 KB
4. zImage 3907 KB
并且通过fastboot模式,将四个文件成功烧写下载到开发板,现在开发板的Android系统,正常运行。
==============================================================================================================
其实我在编译这四个文件的时候,遇到了两个障碍:
==============================================================================================================
第一个障碍是:我的笔记本电脑内存比较小,刚开始的时候,我只分配了1G内存给虚拟机,因此出现了如下的错误消息:
host C++: libLLVMSelectionDAG <= external/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
host C++: libLLVMSelectionDAG <= external/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
host C++: libLLVMSelectionDAG <= external/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
host C++: libLLVMSelectionDAG <= external/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMX86CodeGen_intermediates/X86ISelLowering.o] Killed
make: *** Waiting for unfinished jobs....
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSelectionDAG_intermediates/SelectionDAG.o] Killed
./build_android.sh: line 40: 27960 Killed make -j$CPU_JOB_NUM PRODUCT-full_$SEC_PRODUCT-eng
root@ubuntu:/home/guetsun/Android/iTop4412_ICS#
==============================================================================================================
解决方案是:
分配给虚拟机4G内存RAM,并且我在这里强烈建议,虚拟机的初始硬盘空间最好给60G以上
如果您的电脑内存实在是太小的话,可以使用SWAP命令去实现虚拟内存,实现的方法如下:
1.创建一个swap文件(大约需要10分钟)
sudo dd if=/dev/zero of=/boot/swapfile bs=1024 count=4194304
2.格式化文件,使其成为swap(交换设备)
sudo mkswap -v1 /boot/swapfile
3.将swap加入到现有系统中
sudo swapon /boot/swapfile
4.执行free命令
free
5.做永久性变更
sudo vi /etc/fstab
使用vi编辑器,打开fstab文件之后,在文件的末尾加上如下一行
/boot/swapfile swap swap defaults 1 1
随后,第一个障碍得到了顺利解决!
但是我又遇到了第二个障碍!
==============================================================================================================
Copying: out/target/common/obj/APPS/android.core.tests.libcore.package.dalvik.no-core-tests-res_intermediates/noproguard.classes.dex
target Package: android.core.tests.libcore.package.dalvik.no-core-tests-res (out/target/product/smdk4x12/obj/APPS/android.core.tests.libcore.package.dalvik.no-core-tests-res_intermediates/package.apk)
'out/target/common/obj/APPS/android.core.tests.libcore.package.dalvik.no-core-tests-res_intermediates/classes.dex' as 'classes.dex'...
Add resources to package (out/target/product/smdk4x12/obj/APPS/android.core.tests.libcore.package.dalvik_intermediates/package.apk)
# javalib.jar should only contain .dex files, but the harmony tests also include
# some .class files, so get rid of them
Total compile time is 7641 seconds
[[[[[[[ Make ramdisk image for u-boot ]]]]]]]
./build_android.sh: line 71: mkimage: command not found
==============================================================================================================
问题的根本原因是:
./build_android.sh: line 71: mkimage: command not found
==============================================================================================================
解决方案是:
1. 将 iTop4412_uboot_scp_20141224.tar
iTop4412_Kernel_3.0_20150403.tar
iTop4412_ICS_20150413.tar
解压出来的三个文件夹,放在同一个目录下
2. 将 uboot/tools/目录里面的 mkimage.c 和 mkimage.h 复制到 /usr/bin/ 目录下
3. 执行apt-get install uboot-mkimage 命令
最后,使用讯为iTOP4412开发板,终于顺利生成如下四个文件:
1. system.img 210040 KB
2. ramdisk-uboot.img 901 KB
3. u-boot-iTOP-4412.bin 515 KB
4. zImage 3907 KB
并且通过fastboot模式,将四个文件成功烧写下载到开发板,现在开发板的Android系统,正常运行。