日期:2014-05-16  浏览次数:20762 次

linux-3.6.6自己动手移植

//--------------------------------------------------------

// 作者:longtian635241(longtian_huang@urbetter.com

// 论坛ID:idea6410

// 版权:idea6410

// 平台:友坚idea6410开发板

// 发布日期:2012-11-19

// 最后修改:2012-11-19

//http://www.urbetter.com/main.asp

//----------------------------------------------------------

 

前面介绍了基于mini6410来移植,这次完全由自己从头移植,以mach-smdk6410.c为基础!

1、nand flash MTD分区移植(拿来主义不是mini6410可以,模仿它的)

a、

static struct mtd_partition smdk6410_nand_part[] = {
 [0] = {
  .name = "uboot",
  .size = SZ_1M,
  .offset = 0,
 },
 [1] = {
  .name = "kernel",
  .size = SZ_2M,
  .offset = SZ_1M,
 },
 [2] = {
  .name = "rootfs",
  .size = MTDPART_SIZ_FULL,
  .offset = SZ_1M + SZ_2M,
 },
};

static struct s3c2410_nand_set smdk6410_nand_sets[] = {
 [0] = {
  .name  = "nand",
  .nr_chips = 1,
  .nr_partitions = ARRAY_SIZE(smdk6410_nand_part),
  .partitions = smdk6410_nand_part,
 },
};

static struct s3c2410_platform_nand smdk6410_nand_info = {
 .tacls  = 25,
 .twrph0  = 55,
 .twrph1  = 40,
 .nr_sets = ARRAY_SIZE(smdk6410_nand_sets),
 .sets  = smdk6410_nand_sets,
};
b、

static struct platform_device *smdk6410_devices[] __initdata = {
。。。。。。。。。。。。。

 //add by hcm
 &s3c_device_nand,
};

static void __init smdk6410_machine_init(void)
{
 u32 cs1;

 s3c_i2c0_set_platdata(NULL);
 s3c_i2c1_set_platdata(NULL);
 s3c_fb_set_platdata(&smdk6410_lcd_pdata);
 s3c_hsotg_set_platdata(&smdk6410_hsotg_pdata);

 samsung_keypad_set_platdata(&smdk6410_keypad_data);
//add by hcm
 s3c_nand_set_platdata(&smdk6410_nand_info);

到这我想直接去编译,然后发现少哪些头文件可是不加头文件就出现:

arch/arm/mach-s3c64xx/mach-smdk6410.c:137: error: array type has incomplete element type
arch/arm/mach-s3c64xx/mach-smdk6410.c:138: error: array index in non-array initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:138: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:139: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:139: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:140: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:140: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:141: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:141: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:142: error: field name not in record or union initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:142: error: (near initialization for 'smdk6410_nand_sets')
arch/arm/mach-s3c64xx/mach-smdk6410.c:146: error: variable 'smdk6410_nand_info' has initializer but incomplete type
arch/arm/mach-s3c64xx/mach-smdk6410.c:147: error: unknown field 'tacls' specified in initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:147: warning: excess elements in struct initializer
arch/arm/mach-s3c64xx/mach-smdk6410.c:147: warning: (near initialization for 'smdk6410_nand_info')
arch/arm/mach-s3c64xx/mach-smdk6410.c:148: error: unknown field '