[Android-kernel] Android kernel change

Source: Internet
Author: User

What changes does Google make in the kernel?

A company compared the standard kernel and Android kernel, and found that Google modified 75 files and added 88 files. The company also annotated these modified and new files.

Goldfish -- 44 files

Kernel/ARCH/ARM/Mach-goldfish

Kernel/include/ASM-arm/arch-goldfish

The android simulator runs a virtual CPU called "goldfish" by Google. The goldfish runs the arm926t Instruction Set (arm926t belongs to the armv5 architecture) and simulates input and output, such as keyboard input and LCD output. This simulator is actually developed on qemu, and the input and output are based on libsdl.

The goldfish interface in the kernel implements some interfaces of the virtual "goldfish" CPU. If you want to run Android on a real device, these interfaces must be removed.

For more information, see the http://www.arm.com/products/CPUs/ARM926EJ-S.html.

 

Yaffs2 -- 35 files

Kernel/fs/yaffs2

Unlike PCs, files are stored on hard disks. Mobile phones use flash as storage media. HTC G1 uses nandflash, which is widely used and has many types (SLC, MLC, etc ), the storage density is getting higher and higher (there are dozens of GB nandflash), and the price is getting lower and lower.

Yaffs2 is a file system dedicated to flash. "yaffs2" is short for "yet another flash file system, 2nd Edition. Yaffs2 provides an efficient nandflash access interface for the Linux kernel. However, nandflash support is not included in the 2.6.25 kernel, So Google added support for nandflash.

 

Bluetooth -- 10 files

Google modified 10 files in the Bluetooth protocol stack. These changes solve some significant bugs related to Bluetooth headsets and some functions related to Bluetooth debugging and access control.

 

Scheduler -- 5 files

The android kernel also modified the process scheduling and clock-related policies, which is more in-depth. The purpose and effect can be found after a period of time.

 

New feature for Android-28 files

In addition to fixing some bugs and other changes, Android also adds some new "subsystems" which are important.

 

IPC Binder

IPC binder is an IPC (inter-process communication) mechanism. It enables a process to provide services for other processes-or call an API through a standard Linux system. The concept of IPC binder originated from a company called "Be. Inc" and was used in Palm software before Google.

Low memory killer

In fact, there is already a similar feature in the kernel called "oom killer", that is, out of memory killer. When the memory is insufficient, the policy will try to end a process. I don't know why Google implemented this policy again.

Ashmem

Ashmem, full anonymous shared memory, translated into Chinese, is anonymous shared memory. This feature enables the process to share large volumes of memory. For example, the system can use ashmem to save some icons, and multiple applications can access the shared memory to obtain the icons. Ashmem provides a way for the kernel to recycle these used shared memory blocks. If a process tries to access these recycled memory blocks, it will get an incorrect return value, so that it can re-allocate memory blocks and initialize data.

Ram console and Log Device

For ease of debugging, Android adds a function that allows debugging information to be input into a memory block. In addition, an independent Log Module is added to Android, so that processes in the user space can read and write log messages and debug and print information.

Android debug Bridge

Debugging of embedded devices is indeed troublesome. To facilitate debugging, Google designed this debugging tool, which can be called "ADB". Using USB as the connection method, ADB can be seen as a set of protocols linking Android devices and PCs.

Android also adds other things, such as real-time clock, switch, and timed gpio.

 

Added the android driver. The corresponding directory is:

Kernel/Drivers/android

Mainly divided:

Android IPC: binder (Binder. c)

Android log system: logger (logger. c) Android power management: Power (power. c) android alarm clock management: Alarm (alarm. c)

Android memory Console: ram_console (ram_console.c) gpio controlled by the android clock: timed_gpio (timed_gpio.c)

The switch processing is added, and the corresponding directory is:

Kernel/Drivers/switch/

A new shared memory processing method is added, and the corresponding files are:

Kernel/MM/ashmem. c


Other patches for the Linux-2.6.25 kernel, such as Bluetooth, are not analyzed in detail here


In addition, the driver files related to the goldfish platform are as follows:

1. character output device:

Kernel/Drivers/Char/goldfish_tty.c

2. Image Display Device: (frame buffer)

Kernel/Drivers/Video/goldfishfb. c

3. keyboard input device:

Kernel/Drivers/input/keyboard/goldfish_events.c

4. RTC device: (real time clock)

Kernel/Drivers/RTC/rtc-goldfish.c

