1 /* ----------------------------------------------------------------------- *
3 * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
4 * Copyright 2010 Intel Corporation; author: H. Peter Anvin
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 * Boston MA 02111-1307, USA; either version 2 of the License, or
10 * (at your option) any later version; incorporated herein by reference.
12 * ----------------------------------------------------------------------- */
25 const char program
[] = "sysdump";
26 const char version
[] = "SYSDUMP " VERSION_STR
" " DATE
"\n";
28 __noreturn
die(const char *msg
)
30 printf("%s: %s\n", program
, msg
);
34 static void dump_all(struct upload_backend
*be
, const char *argv
[])
38 cpio_writefile(be
, "sysdump", version
, sizeof version
-1);
52 static struct upload_backend
*upload_backends
[] =
60 __noreturn
usage(void)
62 struct upload_backend
**bep
, *be
;
65 for (bep
= upload_backends
; (be
= *bep
) ; bep
++)
66 printf(" %s %s %s\n", program
, be
->name
, be
->helpmsg
);
71 int main(int argc
, char *argv
[])
73 struct upload_backend
**bep
, *be
;
75 fputs(version
, stdout
);
80 for (bep
= upload_backends
; (be
= *bep
) ; bep
++) {
81 if (!strcmp(be
->name
, argv
[1]))
85 if (!be
|| argc
< be
->minargs
+ 2)
88 /* Do this as early as possible */
91 printf("Backend: %s\n", be
->name
);
93 /* Do the actual data dump */
94 dump_all(be
, (const char **)argv
+ 2);