軟件:內(nèi)核版本2.6.25.14(fc9原裝版本)、busybox-1.14.3、cross-3.4.1
注:由于虛擬機(jī)出來(lái)點(diǎn)問(wèn)題,又重新做了一遍,內(nèi)核也不想升級(jí)了,直接使用了2.6.25.14,bootloader使用最新的u-boot-2009.08-rc2(移植見(jiàn)我的其他文章)。
一、內(nèi)核移植
1、修改Makefile
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
2、修改NandFlash 分區(qū)信息(arch/arm/plat-s3c24xx/common-smdk.c)
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "uboot",
.size = SZ_1M,
.offset = 0,
},
[1] = {
.name = "kernel",
.offset = SZ_1M,
.size = SZ_3M,
},
[2] = {
.name = "root",
.offset = SZ_4M,
.size = SZ_4M * 10,
},
[3] = {
.name = "user",
.offset = SZ_4M * 11,
.size = SZ_4M * 5,
},
};
3、內(nèi)核devfs支持(fs/Kconfig)
在902 行menu "Pseudo filesystems"下面添加如下代碼:
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
default y
config DEVFS_MOUNT
bool "Automatically mount at boot"
default y
depends on DEVFS_FS
4、復(fù)制編譯配置文件。
cp arch/arm/configs/s3c2410_defconfig .config
5、make menuconfig
在配置菜單中,選擇system type-->s3c2410 machines 中的smdk2410
其他的arch-machines 全部取消。
6、make
7、制作uImage
mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008040 - n "linux-2.6.25.14" -d zImage uImage
8、Skyeye模擬
使用tftp或nfs協(xié)議加載內(nèi)核,發(fā)現(xiàn)問(wèn)題:
rtc,網(wǎng)卡,lcd需要自己移植。
(1).修改文件mach-smdk2410.c(arch/arm/mach-s3c2410/mach-smdk2410.c),在數(shù)組smdk2410_devices[]中添加&s3c_device_rtc.
(2).在/etc目錄下創(chuàng)建rtc設(shè)備文件rtc.
mknod rtc –c 10 135(制作根文件系統(tǒng)時(shí)需要)
(3).重新編譯內(nèi)核??纯磫?dòng)信息。(skyeye好像不能模擬rtc芯片,所以實(shí)際的設(shè)置功能實(shí)現(xiàn)不了)。
10、網(wǎng)卡cs8900a移植
但要注意,2.6.25.14內(nèi)核移植時(shí)會(huì)有錯(cuò)誤,修改方法是對(duì)那個(gè)錯(cuò)誤的函數(shù)添加聲明(extern)即可。
11、lcd移植
對(duì)文章里的函數(shù)做如下修改即可
static struct s3c2410fb_display gyh2410_lcd_cfg __initdata = {
{
/* Config for 240x320 LCD */
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 320,
.height = 240,
.pixclock = 100000, /* HCLK/10 */
.xres = 320,
.yres = 240,
.bpp = 16,
.left_margin = 16,
.right_margin = 6,
.hsync_len = 9,
.upper_margin = 4,
.lower_margin = 6,
.vsync_len = 16,
}
};
static struct s3c2410fb_mach_info gyh2410_fb_info __initdata = {
.displays = &gyh2410_lcd_cfg,
.num_displays = 1,
.default_display = 0,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa95aaa1,
.gpdcon_mask = 0xffc0fff0,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
.lpcsel = ((0xCE6) & ~7) | 1<<4,
};
s3c24xx_fb_set_platdata(&gyh2410_fb_info);
不知什么原因,用原作者的方法對(duì)2.6.24.4和2.6.25.14均不成功。
至此使用skyeye仿真時(shí)基本沒(méi)有問(wèn)題了。(除了skyeye沒(méi)有實(shí)現(xiàn)usb模擬的一點(diǎn)錯(cuò)誤)
二、根文件系統(tǒng)制作
基本步驟按前一篇文章。但是編譯器使用的3.4.1,后一篇文章的所有內(nèi)容都是必須修改的。
我使用高版本的編譯器時(shí)內(nèi)核不能啟動(dòng)生成的文件系統(tǒng)(可能與軟浮點(diǎn)有關(guān))。
三、應(yīng)用程序移植
寫了個(gè)簡(jiǎn)單的C程序,使用靜態(tài)鏈接可以,動(dòng)態(tài)的怎么都不行,ldd分析不出所需庫(kù)。
寫了個(gè)簡(jiǎn)單的字符驅(qū)動(dòng)程序,不行。(insmod出錯(cuò))