久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Linux系統(tǒng)移植之—uboot移植,你們要的uboot終于來了,,堪稱精品

 得思 2020-03-19

作為一名過來人,,uboot、kernel對每個學linux的來說都有很深的情誼,,因為它們是一個系統(tǒng)跑起來的最基礎(chǔ),,每個學linux的都會首先接觸到。而它們本身就是一個精美的小系統(tǒng),,里邊代碼所體現(xiàn)的邏輯,、算法以及每個絕妙的C知識點都讓你沉醉其中,。

uboot 屬于bootloader的一種,是用來引導啟動內(nèi)核的,,它的最終目的就是,,從flash中讀出內(nèi)核,放到內(nèi)存中,,啟動內(nèi)核,。具體內(nèi)容如下:

1 u-boot 的介紹及系統(tǒng)結(jié)構(gòu)

1.1 u-boot 介紹

1.2 獲取 u-boot

1.3 u-boot 體系結(jié)構(gòu)

1.3.1 u-boot 目錄結(jié)構(gòu)

2 uboot 的啟動過程及工作原理

2.1 啟動模式介紹

2.2 階段 1 介紹

2.2.1 定義入口

2.2.2 設(shè)置異常向量

2.2.3 設(shè)置 CPU 的模式為 SVC 模式

2.2.4 關(guān)閉看門狗

2.2.5 禁掉所有中斷

2.2.6 設(shè)置以 CPU 的頻率

2.2.7 設(shè)置 CP15

2.2.8 配置內(nèi)存區(qū)控制寄存器

2.2.9 安裝 U-BOOT 使的棧空間

2.2.10 BSS 段清 0

2.2.11 搬移 Nand Flash 代碼

2.2.12 進入 C 代碼部分

2.3 階段 2 的 C 語言代碼部分

2.3.1 調(diào)用一系列的初始化函數(shù)

2.3.2 初始化網(wǎng)絡(luò)設(shè)備

2.3.3 進入主 UBOOT 命令行

2.4 代碼搬運

3 uboot 的移 植過程

3.1 環(huán)境

3.2 步驟

3.2.1 修改 Makefile

3.2.2 在 board 子目錄中建立 crane2410

3.2.3 在 include/configs/中建立配置頭文件

3.2.4 指定交叉編譯工具的路徑

3.2.5 測試編譯能否成功

3.2.6 修改 lowlevel_init.S 文件

2.9 UBOOT 的 Nand Flash 移植

3.2.8 重新編譯 u-boot

3.2.9 把 u-boot 燒入 flash

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,堪稱精品

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,堪稱精品

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,堪稱精品

Linux系統(tǒng)移植之—uboot移植,,你們要的uboot終于來了,,堪稱精品

Linux系統(tǒng)移植之—uboot移植,你們要的uboot終于來了,,堪稱精品

4.2 常用命令使用說明

4.2.1 askenv(F)

在標準輸入(stdin)獲得環(huán)境變量,。

4.2.2 autoscr

從內(nèi)存(Memory)運行腳本。(注意,,從下載地址開始,,例如我們的開發(fā)板是從 0x30008000 處開始運

行).

CRANE2410 # autoscr 0x30008000

## Executing script at 30008000

4.2.3 base

打印或者設(shè)置當前指令與下載地址的地址偏移。

4.2.4 bdinfo

打印開發(fā)板信息

CRANE2410 # bdinfo

-arch_number = 0x000000C1 (CPU 體系結(jié)構(gòu)號)

-env_t = 0x00000000 (環(huán)境變量)

-boot_params = 0x30000100 (啟動引導參數(shù))

-DRAM bank = 0x00000000 (內(nèi)存區(qū))

--> start = 0x30000000 (SDRAM 起始地址)

