diff options
author | Erwan Velu <erwanaliasr1@gmail.com> | 2011-04-11 21:10:11 +0200 |
---|---|---|
committer | Erwan Velu <erwanaliasr1@gmail.com> | 2011-04-11 21:10:11 +0200 |
commit | 6826790fa50b948b1068e15269c64d4b4ee1c877 (patch) | |
tree | 57e05f10f8f726956849d20a4bd5ac81171682a4 | |
parent | 320460e9cc373180e8d8ac53f2bbe09b3bd6ba8b (diff) | |
download | syslinux-6826790fa50b948b1068e15269c64d4b4ee1c877.tar.gz |
hdt: Adding dump_mode & tftp_ip boot option
dump_mode=<dir> give the user a chance to select a directory on the tftp
server.
tftp_ip=<w.x.y.z> give the user a chance to select another tftp server
for dumping data. By default, we use the tftp that serves the pxe
booting.
-rw-r--r-- | com32/hdt/hdt-common.c | 9 | ||||
-rw-r--r-- | com32/hdt/hdt-common.h | 2 | ||||
-rw-r--r-- | com32/hdt/hdt-dump.c | 11 |
3 files changed, 19 insertions, 3 deletions
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index f1557b86..8ae49ee7 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 c9923bfe..a84cbe7c 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 886c224f..88f402b3 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); |