如何解决 W/art:尝试在 Arndale Board 上移植 Android Lollipop 时无法使用图像文件“/system/framework/boot.art”创建图像 space?

how to solve W/art : Could not create image space with image file '/system/framework/boot.art' while trying to port Android Lollipop on Arndale Board?

我正在尝试将 Android Lollipop 移植到 arndale 板上,我面临以下有关 ART 崩溃(AndroidRunTime)的问题。

> I/art ( 2264): RelocateImage: /system/bin/patchoat
> --input-image-location=/system/framework/boot.art --output-image-file=/data/dalvik-cach6 F/libc ( 2443): No [stack] line found in "/proc/self/task/2443/maps"! F/libc ( 2443): Fatal signal 6
> (SIGABRT), code -6 in tid 2443 (patchoat) W/art ( 2702): Could not
> create image space with image file >/system/framework/boot.art.
> Attempting to fall back to imageless running

移植步骤

1.Download vexpress android L 下面的 32 位代码 link。 http://releases.linaro.org/15.05/android

2.Download arndale android KK 32 位源代码和来自 http://releases.linaro.org/14.08/android/arndale

的 3.9 内核

3.Replace 第 1 步代码下载的 Vexpress 内核源代码和从第 2 步下载的 arndale KK 3.9 内核源代码。

4.Replace Vexpress HAL (device/linaro/vexpress) 与 Arndale HAL (device/linaro/arndale)。

5.Solve 与仿生和构建环境相关的小编译问题。

刷新图像并打开电路板电源后,我卡在 android 徽标和内核崩溃

> >37.790000] Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0    Tainted: G        W     (3.9.1 #8) [   37.790000]
> CPU: 0    Tainted: G        W     (3.9.1 #8) PC is at
> __copy_to_user_std+0x4c/0x3a8 [   37.790000] PC is at __copy_to_user_std+0x4c/0x3a8 LR is at 0x6c000000
> >[   37.790000] LR is at 0x6c000000

和 logcat 给出

> >I/art ( 2264): RelocateImage: /system/bin/patchoat --input-image-location=/system/framework/boot.art --output-image-file=/data/dalvik-cach6 F/libc ( 2443): No [stack] line found in "/proc/self/task/2443/maps"! F/libc ( 2443): Fatal signal 6
> (SIGABRT), code -6 in tid 2443 (patchoat) W/art ( 2702): Could not
> create image space with image file >/system/framework/boot.art.
> Attempting to fall back to imageless running.

确切的失败点

1.ART 从 art/runtime/thread.cc.

调用 Thread::InitStackHwm

2.The 上面的调用触发 __pthread_attr_getstack_main_thread(stack_base, stack_size) in bionic/libc/bionic/pthread_attr.cpp which returns No [stack] line在输入代码 here/proc/self/task/2443/maps 中找到!并且 ART 崩溃并给出 SIG_ABORT,似乎没有为 2443 线程创建堆栈,但如何解决这个问题?

如果有人能帮我解决这个问题就太好了。

谢谢, 德瓦什

这是将 3.9 内核与 linaro vexpress android 平台一起使用的副作用,该平台需要 3.10 内核(不支持 arndale)。

作为解决方法,在 art/runtime/thread.cc.

中注释掉 InitStackHwm() 函数

我认为如果在 3.10 内核中需要对 arndale 的支持,我们可能不需要这个解决方法,ART 可以直接工作。

    void Thread::Init(ThreadList* thread_list, JavaVMExt* java_vm) {
  // This function does all the initialization that must be run by the native thread it applies to.
  // (When we create a new thread from managed code, we allocate the Thread* in Thread::Create so
  // we can handshake with the corresponding native thread when it's ready.) Check this native
  // thread hasn't been through here already...
  CHECK(Thread::Current() == nullptr);
  SetUpAlternateSignalStack();
  InitCpu();
  InitTlsEntryPoints();
  RemoveSuspendTrigger();
  InitCardTable();
  InitTid();
  // Set pthread_self_ ahead of pthread_setspecific, that makes Thread::Current function, this
  // avoids pthread_self_ ever being invalid when discovered from Thread::Current().
  tlsPtr_.pthread_self = pthread_self();
  CHECK(is_started_);
  CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, this), "attach self");
  DCHECK_EQ(Thread::Current(), this);

  tls32_.thin_lock_thread_id = thread_list->AllocThreadId(this);
  //InitStackHwm(); This is the workaround

  tlsPtr_.jni_env = new JNIEnvExt(this, java_vm);
  thread_list->Register(this);
}