루팅강좌

퀄컴 최적화 달빅&바이오닉 라이브러리

T.B 2013. 11. 30. 08:07


오늘 소개할 내용은 화제의 [4.4][PATCH] Qualcomm-optimized Dalvik & Bionic libraries로 일명 '모토X 달빅패치'다. 이게 화제인 이유를 짧게만 언급하자면, 최근 출시된 모토로라(Motolora)의 무약정 19만원대 모토G가 삼성의 최신 플래그쉽 모델인 갤럭시S4 보다 '부분적'으로 더 나은 성능을 보일만큼 최적화가 잘되있다는 것에 착안(참고)해서 모토G와 구글 레퍼런스 순정 안드로이드 4.4 킷캣(Android 4.4 Kitkat)의 ROM에 약간의 차이가 있는 것을 확인, 라이브러리를 추출해서 다른 기기(넥서스4)에 적용해보니 성능이 대폭 향상됐기 때문이다.


구글이 레퍼런스 스마트폰을 너무 좋게 만들면 제조업체에서 불만을 갖을 수 있기에 자사(구글)의 모토G에만 적용했다는 '루머'로 결과부터 말하자면, '사용자 환경(백그라운드, 설치 어플리케이션 등)'에 따라서 벤치마크 점수가 다를 수가 있겠으나 Antutu X Benchmark Editor(참고) 기준 Clockworkmod 및 커스텀롬을 설치하지 않은 순정 런타임 달빅(Dalvik)에서 28800점대의 점수였는데 달빅패치를 적용한 후 바로 벤치마크를 테스트했을 적에는 약 4천점 정도 오히려 점수가 감소했으나 히팅된 AP를 식힌 후 다시 시도해보니 달빅패치를 적용한 후 35800점대로 최대 약 1만점 가까이 벤치마크 점수가 향상됐다.


이 점수대는 런타임 아트(ART)(참고)와 유사한 점수대로 [4.4][PATCH] Qualcomm-optimized Dalvik & Bionic libraries 는 달빅(Dalvik)의 어플리케이션 호환성을 유지하면서 아트(ART)의 성능을 갖을 수 있다는 장점이 있으나 커널 플래싱에 따른 '라이브러리 설치 및 ART 전환시 발생할 수 있는 모든 문제점은 각자 본인에게 있다.'는 것을 분명하게 밝혀둔다. 이 패치는 안드로이드 4.4 킷캣이 설치된 퀄컴 AP를 탑재한 모든 기기(APQ8064-based devices)에 적용된다.(http://forum.xda-developers.com/showthread.php?t=2546120)


Q: Will this void my warranty?

A: Yes. Flash at your own risk.

Q: Can I use it?
A:
 Yes, if you're on any 4.4 ROM.

Q: How does this work?
A:
 This patch consists of two files that include optimized bionic and Dalvik libraries for any KitKat ROM.

Q: What is bionic?
A:
 It is a vital system library that provides i.a. basic math and memory access functions to every other library and application in Android.

Q: What is Dalvik?
A:
 In short, Dalvik is a virtual machine in which every not-native-code app runs. You can read more about it in a Wikipedia article.

Q: How do I benefit from this patch?
A:
 In two ways: bionic patch provides faster memory access and optimized some of the math operations, dalvik provides optimized Dalvik Virtual Machine library that allows faster code execution.

Q: Do I need this patch?
A:
 It depends on what ROM you are using:
  • if you're on stock ROM, you'll benefit from flashing both bionic and dalvik patches,
  • if you're using a custom ROM, you most probably don't need bionic patch, as these are already included in most custom ROMs. You'd benefit only from flashing dalvik patch (if it's not already included by your ROM maintainer, of course).

Q: Why aren't these patches included in stock ROM?
A:
 As for bionic - I don't know. Maybe that's because Google didn't want to include vendor-specific optimizations in AOSP or maybe simply because Qualcomm never posted them in Android Code Review to be merged. As for dalvik - because they are closed-source. Here'a a good explanation by @xboxfanj:
Quote:
Originally Posted by xboxfanj View Post
Part of the point of Nexus devices is that AOSP can produce nearly identical images minus GApps. Google would not use a proprietary dalvik as that is one of the core libraries. Using a proprietary dalvik would undermine AOSP. Although, an open libqc-dalvik or even just giving us that binary would be nice. Google could have a device specific extension similar to the adreno extensions onto renderscript and egl for dalvik. Proprietary dalvik won't happen, but an adreno extension could be cool.
Q: Where do these patches come from?
A:
 These have been authored by Qualcomm. Bionic patch comes from Code Aurora Forum, Dalvik library has been extracted from Moto X 4.4. ROM. Another good read by @xboxfanj:
Quote:
Originally Posted by xboxfanj View Post
CAF has all Qualcomm's bionic patches and slight dalvik tweaks, however, the dalvik patches that are used here in the Moto X and any QCOM (non-Nexus) device, are mostly closed source. If you look at the change here:https://www.codeaurora.org/cgit/quic...739455dfd3cf57

