主题 : [转]成功移植2.6.31到mini2440 复制链接 | 浏览器收藏 | 打印
追求卓越,拒绝平庸
级别: 新手上路
UID: 16052
精华: 0
发帖: 21
金钱: 105 两
威望: 21 点
贡献值: 0 点
综合积分: 42 分
注册时间: 2010-03-13
最后登录: 2011-04-07
楼主  发表于: 2010-04-19 10:22

 [转]成功移植2.6.31到mini2440

成功移植2.6.31到mini2440
作者:Athurg        

老子按:两天的时间,终于把linux 2.6.31移植到了mini2440上了。在此记录一下。
先说说移植的过程:

下载并解压缩内核源文件、yaffs2补丁:

wget http://www.cn.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2
wget http://www.aleph1.co.uk/cgi-bin/viewvc.cgi/yaffs2.tar.gz?view=tar
tar xvf linux-2.6.31.tar.bz2
tar xvf yaffs2.tar.gz

打补丁,包括一个yaffs的补丁,一个我自己的补丁(解决缺少s3c_device_usb定义无法编译、运行时提示LED操作指针错误、补充缺失的结构体定义、修正液晶为一直显示等功能)。

cd yaffs2
sh patch-ker.sh c ../linux-2.6.31
cd ../linux-2.6.31
patch -Np0 < mini2440-stuff.patch

配置编译内核:

cp arch/arm/configs/mini2440_defconfig .configure
make ARCH=arm menuconfig #加上fs/misc/yaffs2文件系统的支持
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

相关的补丁内容如下:

