Chinaunix首页 | 论坛 | 博客
  • 博客访问: 127172
  • 博文数量: 35
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2013-07-19 22:24
文章分类
文章存档

2015年(9)

2013年(26)

我的朋友

分类: LINUX

2015-04-08 17:04:25

终于拿到板子了, 嵌入式开发正式开启. 

板子型号 : 三星 S3C6410 基于ARM11, 指令集基于arm6指令集;

为毛不是 Cortext A9的板子;


烧写内容 : BootLoader, Linux KernelFile System;


烧写流程 : 

-- sd卡烧写u-boot并启动 : 首先将 u-boot 烧写到 sd 卡中, 使用 sd 卡的bootloader启动; 

-- 擦出nand flash : 之后将开发板的闪存 nand flassh 擦除干净; 

-- nand flash 烧写 u-boot : 然后将 u-boot 烧写到 nand flash 中;

-- 烧写内核 : 向nand flash 中烧写内核;

-- 烧写文件系统 : 将文件系统烧写到nand flash 中; 


1. BootLoader介绍


嵌入式开发板软件层次 : 从底层到上层 引导程序 -> Linux内核 -> 文件系统 -> 应用程序

-- 引导加载程序 : 分为两部分 硬件中的固化boot代码 和 BootLoader代码, 其中固化的boot代码可有可无, BootLoader是烧写上去的;

-- Linux内核 : 嵌入式开发板定制的内核 和 其启动参数;

-- 文件系统 : 即Linux中的文件系统;

-- 应用程序 : 即用户执行的应用程序, 应用程序 和 内核之间可能包含嵌入式的图形界面;


引导加载程序介绍 : 引导加载程序是系统上电之后执行的第一段程序;


PC机上的引导加载程序 : 

-- 组成结构 : BIOS (固件程序) 和 BootLoader(GRUB等程序);

-- 执行过程 : BIOS执行硬件检测 和 资源分配, 之后将BootLoader读取到内存中, 开始执行BootLoader内容;

-- 执行作用 : 将内核读取到内存中, 跳转到内核的入口运行, 正式执行操作系统程序;


嵌入式BootLoader : BootLoader与硬件的依赖性很强, 每一种嵌入式设备都有其对应的BootLoader引导程序, 在这里 S3C6410 板子使用的BootLoader 是 U-BOOT;


BootLoader操作模式 : 将BootLoader烧写到 nand flash 中之后, 第一次启动是靠交互模式启动的, 之后就靠子启动模式启动;

-- 自启动模式 : 系统上电之后自动将 BootLoader 加载到内存, 之后自动开启系统, 整个过程全自动, 用户不介入;

-- 交互模式 : BootLoader 通过串口 或者 网络从服务器上下载内核到内存中, 可以将内核写到磁盘, 或者直接进入系统, 同时可以从串口中接收用户命令;


BootLoader启动过程 : 分为两个阶段;

-- 第一阶段 : 初始化基本硬件, 将BootLoader加载到内存中, 设置堆栈指针, 清空BSS段;

-- 第二阶段 : 初始化本阶段用的硬件, 读取环境变量, 启动BootLoader(两种启动模式);


2. 配置网络


烧写过程需要配置 网络tftpnfs 三项, 配置完之后重启服务器;


(1) 网络设置


需要设置网络ip地址 和 关闭防火墙; 如果是 redhat 系统, 还需要关闭SELinux;

设置ip地址命令 : ifcofig eth0 192.168.1.27 命令;

关闭防火墙 : sudo ufw disable 命令;

重启网络服务 :  sudo /etc/init.d/networking restart 命令;


[plain] view plaincopy
  1. octopus@octopus:~$ sudo ifconfig eth0 192.168.1.27  
  2. octopus@octopus:~$ sudo ufw disable  
  3. 防火墙在系统启动时自动禁用  
  4. octopus@octopus:~$ sudo /etc/init.d/networking restart  
  5.  * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces  
  6.  * Reconfiguring network interfaces...   



(2) 配置tftp


安装tftp软件 : 

-- 安装tftp服务器 : sudo apt-get install tftpd 命令;

-- 安装tftp客户端 : sudo apt-get install tftp 命令;

-- 安装 xinetd : sudo apt-get install xinetd 命令;


配置 tftp : 建立 /etc/xinetd.d/tftp 文件, 使用 sudo vim /etc/xinetd.d/tftp 命令, 向文件中写入以下内容 : 

[plain] view plaincopy
  1. service tftp  
  2. {  
  3.     socket_type = dgram  
  4.     wait = yes  
  5.     disable = no  
  6.     user = root  
  7.     protocol = udp  
  8.     server = /usr/sbin/in.tftpd  
  9.     server_args = -s /tftpboot  
  10.     #log_on_success += PID HOST DURATION  
  11.     #log_on_failure += HOST  
  12.     per_source = 11  
  13.     cps =100 2  
  14.     flags =IPv4  
  15. }  


,

创建共享目录 : 查看 根目录下 有没有 tftpboot 目录, 如果没有的话就创建 /tftpboot 目录;

-- 创建共享目录 : sudo mkdir /tftpboot 命令创建;

