- UID
- 872238
|
8. 配置内核
复制代码
根据需要配置内核选项,主要包含:
(1) 启动传递参数
(2) devfs文件系统支持
(3) 芯片及系统类型配置
(4) DMA Engine support
(5) MMC/SD/SDIO card support
(6) Dm9000网卡支持
(7) LCD支持
(8) USB输入设备支持
(9) 声卡设备支持
其中有一些需要修改源码的地方会在下面说明。
9. 保存配置并退出xconfig,生成zImage文件
复制代码
OK,将生成的zImage文件烧到开发板上就可以了。
(1). 启动
|---Boot options| |---Default kernel command string: [root=/dev/mtdblock3 rootfstype=cramfs init=/linuxrc console=ttySAC0,115200
devfs=mount mem=64]
分析:
/dev/mtdblock3 : 表示MTD分区的第3个分区存储根文件系统
rootfstype=cramfs : 分区是cramfs类型,这项不加应该关系不大
init=/linuxrc : 启动的首个脚本即根目录下的linuxrc
console=ttySAC0,115200 : 使用串口1作为串口调试,波特率设置为115200; 现在已经摒弃了以前使用ttyS0的写法
devfs=mount : 在/sbin/init运行之前能自动挂载/dev为devfs文件系统
mem=64 : 存储器大小为64M
(2).LCD支持.
修改mach-smdk2410.c文件,添加: - /* LCD driver info */
- static struct s3c2410fb_display smdk2410_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 = 270000,
- .xres = 320,
- .yres = 240,
- .bpp = 16,
- .left_margin =8,
- .right_margin = 5,
- .hsync_len = 63,
- .upper_margin = 15,
- .lower_margin = 3,
- .vsync_len = 5,
- };
- static struct s3c2410fb_mach_info smdk2410_fb_info __initdata = {
- .displays = &smdk2410_lcd_cfg,
- .num_displays = 1,
- .default_display = 0,
- #if 0
- /* currently setup by downloader */
- .gpccon = 0xaa940659,
- .gpccon_mask = 0xffffffff,
- .gpcup = 0x0000ffff,
- .gpcup_mask = 0xffffffff,
- .gpdcon = 0xaa84aaa0,
- .gpdcon_mask = 0xffffffff,
- .gpdup = 0x0000faff,
- .gpdup_mask = 0xffffffff,
- #endif
- .lpcsel = 0, //((0xCE6) & ~7) | 1<<4,
- };
复制代码
(2)添加对SD卡支持
修改mach-smdk2410.c文件添加:&s3c_device_sdi,
(3)对128Mflash支持
修改/linux-2.6.28.7/drivers/mtd/nand下面的nand_bbt.c文件: - static struct nand_bbt_descr largepage_memorybased = {
- .options = 0,
- .offs = 0,
- .len = 2, // 支持128M修改为1
- .pattern = scan_ff_pattern
- };
- static struct nand_bbt_descr largepage_flashbased = {
- .options = NAND_BBT_SCAN2NDPAGE,
- .offs = 0,
- .len = 2, // 支持128M修改为1
- .pattern = scan_ff_pattern
- };
复制代码
(4)修改对dm9000网卡支持
a.修改 drivers/net/dm9000.c 文件:
头文件增加: - /*******************************/
- #include <mach/regs-gpio.h> //by bai
- #include <mach/irqs.h>
- #include <mach/hardware.h>
- /*******************************/
复制代码
在dm9000_probe 函数开始增加: - /* ------------------------------------------------------------------------ */
- unsigned char ne_def_eth_mac_addr[]={0x00,0x12,0x34,0x56,0x80,0x49};
- static void *bwscon;
- static void *gpfcon;
- static void *extint0;
- static void *intmsk;
- #define BWSCON (0x48000000)
- #define GPFCON (0x56000050)
- #define EXTINT0 (0x56000088)
- #define INTMSK (0x4A000008)
- bwscon=ioremap_nocache(BWSCON,0x0000004);
- gpfcon=ioremap_nocache(GPFCON,0x0000004);
- extint0=ioremap_nocache(EXTINT0,0x0000004);
- intmsk=ioremap_nocache(INTMSK,0x0000004);
- writel(readl(bwscon)|0xc0000,bwscon);
- writel( (readl(gpfcon) & ~(0x3 << 14)) | (0x2 << 14), gpfcon);
- writel( readl(gpfcon) | (0x1 << 7), gpfcon); // Disable pull-up
- writel( (readl(extint0) & ~(0xf << 28)) | (0x4 << 28), extint0); //rising edge
- writel( (readl(intmsk)) & ~0x80, intmsk);
- /* ------------------------------------------------------------------------ */
复制代码
在这个函数的最后需要修改: - if (!is_valid_ether_addr(ndev->dev_addr)) {
- /* try reading from mac */
- mac_src = "chip";
- for (i = 0; i < 6; i++)
- //ndev->dev_addr = ior(db, i+DM9000_PAR); //by bai
- ndev->dev_addr = ne_def_eth_mac_addr;
- }
复制代码
b.修改arch/arm/mach-s3c2410/mach-smdk2410.c
在static struct platform_device *smdk2410_devices[] __initdata中添加: - &s3c_device_dm9000,
- static struct map_desc smdk2410_iodesc[] __initdata = {
- [0] = {
- .virtual = (unsigned long)S3C24XX_VA_DM9000,
- .pfn = __phys_to_pfn(S3C24XX_PA_DM9000),
- .length = SZ_1M,
- .type = MT_DEVICE,
- },
- };
复制代码
c.vi arch/arm/plat-s3c24xx/devs.c
添加头文件 - #include <linux/dm9000.h>
- /* DM9000 Net Card */
- static struct resource s3c_dm9000_resource[] = {
- [0] = {
- .start = S3C24XX_PA_DM9000,
- .end = S3C24XX_PA_DM9000+ 0x3,
- .flags = IORESOURCE_MEM
- },
- [1]={
- .start = S3C24XX_PA_DM9000 + 0x4, //CMD pin is A2
- .end = S3C24XX_PA_DM9000 + 0x4 + 0x7c,
- .flags = IORESOURCE_MEM
- },
- [2] = {
- .start = IRQ_EINT7,
- .end = IRQ_EINT7,
- .flags = IORESOURCE_IRQ
- },
- };
- static struct dm9000_plat_data s3c_device_dm9000_platdata = {
- .flags= DM9000_PLATF_16BITONLY,
- };
- struct platform_device s3c_device_dm9000 = {
- .name= "dm9000",
- .id= 0,
- .num_resources= ARRAY_SIZE(s3c_dm9000_resource),
- .resource= s3c_dm9000_resource,
- .dev= {
- .platform_data = &s3c_device_dm9000_platdata,
- }
- };
- EXPORT_SYMBOL(s3c_device_dm9000);
复制代码
d.vi arch/arm/plat-s3c24xx/include/mach/devs.h 45行附近,添加 - extern struct platform_device s3c_device_dm9000;
复制代码
e.vi /linux-2.6.28.7/arch/arm/mach-s3c2410/include/mach/map.h 文件 - /* DM9000 */
- #define S3C24XX_PA_DM9000 0x20000300
- #define S3C24XX_VA_DM9000 0xE0000000
|
|