--> size = 0x04000000 (SDRAM 大?。?/p>

-ethaddr = 01:23:45:67:89:AB (以太網(wǎng)地址)

-ip_addr = 192.168.1.5 (IP 地址)

-baudrate = 115200 bps (波特率)

4.2.5 bootp

通過網(wǎng)絡(luò)使用 Bootp 或者 TFTP 協(xié)議引導境像文件,。

CRANE2410 # help bootp

bootp [loadAddress] [bootfilename]

4.2.6 bootelf

默認從 0x30008000 引導 elf 格式的文件(vmlinux)

CRANE2410 # help bootelf

bootelf [address] - load address of ELF image.

4.2.7 bootd(=boot)

引導的默認命令,即運行 U-BOOT 中在“include/configs/smdk2410.h” 中設(shè)置的“bootcmd” 中

的命令,。如下:

#define CONFIG_BOOTCOMMAND 'tftp 0x30008000 uImage; bootm 0x30008000';

在命令下做如下試驗:

CRANE2410 # set bootcmd printenv

CRANE2410 # boot

bootdelay=3

baudrate=115200

ethaddr=01:23:45:67:89:abCRANE2410 # bootd

bootdelay=3

baudrate=115200

ethaddr=01:23:45:67:89:ab

4.2.8 tftp(tftpboot)

即將內(nèi)核鏡像文件從 PC 中下載到 SDRAM 的指定地址,,然后通過 bootm 來引導內(nèi)核,,前提是所用 PC 要安裝設(shè)

置 tftp 服務。

下載信息:

CRANE2410 # tftp 0x30008000 zImage

TFTP from server 10.0.0.1; our IP address is 10.0.0.110

Filename 'zImage'.

Load address: 0x30008000

Loading: #################################################################

#################################################################

#################################################

done

Bytes transferred = 913880 (df1d8 hex)

4.2.9 bootm

內(nèi)核的入口地址開始引導內(nèi)核,。

CRANE2410 # bootm 0x30008000

## Booting image at 30008000 ...

Starting kernel ...

Uncompressing

Linux......................................................................

done, .

4.2.10 go

直接跳轉(zhuǎn)到可執(zhí)行文件的入口地址,,執(zhí)行可執(zhí)行文件。

CRANE2410 # go 0x30008000

## Starting application at 0x30008000 ...

4.2.11 cmp

對輸入的兩段內(nèi)存地址進行比較,。

CRANE2410 # cmp 0x30008000 0x30008040 64

word at 0x30008000 (0xe321f0d3) != word at 0x30008040 (0xc022020c)

Total of 0 words were the same

CRANE2410 # cmp 0x30008000 0x30008000 64

Total of 100 words were the same

4.2.12 coninfo

打印所有控制設(shè)備和信息,,例如

-List of available devices:

-serial 80000003 SIO stdin stdout stderr

4.2.13 cp

內(nèi)存拷貝,cp 源地址 目的地址 拷貝大?。ㄗ止?jié))

CRANE2410 # help cp

cp [.b, .w, .l] source target count

ANE2410 # cp 0x30008000 0x3000f000 644.2.14 date

獲得/設(shè)置/重設(shè)日期和時間

CRANE2410 # date

Date: 2006-6-6 (Tuesday) Time: 06:06:06

4.2.15 erase(F)

擦除 FLASH MEMORY, 由于該 ARM 板沒有 Nor Flash, 所有不支持該命令.

CRANE2410 # help erase

erase start end

- erase FLASH from addr 'start' to addr 'end'

erase start +len

- erase FLASH from addr 'start' to the end of sect w/addr 'start'+'len'-1

erase N:SF[-SL]

- erase sectors SF-SL in FLASH bank # N

erase bank N

- erase FLASH bank # N

erase all

- erase all FLASH banks

4.2.16 flinfo(F)

打印 Nor Flash 信息, 由于該 ARM 板沒有 Nor Flash, 所有不支持該命令.

4.2.17 iminfo

打印和校驗內(nèi)核鏡像頭, 內(nèi)核的起始地址由 CFG_LOAD_ADDR 指定:

#define CFG_LOAD_ADDR 0x30008000 /* default load address */

該宏在 include/configs/crane2410.h 中定義.

CRANE2410 # iminfo

## Checking Image at 30008000 ...

Image Name: Linux-2.6.14.1

Created: 2006-06-28 7:43:01 UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1047080 Bytes = 1022.5 kB

