设为首页 收藏本站
查看: 1037|回复: 0

[经验分享] Android 2.3 GingerBread for VirtualBox x86编译指南

[复制链接]

尚未签到

发表于 2015-4-15 08:52:06 | 显示全部楼层 |阅读模式
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://carltao.blog.iyunv.com/856514/479777

时间有限,格式未调整,见谅。
编译的问题主要参考
http://hi.baidu.com/kellyvivian/blog/item/96eb45d45997fc9da1ec9c1c.html
谢谢原作者。




展开源码,用AOSP的bionic目录替换(gingerbread)的bionic
删除bootable/diskinstaller,拷贝froyo-x86的newinstaller到bootable目录下;拷贝gingerbread的bootable/diskinstaller/libdiskconfig目录到bootable/newinstaller目录下
修改build/core/Makefile,注释掉bootable/diskinstaller/config.mk的引用
链接froyo-x86的kernel;cd /work/gb; ln -sf /work/x86/kernel/ .
将x86/build/core/kernel.mk拷贝过来,并include在build/core/Makefile中

$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
        $(call pretty,”Target boot image: $@”)
        $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) –output $@
        $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
endif # TARGET_BOOTIMAGE_USE_EXT2

include $(BUILD_SYSTEM)/kernel.mk

else    # TARGET_NO_KERNEL
# HACK: The top-level targets depend on the bootimage.  Not all targets
# can produce a bootimage, though, and emulator targets need the ramdisk
# instead.  Fake it out by calling the ramdisk the bootimage.
# TODO: make the emulator use bootimages, and make mkbootimg accept
#       kernel-less inputs.
INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
endif

将froyo_x86的device/vm拷贝到device目录下,在AndroidBoard.mk中注释掉TARGET_PREBUILT_APPS
将build/core/target/board/generic_x86下面的buildspec*拷贝到根目录的buildspec.mk并修改BUILD_ENV_SEQUENCE_NUMBER为10
编译环境设置(每次编译前不要忘记lunch vm-eng以防止编译错误目标)
carl@carl-amd64:/work/gb$ . build/envsetup.sh
including device/htc/passion/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including device/vm/vm/vendorsetup.sh
carl@carl-amd64:/work/gb$ lunch vm-eng

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.1
TARGET_PRODUCT=vm
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GINGERBREAD
============================================

将下面两行加入build/target/product/generic_x86.mk末尾
GENERIC_X86_CONFIG_MK := $(SRC_TARGET_DIR)/board/generic_x86/BoardConfig.mk
GENERIC_X86_ANDROID_MK := $(SRC_TARGET_DIR)/board/generic_x86/AndroidBoard.mk

开始编译内核
carl@carl-amd64:/work/gb$ m -j3 kernel


消除LOCAL_MODULE_TAGS的问题(external/grub),设置LOCAL_MODULE_TAGS := optional
build/core/base_rules.mk:74: *** Module name: grub_stage1
build/core/base_rules.mk:75: *** Makefile location: external/grub
build/core/base_rules.mk:76: *
build/core/base_rules.mk:77: * Each module must use a LOCAL_MODULE_TAGS in its
build/core/base_rules.mk:78: * Android.mk. Possible tags declared by a module:
build/core/base_rules.mk:79: *
build/core/base_rules.mk:80: *     optional, debug, eng, tests, samples
build/core/base_rules.mk:81: *
build/core/base_rules.mk:82: * If the module is expected to be in all builds
build/core/base_rules.mk:83: * of a product, then it should use the
build/core/base_rules.mk:84: * “optional” tag:
build/core/base_rules.mk:85: *
build/core/base_rules.mk:86: *    Add “LOCAL_MODULE_TAGS := optional” in the
build/core/base_rules.mk:87: *    Android.mk for the affected module, and add
build/core/base_rules.mk:88: *    the LOCAL_MODULE value for that component
build/core/base_rules.mk:89: *    into the PRODUCT_PACKAGES section of product
build/core/base_rules.mk:90: *    makefile(s) where it’s necessary, if
build/core/base_rules.mk:91: *    appropriate.
build/core/base_rules.mk:92: *
build/core/base_rules.mk:93: * If the component should be in EVERY build of ALL
build/core/base_rules.mk:94: * products, then add its LOCAL_MODULE value to the
build/core/base_rules.mk:95: * PRODUCT_PACKAGES section of
build/core/base_rules.mk:96: * build/target/product/core.mk
build/core/base_rules.mk:97: *
build/core/base_rules.mk:98: *** user tag detected on new module – user tags are only supported on legacy modules.  Stop.
make: Leaving directory `/work/gb’

去掉多余的libdiskconfig目标
build/core/base_rules.mk:158: *** bootable/newinstaller/libdiskconfig: MODULE.TARGET.SHARED_LIBRARIES.libdiskconfig already defined by system/core/libdiskconfig.  Stop.
注释掉bootable/newinstaller/libdiskconfig/Android.mk中libdiskconfig相关代码

###########################
# shared library for target
#include $(CLEAR_VARS)

#LOCAL_SRC_FILES := $(commonSources)

#LOCAL_CFLAGS := -O2 -g -W -Wall -Werror

#LOCAL_MODULE := libdiskconfig
#LOCAL_MODULE_TAGS := system_builder
#LOCAL_SYSTEM_SHARED_LIBRARIES := libcutils liblog libc

#include $(BUILD_SHARED_LIBRARY)

将编译好的kernel拷贝到prebuilt下相应目录
carl@carl-amd64:/work/gb$ cp device/vm/vm/vm_defconfig prebuilt/android-x86/kernel/kernel_config_VirtualBox
carl@carl-amd64:/work/gb$ cp out/target/product/vm/kernel /work/gb/prebuilt/android-x86/kernel/kernel



开始全编译
carl@carl-amd64:/work/gb$ m -j3

stlport的问题解决

external/stlport/src/num_put_float.cpp: In function ‘bool std::priv::_Stl_is_nan_or_inf(double)’:
external/stlport/src/num_put_float.cpp:143: error: ‘IsNANorINF’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘bool std::priv::_Stl_is_inf(double)’:
external/stlport/src/num_put_float.cpp:144: error: ‘IsNANorINF’ was not declared in this scope
external/stlport/src/num_put_float.cpp:144: error: ‘IsINF’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘bool std::priv::_Stl_is_neg_inf(double)’:
external/stlport/src/num_put_float.cpp:145: error: ‘IsINF’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘bool std::priv::_Stl_is_neg_nan(double)’:
external/stlport/src/num_put_float.cpp:146: error: ‘IsNegNAN’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘char* std::priv::_Stl_ecvtR(double, int, int*, int*, char*)’:
external/stlport/src/num_put_float.cpp:280: error: ‘ecvt_r’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘char* std::priv::_Stl_fcvtR(double, int, int*, int*, char*)’:
external/stlport/src/num_put_float.cpp:282: error: ‘fcvt_r’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘char* std::priv::_Stl_ecvtR(long double, int, int*, int*, char*)’:
external/stlport/src/num_put_float.cpp:285: error: ‘qecvt_r’ was not declared in this scope
external/stlport/src/num_put_float.cpp: In function ‘char* std::priv::_Stl_fcvtR(long double, int, int*, int*, char*)’:
external/stlport/src/num_put_float.cpp:287: error: ‘qfcvt_r’ was not declared in this scope
target thumb C++: libstlport

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-57255-1-1.html 上篇帖子: VirtualBox 4 – NAT Port Forwarding GUI 下篇帖子: windows xp中virtualbox下ubuntu11.10的文件共享
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表