-- 修改权限 : sudo chmod -R 777 /tftpboot , 加上 -R 表示 递归将其子目录子文件也进行权限修改; 


修改 /etc/xinetd.d 配置文件 : 保证配置文件与下面一致即可;

[plain] view plaincopy
  1. # Simple configuration file for xinetd  
  2. #  
  3. # Some defaults, and include /etc/xinetd.d/  
  4.   
  5. defaults  
  6. {  
  7.   
  8. # Please note that you need a log_type line to be able to use log_on_success  
  9. # and log_on_failure. The default is the following :  
  10. # log_type = SYSLOG daemon info  
  11.   
  12. }  
  13.   
  14. includedir /etc/xinetd.d  

修改 /etc/default/tftpd-hpa 配置文件 : 

[plain] view plaincopy
  1. # /etc/default/tftpd-hpa  
  2.   
  3. TFTP_USERNAME="tftp"  
  4. TFTP_DIRECTORY="/tftpboot"  
  5. TFTP_ADDRESS="0.0.0.0:69"  
  6. TFTP_OPTIONS="-l -c -s"  

重启tftp服务 : 注意按照次序将下面三个命令依次执行 ;

-- 执行 service tftpd-hpa restart 命令 : 

[plain] view plaincopy
  1. octopus@octopus:~$ service tftpd-hpa restart  
  2. stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.83" (uid=1000 pid=5737 comm="stop tftpd-hpa ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")  
  3. start: Rejected send message, 1 matched rules; type="method_call", sender=":1.84" (uid=1000 pid=5734 comm="start tftpd-hpa ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")  
-- 执行 sudo /etc/init.d/xinetd reload 命令 : 

[plain] view plaincopy
  1. octopus@octopus:~$ sudo /etc/init.d/xinetd reload  
  2. [sudo] password for octopus:   
  3. Rather than invoking init scripts through /etc/init.d, use the service(8)  
  4. utility, e.g. service xinetd reload  
  5.   
  6. Since the script you are attempting to invoke has been converted to an  
  7. Upstart job, you may also use the reload(8) utility, e.g. reload xinetd  
-- 执行 sudo /etc/init.d/xinetd restart 命令 : 

[plain] view plaincopy
  1. octopus@octopus:~$ sudo /etc/init.d/xinetd restart  
  2. Rather than invoking init scripts through /etc/init.d, use the service(8)  
  3. utility, e.g. service xinetd restart  
  4.   
  5. Since the script you are attempting to invoke has been converted to an  
  6. Upstart job, you may also use the stop(8) and then start(8) utilities,  
  7. e.g. stop xinetd ; start xinetd. The restart(8) utility is also available.  
  8. xinetd stop/waiting  
  9. xinetd start/running, process 5769  

测试 tftp 服务 : 

-- 进入tftp : 使用 tftp localhost , 进入本地的tftp服务器;

-- 下载其中的文件 : 使用 get uboot.bin 下载其中的 uboot 文件到本地目录, 如果文件不存在会提示 Error code 1: File not found 错误;

[plain] view plaincopy
  1. octopus@octopus:~$ tftp localhost  
  2. tftp> get aaa  
  3. Error code 1: File not found  
  4. tftp> get uboot.bin  
  5. tftp> quit  
  6. octopus@octopus:~$ ls  
  7. aaa        develop  icmp         ndk       Source Insight  x86-probe  模板  图片  下载  桌面  
  8. arm-probe  gcc      log4c-1.2.1  programs  uboot.bin       公共的     视频  文档  音乐  



(3) 配置 nfs 服务


安装nfs服务器 : sudo apt-get install nfs-kernel-server 命令;


配置 nfs 服务 : 使用 sudo vim /etc/exports 命令配置, 将下面的内容添加到文件末尾 ;

[plain] view plaincopy
  1. /nfsroot    *(rw,sync,no_root_squash)  

-- 最终配置 : 

[plain] view plaincopy
  1. # /etc/exports: the access control list for filesystems which may be exported  
  2. #       to NFS clients.  See exports(5).  
  3. #  
  4. # Example for NFSv2 and NFSv3:  
  5. # /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)  
  6. #  
  7. # Example for NFSv4:  
  8. # /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)  
  9. # /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)  
  10.   
  11. /nfsroot    *(rw,sync,no_root_squash)  

-- /nfsroot : 这个是 nfs 服务的共享目录;

-- : 表示任意IP都可以访问;

-- rw : 表示 可以 读 写;

-- sync : 表示 同步;

-- no_root_squash : 表示 root 用户登录不做权限检查;


创建共享目录 : sudo mkdir /nfsroot ;


重启端口映射 : sudo /etc/init.d/portmap restart ;

[plain] view plaincopy
  1. octopus@octopus:~$ sudo /etc/init.d/portmap restart  
  2. Rather than invoking init scripts through /etc/init.d, use the service(8)  
  3. utility, e.g. service portmap restart  
  4.   
  5. Since the script you are attempting to invoke has been converted to an  
  6. Upstart job, you may also use the stop(8) and then start(8) utilities,  
  7. e.g. stop portmap ; start portmap. The restart(8) utility is also available.  
  8. portmap stop/waiting  
  9. portmap start/running, process 5234  

