我想添加自定义命令命令u-boot
可以是一个简单的 hello world 命令。
搜索后我发现了这个链接Yocto u-boot 自定义命令它说看的地方timer
命令输入cmd/misc.c
作为起点。
我怎么带这个timer
命令到我的 u-boot 映像?
我假设我已经对 makefile 进行了更改,但不确定应该编辑哪个 makefile。
我正在使用 qemu 来测试u-boot
Ubuntu 18.04 中的镜像使用以下方法
- 克隆了
u-boot
源码来自github。
- 安装了系统中的所有构建依赖项。
- 使用准备u-boot配置文件
make qemu_arm_config ARCH=arm CROSS_COMPILE=arm-none-eabi-
- 构建u-boot
make all ARCH=arm CROSS_COMPILE=arm-none-eabi-
- 使用 u-boot 映像启动 qemu
qemu-system-arm -M virt -nographic -kernel u-boot
U启动日志
$ qemu-system-arm -M virt -nographic -kernel u-boot
U-Boot 2020.01-dirty (Mar 29 2020 - 15:46:14 +0530)
DRAM: 128 MiB
WARNING: Caches not enabled
Flash: 128 MiB
*** Warning - bad CRC, using default environment
In: pl011@9000000
Out: pl011@9000000
Err: pl011@9000000
Net: No ethernet found.
Hit any key to stop autoboot: 0
=> timer
Unknown command 'timer' - try 'help'
=>
更多细节
U-boot:
- repo : https://github.com/u-boot/u-boot.git
- 分支/标签:v2020.01
Host OS:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
doc/README.commands 描述了如何实现命令。
您的新 C 文件应位于目录 cmd/ 中。在 cmd/Makefile 中,您必须添加目标文件,例如
obj-$(CONFIG_CMD_TIMER) += timer.o
在 cmd/Kconfig 中为您的命令添加一个新的配置选项。 Kconfig 语法描述于https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt.
Run
make menuconfig
启用您的配置选项。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)