[Galaxy S I9000 Android Development] miki4242:
Hi all,

I've created a patchset which contains all diffs between:

- kernel/common from current AOSP Git branch android-2.6.29

- GalaxyS/linux-2.6.29 from GT-i9000_OpenSource.zip/GalaxyS_Kernel.tar.gz, dated July 12, 2010, latest publicly available AFAIK.

For a complete HOWTO, see bottom of this post.

This can be very useful, as it shows exactly what Samsung changed or added, including some very helpful comments.

I'm sure this will reveal a

boatload

of interesting info, I will report here what I've found so far as fast as I can, please join in the fray!

(Note: I've found it very nice to use Midnight Commander under Linux: it allows you to browse patches as if they were files on a virtual filesystem (patchfs).)

Good Luck! :)

The patch files:

Samsung's GT-I9000 patches to Android's Linux kernel version 2.6.29 for Eclair.

Zip containing single patch file: link

Zip containing patches split into individual files: link

Hopefully all info that comes out of this can soon be Wikified.

UPDATE:

Supercurio has pointed out what appears to be the reference Samsung Git repository at git.kernel.org: link.

TMC_Sherpa has been working on a very interesting project here on XDA, comparing sources for different SGS models: link

Thanks for the information!

Here come the updates:

Samsung appear to have borrowed quite a bit of code from Simtec Electronics (an embedded systems supplier) and even from the OpenMoko project :)

They also used a (possibly customized) external tree from the Video4Linux project. I'll try to merge that into my tree, find the exact point in history for their merge. This will reduce the patch size somewhat.

A selection of files that may be of interest:

# Default kernel configs. There are quite a few board revisions out there, kernel hackers and ROM chefs, please take note!

# The .config used in default build is aries_rev03_defconfig with a custom initramfs, so you need to point CONFIG_INITRAMFS_SOURCE to the place where you store yours.

GalaxyS/linux-2.6.29/arch/arm/configs/aries_*

GalaxyS/linux-2.6.29/arch/arm/configs/jupiter_*

# Hardware setup and GPIO configuration (including GPS). Yay!

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/gpio-core.h

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/gpio.h

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/gpio-jupiter.h

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/gpio-p1p2.h

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/mach-jupiter-gps.c

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/mach-jupiter.c

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/jupiter-rfkill.c

# Device memory maps

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/map.h

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/memory.h

# Definitions used with the param.lfs file system, including the kernel boot commandline.

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/param.h

# Jack and device detection driver

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/sec_jack.c

GalaxyS/linux-2.6.29/arch/arm/mach-s5pc110/include/mach/sec_jack.h

# Some interesting customizations...

GalaxyS/linux-2.6.29/drivers/cpufreq

GalaxyS/linux-2.6.29/kernel/power/main.c

# Another 'TRS' headset jack detector driver. Is this actually used?

GalaxyS/linux-2.6.29/drivers/input/trs_connector.c

# Quantum, Melfas, S3C (dev board?) touchscreen drivers and firmware blobs, new flip touch driver

GalaxyS/linux-2.6.29/drivers/input/touchscreen

# S3C, Melfas, Cypress touch keypad drivers and firmware blobs

GalaxyS/linux-2.6.29/drivers/input/keyboard

# Camera driver

GalaxyS/linux-2.6.29/drivers/media/video/samsung/fimc

# (HW accelerated?) JPEG driver

GalaxyS/linux-2.6.29/drivers/media/video/samsung/jpeg_v2

# (HW accelerated) AV codecs, with 'firmwares' (the only binary blobs (wrapped in byte arrays) I've been able to find in this kernel. Not bad, Samsung!)

GalaxyS/linux-2.6.29/drivers/media/video/samsung/mfc40

GalaxyS/linux-2.6.29/drivers/media/video/samsung/mfc50

# Image rotator driver

GalaxyS/linux-2.6.29/drivers/media/video/samsung/rotator

# Transport Stream Interface (for digital TV?)

GalaxyS/linux-2.6.29/drivers/media/video/samsung/tsi

# TV-out driver

GalaxyS/linux-2.6.29/drivers/media/video/samsung/tv20_ap

# More weird tweaks, completely reworked resume behaviour...

GalaxyS/linux-2.6.29/drivers/mmc

# Added battery measurement driver for S5PC110

GalaxyS/linux-2.6.29/kernel/drivers/power

# Added Maxim 8698 and 8998 voltage regulator drivers

GalaxyS/linux-2.6.29/drivers/regulator/

# Added accelerometer, compass and proximity sensor drivers

GalaxyS/linux-2.6.29/drivers/sensor

# Added serial port (UART) driver for Samsung SoCs

GalaxyS/linux-2.6.29/drivers/serial

# Android and Samsung have different ideas about this...

GalaxyS/linux-2.6.29/drivers/staging/android/lowmemorykiller.c

# Added Flash drivers: TinyFSR, Flex-OneNAND and LinuStoreIII

# This could be interesting to study in relation to RFS I/O bottleneck woes.

GalaxyS/linux-2.6.29/drivers/tfsr

# Samsung custom USB setup, includes VendorIDs and ProductIDs.

GalaxyS/linux-2.6.29/drivers/usb/gadget

# USB OTG driver. Does this actually work on the SGS?

GalaxyS/linux-2.6.29/drivers/usb/host

# Samsung LCD panel drivers (probably not interesting for SGS) but there is the mDNIe driver in there somewhere... Nice!

GalaxyS/linux-2.6.29/drivers/video/samsung

# SGS I9000 boot logos. These are among the things that make the patch so large.

GalaxyS/linux-2.6.29/drivers/video/samsung/logo_rgb24_wvga_landscape.h

# This one is disabled entirely...

GalaxyS/linux-2.6.29/drivers/video/samsung/logo_rgb24_wvga_portrait.h

# Obviously, some kernel module needs do_sync() . Hmm... RFS maybe? Why?

GalaxyS/linux-2.6.29/fs/sync.c

# Customization to FAT FS, comment marked: /* 2009-06-25/ Kyo.oh/ workaround code for hiding /sdcard/sd/

# Lag fixers, ROM chefs: take note!

GalaxyS/linux-2.6.29/fs/fat/namei_vfat.c

# Changes to YAFFS2. Hmm... Why don't they actually use the YAFFS2 driver?

GalaxyS/linux-2.6.29/fs/yaffs2

# Maybe this can help with deciphering flash setup?

GalaxyS/linux-2.6.29/include/linux/fsr_if.h

# Kernel log via USB

GalaxyS/linux-2.6.29/kernel/printk.c

# GAForensic? What's that?

GalaxyS/linux-2.6.29/kernel/sched.c

# Small Samsung(/AOSP?) changes, experimental drivers for several Wolfson audio chips, including the WM8994. (This is what I am working on mainly ATM.)

GalaxyS/linux-2.6.29/sound

HOWTO create your own (Linux only for the moment, sorry :) ).

This assumes you have the following tools available on your system: (ba)sh, diff, file, filterdiff (from patchutils package), find, fromdos (from frotodos package) git (from any of the Git packages), grep, gzip, splitdiff (from patchutils package), tar, unzip, zip (optional), and a web browser ( :) ).

# Creating a patchset for Samsung's GT-I9000 changes
# to the Android kernel

# Change to Android build dir if needed
# cd android

# Download SGS kernel source
# % Browse to http://opensource.samsung.com/
# % Click on 'Mobile' in top menubar
# % Choose file to download
# % Accept license

# [While the download is churning away...]

# Create dir which will hold the AOSP kernel Git repositories
mkdir kernel

# Clone the AOSP common kernel tree, android-2.6.29 (Eclair) branch
git clone -b android-2.6.29 git://android.git.kernel.org/kernel/common.git kernel/common

# Unpack source zip and kernel
unzip GT-I9000_OpenSource.zip
tar vxzf GalaxyS_Kernel.tar.gz

# Some files in Samsung's source have MS-DOS style, Unix style, and
# even mixed MS-DOS/Unix style line endings. Convert these to Unix style.
# Be careful not to touch the module binaries in GalaxyS/modules
# (unless you don't mind recompiling them.)
# This may take a while...
find GalaxyS -type f | xargs -n 1 file | LANG=C grep 'terminators$' | \
while read LINE; do FILE=${LINE%%:*}; fromdos -p "$FILE"; done

# Create initial raw patchset
# This may take a while...
diff -uprN kernel/common GalaxyS/linux-2.6.29 > android-2.6.29_GT-I9000.patch-raw

# Clean up unneeded patches
filterdiff -x '*/.git*' -x '*/.mailmap' -x '*/Module.symvers' android-2.6.29_GT-I9000.patch-raw > android-2.6.29_GT-I9000.patch

# Split the patch into multiple files
mkdir android-2.6.29_GT-I9000_patches
cd android-2.6.29_GT-I9000_patches
# splitdiff uses the dirname of the patch as directory to store files(!)
# so symlink it in here temporarily.
ln -s ../android-2.6.29_GT-I9000.patch
splitdiff -a -d android-2.6.29_GT-I9000.patch
rm android-2.6.29_GT-I9000.patch
cd ..

# Gzip the patch
gzip android-2.6.29_GT-I9000.patch

# Tar up the patchset
tar cvzf android-2.6.29_GT-I9000_patches.tar.gz android-2.6.29_GT-I9000_patches/

# Optionally, zip it up.
# zip android-2.6.29_GT-I9000_patches.zip android-2.6.29_GT-I9000_patches/*

# Done!

EDIT: Added TRS connector detection driver, touchscreen and touch keypad drivers