重启 nfs 服务 : sudo /etc/init.d/nfs-kernel-server restart ;

[plain] view plaincopy
  1. octopus@octopus:~$ sudo /etc/init.d/nfs-kernel-server restart  
  2.  * Stopping NFS kernel daemon                                                                                             [ OK ]   
  3.  * Unexporting directories for NFS kernel daemon...                                                                       [ OK ]   
  4.  * Exporting directories for NFS kernel daemon...                                                                                exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/nfsroot".  
  5.   Assuming default behaviour ('no_subtree_check').  
  6.   NOTE: this default has changed since nfs-utils version 1.0.x  
  7.   
  8.                                                                                                                           [ OK ]  
  9.  * Starting NFS kernel daemon                                                                                             [ OK ]   

验证nfs服务 : showmount -e, 如果出现共享目录说明 nfs 服务配置成功;

[plain] view plaincopy
  1. octopus@octopus:~$ showmount -e  
  2. Export list for octopus:  
  3. /nfsroot *  


3. 向 SD 卡中烧写 u-boot


烧写位置 : 烧写的 u-boot 位于 sd卡的末端, 如果SD卡存满了数据, 就会将最后的数据破坏掉, 烧写的 u-boot 在文件系统中是看不到的;


计算位置 : 根据SD卡类型计算出 烧写 u-boot 的初始位置;
-- SD卡 : SD 卡 最后2个文件块 不能用于烧写 u-boot, 因此烧写的位置是 SD卡块大小 减去 2 再减去 u-boot 的块大小, 注意是 块 大小, 一块是 512字节;
-- SDHC卡 : SDHC 卡 最后 1026 字节不能用于烧写 u-boot, 因此烧写的位置是 SDHC卡 块大小 减去 1026, 再减去 u-boot 块大小;

将SD卡装入读卡器, 查看设备名称 : 使用 sudo fdisk -l /dev/sd* 查看sd卡大小, 判断sd卡;
-- 查找sd卡 : 使用 ls /dev/sd* 命令查找sd卡;

[plain] view plaincopy
  1. octopus@octopus:~$ ls /dev/sd*  
  2. /dev/sda  /dev/sda1  /dev/sda2  /dev/sda5  /dev/sdb  /dev/sdb1  
-- 查看SD卡信息 : 使用 sudo fdisk -l /dev/sdb 命令, 可以看到 SD卡的块大小是 512字节, 总字节数为 1018691584 , 总块数为 1989632 块;

[plain] view plaincopy
  1. octopus@octopus:~$ sudo fdisk -l /dev/sdb  
  2.   
  3. Disk /dev/sdb: 1018 MB, 1018691584 bytes  
  4. 30 heads, 29 sectors/track, 2286 cylinders, total 1989632 sectors  
  5. Units = 扇区 of 1 * 512 = 512 bytes  
  6. Sector size (logical/physical): 512 bytes / 512 bytes  
  7. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  8. Disk identifier: 0x00000000  
  9.   
  10.    设备 启动      起点          终点     块数   Id  系统  
  11. /dev/sdb1   
-- 查看 SD 卡块大小 : 使用 cat /sys/block/sdb/size 命令;

[plain] view plaincopy
  1. octopus@octopus:~$ cat /sys/block/sdb/size   
  2. 1989632  


计算 u-boot 大小 : 使用 ll u-boot-movi.bin 命令查看, 大小未 270336, 处以 512, 总共是 528块;

[plain] view plaincopy
  1. octopus@octopus:~$ ll u-boot-movi.bin   
  2. -rw-r--r-- 1 octopus octopus 270336  4月 20 16:59 u-boot-movi.bin  

计算 SD 卡的烧写位置 : 1989632 - 2 - 528 = 1989102, 从 1989102 位置开始烧写;


烧写 u-boot 到 SD卡 : 将 u-boot 放到 ~ 目录, 进入该目录, 执行下面的命令 : 
sudo dd if=u-boot-movi.bin of=/dev/sdb bs=512 count=528 seek=1989102
-- if : 烧写的源文件;
-- of : 要烧写的设备;
-- bs : 设备的文件块大小;
-- count : 烧写的源文件块大小;
-- seek : 烧写的sd卡的初始位置, 设立是 sd卡块大小 - 2 - 528;


需要注意的问题 : 
-- 权限不够 : 需要 root 用户运行 dd 命令;
-- 只读文件系统 : 将 SD卡中的 写 开关打开;

[plain] view plaincopy
  1. octopus@octopus:~$ dd if=u-boot-movi.bin of=/dev/sdb bs=512 count=528 seek=1989102  
  2. dd: 正在打开"/dev/sdb": 权限不够  
  3. octopus@octopus:~$ sudo dd if=u-boot-movi.bin of=/dev/sdb bs=512 count=528 seek=1989102  
  4. dd: 正在打开"/dev/sdb": 只读文件系统  
  5. octopus@octopus:~$ sudo dd if=u-boot-movi.bin of=/dev/sdb bs=512 count=528 seek=1989102  
  6. 记录了528+0 的读入  
  7. 记录了528+0 的写出  
  8. 270336字节(270 kB)已复制,0.0582359 秒,4.6 MB/秒  


