Contents

Introduction xxv

Chapter 1: Mobile 1 Going Mobile 1 A Short History: From Big Iron to Mighty Mouse 2 Changing Focus 3 Turning Points 4 The Generational Divide 5 Netbooks, Linux, and 6 A Giant’s Strength in a Dwarf’s Arm 8 Summary 9

Chapter 2: The Development Environment 11 Getting Started 12 Getting Familiar with the Ubuntu Mobile Environment 12 VirtualBox 12 KVM/QEMU 21 Using QEMU 21 ARM on QEMU 22 Using KVM 23 NETWORKING 25 Networking in VirtualBox 25 Networking in KVM/QEMU 26 Advanced Networking on VirtualBox and KVM/QEMU 26 Using the Bridge in VirtualBox 28 Using the Bridge in KVM 29 Sharing Files BetweenCOPYRIGHTED Guests and Host MATERIAL 29 Sharing Files Between Guests and Host with Advanced Networking 30 Building Your Own Virtual Image 31 Working with Images 31 Building Your Own Image 32 Installing Applications inside the Image 33 Increasing a Downloaded Image Size 34 Summary 34

fftoc.inddtoc.indd xxvv 110/6/090/6/09 99:14:45:14:45 AAMM Contents

Chapter 3: Power Management 35 Introduction 35 Power Saving States 36 Power Management Packages 36 pm-utils 37 pm-suspend 37 pm-hibernate 37 pm-suspend-hybrid 37 pmi action 38 How pm-utils Works 38 Gnome-Power-Manager 40 Gnome-Power-Statistics 40 Device Kit Power 41 The Quality of Service: QoS Interface 43 Controlling Radio Transmitters 44 RFKILL 45 Bluetooth 45 Investigating Power Usage 46 Battery Testing 47 Preparing to Run the Tests 47 Phoronix Test Suite 47 Battery Comparisons 48 Comparing Like-to-Like 50 Summary 51

Chapter 4: Application Development 53 Ubuntu Mobile Releases 54 Creating a New Application 55 Application Design 55 Free Desktop Standards 56 The Desktop Entry Specification 56 The Desktop Application Autostart Specification 57 XDG Base Directory Specification 57 Desktop Menu Specification 57 Hildon: An Application Framework for Handheld Devices 58 What Is Hildon in Terms of Code? 58 Creating the Program 58 Menus 59 Toolbars 59 Window-Specific Settings 59 Program-Wide Settings 59

xvi

fftoc.inddtoc.indd xvixvi 110/6/090/6/09 9:14:459:14:45 AMAM Contents

Hibernation 60 Putting Hildon Together 60 Hello World 60 Other Toolkits 64 Signals 65 Layout 66 Horizontal Boxes 66 Vertical Boxes 66 Glade 66 Handling the .glade File 69 70 QT 75 EFL 79 Canola 81 Elementary 81 What Key Technologies Do I Need to Know to Develop Applications for a Mobile Device? 82 D-Bus 82 Object Paths and Bus Names 83 Exporting Objects with D-Bus 84 Connect to a D-Bus Signal 85 Useful D-Bus Command-Line Applications 85 D-Bus Viewer 85 D-Bus Send 87 D-Bus Monitor 87 D-Bus Launch 88 D-Feet 88 D-Bus Security 89 PolicyKit 90 GConf 91 Notifications 93 Putting All the Concepts Together 94 Summary 103

Chapter 5: Application Packaging 105 Background and Important Tools 105 Packaging and Using a PPA 108 Initial Debianization 109 rules 109 changelog 112 control 112

xvii

fftoc.inddtoc.indd xviixvii 110/6/090/6/09 9:14:469:14:46 AMAM Contents

copyright 113 Other Files 114 Building the Package 115 Uploading to a PPA 115 REVU 116 RFA Packages 117 Creating Your Own Repository 118 Simple Repository 118 Automatic Repository 118 Setting Up a Repository 118 Adding Packages to a Repository 119 Removing Packages From a Repository 119 Backporting KVM 119 PBuilder 120 Configuring PBuilder 120 Performing Actions on PBuilder 123 Creating a Distribution Environment 124 Building a Package to a Specific Release 124 Updating the PBuilder Environment 124 Using pdebuild 124 Configuring Actions 125 Additional Hook Manipulation with PBuilder 125 Hook Script Resource 126 Mount Bind a Package Repository for Use with PBuilder 126 Ubuntu Policy 126 Categories 126 Sections 127 Summary 127

Chapter 6: Application Selection 129 Business Users 129 Documents 130 A Practical Example 131 Multimedia Users 131 A Practical Example 132 Useful Keybindings in the Entertainer GUI 133 Social Network Users 134 A Practical Example 134 Set Up the Environment 136 Copy the Gadget 136 Modify It 136

xviii

fftoc.inddtoc.indd xviiixviii 110/6/090/6/09 9:14:469:14:46 AMAM Contents

Location-Aware Users 138 A Practical Example 138 Background 138 Implementation 139 Test the Gypsy to GPS Connection 142 Interaction with the GPS Daemon 142 D-Bus and HTTP Requests 143 Summary 146

Chapter 7: Theming 147 What Is a Theme? 147 Where Are Themes Located in the Filesystem? 148 What Is a Theme Engine and Where Are They Located? 148 Theming Ubuntu MID 148 What Happens When a MID Device Boots? 149 Modifying Themes 150 A Useful Tool When Working with Themes 150 Theme Structure 151 The theme.xml File 151 The gtkrc File 152 Customizing a gtkrc File 152 Padding 153 Styles 153 Colors 153 Applying the Style 154 Theming Ubuntu MID 154 Manually Theming MID 154 Automatically Theming MID 156 Theming Ubuntu Netbook Remix 157 Boot Splash 158 Creating a gdm Theme 158 Customizing the Netbook Launcher 159 Performance Testing of Themes 160 Test the Human Theme 160 Comparisons 160 X Window Testing 162 Summary 163

