/* * main.c - Utility program to create a bootrom image * * Copyright (C) 1997-2003 Gero Kuhlmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: main.c,v 1.6 2003/01/25 23:29:42 gkminix Exp $ */ #include #include #include "makerom.h" #include "doconfig.h" /* * Private variables */ static char *batchname = NULL; /* name of system to batch process */ /* * Command line options */ static struct cmdopt opts[] = { { "batch-sys", 'b', strval, {(char **)&batchname}, NULL, "name of system to process", "SYSTEM" }, { "drivers", 'd', strval, {(char **)&config.drvfname}, NULL, "name of file with network driver definitions", "FILE" }, { "md5sums", 'm', strval, {(char **)&config.md5fname}, NULL, "name of file with network driver MD5 sums", "FILE" }, { NULL, 0, noval, {NULL}, NULL, NULL, NULL } }; /* * Print boot definition record for debugging purposes */ static void printbootdef(bp) struct bootdef *bp; { static char *bnames[] = { "ISA", "EISA", "MCA", "PCI" }; static char *dnames[] = { "packet driver", "NDIS", "UNDI" }; static char *onames[] = { "binary", "flash", "intel hex", "motorola hex", "tektronix hex" }; int i; if (bp->name != NULL) printf("Bootrom building definitions for %s\n", bp->name); else printf("Bootrom building definitions\n"); printf("Kernel file = %s\n", bp->kernelname); if (bp->bus_type != BUSTYPE_NONE) printf("Bus type = %s\n", bnames[bp->bus_type - 1]); if (bp->bus_type == BUSTYPE_PCI) { printf("PCI vendor ID = %04X\n", bp->pci_vendid); printf("PCI device ID = %04X\n", bp->pci_devid); } else if (bp->pnp_devid != NULL) printf("PnP device ID = %s\n", bp->pnp_devid); printf("\n"); for (i = 0; i < bp->loadernum; i++) { printf("Loader binary %d = %s\n", i, bp->loaders[i].name); printf("Output file %d = %s (int %dh)\n", i, bp->loaders[i].outname, bp->loaders[i].useint18 ? 18 : 19); printf("Size of ROM image %d = ", i); if (bp->loaders[i].outsize > 0) printf("%d kB\n", bp->loaders[i].outsize); else printf("default\n"); printf("Type of out file %d = %s\n", i, onames[bp->loaders[i].outtype - 1]); } printf("\n"); printf("Network interface = %s (%s)\n", bp->netdrv.name, dnames[bp->netdrv.drivertype - 1]); if (bp->netdrv.drivertype == DRVTYPE_PD) { struct progdef *pdp = &(bp->netdrv.driverdefs.pd.progs); for (i = 0; i < pdp->prognum; i++) { printf("Driver %d program = %s\n", i, pdp->prognames[i]); printf("Driver %d arguments = ", i); if (pdp->progargs[i] != NULL) printf("%s\n", pdp->progargs[i]); else printf("none\n"); } } else if (bp->netdrv.drivertype == DRVTYPE_NDIS) { struct progdef *np = &(bp->netdrv.driverdefs.ndis.progs); for (i = 0; i < np->prognum; i++) { printf("Driver %d program = %s\n", i, np->prognames[i]); printf("Driver %d arguments = ", i); if (np->progargs[i] != NULL) printf("%s\n", np->progargs[i]); else printf("none\n"); } } else if (bp->netdrv.drivertype == DRVTYPE_UNDI) { struct undidef *up = &(bp->netdrv.driverdefs.undi); printf("Driver file = %s\n", up->name); } printf("\n"); } /* * Main program */ int main(argc, argv) int argc; char **argv; { struct bootdef *bp; /* Parse command line and read configuration information */ doconfig(argc, argv, opts); if (verbose > 0) { printf("\nBootrom configuration program, " VERSION "\n" COPYRIGHT "\n"); printf("Database file = %s\n", dbname); printf("Binaries directory = %s\n", config.bindir); printf("Network driver directory = %s\n", config.netdrvdir); printf("Utilities directory = %s\n", config.utilsdir); if (config.drvfname != NULL) printf("Driver definition file = %s\n", config.drvfname); if (config.md5fname != NULL) printf("Driver MD5 sums file = %s\n", config.md5fname); printf("\n"); } /* Get bootrom specification either from the user or the database */ if (batchname != NULL) { bp = getdb(batchname); } else { if (!verbose) printf("\nBootrom configuration program, " VERSION "\n" COPYRIGHT "\n\n"); bp = getuser(); } if (verbose > 1) printbootdef(bp); /* Generate bootrom output files */ dopasses(bp); return(EXIT_SUCCESS); }