cmd_menu.c
#include <config.h>
#include <command.h>
static int quit_flag = 0;
char awaitkey(unsigned long delay, int* error_p)
{
int i;
while (1) {
if (tstc()) /* we got a key press */
return getc();
}
}
else {
for (i = 0; i < delay; i++) {
if (tstc()) /* we got a key press */
return getc();
udelay (10*1000);
}
}
if (error_p)
*error_p = -1;
return 0;
}
{
volatile unsigned long *pa = (volatile unsigned long * )0;
unsigned long pb;
*pa = 0x12345678;
if(*pa != 0x12345678) { //不可写
return 1;
}
else{
*pa = pb;
printf("nand \n");
return 0;
}
}
{
printf("\r\n##### u-boot cmd menu ##### \r\n");
if(isbootfromnor())
printf("[o] download u-boot to nor \r\n");
printf("[n] download u-boot to nand \r\n");
printf("[k] download kernel to nand \r\n");
printf("[f] download yaffs-rootfs to nand \r\n");
printf("[r] reset the u-boot \r\n");
printf("[b] boot the system \r\n");
printf("[q] quit from menu \r\n");
}
{
strcpy(cmd_buf, "protect off all;erase 0 7ffff;tftp 30000000 u-boot.bin;cp.b 30000000 0 80000");
run_command(cmd_buf, 0);
}
{
strcpy(cmd_buf, "nand erase.part u-boot;tftp 30000000 u-boot.bin;nand write 30000000 u-boot");
run_command(cmd_buf, 0);
}
{
strcpy(cmd_buf, "nand erase.part kernel;tftp 30000000 uImage;nand write 30000000 kernel");
run_command(cmd_buf, 0);
}
{
char *p = cmd_buf + 14;
strcpy(cmd_buf, "nand erase.part rootfs");
run_command(cmd_buf, 0);
strcpy(cmd_buf, "tftp 30000000 ");
strcpy(p, argv[1]);
run_command(cmd_buf, 0);
strcpy(cmd_buf, "nand write.yaffs 30000000 460000 ");
p = cmd_buf + 33;
strcpy(p, argv[2]);
run_command(cmd_buf, 0);
}
{
run_command("reset", 0);
}
{
run_command("boot", 0);
}
{
quit_flag = 1;
}
{
printf("sure you have prepared file by tftp! \n");
}
{
char cmd;
showmainmenu();
while(1){
cmd = awaitkey(-1, NULL);
switch(cmd){
case 'o':
pre_handle();
do_uboot_load_o();
break;
case 'n':
pre_handle();
do_uboot_load_n();
break;
case 'k':
pre_handle();
do_kernel_load();
break;
case 'f':
pre_handle();
do_rootfs_load(argv);
break;
case 'r':do_reset_cmd();
break;
case 'b':
do_bootm_cmd();
break;
case 'q':
do_quit();
break;
}
if(quit_flag == 1)
break;
cmd = 0;
}
quit_flag = 0;
}
{
menu_shell(argv);
return 0;
}
menu, 3, 1, do_menu,
"sure you have prepared file by tftp, and press corresponding key",
"sure you have prepared file by tftp \n"
"press corresponding key, the u-boot will help you download file to the suited memory location \n"
"note: this menu only support yaffs rootfs, if you want to download jffs rootfs, you must input cmd by hand! \n"
"if you want to download rootfs, you must input 3 paramters like <menu> <rootfs_name> <rootfs_size> \n"
);
cmd_menu.c的更多相关文章
- uboot补丁的分析
接下来分析一下韦老师的uboot补丁: -------------------------------------------------------------------------------- ...
- (转载)U-boot启动完全分析
1.1 U-Boot工作过程 U-Boot启动内核的过程可以分为两个阶段,两个阶段的功能如下: (1)第一阶段的功能 Ø 硬件设备初始化 Ø 加载U-Boot第二阶段代码到RAM空间 Ø 设置好栈 Ø ...
- 改进uboot,添加自定义快捷菜单
.在common目录下新增cmd_menu.c文件,内容为: #include<common.h> #include<command.h> #ifdef CONFIG_MENU ...
- u-boot代码学习内容
前言 u-boot代码庞大,不可能全部细读,只能有选择的读部分代码.在读代码之前,根据韦东山教材,关于代码学习内容和深度做以下预先划定. 一.Makefile.mkconfig.config.mk等 ...
- 在uboot上创建菜单
一.原理 菜单其实就是一个uboot中的命令,和其他的命令没有什么差别. uboot启动时,如果进入uboot命令模式,先运行这个命令,就会打印出一个菜单界面. 在uboot的命令模式,通过键入“m ...
- U-Boot启动过程完全分析
U-Boot启动过程完全分析 1.1 U-Boot工作过程 U-Boot启动内核的过程可以分为两个阶段,两个阶段的功能如下: (1)第一阶段的功能 硬件设备初始化 加载U-Boot第二阶段 ...
- 修改LVDS支持1024*600分辨率
一.在boot中增加LVDS设置分辨率1024*600选项 1.修改文件TQIMX6_android-4.2.2\bootable\bootloader\uboot-imx\common\cmd_me ...
- ok6410 u-boot-2012.04.01移植七完善u-boot移植(u-boot移植结束)
继ok6410 u-boot-2012.04.01移植六后,开发板已支持MLC NAND.DM9000等.但还需要完善比如环境变量.mtdpart分区.裁剪.制作补丁等.下面的工作就是完善移植的u-b ...
- AM3358--Uboot支持LCD输出1024*768
1. uboot/include/lcd/tq3358_fb.h #define TFT240320 1 #define TFT320240 2 #define TFT480272 3//T43(天嵌 ...
随机推荐
- Oracle VM virtualBox -Centos6.4 安装后没有网解决方法
1.先修改Oracle VM virtualBox 的网络配置 2.然后启动centos输入: dhclient eth0 3.然后如果没报错的话 输入: ifconfig 就可以查看到ip地址 ...
- Angular-cli 构建应用的一些配置
Angular-cli 构建应用 的一些配置 标签(空格分隔): Angular 直接使用 ng build --prod --build-optimizer --base-href=/ 来发布 ba ...
- ORACLE不使用工具的情况下获取对象DDL
set line 200set pagesize 0set long 99999set feedback offset echo off获得表.索引.视图.存储过程.函数的DDL:select dbm ...
- March 28 2017 Week 13 Tuesday
Never was anything great achieved without danger. 不经历风雨,又怎能见彩虹. After the rain, if there's the sunsh ...
- 第二次Surm冲刺
一.小组完成情况: 因为技术原因,小组部分代码还没有完成,现在已经可以实现简单的借书与还书操作. 二.个人情况 我对代码进行了测试,与大家进相关的讨论. 三.总结 这次实验的团队合作真的很重要,有许多 ...
- 高通Vuforia
这里使用高通的Vuroria来做一个AR歌姬. 工具: Vuforia,MMD4Mecanim 模型: 初音未来pmd模型文件,极乐净土vmd动作文件. 逻辑: 当发现识别卡时:开启音乐,模型速度为1 ...
- 【转】总结oninput、onchange与onpropertychange事件的用法和区别
经本人测试在chrome下的从历史记录中选取值的时候也户触发input事件 前端页面开发的很多情况下都需要实时监听文本框输入,比如腾讯微博编写140字的微博时输入框hu9i动态显示还可以输入的字数.过 ...
- ASP.NET Web API 自定义MediaType实现jsonp跨域调用
代码来自<ASP.NET Web API 2 框架揭秘>一书. 直接上代码: /// <summary> /// 自定义jsonp MediaType /// </sum ...
- python-函数的使用
一.函数的定义 首先,我们来看一个简单的例子来定义函数: def test(): print('hello') 在其中 def : 关键字,用来告诉解释器,接下来的一段代码是一个函数 test : ...
- Docker 安装mysql8.0
1. 下载Mysql的Docker镜像: $ docker search mysql (搜索mysql镜像) $ docker pull mysql (下载mysql镜像,默认最新版本) 2. 运行镜 ...