ia64/xen-unstable

view tools/firmware/acpi/acpi_gen.c @ 6392:bca2fd76995e

Add EXT3 as built-in filesystem for x86/64 domU.
author kaf24@firebug.cl.cam.ac.uk
date Wed Aug 24 15:21:48 2005 +0000 (2005-08-24)
parents bc8bb3a26ccc
children 68e754d7e1cb
line source
1 /*
2 * Copyright (c) 2004, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 */
18 #include "acpi2_0.h"
19 #include "stdio.h"
21 /*
22 * Generate acpi table
23 * write acpi table to binary: acpitable.bin
24 *
25 */
27 #define USAGE "Usage: acpi_gen filename \n" \
28 " generage acpitable and write to the binary \n" \
29 " filename - the binary name\n"
32 int main(int argc, char** argv){
33 char* filename;
34 char buf[ACPI_TABLE_SIZE];
35 FILE* f=NULL;
36 int i;
38 for (i=0; i<ACPI_TABLE_SIZE; i++){
39 buf[i]=0;
40 }
42 if (argc<2){
43 fprintf(stderr,"%s",USAGE);
44 exit(1);
45 }
47 filename = argv[1];
49 if(!(f=fopen(filename, "w+"))){
50 fprintf(stderr,"Can not open %s",filename);
51 exit(1);
52 }
53 AcpiBuildTable(buf);
54 if (fwrite(buf, ACPI_TABLE_SIZE, 1, f)<1){
55 fprintf(stderr,"Can not write to %s\n",filename);
56 exit(1);
57 }
58 return 0;
59 }