You will see that most of that change is supporting other libraries (libqc-opt and libqc-dalvik), which is where their optimizations are. Unfortunately, both of those are closed source. libqc-opt is included in QCOM ROM zips as a shared library, so we can use that, however, libqc-dalvik is a static library, so we can't pull that from anywhere, as it is included in the libraries themselves and not put in system. This means that our only option to get all of Qualcomm's dalvik optimizations is to use their binaries rather than building from source, since building from source would mean missing any optimizations brought by libqc-dalvik, libqc-sqlite, and libqc-skia (the last two haven't been included in any patch, but are QCOM static libraries).

TLDR: QCOM's dalvik optimizations are closed source, so we are forced to use their binaries.
Remember to thank @xboxfanj for his very useful posts!

Q: How do I use this patch?
A:
 Simple flash it over your current ROM in recovery. Remeber to wipe Dalvik Cache after flashing. Full wipe is not needed.

Q: How do I revert?
A:
 Simply flash over your current ROM and wipe Dalvik Cache afterwards. Full wipe is not needed.

Q: Can I flash it over an ODEXed ROM?
A:
 Yes, but it is strongly recommended to use a deodexed ROM if you want to use Dalvik patch.

Q: How will this affect my battery life?
A:
 It will be at least the same, if not better. Better performance = less CPU time spent on calculations = better battery life.

Q: I don't see any performance gains in some app, why is that?
A:
 The dalvik patch doesn't affect apps that use native libraries, i.e. you won't see much performance gain in Chrome etc.

Q: I'm on X kernel, can I use it?
A:
 Yes, use it with any kernel you like.

Q: Can I use it on other devices?
A:
 Yes, you can use this patch on every Krait device that uses AOSP-based ROM (examples: Nexus 5, Nexus 7 2013). Don't flash it on stock ROM, as they already include these optimizations (that includes Galaxy S4 and HTC One Google Play editions!).

Q: What if I use it on stock ROM and OTA arrives? Can I install the OTA straight away?
A:
 Not necessarily. Any modification to stock ROM can mean problems when installing an OTA.

Q: Can I use ART with this patch installed?
A:
 Yes, but you won't see any performance gains. In fact, with this patch Dalvik is faster than ART. I suppose ART will superseed Dalvik in performance in the future, but not yet.

Q: Where can I see some benchmark results before I flash?
A:
 Head over to Nexus 4 Benchmarks thread.
ATTACHED FILES
File Type: zip4.4_qc-optimized_dalvik.zip - [Click for QR Code] (572.4 KB, 954 views)
File Type: zip4.4_qc-optimized_bionic.zip - [Click for QR Code] (366.4 KB, 704 views)


1. 커널 플래싱(Kernal Flashing)을 위해서는 Clockworkmod가 필요하다. 과거 odin 을 이용한 커널 플래싱은 루팅 흔적(삼각형 마크)이 남았기에 흔적을 지우기 위해 JIG를 사용해야한다는 단점이 있었으나 Clockworkmod를 이용하면 커스텀 커널 바이너리 카운트에 영향을 주지 않으며 PC가 필요하지 않다. Clockworkmod를 설치하는 가장 간단한 방법은 Rom Manager(https://play.google.com/store/apps/details?id=com.koushikdutta.rommanager)를 이용하는 방법이다. Rom Manager를 이용하여 Clockworkmod를 설치한다.


2. 다운로드 받은 패치 파일을 SD카드에 위치시킨 후 Rom Manager를 실행하여 'SD Card에서 ROM 설치'를 클릭한 후 위치시킨 패치 파일(.zip)을 지정한 다음 '다시 시작과 설치'를 클릭하면 Recovery 모드(복구 모드)로 진입한다.


이미 Clockworkmod가 설치되어 있다면 Rom Manager를 이용하지 않고 휴대폰을 종료한 후 '전원버튼 + 볼륨버튼 아래키(▼)'를 길게 홀드하면 패스트 부트 모드로 진입되는데 여기서 볼륨버튼을 이용하여 Recovery mode로 진입해도 무방하다.


3. ClockworkMod Recover에서 볼륨버튼과 전원버튼을 이용하여 'Install zip' → 'choose zip from /sdcard' → 패치를 (/0)위치 시킨 경로로 접근하여 설치한다. 리부팅 후 런타임 변경시 처럼 기기에서 자동으로 설치된 앱을 최적화 한다.


 T.B의 SNS 이야기 블로그의 모든 글은 저작권법의 보호를 받습니다. 어떠한 상업적인 이용도 허가하지 않으며, 이용(불펌)허락을 하지 않습니다.

▲ 사전협의 없이 본 콘텐츠(기사, 이미지)의 무단 도용, 전재 및 복제, 배포를 금합니다. 이를 어길 시 민, 형사상 책임을 질 수 있습니다.

▲ 비영리 SNS(트위터, 페이스북 등), 온라인 커뮤니티, 카페 게시판에서는 자유롭게 공유 가능합니다.


T.B의 SNS이야기 소식은 T.B를 팔로윙(@ph_TB) 하시면 실시간으로 트위터를 통해서 제공 받을 수 있습니다.

728x90
반응형