Chapter 8: Kernel Fine-Tuning 165 Ubuntu MID Kernel Overview 165 Kernel-Tuning Methods 165 Create an Ubuntu Package 166 Create a Debian Package 172 xix

fftoc.inddtoc.indd xixxix 110/6/090/6/09 9:14:479:14:47 AMAM Contents

Updating a Customized Kernel Tree 175 Updating an Ubuntu Kernel Tree 175 Update a Non-Ubuntu Kernel Tree 181 Dynamic Kernel Module Support 181 Inside the DKMS Framework 182 Basic DKMS Commands 183 Summary 186

Chapter 9: Testing and Usability 187 Why Test? 187 Ubuntu Desktop QA 188 Mago — A Desktop Testing Initiative 188 Building an Application for Testing 189 Getting Started 189 Application Creation 190 Testing with Mago 193 Adding the Browser Test to Mago 193 Linux Standards Base and Certification 196 Installing the LSB Application Testkit 196 Running the LSB Application Testkit 196 Other Testing Tools 197 Phoronix Test Suite 197 PBuilder for Automating the Testing of Packages 200 Other Useful Linux Performance Testing Tools 201 ps 201 top 201 time 201 procinfo 201 free 202 memstat 202 memcheck and 202 Latencytop 203 Testing Strategies 203 Basic 203 Advanced 204 Compliance 204 Bug Reporting 205 If You Find a Bug . . . 205 Filing a Bug Report Automatically 206 Reporting a Bug from the Command Line 206 Summary 206

xx

fftoc.inddtoc.indd xxxx 110/6/090/6/09 9:14:479:14:47 AMAM Contents

Chapter 10: Tips and Tricks 207 Improving Boot Speed 207 Hard Coding Modules 207 Creating a /tmp That Is Half the Size of Physical RAM 208 Energy Tips 208 Recharging Correctly 209 Laptop Mode 209 Getting to Know the Battery on a Device 210 CPUFREQ and Governors 211 Use Power Management Settings on Disks 211 Disabling atime 212 Turning Off Background Services 212 Adobe Flash 213 Configuring the Touchscreen 214 Watching Hard Disk Activity 217 Summary 218

Chapter 11: Putting It All Together 219 Important Things to Consider 219 Check If the Device Architecture Is Supported by Ubuntu 220 Checking the Hardware 220 Fine-Tuning the Kernel 221 Defining Power Policies 221 Is It an Embedded System? 221 Customizing the User Interface 222 Boot Selector 222 Display Manager 223 GDM 224 Pre-Configuring GDM 224 Setting the Default Ubuntu, XFCE, and Hildon Behaviors 224 Fine-Tuning the Build Process 225 Setting Up a Repository 225 Caching Packages with approx 225 Creating a Default Ubuntu Image 226 Choosing Which Type of Installer to Use 226 When to Use Debian-Installer (Ubuntu Alternate Image) 226 When to Use Ubiquity (Ubuntu Desktop Image) 226 Getting Started on the Image: Preparing the Environment 226 Finally, Building the Default ISO 229

xxi

fftoc.inddtoc.indd xxixxi 110/6/090/6/09 9:14:479:14:47 AMAM Contents

Building a Customized Ubuntu Image 230 Inside Germination 231 Germinating the Seeds 232 An Example: Germinating Ubuntu Netbook Remix 234 Packages and Repositories 235 Generating Metapackages the Ubuntu Way 235 Building the metapackage 236 Generating Metapackages the Simple Way 238 Preseeding the Installer 239 Adding Packages to the Image 240 Finally, Build the Custom ISO 240 Ubuntu Policies, Trademarks, Copyright, and Common Sense 240 So What Is a Derived Distribution? 241 When to Use the LGPL 241 Summary 242

Chapter 12: Mobile Directions 243 Choice, Change, and Opportunity 244 Evolution and Software Development 246 Darwin 247 Mendel 247 Mayr 248 Frankenstein 248 Big Ideas to Think About 249 The Politics of Technology 249 The Next Billion 249 Sensory Overload 249 Cloud Computing 250 ARM Wrestling 250 Razors and Blades 251 Free Lunch 251 Computing on the Edge 251 The Future 253 Ubuntu, Linux, and Mobile Computing 254 Summary 255

Chapter 13: Common Problems and Possible Solutions 257 The Boot Process Stops 257 Application Icon Does Not Appear 258 Performing a Dual Boot 259 Setting a Flag Automatically 259

xxii

fftoc.inddtoc.indd xxiixxii 110/6/090/6/09 9:14:489:14:48 AMAM Contents

Using USB 260 Running Ubuntu on Freerunner 260 Running Ubuntu on Arima 261 Ubuntu Intrepid UMPC Project 261 Installing Ubuntu Netbook Remix on a UMPC 261 Using 261 Joining the Ubuntu Mobile Developers Team 262 Using KVM or QEMU 262 Graphical Corruption 262 Poor Performance 263 Summary 263

Appendix A: Ubuntu’s Right ARM 265

Appendix B: Usage 277

Appendix : Hosting Your Project on Launchpad 287

Appendix D: Desktop Power Applet Code 291

Appendix E: D- Bus: An Overview 297

Index 307

xxiii

fftoc.inddtoc.indd xxiiixxiii 110/6/090/6/09 9:14:489:14:48 AMAM fftoc.inddtoc.indd xxivxxiv 110/6/090/6/09 9:14:489:14:48 AMAM