首页 > 代码库 > linux-3.4.2移植到FL2440上(一)

linux-3.4.2移植到FL2440上(一)

1.修改
Makefile:
ARCH            ?= arm
CROSS_COMPILE   ?= arm-linux-

2.修改串口时钟:
在/arch/arm/mach-s3c24xx/mach-smdk2440.c
改为12M
s3c24xx_init_clocks(12000000);/* by zhutao */

3.裁剪内核:
  │     -> System Type                                                                                                                      │  
  │       -> SAMSUNG S3C24XX SoCs Support
  │ │                                   *** S3C24XX SoCs ***                                                                              │ │  
  │ │                               [ ] SAMSUNG S3C2410                                                                                   │ │  
  │ │                               [ ] SAMSUNG S3C2412                                                                                   │ │  
  │ │                               [ ] SAMSUNG S3C2416/S3C2450                                                                           │ │  
  │ │                               [*] SAMSUNG S3C2440                                                                                   │ │  
  │ │                               [ ] SAMSUNG S3C2442                                                                                   │ │  
  │ │                               [ ] SAMSUNG S3C2443                                                                                   │ │  
  │ │                                   *** S3C2440 Boards ***                                                                            │ │  
  │ │                               [ ] Simtec Electronics ANUBIS                                                                         │ │  
  │ │                               [ ] Avantech AT2440EVB development board                                                              │ │  
  │ │                               [ ] MINI2440 development board                                                                        │ │  
  │ │                               [ ] NexVision NEXCODER 2440 Light Board                                                               │ │  
  │ │                               [ ] Simtec IM2440D20 (OSIRIS) module                                                                  │ │  
  │ │                               [ ] HP iPAQ rx3715                                                                                    │ │  
  │ │                               [*] SMDK2440                                                                                          │ │  
  │ │                               [*] SMDK2440 with S3C2440 CPU module   
只留下这些。

4.添加串口调试打印:

     -> Device Drivers                                                                                                                   │  
  │       -> Character devices                                                                                                              │  
  │         -> Serial drivers

 │                               <*> Samsung SoC serial support                                                                        │ │  
  │ │                               [*] Samsung SoC serial debug                                                                          │ │  
  │ │                               [*] Support for console on Samsung SoC serial port     

这三个选上。

5.make zImage

6.启动后出现如下错误
Starting kernel ...                                                             
                                                                                
Uncompressing Linux... done, booting the kernel.                                
s3c24xx_serial_probe(c04798e0) 0                                                
s3c24xx_serial_probe: initialising port c0467dbc...                             
s3c24xx_serial_init_port: port=c0467ddc, platdev=c04798e0                       
resource c0458670 (50000000..50003fff)                                          
port: map=50000000, mem=f7000000, irq=70 (70,71), clock=1                       
                                                         s3c24xx_serial_probe: t
s3c24xx_serial_console_setup: co=c04680d4 (0), (null)                           
s3c24xx_serial_console_setup: port=c0467ddc (0)                                 
s3c24xx_serial_get_options: port=c0467ddc                             //ulcon = 3=11b 串口设置为8N1模式         
registers: ulcon=00000003, ucon=000003c5, ubdriv=0000001a             //ucon=000003c5=1111000101b   UBRDIVn=11 = FCLK/n          
calculated baud 0                                                               
s3c24xx_serial_console_setup: baud 0                                            
udivslot = 4a52 (div 6)                                                         
config: 8bits/char                                                              
setting ulcon to 00000003, brddiv to 81, udivslot 00004a52???????????

执行到这个文件:/drivers/tty/serial/samsung.c

    spin_lock_irqsave(&port->lock, flags);
    /* 在下面是 */
/*
    dbg("setting ulcon to %08x, brddiv to %d, udivslot %08x\n",
        ulcon, quot, udivslot);                    /* 这一句打印了 */

    wr_regl(port, S3C2410_ULCON, ulcon);    
    wr_regl(port, S3C2410_UBRDIV, quot);    
    wr_regl(port, S3C2410_UMCON, umcon);

    if (ourport->info->has_divslot)
        wr_regl(port, S3C2443_DIVSLOT, udivslot);
*/
    dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",    /* 打印这一句就乱码了 */
        rd_regl(port, S3C2410_ULCON),
        rd_regl(port, S3C2410_UCON),
        rd_regl(port, S3C2410_UFCON));

所以注释掉上面绿色部分,再编译启动后,就没有打印问题了。

linux-3.4.2移植到FL2440上(一)