|
|
1.1 ! root 1: /* netboot ! 2: * ! 3: * genprom.c,v ! 4: * Revision 1.1 1993/07/08 16:03:58 brezak ! 5: * Diskless boot prom code from Jim McKim ([email protected]) ! 6: * ! 7: * Revision 1.2 1993/06/30 20:15:38 mckim ! 8: * Display code size. ! 9: * ! 10: * Revision 1.1.1.1 1993/05/28 11:41:06 mckim ! 11: * Initial version. ! 12: * ! 13: * ! 14: * Read a binary image of a bios extension, generate the ! 15: * appropriate block count and checksum and write them ! 16: * into the rom image (replacing 2nd and 5th bytes) ! 17: * The binary image should be sized before being filtered ! 18: * through this routine. ! 19: */ ! 20: ! 21: #include <stdio.h> ! 22: ! 23: #define USE_SIZE ROM_SIZE ! 24: #define PROM_SIZE 0x10000 ! 25: ! 26: main() { ! 27: char w[PROM_SIZE], ck; ! 28: int i, sum; ! 29: memset(w, 0xff, PROM_SIZE); ! 30: i = fread(w, 1, PROM_SIZE, stdin); ! 31: fprintf(stderr, "bios extension size: %d (0x%x), read %d bytes\n", ! 32: USE_SIZE, USE_SIZE, i); ! 33: w[2] = USE_SIZE / 512; ! 34: for (sum=0, i=0; i<USE_SIZE; i++) { ! 35: sum += w[i]; ! 36: } ! 37: w[5] = -sum; ! 38: for (ck=0, i=0; i<USE_SIZE; i++) { ! 39: ck += w[i]; ! 40: } ! 41: fwrite(w, 1, PROM_SIZE, stdout); ! 42: } ! 43:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.