Skip to content

Instantly share code, notes, and snippets.

@CFM880
Last active April 19, 2023 14:57
Show Gist options
  • Save CFM880/eb3721dc27bc7184f45b67858870a0ac to your computer and use it in GitHub Desktop.
Save CFM880/eb3721dc27bc7184f45b67858870a0ac to your computer and use it in GitHub Desktop.
Android AOSP 9
project art/
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index b9d51c1125..f034a3db4f 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -504,6 +504,11 @@ MemMap* MemMap::MapFileAtAddress(uint8_t* expected_ptr,
DCHECK(ContainedWithinExistingMap(expected_ptr, byte_count, error_msg))
<< ((error_msg != nullptr) ? *error_msg : std::string());
flags |= MAP_FIXED;
+#if !defined(ART_TARGET)
+ } else if (expected_ptr) {
+#define MAP_FIXED_NOREPLACE 0x100000
+ flags |= MAP_FIXED_NOREPLACE;
+#endif
} else {
CHECK_EQ(0, flags & MAP_FIXED);
// Don't bother checking for an overlapping region here. We'll
project prebuilts/misc/
diff --git a/linux-x86/flex/flex-2.5.39 b/linux-x86/flex/flex-2.5.39
index 7488e09..08a4914 100755
Binary files a/linux-x86/flex/flex-2.5.39 and b/linux-x86/flex/flex-2.5.39 differ
# 初始repo仓库
repo init -u https://mirrors.bfsu.edu.cn/git/AOSP/platform/manifest -b android-9.0.0_r46 --partial-clone --clone-filter=blob:limit=10M 
# 同步repo
cd.repo/repo 
git pull 
croot
repo sync -j16
# 下载bin驱动
https://developers.google.cn/android/drivers?hl=zh-cn#crosshatchpq3a.190801.002
# Android 9的编译环境是python2
sudo ln –s /usr/bin/python2 /usr/bin/python 
# 在 ~/.bashrc 添加环境变量LC_ALL
# Android 9 aosp build need 
export LC_ALL=C 
source ~/.bashrc 

# 需要重新编译flex
aosp/prebuilts/misc/linux-x86/flex/flex-2.5.39.source/install/bin/flex 
./configure --prefix=`pwd`/install
# 将编译的`pwd`/install下的flex可执行文件拷贝到prebuilts/misc/linux-x86/flex/flex-2.5.39 
# 替换成之前的flex-2.5.39 
Copy flex to prebuilts/misc/linux-x86/flex/flex-2.5.39 

target dex2oat: out/target/product/crosshatch/dex_bootjars/system

…..

patchoatd E 04-17 23:51:13 513244 513244 image_space.cc:1761] Could not create image space with image file 'out/target/product/crosshatch/dex_bootjars/system/framework/boot.art'. Attempting to fall back to imageless running. Error was: Failed to mmap at expected address, mapped at 0x7f4037800000 instead of 0x705db000

patchoatd E 04-17 23:51:13 513244 513244 image_space.cc:1761] Attempted image: out/target/product/crosshatch/dex_bootjars/system/framework/boot-framework.art

patchoatd E 04-17 23:51:13 513244 513244 runtime.cc:1290] Dex file fallback disabled, cannot continue without image.

patchoatd E 04-17 23:51:13 513244 513244 patchoat.cc:485] Unable to initialize runtime

上面的报错的解决方案

https://groups.google.com/g/android-building/c/ZfUQQWt_ABI

https://android-review.googlesource.com/c/platform/art/+/2226578/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment