Using WITH_DEXPREOPT in imx6 Android Lollipop build

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using WITH_DEXPREOPT in imx6 Android Lollipop build

7,046 Views
deepikaag
Contributor II

Hi,

I am trying to build the Android Lollipop images for Freescale imx6 sabre-sd board. The build gets successfully completed as mentioned in the Freescale documentation.

Now, I want to compile the user build with "make WITH_DEXPREOPT=true" so as to enable pre-optimization of system apps. Enabling this option builds the odex/oat files in /system/app folder , rather than the using the /data/dalvik-cache on first boot.

However, I am getting build errors after enabling the WITH_DEXPREOPT option.

The build gets completed successfully for a Lollipop Nexus device with the same option enabled.

Following is a snippet of the error logs on imx6 sabresd board:

===============================================================================

Copy: out/target/product/sabresd_6dq/root/fstab.freescale

dex2oatd I  9111  9111 art/dex2oat/dex2oat.cc:1239] out/host/linux-x86/bin/dex2oatd --runtime-arg -Xms64m --runtime-arg -Xmx512m --boot-image=out/target/product/sabresd_6dq/dex_bootjars/system/framework/boot.art --dex-file=out/target/product/sabresd_6dq/obj/APPS/A2dpSinkApp_intermediates/arm/package.odex.input --dex-location=/system/app/A2dpSinkApp/A2dpSinkApp.apk --oat-file=out/target/product/sabresd_6dq/obj/APPS/A2dpSinkApp_intermediates/arm/package.odex --android-root=out/target/product/sabresd_6dq/system --instruction-set=arm --instruction-set-features=default --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols

dex2oatd E  9111  9111 art/runtime/gc/heap.cc:421] 0x5742a778

dex2oatd F  9111  9111 art/runtime/gc/heap.cc:422] There's a gap between the image space and the main space

dex2oatd F  9111  9111 art/runtime/runtime.cc:284] Runtime aborting...

dex2oatd F  9111  9111 art/runtime/runtime.cc:284] (Aborting thread was not attached to runtime!)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #00 pc 00006a22  /home/hscuser/Lollipop/out/host/linux-x86/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+82)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #01 pc 00004141  /home/hscuser/Lollipop/out/host/linux-x86/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+33)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #02 pc 0036f699  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+121)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #03 pc 0033a9ad  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+301)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #04 pc 0033a879  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::Dumpable<art::AbortState>::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+41)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #05 pc 003394f8  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (std::__1::basic_ostream<char, std::__1::char_traits<char> >& art::operator<<<art::AbortState>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Dumpable<art::AbortState> const&)+40)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #06 pc 003329e8  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::Runtime::Abort()+168)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #07 pc 000f6209  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::LogMessage::~LogMessage()+393)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #08 pc 001eb8bb  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::gc::Heap::Heap(unsigned int, unsigned int, unsigned int, unsigned int, double, double, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, art::InstructionSet, art::gc::CollectorType, art::gc::CollectorType, unsigned int, unsigned int, bool, unsigned int, unsigned int, bool, bool, bool, bool, bool, bool, bool, bool, bool, unsigned long long)+5707)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #09 pc 00333202  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::Runtime::Init(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*> > > const&, bool)+1298)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #10 pc 00332cbd  /home/hscuser/Lollipop/out/host/linux-x86/lib/libartd.so (art::Runtime::Create(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*> > > const&, bool)+93)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #11 pc 0001ea1a  /home/hscuser/Lollipop/out/host/linux-x86/bin/dex2oatd (art::Dex2Oat::CreateRuntime(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*> > > const&, art::InstructionSet)+42)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #12 pc 0001655f  /home/hscuser/Lollipop/out/host/linux-x86/bin/dex2oatd (art::Dex2Oat::Create(art::Dex2Oat**, std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void const*> > > const&, art::CompilerOptions const&, art::Compiler::Kind, art::InstructionSet, art::InstructionSetFeatures, art::VerificationResults*, art::DexFileToMethodInlinerMap*, unsigned int)+143)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #13 pc 00010290  /home/hscuser/Lollipop/out/host/linux-x86/bin/dex2oatd (art::dex2oat(int, char**)+11296)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #14 pc 0000d660  /home/hscuser/Lollipop/out/host/linux-x86/bin/dex2oatd (main+32)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #15 pc 000194d2  /lib/i386-linux-gnu/libc-2.15.so (__libc_start_main+242)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]   native: #16 pc 0000ccc0  /home/hscuser/Lollipop/out/host/linux-x86/bin/dex2oatd (???)

dex2oatd F  9111  9111 art/runtime/runtime.cc:284] Dumping all threads without appropriate locks held: thread list lock mutator lock

dex2oatd F  9111  9111 art/runtime/runtime.cc:284] All threads:

dex2oatd F  9111  9111 art/runtime/runtime.cc:284] DALVIK THREADS (0):

dex2oatd F  9111  9111 art/runtime/runtime.cc:284]

