1 /* ----------------------------------------------------------------------- *
3 * Copyright (C) 2009 Intel Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version
7 * 2 as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * H. Peter Anvin <hpa@linux.intel.com>
21 * -----------------------------------------------------------------------
23 * Outputs a small assembly wrapper with the appropriate symbols defined.
31 #include <tools/le_byteshift.h>
33 int main(int argc
, char *argv
[])
41 fprintf(stderr
, "Usage: %s compressed_file\n", argv
[0]);
45 /* Get the information for the compressed kernel image first */
47 f
= fopen(argv
[1], "r");
54 if (fseek(f
, -4L, SEEK_END
)) {
58 if (fread(&olen
, sizeof(olen
), 1, f
) != 1) {
64 olen
= get_unaligned_le32(&olen
);
66 printf(".section \".rodata..compressed\",\"a\",@progbits\n");
67 printf(".globl z_input_len\n");
68 printf("z_input_len = %lu\n", ilen
);
69 printf(".globl z_output_len\n");
70 printf("z_output_len = %lu\n", (unsigned long)olen
);
72 printf(".globl input_data, input_data_end\n");
73 printf("input_data:\n");
74 printf(".incbin \"%s\"\n", argv
[1]);
75 printf("input_data_end:\n");