IMX6ULL移植篇-boot 命令的学习

一.  boot 命令简介

uboot 的作用是启动 Linux系统。所以 uboot 肯定有相关的 boot(引导)命令来启动 Linux。

常用的与 boot 有关的命令有:bootz、bootm boot。

本文主要学习  boot 命令的使用。

本文接上一篇文章,如下:

IMX6ULL移植篇-bootz命令的学习_凌肖战的博客-CSDN博客

二.   boot 命令

boot 命令也是用来启动 Linux 系统的,只是 boot 会读取环境变量 bootcmd 来启动 Linux
统。
bootcmd 是一个很重要的环境变量!其名字分为“ boot ”和“ cmd ”,也就是“引导”和“命令”,说明这个环境变量保存着引导命令,其实就是启动的命令集合,具体的引导命令内容是可 以修改的。

例如,我们想使用 tftp 命令从网络启动 Linux。

1.  首先,可以设置 环境变量 bootcmd。如下方法进行设置:

进入开发板的 uboot命令模式下,输入如下命令:

=> setenv bootcmd 'tftp 0x80800000 zImage;tftp 0x83000000 imx6ull-alientek-nand.dtb;bootz 0x80800000 - 0x83000000'
=>  

2.  其次,保存环境变量,操作如下:

=> saveenv
Saving Environment to NAND...
Erasing NAND...
Erasing at 0x400000 -- 100% complete.
Writing to NAND... OK

3.  最后,运行 boot命令,操作如下:

=> boot
FEC1 Waiting for PHY auto negotiation to complete.... done
Using FEC1 device
TFTP from server 192.168.1.66; our IP address is 192.168.1.50
Filename 'zImage'.
Load address: 0x80800000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #
	 853.5 KiB/s
done
Bytes transferred = 6680336 (65ef10 hex)
Using FEC1 device
TFTP from server 192.168.1.66; our IP address is 192.168.1.50
Filename 'imx6ull-alientek-nand.dtb'.
Load address: 0x83000000
Loading: ###
	 2.9 MiB/s
done
Bytes transferred = 39666 (9af2 hex)
Kernel image @ 0x80800000 [ 0x000000 - 0x65ef10 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300caf1

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.1.15 (wangtian@wangtian-virtual-machine) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #1 SMP PREEMPT Sat Sep 2 22:29:18 CST 2023

可以看出,Linux内核成功加载并启动。以上就是 boot命令的使用。

你可能感兴趣的:(嵌入式C开发,linux,arm开发)