Load Address: 30008000

Entry Point: 30008040

Verifying Checksum ... OK

4.2.18 loadb

從串口下載二進制文件

CRANE2410 # loadb

## Ready for binary (kermit) download to 0x30008000 at 115200 bps...

## Total Size = 0x00000000 = 0 Bytes

## Start Addr = 0x30008000

4.2.19 md

顯示指定內(nèi)存地址中的內(nèi)容

CRANE2410 # md 0

00000000: ea000012 e59ff014 e59ff014 e59ff014 ................

00000010: e59ff014 e59ff014 e59ff014 e59ff014 ................

00000020: 33f80220 33f80280 33f802e0 33f80340 [email protected]

00000030: 33f803a0 33f80400 33f80460 deadbeef ...3...3`..3....

00000040: 33f80000 33f80000 33f9c0b4 33fa019c ...3...3...3...3

00000050: e10f0000 e3c0001f e38000d3 e129f000 ..............).00000060: e3a00453 e3a01000 e5801000 e3e01000 S...............

00000070: e59f0444 e5801000 e59f1440 e59f0440 D.......@...@...

00000080: e5801000 e59f043c e3a01003 e5801000 ....<...........

00000090: eb000051 e24f009c e51f1060 e1500001 Q.....O.`.....P.

000000a0: 0a000007 e51f2068 e51f3068 e0432002 ....h ..h0... C.

000000b0: e0802002 e8b007f8 e8a107f8 e1500002 . ............P.

000000c0: dafffffb e51f008c e2400803 e2400080 ..........@...@.

000000d0: e240d00c e51f0094 e51f1094 e3a02000 ..@.......... ..

000000e0: e5802000 e2800004 e1500001 dafffffb . ........P.....

000000f0: eb000006 e59f13d0 e281f000 e1a00000 ................

4.2.20 mm

順序顯示指定地址往后的內(nèi)存中的內(nèi)容,可同時修改,地址自動遞增。

CRANE2410 # mm 0x30008000

30008000: e1a00000 ? fffff

30008004: e1a00000 ? eeeeee

30008008: e1a00000 ? q

CRANE2410 # md 30008000

30008000: 000fffff 00eeeeee e1a00000 e1a00000 ................

30008010: e1a00000 e1a00000 e1a00000 e1a00000 ................

