mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-01 10:22:48 +02:00
add stage1 stage2 option
Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
This commit is contained in:
parent
eb23820087
commit
2011a397d0
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
extern int com_argc;
|
extern int com_argc;
|
||||||
extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
||||||
|
extern char * stage1;
|
||||||
|
|
||||||
struct ingenic_dev ingenic_dev;
|
struct ingenic_dev ingenic_dev;
|
||||||
struct hand hand;
|
struct hand hand;
|
||||||
@ -788,7 +789,7 @@ int debug_memory(int obj, unsigned int start, unsigned int size)
|
|||||||
printf(" Now test memory from 0x%x to 0x%x: \n",
|
printf(" Now test memory from 0x%x to 0x%x: \n",
|
||||||
start, start + hand.fw_args.size);
|
start, start + hand.fw_args.size);
|
||||||
|
|
||||||
if (load_file(&ingenic_dev, STAGE1_FILE_PATH) < 1)
|
if (load_file(&ingenic_dev, stage1) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
if (usb_ingenic_upload(&ingenic_dev, 1) < 1)
|
if (usb_ingenic_upload(&ingenic_dev, 1) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
@ -841,7 +842,7 @@ int debug_gpio(int obj, unsigned char ops, unsigned char pin)
|
|||||||
else
|
else
|
||||||
printf(" GPIO %d clear!\n",pin);
|
printf(" GPIO %d clear!\n",pin);
|
||||||
|
|
||||||
if (load_file(&ingenic_dev, STAGE1_FILE_PATH) < 1)
|
if (load_file(&ingenic_dev, stage1) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
if (usb_ingenic_upload(&ingenic_dev, 1) < 1)
|
if (usb_ingenic_upload(&ingenic_dev, 1) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -30,6 +30,8 @@ extern unsigned char code_buf[4 * 512 * 1024];
|
|||||||
|
|
||||||
int com_argc;
|
int com_argc;
|
||||||
char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH];
|
||||||
|
char * stage1;
|
||||||
|
char * stage2;
|
||||||
|
|
||||||
static const char COMMAND[][COMMAND_NUM]=
|
static const char COMMAND[][COMMAND_NUM]=
|
||||||
{
|
{
|
||||||
@ -289,7 +291,7 @@ int command_handle(char *buf)
|
|||||||
handle_gpio(3);
|
handle_gpio(3);
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
boot(STAGE1_FILE_PATH, STAGE2_FILE_PATH);
|
boot(stage1, stage2);
|
||||||
break;
|
break;
|
||||||
case 26:
|
case 26:
|
||||||
handle_nmark();
|
handle_nmark();
|
||||||
|
@ -55,9 +55,6 @@
|
|||||||
#define PRODUCT_ID_4750 0x4750
|
#define PRODUCT_ID_4750 0x4750
|
||||||
#define PRODUCT_ID_4760 0x4760
|
#define PRODUCT_ID_4760 0x4760
|
||||||
|
|
||||||
#define STAGE1_FILE_PATH (DATADIR "xburst_stage1.bin")
|
|
||||||
#define STAGE2_FILE_PATH (DATADIR "xburst_stage2.bin")
|
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
struct ingenic_dev {
|
struct ingenic_dev {
|
||||||
|
@ -27,9 +27,13 @@
|
|||||||
#include "ingenic_cfg.h"
|
#include "ingenic_cfg.h"
|
||||||
|
|
||||||
#define CONFIG_FILE_PATH (CFGDIR "usbboot.cfg")
|
#define CONFIG_FILE_PATH (CFGDIR "usbboot.cfg")
|
||||||
|
#define STAGE1_FILE_PATH (DATADIR "xburst_stage1.bin")
|
||||||
|
#define STAGE2_FILE_PATH (DATADIR "xburst_stage2.bin")
|
||||||
|
|
||||||
extern struct ingenic_dev ingenic_dev;
|
extern struct ingenic_dev ingenic_dev;
|
||||||
extern struct hand hand;
|
extern struct hand hand;
|
||||||
|
extern char * stage1;
|
||||||
|
extern char * stage2;
|
||||||
|
|
||||||
static void help(void)
|
static void help(void)
|
||||||
{
|
{
|
||||||
@ -39,6 +43,8 @@ static void help(void)
|
|||||||
" -c --command\t\t\tDirect run the commands, split by ';'\n"
|
" -c --command\t\t\tDirect run the commands, split by ';'\n"
|
||||||
" \t\t\tNOTICE: the max commands count is 10!\n"
|
" \t\t\tNOTICE: the max commands count is 10!\n"
|
||||||
" -f --configure\t\tconfigure file path\n"
|
" -f --configure\t\tconfigure file path\n"
|
||||||
|
" -1 --stage1\t\tstage1 file path\n"
|
||||||
|
" -2 --stage2\t\tstage2 file path\n"
|
||||||
" <run without options to enter commands via usbboot prompt>\n\n"
|
" <run without options to enter commands via usbboot prompt>\n\n"
|
||||||
"Report bugs to <xiangfu@sharism.cc>.\n"
|
"Report bugs to <xiangfu@sharism.cc>.\n"
|
||||||
);
|
);
|
||||||
@ -54,6 +60,8 @@ static struct option opts[] = {
|
|||||||
{ "version", 0, 0, 'v' },
|
{ "version", 0, 0, 'v' },
|
||||||
{ "command", 1, 0, 'c' },
|
{ "command", 1, 0, 'c' },
|
||||||
{ "configure", 1, 0, 'f' },
|
{ "configure", 1, 0, 'f' },
|
||||||
|
{ "stage1", 1, 0, '1' },
|
||||||
|
{ "stage2", 1, 0, '2' },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,14 +72,17 @@ int main(int argc, char **argv)
|
|||||||
char com_buf[256] = {0};
|
char com_buf[256] = {0};
|
||||||
char *cmdpt;
|
char *cmdpt;
|
||||||
char *cfgpath = CONFIG_FILE_PATH;
|
char *cfgpath = CONFIG_FILE_PATH;
|
||||||
|
stage1 = STAGE1_FILE_PATH;
|
||||||
|
stage2 = STAGE2_FILE_PATH;
|
||||||
|
|
||||||
printf("usbboot - Ingenic XBurst USB Boot Utility\n"
|
printf("usbboot - Ingenic XBurst USB Boot Utility\n"
|
||||||
"(c) 2009 Ingenic Semiconductor Inc., Qi Hardware Inc., Xiangfu Liu, Marek Lindner\n"
|
"(c) 2009 Ingenic Semiconductor Inc., Qi Hardware Inc., Xiangfu Liu, Marek Lindner\n"
|
||||||
"This program is Free Software and comes with ABSOLUTELY NO WARRANTY.\n\n");
|
"This program is Free Software and comes with ABSOLUTELY NO WARRANTY.\n\n");
|
||||||
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
int c, option_index = 0;
|
int c, option_index = 0;
|
||||||
c = getopt_long(argc, argv, "hvc:f:", opts,
|
c = getopt_long(argc, argv, "hvc:f:1:2:", opts,
|
||||||
&option_index);
|
&option_index);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
@ -90,6 +101,12 @@ int main(int argc, char **argv)
|
|||||||
case 'f':
|
case 'f':
|
||||||
cfgpath = optarg;
|
cfgpath = optarg;
|
||||||
break;
|
break;
|
||||||
|
case '1':
|
||||||
|
stage1 = optarg;
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
stage2 = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
help();
|
help();
|
||||||
exit(2);
|
exit(2);
|
||||||
|
Loading…
Reference in New Issue
Block a user