📄 2.6.14移植详细过程.rtf
字号:
一.准备必要的文件 a.首先去官方网站下载最新的llinux内核 http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.bz2 b.下载3.4.1版本的交叉编译器 ftp://ftp.handhelds.org/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2二.交叉编译环境设置 a.把gcc解压到/build-tools/usr/local/arm/3.4.1目录下(首先要在根目录下新建一个build-tools目录,把下载下来的交叉编译器放在build-tools目录下) $tar xvjf arm-linux-gcc-3.4.1.tar.bz2 b.建立环境变量设置脚本env.sh #!/bin/bash PRJROOT=~/dev_home export PRJROOT export PATH=/WirelessCard/build-tools/usr/local/arm/3.4.1/bin:$PATH 编辑文件~/.bashrc,输入命令: #vi ~/.bashrc 在最后添加: . ~/dev_home/env.sh 注销,再登录系统,环境变量生效三、接下来需要解压linux内核,输入命令: # tar jxvf linux-2.6.14.tar.bz2 内核被解压到linux-2.6.14目录下。四.修改内核主目录(linux-2.6.14)下的Makefile文件 注释掉以下内容: #ARCH ?= $(SUBARCH) #CROSS_COMPILE ?= 增加如下内容: ARCH : = arm CROSS_COMPILE =/build-tools/usr/local/arm/3.4.1/bin/arm-linux- 然后进入内核相应目录 $ln -s asm-arm asm $ln -s arch-s3c2410/ arch五.修改相关的文件。 a.修改arch\arm\mach-s3c2410\devs.c文件 增加头文件定义 /***********add here***********/ #include <linux/mtd/partitions.h> #include <asm/arch/nand.h> #include <linux/mtd/nand.h> /**************end add********/ /* NAND Controller */ /***********add here***********/ static struct mtd_partition partition_info[] ={ [0]={ /*1MB*/ .name="loader", .offset=0x00000000, .size= 0x00020000, }, [1]={ .name="param", .offset=0x00020000, .size=0x00010000, }, [2]={ .name="kernel", .offset=0x00030000, .size=0x001c0000, }, [3]={ .name="root", .offset=0x00200000, .size=0x001dfc000,/*.mask_flags = MTD_WRITEABLE,*/ } }; struct s3c2410_nand_set nandset ={ .nr_partitions=4 , .partitions=partition_info , }; struct s3c2410_platform_nand superlpplatform={ .tacls=0, .twrph0=30, .twrph1=0, .sets=&nandset, .nr_sets=1, }; /**************end add********/ struct platform_device s3c_device_nand = { .name = "s3c2410-nand", .id = -1, .num_resources = ARRAY_SIZE(s3c_nand_resource), .resource = s3c_nand_resource, /***********add here****************/ .dev = { .platform_data = &superlpplatform } /**************end here************/ };b.加入USB驱动的支持修改arch/arm/mach-s3c2410/mach-smdk2410.c加入头文件#include <asm/arch/regs-clock.h>#include <asm/arch/usb-control.h> #include <linux/device.h>#include <linux/delay.h>/**********************add here*************************************/static struct s3c2410_hcd_info usb_sbc2410_info = { .port[0] = { .flags = S3C_HCDFLG_USED }};int usb_sbc2410_init(void){unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03);printk("USB Control, (c) 2006 sbc2410\n");s3c_device_usb.dev.platform_data = &usb_sbc2410_info;while(upllvalue!=__raw_readl(S3C2410_UPLLCON)){__raw_writel(upllvalue,S3C2410_UPLLCON);mdelay(1);}return 0;}/***************************end add**********************/static void __init smdk2410_map_io(void){s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));s3c24xx_init_clocks(0);s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));s3c24xx_set_board(&smdk2410_board);/*************************add by zxh****************************/ usb_sbc2410_init();/*************************end add*******************************/} c.修改include/linux/mtd/partitions.h的第61行,在list前加*,如下面所示: struct list_head *list;六、内核配置进入内核主目录,输入命令:#make mrproper (清理以前的垃圾,会把主目录下的.config也删除)#cp arch/arm/configs/s3c2410_defconfig .config #make menuconfig_____________________________________________ a、让内核支持热插拔 General setup ---> │ │[*] Support for hot-pluggable devices b、USB驱动设置: Device Drivers --->│ │ Generic Driver Options ---> <*> Hotplug firmware loading support │ │ Block devices ---> │ │ <*> Low Performance USB Block driver │ │ SCSI device support ---> │ │ <*> SCSI generic support │ │ [*] Probe all LUNs on each SCSI device USB support ---> │ │ <*> Support for Host-side USB │ │ [*] USB device filesystem │ │ <*> OHCI HCD support │ │ <*> USB Mass Storage support │ │ [*] USB Monitor c、加入了MSDOS fs和VFAT fs的支持。 File systems ---> │ │ DOS/FAT/NT Filesystems ---> │ │ │ <*> MSDOS fs support │ │ │ │ <*> VFAT (Windows-95) fs support │ │ │ │ (936) Default codepage for FAT │ │ │ │ (cp936) Default iocharset for FAT │ │ │ │ < > NTFS file system support Native Language Support ---> <*> Codepage 437 (United States, Canada) <*> Simplified Chinese charset (CP936, GB2312) _________________________________________________________________七、编译内核 #make bzImage八、为了支持yaffs文件系统,需要帮内核加上对yaffs文件系统的支持, 下载yaffs文件系统源码,解压后进入yaffs主目录下的linux-kernel目录,运行脚本文件patch-ker.sh #./patch-ker.sh 把yaffs文件系统主目录下的.h和.c文件拷贝到内核下的fs目录中的yaffs目录 a.拷贝下面几项到2.6.14的fs/Kconfig中去(注意:bool等前面要用Tab键产生空格) config DEVFS_FS bool "/dev file system support (OBSOLETE)" depends on EXPERIMENTAL help This is support for devfs, a virtual file system (like /proc) which provides the file system interface to device drivers, normally found in /dev. Devfs does not depend on major and minor number allocations. Device drivers register entries in /dev which then appear automatically, which means that the system administrator does not have to create character and block special device files in the /dev directory using the mknod command (or MAKEDEV script) anymore. This is work in progress. If you want to use this, you *must* read the material in , especially the file README there. Note that devfs no longer manages /dev/pts! If you are using UNIX98 ptys, you will also need to mount the /dev/pts filesystem (devpts). Note that devfs has been obsoleted by udev, . It has been stripped down to a bare minimum and is only provided for legacy installations that use its naming scheme which is unfortunately different from the names normal Linux installations use. If unsure, say N. config DEVFS_MOUNT bool "Automatically mount at boot" depends on DEVFS_FS help This option appears if you have CONFIG_DEVFS_FS enabled. Setting this to 'Y' will make the kernel automatically mount devfs onto /dev when the system is booted, before the init thread is started. You can override this with the "devfs=nomount" boot option. If unsure, say N.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -