zoukankan      html  css  js  c++  java
  • 嵌入式系统移植三步曲 余姗姗

    班级:09计应1班   姓名:余姗姗     学号:0906041047

    嵌入式系统移植三步曲

    1. Bootloader的移植

    2. linux 移植

    3. linux根文件系统移植

    前提:安装skyeye,模拟嵌入式的计算机系统

    操作系统:CentOS 5.6

    从网址218.198.18.51下载skyeye-1.2.6_rc1.tar.bz2

    接着执行[root@localhost Desktop]# tar -xjvf skyeye-1.2.6_rc1.tar.bz2 -C ./解压源码包

    后接着编译skyeye-1.2.6

    [root@localhost Desktop]# cd skyeye-1.2.6_rc1

    [root@localhost skyeye-1.2.6_rc1]# ./configure

    [root@localhost skyeye-1.2.6_rc1]# make

    [root@localhost skyeye-1.2.6_rc1]#make install     //将skyeye安装到/usr/local/bin/

    [root@localhost skyeye-1.2.6_rc1]# mv /usr/local/bin/skyeye  /usr/local/bin/skyeye1.2.6

     

    1 Bootloader的移植,配置、编译u-boot

    修改cpu/arm920t/config.mk文件后出现错误接着再修改examples目录下的Makefile文件

    将原文件的第58行开始的内容:

    SREC      = hello_world.srec

    BIN      = hello_world.bin hello_world

    改为

    SREC      = hello_world.o

    BIN      = hello_world.o hello_world

    即可重新编译。

      编辑skyeye.conf文件

    [root@localhost u-boot-1.1.4]# gedit skyeye.conf

    内容为:

    # skyeye config file for S3C2410X

    cpu: arm920t

    mach: s3c2410x

    # physical memory

    mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000, file=./u-boot.bin ,boot=yes

    mem_bank: map=M, type=RW, addr=0x30000000, size=0x00800000

    mem_bank: map=M, type=RW, addr=0x30800000, size=0x00800000

    mem_bank: map=M, type=RW, addr=0x31000000, size=0x03000000

    # all peripherals I/O mapping area

    mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000

    mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020

    net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=08:00:3E:26:0A:5B, ethmod=tuntap, hostip=10.0.0.1

    nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump

    #lcd:type=s3c2410x, mod=gtk

    dbct:state=on

      执行[root@localhost u-boot-1.1.4]# skyeye1.2.6出错,未建立交叉编译环境

    下载arm-linux-gcc-2.95.3.tar.bz2,arm-linux-gcc-3.4.1.tar.bz2,

    下载后解压到/usr/local/arm:

    [root@localhost Desktop]# tar -xjvf arm-linux-gcc-2.95.3.tar.bz2 -C /usr/local/arm/

    [root@localhost Desktop]# tar -xjvf arm-linux-gcc-3.4.1.tar.bz2 -C /usr/local/arm/

    接着再执行[root@localhost u-boot-1.1.4]# skyeye1.2.6

    2 Linux的移植

    1.下载linux-2.6.14.7.tar.bz2

    2.解压linux-2.6.14.7.tar.bz2

    [root@localhost Desktop]# tar -xjvf linux-2.6.14.7.tar.bz2 -C ./

    第7步.编辑arch/arm/mach-s3c2410/mach-smdk2410.c文件

    [root@localhost linux-2.6.14.7]# ls arch/arm/mach-s3c2410/

    bast.h      devs.h         mach-bast.c      mach-smdk2440.c  s3c2410.c        sleep.S

    bast-irq.c  dma.c          mach-h1940.c     mach-vr1000.c    s3c2410.h        time.c

    clock.c     gpio.c         mach-n30.c       Makefile         s3c2440.c        usb-simtec.c

    clock.h     irq.c          mach-nexcoder.c  Makefile.boot    s3c2440-clock.c     usb-simtec.h

    cpu.c       irq.h          mach-otom.c      pm.c             s3c2440-dsc.c

    cpu.h       Kconfig        mach-rx3715.c    pm.h             s3c2440.h

    devs.c      mach-anubis.c  mach-smdk2410.c  pm-simtec.c      s3c2440-irq.c

    [root@localhost linux-2.6.14.7]# gedit arch/arm/mach-s3c2410/mach-smdk2410.c

    添加一个头文件

    #include

    static struct map_desc smdk2410_iodesc[] __initdata = {

      /* nothing here yet */

    };

    改为

    static struct map_desc smdk2410_iodesc[] __initdata = {

          /* nothing here yet */

          /* Map the ethernet controller CS8900A */

          { vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE }

    };

    第九步 设置Flash分区

    编辑3个文件:devs.c、mach-smdk2410.c、s3c2410.c。

    (1)编辑devs.c文件,指明分区信息

    [root@localhost linux-2.6.14.7]# gedit arch/arm/mach-s3c2410/devs.c

    添加如下内容:(此步要注意添加的位置)

    /*nand */

    #include

    #include

    #include

    /* NAND Controller */

    /************************ 建立Nand Flash分区表 ************************/

    /* 一个Nand Flash总共64MB, 按如下大小进行分区 */

    /*

    name:代表分区名字

    size:代表Flash分区大小(单位:字节)

    offset:代表Flash分区的起始地址(相对于0x0的偏移)

    */

    static struct mtd_partition partition_info[] =

    {

        { /* 1MB */

            name: "bootloader",

            size: 0x00100000,

            offset: 0x0,

        },

        { /* 3MB */

            name: "kernel",

            size: 0x00300000,

            offset: 0x00100000,

        },

        { /* 40MB */

            name: "root",

            size: 0x02800000,

            offset: 0x00400000,

        },

        { /* 20MB */

            name: "user",

            size: 0x00f00000,

            offset: 0x02d00000,

        }

    };

    /************************ 加入Nand Flash分区 ************************/

    /*

    nr_partitions:指明partition_info中定义的分区数目

    partitions:分区信息表

    */

    struct s3c2410_nand_set nandset =

    {

        nr_partitions: 4,            /* the number of partitions */

        partitions: partition_info,     /* partition table */

    };

    /************************ 建立Nand Flash芯片支持 ************************/

    /*

    tacls, twrph0, twrph1的意思见S3C2410手册的63,

    这3个值最后会被设置到NFCONF中,见S3C2410手册66.

    sets:支持的分区集

    nr_set:分区集的个数

    */

    struct s3c2410_platform_nand superlpplatform=

    {

        tacls:0,

        twrph0:30,

        twrph1:0,

        sets: &nandset,

        nr_sets: 1,

    };

    在Linux内核移植过程中,穿插搭建了tftp,nfs服务器

    3 根文件系统的移植

      在烧写时提示mknandflashdump命令不存在,这时在u-boot目录下添加一个可执行的mknandflashdump命令,且要在当前目录下执行该命令,在此命令前加./:

    [root@localhost u-boot-1.1.4]#  ./mknandflashdump u-boot.bin nand.dump 0

      移植完成后,执行skyeye1.2.6 ,会出现T,之后提示失败夹着重新Loading,然后还是会出错:

    *** Warning - bad CRC or NAND, using default environment

     

     

     

    In:    serial

     

    Out:   serial

     

    Err:   serial

     

    Hit any key to stop autoboot:  0

     

    TFTP from server 10.0.0.1; our IP address is 10.0.0.110

     

    Filename 'uImage'.

     

    Load address: 0x31000000

     

    Loading: checksum bad

     

    T T T T T T T T

    此时需要重启tftp,nfs服务器,关闭防火墙:

    [root@localhost Desktop]# service xinetd restart

    [root@localhost u-boot-1.1.4]# service nfs restart

    [root@localhost u-boot-1.1.4]#iptables -F

       完整的启动过程(u-boot、内核、文件系统、用户程序),使用NFS文件系统

    [root@localhost u-boot-1.1.4]# skyeye1.2.6

     

    当执行到此步是有出现如下错误:

    ******************************************************************

                       OK 2410 Rootfs made by ztg, 2009.05

    ******************************************************************

    10.0.0.110 login: root

    login:

    10.0.0.110 login: root

    login:

    10.0.0.110 login: root

    login:

    密码一直出错进不去,此时修改etc/passwd的内容

    执行[root@localhost nfs]# gedit etc/passwd

    内容是:root:x:0:0:root:/root:/bin/sh

    修改时把"x"删掉,再重新起动时就不需要密码了。


    http://blog.chinaunix.net/space.php?uid=14735472&do=blog&id=110947



    <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
    阅读(352) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~
    评论热议
  • 相关阅读:
    代码对齐[UVA1593]
    数数字
    子序列
    细菌培养
    内联函数那些事情
    一个简单的问题
    头文件重复包含问题的一点笔记
    mapreduce 对文件分词读取
    hadoop hive-2.3.5安装
    hadoop sqoop 实例
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647534.html
Copyright © 2011-2022 走看看