目录uboot简介实现步骤:头文件:函数:添加命令update:uboot简介 uboot 属于bootloader的一种,是用来引导启动内核的,它的最终目的就是:从flash中读出
uboot 属于bootloader的一种,是用来引导启动内核的,它的最终目的就是:从flash中读出内核,放到内存中,启动内核。
它刚开始被放到flash上,然后上电以后先执行它,它会完成硬件初始化,设置处理器模式,关闭看门狗,屏蔽中断,初始化sdram,设置栈,设置时钟,从flash引导内核到内存,就好像我们PC上的BiOS一样。最终将系统的软硬件带到一个合适的状态。
#include <common.h>
#include <command.h>
static int do_update(cmd_tbl_t *cmdtp, int flag, int arGC, char * const argv[])
{
return 0;
}
// U_BOOT_CMD(_name, _maxargs, _rep, _cmd, _usage, _help)
U_BOOT_CMD(update, 4, 0, do_update,
"update command",
" - check boot progress and timing\n"
"update all\n"
"update uboot \n"
"update image \n"
"update rootfs \n"
);
#include <common.h>
#include <command.h>
static int do_update(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
if (argc != 2)
{
printf("update params num err\n");
return 1;
}
if (0 == strncmp("uboot", argv[0], sizeof("uboot")))
{
printf("update uboot success\n");
}
else if (0 == strncmp("image", argv[0], sizeof("image")))
{
printf("update image success\n");
}
else if (0 == strncmp("rootfs", argv[0], sizeof("rootfs")))
{
printf("update rootfs success\n");
}
return 0;
}
U_BOOT_CMD(update, 4, 0, do_update,
"update command",
" - check boot progress and timing\n"
"update all\n"
"update uboot \n"
"update image \n"
"update rootfs \n"
);
到此这篇关于uboot添加自定义命令的实现步骤的文章就介绍到这了,更多相关uboot添加自定义命令内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!
--结束END--
本文标题: uboot添加自定义命令的实现步骤
本文链接: https://www.lsjlt.com/news/173339.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0