Mokee 6.0源码编译

2017-07-27  本文已影响0人  zhouyufei

编译环境

1.系统版本:Mac OS 10.12.5 (16F73)
2.XCode版本:Version 8.3.3 (8E3004b)
3.jdk版本:1.7.0_60

其它注意事项:
1.Xcode版本,我首先尝试了编译mokee5.0版本的源码,提示了Xcode版本的错误,在
网上查阅相关资料后得知,Xcode版本过高会导致编译失败,网上也有相关的解决办法,
即替换Xcode中的SDKs的版本。未亲测。

2.编译过程中可能会提示部分工具没有安装,比如我遇到的有:ImageMagic、
pngcrush、libsdl、maven,等等,这些软件都可以通过MacPorts 或者Homebrew安
装。我比较喜欢使用homebrew,缺失的环境亲测基本都可以通过homebrew安装

3.Mac自带的sed版本与gnu-sed有区别,需要使用gnu-sed替换

4.mac系统本身的硬盘是不区分大小写的,但是编译安卓需要大小写敏感的磁盘,我使用
的是外置的硬盘。如果不使用外置硬盘的话需要对系统硬盘进行分区,创建大小写敏感的磁
盘。


关于MacPorts:https://www.macports.org
关于:https://brew.sh

关于环境的搭建可以参考:https://source.android.com/source/initializing

源码获取

1.获取repo工具,这里使用mokee提供的repo工具,实际中发现不使用mokee提供的
repo工具同步过程中出现了错误。我将repo工具放进了路径:/usr/local/bin中
获取repo工具的方式:

下载repo:
sudo curl https://download.mokeedev.com/git-repo-downloads/repo > /usr/local/bin/repo

为repo增加执行权限:
chmod a+x /usr/local/bin/repo

2.同步源码

下载mokee 5.0源码
repo init -u https://github.com/MoKee/android -b mkl-mr1

下载mokee 6.0源码
repo init -u https://github.com/MoKee/android -b mkm

这里我下载的6.0的源码,初始化完成后,再执行同步操作,这里执行时间较长:

repo sync

3.更换源码地址,因为mokee部分源码会从google下载,换成国内的镜像地址,下载速度会更快。更换方式:打开源码路径下.repo/manifest.xml文件将其中的 https://android.googlesource.com/ 全部使用 https://aosp.tuna.tsinghua.edu.cn 代替即可

4.以上准备完成以后,在命令行中进入源码根目录开始准备编译:

cd /Volumes/SanDisk/aosp

. build/envsetup.sh      #注意这里不是source build/envsetup.sh。另外.与build之间是有空格的

lunch

我的设备是motorola xt875 也就是targa,所以我选择了117,然后按下回车

首次启动时会下载部分代码,代码下载完成后执行下一步

make bacon



遇到的问题及解决办法

1.Error: selected processor does not support ARM mode `smc #0'
详细信息如下:


  CC      arch/arm/mach-omap2/temp_sensor_device.o
  CC      arch/arm/mach-omap2/omap-smp.o
  AS      arch/arm/mach-omap2/omap-headsmp.o
/Volumes/SanDisk/aosp/kernel/motorola/omap4-common/arch/arm/mach-omap2/omap-headsmp.S: Assembler messages:
/Volumes/SanDisk/aosp/kernel/motorola/omap4-common/arch/arm/mach-omap2/omap-headsmp.S:36: Error: selected processor does not support ARM mode `smc #0'
make[3]: *** [arch/arm/mach-omap2/omap-headsmp.o] Error 1
make[2]: *** [arch/arm/mach-omap2] Error 2
make[1]: *** [sub-make] Error 2
make: *** [TARGET_KERNEL_BINARIES] Error 2

解决办法:

在以下文件中做以下修改

/Volumes/SanDisk/aosp/kernel/motorola/omap4-common/arch/arm/mach-omap2/omap-headsmp.S

/Volumes/SanDisk/aosp/kernel/motorola/omap4-common/arch/arm/mach-omap2/omap44xx-smc.S

/Volumes/SanDisk/aosp/kernel/motorola/omap4-common/arch/arm/mach-omap2/sleep44xx.S

/Volumes/SanDisk/aosp/kernel/motorola/omap4-common/security/smc/bridge_pub2sec.S

在所有 smc #0 语句前添加:.arch_extension sec

2.make: *** No rule to make target libsrv_init', needed by/Volumes/SanDisk/aosp/out/target/product/targa/obj/EXECUTABLES/pvrsrvinit_intermediates/pvrsrvinit.o'. Stop.
详细信息如下:


make: *** No rule to make target `libsrv_init', needed by `/Volumes/SanDisk/aosp/out/target/product/targa/obj/EXECUTABLES/pvrsrvinit_intermediates/pvrsrvinit.o'.  Stop.
make: *** Waiting for unfinished jobs....
target thumb C: pppd <= external/ppp/pppd/utils.c

#### make failed to build some targets (20:28 (mm:ss)) ####

解决办法:
将手机打开adb调试模式接入电脑后,在命令行执行以下命令:

cd Volumes/SanDisk/aosp/device/motorola/targa
./extract-files.sh

3.md5sum required to detect changes on config file
详细信息如下:

md5sum required to detect changes on config file
make[1]: *** [.compat_autoconf_ol_R5.SP7.01] Error 255
make: *** [WLAN_MODULES] Error 2

解决办法:

brew install md5sha1sum

4.make[7]: *** No rule to make target .git/refs/tags', needed by/Volumes/SanDisk/aosp/hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless/wl12xx/version.h'. Stop.
详细信息如下

make[7]: *** No rule to make target `.git/refs/tags', needed by `/Volumes/SanDisk/aosp/hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless/wl12xx/version.h'.  Stop.
make[6]: *** [/Volumes/SanDisk/aosp/hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless/wl12xx] Error 2
make[5]: *** [/Volumes/SanDisk/aosp/hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless] Error 2
make[5]: *** Waiting for unfinished jobs....

解决办法:

将文件
/Volumes/SanDisk/aosp/hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless/wl12xx/Makefile
中的

define filechk_version.h
    (echo 'static const char *wl12xx_timestamp = __TIMESTAMP__;'; \
    echo 'static const char *wl12xx_git_head = \
            "$(shell git describe --dirty)";')
endef
$(obj)/version.h: .git/HEAD .git/index .git/refs/tags
修改为:
define filechk_version.h
    (echo 'static const char *wl12xx_timestamp = __TIMESTAMP__;'; \
    echo 'static const char *wl12xx_git_head = \
            "$(shell hostname)";')
endef
$(obj)/version.h: Makefile



更新Mac上的gcc版本

1.查看mac本身gcc版本


/usr/bin/gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

2.使用homebrew安装gcc4.7


brew install gcc47

3.修改链接,将/usr/local/bin目录下的gcc-4.7重命名为gcc

4.修改环境变量: export PATH=/usr/local/bin:$PATH

上一篇下一篇

猜你喜欢

热点阅读