• 嵌入式系统移植三部曲 刘峰


    09嵌入式方向    计应(2)班           刘峰


    嵌入式系统移植三步曲 1. Bootloader的移植

    Bootloader是计算机系统加电后运行的第一段软件代码,主要功能是引导系统

    1.编辑u-boot目录中的Makefile文件

    [root@localhost u-boot-1.1.4]# gedit 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

    后面添加

    ok2410_config           :           unconfig

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

    2.复制必要的文件,编辑ok2410.h头文件

    [root@localhost u-boot-1.1.4]# mkdir board/ok2410

    [root@localhost u-boot-1.1.4]# cp board/smdk2410/* board/ok2410/

    [root@localhost u-boot-1.1.4]# dir board/ok2410/

    config.mk  flash.c  lowlevel_init.S  Makefile  smdk2410.c  u-boot.lds

    [root@localhost u-boot-1.1.4]# mv board/ok2410/smdk2410.c board/ok2410/ok2410.c

    [root@localhost u-boot-1.1.4]# cp include/configs/smdk2410.h include/configs/ok2410.h

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

    #define           CFG_PROMPT                      "SMDK2410 # "           /* Monitor Command Prompt           */

    改为

    #define           CFG_PROMPT                      "OK2410 # "           /* Monitor Command Prompt           */

    3.编辑board/ok2410/Makefile文件

    [root@localhost u-boot-1.1.4]# gedit board/ok2410/Makefile

    OBJS           := smdk2410.o flash.o

    改为

    OBJS           := ok2410.o flash.o

    4.配置、编译u-boot

    [root@localhost u-boot-1.1.4]# make ok2410_config

     Configuring for ok2410 board...

    [root@localhost u-boot-1.1.4]# make

    2. linux 内核的编译

     

    linux的移植,根据自己的需要配置linux内核,编译内核创建uimag放置在TFTP服务器根目录(tftpboot/),这样在远程下载模式下,可以在TFTP        服务器根目录(tftpboot/)下载文件系统引导系统。

    3. linux根文件系统移植busybox,创建根文件系统在/tmp/nfs中创建所需目录

    Bootloader的移植实验遇到问题

    1.错误2.95.3文件夹未找到

    解决办法:交叉编译器:arm-linux-gcc2.95.3 没有解压到/usr/local/arm/文件夹下

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

    bash: mknandflashdump: command not found

     

    解决办法:没有将 mknandflashdump.c 和编译后的.o文件放入u-boot-1.1.4目录中

    Linux移植实验遇到问题

    1.错误:[root@localhost linux-2.6.14.7]# make

    make: /usr/local/arm/3.4.1/bin/arm-linux-gcc:命令未找到

      CHK     include/linux/version.h

      SPLIT   include/linux/autoconf.h -> include/config/*

      SYMLINK include/asm-arm/arch -> include/asm-arm/arch-s3c2410

    make[1]: “include/asm-arm/mach-types.h”是最新的。

      CC      arch/arm/kernel/asm-offsets.s

    /bin/sh: /usr/local/arm/3.4.1/bin/arm-linux-gcc: 没有那个文件或目录

    make[1]: *** [arch/arm/kernel/asm-offsets.s] 错误 1

    make: *** [prepare0] 错误 2

    解决办法:交叉编译器:arm-linux-gcc3.4.1 没有解压到/usr/local/arm/文件夹下

    2.错误:[root@localhost linux-2.6.14.7]# make menuconfig

    scripts/kconfig/mconf arch/arm/Kconfig

    #

    # using defaults found in .config

    #

    Your display is too small to run Menuconfig!

    It must be at least 19 lines by 80 columns.

    make[1]: *** [menuconfig] 错误 1

    make: *** [menuconfig] 错误 2

    解决办法:终端窗口太小最大化终端窗口

    3.错误:[root@localhost tools]# cp uImage /tftpboot/

    cp: 无法创建一般文件“/tftpboot/”: 是一个目录

    解决办法:创建tftp服务器

    4.错误:TFTP error: 'Permission denied' (0)

    Starting again

     

    解决办法:改变/tftpboot/权限为777

    [root@localhost /]# chmod  -R 777 tftpboot/

    5.错误:

    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

    解决办法:关闭防火墙即可解决

    根文件系统的移植遇到的错误

    1.错误:

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

                       OK 2410 Rootfs made by liufeng, 2009.05

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

    10.0.0.110 login:

    Login timed out after 60 seconds

    10.0.0.110 login: root

    Password:

    10.0.0.110 login:

    输入了自己的root帐号和密码一直进不去

    解决办法:

    [root@localhost nfs]# rm etc/passwd /etc/shadow /etc/group

    rm:是否删除 一般文件 “etc/passwd”? y

    rm:是否删除 一般文件 “/etc/shadow”? y

    rm:是否删除 一般文件 “/etc/group”? y

    [root@localhost nfs]cp /etc/passwd etc/ ;cp /etc/shadow etc/ ;cp /etc/group etc/

    [root@localhost nfs]chmod 600 etc/shadow

    [root@localhost nfs]gedit etc/passwd

    内容为自己文件的第一行把其它的全部删除

    [root@localhost nfs]gedit etc/shadow

    内容为自己文件的第一行把其它的全部删除

    [root@localhost nfs]gedit etc/group

    内容为自己文件的第一行把其它的全部删除

    2.错误:

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

                       OK 2410 Rootfs made by liufeng, 2009.05

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

    10.0.0.110 login: root

    Password:

    login[25]: root login on 'console'

    login: cannot run /bin/bash: Exec format error

    [root@localhost nfs]gedit etc/passwd

    解决办法:

    :root:x:0:0:root:/root:/bin/bash

    改为:root:x:0:0:root:/root:/bin/sh

    3.错误:

    0.110:10.0.0.1:10.0.0.1:255.255.255.0 init=linuxrc console=ttySAC0,115200  mem=64M

    irq: clearing pending status 00004000

    irq: clearing pending status 00008000

    irq: clearing pending status 00004000

    irq: clearing pending status 00800000

    irq: clearing subpending status 00000092

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

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

    Console: colour dummy device 80x30

    1) 解决办法:

    [root@localhost /]# service nfs restart

    关闭 NFS mountd:                                          [确定]

    关闭 NFS 守护进程:                                        [确定]

    关闭 NFS quotas:                                          [确定]

    关闭 NFS 服务:                                            [确定]

    启动 NFS 服务:                                            [确定]

    关掉 NFS 配额:                                            [确定]

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

    启动 NFS mountd:                                          [确定]

    [root@localhost /]# iptables -F

    [root@localhost /]# service xinetd restart

    停止 xinetd:                                              [确定]

    启动 xinetd:                                              [确定]

    2)或者是当启动到

    In:    serial

    Out:   serial

    Err:   serial

    Hit any key to stop autoboot:  0  回车

    OK2410 # 在此输入”run bootcmd“

    4.错误

    ~ # ls

    -sh: ls: not found

    解决办法:

    [root@localhost /]# whereis ls

    ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz

    [root@localhost /]# cp ls: /bin/ls  /tmp/nfs/bin

    ~ # ls

    a.out    test     test.c   test.c~

    可以看到了,ls命令可以使用了

    5.错误

    ~ # ./test

    ./test: line 1: syntax error: "(" unexpected

    解决办法:设置环境变量,因为宿主机的gcc版本和开发本上的linux内核版本不同

    [root@localhost root]# export PATH=$PATH:/usr/local/arm/3.4.1/bin/

    [root@localhost root]# arm-linux-gcc test.c -o test

    ~ #  ./test

    ===== main =====

    Hello world!

    argv[0]=./test

    ==== exit main ====

     


    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>
    阅读(1501) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~
    评论热议
  • 相关阅读:
    MySQL_解决ERROR 2006 (HY000) at line XX MySQL server has gone away问题
    mysql全量备份脚本
    mysql增量备份脚本
    使用u32过滤器设置基于mac地址的下载限制
    Quantum & r2q
    关于limit hashlimit资料整理
    u32 mac以及arp匹配
    Iptables 规则 一些简单实例和详细介绍
    Optimizing shaper — hashing filters (HTB)
    使用ingress qdisc和ifb进行qos
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647546.html
Copyright © 2020-2023  润新知