前面的文章中我们使用qemu启动uboot,现在我们测试在uboot下引导内核的过程。
测试环境
主机系统:ubuntu 18.04 LTS
交叉编译工具链:arm-linux-gnueabi-
uboot版本:u-boot-2017.05-rc2
Kernel版本:4.4.76
制作sd卡
前面 kernel提示找不到,因此就停留在uboot命令行模式。qemu支持模拟sd卡,因此,我们可以制作一个sd卡,然后将kernel、dtb文件放到sd卡,在uboot中将sd卡中的文件load到DDR,并从DDR去启动,以下命令可以用于制作vfat文件系统的sd卡,大小为512M。
使用dd命令创建文件
root@ubuntu:/home/ubuntu/Desktop# dd if=/dev/zero of=./sd_card bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 1.056 s, 508 MB/s
root@ubuntu:/home/ubuntu/Desktop# ls -l sd_card
-rw-r--r-- 1 root root 536870912 Oct 27 23:44 sd_card
root@ubuntu:/home/ubuntu/Desktop#
创建化分区
root@ubuntu:/home/ubuntu/Desktop# fdisk ./sd_card
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x40cdef88.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-1048575, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1048575, default 1048575):
Created a new partition 1 of type 'Linux' and of size 511 MiB.
Command (m for help): p
Disk ./sd_card: 512 MiB, 536870912 bytes, 1048576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical