Android移植成功:linux-2.6.25.8+U盘挂载

『摘要』:    

本次移植的大体思路是:先将linux移植到开发板上,并添加USB驱动,然后将从网上下载的Android文件系统保存在U盘中,最后使用chroot命令切换至U盘中的Android文件系统,并执行./linuxrc和logcat。

Android成功运行的画面可以在我的相册中看到,以此与各位Android的爱好者们分享。http://hi.csdn.net/attachment/201003/21/2513952_1269176150rJc9.jpg

 

1、从http://android.googlecode.com/files/linux-2.6.25-android-1.0_r1.tar.gz 下载linux-2.6.25-android-1.0_r1.tar.gz,并解压至某一目录下(此处我将其解压至/work),解压后文件夹的名字为kernel.git。

 

2、在http://www.codesourcery.com/gnu_toolchains/arm/portal/release644 网站上下载IA32 GNU/Linux TAR,将其解压;

 

3、进入kernel.git目录,修改Makefile

 195 ARCH            = arm
 196 #CROSS_COMPILE  ?= arm-eabi-
 197 CROSS_COMPILE   = /home/san/Desktop/2440/san/forAndroid/arm-2008q3/bin/arm-none-linux-gnueabi-

 

4、配置Linux内核(此部分参考了whizer 的文章《Android在TQ2440开发板上的移植》,再次感谢作者! )

4.1、使用make s3c2410_defconfig,默认配置2410内核

4.2、运行make menuconfig

(1) 确保System Type ---> ARM system type ()中的内容为Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443
(2) 确保System Type ---> S3C2410 Machines ---> SMDK2410/A9M2410被勾选
(3) 取消选择与Goldfish相关的内容
Device Drivers ---> Character devices ---> < > Goldfish TTY Driver
Device Drivers ---> Power supply class support ---> < >   Goldfish battery driver (NEW)
Device Drivers ---> Real Time Clock ---> < >   GOLDFISH (NEW)
Device Drivers ---> Graphics support ---> Support for frame buffer devices ---> < >   Goldfish Framebuffer
(4) 选择S3C2410 LCD相关的内容
Device Drivers ---> Graphics support ---> Support for frame buffer devices ---> <*>   S3C2410 LCD framebuffer support
Device Drivers ---> Graphics support ---> Bootup logo --->   Standard black and white Linux logo
Device Drivers ---> Graphics support ---> Bootup logo --->   Standard 16-color Linux logo
Device Drivers ---> Graphics support ---> Bootup logo --->   Standard 224-color Linux logo
(5) 选中Android内核必须选项
Kernel Features ---> Use the ARM EABI to compile the kernel
General setup ---> Use full shmem filesystem
General setup ---> Enable Android's Shared Memory Subsystem
System Type ---> Support Thumb user binaries
Device Drivers ---> Android --->Android log driver
Device Drivers ---> Android ---> <*> Binder IPC Driver
(6) 尽量选中Android内核可选选项
Device Drivers ---> Android ---> RAM buffer console
Device Drivers ---> Android ---> Android timed gpio driver
Device Drivers ---> Android ---> Only allow certain groups to create sockets
(7) 其余CONFIG选项,如系统支持请一并选择
CONFIG_ANDROID_POWER =y
CONFIG_ANDROID_POWER_STAT =y
CONFIG_ANDROID_POWER_ALARM =y
(可以在Kconfig文件中查找ANDROID_POWER等字段进行选择,或者直接修改.config文件)

4.3、在内核中添加NFS支持
File systems  --->
[*] Network File Systems  --->
 <*>   NFS file system support                                       
  │ │    [*]     Provide NFSv3 client support                              
  │ │    [*]       Provide client support for the NFSv3 ACL protocol extensio
  │ │    [ ]     Provide NFSv4 client support (EXPERIMENTAL)               
  │ │    [*]     Allow direct I/O on NFS files                            
  │ │    < >   NFS server support                                       
  │ │    [*]   Root file system on NFS

4.4、在内核中添加ext2、ext3支持

File systems  --->

[*]   Ext2 extended attributes                                  
  │ │    [*]     Ext2 POSIX Access Control Lists                     
  │ │    [*]     Ext2 Security Labels                                 
  │ │    [*]   Ext2 execute in place support                         
  │ │    <*> Ext3 journalling file system support                      
  │ │    [*]   Ext3 extended attributes                                
  │ │    [*]     Ext3 POSIX Access Control Lists             
  │ │    [*]     Ext3 Security Labels

4.5、在内核中添加yaffs2支持

File systems  --->

 <*> YAFFS2 file system support                            
  │ │    -*-   512 byte / page devices                                
  │ │    [ ]     Use older-style on-NAND data format with pageStatus byte
  │ │    [ ]       Lets Yaffs do its own ECC

4.6、在内核中添加tmpfs支持

File systems  --->

Pseudo filesystems  --->

 [*] Virtual memory file system support (former shm fs)        
  │ │    [*]   Tmpfs POSIX Access Control Lists                        
  │ │    < > Userspace-driven configuration filesystem

4.6、在内核中添加USB设备驱动支持

 Device Drivers  --->

SCSI device support  --->

 < > RAID Transport Class                                       
  │ │    <*> SCSI device support                                         
  │ │    < > SCSI target support                                       
  │ │    [*] legacy /proc/scsi/ support                               
  │ │        *** SCSI support type (disk, tape, CD-ROM) ***         
  │ │    <*> SCSI disk support                                          
  │ │    < > SCSI tape support                                          
  │ │    < > SCSI OnStream SC-x0 tape support                       
  │ │    <*> SCSI CDROM support                                         
  │ │    [ ]   Enable vendor-specific extensions (for SCSI CDROM)

           < > SCSI generic support                                       
  │ │    < > SCSI media changer support                                 
  │ │        *** Some SCSI devices (e.g. CD jukebox) support multiple LUNs
  │ │    [ ] Probe all LUNs on each SCSI device                       
  │ │    [ ] Verbose SCSI error reporting (kernel size +=12K)            
  │ │    [ ] SCSI logging facility                                   
  │ │    [ ] Asynchronous SCSI scanning                               
  │ │        SCSI Transports  --->                                    
  │ │    [*] SCSI low-level drivers  --->

[*] HID Devices  --->

          <*>   USB Human Interface Device (full HID) support

          [*]     /dev/hiddev raw HID device support  

          [*] USB support  --->

          <*>   Support for Host-side USB                                
  │ │    [ ]     USB verbose debug messages                             
  │ │    [ ]     USB announce new devices                               
  │ │            *** Miscellaneous USB options ***                     
  │ │    [*]     USB device filesystem                             
  │ │    [*]     USB device class-devices (DEPRECATED)

          <*>     OHCI HCD support

          <*>   USB Mass Storage support
 4.4、退出并保存.config

 

5、给内核打补丁

将patch_for_Linux-2.6.25.8.tar.bz2(开发板光盘提供的按步骤制作的单个补丁文件压缩包)解压,目录结构如下:

