No sadly , I decided to use another mod, until the dev fixes bluetooth
Last edited:
No sadly , I decided to use another mod, until the dev fixes bluetooth
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := cortex-a53
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a7
This is my opinionThis is from the BoardConfig of angler (nexus 6p)
when i watch the rom being built with htop, i notice that the arm toolchains are being used at times.
however, when i build the kernel from source (not through mka bootimg), it's only necessary to export the location of an aarch64 kernel toolchain.
can someone explain this?
This is my opinion
Even you're 64 bit
You also need to make 32 bit stuff ...
That's why arm toolchain will be used for 32 bit libs / files
so when i added vynikal's squashed commit he pieced together for mm from justarchi's repo to my cm13 build, using uber 5.3 toolchains, i got the evil com.android.bt has stopped, Bluetooth share had stopped etc.So neither of you have fixed this? @JustArchi - you have any thoughts here? I even got medieval and put -g in the cflags in that file and the main BT ones to try to fix.
Original flags changes were made in system/bt/core/Android.mk
packages/apps/Bluetooth
commit d58f68c6f364eedc8771de1204d9a45073df2f82
Author: bigsupersquid <scrubbed>
Date: Sun Jul 10 20:49:52 2016 -0500
-Os jni
Change-Id: Iafb2af0773bc093633483403e6bda7680130cf43
diff --git a/jni/Android.mk b/jni/Android.mk
index 68ca6e7..d973978 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -33,6 +33,7 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_MULTILIB := 32
#LOCAL_CFLAGS += -O0 -g
+LOCAL_CFLAGS += -Os
LOCAL_MODULE := libbluetooth_jni
LOCAL_MODULE_TAGS := optional
system/bt
commit 604eeb7c5a84c0fc4e1ecdda368271bc122c2a51
Author: bigsupersquid <scrubbed>
Date: Sun Jul 10 20:51:08 2016 -0500
-Os
Change-Id: I9e4440b575c0b269dbb291ba0b34834a2a686e5c
diff --git a/Android.mk b/Android.mk
index b398132..dfdb788 100644
--- a/Android.mk
+++ b/Android.mk
@@ -38,7 +38,8 @@ bdroid_CFLAGS += \
-Wno-unused-parameter \
-Wunused-but-set-variable \
-UNDEBUG \
- -DLOG_NDEBUG=1
+ -DLOG_NDEBUG=1 \
+ -Os
include $(call all-subdir-makefiles)
so when i added vynikal's squashed commit he pieced together for mm from justarchi's repo to my cm13 build, using uber 5.3 toolchains, i got the evil com.android.bt has stopped, Bluetooth share had stopped etc.
adding -Os to system/bt/Android.mk CFLAGS didn't solve it but i tracked my issue to packages/apps/Bluetooth/jni, added -Os to that directory's Android.mk CFLAGS as well, and now I'm good on BT.
testing it out, i needed the -Os in both those places together to make it work.
just fyi, maybe it'll help you and or others too since i hadn't seen reference to doing anything with the packages/apps/Bluetooth on my searching.
patches, specifically:
Code:packages/apps/Bluetooth commit d58f68c6f364eedc8771de1204d9a45073df2f82 Author: bigsupersquid <scrubbed> Date: Sun Jul 10 20:49:52 2016 -0500 -Os jni Change-Id: Iafb2af0773bc093633483403e6bda7680130cf43 diff --git a/jni/Android.mk b/jni/Android.mk index 68ca6e7..d973978 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -33,6 +33,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MULTILIB := 32 #LOCAL_CFLAGS += -O0 -g +LOCAL_CFLAGS += -Os LOCAL_MODULE := libbluetooth_jni LOCAL_MODULE_TAGS := optional system/bt commit 604eeb7c5a84c0fc4e1ecdda368271bc122c2a51 Author: bigsupersquid <scrubbed> Date: Sun Jul 10 20:51:08 2016 -0500 -Os Change-Id: I9e4440b575c0b269dbb291ba0b34834a2a686e5c diff --git a/Android.mk b/Android.mk index b398132..dfdb788 100644 --- a/Android.mk +++ b/Android.mk @@ -38,7 +38,8 @@ bdroid_CFLAGS += \ -Wno-unused-parameter \ -Wunused-but-set-variable \ -UNDEBUG \ - -DLOG_NDEBUG=1 + -DLOG_NDEBUG=1 \ + -Os include $(call all-subdir-makefiles)
Bro sorry for quoting your old post..I am getting the same error as you are getting while booting.. Took logcat and got the same Audio system error..Can you help me fixing it?Great script! Tried this myself but it didn't work unfortunately.
However, I've found out that if you copy the /data/misc/adb/adb_keys file from a working and authorized rom to your bootlooping rom zip and add some lines to the updater-script to make it install, adb works flawlessly afterwards. :good:
Was able to grab a log of my bootloop now.. Any opinions or ideas?
Code:E/rmt_storage( 2039): Unable to change dir E/rmt_storage( 2039): Failed in getting the physical address for shared mem I/ServiceManager( 730): Waiting for service media.audio_policy... W/AudioSystem( 730): AudioPolicyService not published, waiting... I/ServiceManager( 730): Waiting for service media.audio_policy... I/ServiceManager( 730): Waiting for service media.audio_policy...
EDIT: Just to clarify, "Waiting for service media.audio_policy..." is the problem.. I've tried removing rmt_storage binary, but the bootloop persisted. So Audio Policy is the reason.
matteo@matteo-SATELLITE-U920T ~/mako/build $ git remote add 32 -f git@github.com:Vynikal/android_build.git && git cherry pick 6af9a30f748153bf9bcab533dbaa7c964113aff2
Aggiornamento di 32
Da github.com:Vynikal/android_build
* [nuovo branch] caf/cm-12.0 -> 32/caf/cm-12.0
* [nuovo branch] caf/cm-12.1 -> 32/caf/cm-12.1
* [nuovo branch] cm-10.1 -> 32/cm-10.1
* [nuovo branch] cm-10.2 -> 32/cm-10.2
* [nuovo branch] cm-11.0 -> 32/cm-11.0
* [nuovo branch] cm-12.0 -> 32/cm-12.0
* [nuovo branch] cm-12.1 -> 32/cm-12.1
* [nuovo branch] cm-13-flags -> 32/cm-13-flags
* [nuovo branch] cm-13.0 -> 32/cm-13.0
* [nuovo branch] cm-9.0.0 -> 32/cm-9.0.0
* [nuovo branch] cm-9.1.0 -> 32/cm-9.1.0
* [nuovo branch] donut -> 32/donut
* [nuovo branch] eclair -> 32/eclair
* [nuovo branch] froyo -> 32/froyo
* [nuovo branch] froyo-stable -> 32/froyo-stable
* [nuovo branch] gb-release-7.2 -> 32/gb-release-7.2
* [nuovo branch] gingerbread -> 32/gingerbread
* [nuovo branch] gingerbread-release -> 32/gingerbread-release
* [nuovo branch] ics -> 32/ics
* [nuovo branch] ics-release -> 32/ics-release
* [nuovo branch] jellybean -> 32/jellybean
* [nuovo branch] jellybean-release -> 32/jellybean-release
* [nuovo branch] jellybean-stable -> 32/jellybean-stable
* [nuovo branch] mr1.1-staging -> 32/mr1.1-staging
* [nuovo branch] qcril -> 32/qcril
* [nuovo branch] shipping/cm-11.0 -> 32/shipping/cm-11.0
* [nuovo branch] stable/cm-10.2 -> 32/stable/cm-10.2
* [nuovo branch] stable/cm-11.0 -> 32/stable/cm-11.0
* [nuovo branch] stable/cm-11.0-XNF8Y -> 32/stable/cm-11.0-XNF8Y
* [nuovo branch] stable/cm-11.0-XNF9X -> 32/stable/cm-11.0-XNF9X
* [nuovo branch] stable/cm-11.0-XNG2S -> 32/stable/cm-11.0-XNG2S
* [nuovo branch] stable/cm-11.0-XNG3C -> 32/stable/cm-11.0-XNG3C
* [nuovo branch] stable/cm-12.0-YNG1T -> 32/stable/cm-12.0-YNG1T
* [nuovo branch] stable/cm-12.0-YNG1TA -> 32/stable/cm-12.0-YNG1TA
* [nuovo branch] stable/cm-12.0-YNG3C -> 32/stable/cm-12.0-YNG3C
* [nuovo branch] stable/cm-12.0-YNG4N -> 32/stable/cm-12.0-YNG4N
* [nuovo branch] stable/cm-12.1-YOG3C -> 32/stable/cm-12.1-YOG3C
* [nuovo branch] stable/cm-12.1-YOG4P -> 32/stable/cm-12.1-YOG4P
* [nuovo branch] stable/cm-12.1-YOG7D -> 32/stable/cm-12.1-YOG7D
* [nuovo branch] stable/cm-13.0-ZNH0E -> 32/stable/cm-13.0-ZNH0E
* [nuovo branch] staging/caf/themes/cm-12.0 -> 32/staging/caf/themes/cm-12.0
* [nuovo branch] staging/cm-12.0-caf -> 32/staging/cm-12.0-caf
* [nuovo branch] staging/cm-12.1 -> 32/staging/cm-12.1
fatal: Commit pick sconosciuto
art/compiler/dex/quick/dex_file_method_inliner.cc: In member function 'bool art:exFileMethodInliner::GenIntrinsic(art::Mir2Lir*, art::CallInfo*)':
art/compiler/dex/quick/dex_file_method_inliner.cc:508:1: error: insn does not satisfy its constraints:
}
^
(insn 2244 1443 1444 107 (parallel [
(set (regI 3 r3 [539])
(lshiftrtI (regI 2 r2 [orig:186 D.340824 ] [186])
(const_int 1 [0x1])))
(clobber (reg:CC 100 cc))
]) art/compiler/dex/quick/dex_file_method_inliner.cc:496 132 {arm_lshrdi3_1bit}
(expr_list:REG_UNUSED (reg:CC 100 cc)
(expr_list:REG_UNUSED (reg:SI 4 r4)
(nil))))
art/compiler/dex/quick/dex_file_method_inliner.cc:508:1: internal compiler error: in build_def_use, at regrename.c:1573
0x8119ea _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
../.././../gcc/gcc-UBER/gcc/rtl-error.c:109
0x811a11 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
../.././../gcc/gcc-UBER/gcc/rtl-error.c:120
0x7f0102 build_def_use
../.././../gcc/gcc-UBER/gcc/regrename.c:1573
0x7f0102 regrename_analyze(bitmap_head*)
../.././../gcc/gcc-UBER/gcc/regrename.c:715
0x7f0409 regrename_optimize
../.././../gcc/gcc-UBER/gcc/regrename.c:1830
0x7f0409 execute
../.././../gcc/gcc-UBER/gcc/regrename.c:1871
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [build/core/binary.mk:619: /run/media/haozeke/Storage/AndBuild/cm-12.1/out/target/product/honami/obj/SHARED_LIBRARIES/libart-compiler_intermediates/dex/quick/dex_file_method_inliner.o] Error 1
make: *** Waiting for unfinished jobs....
Disable graphiteHey any idea about this? Using Uber 4.9 for both toolchain and kernel. No other funny business. honami, cm-12.1
So I disabled the flags in the archidroid.mk like so
But, even after make clobber and ccache -C I got the same error... Help?ARCHIDROID_GCC_CFLAGS +=
# removed -fgraphite -fgraphite-identity
art/compiler/dex/quick/dex_file_method_inliner.cc: In member function 'bool art:exFileMethodInliner::GenIntrinsic(art::Mir2Lir*, art::CallInfo*)':
art/compiler/dex/quick/dex_file_method_inliner.cc:508:1: error: insn does not satisfy its constraints:
}
^
(insn 2244 1443 1444 107 (parallel [
(set (regI 3 r3 [539])
(lshiftrtI (regI 2 r2 [orig:186 D.340824 ] [186])
(const_int 1 [0x1])))
(clobber (reg:CC 100 cc))
]) art/compiler/dex/quick/dex_file_method_inliner.cc:496 132 {arm_lshrdi3_1bit}
(expr_list:REG_UNUSED (reg:CC 100 cc)
(expr_list:REG_UNUSED (reg:SI 4 r4)
(nil))))
art/compiler/dex/quick/dex_file_method_inliner.cc:508:1: internal compiler error: in build_def_use, at regrename.c:1573
0x8119ea _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
../.././../gcc/gcc-UBER/gcc/rtl-error.c:109
0x811a11 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
../.././../gcc/gcc-UBER/gcc/rtl-error.c:120
0x7f0102 build_def_use
../.././../gcc/gcc-UBER/gcc/regrename.c:1573
0x7f0102 regrename_analyze(bitmap_head*)
../.././../gcc/gcc-UBER/gcc/regrename.c:715
0x7f0409 regrename_optimize
../.././../gcc/gcc-UBER/gcc/regrename.c:1830
0x7f0409 execute
../.././../gcc/gcc-UBER/gcc/regrename.c:1871
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [build/core/binary.mk:619: /run/media/haozeke/Storage/AndBuild/cm-12.1/out/target/product/honami/obj/SHARED_LIBRARIES/libart-compiler_intermediates/dex/quick/dex_file_method_inliner.o] Error 1
- Optimized for speed yet more all instructions - ARM and THUMB (-O3)
- Optimized for speed also parts which are compiled with Clang (-O3)
- Turned off all debugging code (lack of -g)
- Eliminated redundant loads that come after stores to the same memory location, both partial and full redundancies (-fgcse-las)
- Ran a store motion pass after global common subexpression elimination. This pass attempts to move stores out of loops (-fgcse-sm)
- Enabled the identity transformation for graphite. For every SCoP we generate the polyhedral representation and transform it back to gimple. We can then check the costs or benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations are also performed by the code generator ISL, like index splitting and dead code elimination in loops (-fgraphite -fgraphite-identity)
- Performed interprocedural pointer analysis and interprocedural modification and reference analysis (-fipa-pta)
- Performed induction variable optimizations (strength reduction, induction variable merging and induction variable elimination) on trees (-fivopts)
- Didn't keep the frame pointer in a register for functions that don't need one. This avoids the instructions to save, set up and restore frame pointers; it also makes an extra register available in many functions (-fomit-frame-pointer)
- Attempted to avoid false dependencies in scheduled code by making use of registers left over after register allocation. This optimization most benefits processors with lots of registers (-frename-registers)
- Tried to reduce the number of symbolic address calculations by using shared “anchor” symbols to address nearby objects. This transformation can help to reduce the number of GOT entries and GOT accesses on some targets (-fsection-anchors)
- Performed tail duplication to enlarge superblock size. This transformation simplifies the control flow of the function allowing other optimizations to do a better job (-ftracer)
- Performed loop invariant motion on trees. It also moved operands of conditions that are invariant out of the loop, so that we can use just trivial invariantness analysis in loop unswitching. The pass also includes store motion (-ftree-loop-im)
- Created a canonical counter for number of iterations in loops for which determining number of iterations requires complicated analysis. Later optimizations then may determine the number easily (-ftree-loop-ivcanon)
- Assumed that loop indices do not overflow, and that loops with nontrivial exit condition are not infinite. This enables a wider range of loop optimizations even if the loop optimizer itself cannot prove that these assumptions are valid (-funsafe-loop-optimizations)
- Moved branches with loop invariant conditions out of the loop (-funswitch-loops)
- Constructed webs as commonly used for register allocation purposes and assigned each web individual pseudo register. This allows the register allocation pass to operate on pseudos directly, but also strengthens several other optimization passes, such as CSE, loop optimizer and trivial dead code remover (-fweb)
- Sorted the common symbols by alignment in descending order. This is to prevent gaps between symbols due to alignment constraints (-Wl,--sort-common)
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" />
<project name="ArchiDroid/Toolchain" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="architoolchain-5.2-arm-linux-gnueabihf" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" />
<project name="ArchiDroid/Toolchain" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="uber-4.9-arm-linux-androideabi" />
</manifest>
(...)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../libexec/gcc/arm-linux-androideabi/4.8.x-sabermod/cc1: error while loading shared libraries: libcloog-isl.so.4: cannot open shared object file: No such file or directory
apt-get install libcloog-isl4
(...)/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../libexec/gcc/arm-linux-androideabi/4.8.x-sabermod/cc1: error while loading shared libraries: libisl.so.13: cannot open shared object file: No such file or directory
deb http://ftp.debian.org/debian testing main contrib non-free
deb-src http://ftp.debian.org/debian testing main contrib non-free
Hello dear developers.
I'd like to share with you effect of nearly 200 hours spent on trying to optimize Android and push it to the limits.
In general. You should be already experienced in setting up your buildbox, using git, building AOSP/CyanogenMod/OmniROM from source and cherry-picking things from review/gerrit. If you don't know how to build your own ROM from source, this is not a something you can apply to your ROM. Also, as you probably noticed, this is not a something you can apply to every ROM, as these optimizations are applied during compilation, so only AOSP roms, self-compiled from source may use this masterpiece.
So, what is it about? As we know, Android contains a bunch of low-level C/C++ code, which is compiled and acts as a backend for our java's frontend and android apps. Unfortunately, Google didn't put their best at focusing on optimization, so as a result we're using the same old flags set back in 2006 for Android Donut or anything which existed back then. As you guess, in 2006 we didn't have as powerful devices as now, we had to sacrifice performance for smaller code size, to fit to our little devices and run well on very low amount of memory. However, this is no longer a case, and by using newest compilers such as GCC 4.8 and properly setting flags, we can achieve something, which I call "Android in 2014".
You probably may heard of some developers claiming using of "O3 Flags" in their ROMs. Well, while this may be true, they've applied only to low-level ARM code, mostly used during kernel compilation. Additionally it overwrites O2 flag, which is already fast, so as you may guess, this is more likely a placebo effect and disappears right after you change the kernel. Take a look at the most cherry-picked "O3 Flags commit". You see big "-Os" in "TARGET_thumb_CFLAGS"? This is what I'm talking about.
However, the commit I'm about to present you is not a placebo effect, as it applies flags to everything what is compiled, and mostly important - target THUMB, about 90% of an Android.
Now I'll tell you some facts. We have three interesting optimization levels. Os, O2, O3. O2 enables all optimizations that do not involve a space-speed tradeoff. Os is similar to O2, but it disables all flags that increase code size. It also performs further optimizations to reduce code size to the minimum. O3 enables all O2 optimizations and some extra optimizations that like to increase code size and may, or may not, increase performance. If you want to ask if there's something more like O4, there is - Ofast, however it breaks IEEE standard and doesn't work with Android, as i.e. sqlite3 is not compatible with Ofast's -ffast-math flag. So no go for us.
Now here comes the fun part. Android by default is compiled with O2 flag for target ARM (about 10% of Android, mostly kernel) and Os flag for target THUMB (about 90% of Android, nearly everything apart from kernel). Some guys think that Os is better than O2 or O3 because smaller code size is faster due to bettering fitting in cpu cache. Unfortunately, I proven that it is a myth. Os was good back in 2006, as only with this flag Google was able to compile Dalvik and it's virtual machine while keeping good amount of free memory and space on eMMC cards. As or now, we have plenty of space, plenty of ram, plenty of CPU power and still good old Os flag for 90% of Android.
Now you should ask - where is your proof?, here I have it for you:
As you may noticed, I compiled whetstone.c benchmark using three different optimization flags - Os, O2 and O3. I repeated each test additional two times, just to make sure that Android doesn't lie to me. Source code of this test is available here and you may download it, compile for our beloved Android and try yourself. As you can see O3 > O2 >> Os, Os performs about 2.5x times worse than O2, and about 3.0x times worse than O3.
But, of course. Android is not a freaking benchmark, it's operating system. We can't tell if things are getting better or worse according to a simple benchmark. I kept that in mind and provided community with JustArchi's Mysterious Builds for test. I gave both mysterious builds and didn't tell them what is the mysterious change. Both builds have been compiled with the same toolchain, same version, same commits. The one and only mysterious change was the fact that every component compiled as target thumb (major portion of an android) has been optimized for speed (O3) in build #1 (experimental), and optimized for size (Os) in build #2 (normal behaviour). Check poll yourself, 9 votes on build 1 in terms of performance, and 1 vote on build 2. I decided that this and benchmark is enough to tell that O2/O3 for target thumb is something that we want.
Now the battle is, O2 or O3? This is tough choice, here are some facts:
1. Kernel compiled with O2 has 4902 KB, with O3 4944 KB, so O3 is 42 KB bigger.
2. ROM compiled with O3 is 3 MB larger than O2 after zip compression. Fast overview: 97 binaries in /system/bin and 2 binaries in /system/xbin + 283 libraries in /system/lib and other files, about 400 files in total. 3 MB / 400 = 7,5 KB per file size increase.
3. No issues
In general, I doubt that this extra chunk of code may cause any significant memory usage or slower performance. I suggest to use O3 if it doesn't cause any issues to you compared to O2, but older devices may use O2 purely for saving on code size, similar way Google did it back in 2006 using Os flag.
[SIZE="+1"]Now let's get down to bussiness[/SIZE].
Here is a link to the commit -> https://github.com/JustArchi/android_build/commit/8e1b82c082a8de9160e6c0fc3ded37b591c3e517
And here is a list of important improvements:
Looks badass? It is badass. Head over to my ArchiDroid 2.X project and see yourself how people react after switching to my ROM. Take a look at just one small example, or another one . No bullsh*t guys, this is future.
However, please read my commit carefully before you decide to cherry-pick it. You must understand that Google's flags weren't touched since 7 years and nobody can assure you that they will work properly for your ROM and your device. You may experiment with them a bit to find out if they're not causing conflicts or other issues.
I can assure you that my OmniROM build compiles fine with some fixes mentioned in the commit itself. Just don't forget to clean ccache (rm -rf /home/youruser/.ccache or rm -rf /root/.ccache) and make clean/clobber.
You can use, modify and share my commit anyway you want, just please keep proper credits in changelogs and in the repo itself. If you feel generous, you may also buy me a coke for massive amount of hours put into those experiments.
Now go ahead and show your users how things should be done .