30008020: ea000002 016f2818 00000000 000df1d8 .....(o.........

30008030: e1a07001 e3a08000 e10f2000 e3120003 .p....... ......

4.2.21 mtest

簡單的 RAM 檢測

CRANE2410 # mtest

Pattern FFFFFFFD Writing... Reading...

4.2.22 mw

向內(nèi)存地址寫內(nèi)容

CRANE2410 # md 30008000

30008000: ffffdffd ffffdffc ffffdffb ffffdffa ................

CRANE2410 # mw 30008000 0 4

CRANE2410 # md 30008000

30008000: 00000000 00000000 00000000 00000000 ................

4.2.23 nm

修改內(nèi)存地址, 地址不遞增

CRANE2410 # nm 30008000

30008000: de4c457f ? 00000000

30008000: 00000000 ? 11111111

30008000: 11111111 ?

4.2.24 printenv

打印環(huán)境變量

CRANE2410 # printenv

bootdelay=3

baudrate=115200

ethaddr=01:23:45:67:89:ab

ipaddr=10.0.0.110

serverip=10.0.0.1

netmask=255.255.255.0

stdin=serial

stdout=serialstderr=serial

Environment size: 153/65532 bytes

4.2.25 ping

ping 主機

CRANE2410 # ping 10.0.0.1

host 10.0.0.1 is alive

4.2.26 reset

復位 CPU

4.2.27 run

運行已經(jīng)定義好的 U-BOOT 的命令

CRANE2410 # set myenv ping 10.0.0.1

CRANE2410 # run myenv

host 10.0.0.1 is alive

4.2.28 saveenv(F)

保存設(shè)定的環(huán)境變量

4.2.29 setenv

設(shè)置環(huán)境變量

CRANE2410 # setenv ipaddr 10.0.0.254

CRANE2410 # printenv

ipaddr=10.0.0.254

4.2.30 sleep

命令延時執(zhí)行時間

CRANE2410 # sleep 1

4.2.31 version

打印 U-BOOT 版本信息

CRANE2410 # version

U-Boot 1.1.4 (Jul 4 2006 - 12:42:27)

4.2.32 nand info

打印 nand flash 信息

CRANE2410 # nand info

Device 0: Samsung K9F1208U0B at 0x4e000000 (64 MB, 16 kB sector)

4.2.33 nand device <n>

顯示某個 nand 設(shè)備

CRANE2410 # nand device 0

Device 0: Samsung K9F1208U0B at 0x4e000000 (64 MB, 16 kB sector)

... is now current device

4.2.34 nand bad

CRANE2410 # nand bad

Device 0 bad blocks:4.2.35 nand read

nand read InAddr FlAddr size

InAddr: 從 nand flash 中讀到內(nèi)存的起始地址,。

FlAddr: nand flash 的起始地址,。

size: 從 nand flash 中讀取的數(shù)據(jù)的大小。

CRANE2410 # nand read 0x30008000 0 0x100000

NAND read: device 0 offset 0, size 1048576 ...

1048576 bytes read: OK

4.2.36 nand erease

nand erase FlAddr size

FlAddr: nand flash 的起始地址

size: 從 nand flash 中擦除數(shù)據(jù)塊的大小

CRANE2410 # nand erase 0x100000 0x20000

NAND erase: device 0 offset 1048576, size 131072 ... OK

4.2.37 nand write

nand write InAddr FlAddr size

InAddr: 寫到 Nand Flash 中的數(shù)據(jù)在內(nèi)存的起始地址

FlAddr: Nand Flash 的起始地址

size: 數(shù)據(jù)的大小

CRANE2410 # nand write 0x30f00000 0x100000 0x20000

NAND write: device 0 offset 1048576, size 131072 ...

131072 bytes written: OK

4.2.37 nboot

u-boot-1.1.4 代碼對于 nboot 命令的幫助不正確,,修改如下:

正確的順序為:

nboot InAddr dev FlAddr

InAddr: 需要裝載到的內(nèi)存的地址,。

FlAddr: 在 nand flash 上 uImage 存放的地址

dev: 設(shè)備號

需要提前設(shè)置環(huán)境變量,否則 nboot 不會調(diào)用 bootm

CRANE2410 #setenv autostart yes

CRANE2410 # nboot 30008000 0 100000

Loading from device 0: <NULL> at 0x4e000000 (offset 0x100000)

Image Name: Linux-2.6.14.3

Created: 2006-07-06 7:31:52 UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 897428 Bytes = 876.4 kB

Load Address: 30008000

Entry Point: 30008040

Automatic boot of image at addr 0x30008000 ...

## Booting image at 30008000 ...

Starting kernel ...

4.3 命令簡寫說明

所以命令都可以簡寫,,只要命令前面的一部分不會跟其它命令相同,就可以不用寫全整個命令.save 命令

CRANE2410 # sa

Saving Environment to Flash...

Un-Protected 1 sectors

Erasing Flash...Erasing sector 10 ... Erased 1 sectors

4.4 把文件寫入 NandFlash

如果把一個傳到內(nèi)存中的文件寫入到 Nand Flash 中, 如:新的 uboot.bin, zImage(內(nèi)核),

rootfs 等, 如果做呢,?我們可以用 Nand Flash 命令來完成. 但是 Nand Flash 寫時,必須先要把 Nand

Flash 的寫入?yún)^(qū)全部擦除后,才能寫. 下面以把內(nèi)存 0x30008000 起長度為 0x20000 的內(nèi)容寫到 Nand

Flash 中的 0x100000 為例.

CRANE2410 # nand erase 0x100000 20000

NAND erase: device 0 offset 1048576, size 131072 ... OK

CRANE2410 # nand write 0x30008000 0x100000 0x20000

NAND write: device 0 offset 1048576, size 131072 ...

131072 bytes written: OK

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,,謹防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多