5. USB device:

Kernel/Drivers/USB/gadget/android_adb.c

6. SD card device:

Kernel/Drivers/MMC/host/goldfish. c

7. Flash devices:

Kernel/Drivers/MTD/devices/goldfish_nand.c

Kernel/Drivers/MTD/devices/goldfish_nand_reg.h

8. LED device:

Kernel/Drivers/LEDs/ledtrig-sleep.c

9. Power supply device:

Kernel/Drivers/power/goldfish_battery.c

10. audio device:

Kernel/ARCH/ARM/Mach-goldfish/audio. c

11. Power Management:

Kernel/ARCH/ARM/Mach-goldfish/PM. c

12. Clock management:

Kernel/ARCH/ARM/Mach-goldfish/Timer. c

 

Power Management -- 5 files

Power management is very important for mobile devices, and is also the most complex and difficult to develop. Google has added a new power management system, which does not include APM and DPM.

 

Other modifications-36 files

In addition to the above changes, there are also some minor changes, such as the additional debugging functions, keyboard backlight control, TCP network management, and so on, involving 36 files.

 

According to the above, Google has made great changes to the standard kernel. Compared with other projects, such as Nokia n810 and openmoko, the kernel change only adds support for a platform. Therefore, the fastest and most possible method for porting is to add platform support on the Kernel used by Google.

Some developers have patched Google's 2.6.25 kernel and directly applied it to their own developed kernel-of course, their own kernel should also be 2.6.25; otherwise, problems may occur.

 

Kernel information on the simulator

Kernel information on the simulator

Run emulator-show-kernel-AVD <your AVD Name>

Uncompressing Linux ...................................... ........................................ ...... done, booting the kernel.
Emulator: emulator window was out of view and was recentred

Linux version 2.6.25-00350-g40fff9a (android-build@apa27.mtv.corp.google.com) (GCC version 4.2.1) #1 Wed Jul 23 18:10:44 PDT 2008
CPU: ARM926EJ-S [41069265] Revision 5 (armv5tej), Cr = 00003137
MACHINE: goldfish
Memory Policy: ECC disabled, data cache writeback
Cpu0: D vivt write-through Cache
Cpu0: I cache: 4096 bytes, associativity 4, 32 byte lines, 32 sets
Cpu0: D cache: 65536 bytes, associativity 4, 32 byte lines, 512 Sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 24384
Kernel command line: qemu = 1 Console = ttys0 Android. checkjni = 1 Android. qemud = ttys1 Android. NDNS = 2
Unknown boot option 'android. checkjni = 1': ignoring
Unknown boot option 'android. qemud = ttys1': ignoring
Unknown boot option 'android. NDNS = 2': ignoring
PID hash table entries: 512 (Order: 9, 2048 bytes)
Console: Color dummy device 80x30
Dentry cache hash table entries: 16384 (Order: 4, 65536 bytes)
Inode-Cache hash table entries: 8192 (Order: 3, 32768 bytes)
Memory: 96 MB = 96 MB total
Memory: 94268kb available (2380 K code, 445 K data, 100 k init)
Mount-Cache hash table entries: 512
CPU: Testing write buffer coherency: OK
Net_namespace: 152 bytes
Android_power_init
Android_power_init done
Net: Registered protocol family 16
Net: Registered protocol family 2
IP Route cache hash table entries: 1024 (Order: 0, 4096 bytes)
TCP established hash table entries: 4096 (Order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (Order: 2, 16384 bytes)
TCP: Hash Tables configured (established 4096 bind 4096)
TCP Reno registered
Checking if image is initramfs... it is
Freeing initrd memory: 136 K
Goldfish_new_pdev goldfish_interrupt_controller at ff000000 IRQ-1
Goldfish_new_pdev goldfish_device_bus at ff001000 IRQ 1
Goldfish_new_pdev goldfish_timer at ff003000 IRQ 3
Goldfish_new_pdev goldfish_rtc at ff010000 IRQ 10
Goldfish_new_pdev goldfish_tty at ff002000 IRQ 4
Goldfish_new_pdev goldfish_tty at ff011000 IRQ 11
Goldfish_new_pdev smc91x at ff012000 IRQ 12
Goldfish_new_pdev goldfish_fb at ff013000 IRQ 13
Goldfish_new_pdev goldfish_audio at ff004000 IRQ 14
Goldfish_new_pdev goldfish_memlog at ff006000 IRQ-1
Goldfish_new_pdev goldfish-battery at ff014000 IRQ 15
Goldfish_new_pdev goldfish_events at ff015000 IRQ 16
Goldfish_new_pdev goldfish_nand at ff016000 IRQ-1
Goldfish_new_pdev goldfish-switch at ff017000 IRQ 17
Goldfish_new_pdev goldfish-switch at ff018000 IRQ 18
Goldfish_pdev_worker registered goldfish-Switch
Goldfish_pdev_worker registered goldfish-Switch
Goldfish_pdev_worker registered goldfish_nand
Goldfish_pdev_worker registered goldfish_events
Goldfish_pdev_worker registered goldfish-Battery
Goldfish_pdev_worker registered goldfish_memlog
Goldfish_audio_probe
Goldfish_pdev_worker registered goldfish_audio
Goldfish_pdev_worker registered goldfish_fb
Goldfish_pdev_worker registered smc91x
Goldfish_pdev_worker registered goldfish_tty
Goldfish_pdev_worker registered goldfish_tty
Goldfish_pdev_worker registered goldfish_rtc
Goldfish_pdev_worker registered goldfish_timer
Goldfish_pdev_worker registered goldfish_device_bus
Goldfish_pdev_worker registered goldfish_interrupt_controller
Ashmem: initialized
Installing knfsd (Copyright (c) 1996 okir@monad.swb.de ).
Yaffs Jul 23 2008 18:10:35 installing.
Io scheduler Noop registered
Io scheduler anticipatory registered (default)
Io scheduler deadline registered
Io scheduler CFQ registered
Allocating frame buffer 320*480, got ffc10000
Console: switching to color frame buffer device 40x30
Console [ttys0] Enabled
BRD: module loaded
Loop: module loaded
NBD: Registered device at major 43
Smc91x. C: V1.1, Sep 22 2004 by Nicolas Pitre <nico@cam.org>
No irqf_trigger set_type function for IRQ 12 (goldfish)
Eth0: smc91c11xfd (Rev 1) at c6800000 IRQ 12 [Nowait]
Eth0: Ethernet ADDR: 52: 54: 00: 12: 34: 56
Goldfish NAND dev0: Size 4000000, page 2048, extra 64, erase 131072
Goldfish NAND dev1: Size 4000000, page 2048, extra 64, erase 131072
Goldfish NAND dev2: Size 4000000, page 2048, extra 64, erase 131072
Mice: PS/2 mouse device common for all mice
* ** Events probe ***
Events_probe () ADDR = 0xc6804000 IRQ = 16
Events_probe () keymap = qwerty2
Input: qwerty2 as/class/input/input0
Goldfish_rtc: RTC core: Registered goldfish_rtc as rtc0
Logger: created 64 K log 'Log _ main'
Logger: created 64 K log 'Log _ events'
Logger: created 64 K log 'Log _ Radio'
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
TCP cubic registered
Net: Registered protocol family 1
Net: Registered protocol family 17
RPC: Registered UDP Transport module.
RPC: Registered TCP transport module.
802.1Q VLAN support v1.8 Ben greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFP support v0.3: implementor 41 architecture 1 Part 10 Variant 9 rev 0
Goldfish_rtc: setting system clock to 07:43:01 UTC (1230882181)
Freeing init memory: 100 K
Init: cannot open'/initlogo. RLE'
Yaffs: Dev is 32505856 name is "mtdblock0"
Yaffs: passed flags ""
Yaffs: Attempting MTD mounted on 31.0, "mtdblock0"
Yaffs: Dev is 32505857 name is "mtdblock1"
Yaffs: passed flags ""
Yaffs: Attempting MTD mounted on 31.1, "mtdblock1"
Yaffs: Dev is 32505858 name is "mtdblock2"
Yaffs: passed flags ""
Yaffs: Attempting MTD mounted on 31.2, "mtdblock2"
SH: can't access tty; Job control turned off
# Init: cannot find '/system/bin/playmp3', disabling 'bootsound'
Eth0: link up
Warning: 'rild' uses 32-bit capabilities (legacy support in use)
Init: sys_prop: mis-match MSG size recieved:-1 expected: 128

From the boot information can be seen that the main CPU is the ARM926EJ-S, not arm11 CPU, indicating that the downloaded emulator kernel is not for G1 mobile phone, it is estimated that only the simulation of the ARM926EJ-S CPU is realized.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.