4. 烧写 uboot 到 nand flash 中



使用 SD 卡启动 uboot : 烧写完毕之后, 将SD卡插入开发板, 并使用 SD卡启动模式, 进入系统;

-- 权限问题 : 进入 minicom , 注意 这个也要使用 sudo minicom 执行, 需要 root 权限;
-- 加载完uboot立刻中断 : 打开开发板, 注意要不停的按回车, 因为 u-boot 启动之后就会加载内核 和 系统文件, 这里我们只有 u-boot, 没有kernel 会出现未知问题, 因此 不能让其继续加载;

[plain] view plaincopy
  1. Welcome to minicom 2.5  
  2.   
  3. OPTIONS: I18n   
  4. Compiled on May  2 2011, 00:39:27.  
  5. Port /dev/ttyUSB0  
  6.   
  7. Press CTRL-A Z for help on special keys                                        
  8.                                                                                
  9.  S3'46j?b1 ?1 X4 fc1 E1 q0Mijiccm2.5K                                        
  10.                                                                                
  11. U-Boot 1.1.6 (Apr 16 2014 - 21:26:39) for atxb                                 
  12.   
  13.   
  14. CPU:     S3C6410 @532MHz  
  15.          Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)   
  16. Board:   SMDK6410  
  17. DRAM:     0 kB  
  18. Flash:   0 kB  
  19. NAND:    256 MB   
  20. SD/MMC:  SD 2.0 / Manufacturer: 0x1B,OEM: "SM/00000",REV: 1.0,S/N: -1320320343,DATE: 2008/3  
  21.          MMC/SD size: 971 MiB  
  22.          Freq = 25MHz  
  23.          using default moviNAND environment  
  24.   
  25. In:      serial  
  26. Out:     lcd  
  27. Err:     lcd  
  28. Hit any key to stop autoboot:  0   
  29. atxb #   

查看开发板的网络状况 : 注意其中的 ipaddr 是开发板的ip地址, serverip 和 gatewayip 是 PC 机的ip地址;
-- 注意 : 链接上PC机之后, Ubuntu 要禁用联网, 否则系统会尝试修改PC的ip地址;

[plain] view plaincopy
  1. atxb # pri  
  2. bootargs=root=/dev/mtdblock2 rootfstype=yaffs2 console=ttySAC0,115200  
  3. bootcmd=fatload mmc 0:1  0x5FD00000 burnIcon.bin;                  nand scrub       0x00000000 0x00100000;                    na   
  4. bootdelay=1  
  5. baudrate=115200  
  6. ethaddr=00:40:5c:26:0a:5b  
  7. netmask=255.255.255.0  
  8. ipaddr=192.168.1.127  
  9. serverip=192.168.1.27  
  10. gatewayip=192.168.1.27  
  11. stdin=serial  
  12. stdout=lcd  
  13. stderr=lcd  




网络准备 : 
-- 连接网线 : 使用网线将 开发板 与 机器连接起来;
-- 关闭网络连接 : 我们会使用 ifconfig 命令设置一个ip地址, 网络自动连接会分配一个ip, 破坏原来的设定, 这里我们将网络链接关闭;


根据开发板修改PC机ip地址 : sudo ifconfig eth0 192.168.1.27 命令;

[plain] view plaincopy
  1. octopus@octopus:~$ sudo ifconfig eth0 192.168.1.27  
  2. [sudo] password for octopus:   
  3. octopus@octopus:~$ ifconfig  
  4. eth0      Link encap:以太网  硬件地址 e0:db:55:c8:cd:ed    
  5.           inet 地址:192.168.1.27  广播:192.168.1.255  掩码:255.255.255.0  
  6.           UP BROADCAST MULTICAST  MTU:1500  跃点数:1  
  7.           接收数据包:619688 错误:0 丢弃:0 过载:0 帧数:0  
  8.           发送数据包:334612 错误:0 丢弃:0 过载:0 载波:0  
  9.           碰撞:0 发送队列长度:1000   
  10.           接收字节:500770870 (500.7 MB)  发送字节:61075765 (61.0 MB)  
  11.   
  12.   
  13. lo        Link encap:本地环回    
  14.           inet 地址:127.0.0.1  掩码:255.0.0.0  
  15.           inet6 地址: ::1/128 Scope:Host  
  16.           UP LOOPBACK RUNNING  MTU:65536  跃点数:1  
  17.           接收数据包:1717476 错误:0 丢弃:0 过载:0 帧数:0  
  18.           发送数据包:1717476 错误:0 丢弃:0 过载:0 载波:0  
  19.           碰撞:0 发送队列长度:0   
  20.           接收字节:1034292099 (1.0 GB)  发送字节:1034292099 (1.0 GB)  


在开发板上 ping PC : ping 192.168.1.27 命令;

