Powerful Google developer tools for immediate impact! (2023-24 C)
Path to Surfdroid
1. The Path to SURFDROID
An Android Rom Building Journey
By
Paul Dutot
2. The Path to SURFDROID
Where did I get the idea to built a rom ?
Android Internals by Marko Gargenta at
● http://www.youtube.com/watch?v=1_H4AlQaNa0
Google Android Source Page
●
http://source.android.com/source/index.html
3. The Path to SURFDROID
What do you need ?
● Python 2.4 – 2.7
● Java Development Kit (JDK) 6 for
Gingerbread or JDK 5 for Froyo
● Git 1.5.4 or newer
● Dependencies listed on source.android.com
● Correct usb access for adb
4. The Path to SURFDROID
Update.zip Contents
Bootloader.bin – initial bootloader code
Boot.img – contains kernel and ramdisk
System.img – android system image
Recovery.img – system recovery image
Google directory containing update script &
binary
5. The Path to SURFDROID
Update.zip Structure ( Type 1)
6. The Path to SURFDROID
Update.zip Structure ( Type 2)
7. The Path to SURFDROID
The Type 1 Updater Script Function
● Mount the system Partition
● Copy the files into system
● Make symbolic links to xbin
● Set correct permissions on files and
directories
● Flash the boot.img file
8. The Path to SURFDROID
The Type 2 Updater Script Function
● Flashes the bootloader.bin
● Flashes the boot.img file
● Flashes the system.img file
● Flashes the recovery.img file
10. The Path to SURFDROID
Notion Ink Partition Information
2 7
BCT MSC
Boot Config data
3 8
PT SOS
Partition Table data
recovery.img
4 9
EBT LNK
bootloader data
bootloader.bin boot.img
5 10
NVC APP
bootloader data
microboot.bin system.img
6 11
MBT CAC
data data
mbtdata.img
11. The Path to SURFDROID
The NVFlash Utility & Recovery Modes
● Utility for directly flashing all partitions used
with forced recovery mode
● Use with care – only for advanced users
● Vol and + - normal recovery
● Vol and - - forced recovery mode
12. The Path to SURFDROID
Building Android Source
● Setup PATH variable
● Pull Down repo command and make
excutable
● Sync repo ….wait...wait
● Source build/envsetup.sh
● lunch full-eng
● make
13. The Path to SURFDROID
Android Source Directories
● Build – build system
● Device – device specific files
● Prebuilt – Prebuilt stuff including toolchains
and kernel
● Out – compilation output directory
● Vendor – vendor specific information
15. The Path to SURFDROID
The Next Stage... So What Do We Need ?
● Kernel – Prebuilt or Compiled
● A supported CM7 device
● Device dependant proprietary binary files
● Working boot.img and system.img
● Packaged Update.zip file
16. The Path to SURFDROID
Building the kernel
● Download the NI sources from
https://github.com/notionink/adam-kernel.git
● Get running config from tablet
sudo ./adb shell then cat /proc/config > config.gz
.sudo /adb pull <path to config file>/config.gz
unzip config.gz then rename .config in kernel directory
● Setup path variable then make ARCH= arm
CROSS_COMPILE=<path to cross compiler
toolchain>
17. The Path to SURFDROID
The Next Stage... So What Do We Need ?
● Kernel – Prebuilt or Compiled
● A supported CM7 device
● Device dependant proprietary binary files
● Working boot.img and system.img
● Packaged update.zip file
18. The Path to SURFDROID
Compile CM7
Main guide is here
● CyanogenMod Wiki
http://wiki.cyanogenmod.com/wiki/Viewsonic_G_Tablet:_Compile_CyanogenMod_%28Linux%29
19. The Path to SURFDROID
The Next Stage... So What Do We Need ?
● Kernel – Prebuilt or Compiled
● A supported CM7 device
● Device dependant proprietary binary files
● Working boot.img and system.img
● Packaged Update.zip file
20. The Path to SURFDROID
Copy Proprietary Binary Blobs
● Download CM7 source
● Start ADB server as root
● Connect tablet via USB
● Navigate to smb_a1002 directory
● Run ./extract-files.sh
● Files are copied into the vendor directory
and makefiles built
21. The Path to SURFDROID
The Next Stage... So What Do We Need ?
● Kernel – Prebuilt or Compiled
● A supported CM7 device
● Device dependant proprietary binary files
● Working boot.img and system.img
● Packaged update.zip file
22. The Path to SURFDROID
Compile CM7 stages
● install ADB via Android SDK
● Create directory and pull down CM7 repo
● Get proprietary blobs
● Download rom manager
● Install kernel in source tree
● Source build/envsetup.sh
● Brunch – choose option 36
24. The Path to SURFDROID
Building & Installing the update.zip file
● Copy the boot.img and system.img to
nvflash directory.
● Use the mkupdatezip.sh script to create
update.zip
● Copy update.zip to device internal or
external sd card. Flash via recovery mode
25. The Path to SURFDROID
Flashing the rom with NVflash
● Copy the boot.img and system.img to
nvflash directory.
● Use NVFLASH utility in forced recovery
mode to reflash entire device.
26. The Path to SURFDROID
Android Build Versions
● Build 1 – CM7 V.2.3.4 -broken wifi & rotation
● Build 2 – CM7 V.2.3.4 - wifi ok , rotation still broken
● Build 3-9 – CM7 V2.3.5 - libstagefrighthw.so included – all
build ok but boot loop on tablet at netrunner or
mediaservice start
● Build 10 - CM7 V.2.3.5 – libstagefrighthw.so working –
wifi,video,hdmi playback, rotation and working flash
● Build 11 – Build 10 plus custom splash screen
● Build 12 (in progress) – Build 11 plus titanium backup
preinstalled
27. The Path to SURFDROID
Common Rom Builders Tasks
● Fixing the 'broken' WIFI / Bluetooth
● Add Additional Apps
● Custom Splash Screen
● Custom Boot Animation
● Android Market
28. The Path to SURFDROID
Fixing the 'broken' WIFI
● Recompile Kernel module bcm4329.ko
against kernel in source tree
● Use compatible bcm4329.ko with associated
files
29. The Path to SURFDROID
Add Additional Applications
● Put Additional apk's in out directory
● Start brunch then crtl 'c'
● Make snod
● Copy system.img
30. The Path to SURFDROID
Custom Splash Screen
● Create your image at correct resolution-
1024 x600 in raw format
● Unpack Boot.img
● Convert image to rgb255 using to565
● ./to565 -rle < splash.raw > initlogo.rle
● Put initlogon.rle in ramdisk root directory
● Repack boot.img
31. The Path to SURFDROID
Custom Boot Animation
● Create your images at correct resolution-
1024 x600 in raw format
● Replace bootanimation.zip in source
32. The Path to SURFDROID
Android Market
● Modified Notion Hacks – Root and Market
Access script
● Apply as update.zip in recovery mode
33. The Path to SURFDROID
Last Things to Do
● Test it with some apps notably flash
● Release it !!!!!!!!!!!!
Thanx to all at tabletroms.com including
Blazingwolf, RaYmAn,Thinkdevoid in the irc
for their help