.
|-- Backlight.patch
|-- Beep.patch
|-- Buttons.patch
|-- Hello.patch
|-- LCD.patch
|-- LEDs.patch
|-- Logo.patch
|-- MMC.patch
|-- Nand.patch NAND FLASH分区补丁
|-- Net.patch
|-- Part1.patch
|-- RTC.patch
|-- Serial.patch
|-- Sound.patch
|-- Ts.patch
|-- USB_2Host.patch USB驱动补丁
|-- USB_Camera.patch
|-- USBgadget.patch
|-- Watchdog.patch
|-- Yaffs2.patch
|-- config_EmbedSky
`-- readme.txt

注意:打补丁时许看清行号是否与对应的源码匹配,因为如下补丁文件是与标准linux源码diff以后得出的patch,但我们现在是要给android  kernel打补丁,补丁的行号会出现错位或者不一致的情况。如果不一致不匹配,那么可以参考补丁文件手动修改源码

5.1、基本补丁

diff -urNwB linux-2.6.25.8/arch/arm/boot/Makefile linux-2.6.25.8_EmbedSky/arch/arm/boot/Makefile
--- linux-2.6.25.8/arch/arm/boot/Makefile 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/arch/arm/boot/Makefile 2009-01-11 02:10:52.000000000 +0800
@@ -55,6 +55,7 @@
 
 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
  $(call if_changed,objcopy)
+ @cp -f arch/arm/boot/zImage zImage
  @echo '  Kernel: $@ is ready'
 
 endif
diff -urNwB linux-2.6.25.8/arch/arm/mach-s3c2440/mach-smdk2440.c linux-2.6.25.8_EmbedSky/arch/arm/mach-s3c2440/mach-smdk2440.c
--- linux-2.6.25.8/arch/arm/mach-s3c2440/mach-smdk2440.c 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/arch/arm/mach-s3c2440/mach-smdk2440.c 2009-02-28 13:18:12.000000000 +0800
@@ -159,7 +159,7 @@
 static void __init smdk2440_map_io(void)
 {
  s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
- s3c24xx_init_clocks(16934400);
+ s3c24xx_init_clocks(12000000);
  s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
 }
 
diff -urNwB linux-2.6.25.8/arch/arm/tools/mach-types linux-2.6.25.8_EmbedSky/arch/arm/tools/mach-types
--- linux-2.6.25.8/arch/arm/tools/mach-types 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/arch/arm/tools/mach-types 2009-02-28 13:18:54.000000000 +0800
@@ -376,7 +376,7 @@
 ixp421_dnaeeth  ARCH_IXP421_DNAEETH IXP421_DNAEETH  359
 pocketserv9200  ARCH_POCKETSERV9200 POCKETSERV9200  360
 toto   ARCH_TOTO  TOTO   361
-s3c2440   ARCH_S3C2440  S3C2440   362
+s3c2440   ARCH_S3C2440  S3C2440   168
 ks8695p   ARCH_KS8695P  KS8695P   363
 se4000   ARCH_SE4000  SE4000   364
 quadriceps  ARCH_QUADRICEPS  QUADRICEPS  365
diff -urNwB linux-2.6.25.8/Makefile linux-2.6.25.8_EmbedSky/Makefile
--- linux-2.6.25.8/Makefile 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/Makefile 2009-01-11 02:13:56.000000000 +0800
@@ -190,8 +190,8 @@
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 export KBUILD_BUILDHOST := $(SUBARCH)
-ARCH  ?= $(SUBARCH)
-CROSS_COMPILE ?=
+ARCH  ?= arm
+CROSS_COMPILE ?= /opt/EmbedSky/crosstools_3.4.5_softfloat/gcc-3.4.5-glibc-2.3.6/arm-linux/bin/arm-linux-
 
 # Architecture as present in compile.h
 UTS_MACHINE  := $(ARCH)
@@ -1153,7 +1153,7 @@
   -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' /
   -o -name '.*.rej' -o -size 0 /
   -o -name '*%' -o -name '.*.cmd' -o -name 'core' /) /
-  -type f -print | xargs rm -f
+  -type f -print | xargs rm -f  rm zImage
 
 
 # Packaging of the kernel to various formats

5.2、、RTC补丁

diff -urNwB linux-2.6.25.8/arch/arm/mach-s3c2440/mach-smdk2440.c linux-2.6.25.8_EmbedSky/arch/arm/mach-s3c2440/mach-smdk2440.c
--- linux-2.6.25.8/arch/arm/mach-s3c2440/mach-smdk2440.c    2009-02-28 14:59:44.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/arch/arm/mach-s3c2440/mach-smdk2440.c    2009-02-28 15:07:22.000000000 +0800
@@ -276,6 +276,7 @@
     &s3c_device_iis,
     &s3c_device_usbgadget,
     &s3c_device_ts,
+    &s3c_device_rtc,
 };
 
 static void __init smdk2440_map_io(void)

5.3、网卡驱动补丁

diff -urNwB linux-2.6.25.8/arch/arm/plat-s3c24xx/common-smdk.c linux-2.6.25.8_EmbedSky/arch/arm/plat-s3c24xx/common-smdk.c
--- linux-2.6.25.8/arch/arm/plat-s3c24xx/common-smdk.c 2009-02-28 13:31:10.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/arch/arm/plat-s3c24xx/common-smdk.c 2009-02-28 13:45:29.000000000 +0800
@@ -43,6 +43,9 @@
 #include
 #include
 #include
+#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
+#include
+#endif
 
 /* LED devices */
 
@@ -145,6 +148,46 @@
  .sets  = smdk_nand_sets,
 };
 
+#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
+/* DM9000 */
+static struct resource s3c_dm9k_resource[] = {
+    [0] = {
+        .start = S3C2410_CS4,       /* ADDR2=0,发送地址时使用这个地址 */
+        .end   = S3C2410_CS4 + 3,
+        .flags = IORESOURCE_MEM,
+    },
+    [1] = {
+        .start = S3C2410_CS4 + 4,   /* ADDR2=1,传输数据时使用这个地址 */
+        .end   = S3C2410_CS4 + 4 + 3,
+        .flags = IORESOURCE_MEM,
+    },
+    [2] = {
+        .start = IRQ_EINT7,         /* 中断号 */
+        .end   = IRQ_EINT7,
+        .flags = IORESOURCE_IRQ,
+    }
+
+};
+
+/* for the moment we limit ourselves to 16bit IO until some
+ * better IO routines can be written and tested
+*/
+
+static struct dm9000_plat_data s3c_dm9k_platdata = {
+    .flags      = DM9000_PLATF_16BITONLY,
+};
+
+static struct platform_device s3c_device_dm9k = {
+    .name       = "dm9000",
+    .id     = 0,
+    .num_resources  = ARRAY_SIZE(s3c_dm9k_resource),
+    .resource   = s3c_dm9k_resource,
+    .dev        = {
+        .platform_data = &s3c_dm9k_platdata,
+    }
+};
+#endif /* CONFIG_DM9000 */
+
 /* devices we initialise */
 
 static struct platform_device __initdata *smdk_devs[] = {
@@ -153,6 +196,9 @@
  &smdk_led5,
  &smdk_led6,
  &smdk_led7,
+#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
+ &s3c_device_dm9k,
+#endif   
 };
 
 void __init smdk_machine_init(void)
diff -urNwB linux-2.6.25.8/drivers/net/dm9000.c linux-2.6.25.8_EmbedSky/drivers/net/dm9000.c
--- linux-2.6.25.8/drivers/net/dm9000.c 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/drivers/net/dm9000.c 2009-02-27 19:18:21.000000000 +0800
@@ -1,5 +1,7 @@
 /*
- *      Davicom DM9000 Fast Ethernet driver for Linux.
+ *   dm9000.c: Version 1.2 03/18/2003
+ *
+ *         A Davicom DM9000 ISA NIC fast Ethernet driver for Linux.
  *  Copyright (C) 1997  Sten Wang
  *
  *  This program is free software; you can redistribute it and/or
@@ -14,9 +16,42 @@
  *
  * (C) Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved.
  *
- * Additional updates, Copyright:
- * Ben Dooks
- * Sascha Hauer
+ * V0.11 06/20/2001 REG_0A bit3=1, default enable BP with DA match
+ *  06/22/2001  Support DM9801 progrmming
+ *      E3: R25 = ((R24 + NF) & 0x00ff) | 0xf000
+ *     E4: R25 = ((R24 + NF) & 0x00ff) | 0xc200
+ *          R17 = (R17 & 0xfff0) | NF + 3
+ *     E5: R25 = ((R24 + NF - 3) & 0x00ff) | 0xc200
+ *          R17 = (R17 & 0xfff0) | NF
+ *
+ * v1.00                modify by simon 2001.9.5
+ *                         change for kernel 2.4.x
+ *
+ * v1.1   11/09/2001       fix force mode bug
+ *
+ * v1.2   03/18/2003       Weilun Huang :
+ *    Fixed phy reset.
+ *    Added tx/rx 32 bit mode.
+ *    Cleaned up for kernel merge.
+ *
+ *        03/03/2004    Sascha Hauer
+ *                      Port to 2.6 kernel
+ *
+ *   24-Sep-2004   Ben Dooks
+ *   Cleanup of code to remove ifdefs
+ *   Allowed platform device data to influence access width
+ *   Reformatting areas of code
+ *
+ *        17-Mar-2005   Sascha Hauer
+ *                      * removed 2.4 style module parameters
+ *                      * removed removed unused stat counter and fixed
+ *                        net_device_stats
+ *                      * introduced tx_timeout function
+ *                      * reworked locking
+ *
+ *   01-Jul-2005   Ben Dooks
+ *   * fixed spinlock call without pointer
+ *   * ensure spinlock is initialised
  */
 
 #include
@@ -28,15 +63,16 @@
 #include
 #include
 #include
-#include
 #include
 #include
 #include
-#include
 
 #include
 #include
 #include
+#if defined(CONFIG_ARCH_S3C2410)
+#include
+#endif
 
 #include "dm9000.h"
 
@@ -46,7 +82,30 @@
 
 #define CARDNAME "dm9000"
 #define PFX CARDNAME ": "
-#define DRV_VERSION "1.30"
+
+#define DM9000_TIMER_WUT  jiffies+(HZ*2) /* timer wakeup time : 2 second */
+
+#define DM9000_DEBUG 0
+
+#if DM9000_DEBUG > 2
+#define PRINTK3(args...)  printk(CARDNAME ": " args)
+#else
+#define PRINTK3(args...)  do { } while(0)
+#endif
+
+#if DM9000_DEBUG > 1
+#define PRINTK2(args...)  printk(CARDNAME ": " args)
+#else
+#define PRINTK2(args...)  do { } while(0)
+#endif
+
+#if DM9000_DEBUG > 0
+#define PRINTK1(args...)  printk(CARDNAME ": " args)
+#define PRINTK(args...)   printk(CARDNAME ": " args)
+#else
+#define PRINTK1(args...)  do { } while(0)
+#define PRINTK(args...)   printk(KERN_DEBUG args)
+#endif
 
 #ifdef CONFIG_BLACKFIN
 #define readsb insb
@@ -55,9 +114,11 @@
 #define writesb outsb
 #define writesw outsw
 #define writesl outsl
-#define DEFAULT_TRIGGER IRQF_TRIGGER_HIGH
+#define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQF_TRIGGER_HIGH)
+#elif defined(CONFIG_ARCH_S3C2410)
+#define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQF_TRIGGER_RISING)
 #else
-#define DEFAULT_TRIGGER (0)
+DM9000_IRQ_FLAGS IRQF_SHARED
 #endif
 
 /*
@@ -67,24 +128,6 @@
 module_param(watchdog, int, 0400);
 MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds");
 
-/* DM9000 register address locking.
- *
- * The DM9000 uses an address register to control where data written
- * to the data register goes. This means that the address register
- * must be preserved over interrupts or similar calls.
- *
- * During interrupt and other critical calls, a spinlock is used to
- * protect the system, but the calls themselves save the address
- * in the address register in case they are interrupting another
- * access to the device.
- *
- * For general accesses a lock is provided so that calls which are
- * allowed to sleep are serialised so that the address register does
- * not need to be saved. This lock also serves to serialise access
- * to the EEPROM and PHY access registers which are shared between
- * these two devices.
- */
-
 /* Structure/enum declaration ------------------------------- */
 typedef struct board_info {
 
@@ -98,52 +141,33 @@
  u16 dbug_cnt;
  u8 io_mode;  /* 0:word, 2:byte */
  u8 phy_addr;
- unsigned int flags;
- unsigned int in_suspend :1;
-
- int debug_level;
 
  void (*inblk)(void __iomem *port, void *data, int length);
  void (*outblk)(void __iomem *port, void *data, int length);
  void (*dumpblk)(void __iomem *port, int length);
 
- struct device *dev;      /* parent device */
-
  struct resource *addr_res;   /* resources found */
  struct resource *data_res;
  struct resource *addr_req;   /* resources requested */
  struct resource *data_req;
  struct resource *irq_res;
 
- struct mutex  addr_lock; /* phy and eeprom access lock */
-
+ struct timer_list timer;
+ unsigned char srom[128];
  spinlock_t lock;
 
  struct mii_if_info mii;
  u32 msg_enable;
 } board_info_t;
 
-/* debug code */
-
-#define dm9000_dbg(db, lev, msg...) do {  /
- if ((lev) < CONFIG_DM9000_DEBUGLEVEL &&  /
-     (lev) < db->debug_level) {   /
-  dev_dbg(db->dev, msg);   /
- }      /
-} while (0)
-
-static inline board_info_t *to_dm9000_board(struct net_device *dev)
-{
- return dev->priv;
-}
-
 /* function declaration ------------------------------------- */
 static int dm9000_probe(struct platform_device *);
 static int dm9000_open(struct net_device *);
 static int dm9000_start_xmit(struct sk_buff *, struct net_device *);
 static int dm9000_stop(struct net_device *);
-static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
 
+
+static void dm9000_timer(unsigned long);
 static void dm9000_init_dm9000(struct net_device *);
 
 static irqreturn_t dm9000_interrupt(int, void *);
@@ -151,19 +175,20 @@
 static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg);
 static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg,
       int value);
-
-static void dm9000_read_eeprom(board_info_t *, int addr, u8 *to);
-static void dm9000_write_eeprom(board_info_t *, int addr, u8 *dp);
+static u16 read_srom_word(board_info_t *, int);
 static void dm9000_rx(struct net_device *);
 static void dm9000_hash_table(struct net_device *);
 
+//#define DM9000_PROGRAM_EEPROM
+#ifdef DM9000_PROGRAM_EEPROM
+static void program_eeprom(board_info_t * db);
+#endif
 /* DM9000 network board routine ---------------------------- */
 
 static void
 dm9000_reset(board_info_t * db)
 {
- dev_dbg(db->dev, "resetting device/n");
-
+ PRINTK1("dm9000x: resetting/n");
  /* RESET device */
  writeb(DM9000_NCR, db->io_addr);
  udelay(200);
@@ -279,10 +304,14 @@
   db->inblk   = dm9000_inblk_8bit;
   break;
 
+ case 2:
+  db->dumpblk = dm9000_dumpblk_16bit;
+  db->outblk  = dm9000_outblk_16bit;
+  db->inblk   = dm9000_inblk_16bit;
+  break;
 
  case 3:
-  dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit/n");
- case 2:
+  printk(KERN_ERR PFX ": 3 byte IO, falling back to 16bit/n");
   db->dumpblk = dm9000_dumpblk_16bit;
   db->outblk  = dm9000_outblk_16bit;
   db->inblk   = dm9000_inblk_16bit;
@@ -333,139 +362,6 @@
 }
 #endif
 
-static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
-{
- board_info_t *dm = to_dm9000_board(dev);
-
- if (!netif_running(dev))
-  return -EINVAL;
-
- return generic_mii_ioctl(&dm->mii, if_mii(req), cmd, NULL);
-}
-
-/* ethtool ops */
-
-static void dm9000_get_drvinfo(struct net_device *dev,
-          struct ethtool_drvinfo *info)
-{
- board_info_t *dm = to_dm9000_board(dev);
-
- strcpy(info->driver, CARDNAME);
- strcpy(info->version, DRV_VERSION);
- strcpy(info->bus_info, to_platform_device(dm->dev)->name);
-}
-
-static u32 dm9000_get_msglevel(struct net_device *dev)
-{
- board_info_t *dm = to_dm9000_board(dev);
-
- return dm->msg_enable;
-}
-
-static void dm9000_set_msglevel(struct net_device *dev, u32 value)
-{
- board_info_t *dm = to_dm9000_board(dev);
-
- dm->msg_enable = value;
-}
-
-static int dm9000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
- board_info_t *dm = to_dm9000_board(dev);
-
- mii_ethtool_gset(&dm->mii, cmd);
- return 0;
-}
-
-static int dm9000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
- board_info_t *dm = to_dm9000_board(dev);
-
- return mii_ethtool_sset(&dm->mii, cmd);
-}
-
-static int dm9000_nway_reset(struct net_device *dev)
-{
- board_info_t *dm = to_dm9000_board(dev);
- return mii_nway_restart(&dm->mii);
-}
-
-static u32 dm9000_get_link(struct net_device *dev)
-{
- board_info_t *dm = to_dm9000_board(dev);
- return mii_link_ok(&dm->mii);
-}
-
-#define DM_EEPROM_MAGIC  (0x444D394B)
-
-static int dm9000_get_eeprom_len(struct net_device *dev)
-{
- return 128;
-}
-
-static int dm9000_get_eeprom(struct net_device *dev,
-        struct ethtool_eeprom *ee, u8 *data)
-{
- board_info_t *dm = to_dm9000_board(dev);
- int offset = ee->offset;
- int len = ee->len;
- int i;
-
- /* EEPROM access is aligned to two bytes */
-
- if ((len & 1) != 0 || (offset & 1) != 0)
-  return -EINVAL;
-
- if (dm->flags & DM9000_PLATF_NO_EEPROM)
-  return -ENOENT;
-
- ee->magic = DM_EEPROM_MAGIC;
-
- for (i = 0; i < len; i += 2)
-  dm9000_read_eeprom(dm, (offset + i) / 2, data + i);
-
- return 0;
-}
-
-static int dm9000_set_eeprom(struct net_device *dev,
-        struct ethtool_eeprom *ee, u8 *data)
-{
- board_info_t *dm = to_dm9000_board(dev);
- int offset = ee->offset;
- int len = ee->len;
- int i;
-
- /* EEPROM access is aligned to two bytes */
-
- if ((len & 1) != 0 || (offset & 1) != 0)
-  return -EINVAL;
-
- if (dm->flags & DM9000_PLATF_NO_EEPROM)
-  return -ENOENT;
-
- if (ee->magic != DM_EEPROM_MAGIC)
-  return -EINVAL;
-
- for (i = 0; i < len; i += 2)
-  dm9000_write_eeprom(dm, (offset + i) / 2, data + i);
-
- return 0;
-}
-
-static const struct ethtool_ops dm9000_ethtool_ops = {
- .get_drvinfo  = dm9000_get_drvinfo,
- .get_settings  = dm9000_get_settings,
- .set_settings  = dm9000_set_settings,
- .get_msglevel  = dm9000_get_msglevel,
- .set_msglevel  = dm9000_set_msglevel,
- .nway_reset  = dm9000_nway_reset,
- .get_link  = dm9000_get_link,
-  .get_eeprom_len  = dm9000_get_eeprom_len,
-  .get_eeprom  = dm9000_get_eeprom,
-  .set_eeprom  = dm9000_set_eeprom,
-};
-
-
 /* dm9000_release_board
  *
  * release a board, and any mapped resources
@@ -509,32 +405,43 @@
  struct dm9000_plat_data *pdata = pdev->dev.platform_data;
  struct board_info *db; /* Point a board information structure */
  struct net_device *ndev;
- const unsigned char *mac_src;
  unsigned long base;
  int ret = 0;
  int iosize;
  int i;
  u32 id_val;
 
+#if defined(CONFIG_ARCH_S3C2410)
+ unsigned int oldval_bwscon;  /* 用来保存BWSCON寄存器的值 */
+ unsigned int oldval_bankcon4;  /* 用来保存S3C2410_BANKCON4寄存器的值 */
+#endif
+
  /* Init network device */
  ndev = alloc_etherdev(sizeof (struct board_info));
  if (!ndev) {
-  dev_err(&pdev->dev, "could not allocate device./n");
+  printk("%s: could not allocate device./n", CARDNAME);
   return -ENOMEM;
  }
 
  SET_NETDEV_DEV(ndev, &pdev->dev);
 
- dev_dbg(&pdev->dev, "dm9000_probe()");
+#if defined(CONFIG_ARCH_S3C2410)
+ /* 设置Bank4: 总线宽度为16, 使能nWAIT。 */
+ oldval_bwscon = *((volatile unsigned int *)S3C2410_BWSCON);
+ *((volatile unsigned int *)S3C2410_BWSCON) = (oldval_bwscon & ~(3<<16)) /
+  | S3C2410_BWSCON_DW4_16 | S3C2410_BWSCON_WS4 | S3C2410_BWSCON_ST4;
+
+ /* 设置BANK3的时间参数, */
+ oldval_bankcon4 = *((volatile unsigned int *)S3C2410_BANKCON4);
+ *((volatile unsigned int *)S3C2410_BANKCON4) = 0x1f7c;
+#endif
+ PRINTK2("dm9000_probe()");
 
  /* setup board info structure */
  db = (struct board_info *) ndev->priv;
  memset(db, 0, sizeof (*db));
 
- db->dev = &pdev->dev;
-
  spin_lock_init(&db->lock);
- mutex_init(&db->addr_lock);
 
  if (pdev->num_resources < 2) {
   ret = -ENODEV;
@@ -562,7 +469,7 @@
 
   if (db->addr_res == NULL || db->data_res == NULL ||
       db->irq_res == NULL) {
-   dev_err(db->dev, "insufficient resources/n");
+   printk(KERN_ERR PFX "insufficient resources/n");
    ret = -ENOENT;
    goto out;
   }
@@ -572,7 +479,7 @@
         pdev->name);
 
   if (db->addr_req == NULL) {
-   dev_err(db->dev, "cannot claim address reg area/n");
+   printk(KERN_ERR PFX "cannot claim address reg area/n");
    ret = -EIO;
    goto out;
   }
@@ -580,7 +487,7 @@
   db->io_addr = ioremap(db->addr_res->start, i);
 
   if (db->io_addr == NULL) {
-   dev_err(db->dev, "failed to ioremap address reg/n");
+   printk(KERN_ERR "failed to ioremap address reg/n");
    ret = -EINVAL;
    goto out;
   }
@@ -590,7 +497,7 @@
         pdev->name);
 
   if (db->data_req == NULL) {
-   dev_err(db->dev, "cannot claim data reg area/n");
+   printk(KERN_ERR PFX "cannot claim data reg area/n");
    ret = -EIO;
    goto out;
   }
@@ -598,7 +505,7 @@
   db->io_data = ioremap(db->data_res->start, iosize);
 
   if (db->io_data == NULL) {
-   dev_err(db->dev,"failed to ioremap data reg/n");
+   printk(KERN_ERR "failed to ioremap data reg/n");
    ret = -EINVAL;
    goto out;
   }
@@ -637,14 +544,12 @@
 
   if (pdata->dumpblk != NULL)
    db->dumpblk = pdata->dumpblk;
-
-  db->flags = pdata->flags;
  }
 
  dm9000_reset(db);
 
  /* try two times, DM9000 sometimes gets the first read wrong */
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < 2; i++) {
   id_val  = ior(db, DM9000_VIDL);
   id_val |= (u32)ior(db, DM9000_VIDH) << 8;
   id_val |= (u32)ior(db, DM9000_PIDL) << 16;
@@ -652,11 +557,11 @@
 
   if (id_val == DM9000_ID)
    break;
-  dev_err(db->dev, "read wrong id 0x%08x/n", id_val);
+  printk("%s: read wrong id 0x%08x/n", CARDNAME, id_val);
  }
 
  if (id_val != DM9000_ID) {
-  dev_err(db->dev, "wrong id: 0x%08x/n", id_val);
+  printk("%s: wrong id: 0x%08x/n", CARDNAME, id_val);
   ret = -ENODEV;
   goto out;
  }
@@ -672,13 +577,13 @@
  ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
  ndev->stop   = &dm9000_stop;
  ndev->set_multicast_list = &dm9000_hash_table;
- ndev->ethtool_ops  = &dm9000_ethtool_ops;
- ndev->do_ioctl   = &dm9000_ioctl;
-
 #ifdef CONFIG_NET_POLL_CONTROLLER
  ndev->poll_controller  = &dm9000_poll_controller;
 #endif
 
+#ifdef DM9000_PROGRAM_EEPROM
+ program_eeprom(db);
+#endif
  db->msg_enable       = NETIF_MSG_LINK;
  db->mii.phy_id_mask  = 0x1f;
  db->mii.reg_num_mask = 0x1f;
@@ -688,22 +593,23 @@
  db->mii.mdio_read    = dm9000_phy_read;
  db->mii.mdio_write   = dm9000_phy_write;
 
- mac_src = "eeprom";
+ /* Read SROM content */
+ for (i = 0; i < 64; i++)
+  ((u16 *) db->srom)[i] = read_srom_word(db, i);
 
- /* try reading the node address from the attached EEPROM */
- for (i = 0; i < 6; i += 2)
-  dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
+ /* Set Node Address */
+ for (i = 0; i < 6; i++)
+  ndev->dev_addr[i] = db->srom[i];
 
  if (!is_valid_ether_addr(ndev->dev_addr)) {
   /* try reading from mac */
   
-  mac_src = "chip";
   for (i = 0; i < 6; i++)
    ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
  }
 
  if (!is_valid_ether_addr(ndev->dev_addr))
-  dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please "
+  printk("%s: Invalid ethernet MAC address.  Please "
     "set using ifconfig/n", ndev->name);
 
  platform_set_drvdata(pdev, ndev);
@@ -711,14 +617,19 @@
 
  if (ret == 0) {
   DECLARE_MAC_BUF(mac);
-  printk("%s: dm9000 at %p,%p IRQ %d MAC: %s (%s)/n",
+  printk("%s: dm9000 at %p,%p IRQ %d MAC: %s/n",
          ndev->name,  db->io_addr, db->io_data, ndev->irq,
-         print_mac(mac, ndev->dev_addr), mac_src);
+         print_mac(mac, ndev->dev_addr));
  }
  return 0;
 
 out:
- dev_err(db->dev, "not found (%d)./n", ret);
+ printk("%s: not found (%d)./n", CARDNAME, ret);
+#if defined(CONFIG_ARCH_S3C2410)
+ /* 恢复寄存器原来的值 */
+ *((volatile unsigned int *)S3C2410_BWSCON) = oldval_bwscon;
+ *((volatile unsigned int *)S3C2410_BANKCON4) = oldval_bankcon4;
+#endif
 
  dm9000_release_board(pdev, db);
  free_netdev(ndev);
@@ -734,22 +645,10 @@
 dm9000_open(struct net_device *dev)
 {
  board_info_t *db = (board_info_t *) dev->priv;
- unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK;
 
- if (netif_msg_ifup(db))
-  dev_dbg(db->dev, "enabling %s/n", dev->name);
+ PRINTK2("entering dm9000_open/n");
 
- /* If there is no IRQ type specified, default to something that
-  * may work, and tell the user that this is a problem */
-
- if (irqflags == IRQF_TRIGGER_NONE) {
-  dev_warn(db->dev, "WARNING: no IRQ resource flags set./n");
-  irqflags = DEFAULT_TRIGGER;
- }

- irqflags |= IRQF_SHARED;
-
- if (request_irq(dev->irq, &dm9000_interrupt, irqflags, dev->name, dev))
+ if (request_irq(dev->irq, &dm9000_interrupt, DM9000_IRQ_FLAGS, dev->name, dev))
   return -EAGAIN;
 
  /* Initialize DM9000 board */
@@ -759,6 +658,13 @@
  /* Init driver variable */
  db->dbug_cnt = 0;
 
+ /* set and active a timer process */
+ init_timer(&db->timer);
+ db->timer.expires  = DM9000_TIMER_WUT;
+ db->timer.data     = (unsigned long) dev;
+ db->timer.function = &dm9000_timer;
+ add_timer(&db->timer);
+
  mii_check_media(&db->mii, netif_msg_link(db), 1);
  netif_start_queue(dev);
 
@@ -773,7 +679,7 @@
 {
  board_info_t *db = (board_info_t *) dev->priv;
 
- dm9000_dbg(db, 1, "entering %s/n", __func__);
+ PRINTK1("entering %s/n",__FUNCTION__);
 
  /* I/O mode */
  db->io_mode = ior(db, DM9000_ISR) >> 6; /* ISR bit7:6 keeps I/O mode */
@@ -783,9 +689,6 @@
  iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */
  iow(db, DM9000_GPR, 0); /* Enable PHY */
 
- if (db->flags & DM9000_PLATF_EXT_PHY)
-  iow(db, DM9000_NCR, NCR_EXT_PHY);
-
  /* Program operating register */
  iow(db, DM9000_TCR, 0);         /* TX Polling clear */
  iow(db, DM9000_BPTR, 0x3f); /* Less 3Kb, 200us */
@@ -798,6 +701,8 @@
  /* Set address filter table */
  dm9000_hash_table(dev);
 
+ /* Activate DM9000 */
+ iow(db, DM9000_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN);
  /* Enable TX/RX interrupt mask */
  iow(db, DM9000_IMR, IMR_PAR | IMR_PTM | IMR_PRM);
 
@@ -817,7 +722,7 @@
  unsigned long flags;
  board_info_t *db = (board_info_t *) dev->priv;
 
- dm9000_dbg(db, 3, "%s:/n", __func__);
+ PRINTK3("dm9000_start_xmit/n");
 
  if (db->tx_pkt_cnt > 1)
   return 1;
@@ -834,8 +739,8 @@
  /* TX control: First packet immediately send, second packet queue */
  if (db->tx_pkt_cnt == 1) {
   /* Set TX length to DM9000 */
-  iow(db, DM9000_TXPLL, skb->len);
-  iow(db, DM9000_TXPLH, skb->len >> 8);
+  iow(db, DM9000_TXPLL, skb->len & 0xff);
+  iow(db, DM9000_TXPLH, (skb->len >> 8) & 0xff);
 
   /* Issue TX polling command */
   iow(db, DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */
@@ -876,8 +781,10 @@
 {
  board_info_t *db = (board_info_t *) ndev->priv;
 
- if (netif_msg_ifdown(db))
-  dev_dbg(db->dev, "shutting down %s/n", ndev->name);
+ PRINTK1("entering %s/n",__FUNCTION__);
+
+ /* deleted timer */
+ del_timer(&db->timer);
 
  netif_stop_queue(ndev);
  netif_carrier_off(ndev);
@@ -905,13 +812,10 @@
   db->tx_pkt_cnt--;
   dev->stats.tx_packets++;
 
-  if (netif_msg_tx_done(db))
-   dev_dbg(db->dev, "tx done, NSR %02x/n", tx_status);
-
   /* Queue packet check & send */
   if (db->tx_pkt_cnt > 0) {
-   iow(db, DM9000_TXPLL, db->queue_pkt_len);
-   iow(db, DM9000_TXPLH, db->queue_pkt_len >> 8);
+   iow(db, DM9000_TXPLL, db->queue_pkt_len & 0xff);
+   iow(db, DM9000_TXPLH, (db->queue_pkt_len >> 8) & 0xff);
    iow(db, DM9000_TCR, TCR_TXREQ);
    dev->trans_start = jiffies;
   }
@@ -923,14 +827,19 @@
 dm9000_interrupt(int irq, void *dev_id)
 {
  struct net_device *dev = dev_id;
- board_info_t *db = (board_info_t *) dev->priv;
+ board_info_t *db;
  int int_status;
  u8 reg_save;
 
- dm9000_dbg(db, 3, "entering %s/n", __func__);
+ PRINTK3("entering %s/n",__FUNCTION__);
 
- /* A real interrupt coming */
+ if (!dev) {
+  PRINTK1("dm9000_interrupt() without DEVICE arg/n");
+  return IRQ_HANDLED;
+ }
 
+ /* A real interrupt coming */
+ db = (board_info_t *) dev->priv;
  spin_lock(&db->lock);
 
  /* Save previous register address */
@@ -943,9 +852,6 @@
  int_status = ior(db, DM9000_ISR); /* Got ISR */
  iow(db, DM9000_ISR, int_status); /* Clear ISR status */
 
- if (netif_msg_intr(db))
-  dev_dbg(db->dev, "interrupt status %02x/n", int_status);
-
  /* Received the coming packet */
  if (int_status & ISR_PRS)
   dm9000_rx(dev);
@@ -965,10 +871,28 @@
  return IRQ_HANDLED;
 }
 
+/*
+ *  A periodic timer routine
+ *  Dynamic media sense, allocated Rx buffer...
+ */
+static void
+dm9000_timer(unsigned long data)
+{
+ struct net_device *dev = (struct net_device *) data;
+ board_info_t *db = (board_info_t *) dev->priv;
+
+ PRINTK3("dm9000_timer()/n");
+
+ mii_check_media(&db->mii, netif_msg_link(db), 0);
+
+ /* Set timer again */
+ db->timer.expires = DM9000_TIMER_WUT;
+ add_timer(&db->timer);
+}
+
 struct dm9000_rxhdr {
- u8 RxPktReady;
- u8 RxStatus;
- __le16 RxLen;
+ u16 RxStatus;
+ u16 RxLen;
 } __attribute__((__packed__));
 
 /*
@@ -993,7 +917,7 @@
 
   /* Status check: this byte must be 0 or 1 */
   if (rxbyte > DM9000_PKT_RDY) {
-   dev_warn(db->dev, "status check fail: %d/n", rxbyte);
+   printk("status check failed: %d/n", rxbyte);
    iow(db, DM9000_RCR, 0x00); /* Stop Device */
    iow(db, DM9000_ISR, IMR_PAR); /* Stop INT request */
    return;
@@ -1008,38 +932,30 @@
 
   (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr));
 
-  RxLen = le16_to_cpu(rxhdr.RxLen);
-
-  if (netif_msg_rx_status(db))
-   dev_dbg(db->dev, "RX: status %02x, length %04x/n",
-    rxhdr.RxStatus, RxLen);
+  RxLen = rxhdr.RxLen;
 
   /* Packet Status check */
   if (RxLen < 0x40) {
    GoodPacket = false;
-   if (netif_msg_rx_err(db))
-    dev_dbg(db->dev, "RX: Bad Packet (runt)/n");
+   PRINTK1("Bad Packet received (runt)/n");
   }
 
   if (RxLen > DM9000_PKT_MAX) {
-   dev_dbg(db->dev, "RST: RX Len:%x/n", RxLen);
+   PRINTK1("RST: RX Len:%x/n", RxLen);
   }
 
-  if (rxhdr.RxStatus & 0xbf) {
+  if (rxhdr.RxStatus & 0xbf00) {
    GoodPacket = false;
-   if (rxhdr.RxStatus & 0x01) {
-    if (netif_msg_rx_err(db))
-     dev_dbg(db->dev, "fifo error/n");
+   if (rxhdr.RxStatus & 0x100) {
+    PRINTK1("fifo error/n");
     dev->stats.rx_fifo_errors++;
    }
-   if (rxhdr.RxStatus & 0x02) {
-    if (netif_msg_rx_err(db))
-     dev_dbg(db->dev, "crc error/n");
+   if (rxhdr.RxStatus & 0x200) {
+    PRINTK1("crc error/n");
     dev->stats.rx_crc_errors++;
    }
-   if (rxhdr.RxStatus & 0x80) {
-    if (netif_msg_rx_err(db))
-     dev_dbg(db->dev, "length error/n");
+   if (rxhdr.RxStatus & 0x8000) {
+    PRINTK1("length error/n");
     dev->stats.rx_length_errors++;
    }
   }
@@ -1068,119 +984,72 @@
  } while (rxbyte == DM9000_PKT_RDY);
 }
 
-static unsigned int
-dm9000_read_locked(board_info_t *db, int reg)
-{
- unsigned long flags;
- unsigned int ret;
-
- spin_lock_irqsave(&db->lock, flags);
- ret = ior(db, reg);
- spin_unlock_irqrestore(&db->lock, flags);
-
- return ret;
-}
-
-static int dm9000_wait_eeprom(board_info_t *db)
-{
- unsigned int status;
- int timeout = 8; /* wait max 8msec */
-
- /* The DM9000 data sheets say we should be able to
-  * poll the ERRE bit in EPCR to wait for the EEPROM
-  * operation. From testing several chips, this bit
-  * does not seem to work.
-  *
-  * We attempt to use the bit, but fall back to the
-  * timeout (which is why we do not return an error
-  * on expiry) to say that the EEPROM operation has
-  * completed.
-  */
-
- while (1) {
-  status = dm9000_read_locked(db, DM9000_EPCR);
-
-  if ((status & EPCR_ERRE) == 0)
-   break;
-
-  if (timeout-- < 0) {
-   dev_dbg(db->dev, "timeout waiting EEPROM/n");
-   break;
-  }
- }
-
- return 0;
-}
-
 /*
- *  Read a word data from EEPROM
+ *  Read a word data from SROM
  */
-static void
-dm9000_read_eeprom(board_info_t *db, int offset, u8 *to)
+static u16
+read_srom_word(board_info_t * db, int offset)
 {
- unsigned long flags;
-
- if (db->flags & DM9000_PLATF_NO_EEPROM) {
-  to[0] = 0xff;
-  to[1] = 0xff;
-  return;
- }
-
- mutex_lock(&db->addr_lock);
-
- spin_lock_irqsave(&db->lock, flags);
-
  iow(db, DM9000_EPAR, offset);
  iow(db, DM9000_EPCR, EPCR_ERPRR);
-
- spin_unlock_irqrestore(&db->lock, flags);
-
- dm9000_wait_eeprom(db);
-
- /* delay for at-least 150uS */
- msleep(1);
-
- spin_lock_irqsave(&db->lock, flags);
-
+ mdelay(8);  /* according to the datasheet 200us should be enough,
+       but it doesn't work */
  iow(db, DM9000_EPCR, 0x0);
-
- to[0] = ior(db, DM9000_EPDRL);
- to[1] = ior(db, DM9000_EPDRH);
-
- spin_unlock_irqrestore(&db->lock, flags);
-
- mutex_unlock(&db->addr_lock);
+ return (ior(db, DM9000_EPDRL) + (ior(db, DM9000_EPDRH) << 8));
 }
 
+#ifdef DM9000_PROGRAM_EEPROM
 /*
  * Write a word data to SROM
  */
 static void
-dm9000_write_eeprom(board_info_t *db, int offset, u8 *data)
+write_srom_word(board_info_t * db, int offset, u16 val)
 {
- unsigned long flags;
+ iow(db, DM9000_EPAR, offset);
+ iow(db, DM9000_EPDRH, ((val >> 8) & 0xff));
+ iow(db, DM9000_EPDRL, (val & 0xff));
+ iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW);
+ mdelay(8);  /* same shit */
+ iow(db, DM9000_EPCR, 0);
+}
 
- if (db->flags & DM9000_PLATF_NO_EEPROM)
-  return;
+/*
+ * Only for development:
+ * Here we write static data to the eeprom in case
+ * we don't have valid content on a new board
+ */
+static void
+program_eeprom(board_info_t * db)
+{
+ u16 eeprom[] = { 0x0c00, 0x007f, 0x1300, /* MAC Address */
+  0x0000,  /* Autoload: accept nothing */
+  0x0a46, 0x9000, /* Vendor / Product ID */
+  0x0000,  /* pin control */
+  0x0000,
+ };   /* Wake-up mode control */
+ int i;
+ for (i = 0; i < 8; i++)
+  write_srom_word(db, i, eeprom[i]);
+}
+#endif
 
- mutex_lock(&db->addr_lock);
 
- spin_lock_irqsave(&db->lock, flags);
- iow(db, DM9000_EPAR, offset);
- iow(db, DM9000_EPDRH, data[1]);
- iow(db, DM9000_EPDRL, data[0]);
- iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW);
- spin_unlock_irqrestore(&db->lock, flags);
+/*
+ *  Calculate the CRC valude of the Rx packet
+ *  flag = 1 : return the reverse CRC (for the received packet CRC)
+ *         0 : return the normal CRC (for Hash Table index)
+ */
 
- dm9000_wait_eeprom(db);
+static unsigned long
+cal_CRC(unsigned char *Data, unsigned int Len, u8 flag)
+{
 
- mdelay(1); /* wait at least 150uS to clear */
+       u32 crc = ether_crc_le(Len, Data);
 
- spin_lock_irqsave(&db->lock, flags);
- iow(db, DM9000_EPCR, 0);
- spin_unlock_irqrestore(&db->lock, flags);
+       if (flag)
+               return ~crc;
 
- mutex_unlock(&db->addr_lock);
+       return crc;
 }
 
 /*
@@ -1192,17 +1061,15 @@
  board_info_t *db = (board_info_t *) dev->priv;
  struct dev_mc_list *mcptr = dev->mc_list;
  int mc_cnt = dev->mc_count;
- int i, oft;
  u32 hash_val;
- u16 hash_table[4];
- u8 rcr = RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN;
+ u16 i, oft, hash_table[4];
  unsigned long flags;
 
- dm9000_dbg(db, 1, "entering %s/n", __func__);
+ PRINTK2("dm9000_hash_table()/n");
 
  spin_lock_irqsave(&db->lock, flags);
 
- for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
+ for (i = 0, oft = 0x10; i < 6; i++, oft++)
   iow(db, oft, dev->dev_addr[i]);
 
  /* Clear Hash Table */
@@ -1212,42 +1079,23 @@
  /* broadcast address */
  hash_table[3] = 0x8000;
 
- if (dev->flags & IFF_PROMISC)
-  rcr |= RCR_PRMSC;
-
- if (dev->flags & IFF_ALLMULTI)
-  rcr |= RCR_ALL;
-
  /* the multicast address in Hash Table : 64 bits */
  for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) {
-  hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f;
+  hash_val = cal_CRC((char *) mcptr->dmi_addr, 6, 0) & 0x3f;
   hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16);
  }
 
  /* Write the hash table to MAC MD table */
- for (i = 0, oft = DM9000_MAR; i < 4; i++) {
-  iow(db, oft++, hash_table[i]);
-  iow(db, oft++, hash_table[i] >> 8);
+ for (i = 0, oft = 0x16; i < 4; i++) {
+  iow(db, oft++, hash_table[i] & 0xff);
+  iow(db, oft++, (hash_table[i] >> 8) & 0xff);
  }
 
- iow(db, DM9000_RCR, rcr);
  spin_unlock_irqrestore(&db->lock, flags);
 }
 
 
 /*
- * Sleep, either by using msleep() or if we are suspending, then
- * use mdelay() to sleep.
- */
-static void dm9000_msleep(board_info_t *db, unsigned int ms)
-{
- if (db->in_suspend)
-  mdelay(ms);
- else
-  msleep(ms);
-}
-
-/*
  *   Read a word from phyxcer
  */
 static int
@@ -1258,8 +1106,6 @@
  unsigned int reg_save;
  int ret;
 
- mutex_lock(&db->addr_lock);
-
  spin_lock_irqsave(&db->lock,flags);
 
  /* Save previous register address */
@@ -1269,15 +1115,7 @@
  iow(db, DM9000_EPAR, DM9000_PHY | reg);
 
  iow(db, DM9000_EPCR, 0xc); /* Issue phyxcer read command */
-
- writeb(reg_save, db->io_addr);
- spin_unlock_irqrestore(&db->lock,flags);
-
- dm9000_msleep(db, 1);  /* Wait read complete */
-
- spin_lock_irqsave(&db->lock,flags);
- reg_save = readb(db->io_addr);
-
+ udelay(100);  /* Wait read complete */
  iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
 
  /* The read data keeps on REG_0D & REG_0E */
@@ -1285,9 +1123,9 @@
 
  /* restore the previous address */
  writeb(reg_save, db->io_addr);
+
  spin_unlock_irqrestore(&db->lock,flags);
 
- mutex_unlock(&db->addr_lock);
  return ret;
 }
 
@@ -1301,8 +1139,6 @@
  unsigned long flags;
  unsigned long reg_save;
 
- mutex_lock(&db->addr_lock);
-
  spin_lock_irqsave(&db->lock,flags);
 
  /* Save previous register address */
@@ -1312,38 +1148,25 @@
  iow(db, DM9000_EPAR, DM9000_PHY | reg);
 
  /* Fill the written data into REG_0D & REG_0E */
- iow(db, DM9000_EPDRL, value);
- iow(db, DM9000_EPDRH, value >> 8);
+ iow(db, DM9000_EPDRL, (value & 0xff));
+ iow(db, DM9000_EPDRH, ((value >> 8) & 0xff));
 
  iow(db, DM9000_EPCR, 0xa); /* Issue phyxcer write command */
-
- writeb(reg_save, db->io_addr);
- spin_unlock_irqrestore(&db->lock, flags);
-
- dm9000_msleep(db, 1);  /* Wait write complete */
-
- spin_lock_irqsave(&db->lock,flags);
- reg_save = readb(db->io_addr);
-
+ udelay(500);  /* Wait write complete */
  iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
 
  /* restore the previous address */
  writeb(reg_save, db->io_addr);
 
  spin_unlock_irqrestore(&db->lock, flags);
- mutex_unlock(&db->addr_lock);
 }
 
 static int
 dm9000_drv_suspend(struct platform_device *dev, pm_message_t state)
 {
  struct net_device *ndev = platform_get_drvdata(dev);
- board_info_t *db;
 
  if (ndev) {
-  db = (board_info_t *) ndev->priv;
-  db->in_suspend = 1;
-
   if (netif_running(ndev)) {
    netif_device_detach(ndev);
    dm9000_shutdown(ndev);
@@ -1366,8 +1189,6 @@
 
    netif_device_attach(ndev);
   }
-
-  db->in_suspend = 0;
  }
  return 0;
 }
@@ -1383,7 +1204,8 @@
  dm9000_release_board(pdev, (board_info_t *) ndev->priv);
  free_netdev(ndev);  /* free device structure */
 
- dev_dbg(&pdev->dev, "released and freed device/n");
+ PRINTK1("clean_module() exit/n");
+
  return 0;
 }
 
@@ -1401,7 +1223,7 @@
 static int __init
 dm9000_init(void)
 {
- printk(KERN_INFO "%s Ethernet Driver, V%s/n", CARDNAME, DRV_VERSION);
+ printk(KERN_INFO "%s Ethernet Driver/n", CARDNAME);
 
  return platform_driver_register(&dm9000_driver); /* search board and register */
 }

 

5.3、USB驱动补丁

diff -urNwB linux-2.6.25.8/drivers/usb/host/Kconfig linux-2.6.25.8_EmbedSky/drivers/usb/host/Kconfig
--- linux-2.6.25.8/drivers/usb/host/Kconfig 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/drivers/usb/host/Kconfig 2009-01-11 00:17:06.000000000 +0800
@@ -4,6 +4,11 @@
 comment "USB Host Controller Drivers"
  depends on USB
 
+config EmbedSky_TWO_USB_HOST
+ bool "EmbedSky TWO USB HOST"
+ ---help---
+  S3C2440 can use two usb Host or one usb host and one usb device.
+
 config USB_EHCI_HCD
  tristate "EHCI HCD (USB 2.0) support"
  depends on USB && USB_ARCH_HAS_EHCI
diff -urNwB linux-2.6.25.8/drivers/usb/host/ohci-s3c2410.c linux-2.6.25.8_EmbedSky/drivers/usb/host/ohci-s3c2410.c
--- linux-2.6.25.8/drivers/usb/host/ohci-s3c2410.c 2008-06-22 13:25:26.000000000 +0800
+++ linux-2.6.25.8_EmbedSky/drivers/usb/host/ohci-s3c2410.c 2009-01-11 00:43:33.000000000 +0800
@@ -24,6 +24,9 @@
 
 #include
 #include
+#ifdef CONFIG_EmbedSky_TWO_USB_HOST
+#include
+#endif
 
 #define valid_port(idx) ((idx) == 1 || (idx) == 2)
 
@@ -347,6 +350,15 @@
  struct usb_hcd *hcd = NULL;
  int retval;
 
+#ifdef CONFIG_EmbedSky_TWO_USB_HOST
+ printk("Initial EmbedSky TWO USB HOST Driver!/n");
+ unsigned long reg_misccr;
+ reg_misccr = 0;
+ reg_misccr = readl(S3C2410_MISCCR);
+ reg_misccr = reg_misccr | S3C2410_MISCCR_USBHOST;
+ writel(reg_misccr,S3C2410_MISCCR);
+#endif
+
  s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
  s3c2410_usb_set_power(dev->dev.platform_data, 2, 1);

6、编译内核

make bzImage

 

7、制作或者从网上下载Android文件系统

这里主要是想先体验一下Android系统,所以我直接从网上下载了Android文件系统http://www.arm123.com.cn/android/android-fs-20090825.tgz

将解压后的文件系统放到U盘的一个ext3分区中,然后将U盘挂载到开发板中。直接chroot /mnt/rootfs /system/bin/sh切换至Android系统中,并执行./linuxrc和logcat指令。

文件系统目录结构如下:

drwxr-xr-x    2 1000     1000         4096 Aug 24  2009 bin
drwxrwx---    3 1000     2001         4096 Mar 21  2010 cache
drwxrwx--x   12 1000     1000         4096 Nov 21 13:19 data
-rwxr-xr-x    1 1000     1000          183 Aug 11  2009 default.prop
drwxr-xr-x    9 0        0           12520 Nov 21 15:58 dev
lrwxrwxrwx    1 0        0              11 Mar 21  2010 etc -> /system/etc
-rwxr-xr-x    1 1000     1000         1754 Aug 11  2009 init.goldfish.rc
-rwxr-xr-x    1 1000     1000         9009 Aug 23  2009 init.rc
drwxr-xr-x    4 1000     1000         4096 Aug 24  2009 lib
-rwxr-xr-x    1 1000     1000          195 Aug 24  2009 linuxrc
drwxr-xr-x    2 1000     1000         4096 Aug 11  2009 lost+found
drwxr-xr-x    2 1000     1000         4096 Mar 20  2010 myDev
drwxr-xr-x    2 1000     1000         4096 Mar 20  2010 other
dr-xr-xr-x   56 0        0               0 Jan  1  1970 proc
drwxr-xr-x    2 1000     1000         4096 Aug 11  2009 sbin
d---------    2 1000     1000         4096 Mar 21  2010 sdcard
drwxrwx--x    2 1000     1000         4096 Nov 21 13:20 shared_prefs
drwxrwxrwt    2 0        0            4096 Nov 21 13:21 sqlite_stmt_journals
drwxr-xr-x   11 0        0               0 Jan  1  1970 sys
drwxr-xr-x   12 1000     1000         4096 Aug 11  2009 system
drwxr-xr-x    3 1000     1000         4096 Aug 11  2009 var

 

8、关于NFS和U盘挂载文件系统的说明

8.1、NFS挂载文件系统

通过NFS挂载文件系统,必须确保网卡驱动没有问题,并且主机已经正确配置好NFS的相关服务。最好是先用ping测试下看有没有问题。如果没有添加NFS支持,则出现如下错误提示。

mount: mounting 192.168.1.100:/home/san/Desktop/root_fs/android_fs_old on /mnt/r
ootfs/ failed: Protocol not supported

添加NFS支持即可,如下

File systems  --->
[*] Network File Systems  --->
 <*>   NFS file system support                                       
  │ │    [*]     Provide NFSv3 client support                                 

    [*]       Provide client support for the NFSv3 ACL protocol extensio

  │ │    [ ]     Provide NFSv4 client support (EXPERIMENTAL)                  
  │ │    [*]     Allow direct I/O on NFS files                                 
  │ │    < >   NFS server support                                              
  │ │    [*]   Root file system on NFS       

用NFS挂载的指令是mount -t nfs 192.168.1.100:/home/san/Desktop/root_fs/ /mnt/rootfs/ -o nolock

但是用这种方式挂载会出现no responding的情况,最终我没有用这种方式。

8.2、U盘挂载方式

用这种方式需要U盘驱动,并且在内核中添加ext2,ext3文件系统支持,通过chroot切换至Android文件系统。

9、结论

Android已经跑起来了,但LCD驱动还没移植,暂时动不了,等待下一步完善。。。

10、linxu启动log

Booting Linux ...
Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00200000 ... Copy Kern
el to SDRAM done,NOW, Booting Linux......
Uncompressing Linux.............................................................
................................................... done, booting the kernel.
Linux version 2.6.25 (san@san-desktop) (gcc version 4.3.2 (Sourcery G++ Lite 200
8q3-72) ) #9 Sun Mar 21 17:10:30 HKT 2010
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SMDK2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
irq: clearing pending ext status 00080000
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61056KB available (3180K code, 510K data, 148K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
ashmem: initialized
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
yaffs Mar 21 2010 16:41:11 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver
eth0: dm9000 at c485e000,c4860004 IRQ 51 MAC: 00:11:22:33:44:55
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=2, 20ns Twrph0=3 30ns, Twrph1=2 20ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit
)
Scanning device for bad blocks
Bad eraseblock 1510 at 0x01798000
Bad eraseblock 2369 at 0x02504000
Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00040000 : "TQ2440_uboot"
0x0004c000-0x0024c000 : "TQ2440_kernel"
0x0024c000-0x03ffc000 : "TQ2440_yaffs2"
usbmon: debugfs is not available
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 390 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
s3c2410-rtc s3c2410-rtc: setting system clock to 2008-11-21 15:47:49 UTC (122728
2469)
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: block 1363 is marked bad
block 1364 is bad
yaffs: block 2222 is marked bad
block 2223 is bad
VFS: Mounted root (yaffs filesystem).
Freeing init memory: 148K
eth0: link down

Please press Enter to activate this console. scsi 0:0:0:0: Direct-Access     Kin
gston DataTraveler G2  PMAP PQ: 0 ANSI: 0 CCS
sd 0:0:0:0: [sda] 15675392 512-byte hardware sectors (8026 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 15675392 512-byte hardware sectors (8026 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1 sda2 sda3 sda4
sd 0:0:0:0: [sda] Attached SCSI removable disk

[root@san /]#

11、Android启动log

[root@san /mnt]#chroot /mnt/rootfs/tmp /system/bin/sh
[/u@/h /W]#./linuxrc &
[/u@/h /W]#logcat mknod: /myDev/ts0: File exists
mknod: /myDev/fb0: File exists
mknod: /myDev/ts_ctl: File exists
open file errer!
&
logcat: not found
[/u@/h /W]#ts_open: No such device
init: cannot open '/initlogo.rle'
sh: can't access tty; job control turned off
/ # init: cannot find '/system/bin/playmp3', disabling 'bootsound'
warning: `rild' uses 32-bit capabilities (legacy support in use)
eth0: link down