[plain] view plaincopy
  1. atxb # ping 192.168.1.27  
  2. dm9000 i/o: 0x18000000, id: 0x90000a46   
  3. MAC: 00:40:5c:26:0a:5b  
  4. operating at 100M full duplex mode  
  5. host 192.168.1.27 is alive  


将 uboot 下载到内存中 : tftp 50000000 uboot.bin 命令;
-- 命令解释 : 下载 uboot.bin 文件到 内存的 50000000 位置;

[plain] view plaincopy
  1. atxb # tftp 50000000 uboot.bin  
  2. dm9000 i/o: 0x18000000, id: 0x90000a46   
  3. MAC: 00:40:5c:26:0a:5b  
  4. operating at 100M full duplex mode  
  5. TFTP from server 192.168.1.27; our IP address is 192.168.1.127  
  6. Filename 'uboot.bin'.  
  7. Load address: 0x50000000  
  8. Loading: #######################################  
  9. done  



擦除整个 nand flash : 使用 nand erase 命令;

[plain] view plaincopy
  1. atxb # nand erase  
  2.   
  3. NAND erase: device 0 whole chip  
  4. Skipping bad block at  0x09000000                                              
  5. Erasing at 0xffe0000 -- 100% complete.  
  6. OK  

将 uboot.bin 写出到 nand flash 中 : nand write 50000000 0 40000 命令;
-- 命令解释 : 将内存中 50000000 地址的文件拷贝到 nand flash 中的 从 0 开始 到 40000 的地址中;

[plain] view plaincopy
  1. atxb # nand write 50000000 0 40000  
  2.   
  3. NAND write: device 0 offset 0x0, size 0x40000  
  4.  262144 bytes written: OK  


此时 uboot.bin 已经正式烧写到了 开发板的 nand flash 中了;



5. 将 Linux Kernel 烧写到nand flash中



使用 nand flash 模式执行 uboot 启动开发板 : 将启动模式开关设置为 nand flash 启动;


查看开发板网络状况 : 使用 pri 命令;

[plain] view plaincopy
  1. [uplooking] > pri  
  2. bootargs=set bootargs root=/dev/mtdblock2 rootfstype=yaffs2 console=ttySAC0,115200  
  3. bootcmd=nand read 0x50008000 0x00040000 0x00400000;bootm 0x50008000  
  4. bootdelay=3  
  5. baudrate=115200  
  6. ethaddr=00:40:5c:26:0a:5b  
  7. ipaddr=192.168.221.100  
  8. serverip=192.168.221.90  
  9. gatewayip=192.168.221.254  
  10. netmask=255.255.255.0  
  11. stdin=serial  
  12. stdout=serial  
  13. stderr=serial  
  14.   
  15. Environment size: 341/16380 bytes  


修改 PC 的ip地址 : sudo ifconfig eth0 192.168.221.90 命令;


在开发板中 ping PC ping 192.168.221.90 命令;

[plain] view plaincopy
  1. [uplooking] > ping 192.168.221.90  
  2. dm9000 i/o: 0x18000300, id: 0x90000a46   
  3. MAC: 00:40:5c:26:0a:5b  
  4. operating at 100M full duplex mode  
  5. host 192.168.221.90 is alive  


内核镜像文件准备 : 准备好 Linux Kernel 的镜像文件 zImage-6410, 将其拷贝到 /tftpboot 目录下, 即tftp的共享目录;

下载内核文件到内存中 : 使用 tftp 50008000 zImage-6410 命令;
-- 命令解析 : 将 zImage-6410 文件下载到 内存中的 50008000 地址中;

[plain] view plaincopy
  1. [uplooking] > tftp 50008000 zImage-6410  
  2. dm9000 i/o: 0x18000300, id: 0x90000a46   
  3. MAC: 00:40:5c:26:0a:5b  
  4. operating at 100M full duplex mode  
  5. TFTP from server 192.168.221.90; our IP address is 192.168.221.100  
  6. Filename 'zImage-6410'.  
  7. Load address: 0x50008000  
  8. Loading: #################################################################  
  9.          #################################################################  
  10.          #################################################################  
  11.          #################################################################  
  12.          #################################################################  
  13.          #################################################################  
  14.          ##########  
  15. done  
  16. Bytes transferred = 2043792 (1f2f90 hex)  

擦除 nand flash : nand erase 40000 命令;

[plain] view plaincopy
  1. [uplooking] > nand erase 40000  
  2.   
  3. NAND erase: device 0 offset 0x40000, size 0xffc0000  
  4. Skipping bad block at  0x09000000                                              
  5. Erasing at 0xffe0000 -- 100% complete.  
  6. OK  

nand erase命令解析 : 
-- nand erase : 擦除整个 nand flash;
-- nand erase 40000 : 擦除 从 40000 地址以后的 nand flash;
-- nand erase 40000 400000 : 擦出 从 40000 到 400000 的 nand flash;


将内核烧写到 nand flash 中 : nand write 50008000 40000 300000 命令;
-- 命令解析 : 将50008000的内核文件 烧写到 从 nand flash 地址 40000 开始的 300000 字节地址中;



6. 烧写文件系统


将文件系统烧写到嵌入式开发板上;