# 作者(author): 冯建波(Athurg Gooth)
# 发布协议(License): GPL v2
# 邮件(email): athurg@gooth.cm
# 说明:
# 此补丁用于2.6.31版Linux内核,主要解决了以下问题:
# 1、修复编译依赖规则缺失导致无法编译的问题(undefined reference to `s3c_device_usb');
2、运行时LED相关操作指针错误(Unable to handle kernel paging request at virtual address 6bd00004,PC is at s3c2410_gpio_setpin+0x1c/0x3c,LR is at s3c24xx_led_set+0x24/0x48


3、结构体mini2440_nand_info、mini2440_led_backlight_pdata成员缺失
4、液晶先开后灭

diff -Nur linux-2.6.31.orig/arch/arm/mach-s3c2410/include/mach/leds-gpio.h linux-2.6.31/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
--- linux-2.6.31.orig/arch/arm/mach-s3c2410/include/mach/leds-gpio.h 2009-10-03 12:11:49.533111222 +0800
+++ linux-2.6.31/arch/arm/mach-s3c2410/include/mach/leds-gpio.h 2009-10-03 13:32:42.462616663 +0800
@@ -16,6 +16,7 @@

#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
+#define S3C24XX_LEDF_STARTON (1<<2) /* Initialise 'on' */

struct s3c24xx_led_platdata {
unsigned int gpio;
diff -Nur linux-2.6.31.orig/arch/arm/mach-s3c2440/Kconfig linux-2.6.31/arch/arm/mach-s3c2440/Kconfig
--- linux-2.6.31.orig/arch/arm/mach-s3c2440/Kconfig 2009-10-03 09:43:28.153999898 +0800
+++ linux-2.6.31/arch/arm/mach-s3c2440/Kconfig 2009-10-03 13:32:42.799281701 +0800
@@ -90,6 +90,7 @@
select EEPROM_AT24
select LEDS_TRIGGER_BACKLIGHT
select SND_S3C24XX_SOC_S3C24XX_UDA134X
+ select S3C_DEV_USB_HOST
help
Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
available via various sources. It can come with a 3.5" or 7" touch LCD.
diff -Nur linux-2.6.31.orig/arch/arm/mach-s3c2440/mach-mini2440.c linux-2.6.31/arch/arm/mach-s3c2440/mach-mini2440.c
--- linux-2.6.31.orig/arch/arm/mach-s3c2440/mach-mini2440.c 2009-10-03 09:46:17.751061591 +0800
+++ linux-2.6.31/arch/arm/mach-s3c2440/mach-mini2440.c 2009-10-03 13:32:42.803037171 +0800
@@ -61,7 +61,7 @@

#define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)

-static struct map_desc mini2440_iodesc[] __initdata = {
+static struct map_desc mini2440_iodesc[] = {
/* nothing to declare, move along */
};

@@ -70,7 +70,7 @@
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE

-static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
+static struct s3c2410_uartcfg mini2440_uartcfgs[] = {
[0] = {
.hwport = 0,
.flags = 0,
@@ -114,7 +114,7 @@
}
}

-static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
+static struct s3c2410_udc_mach_info mini2440_udc_cfg = {
.udc_command = mini2440_udc_pullup,
};

@@ -144,7 +144,7 @@
.type = (S3C2410_LCDCON1_TFT16BPP |\
S3C2410_LCDCON1_TFT)

-struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
+struct s3c2410fb_display mini2440_lcd_cfg[] = {
[0] = { /* mini2440 + 3.5" TFT + touchscreen */
_LCD_DECLARE(
7, /* The 3.5 is quite fast */
@@ -191,7 +191,7 @@
#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))

-struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
+struct s3c2410fb_mach_info mini2440_fb_info = {
.displays = &mini2440_lcd_cfg[0], /* not constant! see init */
.num_displays = 1,
.default_display = 0,
@@ -233,7 +233,7 @@

/* MMC/SD */

-static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
+static struct s3c24xx_mci_pdata mini2440_mmc_cfg = {
.gpio_detect = S3C2410_GPG(8),
.gpio_wprotect = S3C2410_GPH(8),
.set_power = NULL,
@@ -242,7 +242,7 @@

/* NAND Flash on MINI2440 board */

-static struct mtd_partition mini2440_default_nand_part[] __initdata = {
+static struct mtd_partition mini2440_default_nand_part[] = {
[0] = {
.name = "u-boot",
.size = SZ_256K,
@@ -267,7 +267,7 @@
},
};

-static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
+static struct s3c2410_nand_set mini2440_nand_sets[] = {
[0] = {
.name = "nand",
.nr_chips = 1,
@@ -277,18 +277,19 @@
},
};

-static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
+static struct s3c2410_platform_nand mini2440_nand_info = {
.tacls = 0,
.twrph0 = 25,
.twrph1 = 15,
.nr_sets = ARRAY_SIZE(mini2440_nand_sets),
.sets = mini2440_nand_sets,
.ignore_unset_ecc = 1,
+ .select_chip = NULL
};

/* DM9000AEP 10/100 ethernet controller */

-static struct resource mini2440_dm9k_resource[] __initdata = {
+static struct resource mini2440_dm9k_resource[] = {
[0] = {
.start = MACH_MINI2440_DM9K_BASE,
.end = MACH_MINI2440_DM9K_BASE + 3,
@@ -310,11 +311,11 @@
* The DM9000 has no eeprom, and it's MAC address is set by
* the bootloader before starting the kernel.
*/
-static struct dm9000_plat_data mini2440_dm9k_pdata __initdata = {
+static struct dm9000_plat_data mini2440_dm9k_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};

-static struct platform_device mini2440_device_eth __initdata = {
+static struct platform_device mini2440_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
@@ -341,7 +342,7 @@
* | | +----+ +----+
* .....
*/
-static struct gpio_keys_button mini2440_buttons[] __initdata = {
+static struct gpio_keys_button mini2440_buttons[] = {
{
.gpio = S3C2410_GPG(0), /* K1 */
.code = KEY_F1,
@@ -384,12 +385,12 @@
#endif
};

-static struct gpio_keys_platform_data mini2440_button_data __initdata = {
+static struct gpio_keys_platform_data mini2440_button_data = {
.buttons = mini2440_buttons,
.nbuttons = ARRAY_SIZE(mini2440_buttons),
};

-static struct platform_device mini2440_button_device __initdata = {
+static struct platform_device mini2440_button_device = {
.name = "gpio-keys",
.id = -1,
.dev = {
@@ -399,41 +400,42 @@

/* LEDS */

-static struct s3c24xx_led_platdata mini2440_led1_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led1_pdata = {
.name = "led1",
.gpio = S3C2410_GPB(5),
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.def_trigger = "heartbeat",
};

-static struct s3c24xx_led_platdata mini2440_led2_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led2_pdata = {
.name = "led2",
.gpio = S3C2410_GPB(6),
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.def_trigger = "nand-disk",
};

-static struct s3c24xx_led_platdata mini2440_led3_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led3_pdata = {
.name = "led3",
.gpio = S3C2410_GPB(7),
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.def_trigger = "mmc0",
};

-static struct s3c24xx_led_platdata mini2440_led4_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led4_pdata = {
.name = "led4",
.gpio = S3C2410_GPB(8),
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.def_trigger = "",
};

-static struct s3c24xx_led_platdata mini2440_led_backlight_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
.name = "backlight",
.gpio = S3C2410_GPG(4),
+ //.flags = S3C24XX_LEDF_STARTON,
.def_trigger = "backlight",
};

-static struct platform_device mini2440_led1 __initdata = {
+static struct platform_device mini2440_led1 = {
.name = "s3c24xx_led",
.id = 1,
.dev = {
@@ -441,7 +443,7 @@
},
};

-static struct platform_device mini2440_led2 __initdata = {
+static struct platform_device mini2440_led2 = {
.name = "s3c24xx_led",
.id = 2,
.dev = {
@@ -449,7 +451,7 @@
},
};

-static struct platform_device mini2440_led3 __initdata = {
+static struct platform_device mini2440_led3 = {
.name = "s3c24xx_led",
.id = 3,
.dev = {
@@ -457,7 +459,7 @@
},
};

-static struct platform_device mini2440_led4 __initdata = {
+static struct platform_device mini2440_led4 = {
.name = "s3c24xx_led",
.id = 4,
.dev = {
@@ -465,7 +467,7 @@
},
};

-static struct platform_device mini2440_led_backlight __initdata = {
+static struct platform_device mini2440_led_backlight = {
.name = "s3c24xx_led",
.id = 5,
.dev = {
@@ -475,14 +477,14 @@

/* AUDIO */

-static struct s3c24xx_uda134x_platform_data mini2440_audio_pins __initdata = {
+static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
.l3_clk = S3C2410_GPB(4),
.l3_mode = S3C2410_GPB(2),
.l3_data = S3C2410_GPB(3),
.model = UDA134X_UDA1341
};

-static struct platform_device mini2440_audio __initdata = {
+static struct platform_device mini2440_audio = {
.name = "s3c24xx_uda134x",
.id = 0,
.dev = {
@@ -498,14 +500,14 @@
.page_size = 16,
};

-static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
+static struct i2c_board_info mini2440_i2c_devs[] = {
{
I2C_BOARD_INFO("24c08", 0x50),
.platform_data = &at24c08,
},
};

-static struct platform_device *mini2440_devices[] __initdata = {
+static struct platform_device *mini2440_devices[] = {
&s3c_device_usb,
&s3c_device_wdt,
/* &s3c_device_adc,*/ /* ADC doesn't like living with touchscreen ! */

级别: 新手上路
UID: 19540
精华: 0
发帖: 1
金钱: 5 两
威望: 1 点
贡献值: 0 点
综合积分: 2 分
注册时间: 2010-04-20
最后登录: 2011-05-14
1楼  发表于: 2010-04-22 19:44
感谢分享, 请问 2.6.31 内核在哪修改始终频率?