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



    09计应一班 孟明明(09嵌入式方向) 

     

    嵌入式系统移植三步曲

     

     

    1. Bootloader的移植

    2. linux 内核的编译

    3. linux根文件系统移植

     

    1.BootLoader的移植,修改Makefile文件内容,

    ifeq ($(ARCH),arm)

    CROSS_COMPILE = arm-linux-

    endif

    改为

    ifeq ($(ARCH),arm)

    CROSS_COMPILE=/usr/local/arm/2.95.3/bin/arm-linux-

    endif

     

    smdk2410_config    :     unconfig

          @./mkconfig $(@:_config=) arm arm920t smdk2410 NULL s3c24x0

    后面添加

    meng2410_config   :     unconfig

          @./mkconfig $(@:_config=) arm arm920t meng2410 NULL s3c24x0

    编辑meng2410.h头文件

    [root@localhost u-boot-1.1.4]# gedit include/configs/meng2410.h

     编辑board/meng2410/Makefile文件

    OBJS   := smdk2410.o flash.o

    改为

    OBJS   := meng2410.o flash.o

    修改cpu/arm920t/config.mk文件

    PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

    改成

    PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))

    再修改examples/Makefile文件

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

    SREC   = hello_world.srec

    BIN = hello_world.bin hello_world

    改为

    SREC   = hello_world.o

    BIN = hello_world.o hello_world

    即可重新编译。

    [root@localhost u-boot-1.1.4]#  ll u-boot*

    -rwxr-xr-x 1 root root 441785 06-07 09:30 u-boot

    -rwxr-xr-x 1 root root 115460 06-07 09:30 u-boot.bin

    -rw-r--r-- 1 root root  50542 06-07 09:30 u-boot.map

    -rwxr-xr-x 1 root root 346442 06-07 09:30 u-boot.srec

     再添加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

     

     

    执行skyeye1.2.6

    In:    serial

    Out:   serial

    Err:   serial

    Hit any key to stop autoboot:  0

    MENG2410 #

     

     

    第二步:编译内核

     

    建立好了开发环境,接下来要做的就是根据硬件环境编译原程序.本试验用的是linux-2.6.14.7.tar.bz2,将其解压之后修改Makefile文件,然后再对网上进行移植,本例用的是cs8900,接着编辑arch/arm/mach-s3c2410/mach-smdk2410.c文件。设置flash分区

     

    第三步:根文件系统的移植 busybox,yaffs2根文件系统的建立,在重启服务器之后再启动开发版。

     

     

    问题

    1.     在烧写的时候会有提示说mknandflashdump 命令找不到,这时需要在u-boot目录下添加一个可执行的mknandflashdump 命令,并用要是在当前环境下执行该命令,也就是执行命令时前加./:

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

     

     

    2.移植完成后,执行skyeye1.2.6 ,会出现T(表示try),这时就需要根文件系统的移植

     

     

    *** 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服务器没有搭建,需要对tftp进行搭建,同时对其权限进行修改,

    #chmod-R 755 /tftpboot;

    3.防火墙问题

    此时可执行iptables命令;

    4.SElinux 问题:使用getsebool,setsebool命令对其进行修改;

    SElinux为安全机制,在执行的时候右下角会出现SElinux提示,此时可以用命令对其进行修改:

    [root@localhost qrs]# getsebool -a|grep tftp

    allow_tftp_anon_write --> off

    allow_tftp_anon_write--> off

    tftpd_disable_trans --> off

    此时可以用setsebool命令对其进行改

    [root@localhost qrs]#setsebool -P allow_tftp_anon_write =1

    [root@localhost qrs]#setsebool -P allow_tftp_anon_write=1 [root@localhost qrs]#  setsebool -P tftpd_disable_trans=1

     

    5.有时在启动的时候会出现如下情况:

    PID hash table entries: 512 (order: 9, 8192 bytes)

    timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c

    Console: colour dummy device 80x30

    [root@localhost u-boot-1.1.4]#

    此时由于nfs没有搭建,可以用命令查看

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

    rpc.mountd 已停

    nfsd 已停

    rpc.rquotad 已停

    [root@localhost u-boot-1.1.4]#

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

    启动 NFS 服务:                                            [确定]

    关掉 NFS 配额:                                            [确定]

    启动 NFS 守护进程:                                        [确定]

    启动 NFS mountd                                          [确定]

    [root@localhost u-boot-1.1.4]#

     

     再重新执行skyeye1.2.6

      完整的启动过程(u-boot、内核、文件系统)通过tftp将操作系统内核下载到开发板,内核引导时通过NFS挂载根文件系统

    编辑tftp服务器,然后重启tftp;

     

    6. 在启动过程中原本可以启动的却在重启计算机后启动不起来了,这时就需要将执行如下命令:

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

    停止 xinetd                                              [确定]

    启动 xinetd                                              [确定]

    也有可能是防火墙的问题,需要执行如下命令:

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

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

     

    此时再重新执行skyeye1.2.6,启动开发板系统,出现

    Mounted devfs on /dev

    Freeing init memory: 96K

    #mount all.......

     

              MENG 2410 Rootfs made by mengmingming, 2010.06

     

     

    说明启动成功,此时可以有您自己的烙印在里面的哦!

     

    输入用户名和密码就可以登陆进去,执行命令!此时可能又会出现问题,这就是问题7所在的哦:

    7.当输入用户名之后,再输入密码发现密码不正确,那密码到底是什么呢?那就是我们自己的主机密码,可能在输入的主机密码之后还是不能登陆,那么我们就要对密码进行设置了,在文件系统里面etc/passwd里面第一行的:

    root:x:0:0:root:/root:/bin/sh

    X删除,之后再重新登陆,此时登陆是不要密码的,但此时却没有安全性可言,不过可以在登陆之后再对其密码进行重新设置,此时要加上X之后再对密码进行设置,也就是用passwd命令!

    10.0.0.110 login: root

    login[25]: root login on 'console'

     

    Processing /etc/profile... Done

    ~ # printenv

    USER=root

    HOME=/root

    LOGNAME=root

    TERM=vt102

    PATH=/sbin:/usr/sbin:/bin:/usr/bin

    SHELL=/bin/sh

    PWD=/root

    ~ #

    ~ # ping -c 4 10.0.0.1

    PING 10.0.0.1 (10.0.0.1): 56 data bytes

    64 bytes from 10.0.0.1: seq=0 ttl=64 time=0.030 ms

    64 bytes from 10.0.0.1: seq=1 ttl=64 time=0.022 ms

    64 bytes from 10.0.0.1: seq=2 ttl=64 time=0.022 ms

    64 bytes from 10.0.0.1: seq=3 ttl=64 time=0.022 ms

     


    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>
    阅读(796) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~
    评论热议
  • 相关阅读:
    我常用到的前端工具
    三级菜单
    voxel安装2
    voxel安装
    Linux 安装 nginx
    pip DEPRECATION: The default format will switch to columns”错误
    Python升级安装的一些问题
    Linux下修改Apache即httpd的端口
    Linux中yum命令镜像源和出错解决方案
    Linux 别名 Apache
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647608.html
Copyright © 2011-2022 走看看