Linux内核移植

我们在这里选用的是linux-3.0.tar.bz2 压缩包。

 下载在Linux官网下载压缩包,然后解压,.tar.bz2   格式解压为     tar   -jxvf    xx.tar.bz2

现在开始我们的内核移植。

1. Makefile的修改

ARCH            ?=arm
CROSS_COMPILE   ?=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-

2.在u-boot修改环境变量

console=ttyS0,115200 mem=64M init=/linuxrc rw loglevel=7

3.machid修改

/home/yuzhonghan/fl2400/bootloacal/u-boot-2010.09/board/lingyun/fl2440/fl2440.c

        gpio->GPHUP = 0x000007FF;


        /* arch number of SMDK2410-Board */
        gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
#if defined(CONFIG_FL2440)
        gd->bd->bi_arch_number = MACH_TYPE_MINI2440;
#else
        gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
#endif
        /* adress of boot parameters */
        gd->bd->bi_boot_params = 0x30000100;


        icache_enable();
        dcache_enable();


        return 0;
}

4. 添加zmagin

all: vmlinux
        cp arch/arm/boot/zImage . -f
        mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008040 -n "Linux Kernel" -d zImage linuxrom-s3c2440.bin
        rm -f zImage

PS:其中的mkimage在编译好的u-boot下的tools中

5.改distclean添加删除linuxrom-s3c2440.bin

1196 #
1197 PHONY += distclean
1198 
1199 distclean: mrproper
1200     @find $(srctree) $(RCS_FIND_IGNORE) \
1201         \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
1202         -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
1203         -o -name '.*.rej' -o -size 0 \
1204         -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
1205         -type f -print | xargs rm -f
1206     @rm -f linuxrom-s3c2440.bin

6.arch/arm/mach-s3c2440/mach-smdk2440.c 修改晶振频率


static void __init smdk2440_map_io(void)
223 {
224     s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
225     s3c24xx_init_clocks(12000000);
226     s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));

7. drivers/tty/serial/samsung.c  更改串口名

#define S3C24XX_SERIAL_NAME     "ttyS"

8. 拷贝config文件

cp arch/arm/configs/mini2440_defconfig .config

9.Make menuconfig

修改system type/s3c2440 and s3c2442 Machines下

[ ] Simtec Electronics ANUBIS                                                                                    | |
[ ] Openmoko GTA02 / Freerunner phone                                                                            | |
[ ] Simtec IM2440D20 (OSIRIS) module                                                                             | |
[*] SMDK2440                                                                                                     | |
[ ] NexVision NEXCODER 2440 Light Board                                                                          | |
[*] SMDK2440 with S3C2440 CPU module                                                                             | |
[ ] SMDM2440 with S3C2442 CPU module                                                                             | |
[ ] Avantech AT2440EVB development board                                                                         | |
[ ] MINI2440 development board                                                                                   | |
[ ] HP iPAQ rx1950 

10.machID的更改

arch/arm/tools/mach-types

mini2440                MACH_MINI2440           MINI2440                362

s3c2440                 ARCH_S3C2440            S3C2440                 1999

11.改盘

arch/arm/plat-s3c24xx/common-smdk.c



109 /* NAND parititon from 2.4.18-swl5 */
110 
111 static struct mtd_partition smdk_default_nand_part[] = {
112     [0] = {
113         .name   = "bootloader",
114         .size   = SZ_1M,
115         .offset = 0,
116     },
117     [1] = {
118         .name   = "linux",
119         .offset = MTDPART_OFS_NXTBLK,
120         .size   = SZ_1M*15,
121     },
122     [2] = {
123         .name   = "rootfs",
124         .offset = MTDPART_OFS_NXTBLK,
125         .size   = SZ_1M*64,
126     },
127     [3] = {
128         .name   = "apps",
129         .offset = MTDPART_OFS_NXTBLK,
130         .size   = SZ_1M*80,
131     },
132     [4] = {
133         .name   = "data",
134         .offset = MTDPART_OFS_NXTBLK,
135         .size   = SZ_1M*48,
136     },
137     [5] = {
138         .name   = "info",
139         .size   = SZ_1M * 48,
140         .size   = MTDPART_OFS_NXTBLK,
141     },
142 
143 };

12.添加根文件树

cp ~/fl2440/roofs/roof_tree.tar.bz2 ~/ciel/fl2440/roors

make menuconfig

 General setup  ---> 
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support 
  (/opt/rootfs) Initramfs source file(s)  

---------------------- Initramfs source file(s) ------------------------+
                         |  Please enter a string value. Use the <TAB> key to move from the input  |
                           |  field to the buttons below it.                                         |
                                              | +---------------------------------------------------------------------+ |
                                              | | opt/roofs                                                                | |
                                              | +---------------------------------------------------------------------+ |
                                              |                                                                         |
                                              +-------------------------------------------------------------------------+
                                              |                         <  Ok  >      < Help >                          |

13.添加dm9000驱动

arch/arm/mach-s3c2440/mach-smdk2440.c

#include <linux/dm9000.h>//添加DM9000网卡的头文件

添加下列代码:

/* add DM9000 ethernet drivers ,whitch is bodify by hurryliu */

#define DM9000_BASE    (S3C2410_CS4 + 0x300)

static struct resource s3c_dm9000_resource[] = {

     [0] = {

        .start = DM9000_BASE,

        .end   = DM9000_BASE + 3,

        .flags = IORESOURCE_MEM

    },

    [1] = {

        .start = DM9000_BASE + 4,

        .end   = DM9000_BASE + 7,

        .flags = IORESOURCE_MEM

    },

    [2] = {

        .start = IRQ_EINT7,

        .end   = IRQ_EINT7,

        .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,

    }

};

 

/*        

 * The DM9000 has no eeprom, and it's MAC address is set by

 * the bootloader before starting the kernel.

 */

static struct dm9000_plat_data s3c_dm9000_pdata = {

    .flags      = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),

};

 

static struct platform_device s3c_device_dm9000 = {

    .name       = "dm9000",

    .id     = -1,

    .num_resources  = ARRAY_SIZE(s3c_dm9000_resource),

    .resource   = s3c_dm9000_resource,

    .dev        = {

        .platform_data  = &s3c_dm9000_pdata,

    },

};

/* modify end  */

 

修改platform_device *smdk2440_devices[] __initdata结构体为如下,在其中添加启动DM9000

 

static struct platform_device *smdk2440_devices[] __initdata = {

    &s3c_device_ohci,

    &s3c_device_lcd,

    &s3c_device_wdt,

    &s3c_device_i2c0,

    &s3c_device_iis,

    &s3c_device_dm9000,

};

之后make,就可支持DM9000网络了,当我们的系统运行的时候,就可以使用tftp下载文件到我们的开发板中

测试:1.ifconfig

    2.ping 192.168.3.1

这样我们的内核就完成了


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值