uboot中ramdisk啟動linux的兩種方法

2021-06-20 19:48:20 字數 1773 閱讀 9275

首先要確保核心支援ramdisk啟動:

the configuration of the kernel is as follow:

1) general setup-->[*] initial ram filesystem and ram disk (initramfs/initrd) support 

[*]   support initial ramdisks compressed using gzip

[*]   support initial ramdisks compressed using bzip2

2)device driver-->block devices--><*>   loopback device support

<*>   ram block device support

(16384) default ram disk size (kbytes)

3)ext2 filesystem support, enalbed by default

相關配置如上。

第1種:

setenv ramdiskimage 'ramdisk.gz.uboot'

setenv ramdiskaddr '0x2000000'

setenv ramload 'tftp $ $;tftp $ $; tftp $ $'

setenv ramboot 'setenv bootargs console=ttys0,115200 root=/dev/ram rw rootfstype=ext2;bootz $ $ $'

setenv bootcmd 'run ramload;run ramboot'

需要把ramdisk.gz用mkimage增加頭部:

sudo mkimage -n 'uboot ext2 ramdisk rootfs' -a arm -o linux -t ramdisk -c gzip -d ramdisk.gz ramdisk.gz.uboot

mkimage -a arch -o os -t type -c comp -a addr -e ep \

-n name -d data_file image

-a ==> set architecture to 'arch' 體系結構

-o ==> set operating system to 'os' 作業系統

-t ==> set image type to 'type' 映像型別

-c ==> set compression type 'comp' 壓縮方式

-a ==> set load address to 'addr' (hex) 載入位址

-e ==> set entry point to 'ep' (hex) 入口位址

-n ==> set image name to 'name' 映像檔名

-d ==> use image data from 'datafile' 製作映像的原始檔

第2種:比較傳統的啟動方法

setenv ramdiskimage 'ramdisk_115200.gz'

setenv ramdiskaddr '0x2000000'

setenv ramload 'fatload mmc 0:1 $ $;fatload mmc 0:1 $ $; fatload mmc 0:1 $ $'

setenv ramboot 'setenv bootargs console=ttys0,115200 root=/dev/ram rw  rootfstype=ext2 initrd=0x2000000,16m;bootz $ - $'

uboot中usb storage啟動方法

這種方法比較簡單,就是利用uboot自帶命令usbboot來實現啟動,也算是最粗糙的一種。1.在配置檔案中新增一系列有關usb的支援。uboot編譯啟動後輸入 usb start usbboot 0x30800000 0 1 這裡的0是usb裝置0,1是第一分區 當然,這裡肯定會失敗,因為usb s...

uboot啟動流程概述 uboot啟動流程

u boot系統啟動流程 大多數bootloader都分為stage1和stage2兩大部分,u boot也不例外。依賴於cpu體系結構的 如裝置初始化 等 通常都放在stage1,且可以用組合語言來實現,而stage2則通常用c語言來實現,這樣可以實現複雜的功能,而且有更好的可讀性和移植性。2.1...

uboot移植 uboot啟動回顧

一 uboot啟動的第一階段start.s 路徑uboot cpu s5pc11x start.s 1 include 標頭檔案包含,config.件原始碼中不存 在,配置後自動生成 路徑 include linux config.h 2 include 標頭檔案包含,version.件原始碼中不存...