板子型號 : 三星 S3C6410 基于ARM11, 指令集基于arm6指令集;
為毛不是 Cortext A9的板子;
燒寫內(nèi)容 : BootLoader, Linux Kernel, File System;
燒寫流程 :
-- sd卡燒寫u-boot并啟動 : 首先將 u-boot 燒寫到 sd 卡中, 使用 sd 卡的bootloader啟動;
-- 擦出nand flash : 之后將開發(fā)板的閃存 nand flassh 擦除干凈;
-- nand flash 燒寫 u-boot : 然后將 u-boot 燒寫到 nand flash 中;
-- 燒寫內(nèi)核 : 向nand flash 中燒寫內(nèi)核;
-- 燒寫文件系統(tǒng) : 將文件系統(tǒng)燒寫到nand flash 中;
1. BootLoader介紹
嵌入式開發(fā)板軟件層次 : 從底層到上層 引導程序 -> Linux內(nèi)核 -> 文件系統(tǒng) -> 應用程序
-- 引導載入程序 : 分為兩部分 硬件中的固化boot代碼 和 BootLoader代碼, 當中固化的boot代碼可有可無, BootLoader是燒寫上去的;
-- Linux內(nèi)核 : 嵌入式開發(fā)板定制的內(nèi)核 和 其啟動參數(shù);
-- 文件系統(tǒng) : 即Linux中的文件系統(tǒng);
-- 應用程序 : 即用戶運行的應用程序, 應用程序 和 內(nèi)核之間可能包括嵌入式的圖形界面;
引導載入程序介紹 : 引導載入程序是系統(tǒng)上電之后運行的第一段程序;
PC機上的引導載入程序 :
-- 組成結(jié)構(gòu) : BIOS (固件程序) 和 BootLoader(GRUB等程序);
-- 運行過程 : BIOS運行硬件檢測 和 資源分配, 之后將BootLoader讀取到內(nèi)存中, 開始運行BootLoader內(nèi)容;
-- 運行作用 : 將內(nèi)核讀取到內(nèi)存中, 跳轉(zhuǎn)到內(nèi)核的入口運行, 正式運行操作系統(tǒng)程序;
嵌入式BootLoader : BootLoader與硬件的依賴性非常強, 每一種嵌入式設(shè)備都有其相應的BootLoader引導程序, 在這里 S3C6410 板子使用的BootLoader 是 U-BOOT;
BootLoader操作模式 : 將BootLoader燒寫到 nand flash 中之后, 第一次啟動是靠交互模式啟動的, 之后就靠子啟動模式啟動;
-- 自啟動模式 : 系統(tǒng)上電之后自己主動將 BootLoader 載入到內(nèi)存, 之后自己主動開啟系統(tǒng), 整個過程全自己主動, 用戶不介入;
-- 交互模式 : BootLoader 通過串口 或者 網(wǎng)絡(luò)從服務(wù)器上下載內(nèi)核到內(nèi)存中, 能夠?qū)?nèi)核寫到磁盤, 或者直接進入系統(tǒng), 同一時候能夠從串口中接收用戶命令;
BootLoader啟動過程 : 分為兩個階段;
-- 第一階段 : 初始化基本硬件, 將BootLoader載入到內(nèi)存中, 設(shè)置堆棧指針, 清空BSS段;
-- 第二階段 : 初始化本階段用的硬件, 讀取環(huán)境變量, 啟動BootLoader(兩種啟動模式);
2. 配置網(wǎng)絡(luò)
燒寫過程須要配置 網(wǎng)絡(luò), tftp, nfs 三項, 配置完之后重新啟動服務(wù)器;
(1) 網(wǎng)絡(luò)設(shè)置
須要設(shè)置網(wǎng)絡(luò)ip地址 和 關(guān)閉防火墻; 假設(shè)是 redhat 系統(tǒng), 還須要關(guān)閉SELinux;
設(shè)置ip地址命令 : ifcofig eth0 192.168.1.27 命令;
關(guān)閉防火墻 : sudo ufw disable 命令;
重新啟動網(wǎng)絡(luò)服務(wù) : sudo /etc/init.d/networking restart 命令;
octopus@octopus:~$ sudo ifconfig eth0 192.168.1.27
octopus@octopus:~$ sudo ufw disable
防火墻在系統(tǒng)啟動時自己主動禁用
octopus@octopus:~$ sudo /etc/init.d/networking restart
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces...
(2) 配置tftp
安裝tftp軟件 :
-- 安裝tftp服務(wù)器 : 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 命令, 向文件里寫入以下內(nèi)容 :
service tftp
{
socket_type = dgram
wait = yes
disable = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
#log_on_success += PID HOST DURATION
#log_on_failure += HOST
per_source = 11
cps =100 2
flags =IPv4
}
,
創(chuàng)建共享文件夾 : 查看 根文件夾下 有沒有 tftpboot 文件夾, 假設(shè)沒有的話就創(chuàng)建 /tftpboot 文件夾;
-- 創(chuàng)建共享文件夾 : sudo mkdir /tftpboot 命令創(chuàng)建;
-- 改動權(quán)限 : sudo chmod -R 777 /tftpboot , 加上 -R 表示 遞歸將其子文件夾子文件也進行權(quán)限改動;
改動 /etc/xinetd.d 配置文件 : 保證配置文件與以下一致就可以;
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/
defaults
{
# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
}
includedir /etc/xinetd.d
改動 /etc/default/tftpd-hpa 配置文件 :
# /etc/default/tftpd-hpa
TFTP_USERNAME='tftp'
TFTP_DIRECTORY='/tftpboot'
TFTP_ADDRESS='0.0.0.0:69'
TFTP_OPTIONS='-l -c -s'
重新啟動tftp服務(wù) : 注意依照次序?qū)⒁韵氯齻€命令依次運行 ;
-- 運行 service tftpd-hpa restart 命令 :
octopus@octopus:~$ service tftpd-hpa restart
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')
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 命令 :
octopus@octopus:~$ sudo /etc/init.d/xinetd reload
[sudo] password for octopus:
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service xinetd reload
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload xinetd
-- 運行 sudo /etc/init.d/xinetd restart 命令 :
octopus@octopus:~$ sudo /etc/init.d/xinetd restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service xinetd restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop xinetd ; start xinetd. The restart(8) utility is also available.
xinetd stop/waiting
xinetd start/running, process 5769
測試 tftp 服務(wù) :
-- 進入tftp : 使用 tftp localhost , 進入本地的tftp服務(wù)器;
-- 下載當中的文件 : 使用 get uboot.bin 下載當中的 uboot 文件到本地文件夾, 假設(shè)文件不存在會提示 Error code 1: File not found 錯誤;
octopus@octopus:~$ tftp localhost
tftp> get aaa
Error code 1: File not found
tftp> get uboot.bin
tftp> quit
octopus@octopus:~$ ls
aaa develop icmp ndk Source Insight x86-probe 模板 圖片 下載 桌面
arm-probe gcc log4c-1.2.1 programs uboot.bin 公共的 視頻 文檔 音樂
(3) 配置 nfs 服務(wù)
安裝nfs服務(wù)器 : sudo apt-get install nfs-kernel-server 命令;
配置 nfs 服務(wù) : 使用 sudo vim /etc/exports 命令配置, 將以下的內(nèi)容加入到文件末尾 ;
/nfsroot *(rw,sync,no_root_squash)
-- 最終配置 :
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
/nfsroot *(rw,sync,no_root_squash)
-- /nfsroot : 這個是 nfs 服務(wù)的共享文件夾;
-- * : 表示隨意IP都能夠訪問;
-- rw : 表示 能夠 讀 寫;
-- sync : 表示 同步;
-- no_root_squash : 表示 root 用戶登錄不做權(quán)限檢查;
創(chuàng)建共享文件夾 : sudo mkdir /nfsroot ;
重新啟動端口映射 : sudo /etc/init.d/portmap restart ;
octopus@octopus:~$ sudo /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop portmap ; start portmap. The restart(8) utility is also available.
portmap stop/waiting
portmap start/running, process 5234
重新啟動 nfs 服務(wù) : sudo /etc/init.d/nfs-kernel-server restart ;
octopus@octopus:~$ sudo /etc/init.d/nfs-kernel-server restart
* Stopping NFS kernel daemon [ OK ]
* Unexporting directories for NFS kernel daemon... [ OK ]
* Exporting directories for NFS kernel daemon... exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export '*:/nfsroot'.
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
[ OK ]
* Starting NFS kernel daemon [ OK ]
驗證nfs服務(wù) : showmount -e, 假設(shè)出現(xiàn)共享文件夾說明 nfs 服務(wù)配置成功;
octopus@octopus:~$ showmount -e
Export list for octopus:
/nfsroot *
3. 向 SD 卡中燒寫 u-boot
燒寫位置 : 燒寫的 u-boot 位于 sd卡的末端, 假設(shè)SD卡存滿了數(shù)據(jù), 就會將最后的數(shù)據(jù)破壞掉, 燒寫的 u-boot 在文件系統(tǒng)中是看不到的;
計算位置 : 依據(jù)SD卡類型計算出 燒寫 u-boot 的初始位置;
-- SD卡 : SD 卡 最后2個文件塊 不能用于燒寫 u-boot, 因此燒寫的位置是 SD卡塊大小 減去 2 再減去 u-boot 的塊大小, 注意是 塊 大小, 一塊是 512字節(jié);
-- SDHC卡 : SDHC 卡 最后 1026 字節(jié)不能用于燒寫 u-boot, 因此燒寫的位置是 SDHC卡 塊大小 減去 1026, 再減去 u-boot 塊大小;
將SD卡裝入讀卡器, 查看設(shè)備名稱 : 使用 sudo fdisk -l /dev/sd* 查看sd卡大小, 推斷sd卡;
-- 查找sd卡 : 使用 ls /dev/sd* 命令查找sd卡;
octopus@octopus:~$ ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb /dev/sdb1
-- 查看SD卡信息 : 使用 sudo fdisk -l /dev/sdb 命令, 能夠看到 SD卡的塊大小是 512字節(jié), 總字節(jié)數(shù)為 1018691584 , 總塊數(shù)為 1989632 塊;
octopus@octopus:~$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 1018 MB, 1018691584 bytes
30 heads, 29 sectors/track, 2286 cylinders, total 1989632 sectors
Units = 扇區(qū) of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
設(shè)備 啟動 起點 終點 塊數(shù) Id 系統(tǒng)
/dev/sdb1
-- 查看 SD 卡塊大小 : 使用 cat /sys/block/sdb/size 命令;
octopus@octopus:~$ cat /sys/block/sdb/size
1989632
計算 u-boot 大小 : 使用 ll u-boot-movi.bin 命令查看, 大小未 270336, 處以 512, 總共是 528塊;
octopus@octopus:~$ ll u-boot-movi.bin
-rw-r--r-- 1 octopus octopus 270336 4月 20 16:59 u-boot-movi.bin
上一篇:ARM中外部中斷
下一篇:S3C6410的PWM驅(qū)動實例
- 熱門資源推薦
- 熱門放大器推薦
設(shè)計資源 培訓 開發(fā)板 精華推薦
- L6985F 38V、500mA 同步降壓開關(guān)穩(wěn)壓器的典型應用,具有 30 uA 靜態(tài)電流
- AM6TW-2405SZ 5V 6 瓦單路輸出 DC-DC 轉(zhuǎn)換器的典型應用
- LTC4054L-4.2 的典型應用 - ThinSOT 中的 150mA 獨立線性鋰離子電池充電器
- 采用MIC4575可調(diào)降壓穩(wěn)壓器的典型應用電路
- 使用 TC7662B 電荷泵調(diào)節(jié)輸出電壓的典型應用電路
- 使用 Asahi Kasei Microdevices Corporation 的 AK4220VQP 的參考設(shè)計
- CMC1003-2M??-55-8-KU、EP4CE55 USB Blaster 套件,允許在緊湊型模塊中實現(xiàn)通用邏輯功能、Altera Nios II 處理器操作
- LTC1046CS8 電池分路器的典型應用電路
- ADP7118RD-EVALZ、LFCSP 評估板,用于評估 ADP7118 20V、200mA 低噪聲、CMOS LDO
- L7809C高輸入電壓電路典型應用(配置1)
- Bourns 發(fā)布全新大功率金屬片電流檢測電阻, 采用 SMD 2010 緊湊型封裝
- 意法半導體推出先進的 1600 V IGBT,面向高性價比節(jié)能家電市場
- EDPF-NT+分散控制系統(tǒng)網(wǎng)絡(luò)防護解決方案
- 基于PLC控制的易驅(qū)變頻器在布袋除塵器上的應用
- 如何利用伺服自動化實現(xiàn)成本降低和產(chǎn)能最大化?
- 壓力傳感器有哪些抗干擾措施?
- 破局!補盲dToF固態(tài)激光雷達輪番“出手”,禾賽FT120也要靠邊
- 利用正壓送風壓力傳感器自動控制火災風口壓力
- 多個傳感器間相互位置關(guān)系校準方法
- 樓宇自控BA系統(tǒng)傳感器有哪些?
- 紫光展銳攜手是德科技完成了26GHz頻段5G毫米波測試
- 紅米Note7系列推出全新配色鏡花水月,開售在即
- Gartner預計企業(yè)明年人工智能項目數(shù)將倍增
- 英唐智控擬用4.6億元收購聯(lián)合創(chuàng)泰剩余的20%股權(quán)
- 5G漫游服務(wù)成為新戰(zhàn)場,SKT與LG U+選擇歐洲為首發(fā)地
- 上海知產(chǎn)法院去年受理案件同比倍增,涉及手機芯片、存儲
- 繼三安光電之后,首爾半導體打入三星MiniLED供應鏈
- TWS產(chǎn)品同比上升255%,瀛通通訊去年業(yè)績增收入不增利潤
- 總投資1172億元!大灣區(qū)綜合性國家科學中心先行啟動區(qū)奠基
- 2025年200億元目標,石家莊集成電路新政出臺了