/system/bin/logcat &
/ # I/DEBUG   ( 1557): debuggerd: May 13 2009 23:22:59
E/flash_image( 1565): can't find recovery partition
D/mountd  ( 1556): AddMountPoint device: /dev/block/mmcblk0p1, mountPoint: /sdca
rd driverStorePath: /sys/devices/platform/usb_mass_storage/lun0/file
E/mountd  ( 1556): could not read initial mass storage state
D/mountd  ( 1556): USB offline
D/mountd  ( 1556): RequestMount /sdcard
D/AndroidRuntime( 1559):
D/AndroidRuntime( 1559): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1559): CheckJNI is ON
I/        ( 1560): ServiceManager: 0xabe0
W/AudioHardwareInterface( 1560): Using stubbed audio hardware. No sound will be
produced.
I/AudioFlinger( 1560): AudioFlinger's main thread ready to run.
I/CameraService( 1560): CameraService started: pid=1560
D/AndroidRuntime( 1559): --- registering native functions ---
I/Zygote  ( 1559): Preloading classes...
D/dalvikvm( 1559): GC freed 763 objects / 42112 bytes in 11ms
D/dalvikvm( 1559): GC freed 280 objects / 17456 bytes in 12ms
D/dalvikvm( 1559): GC freed 306 objects / 18656 bytes in 13ms
D/dalvikvm( 1559): Trying to load lib /lib/libmedia_jni.so 0x0
I/dalvikvm( 1559): Unable to dlopen(/lib/libmedia_jni.so): Cannot find library
D/dalvikvm( 1559): Trying to load lib /system/lib/libmedia_jni.so 0x0
D/dalvikvm( 1559): Added shared lib /system/lib/libmedia_jni.so 0x0
D/dalvikvm( 1559): Trying to load lib /lib/libmedia_jni.so 0x0
I/dalvikvm( 1559): Unable to dlopen(/lib/libmedia_jni.so): Cannot find library
D/dalvikvm( 1559): Trying to load lib /system/lib/libmedia_jni.so 0x0
D/dalvikvm( 1559): Shared lib '/system/lib/libmedia_jni.so' already loaded in sa
me CL 0x0
D/dalvikvm( 1559): Trying to load lib /lib/libmedia_jni.so 0x0
I/dalvikvm( 1559): Unable to dlopen(/lib/libmedia_jni.so): Cannot find library
D/dalvikvm( 1559): Trying to load lib /system/lib/libmedia_jni.so 0x0
D/dalvikvm( 1559): Shared lib '/system/lib/libmedia_jni.so' already loaded in sa
me CL 0x0
D/dalvikvm( 1559): Trying to load lib /lib/libmedia_jni.so 0x0
I/dalvikvm( 1559): Unable to dlopen(/lib/libmedia_jni.so): Cannot find library
D/dalvikvm( 1559): Trying to load lib /system/lib/libmedia_jni.so 0x0
D/dalvikvm( 1559): Shared lib '/system/lib/libmedia_jni.so' already loaded in sa
me CL 0x0
D/dalvikvm( 1559): GC freed 3739 objects / 177928 bytes in 36ms
D/dalvikvm( 1559): GC freed 328 objects / 26232 bytes in 33ms
D/dalvikvm( 1559): GC freed 375 objects / 22576 bytes in 33ms
D/dalvikvm( 1559): GC freed 199 objects / 29728 bytes in 34ms
D/dalvikvm( 1559): GC freed 102 objects / 23888 bytes in 54ms
D/dalvikvm( 1559): GC freed 379 objects / 23360 bytes in 56ms
D/dalvikvm( 1559): Trying to load lib /lib/libwebcore.so 0x0
I/dalvikvm( 1559): Unable to dlopen(/lib/libwebcore.so): Cannot find library
D/dalvikvm( 1559): Trying to load lib /system/lib/libwebcore.so 0x0
D/dalvikvm( 1559): Added shared lib /system/lib/libwebcore.so 0x0
D/dalvikvm( 1559): GC freed 452 objects / 28368 bytes in 58ms
D/dalvikvm( 1559): GC freed 380 objects / 26080 bytes in 61ms
D/dalvikvm( 1559): GC freed 292 objects / 19320 bytes in 62ms
D/dalvikvm( 1559): GC freed 2149 objects / 112360 bytes in 69ms
D/dalvikvm( 1559): GC freed 556 objects / 42952 bytes in 68ms
D/dalvikvm( 1559): GC freed 14030 objects / 489968 bytes in 94ms
D/dalvikvm( 1559): GC freed 10951 objects / 459512 bytes in 96ms
D/SSLSocketFactory( 1559): Using factory org.apache.harmony.xnet.provider.jsse.O
penSSLSocketFactoryImpl@40130ad0
D/dalvikvm( 1559): GC freed 6407 objects / 273312 bytes in 93ms
D/dalvikvm( 1559): GC freed 645 objects / 35192 bytes in 85ms
D/dalvikvm( 1559): GC freed 590 objects / 30568 bytes in 88ms
D/dalvikvm( 1559): GC freed 372 objects / 26328 bytes in 89ms
I/Zygote  ( 1559): ...preloaded 909 classes in 16333ms.
D/dalvikvm( 1559): GC freed 41 objects / 2384 bytes in 88ms
I/Zygote  ( 1559): Preloading resources...
D/dalvikvm( 1559): GC freed 6 objects / 8928 bytes in 89ms
D/dalvikvm( 1559): GC freed 198 objects / 10184 bytes in 92ms
D/dalvikvm( 1559): GC freed 253 objects / 10200 bytes in 93ms
I/Zygote  ( 1559): ...preloaded 42 resources in 1175ms.
D/dalvikvm( 1559): GC freed 15 objects / 1704 bytes in 93ms
D/dalvikvm( 1559): GC freed 99 objects / 3912 bytes in 92ms
D/dalvikvm( 1559): GC freed 30 objects / 1112 bytes in 91ms
I/dalvikvm( 1559): Splitting out new zygote heap
I/dalvikvm( 1559): System server process 1582 has been created
I/Zygote  ( 1559): Accepting command socket connections
D/dalvikvm( 1582): Trying to load lib /lib/libandroid_servers.so 0x0
I/dalvikvm( 1582): Unable to dlopen(/lib/libandroid_servers.so): Cannot find lib
rary
D/dalvikvm( 1582): Trying to load lib /system/lib/libandroid_servers.so 0x0
D/dalvikvm( 1582): Added shared lib /system/lib/libandroid_servers.so 0x0
I/sysproc ( 1582): Entered system_init()
I/sysproc ( 1582): ServiceManager: 0xcdb90
I/SurfaceFlinger( 1582): SurfaceFlinger is starting
I/SurfaceFlinger( 1582): SurfaceFlinger's main thread ready to run. Initializing
 graphics H/W...