设置 uboot 启动配置 : 使用 set bootargs noinitrd root=/dev/nfs rw nfsroot=192.168.221.90:/nfsroot ip=192.168.221.100 console=ttySAC0,115200 init=/linuxrc mem=128M 命令进行配置;

-- root=/dev/nfs : 文件系统在远程的 NFS 服务器上;

-- nfsroot=192.168.221.90:/nfsroot : 表示 NFS 服务器在 192.168.221.90 服务器中, 共享目录是 /nfsroot;

-- ip=192.168.221.100 : 当前的开发板地址是 192.168.221.100 ;

-- console=ttySAC0,115200 : ttySAC0 代表 PC 机通过串口登录到开发板上, 串口通信的波特率是 115200 ;

-- init=/linuxrc : Linux Kernel 启动完成之后, 立即运行文件系统中的 linuxrc 程序;

-- mem=128M : 当前开发板的内存是 128M;


文件系统准备 : 将文件系统文件 atxb.tar 和 root_qtopia.tgz 拷贝到 /nfsroot 目录下, 然后将 root_qtopia.tgz 解压, 并见将其中的跟文件系统拷贝到 /nfsroot 目录下;

[plain] view plaincopy
  1. root@octopus:/nfsroot# ls  
  2. atxb.tar  bin  dev  etc  home  lib  linuxrc  mnt  opt  proc  root  root_qtopia.tgz  sbin  sdcard  sys  tmp  usr  var  www  
  3. root@octopus:/nfsroot#   

启动内核 : 从内存中启动内核, 使用 bootm 50008000 命令, 从内存中的 50008000 地址启动内核;

