u-boot 2016.05 添加u-boot cmd
记录一下如何在u-boot 添加一个自己想要的命令。
首先来看一下宏,include/command.h
218 #define U_BOOT_CMD(_name, _maxargs, _rep, _cmd, _usage, _help) \
219 U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
U_BOOT_CMD 宏第一个参数是你的命令的名字。
第二个参数你最大参数个数
第三个参数是是否能复用。
第四个参数是实现的函数名
第五个简单说明。
后面是help
- 举例:
nandecc.c
#include <common.h>
#include <linux/mtd/mtd.h>
#include <command.h>
#include <console.h>
#include <watchdog.h>
#include <malloc.h>
#include <asm/byteorder.h>
#include <jffs2/jffs2.h>
#include <nand.h>
#include <asm/io.h>
#include <asm/errno.h>
#if defined(CONFIG_SOC_KEYSTONE)
#include <asm/ti-common/ti-gpmc.h>
#else
#include <asm/arch/mem.h>
#endif
#include <linux/mtd/omap_gpmc.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/bch.h>
#include <linux/compiler.h>
#include <nand.h>
#include <linux/mtd/omap_elm.h>
#include <dm.h>
#ifdef CONFIG_CMD_NANDECC
extern void omap_nand_switch_ecc(nand_ecc_modes_t hardware, int32_t mode);
static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
int type = 1;
if (argc < 2)
goto usage;
if (strncmp(argv[1], "hw", 2) == 0) {
if (argc == 3)
type = simple_strtoul(argv[2], NULL, 10);
omap_nand_switch_ecc(NAND_ECC_HW, type);
}
else if (strncmp(argv[1], "sw", 2) == 0)
omap_nand_switch_ecc(NAND_ECC_NONE, 1);
else
goto usage;
return 0;
usage:
printf("Usage: nandecc %s\n", cmdtp->usage);
return 1;
}
U_BOOT_CMD(
nandecc, 3, 1, do_switch_ecc,
"Switch NAND ECC calculation algorithm b/w hardware and software",
"[sw|hw <hw_type>] \n"
" [sw|hw]- Switch b/w hardware(hw) & software(sw) ecc algorithm\n"
" hw_type- 0 for Hamming code\n"
" 4 for bch4\n"
" 8 for bch8\n"
" 16 for bch16\n"
);
#endif
- 将该文件添加进所属文件的Makefile,上述例子所在目录是cmd 目录。
我将在该目录里面加入如下选项:
cat cmd/Makefile
//...
98 obj-$(CONFIG_CMD_NANDECC) += nandecc.o
//...
- 然后在你的config.h 里面添加相关宏定义开关:
cat include/configs/am335x_sbc7109.h
//...
343 #define CONFIG_CMD_NANDECC
//...
- 然后启动u-boot ,看是否有nandecc 这条命令。有即成功加入。
u-boot 2016.05 添加u-boot cmd的更多相关文章
- u-boot 2016.05 添加自己的board 以及config.h
拿到一个uboot 后,我都想添加一个属于自己的board文件以及include/configs/*.h 文件. 如何添加这个些文件,今天来记录一下. 复制一份你所参考的板级文件,比如说board/v ...
- 黑马_13 Spring Boot:05.spring boot 整合其他技术
13 Spring Boot: 01.spring boot 介绍&&02.spring boot 入门 04.spring boot 配置文件 05.spring boot 整合其他 ...
- step6----->往工程中添加spring boot项目------->修改pom.xml使得我的project是基于spring boot的,而非直接基于spring framework
文章内容概述: spring项目组其实有多个projects,如spring IO platform用于管理external dependencies的版本,通过定义BOM(bill of mater ...
- eclipse添加spring boot 插件
在使用eclipse开发时,一般需要添加spring boot的管理插件,这样更方便我们开发,在写application.yml或properties配置的时候,也有相关的提示,而且还可以从配置文件中 ...
- (转)Spring Boot 2 (八):Spring Boot 集成 Memcached
http://www.ityouknow.com/springboot/2018/09/01/spring-boot-memcached.html Memcached 介绍 Memcached 是一个 ...
- (转)Spring Boot 2 (二):Spring Boot 2 尝鲜-动态 Banner
http://www.ityouknow.com/springboot/2018/03/03/spring-boot-banner.html Spring Boot 2.0 提供了很多新特性,其中就有 ...
- Spring Boot 2 (八):Spring Boot 集成 Memcached
Spring Boot 2 (八):Spring Boot 集成 Memcached 一.Memcached 介绍 Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数 ...
- Spring Boot 2 (七):Spring Boot 如何解决项目启动时初始化资源
Spring Boot 2 (七):Spring Boot 如何解决项目启动时初始化资源 在项目启动的时候需要做一些初始化的操作,比如初始化线程池,提前加载好加密证书等.今天就给大家介绍一个 Spri ...
- Spring Boot 2 (二):Spring Boot 2 动态 Banner
Spring Boot 2 (二):Spring Boot 2 动态 Banner Spring Boot 2.0 提供了很多新特性,其中就有一个小彩蛋:动态 Banner. 一.配置依赖 使用 Sp ...
随机推荐
- 原创:【微信小程序】发送消息模板教程(后台以PHP示例)
1.本教程对外开放,未经博主同意,禁止转载. 2.准备材料:1)公众号|小程序,添加选择的模板消息,2)在设置>开发设置页面,开通消息模板功能:如: 3.因为调用微信发送模板的接口是:https ...
- Linux终端监控工具之dstat
1.安装 yum install dstat 2.示例 1)直接跟数字,表示#秒收集一次数据,默认为一秒:dstat 5表示5秒更新一次 这是默认输出显示的信息: CPU状态:CPU的使用率.这项报告 ...
- linux下修改文件权限
加入-R 参数,就可以将读写权限传递给子文件夹例如chmod -R 777 /home/mypackage那么mypackage 文件夹和它下面的所有子文件夹的属性都变成了777777是读.写.执行权 ...
- HDUOJ------2398Savings Account
Savings Account Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- Redis的Docker镜像
原文地址:https://hub.docker.com/_/redis/ Pull Command docker pull redis Short Description Redis is an op ...
- JMeter学习笔记--详解JMeter定时器
定时器的处理优先于同一作用域内的采样器,如果在同一作用域内有多个定时器,那么所有的定时器都会在每个采样器之前处理. 若定时器所在作用域内无采样器,那么定时器不会被处理 固定定时器,每个线程在请求之间间 ...
- 管道读写规则和Pipe Capacity、PIPE_BUF
一.当没有数据可读时 O_NONBLOCK disable:read调用阻塞,即进程暂停执行,一直等到有数据来到为止. O_NONBLOCK enable:read调用返回-1,errno值为EAGA ...
- asp.net2.0导出pdf文件完美解决方案【转载】
asp.net2.0导出pdf文件完美解决方案 作者:清清月儿 PDF简介:PDF(Portable Document Format)文件格式是Adobe公司开发的电子文件格式.这种文件格式与操作系统 ...
- Tree通用的系列方法列表-treepanel
在项目中经常会用到Tree来显示数据进行操作.今天整理出来一系列操作Tree的方法.可供项目中方便调用.不用重复写代码,快速应用,通用性很强. Tree系列方法列表如下:主要针对的是ext.net中的 ...
- MYSQL 更改数据库data存储目录 创建用户 创建权限 设置远程访问的权限.
一. 怎么更改数据库data存储目录: 1. 安装MYSQL. 2. 切换到 C:\Program Files\MySQL\MySQL Server 5.6 3. 新建my.ini. 加入如下配置: ...