make: *** [out/target/product/sabresd_6dq/obj/APPS/A2dpSinkApp_intermediates/arm/package.odex] Aborted (core dumped)

make: *** Deleting file `out/target/product/sabresd_6dq/obj/APPS/A2dpSinkApp_intermediates/arm/package.odex'

#### make failed to build some targets (02:24 (mm:ss)) ####

======================================================================================

Please suggest on how we can enable the WITH_DEXPREOPT option in Freescale imx sabresd board Lollipop release.

Thanks in advance!!

Deepika

Labels (1)
11 Replies

2,254 Views
jerryliao
Contributor I

Dear All:

I can successfully compile Android 5.1.1 with WITH_DEXPREOPT define by following changes.

1. build/core/dex_preopt_libart.mk

      # start of image reserved address space

      LIBART_IMG_HOST_BASE_ADDRESS   := 0x60000000

     -LIBART_IMG_TARGET_BASE_ADDRESS := 0x50000000

     +LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000

2. device/fsl/sabresd_6dq/BoardConfig.mk

   

      PRODUCT_MODEL := SABRESD-MX6DQ     

    +WITH_DEXPREOPT := true     

      TARGET_RELEASETOOLS_EXTENSIONS := device/fsl/imx6

3. device/fsl/imx6/BoardConfigCommon.mk

    

     -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 377487360

     +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 524288000

Since there is no any virtual memory conflict, I wanna know if we can rollback this patch.

Otherwise, could anyone tell us when or how the virtual memory conflict would happen if the WITH_DEXPREOPT is set.

Regards,

Jerry

0 Kudos

2,254 Views
sanshanzhang
NXP Employee
NXP Employee

Hi Deepika,

You can try below patches.

build.git

diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk

index f8589ba..cfbf221 100644

--- a/core/dex_preopt_libart.mk

+++ b/core/dex_preopt_libart.mk

@@ -26,7 +26,7 @@ COMPILED_CLASSES := $(call word-colon,1,$(firstword \

# start of image reserved address space

LIBART_IMG_HOST_BASE_ADDRESS   := 0x60000000

-LIBART_IMG_TARGET_BASE_ADDRESS := 0x50000000

+LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000

device/fsl.git

diff --git a/imx6/BoardConfigCommon.mk b/imx6/BoardConfigCommon.mk

index 835a4dc..3d0a900 100644

--- a/imx6/BoardConfigCommon.mk

+++ b/imx6/BoardConfigCommon.mk

@@ -60,7 +60,7 @@ ARCH_ARM_USE_NON_NEON_MEMCPY := true

BOARD_BOOTIMAGE_PARTITION_SIZE := 16777216

BOARD_RECOVERYIMAGE_PARTITION_SIZE := 16777216

-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 377487360

+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 471859200

BOARD_FLASH_BLOCK_SIZE := 4096

TARGET_RECOVERY_UI_LIB := librecovery_ui_imx

0 Kudos

2,254 Views
mmj
Contributor III

Hi Sanshan,

I tried your patch but the problem still persist. Any further suggestion?

Regards,

mmj

0 Kudos

2,254 Views
bordeaujean-pas
Contributor I

Dear All,

it's still the same with last android 5.1.1...

Does anybody have solved this issue?

Regards.

0 Kudos

2,254 Views
kishorepoojari
Contributor III

Hello Deepika,

  I am facing the same issue , If u resolved above problem please share me the solution.

Regards,

Kishore P

0 Kudos

2,254 Views
jeffkrupp
Contributor II

I have the same issue, but don't think I need DEX_PREOPT.  While looking into this, I haven't found a complete fix other than to disable it.  But I did find that you can disable DEX_PREOPT for selected modules.  Maybe this helps someone.  Reference:

Configuring ART | Android Open Source Project

Example in device.mk

$(call add-product-dex-preopt-module-config,Calculator,disable)

0 Kudos

2,254 Views
deepikaag
Contributor II

Hi,

Can someone from the Freescale IMX community please reply on this query.

Thanks

Deepika

0 Kudos

2,255 Views
SergioSolis
NXP Employee
NXP Employee

Deepika, can you let us know if you were able to make it work with Guoyin's recommendations?

0 Kudos

2,256 Views
deepikaag
Contributor II

@sergiosolis

It didn't work.

0 Kudos

2,256 Views
chenguoyin
NXP Employee
NXP Employee

Could you check whether it helps by enlarge settingBOARD_SYSTEMIMAGE_PARTITION_SIZE?

myandroid//device/fsl

./imx6/BoardConfigCommon.mk:63:BOARD_SYSTEMIMAGE_PARTITION_SIZE := 377487360

0 Kudos

2,255 Views
deepikaag
Contributor II

Hi Guoyin,

The suggested option to increase the BOARD_SYSTEMIMAGE_PARTITION_SIZE didn't work.

Also, if I checkout the original android-5.0.2_r1 src code for build.git (to discard the freescale changes), boot.img is not getting compiled.

I request you to please take a look and provide a viable alternative.

It has been a long time and the query is not answered appropriately on the forum.

Thanks

Deepika

0 Kudos