[plain] view plaincopy
  1. [uplooking] > set bootargs noinitrd root=/dev/nfs rw nfsroot=192.168.221.90:/nfsroot ip=192.168.221.100 console=ttySAC0,115200 iM  
  2. [uplooking] > bootm 50008000  
  3. Boot with zImage  
  4. do not support this address : 50008000  
  5.   
  6. Starting kernel ...  
  7.   
  8. Uncompressing Linux..............................................................................................................  
  9. Linux version 2.6.28.6 (yq@m862-ubuntu) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #63 Mon Sep 27 12:28:49 CST 2010  
  10. CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f  
  11. CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache  
  12. Machine: SMDK6410  
  13. Memory policy: ECC disabled, Data cache writeback  
  14. CPU S3C6410 (id 0x36410101)  
  15. S3C24XX Clocks, (c) 2004 Simtec Electronics  
  16. S3C64XX: PLL settings, A=532000000, M=532000000, E=24000000  
  17. S3C64XX: HCLKx2=266000000, HCLK=133000000, PCLK=66500000  
  18. div1: 00000555  
  19. mout_apll: source is fout_apll (1), rate is 532000000  
  20. mout_epll: source is fout_epll (1), rate is 24000000  
  21. mout_mpll: source is mpll (1), rate is 532000000  
  22. mmc_bus: source is dout_mpll (1), rate is 44333333  
  23. mmc_bus: source is dout_mpll (1), rate is 44333333  
  24. mmc_bus: source is dout_mpll (1), rate is 44333333  
  25. usb-host-bus: source is mout_epll (0), rate is 24000000  
  26. uclk1: source is dout_mpll (1), rate is 66500000  
  27. spi-bus: source is mout_epll (0), rate is 24000000  
  28. spi-bus: source is mout_epll (0), rate is 24000000  
  29. audio-bus0: source is mout_epll (0), rate is 24000000  
  30. audio-bus1: source is mout_epll (0), rate is 24000000  
  31. audio-bus2: source is mout_epll (0), rate is 24000000  
  32. irda-bus: source is mout_epll (0), rate is 24000000  
  33. s3c64xx: 15728640 bytes SDRAM reserved for fimc at 0x50569000  
  34. s3c64xx: 8388608 bytes SDRAM reserved for pp at 0x51469000  
  35. s3c64xx: 8388608 bytes SDRAM reserved for tv at 0x51c69000  
  36. s3c64xx: 6291456 bytes SDRAM reserved for mfc at 0x52469000  
  37. s3c64xx: 8388608 bytes SDRAM reserved for jpeg at 0x52a69000  
  38. s3c64xx: 8388608 bytes SDRAM reserved for cmm at 0x53269000  
  39. Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512  
  40. Kernel command line: noinitrd root=/dev/nfs rw nfsroot=192.168.221.90:/nfsroot ip=192.168.221.100 console=ttySAC0,115200 init=/lM  
  41. PID hash table entries: 512 (order: 9, 2048 bytes)  
  42. Console: colour dummy device 80x30  
  43. s3c24xx_serial_init_ports: initialising ports=4...  
  44. console [ttySAC0] enabled  
  45. Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)  
  46. Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)  
  47. Memory: 128MB = 128MB total  
  48. Memory: 71024KB available (3808K code, 492K data, 140K init)  
  49. SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1  
  50. Calibrating delay loop... 530.84 BogoMIPS (lpj=1327104)  
  51. Mount-cache hash table entries: 512  
  52. CPU: Testing write buffer coherency: ok  
  53. net_namespace: 316 bytes  
  54. NET: Registered protocol family 16  
  55. S3C6410: Initialising architecture  
  56. S3C DMA-pl080 Controller Driver, (c) 2006-2007 Samsung Electronics  
  57. Total 32 DMA channels will be initialized.  
  58. SCSI subsystem initialized  
  59. usbcore: registered new interface driver usbfs  
  60. usbcore: registered new interface driver hub  
  61. usbcore: registered new device driver usb  
  62. NET: Registered protocol family 2  
  63. IP route cache hash table entries: 1024 (order: 0, 4096 bytes)  
  64. TCP established hash table entries: 4096 (order: 3, 32768 bytes)  
  65. TCP bind hash table entries: 4096 (order: 4, 81920 bytes)  
  66. TCP: Hash tables configured (established 4096 bind 4096)  
  67. TCP reno registered  
  68. NET: Registered protocol family 1  
  69. NetWinder Floating Point Emulator V0.97 (double precision)  
  70. yaffs Sep 26 2010 15:19:14 Installing.   
  71. msgmni has been set to 139  
  72. alg: No test for stdrng (krng)  
  73. io scheduler noop registered  
  74. io scheduler anticipatory registered  
  75. io scheduler deadline registered  
  76. io scheduler cfq registered (default)  
  77. S3C_LCD clock got enabled :: 133.000 Mhz  
  78. LCD TYPE :: UT_LCD43C_D will be initialized  
  79. Window[0] - FB1: map_video_memory: clear ff000000:0007f800  
  80.             FB1: map_video_memory: dma=57180000 cpu=ff000000 size=0007f800  
  81. Window[0] - FB2: map_video_memory: clear ff03fc00:0003fc00  
  82.             FB2: map_video_memory: dma=571bfc00 cpu=ff03fc00 size=0003fc00  
  83. Console: switching to colour frame buffer device 60x34  
  84. fb0: s3cfb frame buffer device  
  85. Window[1] - FB1: map_video_memory: clear ff080000:0007f800  
  86.             FB1: map_video_memory: dma=57200000 cpu=ff080000 size=0007f800  
  87. Window[1] - FB2: map_video_memory: clear ff0bfc00:0003fc00  
  88.             FB2: map_video_memory: dma=5723fc00 cpu=ff0bfc00 size=0003fc00  
  89. fb1: s3cfb frame buffer device  
  90. Window[2] - FB1: map_video_memory: clear ff100000:0003fc00  
  91.             FB1: map_video_memory: dma=57140000 cpu=ff100000 size=0003fc00  
  92. fb2: s3cfb frame buffer device  
  93. Window[3] - FB1: map_video_memory: clear ff140000:0003fc00  
  94.             FB1: map_video_memory: dma=57280000 cpu=ff140000 size=0003fc00  
  95. fb3: s3cfb frame buffer device  
  96. s3c6400-uart.0: s3c2410_serial0 at MMIO 0x7f005000 (irq = 16) is a S3C6400/10  
  97. s3c6400-uart.1: s3c2410_serial1 at MMIO 0x7f005400 (irq = 20) is a S3C6400/10  
  98. s3c6400-uart.2: s3c2410_serial2 at MMIO 0x7f005800 (irq = 24) is a S3C6400/10  
  99. s3c6400-uart.3: s3c2410_serial3 at MMIO 0x7f005c00 (irq = 28) is a S3C6400/10  
  100. brd: module loaded  
  101. loop: module loaded  
  102. PPP generic driver version 2.4.2  
  103. dm9000 Ethernet Driver  
  104. dm9000: dm9000_probe, init GPIO/EINT.  
  105. dm9000: dm9000_probe2  
  106. dm9000: dm9000_probe3  
  107. eth%d: con201 Invalid ethernet MAC address. using default config,  Please set using ifconfig  
  108. eth0: dm9000 at f7b00300,f7b00304 IRQ 108 MAC: 00:e0:4a:bc:15:e7  
  109. Linux video capture interface: v2.00  
  110. s3c-fimc: controller 0 registered successfully  
  111. s3c-fimc: controller 1 registered successfully  
  112. S3C6400 MFC Driver, (c) 2007 Samsung Electronics  
  113. S3C6400 MFC Driver, (c) 2007 Samsung Electronics  
  114. S3C PostProcessor Driver v3.12, (c) 2009 Samsung Electronics  
  115. S3C6410 TV encoder Driver, (c) 2008 Samsung Electronics  
  116.  S3C6410 TV encoder Driver init OK.   
  117. S3C6410 TV scaler Driver, (c) 2008 Samsung Electronics  
  118.  S3C6410 TV scaler Driver init OK.   
  119. S3C Rotator Driver, (c) 2008 Samsung Electronics  
  120. s3c_rotator_probe called  
  121. s3c_rotator_probe success  
  122. S3C JPEG Driver, (c) 2007 Samsung Electronics  
  123. s3c_g2d_probe called  
  124.  s3c_g2d_probe Success  
  125.  S3C G2D Init : Done  
  126. S3C G3D Driver, (c) 2007-2009 Samsung Electronics  
  127. s3c_g3d version : 0x1050000  
  128.  S3C G3D Init : Done  
  129. S3C CMM Driver, (c) 2008 Samsung Electronics  
  130. Driver 'sd' needs updating - please use bus_type methods  
  131. S3C NAND Driver, (c) 2008 Samsung Electronics  
  132. S3C NAND Driver is using software ECC.  
  133. NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)  
  134. Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":  
  135. 0x00000000-0x00040000 : "Bootloader"  
  136. 0x00040000-0x00400000 : "Kernel"  
  137. 0x00400000-0x10000000 : "File System"  
  138. ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver  
  139. s3c2410-ohci s3c2410-ohci: S3C24XX OHCI  
  140. s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1  
  141. s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000  
  142. usb usb1: configuration #1 chosen from 1 choice  
  143. hub 1-0:1.0: USB hub found  
  144. hub 1-0:1.0: 2 ports detected  
  145. Initializing USB Mass Storage driver...  
  146. usbcore: registered new interface driver usb-storage  
  147. USB Mass Storage support registered.  
  148. s3c-udc : S3C HS USB OTG Device Driver, (c) 2008-2009 Samsung Electronics  
  149. s3c-udc : version 15 March 2009 (DMA Mode)   
  150. mice: PS/2 mouse device common for all mice  
  151. input: s3c-keypad as /class/input/input0  
  152. s3c-keypad Initialized  
  153. S3C Keypad Driver  
  154. S3C Touchscreen driver, (c) 2008 Samsung Electronics  
  155. S3C TouchScreen got loaded successfully : 12 bits  
  156. input: S3C TouchScreen as /class/input/input1  
  157. S3C24XX RTC, (c) 2004,2006 Simtec Electronics  
  158. s3c2410_rtc: tick irq 34, alarm irq 92  
  159. s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling  
  160. s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0  
  161. i2c /dev entries driver  
  162. s3c2440-i2c s3c2440-i2c: slave address 0x10  
  163. s3c2440-i2c s3c2440-i2c: bus frequency set to 377 KHz  
  164. parent clock for camera: 266.000 MHz, divisor: 11  
  165. [CAM]RESET CAM.<6>s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter  
  166. sdhci: Secure Digital Host Controller Interface driver  
  167. sdhci: Copyright(c) Pierre Ossman  
  168. s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133000000 Hz)  
  169. s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133000000 Hz)  
  170. s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus (44333333 Hz)  
  171. [SDHCI]to add external irq as a card detect signal......  
  172. [SDHCI]if (pdata->cfg_ext_cd)......  
  173. mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA  
  174. [SDHCI]request_irq......  
  175. sdhci: card inserted.  
  176. s3c-sdhci s3c-sdhci.1: clock source 0: hsmmc (133000000 Hz)  
  177. s3c-sdhci s3c-sdhci.1: clock source 1: hsmmc (133000000 Hz)  
  178. s3c-sdhci s3c-sdhci.1: clock source 2: mmc_bus (44333333 Hz)  
  179. [SDHCI]to add external irq as a card detect signal......  
  180. mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA  
  181. usbcore: registered new interface driver usbhid  
  182. usbhid: v2.6:USB HID core driver  
  183. Advanced Linux Sound Architecture Driver Version 1.0.18rc3.  
  184. ASoC version 0.13.2  
  185. WM9713/WM9714 SoC Audio Codec 0.15  
  186. playback: 1, capture : 1  
  187. asoc: AC97 HiFi <-> s3c64xx-ac97 mapping ok  
  188. [WM9713]Open speaker volume.  
  189. ALSA device list:  
  190.   #0: SMDK6400 (WM9713)  
  191. TCP cubic registered  
  192. RPC: Registered udp transport module.  
  193. RPC: Registered tcp transport module.  
  194. VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5  
  195. s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time  
  196. mmc0: new high speed SD card at address 0002  
  197. mmcblk0: mmc0:0002 00000 971 MiB   
  198.  mmcblk0: p1  
  199. eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1  
  200. IP-Config: Guessing netmask 255.255.255.0  
  201. IP-Config: Complete:  
  202.      device=eth0, addr=192.168.221.100, mask=255.255.255.0, gw=255.255.255.255,  
  203.      host=192.168.221.100, domain=, nis-domain=(none),  
  204.      bootserver=255.255.255.255, rootserver=192.168.221.90, rootpath=  
  205. Looking up port of RPC 100003/2 on 192.168.221.90  
  206. Looking up port of RPC 100005/1 on 192.168.221.90  
  207. VFS: Mounted root (nfs filesystem).  
  208. Freeing init memory: 140K  
  209. [01/Jan/2001:01:12:36 +0000] boa: server version Boa/0.94.13  
  210. [01/Jan/2001:01:12:36 +0000] boa: server built Mar 26 2009 at 15:28:42.  
  211. [01/Jan/2001:01:12:36 +0000] boa: starting server pid=1061, port 80  
  212. open device leds: No such file or directory  
  213.                           
  214. Try to bring eth0 interface up......NFS root ...Done  
  215.   
  216. Please press Enter to activate this console.   
  217. [root@FriendlyARM /]#   

阅读(2431) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~