Arm Linux 2.6.36编译

来源:互联网 发布:北京知产法院电话 编辑:程序博客网 时间:2024/05/20 02:24

2.6.36的内核移植到SkyEye 1.3.1上和2.6.20还是有点区别的。SkyEye的安装这里就不说的,需要注意的是gcc最好使用友善之臂的 4.4.3(http://arm9download.cncncn.com/mini2440/linux/arm-linux-gcc-4.4.3-20100728.tar.gz),传说中这个版本编译QT时能避免所有的Segmentation Fault。呵呵,真实与否暂不舆论。
先下载linux-2.6.36.tar.bz2(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.36.tar.bz2),下面详细给出2.6.36的编译过程:

1. tar jxvf linux-2.6.36.tar.bz2

2. cd linux-2.6.36/

3. gedit arch/arm/mach-s3c2410/include/mach/memory.h &
    将:
#define PHYS_OFFSET    UL(0x30000000)
    修改成:
#define PHYS_OFFSET    UL(0xC0000000)

4. gedit arch/arm/mach-s3c2410/include/mach/map.h &
    将:
#define S3C2410_CS6 (0x30000000)
    修改成:
#define S3C2410_CS6 (0xC0000000)

5. gedit arch/arm/mach-s3c2410/include/mach/smdk2410.h &
    在文件中添加以下内容:
#ifndef _INCLUDE_SMDK2410_H_
#define _INCLUDE_SMDK2410_H_

#include <generated/autoconf.h>

#define pSMDK2410_ETH_IO __phys_to_pfn(0x19000000)
#define vSMDK2410_ETH_IO S3C2410_ADDR(0xE0000000)
#define SMDK2410_ETH_IRQ IRQ_EINT9

#define pSMDK2410_TS_IO __phys_to_pfn(0x19100000)
#define vSMDK2410_TS_IO S3C2410_ADDR(0xE0100000)
#define SMDK2410_TS_IRQ IRQ_EINT19

#endif // _INCLUDE_SMDK2410_H_

6. gedit arch/arm/mach-s3c2410/mach-smdk2410.c &
    添加以下内容:
#include <mach/smdk2410.h>
#include <mach/regs-lcd.h>
#include <mach/fb.h>

static struct s3c2410fb_display s3c2410_lcd_cfg __initdata = {
    .type = S3C2410_LCDCON1_TFT,
 
    .lcdcon5    = S3C2410_LCDCON5_FRM565 |
                  S3C2410_LCDCON5_INVVLINE |
                  // S3C2410_LCDCON5_INVVCLK |
                  S3C2410_LCDCON5_INVVFRAME |
                  // S3C2410_LCDCON5_INVLEND|
                 S3C2410_LCDCON5_PWREN |
                  S3C2410_LCDCON5_HWSWP,

   .width       = 320,
   .height        = 240,
   .xres        = 320,
   .yres        = 240,
   .bpp            = 16,

    .pixclock     = 100000,
    .left_margin  = 13,
    .right_margin = 8,
    .hsync_len    = 4,
    .upper_margin = 2,
    .lower_margin = 7,
    .vsync_len    = 4,
};

static struct s3c2410fb_mach_info s3c2410_lcd_info __initdata = {
    .displays=     &s3c2410_lcd_cfg,
    .num_displays=     1,
    .default_display= 0,
 
    .gpcup=         0xffffffff,
    .gpcup_mask=    0xffffffff,
    .gpccon=        0xaaaaaaaa,
    .gpccon_mask=   0xffffffff,
    .gpdup  =       0xFFFFFFFF,
    .gpdup_mask=    0xffffffff,
    .gpdcon=        0xaaaaaaaa,
    .gpdcon_mask=   0xffffffff,

    .lpcsel=     0,// ((0xCE6) & ~7) | 1<<4,
};

    在smdk2410_iodesc的定义中添加以下内容:
  /* Map the ethernet controller CS8900A */
  {vSMDK2410_ETH_IO,pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE},
  /* Map the touchscreen controller SKYEYE */
  {vSMDK2410_TS_IO,pSMDK2410_TS_IO, SZ_1M, MT_DEVICE},

    在smdk2410_init的定义中s3c_i2c0_set_platdata(NULL);这一句的下面添加:
    s3c24xx_fb_set_platdata(&s3c2410_lcd_info);

7. gedit arch/arm/plat-s3c24xx/common-smdk.c &
    将结构定义mtd_partition smdk_default_nand_part由:
static struct mtd_partition smdk_default_nand_part[] = {
    [0] = {
        .name    = "Boot Agent",
        .size    = SZ_16K,
        .offset    = 0,
    },
    [1] = {
        .name    = "S3C2410 flash partition 1",
        .offset = 0,
        .size    = SZ_2M,
    },
    [2] = {
        .name    = "S3C2410 flash partition 2",
        .offset = SZ_4M,
        .size    = SZ_4M,
    },
    [3] = {
        .name    = "S3C2410 flash partition 3",
        .offset    = SZ_8M,
        .size    = SZ_2M,
    },
    [4] = {
        .name    = "S3C2410 flash partition 4",
        .offset = SZ_1M * 10,
        .size    = SZ_4M,
    },
    [5] = {
        .name    = "S3C2410 flash partition 5",
        .offset    = SZ_1M * 14,
        .size    = SZ_1M * 10,
    },
    [6] = {
        .name    = "S3C2410 flash partition 6",
        .offset    = SZ_1M * 24,
        .size    = SZ_1M * 24,
    },
    [7] = {
        .name    = "S3C2410 flash partition 7",
        .offset = SZ_1M * 48,
        .size    = SZ_16M,
    }
};
改成:
static struct mtd_partition smdk_default_nand_part[] = {
    [0] = {
        .name    = "S3C2410 flash partition 1",
        .offset = 0,
        .size    = SZ_32M,
    },
    [1] = {
        .name    = "S3C2410 flash partition 2",
        .offset = SZ_32M,
        .size    = SZ_32M,
    }/*,
    [2] = {
        .name    = "S3C2410 flash partition 2",
        .offset = SZ_4M,
        .size    = SZ_4M,
    },
    [3] = {
        .name    = "S3C2410 flash partition 3",
        .offset    = SZ_8M,
        .size    = SZ_2M,
    },
    [4] = {
        .name    = "S3C2410 flash partition 4",
        .offset = SZ_1M * 10,
        .size    = SZ_4M,
    },
    [5] = {
        .name    = "S3C2410 flash partition 5",
        .offset    = SZ_1M * 14,
        .size    = SZ_1M * 10,
    },
    [6] = {
        .name    = "S3C2410 flash partition 6",
        .offset    = SZ_1M * 24,
        .size    = SZ_1M * 24,
    },
    [7] = {
        .name    = "S3C2410 flash partition 7",
        .offset = SZ_1M * 48,
        .size    = SZ_16M,
    }*/
};

将:
static struct s3c2410_nand_set smdk_nand_sets[] = {
    [0] = {
        .name        = "NAND",
        .nr_chips    = 1,
        .nr_partitions    = ARRAY_SIZE(smdk_default_nand_part),
        .partitions    = smdk_default_nand_part,
    },
};
改成:
static struct s3c2410_nand_set smdk_nand_sets[] = {
    [0] = {
        .name        = "NAND",
        .nr_chips    = 1,
        .disable_ecc    = 1,
        .nr_partitions    = ARRAY_SIZE(smdk_default_nand_part),
        .partitions    = smdk_default_nand_part,
    },
};

8. gedit arch/arm/plat-samsung/time.c &
    将函数s3c2410_timer_setup中的:
    if (tcnt > TICK_MAX) {
    修改成:
    if (tcnt > 0xffffffff) {

9. gedit arch/arm/mach-s3c2410/Makefile.boot &
将:
ifeq ($(CONFIG_PM_H1940),y)
    zreladdr-y        := 0x30108000
    params_phys-y    := 0x30100100
else
    zreladdr-y        := 0x30008000
    params_phys-y    := 0x30000100
endif
改成:
ifeq ($(CONFIG_PM_H1940),y)
    zreladdr-y        := 0xC0108000
    params_phys-y    := 0xC0100100
else
    zreladdr-y        := 0xC0008000
    params_phys-y    := 0xC0000100
endif

10. 下载cs8900驱动(http://blog.csdn.net/Matrix_Designer/archive/2010/12/09/6065055.aspx ),然后:
cp cs8900.h drivers/net/arm/
cp cs8900.c drivers/net/arm/

11. gedit drivers/net/arm/Kconfig &
    在文件最后添加以下内容:
config ARM_CS8900
        tristate "CS8900 support"
        depends on NET_ETHERNET && ARM && ARCH_SMDK2410
        help
          Support for CS8900A chipset based Ethernet cards. If you have a network
          (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available
          from as well as .To compile this driver as a module, choose M here and read.
          The module will be called cs8900.o.

12. gedit drivers/net/arm/Makefile &
    在文件最后添加以下内容:
obj-$(CONFIG_ARM_CS8900)     += cs8900.o


13. 下载TouchScreen驱动(http://blog.csdn.net/Matrix_Designer/archive/2010/12/09/6065713.aspx ),然后:
cp skyeye_ts_drv.h drivers/input/touchscreen/
cp skyeye_ts_drv.c drivers/input/touchscreen/

14. gedit drivers/input/touchscreen/Kconfig &
在if INPUT_TOUCHSCREEN的下面添加以下内容:
config TOUCHSCREEN_SKYEYE
    tristate "SkyEye Touch Screen support"
    depends on INPUT && INPUT_TOUCHSCREEN
    help
      Support for skyeye based touchscreen. If you build the kernel
          for skyeye, and want to use the touchscreen, say Y. To compile
          this driver as a module, choose M here and read.
          The module will be called skyeye_ts_drv.o.

15. gedit drivers/input/touchscreen/Makefile &
在文件最后添加以下内容:
obj-$(CONFIG_TOUCHSCREEN_SKYEYE)    += skyeye_ts_drv.o

16. make ARCH=arm CROSS_COMPILE=arm-linux- s3c2410_defconfig

17. make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
      将Boot options->Default kernel command string改成mem=64M console=ttySAC0 root=/dev/ram initrd=0xC0800000,0x01000000 ramdisk_size=16384 rw
      选中Kernel Features->Use the ARM EABI to compile the kernel
      取消Device Drivers->Character devices->Serial drivers->8250/16550 and compatible serial support
      选中Device Drivers->Graphics support->Logo configuration->Bootup logo
      选中Device Drivers->Input device support->Event Debugging
      选中Device Drivers->Input device support->Touchscreens->SkyEye Touch Screen support
      选中Device Drivers->Network device support->Ethernet (10 or 100Mbit)->CS8900 support
      修改Device Drivers->Block devices下的几个值:
            (1) Default number of RAM disks
            (16384) Default RAM disk size (kbyte)
      选中Device Drivers->Memory Technology Device(MTD) support->Mapping drivers for chip access->Flash device in physical memory map
      选中Device Drivers->Memory Technology Device(MTD) support->Mapping drivers for chip access->Flash device in physical memory map->Physmap compat support
      修改Device Drivers->Memory Technology Device(MTD) support->Mapping drivers for chip access->Flash device in physical memory map->Physmap compat support下的几个值:
            (0x80000000) Physical start address of flash mapping
            (0x2000000) Physical length of flash mapping
            (4) Bank width in octets
      取消File System->Network File System->Root file system on NFS
      选中File System->Network File System->NFS client support for NFS version 4
      选中File System->Network File System->NFS client support for NFSv4.1 (EXPERIMENTAL)

18. make ARCH=arm CROSS_COMPILE=arm-linux-

至此,linux2.6.36编译完成,此内核支持cs8900网卡、LCD和触摸屏。将其拷贝到skyeye.conf所在目录,并将文件系统镜像文件 initrd.img也拷贝到此文件夹下即可在skyeye中运行此linux系统了。skyeye.conf的内容如下所示:

# skyeye config file for S3C2410X
arch: arm
cpu:  arm920t
mach: s3c2410x

# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00000024
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0xc0800000, size=0x01000000, file=./initrd.img
mem_bank: map=M, type=RW, addr=0xc1800000, size=0x02800000

# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
mem_bank: map=I, type=RW, addr=0x19100300, size=0x00000020

net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1, state=on

lcd: type=s3c2410x, mod=gtk
touchscreen: type=s3c2410x, mod=gtk
uart:mod=term
dbct:state=on
#log: logon=0, logfile=./sk1.log, start=5000000, end=6000000

原创粉丝点击