4 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
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; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
23 void print_usage(void)
25 printf("print\t\t\t\tShow the contents of the ROM\n");
28 int print_handler(struct rom *rom, int argc, char **argv)
31 ERROR("print %s? print takes no arguments.\n", argv[0]);
36 printf("%s: %d kB, bootblocksize %d, romsize %d, offset 0x%x\n", rom->name, rom->size / 1024,
37 ntohl(rom->header->bootblocksize), ntohl(rom->header->romsize), ntohl(rom->header->offset));
38 printf("Alignment: %d bytes\n\n", ntohl(rom->header->align));
40 struct cbfs_file *c = rom_find_first(rom);
42 printf("%-30s Offset %-12s Size\n", "Name", "Type");
47 switch (htonl(c->type)) {
48 case CBFS_COMPONENT_STAGE:
49 strcpy(type, "stage");
51 case CBFS_COMPONENT_PAYLOAD:
52 strcpy(type, "payload");
54 case CBFS_COMPONENT_OPTIONROM:
55 strcpy(type, "optionrom");
57 case CBFS_COMPONENT_NULL:
60 case CBFS_COMPONENT_DELETED:
61 strcpy(type, "deleted");
64 sprintf(type, "0x%8.8x", htonl(c->type));
68 printf("%-30s 0x%-8x %-12s %d\n", CBFS_NAME(c),
69 ROM_OFFSET(rom, c), type, htonl(c->len));
71 c = rom_find_next(rom, c);