E/MemoryHeapBase( 1582): error opening /dev/pmem: No such file or directory
E/SurfaceFlinger( 1582): Couldn't open /sys/power/wait_for_fb_sleep or /sys/powe
r/wait_for_fb_wake
E/GLLogger( 1582): couldn't load library (Cannot find library)
I/SurfaceFlinger( 1582): EGL informations:
I/SurfaceFlinger( 1582): # of configs : 6
I/SurfaceFlinger( 1582): vendor    : Android
I/SurfaceFlinger( 1582): version   : 1.3 Android META-EGL
I/SurfaceFlinger( 1582): extensions: EGL_ANDROID_query_string_config EGL_ANDROID
_swap_rectangle
I/SurfaceFlinger( 1582): ext/config: EGL_ANDROID_swap_rectangle
I/SurfaceFlinger( 1582): Client API: OpenGL ES
W/EGLDisplaySurface( 1582): FBIOPUT_VSCREENINFO failed, page flipping not suppor
ted
W/EGLDisplaySurface( 1582): page flipping not supported (yres_virtual=320, reque
sted=640)
I/EGLDisplaySurface( 1582): using (fd=21)
I/EGLDisplaySurface( 1582): id           = s3c2410fb
I/EGLDisplaySurface( 1582): xres         = 240 px
I/EGLDisplaySurface( 1582): yres         = 320 px
I/EGLDisplaySurface( 1582): xres_virtual = 240 px
I/EGLDisplaySurface( 1582): yres_virtual = 320 px
I/EGLDisplaySurface( 1582): bpp          = 16
I/EGLDisplaySurface( 1582): r            = 11:5
I/EGLDisplaySurface( 1582): g            =  5:6
I/EGLDisplaySurface( 1582): b            =  0:5
I/EGLDisplaySurface( 1582): width        = 240 mm (25.400000 dpi)
I/EGLDisplaySurface( 1582): height       = 320 mm (25.400000 dpi)
I/EGLDisplaySurface( 1582): refresh rate = 66.83 Hz
W/SurfaceFlinger( 1582): ro.sf.lcd_density not defined, using 160 dpi by default
.
I/SurfaceFlinger( 1582): OpenGL informations:
I/SurfaceFlinger( 1582): vendor    : Android
I/SurfaceFlinger( 1582): renderer  : Android PixelFlinger 1.0
I/SurfaceFlinger( 1582): version   : OpenGL ES-CM 1.0
I/SurfaceFlinger( 1582): extensions: GL_OES_byte_coordinates GL_OES_fixed_point
GL_OES_single_precision GL_OES_read_format GL_OES_compressed_paletted_texture GL
_OES_draw_texture GL_OES_matrix_get GL_OES_query_matrix GL_ARB_texture_compressi
on GL_ARB_texture_non_power_of_two GL_ANDROID_direct_texture GL_ANDROID_user_cli
p_plane GL_ANDROID_vertex_buffer_object GL_ANDROID_generate_mipmap
I/sysproc ( 1582): System server: starting Android runtime.
I/sysproc ( 1582): System server: starting Android services.
I/SystemServer( 1582): Entered the Android system server!
E/GLLogger( 1582): couldn't load library (Cannot find library)
I/sysproc ( 1582): System server: entering thread pool.
I/SystemServer( 1582): Starting Power Manager.
I/SystemServer( 1582): Starting Activity Manager.
I/SystemServer( 1582): Starting telephony registry
I/SystemServer( 1582): Starting Package Manager.
I/Installer( 1582): connecting...
I/installd( 1563): new connection
I/PackageManager( 1582): Got library android.awt in /system/framework/android.aw
t.jar
I/PackageManager( 1582): Got library android.test.runner in /system/framework/an
droid.test.runner.jar
I/PackageManager( 1582): Got library com.android.im.plugin in /system/framework/
com.android.im.plugin.jar
D/PackageManager( 1582): Scanning app dir /system/framework
D/PackageManager( 1582): Scanning app dir /system/app
D/dalvikvm( 1582): GC freed 5425 objects / 231784 bytes in 211ms
D/PackageManager( 1582): Scanning app dir /data/app
D/PackageManager( 1582): Scanning app dir /data/app-private
I/PackageManager( 1582): Time to scan packages: 9.278 seconds
W/PackageManager( 1582): Removing dangling permission: android.permission.ACCESS
_CACHE_FILESYSTEM from package null
W/PackageManager( 1582): Not granting permission android.permission.INSTALL_PACK
AGES to package com.android123.apkInstaller (protectionLevel=2 flags=0x45)
W/PackageManager( 1582): Not granting permission android.permission.DELETE_PACKA
GES to package com.android123.apkInstaller (protectionLevel=2 flags=0x45)
W/PackageManager( 1582): Unknown permission com.google.android.providers.gmail.p
ermission.WRITE_GMAIL in package com.android.settings
W/PackageManager( 1582): Unknown permission com.google.android.providers.gmail.p
ermission.READ_GMAIL in package com.android.settings
W/PackageManager( 1582): Unknown permission com.google.android.googleapps.permis
sion.GOOGLE_AUTH in package com.android.settings
W/PackageManager( 1582): Unknown permission android.permission.ACCESS_DOWNLOAD_M
ANAGER in package com.android.settings
W/PackageManager( 1582): Unknown permission com.google.android.googleapps.permis
sion.GOOGLE_AUTH in package com.android.browser
W/PackageManager( 1582): Unknown permission android.permission.ACCESS_DOWNLOAD_M
ANAGER in package com.android.browser
D/dalvikvm( 1582): GC freed 2131 objects / 150912 bytes in 207ms
I/SystemServer( 1582): Starting Content Manager.
W/ActivityManager( 1582): Unable to start service Intent { action=android.accoun
ts.IAccountsService comp={com.google.android.googleapps/com.google.android.googl
eapps.GoogleLoginService} }: not found
W/AccountMonitor( 1582): Couldn't connect to Intent { action=android.accounts.IA
ccountsService comp={com.google.android.googleapps/com.google.android.googleapps
.GoogleLoginService} } (Missing service?)
I/SystemServer( 1582): Starting System Content Providers.
I/ActivityThread( 1582): Publishing provider settings: com.android.providers.set
tings.SettingsProvider
I/ActivityThread( 1582): Publishing provider android.server.checkin: android.ser
ver.checkin.CheckinProvider
I/ActivityThread( 1582): Publishing provider sync: android.content.SyncProvider
I/SystemServer( 1582): Starting Battery Service.
E/BatteryService( 1582): Could not open '/sys/class/power_supply/ac/online'
E/BatteryService( 1582): Could not open '/sys/class/power_supply/usb/online'
E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/present
'
E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/capacit
y'
E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/batt_vo
l'
E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/batt_te
mp'
E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/status'

