From: Erwan Velu Date: Mon, 11 Apr 2011 19:10:11 +0000 (+0200) Subject: hdt: Adding dump_mode & tftp_ip boot option X-Git-Tag: syslinux-4.05-pre1~20^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6826790fa50b948b1068e15269c64d4b4ee1c877;p=profile%2Fivi%2Fsyslinux.git hdt: Adding dump_mode & tftp_ip boot option dump_mode= give the user a chance to select a directory on the tftp server. tftp_ip= give the user a chance to select another tftp server for dumping data. By default, we use the tftp that serves the pxe booting. --- diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index f1557b8..8ae49ee 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -106,6 +106,12 @@ void detect_parameters(const int argc, const char *argv[], max_console_lines = MAX_CLI_LINES; } else if (!strncmp(argv[i], "nomenu", 6)) { menumode = false; + } else if (!strncmp(argv[i], "dump_path=", 10)) { + strlcpy(hardware->dump_path, argv[i] + 10, + sizeof(hardware->dump_path)); + } else if (!strncmp(argv[i], "tftp_ip=", 8)) { + strlcpy(hardware->tftp_ip, argv[i] + 8, + sizeof(hardware->tftp_ip)); } else if (!strncmp(argv[i], "auto=", 5)) { /* The auto= parameter is separated in several argv[] * as it can contains spaces. @@ -203,7 +209,10 @@ void init_hardware(struct s_hardware *hardware) sizeof hardware->modules_alias_path); memset(hardware->memtest_label, 0, sizeof hardware->memtest_label); memset(hardware->auto_label, 0, sizeof hardware->auto_label); + memset(hardware->dump_path, 0, sizeof hardware->dump_path); memset(hardware->vesa_background, 0, sizeof hardware->vesa_background); + memset(hardware->tftp_ip, 0, sizeof hardware->tftp_ip); + strcat(hardware->dump_path, "hdt"); strcat(hardware->pciids_path, "pci.ids"); strcat(hardware->modules_pcimap_path, "modules.pcimap"); strcat(hardware->modules_alias_path, "modules.alias"); diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h index c9923bf..a84cbe7 100644 --- a/com32/hdt/hdt-common.h +++ b/com32/hdt/hdt-common.h @@ -212,6 +212,8 @@ struct s_hardware { char modules_pcimap_path[255]; char modules_alias_path[255]; char pciids_path[255]; + char dump_path[255]; /* Dump path on the tftp server */ + char tftp_ip[255]; /* IP address of tftp server (dump mode) */ char memtest_label[255]; char auto_label[AUTO_COMMAND_SIZE]; char vesa_background[255]; diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c index 886c224..88f402b 100644 --- a/com32/hdt/hdt-dump.c +++ b/com32/hdt/hdt-dump.c @@ -37,7 +37,7 @@ struct print_buf p_buf; void compute_filename(struct s_hardware *hardware, char *filename, int size) { - snprintf(filename,size,"%s/","hdt"); + snprintf(filename,size,"%s/",hardware->dump_path); if (hardware->is_pxe_valid) { strncat(filename, hardware->pxe.mac_addr, sizeof(hardware->pxe.mac_addr)); @@ -115,8 +115,13 @@ void dump(struct s_hardware *hardware) /* The filename */ arg[0] = filename; - /* More to come */ - arg[1] = NULL; + /* The server to upload the file */ + if (strlen(hardware->tftp_ip) != 0) { + arg[1] = hardware->tftp_ip; + arg[2] = NULL; + } else { + arg[1] = NULL; + } /* We initiate the cpio to send */ cpio_init(upload,(const char **)arg);