U-boot、内核移植、根文件系统的构建(s3c2440)(2)
- UID
- 1029342
- 性别
- 男
|
U-boot、内核移植、根文件系统的构建(s3c2440)(2)
static int strtonum(char *str)
{
return (*str-48);
}
int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
int i=0;
int j=0;
if(argc != 3)
{
printf("led led_num on/off\n");
return 1;
}
if(strtonum(argv[1])>3||strtonum(argv[1])<0)
{
printf("only have 3 leds,please input 0-3\n") ;
return 1;
}
if(strtonum (argv[2])==1)
{
j=strtonum(argv[1])+5;
i=1<<j;
gpio->GPBDAT= (gpio->GPBDAT)&(~i);
}
else if(strtonum (argv[2])==0)
{
j=strtonum(argv[1])+5;
i=1<<j;
gpio->GPBDAT= (gpio->GPBDAT)|i;
}
else
{
printf("bad command,1:led on,0:led off\n");
return 1;
}
return 0;
}
U_BOOT_CMD(
led, CFG_MAXARGS, 1, do_led,
"led - trun on or off the leds\n",
"led led_num on/off\n"
);
#endif
2 修改/include/cmd_confdefs.h
#define CFG_CMD_LED 0x8000000000000000ULL
3 修改本层Makefile文件,增加cmd_led.o
4 增加自动挂载功能
#define CONFIG_BOOTCOMMAND "nand read.jffs2 0x32000000 0x80000 0x180000; bootm 0x32000000"
5 增加历史纪录
#define CONFIG_CMDLINE_EDITING 1 /* add command line history */
/***************************************
************引导linux启动***************
/****************************************
1 在/include/configs/my2440.h中增加宏定义
#define CONFIG_CMDLINE_TAG
#define CONFIG_SETUP_MEMORY_TAGS |
|
|
|
|
|