#make s3c2410_defconfig 或 #cp arch/arm/configs/s3c2410_defconfig ./.config执行上述命令后,将会在源码目录下生成相应的.config配置文件。通过
#make menuconfig 或 #make xconfig
#make zImage
make mrproper --- 清理全部文件,包括.config和一些备份文件 make clean --- 清理生成文件,但会保留.config和一些模块文件 make defconfig --- 生成包含全部默认选项的.config文件。这里用make s3c2410_defconfig替代 make oldconfig --- 在旧的.config基础上生成新的.config。如果只想在原来内核配置的基础上修改一些小地方,会省去不少麻烦 make config --- 基于文本的最为传统的配置界面,不推荐使用 make menuconfig --- 基于文本选单的配置界面,字符终端下推荐使用 make xconfig --- 基于图形窗口模式的配置界面,Xwindow下推荐使用
#cd /usr/local/arm #tar jxvf linux-2.6.28.7.tar.bz2 #cd linux-2.6.28.7
#ARCH ?= $(SUBARCH) #CROSS_COMPILE ?= ARCH ?= arm CROSS_COMPILE ?= arm-linux- 或者:CROSS_COMPILE ?= /usr/local/arm/3.4.1/bin/arm-linux-
我是将交叉编译器安装在/usr/local/arm目录下的。
3. 生成默认配置
#make s3c2410_defconfig
[root@localhost linux-2.6.28.7]# make s3c2410_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/docproc HOSTCC scripts/basic/hash HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # [root@localhost linux-2.6.28.7]#
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
/*s3c24xx_init_clocks(16934400);*/ s3c24xx_init_clocks(12000000);
static struct mtd_partition smdk_default_nand_part[] = { [0] = { .name = "Boot", .size = 0x00100000, .offset = 0 }, [1] = { .name = "MyApp", .size = 0x003c0000, .offset = 0x00140000, }, [2] = { .name = "Kernel", .size = 0x00300000, .offset = 0x00500000, }, [3] = { .name = "fs_yaffs", .size = 0x03c00000, //30M .offset = 0x00800000, }, [4] = { .name = "WINCE", .size = 0x03c00000, .offset = 0x04400000, } };
/*chip->ecc.mode = NAND_ECC_SOFT; */ chip->ecc.mode = NAND_ECC_NONE;
#make menuconfig
#make 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, };
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 };
/*******************************/ #include <mach/regs-gpio.h> //by bai #include <mach/irqs.h> #include <mach/hardware.h> /*******************************/
/* ------------------------------------------------------------------------ */ 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[i] = ior(db, i+DM9000_PAR); //by bai ndev->dev_addr[i] = ne_def_eth_mac_addr[i]; }
&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, }, };
#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);
extern struct platform_device s3c_device_dm9000;
/* DM9000 */ #define S3C24XX_PA_DM9000 0x20000300 #define S3C24XX_VA_DM9000 0xE0000000