Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • cool, yeah i havnt yet figured it out. im not even sure that the smal and baksmali jars have been updated to handle the new lollipop updates. i havnt been able to find any other stock roms that have been deodexed either so im assuming theres no fix yet. ill be working on it thos and if i come across anything ill let you know. thanks
    Are you sure you want to
    Your message goes here
  • I am. It’s something I’ve been using for work, and this version on Github needs to be updated. Haven’t yet tried to get this going for Lollipop. Keep in mind, that Lollipop uses ART, so there may not be a deodexing step as such. If you can figure it out, I’d appreciate knowing what you did.
    Are you sure you want to
    Your message goes here
  • are you still working on the aospplus project? ran into this while searching for google apps for 5.0 lollipop. im trying to use your deodex.py tool to deodex the apks so i can add them to my build but i ran into some trouble. was wondering if your still working on this. my gmail is valozuna361@gmail.com
    Are you sure you want to
    Your message goes here
    Be the first to like this
No Downloads

Views

Total Views
342
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
11
Comments
3
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. AOSP PlusAOSP builds with batteries includedJames PudererOttawa Android User GroupMay 13th, 2013+
  • 2. What is AOSP?● AOSP is the Android Open Source Project.● It contains all of the open sourced components ofAndroid.● You are free to download, modify, build, and distributeAOSP1● You can find instructions on downloading and buildingAOSP at http://source.android.com● AOSP can be built for most of the recent Googlebranded devices (Nexus).○ Nexus Galaxy○ Nexus 4, 7, 10○ Nexus S (<= 4.1)○ Motorola Xoom (<= 4.1)
  • 3. What AOSP isnt?What is it missing?● It may be missing some drivers○ You can get some of the proprietary drivers for your build: https://developers.google.com/android/nexus/drivers○ Not all of the drivers are are available. (e.g. Camera and GPS dontwork on Galaxy Nexus.)● It doesnt contain many of the Google applications andframeworks:○ Play Store○ Google Maps○ Youtube○ Face unlock○ etc.● Not exactly the same as a commercial device○ In fact, it looks pretty much like the emulator.
  • 4. Why? (does this matter)● Making changing to AOSP● Seeing what kind of effect these would haveon a real phone.● For example:○ Enabling SEAndroid enforcement and to see whateffect it would have on a real phone (with the Playstore).○ Developing an Embedded Android system, but goshit would be nice if your device had the Play storeduring development
  • 5. How?1. Build AOSP12. Create vendor directories23. Extract factory system image4. Deodex APK and framework files5. Identify the components you need6. Tailoring the vendor Makefiles7. Profit!
  • 6. If youre new to building AOSPI recommend this book!
  • 7. Build AOSPGo here: http://source.android.com/source/index.html...and do what it says.1If you havent done this before, Ill see you in a day ortwo.If youre successful, you should be able to flash a basicAOSP image onto your device.OK? Good?
  • 8. The aospplus templates include directories and Makefiles forNexus Galaxy, Nexus 4, and Nexus 7For the purposes of this tutorial, well focus on building for theNexus 4 (codename: mako).However, the same approach could be used for any of theother device, and extended to include new devices.Create the vendor directoriesUse my template on Github$ cd $ANDROID_BUILD_TOP$ cd vendor 1$ git clone git://github.com/jpuderer/vendor-aospplus.git aospplus
  • 9. Include our directory in the build--- BoardConfigVendor.mk.orig 2013-05-03 17:11:09.705229512 -0400+++ BoardConfigVendor.mk 2013-05-03 17:14:37.085224121 -0400@@ -17,3 +17,4 @@-include vendor/broadcom/$(LOCAL_STEM)-include vendor/lge/$(LOCAL_STEM)-include vendor/qcom/$(LOCAL_STEM)+-include vendor/aospplus/$(LOCAL_STEM)--- device-vendor.mk.orig 2013-05-03 17:10:30.393230534 -0400+++ device-vendor.mk 2013-05-03 17:09:51.393231548 -0400@@ -17,3 +17,4 @@$(call inherit-product-if-exists, vendor/broadcom/$(LOCAL_STEM))$(call inherit-product-if-exists, vendor/lge/$(LOCAL_STEM))$(call inherit-product-if-exists, vendor/qcom/$(LOCAL_STEM))+$(call inherit-product-if-exists, vendor/aospplus/$(LOCAL_STEM))In order for our aospplus components to be added to the build,we need make sure they get included by one of the makodevices Makefiles.1
  • 10. Extract factory system imageDownload factory image and extract system.img fileDownload a factory image for your device. For Nexusdevices, these can be downloaded from here:https://developers.google.com/android/nexus/imagesThe factory image will contain a zip file, which will contain asystem.img file. This file contains the compressed ext4filesystem for the devices /system directory.Make a copy of this file somewhere you can work on it.
  • 11. Extract factory system imageExtract the file tree from the system.img$ cp $ANDROID_BUILD_TOP/out/host/linux-x86/bin/simg2img ~/bin$ simg2img system.img system.full.img$ mkdir system.mnt$ mkdir system.factory$ sudo mount -n -o loop system.full.img system.mnt$ sudo cp -r system.mnt/* system.factory$ sudo umount -n system.mnt$ sudo chown -R ${USER}. system.factory 1$ rmdir system.mnt$ rm -r system.full.imgThe system.img file packaged with most phones is effectively aext4 filesystem that has been compressed. You can expand itby using the simg2img tool that is built as part of AOSP. Oncethe image has been expanded you can loopback mount it as youwould any other filesystem image.
  • 12. Compare system imagesFigure out what AOSP is missingNext, we want to compare the AOSP system directory with the factory system directory, to see whatcomponents and configuration files we might be missing.1I usually keep a pristine copy of system.factory and a system.aosp directory around for this purpose.$ cp -r $ANDROID_BUILD_TOP/out/target/product/ mako/system system.aosp$ diff -qr system.aosp system.factory$ ...You will need to use this information later to configure the vendor/aospplus/device/Makefiles. Youll want to come backto this when you start modifying the Makefiles.If youre using the aospplus template for one of the defined devices, you may not need to wory about this. Since wereassuming the mako device (Nexus 4), this analysis has already been done for you.
  • 13. Deodex the APK and framework files...but first, what is odexing/deodexing?An odexed file is basically an APK that has been preoptimized for fast loading. The .dex file thatnormally exists inside the APK or JAR file (which are really just a zip files) is removed from the APK,optimized, and is placed next to the .apk as an .odex file.The Android build system can be configured to preoptimize the files on APK files in /system/app, andthis is exactly whats happened to the factory images.1The documentation for dexopt details the optimizations:https://github.com/android/platform_dalvik/blob/master/docs/dexopt.htmlUnfortunately for us (and themers in general), the optimized .odex file has dependencies on theclasses in bootstrap class path, which for Android is everything under /system/framework. If wechange the framework files, the .odex files will not work.So we need to "deodex" the the .odex files, and package them back into the APK and JAR files.To do that, we need to use some tools to recompile the odex files back into odex files.You can find the tools here:2https://code.google.com/p/smali
  • 14. Deodex the APK and framework filesUsing the deodex.py script provided with the aospplus templates$ cd $ANDROID_BUILD_TOP/vendor/aospplus/$ cp -r $MY_SCRATCH_DIR/system.factory mako/proprietary/system$ utils/deodex.py mako/proprietary/systemFeel free to do some cleanup of the system directory if you wish, since not all files are needed.$ cd mako/proprietary/system$ rm -Rf bin build.prop fonts lost+found xbin
  • 15. Tailoring the MakefilesAndroid.mk and device-partial.mkThere are two make files that you will need to tailor for your device.vendor/aospplus/mako/proprietary/Android.mk tells AOSP how to install the prebuild each of the APKsfrom the factory image.vendor/aospplus/mako/device-partial.mk actually declares what will be added to the final systemimage for our device.● List of APKs to install1List of files to copy● Overrides for the devices system properties
  • 16. Tailoring the MakefilesAndroid.mkLOCAL_PATH:=$(call my-dir)ifeq ($(TARGET_DEVICE),mako)...include $(CLEAR_VARS)LOCAL_MODULE := CalendarGoogle 1LOCAL_SRC_FILES := system/app/$(LOCAL_MODULE).apkLOCAL_OVERRIDES_PACKAGES := Calendar 2LOCAL_MODULE_CLASS := APPSLOCAL_MODULE_OWNER := google 3LOCAL_MODULE_TAGS := optionalLOCAL_CERTIFICATE := PRESIGNEDLOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)include $(BUILD_PREBUILT)...endifDeclare the prebuild APKs you wish to include from the factoryimage.
  • 17. Tailoring the Makefilesdevice-partial.mkPRODUCT_COPY_FILES += vendor/google/mako/proprietary/system/media/bootanimation.zip:system/media/bootanimation.zip:google 1...PRODUCT_PACKAGES += Books BrowserProviderProxy CalendarGoogle ... 2PRODUCT_PROPERTY_OVERRIDES += ro.facelock.black_timeout=1250 ro.facelock.det_timeout=1500 ...Declare the APKs and other files you wish to include in yourbuild, along with any system properties you need to override.
  • 18. Thats it!Build and be merry.This should do it:$ cd $ANDROID_BUILD_TOP$ make installclean & make -j8For the truly paranoid:$ make clobber & make -j8Questions?Rebuild AOSP for your device as you did at the beginning.