E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/health'

E/BatteryService( 1582): Could not open '/sys/class/power_supply/battery/technol
ogy'
E/power   ( 1582): set_a_light failed to open /sys/class/leds/keyboard-backlight
/brightness
I/SystemServer( 1582): Starting Alarm Manager.
W/AlarmManager( 1582): Failed to open alarm driver. Falling back to a handler.
I/SystemServer( 1582): Starting Sensor Service.
I/SystemServer( 1582): Starting Window Manager.
E/EventHub( 1582): could not get driver version for /dev/input/mice, Not a typew
riter
D/SensorManager( 1582): found sensor: null, handle=0
I/SystemServer( 1582): Starting Bluetooth Service.
I/SystemServer( 1582): Starting Status Bar Service.
I/SystemServer( 1582): Starting Clipboard Service.
I/SystemServer( 1582): Starting Input Method Service.
I/InputManagerService( 1582): Enabled input methods: com.example.android.softkey
board/.SoftKeyboard
I/SystemServer( 1582): Starting Hardware Service.
I/SystemServer( 1582): Starting NetStat Service.
I/SystemServer( 1582): Starting Connectivity Service.
D/WifiService( 1582): WifiService starting up with Wi-Fi disabled
I/SystemServer( 1582): Starting Notification Manager.
I/SystemServer( 1582): Starting Mount Service.
I/SystemServer( 1582): Starting DeviceStorageMonitor service
D/MountListener( 1582): handleEvent ums_disconnected
I/DeviceStorageMonitorService( 1582): Running low on memory. Sending notificatio
n
W/PackageManager( 1582): Couldn't clear application caches
D/MountListener( 1582): handleEvent ums_disabled
I/SystemServer( 1582): Starting Location Manager.
D/LocationManagerService( 1582): Constructed LocationManager Service
I/System.out( 1582): #### #### Setting locale to zh_CN
D/libhardware_legacy( 1582): no GPS hardware on this device
I/SystemServer( 1582): Starting Search Service.
I/SystemServer( 1582): Starting Checkin Service
W/SystemServer( 1582): Could not find com.google.android.server.checkin.CheckinS
ervice, trying fallback
I/SystemServer( 1582): Starting Wallpaper Service
D/WallpaperService( 1582): WallpaperService startup
I/SystemServer( 1582): Starting Audio Service
I/SystemServer( 1582): Starting HeadsetObserver
W/HeadsetObserver( 1582): This kernel does not have wired headset support
I/SystemServer( 1582): Starting Gadget Service
I/SystemServer( 1582): Starting OpdPrint Service
D/OpdPrintService( 1582): OpdPrintService startup
I/WindowManager( 1582): Input configuration changed: { scale=1.0 imsi=0/0 locale
=zh_CN touch=1 key=1/1/2 nav=1 orien=1 }
I/WindowManager( 1582): Menu key state: -1
D/PowerManagerService( 1582): system ready!
D/ActivityManager( 1582): Start running!
I/Zygote  ( 1582): Process: zygote socket opened
I/ActivityManager( 1582): Start proc com.android.phone for added application com
.android.phone: pid=1619 uid=1001 gids={3002, 3001, 3003}
I/ActivityManager( 1582): Starting activity: Intent { action=android.intent.acti
on.MAIN categories={android.intent.category.HOME} flags=0x10000000 comp={com.and
roid.launcher/com.android.launcher.Launcher} }
I/ActivityManager( 1582): Start proc android.process.acore for activity com.andr
oid.launcher/.Launcher: pid=1621 uid=10007 gids={}
D/dalvikvm( 1582): GC freed 5382 objects / 295976 bytes in 408ms
W/ResourceType( 1582): No package identifier when getting value for resource num
ber 0x00000000
W/StatusBar( 1582): Icon not found in : 0
I/ActivityThread( 1621): Publishing provider com.android.launcher.settings: com.
android.launcher.LauncherProvider
I/ActivityThread( 1619): Publishing provider sim: com.android.phone.SimProvider
D/StatusBar( 1582): updateResources
E/ActivityThread( 1619): Failed to find provider info for call_log
D/PhoneApp( 1619): [PhoneIntfMgr] publish: com.android.phone.PhoneInterfaceManag
er@436de350
D/dalvikvm( 1621): GC freed 1338 objects / 96488 bytes in 306ms
D/PhoneApp( 1619): Resetting audio state/mode: IDLE
V/ActivityThread( 1621): Resuming ActivityRecord{436b6998 token=android.os.Binde
rProxy@436b6428 {com.android.launcher/com.android.launcher.Launcher}} with isFor
ward=false
I/ActivityManager( 1582): Displayed activity com.android.launcher/.Launcher: 509
2 ms
D/BT HSHFP( 1619): Starting BluetoothHeadsetService
D/PhoneApp( 1619): [CallNotifier] onMwiChanged(): false
D/PhoneApp( 1619): [CallNotifier] onCfiChanged(): false
I/SurfaceFlinger( 1582): Boot is finished (26357 ms)
I/WindowManager( 1582): Input configuration changed: { scale=1.0 imsi=0/0 locale
=zh_CN touch=1 key=1/1/2 nav=1 orien=1 }
D/dalvikvm( 1582): GC freed 3194 objects / 147760 bytes in 319ms
W/InputManagerService( 1582): Starting input on non-focused client android.view.
inputmethod.InputMethodManager$1@4379e6a8 (uid=1000 pid=1582)
W/InputManagerService( 1582): Ignoring focus gain of: android.view.inputmethod.I
nputMethodManager$1@4379e6a8
I/ActivityManager( 1582): Start proc android.process.media for broadcast com.and
roid.providers.media/.MediaScannerReceiver: pid=1646 uid=10006 gids={1006}
I/ActivityManager( 1582): Start proc com.example.android.softkeyboard for servic
e com.example.android.softkeyboard/.SoftKeyboard: pid=1653 uid=10004 gids={}
I/ActivityThread( 1646): Publishing provider media: com.android.providers.media.
MediaProvider
V/MediaProvider( 1646): Attached volume: internal
D/MediaScannerService( 1646): start scanning volume internal
D/MediaScanner( 1646):  prescan time: 269ms
D/MediaScanner( 1646):     scan time: 255ms
D/MediaScanner( 1646): postscan time: 1ms
D/MediaScanner( 1646):    total time: 525ms
D/MediaScannerService( 1646): done scanning volume internal
I/ActivityManager( 1582): Stopping service: com.android.providers.media/.MediaSc
annerService

你可能感兴趣的:(linux)