Upload
phungdieu
View
247
Download
3
Embed Size (px)
Citation preview
XDA Developers’ Android™ Hacker’s Toolkit THE COMPLETE GUIDE TO ROOTING, ROMS AND THEMING
Jason Tyler with Will Verduzco
This work is a co-publication between XDA Developers and John Wiley & Sons, Ltd.
A John Wiley and Sons, Ltd, Publication
This edition first published 2012© 2012 John Wiley and Sons, Ltd.
Registered officeJohn Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com.
The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the under-standing that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought.
Trademarks: Wiley and the Wiley logo are trademarks or registered trade-marks of John Wiley and Sons, Inc. and/ or its affiliates in the United States and/or other countries, and may not be used without written permission. Android is a trademark of Google, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Ltd. is not associated with any product or vendor mentioned in the book.
XDA, XDA Developers is a trademark of JB Online Media, LLCA catalogue record for this book is available from the British Library.
ISBN 978-1-119-95138-4 (paperback); ISBN 978-1-119-96154-3 (ebook); 978-1-119-96155-0 (ebook); 978-1-119-96156-7 (ebook)
Set in 9.5/11.5 Minion Pro Regular by Indianapolis Composition Services
Printed in the United States by Courier Westford
PUBLISHER’S ACKNOWLEDGEMENTS
Some of the people who helped bring this book to market include the following:
Editorial and ProductionVP Consumer and Technology Publishing Director: Michelle LeeteAssociate Director–Book Content Management: Martin TribeAssociate Publisher: Chris WebbAssistant Editor: Ellie ScottDevelopment Editor: Shena DeucharsCopy Editor: Shena DeucharsTechnical Editor: Akshay DashrathEditorial Manager: Jodi JensenSenior Project Editor: Sara ShlaerEditorial Assistant: Leslie Saxman
MarketingAssociate Marketing Director: Louise BreinholtSenior Marketing Executive: Kate Parrett
Composition ServicesCompositor: Indianapolis Composition ServicesProofreader: Linda SeifertIndexer: Estalita Slivoskey
About the Authors
Jason Tyler has been an IT instructor and is currently Director of Technol-ogy for Typefrag.com. An avid Android hacker, Jason has been rooting and ROMing every Android phone he can get his hands on since the OG Droid.
Will Verduzco is a Johns Hopkins University graduate in neuroscience and is now currently studying to become a physician. He is also Portal Adminis-trator for XDA-Developers, and has been addicted to mobile technology since the HTC Wizard. Starting with the Nexus One, however, his gadget love affair has shifted to Google’s little green robot.
Contents
Foreword xvIntroduction 1
First Things First: What Is XDA? 1The Dragons that Lie Ahead 3Who This Book Is For 6What This Book Covers 6How This Book Is Structured 6What You Need to Use This Book 7
PART I: WHAT YOU NEED TO KNOW 9
Chapter 1: Android OS Internals: Understanding How Your Device Starts 11
The Penguin Down Below 12How Your Android Device Starts 13
Bootstrapping 13Adding a Custom Bootloader 15Understanding the Bootloader Process 15
Custom Recoveries: The Holy Grail 17Chapter 2: Rooting Your Android Device 21
Why Should You Root? 22Increasing the Service Life of the Device 22Fixing OEM Defects 23Increasing Capability 24Customizing the Device 25
Backing Up Data 26Contact Information 26Applications and Their Data 27Data on the SD Card 27
How You Can Root and Leave Your OEM’s Control 28OEM Flash Software 28Exploits 30Native Fastboot Flash 31Scripted and One-Click Methods 31
x Contents
Rooting Two Devices 32Nexus One 32HTC Thunderbolt 33
The Root of It All 34Chapter 3: The Right Tool for the Job 37
Ready, Set, . . . Wait I Have to Have What? 38Connecting a Phone to a Computer 38Hacking Tools 38
USB Cables 39USB Debugging 40What’s Driving This Thing? 41Using the Android Debug Bridge 42
Checking Device Connectivity 43Restarting the ADB Service 44Copying Files to and from Your Device 45Rebooting a Device 48
The Power of Fastboot 49Unlocking a Device 50Updating a Device 50Flashing a Device 50Rebooting a Device 51
Harnessing the Power of the Penguin with ADB Shell 51File System Navigation 52File Management 54File Access Permissions 57Redirection and Piping 60Concatenation 60
BusyBox: Giving the Penguin Back Its Power 61The dd Command 61The echo Command 62The md5sum Command 62
Chapter 4: Rooting and Installing a Custom Recovery 63How to Use Exploits 64
Exploit Scripts 64Exploit Applications 65Using a Script or Application on a Device 66
Hacking Utilities 68OEM Tools 68Developer Utilities 68Image Files 68
xiContents
Recovery Mode 69What Is Recovery Mode? 69Make It All So Easy: Get A Custom Recovery! 70
Using ClockworkMod Recovery 71Rebooting the Device 72Updating a Device from the SD Card 72Resetting a Device to Factory Condition 74Wiping the Cache 74Installing a Zip File from the SD Card 74Backing Up and Restoring a Device 76Mounting Partitions and Managing Storage 79Advanced Functions 79
Backup and Disaster Recovery 81Precautions for Success and Data Recovery 82Backing Up Applications 83Backing Up Through a Recovery Process 83Backing Up Through an Application 84What Happens If It Goes Really Wrong? 84
Chapter 5: Theming: Digital Cosmetic Surgery 87Changing the Look and Feel of Android 88
Theming the Launcher 89Theming with an Add-on Launcher 89
Tools Used in Theming 89APKManager 89Android SDK 90Eclipse 90A ROM of Your Choice 917-Zip 91Paint.NET 91Update.zip Creator 91Amend2Edify 92
The Editing Process 92Walkthrough for Creating Theme Files 92Walkthrough for Creating a Flashable ZIP File 97
Chapter 6: You’ve Become Superuser: Now What? 99Popular Multi-Device Custom ROMs 100
CyanogenMod 100Android Open Kang Project 101VillainROM 101
xii Contents
Kernel Tweaks 101Backlight Notifications 101Voodoo Enhancements 102Performance and Battery Life Tweaks 103
Root Applications 103SetCPU 103Adfree Android 104Chainfire 3D 104Titanium Backup 105
PART II: MANUFACTURER GUIDELINES AND DEVICE-SPECIFIC GUIDES 107
Chapter 7: HTC EVO 3D: A Locked Device 109Obtaining Temporary Root 110Using S-OFF and Permanent Root Requirements 111
Running the Revolutionary Tool 112Installing a Custom Recovery 115Installing the Superuser Binary 116Installing a SuperUser Application 117
Chapter 8: Nexus One: An Unlockable Device 119Root Methods Available 120Resources Required for This Walkthrough 120Walkthrough 121
Placing the Nexus One in Fastboot Mode 122Flashing a Boot Partition 123Getting Full Root Access 124Installing a Custom Recovery 125
Chapter 9: HTC ThunderBolt: A Tightly Locked Device 127Root Methods Available 128Resources Required for This Walkthrough 128Walkthrough 129
Pushing Files to the Device 129Gaining Temporary Root 130Checking a File’s MD5 Signature 131Writing the Temporary Bootloader 131Downgrading the Firmware 132Gaining Temporary Root to Unlock the MMC 133Rewriting the Bootloader 134Upgrading the Firmware 135
xiiiContents
Chapter 10: Droid Charge: Flashing with ODIN 137Resources Required for This Walkthrough 138Walkthrough 138
Connecting the Device to ODIN 138Flashing the Device 139
Troubleshooting 140Chapter 11: Nexus S: An Unlocked Device 143
Connecting the Device to a PC 144Resources Required for This Walkthrough 144Walkthrough 144
Unlocking the Device 144Flashing the Device with a Recovery 145Flashing the Device with the SuperUser
Application 146Chapter 12: Motorola Xoom: An Unlocked Honeycomb Tablet 147
Resources Required for This Walkthrough 148Walkthrough 148
Pushing the Root File to the SD Card 148Unlocking the Xoom 148Flashing the Device with a Recovery 149Flashing the Device with a Universal Root 150
Chapter 13: Nook Color: Rooting with a Bootable SD Card 153Resources Required for This Walkthrough 154Walkthrough 154
Creating a Bootable SD Card 155Booting the Device from the SD Card 155Making the Device More Usable 156
Appendix A: Setting Up Android SDK and ADB Tools 159Installing the Java Development Kit 160Installing the Android SDK 161Installing the Platform Tools 162Setting Up Windows Environment Variables 163
Index 165