我想向u-boot添加自定义命令,这是一个简单的hello命令。
在搜索之后,我找到了这个链接Yocto u-boot Custom Commands,它说要将cmd/misc.c中的timer命令作为起点。
如何将这个timer命令带到我的u引导映像中?我假设我已经对makefile进行了更改,但不确定我应该编辑哪个makefile。
我正在使用qemu测试Ubuntu18.04中的u-boot映像,方法如下
github.
qemu-system-arm -M virt -nographic -kernel u-boot的make qemu_arm_config ARCH=arm CROSS_COMPILE=arm-none-eabi-
make all ARCH=arm CROSS_COMPILE=arm-none-eabi-
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型靴:
https://github.com/u-boot/u-boot.git
主机操作系统:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic发布于 2020-03-30 09:42:16
doc/README.命令描述了应该如何实现命令。
您的新C文件应该位于cmd/目录中。在cmd/Makefile中,您必须添加目标文件。
obj-$(CONFIG_CMD_TIMER) += timer.o在cmd/Kconfig中,为命令添加一个新的配置选项。Kconfig语法用https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt描述。
跑
make menuconfig要启用配置选项,请执行以下操作。
发布于 2020-12-23 04:26:45
stock附带了许多股票命令,可以在u引导控制台上运行,类似于Linux控制台命令'ls‘。每个命令的源都可以在“公共/”目录下找到,文件名以'cmd_‘开头。但是,默认情况下并非所有命令都启用。
在代码中,您可以打开“config /Makefile”,在“#命令”部分,您可以找到所有带有配置标志“CONFIG_*”的命令的列表。要启用一个命令,您必须简单地在‘include/ To /.h’文件下定义相应的标志,然后构建源代码。现在,您可以通过运行“帮助”在命令列表中看到该命令。
要启用命令“source”,可以在“enable /Makefile”中找到
obj-$(CONFIG_CMD_SOURCE) += cmd_source.o只需将相应的标志包含在‘include / the /.h’文件中,如下所示
obj-y += cmd_source.o参考:http://studyzone.dgpride.com/2016/11/u-boot-how-to-add-new-command-to-u-boot.html
https://stackoverflow.com/questions/60913034
复制相似问题