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 * ----------------------------------------------------------------------- */
22 #include "../../version.h"
26 const char program
[] = "sysdump";
27 const char version
[] = "SYSDUMP " VERSION_STR
" " DATE
"\n";
29 __noreturn
die(const char *msg
)
31 printf("%s: %s\n", program
, msg
);
35 static void dump_all(struct backend
*be
, const char *argv
[])
39 cpio_writefile(be
, "sysdump", version
, sizeof version
-1);
53 static struct backend
*backends
[] =
60 __noreturn
usage(void)
62 struct backend
**bep
, *be
;
65 for (bep
= backends
; (be
= *bep
) ; bep
++)
66 printf(" %s %s %s\n", program
, be
->name
, be
->helpmsg
);
71 int main(int argc
, char *argv
[])
73 struct backend
**bep
, *be
;
75 openconsole(&dev_null_r
, &dev_stdcon_w
);
76 fputs(version
, stdout
);
81 for (bep
= backends
; (be
= *bep
) ; bep
++) {
82 if (!strcmp(be
->name
, argv
[1]))
86 if (!be
|| argc
< be
->minargs
+ 2)
89 /* Do this as early as possible */
92 printf("Backend: %s\n", be
->name
);
94 /* Do the actual data dump */
95 dump_all(be
, (const char **)argv
+ 2);