u-boot增加新命令
00. u-boot默认配置为:
UBOOT_DEFCONFIG=rk3399_defconfig
01. 新增文件夹:
mkdir -p /u-boot/test/hello
02. 编译该文件夹
obj-$(CONFIG_TEST_HELLO) += hello/
03. 定义CONFIG_TEST_HELLO变量
CONFIG_TEST_HELLO=y
05. 新增cmd文件
touch /u-boot/test/hello/helloworld.c
06. 新增Makefile
touch /u-boot/test/hello/Makefile
编译为:
obj-y += helloworld.o
UBOOT_DEFCONFIG=rk3399_defconfig
01. 新增文件夹:
mkdir -p /u-boot/test/hello
02. 编译该文件夹
obj-$(CONFIG_TEST_HELLO) += hello/
03. 定义CONFIG_TEST_HELLO变量
config TEST_HELLO bool "test my modules" depends on ARCH_ROCKCHIP help This enables the test function for me.
04. 在/u-boot/configs/rk3399_defconfig 新增配置
CONFIG_TEST_HELLO=y
05. 新增cmd文件
touch /u-boot/test/hello/helloworld.c
/*
* Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <command.h>
#include <version.h>
#include <linux/compiler.h>
#ifdef CONFIG_SYS_COREBOOT
#include <asm/arch/sysinfo.h>
#endif
const char __weak version_string[] = U_BOOT_VERSION_STRING;
static int do_helloworld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
printf("hello printf.\n");
puts("hello puts.\n");
return 0;
}
U_BOOT_CMD(
helloworld, 1, 1, do_helloworld,
"print hello ifno, to verify the hello function",
""
);
06. 新增Makefile
touch /u-boot/test/hello/Makefile
编译为:
obj-y += helloworld.o
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架