瀏覽代碼

[contrib] Move most contrib content to a separate repository

Most of the content that was previously in this directory has been
moved to a separate git repository:

    http://git.etherboot.org/?p=contrib.git;a=summary

or the Etherboot Project wiki:

    http://etherboot.org/
tags/v1.0.0-rc1
Marty Connor 15 年之前
父節點
當前提交
330abebddf
共有 100 個文件被更改,包括 9 次插入14187 次删除
  1. 0
    9
      contrib/3c90xutil/Makefile
  2. 0
    80
      contrib/3c90xutil/README
  3. 0
    254
      contrib/3c90xutil/bromutil.c
  4. 0
    259
      contrib/3c90xutil/cromutil.c
  5. 0
    104
      contrib/3c90xutil/ocromutil.c
  6. 0
    36
      contrib/3c90xutil/romutil.txt
  7. 0
    537
      contrib/Diskless-From-NT/Config.txt
  8. 0
    565
      contrib/Diskless-From-NT/Diskless-From-NT.txt
  9. 0
    82
      contrib/Diskless-From-NT/furtmayr.html
  10. 9
    0
      contrib/README
  11. 0
    40
      contrib/auto-default/mail
  12. 0
    55
      contrib/auto-default/main.c.patch
  13. 0
    2
      contrib/award_plugin_roms/README
  14. 0
    341
      contrib/award_plugin_roms/award_plugin_roms.pl
  15. 0
    475
      contrib/baremetal/Makefile
  16. 0
    1119
      contrib/baremetal/main.c
  17. 0
    52
      contrib/baremetal/marini.txt
  18. 0
    351
      contrib/baremetal/misc.c
  19. 0
    756
      contrib/baremetal/startmpcc.S
  20. 0
    9
      contrib/bin2intelhex/Makefile
  21. 0
    148
      contrib/bin2intelhex/bin2intelhex.c
  22. 0
    74
      contrib/bin2intelhex/bin2intelhex.c.simple
  23. 0
    7
      contrib/bochs/.gitignore
  24. 0
    10
      contrib/bochs/Makefile
  25. 0
    95
      contrib/bochs/README
  26. 0
    79
      contrib/bochs/README.qemu
  27. 0
    31
      contrib/bochs/README.windows-ris
  28. 0
    20
      contrib/bochs/bochs-writable-ROM-patch
  29. 0
    750
      contrib/bochs/bochsrc.txt
  30. 0
    26
      contrib/bochs/qemu-patch
  31. 0
    278
      contrib/bochs/serial-console
  32. 0
    191
      contrib/bochs/serial-console.1
  33. 0
    113
      contrib/bochs/tunctl.c
  34. 0
    42
      contrib/bootptodhcp/bootptodhcp.pl
  35. 0
    23
      contrib/compressor/COPYING
  36. 0
    58
      contrib/compressor/algorithm.doc
  37. 0
    14
      contrib/compressor/loader.h
  38. 0
    764
      contrib/compressor/lzhuf.c
  39. 0
    16
      contrib/dhcpdconfeg/dhcpd.conf
  40. 0
    140
      contrib/dhcpdconfeg/vendorclassid.txt
  41. 0
    884
      contrib/dhcpid/dhcpid.txt
  42. 0
    73
      contrib/eepro100notes/flash-1.txt
  43. 0
    149
      contrib/eepro100notes/flash-2.txt
  44. 0
    57
      contrib/eepro100notes/flash-3.txt
  45. 0
    29
      contrib/flashimg/Makefile
  46. 0
    497
      contrib/flashimg/flashimg.asm
  47. 二進制
      contrib/flashimg/flashimg.img
  48. 0
    15
      contrib/hdload/Makefile
  49. 0
    162
      contrib/hdload/hdload.S
  50. 0
    175
      contrib/hdload/petr.msg
  51. 0
    46
      contrib/initrd/ChangeLog
  52. 0
    187
      contrib/initrd/Makefile
  53. 0
    15
      contrib/initrd/Manifest
  54. 0
    37
      contrib/initrd/README
  55. 0
    207
      contrib/initrd/dhcpd.conf.etherboot.include
  56. 0
    63
      contrib/initrd/include-modules
  57. 0
    7
      contrib/initrd/linux-wlan.cfg
  58. 0
    76
      contrib/initrd/linuxrc
  59. 0
    165
      contrib/initrd/mkinitrd-net
  60. 0
    112
      contrib/initrd/mkinitrd-net.spec
  61. 0
    200
      contrib/initrd/mknbi-set
  62. 0
    27
      contrib/initrd/mknbi-set.conf
  63. 0
    11
      contrib/initrd/script.c.patch
  64. 0
    25
      contrib/initrd/udhcpc-post
  65. 0
    92
      contrib/linux-2.0-transname.lsm
  66. 0
    24
      contrib/linux-3c503-patch/3c503.patch
  67. 0
    7
      contrib/linux-3c503-patch/README
  68. 0
    339
      contrib/mini-slamd/COPYING
  69. 0
    8
      contrib/mini-slamd/Makefile
  70. 0
    521
      contrib/mini-slamd/mini-slamd.c
  71. 0
    10
      contrib/mkQNXnbi/Makefile
  72. 0
    36
      contrib/mkQNXnbi/README
  73. 0
    29
      contrib/mkQNXnbi/examples/bootptab
  74. 0
    22
      contrib/mkQNXnbi/examples/ws.etherboot
  75. 0
    22
      contrib/mkQNXnbi/examples/ws.etherboot.on-the-fly
  76. 0
    196
      contrib/mkQNXnbi/mkQNXnbi.c
  77. 0
    76
      contrib/mkffwnb/2.0.10/linuxrc
  78. 0
    43
      contrib/mkffwnb/Extendinitrd.pm
  79. 0
    69
      contrib/mkffwnb/README
  80. 0
    226
      contrib/mkffwnb/mkffwnb.pl
  81. 0
    4
      contrib/mklrpnb/README.txt
  82. 0
    191
      contrib/mklrpnb/extractdach.pl
  83. 0
    45
      contrib/mklrpnb/mklrpnb
  84. 0
    97
      contrib/mntnbi/mntnbi.pl
  85. 0
    2
      contrib/nfs-swap/README
  86. 0
    10
      contrib/p910nd-0.8/Makefile
  87. 0
    9
      contrib/p910nd-0.8/banner.pl
  88. 0
    58
      contrib/p910nd-0.8/client.pl
  89. 0
    93
      contrib/p910nd-0.8/p910nd.8
  90. 0
    420
      contrib/p910nd-0.8/p910nd.c
  91. 0
    39
      contrib/p910nd-0.8/p910nd.sh
  92. 0
    67
      contrib/ppmtoansi/Makefile
  93. 0
    1
      contrib/ppmtoansi/demo/dos.ansi
  94. 0
    51
      contrib/ppmtoansi/demo/dos.ppm
  95. 0
    29
      contrib/ppmtoansi/demo/dos.xpm
  96. 二進制
      contrib/ppmtoansi/demo/etherboot.ansi
  97. 0
    99
      contrib/ppmtoansi/demo/etherboot.ppm
  98. 0
    27
      contrib/ppmtoansi/demo/etherboot.xpm
  99. 0
    1
      contrib/ppmtoansi/demo/flash.ansi
  100. 0
    0
      contrib/ppmtoansi/demo/flash.ppm

+ 0
- 9
contrib/3c90xutil/Makefile 查看文件

@@ -1,9 +0,0 @@
1
-FILES = cromutil ocromutil bromutil
2
-
3
-INCLUDEDIR = /usr/include
4
-CFLAGS = -O2 -fomit-frame-pointer -Wall -I$(INCLUDEDIR)
5
-
6
-all: $(FILES)
7
-
8
-clean:
9
-	rm -f $(FILES) *~ core

+ 0
- 80
contrib/3c90xutil/README 查看文件

@@ -1,80 +0,0 @@
1
-This utility was apparently writen by John Finlay and came to me
2
-via Richard Schroeder who got it from Greg Beeley. John, if you want
3
-to be credited with your full address or whatever in the Etherboot
4
-documentation, please contact me (Etherboot maintainer).
5
-
6
-1/18/2000 Marty Connor (mdc@thinguin.org) added code for the 3C905C
7
-with AT49BV512 Flash memory, and created cromutil and bromutil to
8
-differentiate the versions.  cromutil is for 3C905C and bromutil is
9
-for 3C905B.
10
-
11
-8.28.2005 I am adding a new version from Jorge L. deLyra that will
12
-replace cromutil.c.  I will rename cromutil.c to ocromutil.c
13
-
14
-  From:	        delyra@fma.if.usp.br
15
-  Subject:	Improved version of cromutil.c.
16
-  Date:		June 22, 2004 12:19:00 AM EDT
17
-  To:		mdc@thinguin.org
18
-
19
-  Dear Marty,
20
-
21
-       Below you will find a new version of the cronutil.c program. Since
22
-  the changes were quite large I am sending the program rather than a patch.
23
-  I added support for 3C905CX cards with a page-mode super-flash EEPROM, and
24
-  included several informative messages, a programming progress report and a
25
-  detailed help message. I did all the tests I could with it and it seems to
26
-  work correctly for the 3C905CX with either type of EEPROM chip.
27
-
28
-  A question: is there a similar program for Intel eepro100 cards or for the
29
-  Intel or 3COM Gbit cards?
30
-					  Cheers,
31
-
32
-  ----------------------------------------------------------------
33
-	  Jorge L. deLyra,  Associate Professor of Physics
34
-	      The University of Sao Paulo,  IFUSP-DFMA
35
-	 For more information: finger delyra@latt.if.usp.br
36
-  ----------------------------------------------------------------
37
-
38
-12/4/2009 The new cromutil version from Jorge L. deLyra can be found in
39
-cromutil.c, whereas the old version can be found in ocromutil.c.
40
-
41
-bromutil.c now supports enabling a bootrom workaround that was previously
42
-implemented in the old 3c90x driver. Some 3c90xB cards refuse to load gPXE
43
-after the ROM is burned. The gPXE banner is likely to appear, but gPXE will
44
-crash soon after.
45
-If this is the case try the following commands. It is assumed that you replace
46
-0x6600 with the I/O address of your card which can be acquired with:
47
-(look for a line like 'I/O ports at e400')
48
- $ lspci -v
49
-
50
-    $ make
51
-    $ ./bromutil 0x6600 bootrom
52
-
53
-This command will write into the settings EEPROM of the network card. In case
54
-the network card shows any unexpected behavior it is possible to restore the
55
-EEPROM settings with a 3COm provided tool called '3c90xcfg.exe'(google it for
56
-mirrors).
57
-
58
-  -- Thomas Miletich
59
-
60
-Be careful. You can easily erase your Flash memory using these
61
-utilities.  Make *sure* to back them up first using the "read"
62
-command. You must "erase" before using "prog" to program the chip with
63
-Etherboot code.  This code comes with NO WARRANTY, and you take sole
64
-responsibility and liability for whatever it does.  Read the
65
-"romutil.txt" file for more information on commands.
66
-
67
-That being said, if you are programming a 3C905C-TXM (for example)
68
-you would do something like this:
69
-
70
-    $ cd etherboot-x.x.x/contrib
71
-    $ tar -zxvf n3c905xutil.tar.gz
72
-    $ cd n3c905xutil
73
-    $ make
74
-    # replace 0x6600 with whatever the IO Addr for your card is!!!!
75
-    $ ./cromutil 0x6600 read > 905cbackup.bin
76
-    $ ./cromutil 0x6600 erase
77
-    $ ./cromutil 0x6600 prog < 3c90x.lzrom
78
-
79
-You should now have an Etherboot-enabled 3c905C-TXM.
80
-

+ 0
- 254
contrib/3c90xutil/bromutil.c 查看文件

@@ -1,254 +0,0 @@
1
-/* 
2
- * readutil.c - perform various control ops on the 3c509b bios rom
3
- *
4
- */
5
-
6
-#ifndef __i386__
7
-#  error "This program can't compile or run on non-intel computers"
8
-#else
9
-
10
-#include <stdio.h>
11
-#include <stdlib.h>
12
-#include <unistd.h>
13
-#include <string.h>
14
-
15
-#ifdef __FreeBSD__
16
-
17
-#include <fcntl.h>
18
-#include <machine/cpufunc.h>
19
-
20
-#define OUTB(data, port) 	outb(port, data)
21
-#define OUTW(data, port) 	outw(port, data)
22
-#define OUTL(data, port) 	outl(port, data)
23
-
24
-#else
25
-
26
-#include <sys/io.h>
27
-
28
-#define OUTB(data, port) 	outb(data, port)
29
-#define OUTW(data, port) 	outw(data, port)
30
-#define OUTL(data, port) 	outl(data, port)
31
-
32
-#endif
33
-
34
-/*
35
- * write_eeprom() and enum definitions are copied from vortex-diag.c,
36
- * Copyright 1997-2004 by Donald Becker.
37
- *	This software may be used and distributed according to the terms of
38
- *	the GNU General Public License (GPL), incorporated herein by reference.
39
- *	Contact the author for use under other terms.
40
- */
41
-
42
-enum vortex_cmd {
43
-	TotalReset = 0<<11, SelectWindow = 1<<11, StartCoax = 2<<11,
44
-	RxDisable = 3<<11, RxEnable = 4<<11, RxReset = 5<<11,
45
-	UpStall = 6<<11, UpUnstall = (6<<11)+1,
46
-	DownStall = (6<<11)+2, DownUnstall = (6<<11)+3,
47
-	RxDiscard = 8<<11, TxEnable = 9<<11, TxDisable = 10<<11, TxReset = 11<<11,
48
-	FakeIntr = 12<<11, AckIntr = 13<<11, SetIntrEnb = 14<<11,
49
-	SetStatusEnb = 15<<11, SetRxFilter = 16<<11, SetRxThreshold = 17<<11,
50
-	SetTxThreshold = 18<<11, SetTxStart = 19<<11,
51
-	StartDMAUp = 20<<11, StartDMADown = (20<<11)+1, StatsEnable = 21<<11,
52
-	StatsDisable = 22<<11, StopCoax = 23<<11, SetFilterBit = 25<<11,
53
-};
54
-
55
-enum Window0 {
56
-	Wn0EepromCmd = 10,		/* Window 0: EEPROM command register. */
57
-	Wn0EepromData = 12,		/* Window 0: EEPROM results register. */
58
-	IntrStatus=0x0E,		/* Valid in all windows. */
59
-};
60
-
61
-enum Win0_EEPROM_cmds {
62
-	EEPROM_Read = 2, EEPROM_WRITE = 1, EEPROM_ERASE = 3,
63
-	EEPROM_EWENB = 0xC,		/* Enable erasing/writing for 10 msec. */
64
-	EEPROM_EWDIS = 0x0,		/* Disable EWENB before 10 msec timeout. */
65
-};
66
-
67
-#define debug 1
68
-static void write_eeprom(long ioaddr, int addrlen, int index, int value)
69
-{
70
-	int timer;
71
-
72
-	/* Verify that the EEPROM is idle. */
73
-	for (timer = 1620; inw(ioaddr + Wn0EepromCmd) & 0x8000;)
74
-		if (--timer < 0)
75
-			goto error_return;
76
-	/* Enable writing: EEPROM_EWENB | 110000.... */
77
-	OUTW(3 << (addrlen-2), ioaddr + Wn0EepromCmd);
78
-	for (timer = 400; inw(ioaddr + Wn0EepromCmd) & 0x8000;) {
79
-		if (--timer < 0)
80
-			goto error_return;
81
-	}
82
-	if (debug)
83
-		fprintf(stderr, "EEPROM write enable took %d ticks!\n", 400 - timer);
84
-	OUTW((EEPROM_ERASE << addrlen) + index, ioaddr + Wn0EepromCmd);
85
-	for (timer = 16000; inw(ioaddr + Wn0EepromCmd) & 0x8000;)
86
-		if (--timer < 0) {
87
-			fprintf(stderr, "EEPROM failed to erase index %d!\n", index);
88
-			return;
89
-		}
90
-	if (debug)
91
-		fprintf(stderr, "EEPROM erased index %d after %d ticks!\n",
92
-				index, 16000-timer);
93
-	OUTW(3 << (addrlen-2), ioaddr + Wn0EepromCmd);
94
-	for (timer = 400; inw(ioaddr + Wn0EepromCmd) & 0x8000;) {
95
-		if (--timer < 0)
96
-			goto error_return;
97
-	}
98
-	if (debug)
99
-		fprintf(stderr, "EEPROM write enable took %d ticks!\n", 400-timer);
100
-	OUTW(value, ioaddr + Wn0EepromData);
101
-	OUTW((EEPROM_WRITE << addrlen) + index, ioaddr + Wn0EepromCmd);
102
-	for (timer = 16000; inw(ioaddr + Wn0EepromCmd) & 0x8000;)
103
-		if (--timer < 0)
104
-			goto error_return;
105
-	if (debug)
106
-		fprintf(stderr, "EEPROM wrote index %d with 0x%4.4x after %d ticks!\n",
107
-				index, value, 16000-timer);
108
-	return;
109
-error_return:
110
-	fprintf(stderr, "Failed to write EEPROM location %d with 0x%4.4x!\n",
111
-			index, value);
112
-}
113
-
114
-int main(int argc, char **argv)
115
-{
116
-	unsigned int i, j, n;
117
-	unsigned int ioaddr;
118
-	unsigned long recvrstat;
119
-	unsigned char buf[128];
120
-	unsigned char b;
121
-
122
-	if (argc != 3) {
123
-		printf
124
-		    ("Usage: romid ioaddr [erase|protect|unprotect|id|bootrom|read >file|prog <file]\n");
125
-		exit(-1);
126
-	}
127
-#ifdef __FreeBSD__
128
-	/* get permissions for in/out{blw} */
129
-	open("/dev/io", O_RDONLY, 0);
130
-#else
131
-	setuid(0);		/* if we're setuid, do it really */
132
-	if (iopl(3)) {
133
-		perror("iopl()");
134
-		exit(1);
135
-	}
136
-#endif
137
-
138
-	sscanf(argv[1], "%x", &ioaddr);
139
-	/* Set the register window to 3 for the 3c905b */
140
-	OUTW(0x803, ioaddr + 0xe);
141
-	recvrstat = inl(ioaddr);	/* save the receiver status */
142
-	/* set the receiver type to MII so the full bios rom address space
143
-	   can be accessed */
144
-	OUTL((recvrstat & 0xf00fffff) | 0x00600000, ioaddr);
145
-
146
-	/* Set the register window to 0 for the 3c905b */
147
-	OUTW(0x800, ioaddr + 0xe);
148
-
149
-	if (strcmp(argv[2], "erase") == 0) {
150
-		/* do the funky chicken to erase the rom contents */
151
-		OUTL(0x5555, ioaddr + 0x4);
152
-		OUTB(0xaa, ioaddr + 0x8);
153
-		OUTL(0x2aaa, ioaddr + 0x4);
154
-		OUTB(0x55, ioaddr + 0x8);
155
-		OUTL(0x5555, ioaddr + 0x4);
156
-		OUTB(0x80, ioaddr + 0x8);
157
-		OUTL(0x5555, ioaddr + 0x4);
158
-		OUTB(0xaa, ioaddr + 0x8);
159
-		OUTL(0x2aaa, ioaddr + 0x4);
160
-		OUTB(0x55, ioaddr + 0x8);
161
-		OUTL(0x5555, ioaddr + 0x4);
162
-		OUTB(0x10, ioaddr + 0x8);
163
-		printf("Bios ROM at %04x has been erased\n", ioaddr);
164
-	} else if (strcmp(argv[2], "protect") == 0) {
165
-		OUTL(0x5555, ioaddr + 0x4);
166
-		OUTB(0xaa, ioaddr + 0x8);
167
-		OUTL(0x2aaa, ioaddr + 0x4);
168
-		OUTB(0x55, ioaddr + 0x8);
169
-		OUTL(0x5555, ioaddr + 0x4);
170
-		OUTB(0xa0, ioaddr + 0x8);
171
-		printf
172
-		    ("Software Data Protection for Bios ROM at %04x has been enabled\n",
173
-		     ioaddr);
174
-	} else if (strcmp(argv[2], "unprotect") == 0) {
175
-		OUTL(0x5555, ioaddr + 0x4);
176
-		OUTB(0xaa, ioaddr + 0x8);
177
-		OUTL(0x2aaa, ioaddr + 0x4);
178
-		OUTB(0x55, ioaddr + 0x8);
179
-		OUTL(0x5555, ioaddr + 0x4);
180
-		OUTB(0x80, ioaddr + 0x8);
181
-		OUTL(0x5555, ioaddr + 0x4);
182
-		OUTB(0xaa, ioaddr + 0x8);
183
-		OUTL(0x2aaa, ioaddr + 0x4);
184
-		OUTB(0x55, ioaddr + 0x8);
185
-		OUTL(0x5555, ioaddr + 0x4);
186
-		OUTB(0x20, ioaddr + 0x8);
187
-		printf
188
-		    ("Software Data Protection for Bios ROM at %04x has been disabled\n",
189
-		     ioaddr);
190
-	} else if (strcmp(argv[2], "id") == 0) {
191
-		OUTL(0x5555, ioaddr + 0x4);
192
-		OUTB(0xaa, ioaddr + 0x8);
193
-		OUTL(0x2aaa, ioaddr + 0x4);
194
-		OUTB(0x55, ioaddr + 0x8);
195
-		OUTL(0x5555, ioaddr + 0x4);
196
-		OUTB(0x90, ioaddr + 0x8);
197
-		/* 10ms delay needed */
198
-		printf("Manufacturer ID - ");
199
-		/* manuf. id */
200
-		OUTL(0x0000, ioaddr + 0x4);
201
-		printf("%02x\n", inb(ioaddr + 0x8));
202
-		/* device id */
203
-		OUTL(0x0001, ioaddr + 0x4);
204
-		printf("Device ID - %02x\n", inb(ioaddr + 0x8));
205
-		/* undo the funky chicken */
206
-		OUTL(0x5555, ioaddr + 0x4);
207
-		OUTB(0xaa, ioaddr + 0x8);
208
-		OUTL(0x2aaa, ioaddr + 0x4);
209
-		OUTB(0x55, ioaddr + 0x8);
210
-		OUTL(0x5555, ioaddr + 0x4);
211
-		OUTB(0xf0, ioaddr + 0x8);
212
-	} else if(strcmp(argv[2], "bootrom") == 0) {
213
-		printf("bootrom fix\n");
214
-		write_eeprom(ioaddr, 6, 19, 0x160);
215
-	} else if (strcmp(argv[2], "read") == 0) {
216
-		for (i = 0; i < 65536; i++) {
217
-			OUTL(i, ioaddr + 0x4);
218
-			b = inb(ioaddr + 0x8);
219
-			write(1, &b, 1);
220
-		}
221
-	} else if (strcmp(argv[2], "prog") == 0) {
222
-		/* program the rom in 128 bute chunks */
223
-		for (i = 0, n = 0; i < 65536; i += n) {
224
-			n = read(0, buf, 128);
225
-			if (n == 0)
226
-				break;
227
-			if (n < 0) {
228
-				perror("File Error");
229
-				exit(-3);
230
-			}
231
-			/* disable SDP temporarily for programming a sector */
232
-			OUTL(0x5555, ioaddr + 0x4);
233
-			OUTB(0xaa, ioaddr + 0x8);
234
-			OUTL(0x2aaa, ioaddr + 0x4);
235
-			OUTB(0x55, ioaddr + 0x8);
236
-			OUTL(0x5555, ioaddr + 0x4);
237
-			OUTB(0xa0, ioaddr + 0x8);
238
-			for (j = 0; j < n; j++) {
239
-				OUTL(i + j, ioaddr + 0x4);
240
-				OUTB(buf[j], ioaddr + 0x8);
241
-			}
242
-			/* wait for the programming of this sector to coomplete */
243
-			while (inb(ioaddr + 0x8) != buf[j - 1]);
244
-		}
245
-	}
246
-
247
-	/* Set the register window to 3 for the 3c905b */
248
-	OUTW(0x803, ioaddr + 0xe);
249
-	/* restore the receiver status */
250
-	OUTL(recvrstat, ioaddr);
251
-	return 0;
252
-}
253
-
254
-#endif				/* __i386__ */

+ 0
- 259
contrib/3c90xutil/cromutil.c 查看文件

@@ -1,259 +0,0 @@
1
-/*
2
- * JLdL 21Jun04.
3
- *
4
- * cromutil.c
5
- *
6
- * Perform various control operations on the flash EEPROM of
7
- * _ the 3COM models 3C905C or 3C905CX network cards, in order
8
- * _ to write a boot program such as Etherboot into it.
9
- *
10
- * This program is meant for the Linux operating system only,
11
- * _ and only for the i386 architecture.
12
- *
13
- * The flash EEPROM usually used in these cards is the AT49BV512
14
- * _ chip, which has 512 Kbit (64 KByte). Another possible chip,
15
- * _ which is equivalent to this one, is the SST39VF512.
16
- *
17
- * Added alternative read128 and prog128 commands for cards with
18
- * _ the SST29EE020 fast page-write (super-)flash EEPROM, which
19
- * _ has 2 Mbit (256 KByte), and which has to be programmed in
20
- * _ a 128-byte page mode. NOTE: it seems that the card can
21
- * _ address only the first half of the memory in this chip,
22
- * _ so only 128 Kbytes are actually available for use.
23
- *
24
- * Added a few informative messages and a detailed help message.
25
- *
26
- */
27
-
28
-#ifndef __i386__
29
-#  error "This program can't compile or run on non-Intel computers"
30
-#else
31
-
32
-#include <stdio.h>
33
-#include <stdlib.h>
34
-#include <unistd.h>
35
-#include <sys/io.h>
36
-#include <string.h>
37
-
38
-int main(int argc, char **argv)
39
-{
40
-  /* Counters. */
41
-  unsigned int i, j, n;
42
-  /* For ROM chips larger than 64 KB, a long integer
43
-     _ is needed for the global byte counter. */
44
-  unsigned long k;
45
-  /* The I/O address of the card. */
46
-  unsigned int ioaddr;
47
-  /* Storage for a byte. */
48
-  unsigned char b;
49
-  /* Storage for a page. */
50
-  unsigned char buf[128];
51
-
52
-  /* Initialize a few things to avoid compiler warnings. */
53
-  i=0; j=0; n=0; k=0;
54
-
55
-  /* Verify the command-line parameters; write
56
-     _ out an usage message if needed. */
57
-  if (argc != 3) {
58
-    /* Exactly 2 command line parameters are needed. */
59
-    printf("Usage: ./cromutil ioaddr command [(>|<) file]\n");
60
-    printf(" (try './cromutil 0x0000 help' for details)\n");
61
-    exit(-1);
62
-  }
63
-
64
-  /* Set the UID to root if possible. */
65
-  setuid(0);
66
-
67
-  /* Get port-access permissions for in{blw}/out{blw}. */
68
-  if (iopl(3)) {
69
-    perror("iopl()");
70
-    exit(1);
71
-  }
72
-
73
-  /* Pass the I/O address of the card to a variable. */
74
-  sscanf(argv[1],"%x",&ioaddr);
75
-
76
-  /* Set the register window to 0. */
77
-  outw(0x800, ioaddr+0xe);
78
-
79
-  /*
80
-   * Execute the requested command.
81
-   *
82
-   * "id": get and write out the ID numbers.
83
-   */
84
-  if (strcmp(argv[2], "id") == 0) {
85
-    /* Software ID entry command sequence. */
86
-    outl(0x5555, ioaddr+0x4); outb(0xaa, ioaddr+0x8);
87
-    outl(0x2aaa, ioaddr+0x4); outb(0x55, ioaddr+0x8);
88
-    outl(0x5555, ioaddr+0x4); outb(0x90, ioaddr+0x8);
89
-    /* A 10 ms delay is needed. */
90
-    usleep(10000);
91
-    /* Get the manufacturer id. */
92
-    outl(0x0000, ioaddr+0x4);
93
-    printf("Manufacturer ID - %02x\n", inb(ioaddr+0x8));
94
-    /* Get the device id. */
95
-    outl(0x0001, ioaddr+0x4);
96
-    printf("Device ID - %02x\n", inb(ioaddr+0x8));
97
-    /* Software ID exit command sequence. */
98
-    outl(0x5555, ioaddr+0x4); outb(0xaa, ioaddr+0x8);
99
-    outl(0x2aaa, ioaddr+0x4); outb(0x55, ioaddr+0x8);
100
-    outl(0x5555, ioaddr+0x4); outb(0xf0, ioaddr+0x8);
101
-  }
102
-  /*
103
-   * "read": read data from the 512 Kbit ROM.
104
-   */
105
-  else if (strcmp(argv[2], "read") == 0) {
106
-    /* Loop over the whole ROM. */
107
-    for (k = 0; k < 65536; k++) {
108
-      outl(k, ioaddr+0x4);
109
-      b = inb(ioaddr+0x8);
110
-      write(1, &b, 1);
111
-    }
112
-    /* Write out an informative message. */
113
-    perror("Read 65536 bytes from ROM");
114
-  }
115
-  /*
116
-   * "read128": this alternative is for the 2 Mbit ROM.
117
-   */
118
-  else if (strcmp(argv[2], "read128") == 0) {
119
-    /* Loop over the accessible part of the ROM. */
120
-    for (k = 0; k < 131072; k++) {
121
-      outl(k, ioaddr+0x4);
122
-      b = inb(ioaddr+0x8);
123
-      write(1, &b, 1);
124
-    }
125
-    /* Write out an informative message. */
126
-    perror("Read 131072 bytes from ROM");
127
-  }
128
-  /*
129
-   * "erase": erase the ROM contents.
130
-   */
131
-  else if (strcmp(argv[2], "erase") == 0) {
132
-    /* Software chip-erase command sequence. */
133
-    outl(0x5555, ioaddr+0x4); outb(0xaa, ioaddr+0x8);
134
-    outl(0x2aaa, ioaddr+0x4); outb(0x55, ioaddr+0x8);
135
-    outl(0x5555, ioaddr+0x4); outb(0x80, ioaddr+0x8);
136
-    outl(0x5555, ioaddr+0x4); outb(0xaa, ioaddr+0x8);
137
-    outl(0x2aaa, ioaddr+0x4); outb(0x55, ioaddr+0x8);
138
-    outl(0x5555, ioaddr+0x4); outb(0x10, ioaddr+0x8);
139
-    /* Wait a bit. */
140
-    sleep(1);
141
-    /* Write out an informative message. */
142
-    printf("Bios ROM at %04x has been erased: Success\n", ioaddr);
143
-  }
144
-  /*
145
-   * "prog": program the 512 Kbit ROM.
146
-   */
147
-  else if (strcmp(argv[2], "prog") == 0) {
148
-    /* Loop over the bytes in pages, to
149
-       _ allow for a progress report. */
150
-    for (j = 0; j < 512; j++) {
151
-      for (i = 0; i < 128; i++) {
152
-	/* If this program is to run on a diskless node,
153
-	   _ must read in the byte _before_ changing the
154
-	   _ mode of the chip, or NFS may block. */
155
-	n = read(0, &b, 1);
156
-	/* At EOF exit the inner loop. */
157
-	if (n == 0)
158
-	  break;
159
-	if (n < 0) {
160
-	  perror("Input File Error");
161
-	  exit(-3);
162
-	}
163
-	/* Disable SDP temporarily for programming a byte. */
164
-	outl(0x5555, ioaddr+0x4); outb(0xaa, ioaddr+0x8);
165
-	outl(0x2aaa, ioaddr+0x4); outb(0x55, ioaddr+0x8);
166
-	outl(0x5555, ioaddr+0x4); outb(0xA0, ioaddr+0x8);
167
-	/* Calculate the address of the byte. */
168
-	k=i+128*j;
169
-	/* Program this byte. */
170
-	outl(k, ioaddr+0x4); outb(b, ioaddr+0x8);
171
-	/* Wait for the programming of this byte to complete. */
172
-	while (inb(ioaddr+0x8) != b)
173
-	  ;
174
-      }
175
-      /* At EOF exit the outer loop. */
176
-      if (n == 0)
177
-	break;
178
-      /* Write out a progress report. */
179
-      printf("."); fflush(NULL);
180
-    }
181
-    /* Write out an informative message. */
182
-    printf("\nWrote %ld bytes to ROM: Success\n", k);
183
-  }
184
-  /*
185
-   * "prog128": this alternative is for the 2 Mbit ROM.
186
-   */
187
-  else if (strcmp(argv[2], "prog128") == 0) {
188
-    /* Loop over the accessible pages; the card can
189
-       _ access only the first half of the chip. */
190
-    for (j = 0; j < 1024; j++) {
191
-      /* If this program is to run on a diskless node,
192
-	 _ must read in the page _before_ changing the
193
-	 _ mode of the chip, or NFS may block. */
194
-      n = read(0, buf, 128);
195
-      /* At EOF exit the loop. */
196
-      if (n == 0)
197
-	break;
198
-      if (n < 0) {
199
-	perror("Input File Error");
200
-	exit(-3);
201
-      }
202
-      /* Disable SDP temporarily for programming a page. */
203
-      outl(0x5555, ioaddr+0x4); outb(0xaa, ioaddr+0x8);
204
-      outl(0x2aaa, ioaddr+0x4); outb(0x55, ioaddr+0x8);
205
-      outl(0x5555, ioaddr+0x4); outb(0xA0, ioaddr+0x8);
206
-      /* Loop over the bytes in a page. */
207
-      for (i = 0; i < n; i++) {
208
-	/* Calculate the address of the byte. */
209
-	k=i+128*j;
210
-	/* Program this byte. */
211
-	outl(k, ioaddr+0x4); outb(buf[i], ioaddr+0x8);
212
-      }
213
-      /* Wait for the programming of this page to complete. */
214
-      while (inb(ioaddr+0x8) != buf[i-1])
215
-	;
216
-      /* Write out a progress report. */
217
-      printf("."); fflush(NULL);
218
-    }
219
-    /* Write out an informative message. */
220
-    printf("\nWrote %d pages to ROM: Success\n", j);
221
-  }
222
-  /*
223
-   * "help": write out a detailed help message.
224
-   */
225
-  else if (strcmp(argv[2], "help") == 0) {
226
-    printf("This utility can be used to write data, usually boot loaders\n");
227
-    printf("  such as Etherboot, to the flash EEPROM of the 3COM models\n");
228
-    printf("  3C905C and 3C905CX network cards. You use it like this:\n");
229
-    printf("        ./cromutil ioaddr command [(>|<) file]\n");
230
-    printf("Here ioaddr is the hexadecimal I/O address of the card, such\n");
231
-    printf("  as 0xA123, in some cases you need input/output redirection\n");
232
-    printf("  from/to a file, and the command can be one of these:\n");
233
-    printf("  id               get the ID numbers of the card;\n");
234
-    printf("  read > file      read the contents of the ROM into a file;\n");
235
-    printf("  read128 > file   read the contents of the ROM into a file;\n");
236
-    printf("  erase            erase the whole ROM to the 1 state;\n");
237
-    printf("  prog < file      write the contents of a file into the ROM;\n");
238
-    printf("  prog128 < file   write the contents of a file into the ROM.\n");
239
-    printf("You can get the I/O address of the card using the commands\n");
240
-    printf("  'lspci -v', 'cat /proc/pci', or 'dmesg | grep -i 3C905C'.\n");
241
-    printf("The read and prog commands are to be used if the card has a\n");
242
-    printf("  traditional 512 Kb (64 KB) flash EEPROM chip, such as:\n");
243
-    printf("  | AT49BV512 | SST39VF512 |\n");
244
-    printf("The read128 and prog128 versions are for cards with a 2 Mb\n");
245
-    printf("  (128 KB usable) page-write flash EEPROM chip, such as:\n");
246
-    printf("  | SST29EE020 |\n");
247
-  }
248
-  /*
249
-   * Write out the usage message if an unknown command is used.
250
-   */
251
-  else {
252
-    printf("Usage: ./cromutil ioaddr command [(>|<) file]\n");
253
-    printf("(try './cromutil 0x0000 help' for details)\n");
254
-    exit(-1);
255
-  }
256
-  return 0;
257
-}
258
-
259
-#endif /* __i386__ */

+ 0
- 104
contrib/3c90xutil/ocromutil.c 查看文件

@@ -1,104 +0,0 @@
1
-/*
2
- * 3c905cutil.c - perform various control ops on the 3C905C bios rom
3
- *             which we assume to be an AT49BV512
4
- *
5
- */
6
-
7
-#ifndef __i386__
8
-#  error "This program can't compile or run on non-intel computers"
9
-#else
10
-
11
-#include <stdio.h>
12
-#include <stdlib.h>
13
-#include <unistd.h>
14
-#include <sys/io.h>
15
-#include <string.h>
16
-
17
-int main(int argc, char **argv)
18
-{
19
-  unsigned int ioaddr, i, n;
20
-  unsigned char b;
21
-
22
-  setuid(0); /* if we're setuid, do it really */
23
-  if (argc != 3) {
24
-    printf("Usage: romid ioaddr [erase|id|read >file|prog <file]\n");
25
-    exit(-1);
26
-  }
27
-  if (iopl(3)) {
28
-    perror("iopl()");
29
-    exit(1);
30
-  }
31
-  sscanf(argv[1],"%x",&ioaddr);
32
-
33
-  /* Set the register window to 0 for the 3C905C */
34
-  outw(0x800, ioaddr+0xe);
35
-
36
-  if (strcmp(argv[2], "erase") == 0) {
37
-    /* do the funky chicken to erase the rom contents */
38
-    outl(0x5555, ioaddr+0x4);
39
-    outb(0xaa, ioaddr+0x8);
40
-    outl(0x2aaa, ioaddr+0x4);
41
-    outb(0x55, ioaddr+0x8);
42
-    outl(0x5555, ioaddr+0x4);
43
-    outb(0x80, ioaddr+0x8);
44
-    outl(0x5555, ioaddr+0x4);
45
-    outb(0xaa, ioaddr+0x8);
46
-    outl(0x2aaa, ioaddr+0x4);
47
-    outb(0x55, ioaddr+0x8);
48
-    outl(0x5555, ioaddr+0x4);
49
-    outb(0x10, ioaddr+0x8);
50
-    sleep (1);
51
-    printf("Bios ROM at %04x has been erased\n", ioaddr);
52
-  } else if (strcmp(argv[2], "id") == 0) {
53
-    outl(0x5555, ioaddr+0x4);
54
-    outb(0xaa, ioaddr+0x8);
55
-    outl(0x2aaa, ioaddr+0x4);
56
-    outb(0x55, ioaddr+0x8);
57
-    outl(0x5555, ioaddr+0x4);
58
-    outb(0x90, ioaddr+0x8);
59
-    /* 10ms delay needed */
60
-    printf("Manufacturer ID - ");
61
-    /* manuf. id */
62
-    outl(0x0000, ioaddr+0x4);
63
-    printf("%02x\n", inb(ioaddr+0x8));
64
-    /* device id */
65
-    outl(0x0001, ioaddr+0x4);
66
-    printf("Device ID - %02x\n", inb(ioaddr+0x8));
67
-    /* undo the funky chicken */
68
-    outl(0x5555, ioaddr+0x4);
69
-    outb(0xaa, ioaddr+0x8);
70
-    outl(0x2aaa, ioaddr+0x4);
71
-    outb(0x55, ioaddr+0x8);
72
-    outl(0x5555, ioaddr+0x4);
73
-    outb(0xf0, ioaddr+0x8);
74
-  } else if (strcmp(argv[2], "read") == 0) {
75
-    for (i = 0; i < 65536; i++) {
76
-      outl(i, ioaddr+0x4);
77
-      b = inb(ioaddr+0x8);
78
-      write(1, &b, 1);
79
-    }
80
-  } else if (strcmp(argv[2], "prog") == 0) {
81
-    for (i = 0; i < 65536; i++) {
82
-      n = read(0, &b, 1);
83
-      if (n == 0)
84
-	break;
85
-      if (n < 0) {
86
-	perror("File Error");
87
-	exit(-3);
88
-      }
89
-      outl(0x5555, ioaddr+0x4);
90
-      outb(0xaa, ioaddr+0x8);
91
-      outl(0x2aaa, ioaddr+0x4);
92
-      outb(0x55, ioaddr+0x8);
93
-      outl(0x5555, ioaddr+0x4);
94
-      outb(0xA0, ioaddr+0x8);
95
-      outl(i, ioaddr+0x4);
96
-      outb(b, ioaddr+0x8);
97
-      while (inb(ioaddr+0x8) != b)
98
-	;
99
-    }
100
-  }
101
-  return 0;
102
-}
103
-
104
-#endif /* __i386__ */

+ 0
- 36
contrib/3c90xutil/romutil.txt 查看文件

@@ -1,36 +0,0 @@
1
-I wrote the attached little util program to try out the basic approach
2
-and thought that you might find it useful as well as providing some
3
-simple testing. It isn't a final solution so the interface is rough. The
4
-program must be run as root on an Intel based machine.
5
-
6
-The key point is that the IO address needs to be entered - I grab it
7
-from the dmesg output:
8
-
9
-eth0: 3Com 3c905B Cyclone 100baseTx at 0xe400,  00:10:4b:d2:5e:0d, IRQ
10
-11
11
-
12
-or "cat /proc/pci" to find the "I/O at XXXXXX" for your 3Com Card.
13
-
14
-Some example commands are:
15
-
16
-romutil 0xe400 erase            - erases the ROM contents
17
-romutil 0xe400 protect            - enables the Software Data Protection
18
-on the ROM [3c905B only]
19
-romutil 0xe400 unprotect       - disables the Software Data Protection
20
-on the ROM [3c905B only]
21
-romutil 0xe400 id                    - displays the manufacturer and
22
-device IDs
23
-romutil 0xe400 read >file    - writes the contents of the ROM to stdout
24
-romutil 0xe400 prog <file    - writes the contents of the stdin into the
25
-ROM (<64k)
26
-
27
-I tried reading and writing the ROM while doing large ftp transfers and
28
-experienced no problems. I didn't spend much time worrying about the
29
-possible race conditions. My system has lots of resources (450MHx P2,
30
-128MB RAM) so it might not provide the best test candidate.
31
-
32
-Let me know what results you get if you try it out.
33
-
34
-Thanks
35
-
36
-John

+ 0
- 537
contrib/Diskless-From-NT/Config.txt 查看文件

@@ -1,537 +0,0 @@
1
-#
2
-# Automatically generated make config: don't edit
3
-#
4
-CONFIG_X86=y
5
-CONFIG_ISA=y
6
-# CONFIG_SBUS is not set
7
-CONFIG_UID16=y
8
-
9
-#
10
-# Code maturity level options
11
-#
12
-CONFIG_EXPERIMENTAL=y
13
-
14
-#
15
-# Loadable module support
16
-#
17
-CONFIG_MODULES=y
18
-# CONFIG_MODVERSIONS is not set
19
-# CONFIG_KMOD is not set
20
-
21
-#
22
-# Processor type and features
23
-#
24
-CONFIG_M386=y
25
-# CONFIG_M486 is not set
26
-# CONFIG_M586 is not set
27
-# CONFIG_M586TSC is not set
28
-# CONFIG_M586MMX is not set
29
-# CONFIG_M686 is not set
30
-# CONFIG_M686FXSR is not set
31
-# CONFIG_MPENTIUM4 is not set
32
-# CONFIG_MK6 is not set
33
-# CONFIG_MK7 is not set
34
-# CONFIG_MCRUSOE is not set
35
-# CONFIG_MWINCHIPC6 is not set
36
-# CONFIG_MWINCHIP2 is not set
37
-# CONFIG_MWINCHIP3D is not set
38
-# CONFIG_X86_CMPXCHG is not set
39
-CONFIG_X86_L1_CACHE_SHIFT=4
40
-# CONFIG_TOSHIBA is not set
41
-# CONFIG_MICROCODE is not set
42
-# CONFIG_X86_MSR is not set
43
-# CONFIG_X86_CPUID is not set
44
-CONFIG_NOHIGHMEM=y
45
-# CONFIG_HIGHMEM4G is not set
46
-# CONFIG_HIGHMEM64G is not set
47
-CONFIG_MATH_EMULATION=y
48
-CONFIG_MTRR=y
49
-# CONFIG_SMP is not set
50
-# CONFIG_X86_UP_IOAPIC is not set
51
-
52
-#
53
-# General setup
54
-#
55
-CONFIG_NET=y
56
-# CONFIG_VISWS is not set
57
-CONFIG_PCI=y
58
-# CONFIG_PCI_GOBIOS is not set
59
-# CONFIG_PCI_GODIRECT is not set
60
-CONFIG_PCI_GOANY=y
61
-CONFIG_PCI_BIOS=y
62
-CONFIG_PCI_DIRECT=y
63
-# CONFIG_PCI_NAMES is not set
64
-CONFIG_EISA=y
65
-# CONFIG_MCA is not set
66
-CONFIG_HOTPLUG=y
67
-
68
-#
69
-# PCMCIA/CardBus support
70
-#
71
-# CONFIG_PCMCIA is not set
72
-CONFIG_SYSVIPC=y
73
-# CONFIG_BSD_PROCESS_ACCT is not set
74
-CONFIG_SYSCTL=y
75
-CONFIG_KCORE_ELF=y
76
-# CONFIG_KCORE_AOUT is not set
77
-# CONFIG_BINFMT_AOUT is not set
78
-CONFIG_BINFMT_ELF=y
79
-CONFIG_BINFMT_MISC=m
80
-CONFIG_PM=y
81
-# CONFIG_ACPI is not set
82
-# CONFIG_APM is not set
83
-
84
-#
85
-# Memory Technology Devices (MTD)
86
-#
87
-# CONFIG_MTD is not set
88
-
89
-#
90
-# Parallel port support
91
-#
92
-CONFIG_PARPORT=y
93
-CONFIG_PARPORT_PC=y
94
-CONFIG_PARPORT_PC_FIFO=y
95
-# CONFIG_PARPORT_PC_SUPERIO is not set
96
-# CONFIG_PARPORT_AMIGA is not set
97
-# CONFIG_PARPORT_MFC3 is not set
98
-# CONFIG_PARPORT_ATARI is not set
99
-# CONFIG_PARPORT_SUNBPP is not set
100
-# CONFIG_PARPORT_OTHER is not set
101
-# CONFIG_PARPORT_1284 is not set
102
-
103
-#
104
-# Plug and Play configuration
105
-#
106
-# CONFIG_PNP is not set
107
-
108
-#
109
-# Block devices
110
-#
111
-CONFIG_BLK_DEV_FD=m
112
-# CONFIG_BLK_DEV_XD is not set
113
-# CONFIG_PARIDE is not set
114
-# CONFIG_BLK_CPQ_DA is not set
115
-# CONFIG_BLK_CPQ_CISS_DA is not set
116
-# CONFIG_BLK_DEV_DAC960 is not set
117
-# CONFIG_BLK_DEV_LOOP is not set
118
-# CONFIG_BLK_DEV_NBD is not set
119
-CONFIG_BLK_DEV_RAM=y
120
-CONFIG_BLK_DEV_RAM_SIZE=4096
121
-# CONFIG_BLK_DEV_INITRD is not set
122
-
123
-#
124
-# Multi-device support (RAID and LVM)
125
-#
126
-# CONFIG_MD is not set
127
-
128
-#
129
-# Networking options
130
-#
131
-# CONFIG_PACKET is not set
132
-# CONFIG_NETLINK is not set
133
-# CONFIG_NETFILTER is not set
134
-# CONFIG_FILTER is not set
135
-CONFIG_UNIX=y
136
-CONFIG_INET=y
137
-# CONFIG_IP_MULTICAST is not set
138
-# CONFIG_IP_ADVANCED_ROUTER is not set
139
-CONFIG_IP_PNP=y
140
-# CONFIG_IP_PNP_BOOTP is not set
141
-# CONFIG_IP_PNP_RARP is not set
142
-# CONFIG_NET_IPIP is not set
143
-# CONFIG_NET_IPGRE is not set
144
-# CONFIG_INET_ECN is not set
145
-# CONFIG_SYN_COOKIES is not set
146
-# CONFIG_IPV6 is not set
147
-# CONFIG_KHTTPD is not set
148
-# CONFIG_ATM is not set
149
-
150
-#
151
-#  
152
-#
153
-# CONFIG_IPX is not set
154
-# CONFIG_ATALK is not set
155
-# CONFIG_DECNET is not set
156
-# CONFIG_BRIDGE is not set
157
-# CONFIG_X25 is not set
158
-# CONFIG_LAPB is not set
159
-# CONFIG_LLC is not set
160
-# CONFIG_NET_DIVERT is not set
161
-# CONFIG_ECONET is not set
162
-# CONFIG_WAN_ROUTER is not set
163
-# CONFIG_NET_FASTROUTE is not set
164
-# CONFIG_NET_HW_FLOWCONTROL is not set
165
-
166
-#
167
-# QoS and/or fair queueing
168
-#
169
-# CONFIG_NET_SCHED is not set
170
-
171
-#
172
-# Telephony Support
173
-#
174
-# CONFIG_PHONE is not set
175
-
176
-#
177
-# ATA/IDE/MFM/RLL support
178
-#
179
-# CONFIG_IDE is not set
180
-# CONFIG_BLK_DEV_IDE_MODES is not set
181
-# CONFIG_BLK_DEV_HD is not set
182
-
183
-#
184
-# SCSI support
185
-#
186
-# CONFIG_SCSI is not set
187
-
188
-#
189
-# IEEE 1394 (FireWire) support
190
-#
191
-# CONFIG_IEEE1394 is not set
192
-
193
-#
194
-# I2O device support
195
-#
196
-# CONFIG_I2O is not set
197
-
198
-#
199
-# Network device support
200
-#
201
-CONFIG_NETDEVICES=y
202
-
203
-#
204
-# ARCnet devices
205
-#
206
-# CONFIG_ARCNET is not set
207
-# CONFIG_DUMMY is not set
208
-# CONFIG_BONDING is not set
209
-# CONFIG_EQUALIZER is not set
210
-# CONFIG_TUN is not set
211
-# CONFIG_NET_SB1000 is not set
212
-
213
-#
214
-# Ethernet (10 or 100Mbit)
215
-#
216
-CONFIG_NET_ETHERNET=y
217
-# CONFIG_NET_VENDOR_3COM is not set
218
-# CONFIG_LANCE is not set
219
-# CONFIG_NET_VENDOR_SMC is not set
220
-# CONFIG_NET_VENDOR_RACAL is not set
221
-# CONFIG_AT1700 is not set
222
-# CONFIG_DEPCA is not set
223
-# CONFIG_HP100 is not set
224
-CONFIG_NET_ISA=y
225
-# CONFIG_E2100 is not set
226
-# CONFIG_EEXPRESS is not set
227
-# CONFIG_EEXPRESS_PRO is not set
228
-# CONFIG_HPLAN_PLUS is not set
229
-# CONFIG_HPLAN is not set
230
-# CONFIG_ETH16I is not set
231
-CONFIG_NE2000=y
232
-# CONFIG_SK_G16 is not set
233
-# CONFIG_NET_PCI is not set
234
-# CONFIG_NET_POCKET is not set
235
-
236
-#
237
-# Ethernet (1000 Mbit)
238
-#
239
-# CONFIG_ACENIC is not set
240
-# CONFIG_HAMACHI is not set
241
-# CONFIG_YELLOWFIN is not set
242
-# CONFIG_SK98LIN is not set
243
-# CONFIG_FDDI is not set
244
-# CONFIG_HIPPI is not set
245
-# CONFIG_PLIP is not set
246
-# CONFIG_PPP is not set
247
-# CONFIG_SLIP is not set
248
-
249
-#
250
-# Wireless LAN (non-hamradio)
251
-#
252
-# CONFIG_NET_RADIO is not set
253
-
254
-#
255
-# Token Ring devices
256
-#
257
-# CONFIG_TR is not set
258
-# CONFIG_NET_FC is not set
259
-# CONFIG_RCPCI is not set
260
-# CONFIG_SHAPER is not set
261
-
262
-#
263
-# Wan interfaces
264
-#
265
-# CONFIG_WAN is not set
266
-
267
-#
268
-# Amateur Radio support
269
-#
270
-# CONFIG_HAMRADIO is not set
271
-
272
-#
273
-# IrDA (infrared) support
274
-#
275
-# CONFIG_IRDA is not set
276
-
277
-#
278
-# ISDN subsystem
279
-#
280
-# CONFIG_ISDN is not set
281
-
282
-#
283
-# Old CD-ROM drivers (not SCSI, not IDE)
284
-#
285
-# CONFIG_CD_NO_IDESCSI is not set
286
-
287
-#
288
-# Input core support
289
-#
290
-# CONFIG_INPUT is not set
291
-
292
-#
293
-# Character devices
294
-#
295
-CONFIG_VT=y
296
-CONFIG_VT_CONSOLE=y
297
-CONFIG_SERIAL=y
298
-# CONFIG_SERIAL_CONSOLE is not set
299
-# CONFIG_SERIAL_EXTENDED is not set
300
-# CONFIG_SERIAL_NONSTANDARD is not set
301
-CONFIG_UNIX98_PTYS=y
302
-CONFIG_UNIX98_PTY_COUNT=256
303
-CONFIG_PRINTER=m
304
-# CONFIG_LP_CONSOLE is not set
305
-# CONFIG_PPDEV is not set
306
-
307
-#
308
-# I2C support
309
-#
310
-# CONFIG_I2C is not set
311
-
312
-#
313
-# Mice
314
-#
315
-# CONFIG_BUSMOUSE is not set
316
-CONFIG_MOUSE=y
317
-CONFIG_PSMOUSE=y
318
-# CONFIG_82C710_MOUSE is not set
319
-# CONFIG_PC110_PAD is not set
320
-
321
-#
322
-# Joysticks
323
-#
324
-
325
-#
326
-# Game port support
327
-#
328
-
329
-#
330
-# Gameport joysticks
331
-#
332
-
333
-#
334
-# Serial port support
335
-#
336
-
337
-#
338
-# Serial port joysticks
339
-#
340
-
341
-#
342
-# Parallel port joysticks
343
-#
344
-# CONFIG_QIC02_TAPE is not set
345
-
346
-#
347
-# Watchdog Cards
348
-#
349
-# CONFIG_WATCHDOG is not set
350
-# CONFIG_INTEL_RNG is not set
351
-# CONFIG_NVRAM is not set
352
-# CONFIG_RTC is not set
353
-# CONFIG_DTLK is not set
354
-# CONFIG_R3964 is not set
355
-# CONFIG_APPLICOM is not set
356
-
357
-#
358
-# Ftape, the floppy tape device driver
359
-#
360
-# CONFIG_FTAPE is not set
361
-CONFIG_AGP=m
362
-CONFIG_AGP_INTEL=y
363
-CONFIG_AGP_I810=y
364
-CONFIG_AGP_VIA=y
365
-# CONFIG_AGP_AMD is not set
366
-# CONFIG_AGP_SIS is not set
367
-# CONFIG_AGP_ALI is not set
368
-# CONFIG_DRM is not set
369
-
370
-#
371
-# Multimedia devices
372
-#
373
-# CONFIG_VIDEO_DEV is not set
374
-
375
-#
376
-# File systems
377
-#
378
-# CONFIG_QUOTA is not set
379
-# CONFIG_AUTOFS_FS is not set
380
-# CONFIG_AUTOFS4_FS is not set
381
-# CONFIG_ADFS_FS is not set
382
-# CONFIG_AFFS_FS is not set
383
-# CONFIG_HFS_FS is not set
384
-# CONFIG_BFS_FS is not set
385
-CONFIG_FAT_FS=m
386
-CONFIG_MSDOS_FS=m
387
-# CONFIG_UMSDOS_FS is not set
388
-CONFIG_VFAT_FS=m
389
-# CONFIG_EFS_FS is not set
390
-CONFIG_JFFS_FS_VERBOSE=0
391
-# CONFIG_CRAMFS is not set
392
-# CONFIG_RAMFS is not set
393
-# CONFIG_ISO9660_FS is not set
394
-# CONFIG_MINIX_FS is not set
395
-# CONFIG_NTFS_FS is not set
396
-# CONFIG_HPFS_FS is not set
397
-CONFIG_PROC_FS=y
398
-CONFIG_DEVFS_FS=y
399
-CONFIG_DEVFS_MOUNT=y
400
-# CONFIG_DEVFS_DEBUG is not set
401
-# CONFIG_DEVPTS_FS is not set
402
-# CONFIG_QNX4FS_FS is not set
403
-# CONFIG_ROMFS_FS is not set
404
-CONFIG_EXT2_FS=y
405
-# CONFIG_SYSV_FS is not set
406
-# CONFIG_UDF_FS is not set
407
-# CONFIG_UFS_FS is not set
408
-
409
-#
410
-# Network File Systems
411
-#
412
-# CONFIG_CODA_FS is not set
413
-CONFIG_NFS_FS=y
414
-CONFIG_NFS_V3=y
415
-CONFIG_ROOT_NFS=y
416
-# CONFIG_NFSD is not set
417
-CONFIG_SUNRPC=y
418
-CONFIG_LOCKD=y
419
-CONFIG_LOCKD_V4=y
420
-# CONFIG_SMB_FS is not set
421
-# CONFIG_NCP_FS is not set
422
-
423
-#
424
-# Partition Types
425
-#
426
-# CONFIG_PARTITION_ADVANCED is not set
427
-CONFIG_MSDOS_PARTITION=y
428
-# CONFIG_SMB_NLS is not set
429
-CONFIG_NLS=y
430
-
431
-#
432
-# Native Language Support
433
-#
434
-CONFIG_NLS_DEFAULT="iso8859-1"
435
-# CONFIG_NLS_CODEPAGE_437 is not set
436
-# CONFIG_NLS_CODEPAGE_737 is not set
437
-# CONFIG_NLS_CODEPAGE_775 is not set
438
-# CONFIG_NLS_CODEPAGE_850 is not set
439
-# CONFIG_NLS_CODEPAGE_852 is not set
440
-# CONFIG_NLS_CODEPAGE_855 is not set
441
-# CONFIG_NLS_CODEPAGE_857 is not set
442
-# CONFIG_NLS_CODEPAGE_860 is not set
443
-# CONFIG_NLS_CODEPAGE_861 is not set
444
-# CONFIG_NLS_CODEPAGE_862 is not set
445
-# CONFIG_NLS_CODEPAGE_863 is not set
446
-# CONFIG_NLS_CODEPAGE_864 is not set
447
-# CONFIG_NLS_CODEPAGE_865 is not set
448
-# CONFIG_NLS_CODEPAGE_866 is not set
449
-# CONFIG_NLS_CODEPAGE_869 is not set
450
-# CONFIG_NLS_CODEPAGE_874 is not set
451
-# CONFIG_NLS_CODEPAGE_932 is not set
452
-# CONFIG_NLS_CODEPAGE_936 is not set
453
-# CONFIG_NLS_CODEPAGE_949 is not set
454
-# CONFIG_NLS_CODEPAGE_950 is not set
455
-CONFIG_NLS_ISO8859_1=m
456
-# CONFIG_NLS_ISO8859_2 is not set
457
-# CONFIG_NLS_ISO8859_3 is not set
458
-# CONFIG_NLS_ISO8859_4 is not set
459
-# CONFIG_NLS_ISO8859_5 is not set
460
-# CONFIG_NLS_ISO8859_6 is not set
461
-# CONFIG_NLS_ISO8859_7 is not set
462
-# CONFIG_NLS_ISO8859_8 is not set
463
-# CONFIG_NLS_ISO8859_9 is not set
464
-# CONFIG_NLS_ISO8859_14 is not set
465
-# CONFIG_NLS_ISO8859_15 is not set
466
-# CONFIG_NLS_KOI8_R is not set
467
-# CONFIG_NLS_UTF8 is not set
468
-
469
-#
470
-# Console drivers
471
-#
472
-CONFIG_VGA_CONSOLE=y
473
-# CONFIG_VIDEO_SELECT is not set
474
-# CONFIG_MDA_CONSOLE is not set
475
-
476
-#
477
-# Frame-buffer support
478
-#
479
-# CONFIG_FB is not set
480
-
481
-#
482
-# Sound
483
-#
484
-CONFIG_SOUND=m
485
-# CONFIG_SOUND_CMPCI is not set
486
-# CONFIG_SOUND_EMU10K1 is not set
487
-# CONFIG_SOUND_FUSION is not set
488
-# CONFIG_SOUND_CS4281 is not set
489
-# CONFIG_SOUND_ES1370 is not set
490
-CONFIG_SOUND_ES1371=m
491
-# CONFIG_SOUND_ESSSOLO1 is not set
492
-# CONFIG_SOUND_MAESTRO is not set
493
-# CONFIG_SOUND_SONICVIBES is not set
494
-# CONFIG_SOUND_TRIDENT is not set
495
-# CONFIG_SOUND_MSNDCLAS is not set
496
-# CONFIG_SOUND_MSNDPIN is not set
497
-CONFIG_SOUND_VIA82CXXX=m
498
-CONFIG_SOUND_OSS=m
499
-# CONFIG_SOUND_TRACEINIT is not set
500
-# CONFIG_SOUND_DMAP is not set
501
-# CONFIG_SOUND_AD1816 is not set
502
-# CONFIG_SOUND_SGALAXY is not set
503
-# CONFIG_SOUND_ADLIB is not set
504
-# CONFIG_SOUND_ACI_MIXER is not set
505
-# CONFIG_SOUND_CS4232 is not set
506
-# CONFIG_SOUND_SSCAPE is not set
507
-# CONFIG_SOUND_GUS is not set
508
-# CONFIG_SOUND_ICH is not set
509
-# CONFIG_SOUND_VMIDI is not set
510
-# CONFIG_SOUND_TRIX is not set
511
-# CONFIG_SOUND_MSS is not set
512
-# CONFIG_SOUND_MPU401 is not set
513
-# CONFIG_SOUND_NM256 is not set
514
-# CONFIG_SOUND_MAD16 is not set
515
-# CONFIG_SOUND_PAS is not set
516
-# CONFIG_SOUND_PSS is not set
517
-CONFIG_SOUND_SB=m
518
-# CONFIG_SOUND_AWE32_SYNTH is not set
519
-# CONFIG_SOUND_WAVEFRONT is not set
520
-# CONFIG_SOUND_MAUI is not set
521
-CONFIG_SOUND_YM3812=m
522
-# CONFIG_SOUND_OPL3SA1 is not set
523
-# CONFIG_SOUND_OPL3SA2 is not set
524
-# CONFIG_SOUND_YMPCI is not set
525
-# CONFIG_SOUND_YMFPCI is not set
526
-# CONFIG_SOUND_UART6850 is not set
527
-# CONFIG_SOUND_AEDSP16 is not set
528
-
529
-#
530
-# USB support
531
-#
532
-# CONFIG_USB is not set
533
-
534
-#
535
-# Kernel hacking
536
-#
537
-# CONFIG_MAGIC_SYSRQ is not set

+ 0
- 565
contrib/Diskless-From-NT/Diskless-From-NT.txt 查看文件

@@ -1,565 +0,0 @@
1
-
2
-
3
-The Diskless Terminal running from NT server Mini-HOWTO
4
-Pavel Tkatchouk, ptkatcho@portal.ca
5
-v0.1, June 19th 1999
6
-
7
-Table of Contents
8
-
9
-1. Introduction.
10
-
11
-   1.1 What is it for?
12
-   1.2 Do we need this HOWTO?
13
-   1.3 A bit of History.
14
-
15
-2. Project description.
16
-
17
-   2.1 Packaging.
18
-   2.2 Image.
19
-      2.2.1 Kernel.
20
-      2.2.2 MRFS.
21
-      2.2.3 Building MRFS.
22
-   2.3 Remotefs.
23
-   2.4 Booting sequence.
24
-      2.4.1 BOOTP, TFTP.
25
-   2.5 Bootprom.
26
-
27
-3. Resources.
28
-
29
-4. Copyright.
30
-
31
-5. Feedback and credits.
32
-
33
-
34
-1. Introduction.
35
-
36
-
37
-1.1. What is it for?
38
-
39
-This document describes how to build software distribution to run Java client on diskless 
40
-terminal booted from Microsoft Windows 95/98/NT workstation. Package can also be easily 
41
-modified to be used as Linux terminal or X Windows terminal's software. I found it also 
42
-convenient for setup over the Ethernet of floppyless PS's, hard disk of which for some 
43
-reason can not be accessed (sealed case under warranty, etc.).
44
-
45
-
46
-1.2. Do we need this HOWTO?
47
-
48
-To be honest, I'm not sure. There are few excellent HOWTO's (see 3. Recources) that up until 
49
-recently I considered quite sufficient to build what I've done two years ago. But since my 
50
-project uses MS Windows as a file server vs. traditional NFS there were some know-how's 
51
-involved which number of people wanted to see in some formal document.
52
-
53
-
54
-1.3. A bit of history.
55
-
56
-My project at that time (1996) was to find OS/JVM that will allow to run Java application 
57
-on hardware we manufacture. Hardware is practically generic x86 PC except it has no keyboard, 
58
-hard drive, floppy drive, mouse, but touchscreen over LCD, plus some POS specific peripherals 
59
-(badge reader, credit card reader, etc.). Due to cost consideration it had no any significant 
60
-storage, so OS and Java client along with support binaries, libraries etc. had to be loaded 
61
-remotely. Because our clients are exclusively Windows shops, Server had to be Windows as well. 
62
-During evaluation of different commercial OS'es along with JVM's available it become apparent 
63
-to my surprise that most promising solution was GPL one - Linux.
64
-
65
-
66
-2. Project description.
67
-
68
-2.1. Packaging.
69
-
70
-The whole distribution consists of remote file system (RemoteFS) residing on MS Windows
71
-server (NT Workstation, NT Server or Windows9x) and tagged bootable image. 
72
-
73
-
74
-2.2. Image.
75
-
76
-Image (~1.5MB) is generated by mknbi utility that comes with Etherboot package
77
-<http://etherboot.sourceforge.net>. It can include minimal root file system (MRFS) 
78
-like in my case (since I had to boot client from MS Windows server and Linux kernel doesn't 
79
-support SMBFS-Root, only NFS-Root. So I had to keep rootfs in the ramdisk). To generate 
80
-image the following script can be used.
81
-
82
-#!/bin/sh
83
-# mkrootnet: makes tagged netbootable image
84
-# This image includes kernel and minimal root filesystem
85
-# to do initial boot.
86
-#
87
-# Copyright (c) Pavel Tkatchouk 1996. All rights reserved.
88
-# Permission is granted for this material to be freely
89
-# used and distributed, provided the source is acknowledged.
90
-# No warranty of any kind is provided. You use this material
91
-# at your own risk.
92
-#
93
-DEVICEFILENAME="/tmp/file"		# temporary file to be used as device
94
-FSBLOCKS=4096   				# uncompressed filesystem size in K
95
-BOOTDISKDIR="/usr/BOOT/ROOTFS"	# root filesystem model
96
-MOUNT="/mnt2"				# temporary mount point
97
-ROOTFS="/tmp/rootfs"			# root filesystem image
98
-ROOTFSGZ="/tmp/rootfs.gz"		# compressed root filesystem image
99
-KERNEL="/usr/KERNELS/vmlinuz-nt"	# kernel image
100
-KERNELTMP="/tmp/vmlinuz"		# temporary copy of kernel image
101
-BOOTIMAGE="/tmp/img"			# tagged image to be booted by client
102
-# if you want ramisk more than default 4096 set CMDLINE, don't forget to
103
-# adjust $FSBLOCKS 
104
-# CMDLINE="ramdisk_size=8192"		# parameters to pass to the kernel
105
-# 
106
-echo "check:"
107
-echo "- if tftp server's download dir mounted to /mnt"
108
-echo "- loopback device is built-in or loaded"
109
-echo "\n press Enter when done"
110
-read tmp 
111
-UPLOAD="/mnt/tmp"				# tftp server's dir to upload bootimage
112
-echo -e "\nZeroing $DEVICEFILENAME of $FSBLOCKS k"
113
-echo "to be used as device for root filesystem model"
114
-dd if=/dev/zero of=$DEVICEFILENAME bs=1k count=$FSBLOCKS
115
-echo -e "\nMaking file system on $DEVICEFILENAME"
116
-mke2fs -m 0 $DEVICEFILENAME
117
-echo "Mounting $DEVICEFILENAME as a loopback device"
118
-mount -o loop -t ext2 $DEVICEFILENAME $MOUNT
119
-curdir=`pwd`
120
-cd $BOOTDISKDIR
121
-echo -e "Copying files from $BOOTDISKDIR to $DEVICEFILENAME, please wait"
122
-find . -print|cpio -pmd $MOUNT
123
-echo "Unmounting $MOUNT"
124
-umount $MOUNT
125
-cd $curdir
126
-echo "Copying $DEVICEFILENAME to $ROOTFS"
127
-dd if=$DEVICEFILENAME of=$ROOTFS bs=1k
128
-echo "Compressing $ROOTFS, it may take a while"
129
-echo "Please wait..."
130
-if [ -f $ROOTFSGZ ];then
131
-	rm -f $ROOTFSGZ
132
-fi
133
-gzip -c $ROOTFS>$ROOTFSGZ
134
-rm -f $ROOTFS
135
-echo -e "\nCreating netbootable image"
136
-cp $KERNEL $KERNELTMP
137
-mknbi -d ram -i rom -r $ROOTFSGZ -k $KERNELTMP -a $CMDLINE -o $BOOTIMAGE
138
-echo "Uploading $BOOTIMAGE to $UPLOAD"
139
-cp $BOOTIMAGE $UPLOAD
140
-echo "Cleaning after ourselves"
141
-rm -f $KERNELTMP $DEVICEFILENAME $BOOTIMAGE
142
-echo "All done"
143
-
144
-
145
-In the above script actual image is generated by the following comand
146
-
147
-#mknbi -d ram -i rom -r rootfs.gz -k vmlinuz-nt -o img
148
-
149
-where:
150
-	rootfs.gz - minimal root file system (MRFS);
151
-	vmlinuz-nt   - kernel;
152
-	img       - resulting image.
153
-
154
-
155
-Note:
156
-Default ramdisk size is 4096. It was enough for RedHat4.1 based minimal file system, but 
157
-apparently not enough for 5.2 based. When this happens "end request:I/O error, dev 01:00 ..." 
158
-error shows up. To fix that either use "mknbi -a ramdisk_size=8192" to pass parameter to the 
159
-kernel (doesn't require kernel recompilation), or change /usr/src/linux/drivers/block/rd.c: 
160
-int rd_size= from 4096 to 8192 or whatever and rebuild the kernel.                                                    
161
-
162
-
163
-2.2.1. Kernel.
164
-
165
-Kernels 2.0.30 and 2.0.36 have been used by author, although nothing is preventing you from
166
-experimenting with others. Kernel should include ramdisk support. The following 
167
-<link to .config> configuration has been used to build <link to binary (kernel 2.0.30)>. 
168
-You may find some components unnecessary, just exclude them and rebuild. 
169
-
170
-Don't forget to change root device after you built the kernel (rdev vmlinuz /dev/rd).
171
-
172
-Gotcha's: apparently smbfs is broken in 2.2.x kernels. Symptoms: remote share is mounted
173
-just fine but after a while fails with "smb_request: result = -32" errmsg. I've heard
174
-SuSe has fix for that.
175
-
176
-2.2.2. MRFS.
177
-
178
-Minimal root file system is required to get Linux up and running along with networking until 
179
-it can mount remote file system to run X/Java from there. After image gets loaded from the 
180
-server MRFS is decompressed into ramdisk. If you can afford a lot of ram on your terminal the 
181
-entire remote file system can be moved to rootfs.gz. That will make your terminal more 
182
-responsive.
183
-
184
-
185
-2.2.3. Building MRFS.  
186
-
187
-Some folks found it easier to start from scratch, others use known "minimal" Linux distributions
188
-(Linux Router, tomsrtbt, etc.), yet others prefer to start from "big" Linuces like I did. Every
189
-path has it's pro and contras.
190
-
191
-Pruning standard distribution (RedHat, Debian, etc.) to your needs might be very time consuming.
192
-To ease that painful process I have used remotely booted diskless client with NFS-Root (see 
193
-Etherboot's Readme, NFS-Root and NFS-Root-Client mini-HOWTO's, Diskless-HOWTO):
194
-
195
-- setup minimal RedHat4.1 install (networked workstation, X, no development, mail, etc., ~117MB);
196
-- find . -print|cpio -pmd /usr/NFS/ROOTFS - copy entire fs tree to NFS exported dir;
197
-- mknod /usr/NFS/ROOTFS/dev/nfsroot b 0 255;
198
-- build vmlinuz-nfs kernel according to NFS-Howto (built-in bootp,rarp,NFS,NFS root,NIC 
199
-  driver,RAM disk);
200
-- rdev vmlinuz-nfs /dev/nfsroot - to set NFS root device; 
201
-- build image for NFS-Root fs:
202
-  #mknbi -d rom -i rom -k vmlinuz-nfs -o nfsImage;
203
-- boot client while monitoring NFS file requests (by Solaris snoop);
204
-- copy files from /usr/NFS/ROOTFS to /usr/BOOT/ROOTFS (MRFS model) according to snoop's
205
-  filelist;
206
-- generate image by mkrootnet script (don't forget to point to the right kernel vmlinuz-nt).
207
-
208
-The above trick not only allows to determine the sought files set but also debug boot process 
209
-analyzing NFS messages. I found it convenient to put "read tmp" statements into init scripts
210
-for debugging. Tracking files up until issuing login gives you <link to rootfs.gz> MRFS (~1MB) 
211
-that can be used to boot Linux from ROM (flash, eprom, DiskOnChip, SanDisk, etc.) as well. All 
212
-the other files requested by client (during starting X, Java, Java client) were put into (link 
213
-to remotefs.zip, ~9MB).
214
-
215
-
216
-To restore MRFS model on your PC from the above rootfs.gz:
217
-- #cd /tmp
218
-- #gunzip rootfs.gz
219
-- #mount -o loop -t ext2 /tmp/rootfs /mnt
220
-- #cd /mnt
221
-- #find . -print|cpio -pmd /usr/BOOT/ROOTFS
222
-- #umount /mnt
223
-
224
-Note: 
225
-
226
-You will have to change attributes of some dirs, files (/etc/mtab, /etc/mtab~, /var/lock/subsys/*, 
227
-/var/run/*, /dev/tty*, etc.) against standard. This is because with standard attribs diskless 
228
-client refused to work. For example I had to change /dev/tty* ownerships to 99:99 from original 
229
-0:0 or 0:5, to get rid of errmsg "INIT: Id "1" respawning too fast: disabled for 5 minutes". 
230
-Being admin illiterate I just chmod them to 777 and chown to 99:99 to make life easier. 
231
-THIS IS SERIOUS SECURITY VIOLATION!!! Using keyboardless terminal with no daemons running in 
232
-my case reduces the risk, yet I would appreciate very much those more experienced who will help 
233
-to restore the right attribs while keeping the distribution working.
234
-
235
-Some "gotcha's" to watch for during MRFS building:
236
-- standard attributes/ownership of some files don't work;
237
-- rdev must be set (non-tagged image didn't work, so couldn't use config file to pass parrs 
238
-  to the kernel);
239
-- diskless client writes 99:99 ownership on generated files;
240
-- "password incorrect" for root, but any other OK and su OK too.
241
-
242
-
243
-2.3. RemoteFS.
244
-
245
-Remotefs.zip file includes everything required by the system that can be located on
246
-remote file system, i.e after booting has been complete and remote file system mounted.
247
-In my case it is X Windows System and Java binaries, libraries etc. To use that file on
248
-MS Windows NT:
249
-- unzip remotefs.zip to some directory;
250
-- share this directory read-only as "usr" (or share as some other name and pass this name to
251
-  the client through bootptab configuration file for BOOTP server;
252
-- create an account username=root, password=linux on NT (can be set in bootptab).
253
-
254
-Note:
255
-There's no symbolic links on NTFS, so UNIX links must be replaced by copies on NTFS. 
256
-To determine potential troublmakers one could use the following:
257
-- first copy required subset (according to snoop's intercept) from /usr/NFS/ROOTFS to 
258
-  /usr/BOOT/REMOTEFS;
259
-- mount some share from NTFS to /mnt;
260
-- /usr/BOOT/REMOTEFS#find . -print|cpio -pmd /mnt 2>links;
261
-In the links file you will find names to work with.
262
-
263
-
264
-2.4. Booting sequence.
265
-
266
-Boot occurs in the following sequence:
267
-- bootprom sends bootp request,
268
-- bootp server responds with subnet mask, client's name, client's IP, TFTP server's IP, 
269
-  bootfile name and some optional parameters (like NT's username/password to use it's share,
270
-  you could pass some other share name here as say T104="somedir");
271
-- bootprom downloads image from TFTP server;
272
-- kernel starts;
273
-- kernel decompresses MRFS in RAM;
274
-- system starts init using ramdisk root,
275
-- mounts remote file system from NT via SMBFS;
276
-- automatically logins;
277
-- starts xstart script located on remotefs (/usr/sbin) where you can start any of your
278
-  programs, change parameters, etc. without rebuilding the image.
279
-
280
-Below are some config/init sample files from <rootfs.gz>, <remotefs.zip>:
281
-
282
-<bootptab, change to link>
283
-t1:sm=255.255.255.0:sa=192.168.33.150:bf=img:T100="pavelnt4":T101="root":T102="linux"
284
-touch1:hn=touch1:tc=t1:ha=00A0F00035CD:ip=192.168.33.127
285
-
286
-</etc/fstab, change to link>:
287
-/dev/ram  /      ext2    defaults    1 1
288
-/proc     /proc  proc    defaults    0 0
289
-
290
-</etc/rc.d/rc.bootp, change to link later>:
291
-#!/bin/sh
292
-# Written to simply set the IP stuff up from the
293
-# bootpc data.
294
-# Last updated : Mon Mar 10 15:17:01 1997
295
-#
296
-# Variables
297
-
298
-BOOTPC=/sbin/bootpc
299
-IFCONFIG=/sbin/ifconfig
300
-ROUTE=/sbin/route
301
-BINHOST=/bin/hostname
302
-DEV=eth0
303
-ASKSERVER="255.255.255.255"
304
-TW="--timeoutwait 320"
305
-RIF="--returniffail"
306
-RIFMESSAGE="Bootp failed -- disabling network."
307
-RCONF=/etc/resolv.conf
308
-EHOSTS=/etc/hosts
309
-LHOSTS=/etc/hosts.local
310
-TMPFILE=/tmp/bootp
311
-# Functions
312
-# Remove the networking by taking down the interface
313
-netdown() {
314
-  ${ROUTE} del default
315
-  ${IFCONFIG} ${DEV} down
316
-}
317
-## End of the functions
318
-
319
-## Start of the actual work
320
-# Bring up minimal networking use 0.0.0.0 as our address as we don't
321
-# know it yet (Means "Me but I don't know my address or network")
322
-${IFCONFIG} ${DEV} up 0.0.0.0
323
-${ROUTE} add default dev ${DEV}
324
-
325
-# Perform the bootp  --  doesn't return unless it gets an answer
326
-if ${BOOTPC} --dev ${DEV} --server ${ASKSERVER} ${RIF} ${TW} > ${TMPFILE}
327
-then
328
-# Take down networking (use the 0.0.0.0 for as short a time as possible)
329
-  netdown
330
-# Read in the values   
331
-  . ${TMPFILE}
332
-
333
-# To use in mountsmb script later
334
-SMBSERVER=${T100}
335
-# And delete the temporary file
336
-#  rm ${TMPFILE}
337
-else
338
-# Take down networking (use the 0.0.0.0 for as short a time as possible)
339
-  netdown
340
-# give message and quit
341
-  echo ${RIFMESSAGE}
342
-  exit 1
343
-fi
344
-
345
-# Start the loopback interface and add a route to it
346
-# It's already set by standard init?
347
-${IFCONFIG} lo 127.0.0.1
348
-${ROUTE} add -net 127.0.0.0
349
-
350
-# Setup of IP stuff needs doing first
351
-#
352
-if [ -z "${NETMASK}" ] ; then
353
-# No netmask info, all this is guessed from the IP number
354
-# If this is wrong for your network FIX the bootpd to know
355
-# what it should send in the RFC1497 cookie!  11/02/94 JSP
356
-#
357
-  ${IFCONFIG} ${DEV} up ${IPADDR} broadcast ${BROADCAST} 
358
-  ${ROUTE} -n add -net ${NETWORK} dev ${DEV}
359
-else
360
-# We will have NETMASK, BROADCAST, and NETWORK defined 
361
-  ${IFCONFIG} ${DEV} up ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK} 
362
-  ${ROUTE} -n add -net ${NETWORK} dev ${DEV}
363
-fi
364
-
365
-# Set the hostname from what we got via bootp or reverse lookup
366
-
367
-echo "127.0.0.1	loopback localhost">${EHOSTS}
368
-${BINHOST} "${HOSTNAME}"
369
-echo "${IPADDR}	${HOSTNAME}" >>${EHOSTS}
370
-echo "${SERVER} ${SMBSERVER}" >>${EHOSTS}
371
-
372
-
373
-</etc/rc.d/rc.local, change to link>:
374
-#!/bin/sh
375
-# This script will be executed *after* all the other init scripts.
376
-# You can put your own initialization stuff in here if you don't
377
-# want to do the full Sys V style init stuff.
378
-#
379
-# 07/02/97 Pavel Tkatchouk
380
-#
381
-echo "Start networking"
382
-insmod /lib/8390.o
383
-insmod /lib/ne.o io=0x300 irq=9
384
-echo "Install serial"
385
-insmod /lib/serial.o
386
-echo "Install touch"
387
-insmod /lib/touch.o
388
-echo "Install smbfs"
389
-insmod /lib/smbfs.o
390
-echo "Getting TCP/IP parameters from bootp server"
391
-echo "and start networking"
392
-/etc/rc.d/rc.bootp
393
-if [ -f /etc/squirrel-release ]; then
394
-	R=$(cat /etc/squirrel-release)
395
-else
396
-	R="release 0.02"
397
-fi
398
-echo "Mounting remote fs"
399
-/sbin/mountsmb
400
-echo "XYZ Inc. Diskless Linux $R"
401
-echo "Starting X and Java client without login"
402
-su -c /sbin/xstart root
403
-
404
-
405
-</usr/sbin/xstart, change to link>:
406
-#!/bin/bash
407
-#
408
-# Script to start X and Java client
409
-# 08/07/97 Pavel Tkatchouk
410
-#
411
-# Read bootps response first
412
-. /tmp/bootp
413
-# -s 0 to disable screen-saver
414
-/usr/X11R6/bin/X -s 0 &
415
-export DISPLAY=:0.0
416
-# /usr is share mounted from Windows workstation
417
-cd /usr/program/
418
-java SomeJavaApp 
419
-
420
-
421
-</sbin/mountsmb, change to link>:
422
-#!/bin/bash
423
-# mountsmb: mounts remote filesystems from NT workstation 
424
-# using Microsoft's SMB protocol 
425
-# 
426
-# Copyright (c) Pavel Tkatchouk 1997. All rights reserved.
427
-# Permission is granted for this material to be freely
428
-# used and distributed, provided the source is acknowledged.
429
-# No warranty of any kind is provided. You use this material
430
-# at your own risk.
431
-#
432
-# Last edit June 29 8:30 1997
433
-#
434
-MOUNTDIR="usr"
435
-SHRDIR="usr"
436
-BOOTPRES="/tmp/bootp"
437
-# Read botpc response
438
-. ${BOOTPRES}
439
-# Sharename from NT server, uncomment if you want to use 
440
-# non-hardcoded "usr" but from bootptab
441
-#SHRDIR=${T104} 
442
-SMBSRV="//${T100}"
443
-CLIENT="${HOSTNAME}"
444
-USER="${T101}"
445
-PASSWORD="${T102}"
446
-echo -e "\nMounting $SMBSRV/$SHRDIR to /$MOUNTDIR"
447
-smbmount $SMBSRV/$SHRDIR $MOUNTDIR -c $CLIENT -U $USER -P $PASSWORD
448
-echo -e "\nDone"
449
-
450
-Gotcha's:
451
-Looks like smbmount client from smbfs package used to mount remote Windows shares to local 
452
-Linux dirs in pre 2.2.x era isn't maintained anymore so you should use one coming with 
453
-Samba package. Also binary smbmount won't work with 2.2.x, so you have to recompile with 
454
-2.2.x headers following Samba's readme. Yet even that won't guarantee reliable work until
455
-somebody fixes kernel's smbfs module.
456
-
457
-2.4.1. BOOTP, TFTP.
458
-
459
-There are number of BOOTP, TFTP servers for Windows on the market. You could find them
460
-here:
461
-
462
-- www.walusoft.co.uk (Walusoft's tftp);
463
-- ftp.coast.net/simtel/nt/internet/tftpds12.zip (Millwood AB's tftp);
464
-- ftp.cabletron.com/pub/snmp/bootftp/boottft2.zip (Cabletron's bootp/tftp combo);
465
-- www.tellurian.au.com (Tellurian's bootp, tftp, dhcp servers).
466
-- www.metainfo.com (Metainfo's DHCP server)
467
-- www.nts.com (Network Telesystems's DHCP server in IPserver package)
468
-
469
-My choice was Tellurian's products - very reliable, simple to install, attractively priced
470
-(fully capable evaluation versions are available).
471
-
472
-2.5. Bootprom.
473
-
474
-Ken Yap's Etherboot <etherboot.sourceforge.net> will tell you everything about bootprom. 
475
-Here I just want to mention that normally you would have to put bootprom's code into network
476
-adapter's PROM. But if your hardware like mine has BIOS programmed in flash you could 
477
-re-program it to add bootprom (some BIOS requires special programmer to do that, others don't)
478
-as BIOS extension.
479
-
480
-This is what I did to add ne.rom (bootprom generated by Etherboot's makerom for NE2000 clone) 
481
-to AMI BIOS on my flash:
482
-
483
-- read flash content by programmer into bios.bin binary file;
484
-- use one of available binary editors (say www.simtel.net/Win95/editors/hxp3005.zip to add
485
-  ne.rom to bios.bin (and to edit ne.rom if necessary);
486
-- write new bios.bin back to flash.
487
-
488
-Notes:
489
-- makerom generates bootprom for standard EPROM sizes (8k, 16k, 32k, etc.), so if you tight on 
490
-  space use -s flag to adjust size (or cut it manually to multiple of 512 bytes blocks, just
491
-  don't forget to adjust extension's length which is coded in Byte 2 and checksum to 8 bits 
492
-  of zero;
493
-- valid absolute addresses for BIOS extensions are from 0xC8000 to 0xF4000 (check with 
494
-  motherboard's manufacturer how flash is mapped onto system memory space);
495
-- Byte 0 must be 0x55, Byte 1 must be 0xAA, Byte 2 must be extension's length in 512 bytes 
496
-  blocks;
497
-- extension BIOS has to start at a 2k boundary;
498
-
499
-
500
-3. Resources.
501
-
502
-FAQ's:
503
-- tomsrtbt.FAQ (www.toms.net);
504
-
505
-HOWTO's:
506
-- Paul Moody's miniHOWTO (www.linuxembedded.com/pmhowto.html)
507
-- Diskless;
508
-- Diskless-HOWTO;
509
-- NFS-Root;
510
-- NFS-Root-Client;
511
-- Bootdisk-HOWTO;
512
-- BootPrompt-HOWTO;
513
-- NCD-X-Terminal;
514
-- Remote-Boot;
515
-- Remote-X-Apps;
516
-
517
-Web:
518
-- etherboot.sourceforge.net/
519
-- www.waste.org/~zanshin
520
-- www.tellurian.com.au.
521
-- www.toms.net
522
-- www.trinux.org
523
-- www.linux.org.uk/ELKS-Home
524
-- www.embedded.com
525
-- www.linuxembedded.com
526
-- www.thinlinux.org
527
-- www.linuxrouter.org
528
-- linux-mandrake.com
529
-- www.disklessworkstations.com
530
-
531
-Newsgroups:
532
-- comp.arch.embedded
533
-
534
-Lists:
535
-- netboot-owner@baghira.han.de
536
-- linux-embedded@waste.org
537
-
538
-Magazines:
539
-- Circuit Cellar #100 - 105
540
-
541
-
542
-4. Copyright.
543
-
544
-Copyright (c) Pavel Tkatchouk 1999.
545
-Permission is granted for this material to be freely used and distributed, provided the source 
546
-is acknowledged. Copyright policy is GPL as published by the Free Software Foundation.
547
-
548
-No warranty of any kind is provided. You use this material at your own risk.
549
-
550
- 
551
-
552
-5. Feedback and credits.
553
-
554
-Since I am neither have a lot of Linux experience nor native English speaker, there would be 
555
-errors in this document. I would accept any help with gratitude whether in form of proof-reading, 
556
-techical corrections or otherwise. Please send your comments, suggestions and questions to Pavel 
557
-Tkatchouk (ptkatcho@portal.ca)
558
-
559
-I wish to thank Pierre Mondie who convinced me to start this document. I'm also very much in 
560
-debt to all those who's work made this project possible:
561
-
562
-Ken Yap 		<ken_yap@users.sourceforge.net>	(Etherboot)
563
-David Newall 	<www.tellurian.com.au>	(Bootpdnt/Ftpdnt)
564
-(to be continued)
565
-

+ 0
- 82
contrib/Diskless-From-NT/furtmayr.html 查看文件

@@ -1,82 +0,0 @@
1
-<html>
2
-
3
-<head>
4
-<title>Free TFTP / Syslog / NFS Servers for Windows</title>
5
-</head>
6
-
7
-<body>
8
-
9
-<h3 align="center">Free TFTP / Syslog / NFS Servers for Windows</h3>
10
-<div align="center"><center>
11
-
12
-<address>
13
-  Stefan Furtmayr (<a href="mailto:sf@paf.net">sf@paf.net</a>) 
14
-</address>
15
-</center></div>
16
-
17
-<p>Feel free to send me your comments about these programs or some additions.</p>
18
-
19
-<p>Also have a look at the <a
20
-href="http://www.ltsp.org/contrib/diskless-windows-howto.htm">&quot;Diskless Windows
21
-Cookbook &quot;</a> in the <a href="http://www.ltsp.org/contrib/">LTSP Contrib Area</a>.</p>
22
-
23
-<p><small>From this list I have only used the W2K-TFTP once for a customer with the <a
24
-href="http://support.3com.com/infodeli/tools/nic/mba.htm">3Com MBA Utility Disk</a>, while
25
-it can be used as well with <a href="http://etherboot.sourceforge.net">Etherboot</a>
26
-tagged images for other NIC brands.</small><br>
27
-<small>The solution used a netbooted DOS with MS Client 3.0 to easily restore disk images
28
-with <a href="http://www.ghost.com/">Symantec Ghost</a> (see <a
29
-href="http://appdeploy.com/tools/imaging.shtml">appdeploy.com</a> for similar tools).</small><br>
30
-<small>Sure there are several possibilities to do this with Linux but for cloning NT4/W2K
31
-the NTFS support is rather experimental and automatically changing the SID is another
32
-issue.</small></p>
33
-
34
-<h4>TFTP Servers:</h4>
35
-
36
-<p>In Autumn 2000 i tested some different TFTP servers and found out that most of them do
37
-not install/run as a service, especially under W2K. 
38
-
39
-<ul>
40
-  <li>TFTP server included with Windows 2000 (remote installation services need to be
41
-    installed)<br>
42
-    The path for the images has to be specified via registry:<br>
43
-    Q232115 - Changing the Drive or Volume on Which Remote Installation Images Reside:<br>
44
-    <a href="http://support.microsoft.com/support/kb/articles/Q232/1/15.ASP">http://support.microsoft.com/support/kb/articles/Q232/1/15.ASP</a></li>
45
-  <li>3CDaemon version 2.0 revision 10. Freeware. Integrated TFTP/FTP/Syslog Daemon for
46
-    Windows 95/98/NT<br>
47
-    <a href="ftp://ftp.3com.com/pub/utilbin/win32/3cdv2r10.zip">ftp://ftp.3com.com/pub/utilbin/win32/3cdv2r10.zip</a><br>
48
-    - Windows 2000 Server: does not run as service!<br>
49
-    - Windows NT Server 4.0: not tested</li>
50
-  <li>The TFTP Server portion of 3CServer, altered to run as a system Service under Windows NT<br>
51
-    <a href="ftp://ftp.3com.com/pub/utilbin/win32/3CTftpSvc.zip">ftp://ftp.3com.com/pub/utilbin/win32/3CTftpSvc.zip</a><br>
52
-    - Windows 2000 Server: only working in debug mode, does not run as service!<br>
53
-    - Windows NT Server 4.0: not tested</li>
54
-  <li>Cisco TFTP Server v.1.1<br>
55
-    <a href="http://www.cisco.com/pcgi-bin/tablebuild.pl/tftp">http://www.cisco.com/pcgi-bin/tablebuild.pl/tftp</a><br>
56
-    Does not provide an option itself to install as service.</li>
57
-  <li><a href="http://solarwinds.net/Tools/Free_Tools/TFTP_Server/">http://solarwinds.net/Tools/Free_Tools/TFTP_Server/</a><br>
58
-    Does not provide an option itself to install as service.</li>
59
-</ul>
60
-
61
-<p><em>Untested:</em></p>
62
-
63
-<p>found on <a href="http://www.nonags.com/nonags/servd32.html">http://www.nonags.com/nonags/servd32.html</a><br>
64
-- <a href="http://www.klever.net/kin/pumpkin.html">http://www.klever.net/kin/pumpkin.html</a><br>
65
-- <a href="http://membres.tripod.fr/phjounin//P_tftpd32.htm">http://membres.tripod.fr/phjounin//P_tftpd32.htm</a></p>
66
-
67
-<h4>Syslog Servers:</h4>
68
-
69
-<ul>
70
-  <li>3Com Software Library - Utilities for 32 bit Windows<br>
71
-    <a href="http://support.3com.com/software/utilities_for_windows_32_bit.htm">http://support.3com.com/software/utilities_for_windows_32_bit.htm</a></li>
72
-  <li><a href="http://www.netal.com/download.htm#SL4NT03">http://www.netal.com/download.htm#SL4NT03</a>
73
-    (works as service) </li>
74
-</ul>
75
-
76
-<h4>NFS Servers:</h4>
77
-
78
-<ul>
79
-  <li>War NFS Daemon: <a href="http://www.jgaa.com">http://www.jgaa.com</a> (untested)</li>
80
-</ul>
81
-</body>
82
-</html>

+ 9
- 0
contrib/README 查看文件

@@ -0,0 +1,9 @@
1
+Most of the content that was previously in this directory has been
2
+moved to a separate git repository:
3
+
4
+    http://git.etherboot.org/?p=contrib.git;a=summary
5
+
6
+or the Etherboot Project wiki:
7
+
8
+    http://etherboot.org/
9
+

+ 0
- 40
contrib/auto-default/mail 查看文件

@@ -1,40 +0,0 @@
1
-Date:        11/9/2001 3:56 PM
2
-Received:    11/9/2001 4:05 PM
3
-From:        Steve Tilden, stilden@sicom-sys.com
4
-
5
-...
6
-
7
-2)  I have added conditional code to main.c from Etherboot 5.0.4 to add
8
-a new default boot option and I have included the modified main.c as an
9
-attachment to this message.
10
-
11
-As I received Etherboot 5.0.4, in the Config file, if you select
12
-ASK_BOOT with a non zero time-out option, then you also get to set
13
-ANS_DEFAULT = ANS_NETWORK or ANS_DEFAULT = ANS_LOCAL to determine what
14
-will happen if the operator does not respond to the prompt.   I have now
15
-added conditional code in main.c such that if you set ANS_DEFAULT =
16
-ANS_AUTO, the default answer will be set according to whether or not
17
-there is a hard disk in the system (as detected by the BIOS).  If a hard
18
-disk is present, then if the operator does nothing, the system will boot
19
-from it.  If a hard disk does not exist, then again if the operator does
20
-nothing, the system will boot via the network.  Either way, for our
21
-particular environment, the operator has to do nothing to get it to boot
22
-correctly.  Yet the operator can still override the default selection
23
-to, for example, allow a unit without a hard disk, to boot directly from
24
-a floppy rather than the network, or to allow a unit with a hard disk,
25
-to boot from the network.
26
-
27
-I don't know it the code I have added might be correct for a future
28
-production version of Etherboot, but I thought I'd send it to you and
29
-let you get it into the system if you feel it might be appropriate.
30
-
31
-Thanks,
32
-
33
-Steve Tilden
34
-Sicom Systems Inc.
35
-stilden@sicom-sys.com
36
-
37
-[Ed: On a compliant BIOS, it will actually boot the next device in the
38
-BIOS list if local is selected, either explicitly or by timeout, which
39
-may or may not be the hard disk, which is why it's less than general and
40
-not included in the distribution by default.]

+ 0
- 55
contrib/auto-default/main.c.patch 查看文件

@@ -1,55 +0,0 @@
1
---- main.c	Mon Nov  5 18:58:30 2001
2
-+++ main.c.new	Thu Nov 15 01:45:12 2001
3
-@@ -149,21 +151,49 @@
4
- static unsigned short ipchksum(unsigned short *ip, int len);
5
- static unsigned short udpchksum(struct iphdr *packet);
6
- 
7
-+
8
-+#if defined(ASK_BOOT) && ASK_BOOT > 0 && (ANS_DEFAULT == ANS_AUTO)
9
-+/*
10
-+ * Read Installed Hard Disk Count from BIOS memory at 0:0475
11
-+ */
12
-+static int hdsk_cnt(void)
13
-+{
14
-+	int retv;
15
-+	__asm__ __volatile__(
16
-+       "xorw %%ax,%%ax\n\t"
17
-+       "movb 0x475,%%al\n"
18
-+       : "=a" (retv)
19
-+       : /* no inputs */
20
-+       : "ax", "cc", "memory"
21
-+	);
22
-+	return(retv);
23
-+}
24
-+#endif /* ASK_BOOT && ANS_AUTO */
25
-+
26
-+
27
- static inline void ask_boot(void)
28
- {
29
- #if defined(ASK_BOOT) && ASK_BOOT > 0
30
- 	while(1) {
31
--		int c;
32
-+		int c, deflt;
33
- 		unsigned long time;
34
-+#if defined(ASK_BOOT) && ASK_BOOT > 0 && (ANS_DEFAULT == ANS_AUTO)
35
-+		if (hdsk_cnt() != 0)
36
-+			deflt = ANS_LOCAL;
37
-+		else
38
-+			deflt = ANS_NETWORK;
39
-+#else
40
-+		deflt = ANS_DEFAULT;
41
-+#endif
42
- 		printf(ASK_PROMPT);
43
- 		for (time = currticks() + ASK_BOOT*TICKS_PER_SEC; !iskey(); )
44
- 			if (currticks() > time) {
45
--				c = ANS_DEFAULT;
46
-+				c = deflt;
47
- 				goto done;
48
- 			}
49
- 		c = getchar();
50
- 		if ((c >= 'a') && (c <= 'z')) c &= 0x5F;
51
--		if (c == '\n') c = ANS_DEFAULT;
52
-+		if (c == '\n') c = deflt;
53
- done:
54
- 		if ((c >= ' ') && (c <= '~')) putchar(c);
55
- 		putchar('\n');

+ 0
- 2
contrib/award_plugin_roms/README 查看文件

@@ -1,2 +0,0 @@
1
-An Award BIOS ROM lister in Perl contributed by Eric W. Biederman
2
-<ebiederman@lnxi.com>.

+ 0
- 341
contrib/award_plugin_roms/award_plugin_roms.pl 查看文件

@@ -1,341 +0,0 @@
1
-#!/usr/bin/perl -w
2
-use strict;
3
-use FileHandle;
4
-use integer;
5
-
6
-sub unsigned_little_endian_to_value
7
-{
8
-	# Assumes the data is initially little endian
9
-	my ($buffer) = @_;
10
-	my $bytes = length($buffer);
11
-	my $value = 0;
12
-	my $i;
13
-	for($i = $bytes -1; $i >= 0; $i--) {
14
-		my $byte = unpack('C', substr($buffer, $i, 1));
15
-		$value = ($value * 256) + $byte;
16
-	}
17
-	return $value;
18
-}
19
-
20
-sub decode_fixed_string
21
-{
22
-	my ($data, $bytes) = @_;
23
-	return $data;
24
-}
25
-
26
-sub decode_pstring
27
-{
28
-	my ($buf_ref, $offset_ref) = @_;
29
-	# Decode a pascal string
30
-	my $offset = ${$offset_ref};
31
-	my $len = unpack('C',substr(${$buf_ref}, $offset, 1));
32
-	my $data = substr(${$buf_ref}, $offset +1,  $len);
33
-	${$offset_ref} = $offset + $len +1;
34
-	return $data;
35
-}
36
-
37
-sub decode_cstring
38
-{
39
-	# Decode a c string
40
-	my ($buf_ref, $offset_ref) = @_;
41
-	my ($data, $byte);
42
-	my $index = ${$offset_ref};
43
-	while(1) {
44
-		$byte = substr(${$buf_ref}, $index, 1);
45
-		if (!defined($byte) || ($byte eq "\0")) {
46
-			last;
47
-		}
48
-		$data .= $byte;
49
-		$index++;
50
-	}
51
-	${$offset_ref} = $index;
52
-	return $data;
53
-}
54
-
55
-sub type_size
56
-{
57
-	my ($entry) = @_;
58
-	my %type_length = (
59
-		byte => 1,
60
-		half => 2,
61
-		word => 4,
62
-		xword => 8,
63
-		'fixed-string' => $entry->[2],
64
-		pstring => 0,
65
-		cstring => 0,
66
-	);
67
-	my $type = $entry->[0];
68
-	if (!exists($type_length{$type})) {
69
-		 die "unknown type $type";
70
-	 }
71
-	my $length = $type_length{$type};
72
-	return $length;
73
-}
74
-
75
-sub decode_fixed_type
76
-{
77
-	my ($type, $data, $bytes) = @_;
78
-	my %decoders = (
79
-		'byte' => \&unsigned_little_endian_to_value,
80
-		'half' => \&unsigned_little_endian_to_value,
81
-		'word' => \&unsigned_little_endian_to_value,
82
-		'xword' => \&unsigned_little_endian_to_value,
83
-		'fixed-string' => \&decode_fixed_string,
84
-	);
85
-	my $decoder = $decoders{$type} or die "unknow fixed type $type";
86
-	return $decoder->($data, $bytes);
87
-}
88
-
89
-sub decode_variable_type
90
-{
91
-	my ($type, $buf_ref, $offset_ref) = @_;
92
-	my %decoders = (
93
-		'pstring' => \&decode_pstring,
94
-		'cstring' => \&decode_cstring,
95
-	);
96
-	my $decoder = $decoders{$type} or die "unknow variable type $type";
97
-	return $decoder->($buf_ref, $offset_ref);
98
-}
99
-
100
-sub decode_struct
101
-{
102
-	my ($buf_ref, $offset, $layout) = @_;
103
-	my $initial_offset = $offset;
104
-	my ($entry, %results);
105
-	foreach $entry (@$layout) {
106
-		my ($type, $name) = @$entry;
107
-		my $bytes = type_size($entry);
108
-		if ($bytes > 0) {
109
-			my $data = substr(${$buf_ref}, $offset, $bytes);
110
-			$results{$name} = decode_fixed_type($type, $data, $bytes);
111
-			$offset += $bytes;
112
-		} else {
113
-			$results{$name} = decode_variable_type($type, $buf_ref, \$offset);
114
-		}
115
-	}
116
-	return (\%results, $offset - $initial_offset);
117
-}
118
-
119
-sub print_big_hex
120
-{
121
-	my ($min_digits, $value) = @_;
122
-	my @digits;
123
-	while($min_digits > 0 || ($value > 0)) {
124
-		my $digit = $value%16;
125
-		$value /= 16;
126
-		unshift(@digits, $digit);
127
-		$min_digits--;
128
-	}
129
-	my $digit;
130
-	foreach $digit (@digits) {
131
-		printf("%01x", $digit);
132
-	}
133
-}
134
-
135
-
136
-
137
-my %lha_signatures = (
138
-	'-com-' => 1,	
139
-	'-lhd-'	=> 1,
140
-	'-lh0-'	=> 1,
141
-	'-lh1-'	=> 1,
142
-	'-lh2-'	=> 1,
143
-	'-lh3-'	=> 1,
144
-	'-lh4-'	=> 1,
145
-	'-lh5-'	=> 1,
146
-	'-lzs-' => 1,
147
-	'-lz4-' => 1,
148
-	'-lz5-' => 1,
149
-	'-afx-'	=> 1,
150
-	'-lzf-'	=> 1,
151
-);
152
-
153
-my %lha_os = (
154
-	'M' => 'MS-DOS',
155
-	'2' => 'OS/2',
156
-	'9' => 'OS9',
157
-	'K' => 'OS/68K',
158
-	'3' => 'OS/386',
159
-	'H' => 'HUMAN',
160
-	'U' => 'UNIX',
161
-	'C' => 'CP/M',
162
-	'F' => 'FLEX',
163
-	'm' => 'Mac',
164
-	'R' => 'Runser',
165
-	'T' => 'TownOS',
166
-	'X' => 'XOSK',
167
-	'A' => 'Amiga',
168
-	'a' => 'atari',
169
-	' ' => 'Award ROM',
170
-);
171
-
172
-
173
-my @lha_level_1_header = (
174
-	[ 'byte',         'header_size' ],    # 1
175
-	[ 'byte',         'header_sum', ],    # 2
176
-	[ 'fixed-string', 'method_id', 5 ],   # 7
177
-	[ 'word',         'skip_size', ],     # 11
178
-	[ 'word',         'original_size' ],  # 15
179
-	[ 'half',         'dos_time' ],       # 17
180
-	[ 'half',         'dos_date' ],       # 19
181
-    	[ 'byte',         'fixed'   ],        # 20
182
-	[ 'byte',         'level'   ],        # 21
183
-	[ 'pstring',      'filename' ],       # 22
184
-	[ 'half',         'crc' ],
185
-	[ 'fixed-string', 'os_id', 1 ],
186
-	[ 'half',         'ext_size' ],		  
187
-);
188
-
189
-# General lha_header
190
-my @lha_header = (
191
-	[ 'byte',         'header_size' ],
192
-	[ 'byte',         'header_sum', ],
193
-	[ 'fixed-string', 'method_id', 5 ],
194
-	[ 'word',         'skip_size', ],
195
-	[ 'word',         'original_size' ],
196
-	[ 'half',         'dos_time' ],
197
-	[ 'half',         'dos_date' ],
198
-	[ 'half',         'rom_addr' ],
199
-	[ 'half',         'rom_flags' ],
200
-    	[ 'byte',         'fixed'   ],
201
-	[ 'byte',         'level'   ],
202
-	[ 'pstring',      'filename' ],
203
-	[ 'half',         'crc' ],
204
-	[ 'lha_os',	  'os_id', 1 ],
205
-	[ 'half',         'ext_size' ],
206
-	[ 'byte',         'zero' ],
207
-	[ 'byte',         'total_checksum' ],
208
-	[ 'half',         'total_size' ],
209
-);
210
-
211
-sub print_struct
212
-{
213
-	my ($layout, $self) = @_;
214
-	my $entry;
215
-	my $width = 0;
216
-	foreach $entry(@$layout) {
217
-		my ($type, $name) = @$entry;
218
-		if (length($name) > $width) {
219
-			$width = length($name);
220
-		}
221
-	}
222
-	foreach $entry (@$layout) {
223
-		my ($type, $name) = @$entry;
224
-		printf("%*s = ", $width, $name);
225
-		my $value = $self->{$name};
226
-		if (!defined($value)) {
227
-			print "undefined";
228
-		}
229
-		elsif ($type eq "lha_os") {
230
-			print "$lha_os{$value}";
231
-		}
232
-		elsif ($type =~ m/string/) {
233
-			print "$value";
234
-		} 
235
-		else {
236
-			my $len = type_size($entry);
237
-			print "0x";
238
-			print_big_hex($len *2, $value);
239
-		}
240
-		print "\n";
241
-	}
242
-}
243
-
244
-sub checksum
245
-{
246
-	my ($buf_ref, $offset, $length) = @_;
247
-	my ($i, $sum);
248
-	$sum = 0;
249
-	for($i = 0; $i < $length; $i++) {
250
-		my $byte = unpack('C', substr($$buf_ref, $offset + $i, 1));
251
-		$sum = ($sum + $byte) %256;
252
-	}
253
-	return $sum;
254
-}
255
-
256
-sub decode_lha_header
257
-{
258
-	my ($buf_ref, $offset) = @_;
259
-	my $level = unpack('C',substr(${$buf_ref}, $offset + 20, 1));
260
-
261
-	my %self;
262
-	my ($struct, $bytes);
263
-	if ($level == 1) {
264
-		($struct, $bytes) 
265
-			= decode_struct($buf_ref, $offset, \@lha_level_1_header);
266
-		%self = %$struct;
267
-		if ($self{fixed} != 0x20) {
268
-			 die "bad fixed value";
269
-		}
270
-		$self{total_size} = $self{header_size} + 2 + $self{skip_size};
271
-		if ($bytes != $self{header_size} +2) {
272
-			die "$bytes != $self{header_size} +2";
273
-		}
274
-		my $checksum = checksum($buf_ref, $offset +2, $self{header_size});
275
-		if ($checksum != $self{header_sum}) {
276
-			printf("WARN: Header bytes checksum to %02lx\n", 
277
-				     $checksum);
278
-		}
279
-		# If we are an award rom...
280
-		if ($self{os_id} eq ' ') {
281
-			@self{qw(zero total_checksum)} = 
282
-			    unpack('CC', substr($$buf_ref, 
283
-				$offset + $self{total_size}, 2));
284
-			if ($self{zero} != 0) {
285
-				warn "Award ROM without trailing zero";
286
-			}
287
-			else {
288
-				$self{total_size}++;
289
-			}
290
-			my $checksum = 
291
-				checksum($buf_ref, $offset, $self{total_size});
292
-			if ($self{total_checksum} != $checksum) {
293
-				printf("WARN: Image bytes checksum to %02lx\n", 
294
-					$checksum);
295
-			}
296
-			else {
297
-				$self{total_size}++;
298
-			}
299
-			$self{rom_addr} = $self{dos_time};
300
-			$self{rom_flags} = $self{dos_date};
301
-			delete @self{qw(dos_time dos_date)};
302
-		}
303
-	}
304
-	else {
305
-		die "Unknown header type";
306
-	}
307
-	return \%self;
308
-}
309
-
310
-sub main
311
-{
312
-	my ($filename, $rom_length) = @_;
313
-	my $fd = new FileHandle;
314
-	if (!defined($rom_length)) {
315
-		my ($dev, $ino, $mode, $nlink, $uid, $gid,$rdev,$size,
316
-			$atime, $mtime, $ctime, $blksize, $blocks)
317
-			= stat($filename);
318
-		$rom_length = $size;
319
-	}
320
-	$fd->open("<$filename") or die "Cannot ope $filename";
321
-	my $data;
322
-	$fd->read($data, $rom_length);
323
-	$fd->close();
324
-	
325
-	my $i;
326
-	for($i = 0; $i < $rom_length; $i++) {
327
-		my $sig = substr($data, $i, 5);
328
-		if (exists($lha_signatures{$sig})) {
329
-			my $start = $i -2;
330
-			my $header = decode_lha_header(\$data, $start);
331
-			
332
-			my $length = $header->{total_size};
333
-			print "AT:  $start - @{[$start + $length -1]},  $length bytes\n";
334
-			print_struct(\@lha_header, $header);
335
-			print "\n";
336
-
337
-		}
338
-	}
339
-}
340
-
341
-main(@ARGV);

+ 0
- 475
contrib/baremetal/Makefile 查看文件

@@ -1,475 +0,0 @@
1
-#
2
-# Makefile for Etherboot
3
-#
4
-# Most of the time you should edit Config
5
-#
6
-# Common options:
7
-#	VERSION=v	- Set the version string
8
-#
9
-# NS8390 options:
10
-#	-DINCLUDE_NE	- Include NE1000/NE2000 support
11
-#	-DNE_SCAN=list	- Probe for NE base address using list of
12
-#			  comma separated hex addresses
13
-#	-DINCLUDE_3C503 - Include 3c503 support
14
-#	  -DT503_SHMEM	- Use 3c503 shared memory mode (off by default)
15
-#	-DINCLUDE_WD	- Include Western Digital/SMC support
16
-#	-DWD_DEFAULT_MEM- Default memory location for WD/SMC cards
17
-#	-DCOMPEX_RL2000_FIX
18
-#
19
-#	If you have a Compex RL2000 PCI 32-bit (11F6:1401),
20
-#	and the bootrom hangs in "Probing...[NE*000/PCI]",
21
-#	try enabling this fix... it worked for me :).
22
-#	In the first packet write somehow it somehow doesn't
23
-#	get back the expected data so it is stuck in a loop.
24
-#	I didn't bother to investigate what or why because it works
25
-#	when I interrupt the loop if it takes more then COMPEX_RL2000_TRIES.
26
-#	The code will notify if it does a abort.
27
-#	SomniOne - somnione@gmx.net
28
-#
29
-# 3C509 option:
30
-#	-DINCLUDE_3C509	- Include 3c509 support
31
-#
32
-# 3C90X options:
33
-#	-DINCLUDE_3C90X	- Include 3c90x support
34
-#	-DCFG_3C90X_PRESERVE_XCVR - Reset the transceiver type to the value it
35
-#			  had initially just before the loaded code is started.
36
-#	-DCFG_3C90X_XCVR - Hardcode the tranceiver type Etherboot uses.
37
-#	-DCFG_3C90X_BOOTROM_FIX - If you have a 3c905B with buggy ROM
38
-#			  interface, setting this option might "fix" it.  Use
39
-#			  with caution and read the docs in 3c90x.txt!
40
-#
41
-#	See the documentation file 3c90x.txt for more details.
42
-#
43
-# CS89X0 (optional) options:
44
-#	-DINCLUDE_CS89X0- Include CS89x0 support
45
-#	-DCS_SCAN=list	- Probe for CS89x0 base address using list of
46
-#			  comma separated hex addresses; increasing the
47
-#			  address by one (0x300 -> 0x301) will force a
48
-#			  more aggressive probing algorithm. This might
49
-#			  be neccessary after a soft-reset of the NIC.
50
-#
51
-# LANCE options:
52
-#	-DINCLUDE_NE2100- Include NE2100 support
53
-#	-DINCLUDE_NI6510- Include NI6510 support
54
-#
55
-# SK_G16 options:
56
-#	-DINCLUDE_SK_G16- Include SK_G16 support
57
-#
58
-# I82586 options:
59
-#	-DINCLUDE_3C507	- Include 3c507 support
60
-#	-DINCLUDE_NI5210- Include NI5210 support
61
-#	-DINCLUDE_EXOS205-Include EXOS205 support
62
-#
63
-# SMC9000 options:
64
-#       -DINCLUDE_SMC9000   - Include SMC9000 driver
65
-#       -DSMC9000_SCAN=list - List of I/O addresses to probe
66
-#
67
-# TIARA (Fujitsu Etherstar) options:
68
-#	-DINCLUDE_TIARA	- Include Tiara support
69
-#
70
-# NI5010 options:
71
-#	-DINCLUDE_NI5010 - Include NI5010 support
72
-#
73
-# TULIP options:
74
-#	-DINCLUDE_TULIP	- Include Tulip support
75
-#	-DUSE_INTERNAL_BUFFER - receuve and transmit buffers within program
76
-#		space, not below 0x10000, in case that region is used
77
-#
78
-# RTL8139 options:
79
-#	-DINCLUDE_RTL8139 - Include RTL8139 support
80
-#	-DUSE_INTERNAL_BUFFER - 8 kB receive buffer within program space,
81
-#		not at 0x10000 - 8kB, in case that region is used
82
-#
83
-
84
-include Config
85
-
86
-GCC=		gcc
87
-CPP=		gcc -E
88
-VERSION=	4.6.12
89
-CFLAGS16+=	-DVERSION=\"$(VERSION)\" -DRELOC=$(RELOCADDR)
90
-CFLAGS32+=	-DVERSION=\"$(VERSION)\" -DRELOC=$(RELOCADDR) $(OLDGAS)
91
-LCONFIG+=	-DRELOC=$(RELOCADDR)
92
-
93
-IDENT16=		'Etherboot/16 $(VERSION) (GPL) $(@F)'
94
-IDENT32=		'Etherboot/32 $(VERSION) (GPL) $(@F)'
95
-
96
-# Find out if we're using binutils 2.9.1 which uses a different syntax in some
97
-# places (most prominently in the opcode prefix area).
98
-OLDGAS:=	$(shell $(AS) --version | grep -q '2\.9\.1' && echo -DGAS291)
99
-
100
-# Check the requested type of build (32, 16 or both families)
101
-ifeq ($(ETHERBOOT),16)
102
-BUILD_LIBS=	$(BLIB16)
103
-BUILD_BINS=	$(BINS16)
104
-endif
105
-ifeq ($(ETHERBOOT),32)
106
-BUILD_LIBS=	$(BLIB32)
107
-BUILD_BINS=	$(BINS32)
108
-endif
109
-ifeq ($(ETHERBOOT),both)
110
-BUILD_LIBS=	$(BLIB16) $(BLIB32)
111
-BUILD_BINS=	$(BINS16) $(BINS32)
112
-endif
113
-
114
-3C503FLAGS=	-DINCLUDE_3C503 # -DT503_SHMEM
115
-# Note that the suffix to MAKEROM_ is the (mixed case) basename of the ROM file
116
-MAKEROM_3c503=	-3
117
-3C507FLAGS=	-DINCLUDE_3C507
118
-3C509FLAGS=	-DINCLUDE_3C509
119
-3C529FLAGS=	-DINCLUDE_3C529
120
-3C595FLAGS=	-DINCLUDE_3C595
121
-3C90XFLAGS=	-DINCLUDE_3C90X
122
-CS89X0FLAGS=	-DINCLUDE_CS89X0
123
-EEPROFLAGS=	-DINCLUDE_EEPRO
124
-EEPRO100FLAGS=	-DINCLUDE_EEPRO100
125
-EPIC100FLAGS=	-DINCLUDE_EPIC100
126
-EXOS205FLAGS=	-DINCLUDE_EXOS205
127
-LANCEFLAGS=	-DINCLUDE_LANCE		# Lance/PCI!
128
-NE2100FLAGS=	-DINCLUDE_NE2100
129
-NEFLAGS=	-DINCLUDE_NE -DNE_SCAN=0x300,0x280,0x320,0x340,0x380
130
-NS8390FLAGS=	-DINCLUDE_NS8390	# NE2000/PCI!
131
-NI5010FLAGS=	-DINCLUDE_NI5010
132
-NI5210FLAGS=	-DINCLUDE_NI5210
133
-NI6510FLAGS=	-DINCLUDE_NI6510
134
-RTL8139FLAGS=	-DINCLUDE_RTL8139
135
-SK_G16FLAGS=	-DINCLUDE_SK_G16
136
-SMC9000FLAGS=   -DINCLUDE_SMC9000
137
-TIARAFLAGS=	-DINCLUDE_TIARA
138
-DEPCAFLAGS=	-DINCLUDE_DEPCA	# -DDEPCA_MODEL=DEPCA -DDEPCA_RAM_BASE=0xd0000
139
-TULIPFLAGS=	-DINCLUDE_TULIP
140
-OTULIPFLAGS=	-DINCLUDE_OTULIP
141
-VIA_RHINEFLAGS=	-DINCLUDE_VIA_RHINE
142
-WDFLAGS=	-DINCLUDE_WD -DWD_DEFAULT_MEM=0xCC000
143
-W89C840FLAGS=	-DINCLUDE_W89C840
144
-
145
-# If you have not made any changes to the *.S files, AS86 need not be set.
146
-# (most people)
147
-# If you have made changes to the *.S files and you want to rebuild *loader.bin
148
-# and {floppy,com}load.bin and you have as86 from the ELKS Dev86 package (not
149
-# the one that normally comes with Linux) (not most people)
150
-#AS86=		as86
151
-# If you have made changes to the *.S files and you want to rebuild *loader.bin
152
-# and {floppy,com}load.bin and you have nasm (not most people)
153
-#AS86=		nasm
154
-
155
-# if your as has trouble with the data32 directive, uncomment this
156
-# but note that the premade start*.o will be larger than necessary because it
157
-# contains some routines which may not be used
158
-#AS_PSEUDOS=	n
159
-
160
-SRCS=	floppyload.S comload.S liloprefix.S loader.S start16.S start32.S serial.S startmpcc.S
161
-SRCS+=	main.c pci.c osloader.c nfs.c misc.c ansiesc.c bootmenu.c config.c
162
-SRCS+=	md5.c floppy.c
163
-
164
-# ROM loaders: LZ version (prefix Z), PCI header version (prefix P)
165
-ifndef AS86
166
-RLOADER=	rloader.bin.pre
167
-PRLOADER=	prloader.bin.pre
168
-RZLOADER=	rzloader.bin.pre
169
-PRZLOADER=	przloader.bin.pre
170
-FLOPPYLOAD=	floppyload.bin.pre
171
-COMLOAD=	comload.bin.pre
172
-LILOPREFIX=	liloprefix.bin.pre
173
-else
174
-RLOADER=	bin/rloader.bin
175
-PRLOADER=	bin/prloader.bin
176
-RZLOADER=	bin/rzloader.bin
177
-PRZLOADER=	bin/przloader.bin
178
-FLOPPYLOAD=	bin/floppyload.bin
179
-COMLOAD=	bin/comload.bin
180
-LILOPREFIX=	bin/liloprefix.bin
181
-endif
182
-
183
-ifeq ($(AS86),as86)
184
-LCPPFLAGS+=	-DUSE_AS86
185
-LASFLAGS+=	$(AS86FLAGS) -0
186
-LASBINARY:=	-b
187
-endif
188
-ifeq ($(AS86),nasm)
189
-LCPPFLAGS+=	-DUSE_NASM
190
-LASFLAGS+=	$(NASMFLAGS) -fbin
191
-LASBINARY:=	-o
192
-endif
193
-
194
-ifeq ($(AS_PSEUDOS),n)
195
-START16=	start16.o.pre
196
-START32=	start32.o.pre
197
-else
198
-START16=	bin16/start16.o
199
-START32=	bin32/startmpcc.o
200
-endif
201
-
202
-BOBJS16=	bin16/main.o bin16/osloader.o bin16/misc.o bin16/bootmenu.o
203
-BOBJS16+=	bin16/floppy.o bin16/timer.o
204
-BOBJS32=	bin32/main.o bin32/osloader.o bin32/nfs.o bin32/misc.o
205
-BOBJS32+=	bin32/ansiesc.o bin32/bootmenu.o bin32/md5.o bin32/floppy.o
206
-BOBJS32+=	bin32/serial.o bin32/timer.o
207
-BLIB16=	bin16/bootlib.a
208
-BLIB32=	bin32/bootlib.a
209
-LIBS16=	$(BLIB16) $(LIBC16)
210
-LIBS32=	$(BLIB32) $(LIBC32) /usr/lib/gcc-lib/i386-redhat-linux/2.96/libgcc.a
211
-UTIL_LZHUF:= $(shell if [ -d ../contrib/compressor ]; then echo bin/lzhuf; fi)
212
-UTILS+=	bin/makerom $(UTIL_LZHUF) bin/organon
213
-STDDEPS16=	$(START16) $(BLIB16) $(UTILS)
214
-STDDEPS32=	$(START32) $(BLIB32) $(UTILS)
215
-MAKEDEPS=	Makefile Config Roms
216
-
217
-CHECKSIZE=	{ read d1; read d1 d2 d3 size d4; [ $$size -gt $(ROMLIMIT) ] &&\
218
-	{ $(RM) $@; echo "ERROR: code size exceeds limit!"; exit 1; }; exit 0; }
219
-
220
-# Make sure that the relocation address is acceptable for all ROM sizes.
221
-# Setting it to 0x98000 leaves about 29kB of space for the Etherboot program.
222
-# The check is done based running 'size' on the binary, not ROM size, but
223
-# roughly this means a ROM of 16kB or a partially used ROM of 32kB,
224
-# remembering to compressed ROM images into account.
225
-# You may also set RELOCADDR to 0x88000 to avoid using 0x98000
226
-# because of other drivers (e.g. Disk On Chip). In that case, you may
227
-# only load 512kB of OS, or load in memory above 1MB.
228
-# Don't forget to choose an assembler because the loaders have to be rebuilt.
229
-ifndef RELOCADDR
230
-RELOCADDR=0x98000
231
-#RELOCADDR=0xe0000
232
-endif
233
-
234
-# Evaluate ROMLIMIT only once - it is constant during the make run.
235
-# Note that the 3K safety margin below is for the 1K extended BIOS data area
236
-# and for the Etherboot runtime stack.  Under normal situations, 2K of stack
237
-# are rarely needed.  If you experience strange behaviour in functions that use
238
-# many local variables or that call functions that do, check for stack overrun!
239
-# Make sure that the normal case needs no perl interpreter - if someone uses a
240
-# different RELOCADDR, then he has perl installed anyways (the shell cannot
241
-# deal with hex numbers, as test/eval don't support non-decimal integers).
242
-ifeq ($(RELOCADDR),0x98000)
243
-ROMLIMIT=29696
244
-else
245
-ROMLIMIT:=$(shell perl -e 'print 0x10000 - 3072 - ($(RELOCADDR) & 0xFFFF), "\n";')
246
-endif
247
-
248
-# Start of targets
249
-
250
-all:	$(UTILS) $(BUILD_LIBS) allbins
251
-
252
-include Roms
253
-
254
-# We need allbins because $(BINS16) and $(BINS32) are not defined until
255
-# the Makefile fragment "Roms" is read.
256
-
257
-allbins:	$(BUILD_BINS)
258
-
259
-# Common files
260
-
261
-$(BLIB16):	$(BOBJS16)
262
-	$(AR16) rv $@ $(BOBJS16)
263
-	$(RANLIB16) $@
264
-
265
-$(BLIB32):	$(BOBJS32)
266
-	$(AR32) rv $@ $(BOBJS32)
267
-	$(RANLIB32) $@
268
-
269
-bin16/main.o:		main.c etherboot.h osdep.h nic.h
270
-bin32/main.o:		main.c etherboot.h osdep.h nic.h
271
-
272
-bin16/osloader.o:	osloader.c etherboot.h osdep.h
273
-bin32/osloader.o:	osloader.c etherboot.h osdep.h
274
-
275
-# NFS currently makes no sense for Etherboot/16
276
-bin32/nfs.o:		nfs.c etherboot.h osdep.h nic.h
277
-
278
-bin16/misc.o:		misc.c etherboot.h osdep.h
279
-bin32/misc.o:		misc.c etherboot.h osdep.h
280
-
281
-# ANSIESC is not supported for Etherboot/16
282
-bin32/ansiesc.o:	ansiesc.c etherboot.h osdep.h
283
-
284
-bin16/bootmenu.o:	bootmenu.c etherboot.h osdep.h
285
-bin32/bootmenu.o:	bootmenu.c etherboot.h osdep.h
286
-
287
-# Password support is not available for Etherboot/16
288
-bin32/md5.o:		md5.c etherboot.h osdep.h
289
-
290
-bin16/floppy.o:		floppy.c etherboot.h osdep.h
291
-bin32/floppy.o:		floppy.c etherboot.h osdep.h
292
-
293
-bin16/timer.o:		timer.c timer.h etherboot.h osdep.h
294
-bin32/timer.o:		timer.c timer.h etherboot.h osdep.h
295
-
296
-bin32/inthw.o:		inthw.c
297
-
298
-# PCI support code (common to all PCI drivers)
299
-
300
-bin32/pci.o:	pci.c pci.h
301
-
302
-# Do not add driver specific dependencies here unless it's something the
303
-# genrules.pl script *can't* deal with, i.e. if it is not C code.
304
-
305
-# Prepended loaders
306
-
307
-#ifndef AS86
308
-#$(RLOADER) $(RZLOADER) $(PRLOADER) $(PRZLOADER):	$(MAKEDEPS)
309
-#	@if [ $(RELOCADDR) != 0x98000 ]; then echo Non-standard RELOCADDR, must assemble $@; exit 1; fi
310
-#	$(TOUCH) $@
311
-#else
312
-#bin/rloader.s:	loader.S $(MAKEDEPS)
313
-#	$(CPP) $(LCPPFLAGS) $(LCONFIG) -o $@ $<
314
-#
315
-#bin/rzloader.s:	loader.S $(MAKEDEPS)
316
-#	$(CPP) $(LCPPFLAGS) $(LCONFIG) -DZLOADER -o $@ $<
317
-#
318
-#bin/prloader.s:	loader.S $(MAKEDEPS)
319
-#	$(CPP) $(LCPPFLAGS) $(LCONFIG) -DPCI_PNP_HEADER -o $@ $<
320
-#
321
-#bin/przloader.s:	loader.S $(MAKEDEPS)
322
-#	$(CPP) $(LCPPFLAGS) $(LCONFIG) -DPCI_PNP_HEADER -DZLOADER -o $@ $<
323
-#endif
324
-
325
-# Floppy loader
326
-
327
-ifdef AS86
328
-bin/floppyload.s:	floppyload.S $(MAKEDEPS)
329
-	$(CPP) $(LCPPFLAGS) -o $@ $<
330
-endif
331
-
332
-# COM loader
333
-
334
-ifdef AS86
335
-bin/comload.s:	comload.S $(MAKEDEPS)
336
-	$(CPP) $(LCPPFLAGS) -o $@ $<
337
-endif
338
-
339
-# LILO prefix:
340
-
341
-ifdef AS86
342
-bin/liloprefix.s:	liloprefix.S $(MAKEDEPS)
343
-	$(CPP) $(LCPPFLAGS) -o $@ $<
344
-endif
345
-
346
-# Utilities
347
-
348
-bin/makerom: makerom.c
349
-	$(GCC) -O2 -o $@ makerom.c
350
-
351
-bin/organon: organon.c
352
-	$(GCC) -o $@ organon.c
353
-
354
-bin/lzhuf:	../contrib/compressor/lzhuf.c
355
-	$(GCC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -o $@ $<
356
-
357
-# Roms file
358
-
359
-Roms:	NIC genrules.pl
360
-	@chmod +x genrules.pl
361
-	./genrules.pl NIC > $@
362
-
363
-# Pattern Rules
364
-
365
-# general rules for compiling/assembling source files
366
-bin16/%.o:	%.c $(MAKEDEPS)
367
-	$(CC16) $(CFLAGS16) -o $@ -c $<
368
-
369
-bin32/%.o:	%.c $(MAKEDEPS)
370
-	$(CC32) $(CFLAGS32) -o $@ -c $<
371
-
372
-bin16/%.o:	%.S $(MAKEDEPS)
373
-	$(CC16) $(CFLAGS16) $(ASFLAGS16) -c -o $@ $<
374
-
375
-bin32/%.o:	%.S $(MAKEDEPS)
376
-	$(CPP) $(CFLAGS32) $< | $(AS) $(ASFLAGS32) -o $@
377
-
378
-# general rule for .bin (plain binary loader code), may be overridden
379
-ifdef AS86
380
-bin/%.bin:	bin/%.s
381
-	$(AS86) $(LASFLAGS) $(LASBINARY) $@ $<
382
-endif
383
-
384
-# general rule for .huf (compressed binary code), may be overridden
385
-%.huf:	%.img
386
-	bin/lzhuf e $< $@
387
-
388
-# general rules for normal/compressed ROM images, may be overridden
389
-bin16/%.rom:	bin16/%.img $(RLOADER)
390
-	cat $(RLOADER) $< > $@
391
-	bin/makerom $(MAKEROM_$*) -i$(IDENT16) $@
392
-
393
-bin32/%.rom:	bin32/%.img $(RLOADER)
394
-	cat $(RLOADER) $< > $@
395
-	bin/makerom $(MAKEROM_$*) -i$(IDENT32) $@
396
-
397
-bin16/%.lzrom:	bin16/%.huf $(RZLOADER)
398
-	cat $(RZLOADER) $< > $@
399
-	bin/makerom $(MAKEROM_$*) -i$(IDENT16) $@
400
-
401
-bin32/%.lzrom:	bin32/%.huf $(RZLOADER)
402
-	cat $(RZLOADER) $< > $@
403
-	bin/makerom $(MAKEROM_$*) -i$(IDENT32) $@
404
-
405
-# rules to write the .rom/.lzrom image onto a blank floppy
406
-# You must give the directory name, e.g. use bin32/rtl8139.lzfd0 as the target.
407
-%.fd0:	%.rom $(FLOPPYLOAD)
408
-	cat $(FLOPPYLOAD) $< > /dev/fd0
409
-
410
-%.lzfd0:	%.lzrom $(FLOPPYLOAD)
411
-	cat $(FLOPPYLOAD) $< > /dev/fd0
412
-
413
-# rules to generate a .com executable
414
-# You must give the directory name, e.g. use bin32/rtl8139.com as the target.
415
-%.com:	%.lzrom $(COMLOAD)
416
-	cat $(COMLOAD) $< > $@
417
-
418
-# rules to make a floppy image (padding to fill an even number of cylinders).
419
-# VMware reports floppy image read errors if it cannot read ahead 36 sectors,
420
-# probably because the floppyload.S code reads up to that number of sectors in
421
-# a single request.  Not that 18k matters much these days...
422
-# You must give the directory name, e.g. use bin32/rtl8139.fdimg as the target.
423
-%.fdimg:	%.rom $(FLOPPYLOAD)
424
-	cat $(FLOPPYLOAD) $< > $@.x
425
-	dd if=$@.x of=$@ bs=36k conv=sync 2> /dev/null
426
-	$(RM) $@.x
427
-
428
-%.lzfdimg:	%.lzrom $(FLOPPYLOAD)
429
-	cat $(FLOPPYLOAD) $< > $@.x
430
-	dd if=$@.x of=$@ bs=36k conv=sync 2> /dev/null
431
-	$(RM) $@.x
432
-
433
-# rules to make a LILO-bootable image
434
-%.lilo:		%.rom $(LILOPREFIX)
435
-	cat $(LILOPREFIX) $< /dev/zero | head -c 64k > $@
436
-
437
-%.lzlilo:	%.lzrom $(LILOPREFIX)
438
-	cat $(LILOPREFIX) $< /dev/zero | head -c 64k > $@
439
-
440
-# Housekeeping
441
-
442
-# To make sure that this actually builds a start32.o.pre with all options set,
443
-# you have to make sure that -DFLOPPY -DANSIESC -DCONSOLE_DUAL are in CFLAGS32.
444
-precompiled:	bin/rloader.bin bin/rzloader.bin bin/prloader.bin bin/przloader.bin bin/floppyload.bin bin/comload.bin bin16/start16.o bin32/start32.o bin/liloprefix.bin
445
-	cp -p bin/rloader.bin rloader.bin.pre
446
-	cp -p bin/rzloader.bin rzloader.bin.pre
447
-	cp -p bin/prloader.bin prloader.bin.pre
448
-	cp -p bin/przloader.bin przloader.bin.pre
449
-	cp -p bin/floppyload.bin floppyload.bin.pre
450
-	cp -p bin/comload.bin comload.bin.pre
451
-	cp -p bin16/start16.o start16.o.pre
452
-	cp -p bin32/start32.o start32.o.pre
453
-	cp -p bin/liloprefix.bin liloprefix.bin.pre
454
-
455
-clean:
456
-	$(RM) $(UTILS) bin/*.s bin/*.bin
457
-	$(RM) $(BLIB16) $(BLIB32)
458
-	$(RM) bin16/*.o bin32/*.o bin16/*.tmp bin32/*.tmp
459
-	$(RM) bin16/*.img bin32/*.img bin16/*.huf bin32/*.huf
460
-	$(RM) bin16/*.rom bin32/*.rom bin16/*.lzrom bin32/*.lzrom
461
-	$(RM) bin16/*.com bin32/*.com
462
-	$(RM) bin16/*.fdimg bin32/*.fdimg bin16/*.lzfdimg bin32/*.lzfdimg
463
-	$(RM) bin16/*.lilo bin32/*.lilo bin16/*.lzlilo bin32/*.lzlilo
464
-	$(RM) bin32/*.hex
465
-	$(RM) bin32/*.asm
466
-	$(RM) bin32/*.map
467
-
468
-tarball:
469
-	(echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
470
-	(cd ..; tar cf /tmp/mpccboot-$(VERSION).tar --exclude CVS mpccboot)
471
-	bzip2 -9 < /tmp/mpccboot-$(VERSION).tar > /tmp/mpccboot-$(VERSION).tar.bz2
472
-	gzip -9 < /tmp/mpccboot-$(VERSION).tar > /tmp/mpccboot-$(VERSION).tar.gz
473
-
474
-version:
475
-	@echo $(VERSION)

+ 0
- 1119
contrib/baremetal/main.c
文件差異過大導致無法顯示
查看文件


+ 0
- 52
contrib/baremetal/marini.txt 查看文件

@@ -1,52 +0,0 @@
1
-From: "Paolo Marini" <paolom@prisma-eng.it>
2
-Subject: Etherboot on bare metal
3
-Date: Tue, 10 Apr 2001 23:19:19 +0200
4
-Organization: Prisma Engineering srl
5
-
6
-Hi Ken,
7
-I have ported Etherboot on an embedded, biosless platform and would like
8
-to contribute the code.
9
-
10
-Essentially, the hardware I was running Etherboot is a Pentium based
11
-embedded system, with an Intel Chipset, *but* without serial, VGA,
12
-keyboard etc., only an 82559 Intel (custom) Ethernet controller (I debug
13
-it with the etheral Ethernet packet analyser and an emulator).
14
-
15
-What I did was:
16
-
17
-  a.. integrate the init.s file within the firmware, with GDT
18
-(re)initialisation (a simple and single entry point taking control of
19
-the boot process)
20
-  b.. provide some stupid BIOS stubs in order to let the OS boot and
21
-still belive that an INT10 call goes to the BIOS
22
-  c.. provide some basic functions to Etherboot, like timer (I used the
23
-Pentium TSC internal counter)
24
-  d.. hardwire in the code information about the RAM size
25
-The BIOS stubs are enough to boot Linux, pSOS and QNX with bootp. QNX is
26
-somewhat difficult to load, because the i82559 driver tries to find the
27
-component using the BIOS32 calls, so I had to patch it.
28
-
29
-what i I got from the original firmware is the PCI initialisation and
30
-resource (I/O, interrupts, memory) allocation.
31
-
32
-I send you what I changed, that is, the initialisation code and the
33
-misc.c file containing the timer, and the makefile (I don't remember
34
-exactly the options I used to compile all).
35
-
36
-Of course, it is only a good starting point for anyone wanting to
37
-implement a bootp client on a biosless platform; some integration work
38
-still needs to be done.
39
-
40
-Ciao
41
-Paolo
42
-
43
-And in a subsequent email:
44
-
45
-I worked with version 4.6.12, but the real modifications involve the
46
-init.S file, which I think is quite sstable between releases.  I forgot
47
-to say that my entry point (symbol _start in init.s) assumes the
48
-processor is already in protected mode.
49
-
50
-[The only difference between main.c and misc.c from those in Etherboot
51
-4.6.12 seems to be the deletion of eth_reset(). This may be of use to
52
-others trying to make these changes work on more recent releases. Ken]

+ 0
- 351
contrib/baremetal/misc.c 查看文件

@@ -1,351 +0,0 @@
1
-/**************************************************************************
2
-MISC Support Routines
3
-**************************************************************************/
4
-
5
-#include "etherboot.h"
6
-
7
-/**************************************************************************
8
-SLEEP
9
-**************************************************************************/
10
-void sleep(int secs)
11
-{
12
-	unsigned long tmo;
13
-
14
-	for (tmo = currticks()+secs*TICKS_PER_SEC; currticks() < tmo; )
15
-		/* Nothing */;
16
-}
17
-
18
-/**************************************************************************
19
-TWIDDLE
20
-**************************************************************************/
21
-void twiddle()
22
-{
23
-	static unsigned long lastticks = 0;
24
-	static int count=0;
25
-	static const char tiddles[]="-\\|/";
26
-	unsigned long ticks;
27
-	if ((ticks = currticks()) == lastticks)
28
-		return;
29
-	lastticks = ticks;
30
-	putchar(tiddles[(count++)&3]);
31
-	putchar('\b');
32
-}
33
-
34
-/**************************************************************************
35
-STRCASECMP (not entirely correct, but this will do for our purposes)
36
-**************************************************************************/
37
-int strcasecmp(a,b)
38
-	char *a, *b;
39
-{
40
-	while (*a && *b && (*a & ~0x20) == (*b & ~0x20)) {a++; b++; }
41
-	return((*a & ~0x20) - (*b & ~0x20));
42
-}
43
-
44
-/**************************************************************************
45
-PRINTF and friends
46
-
47
-	Formats:
48
-		%[#]X	- 4 bytes long (8 hex digits)
49
-		%[#]x	- 2 bytes int (4 hex digits)
50
-			- optional # prefixes 0x
51
-		%b	- 1 byte int (2 hex digits)
52
-		%d	- decimal int
53
-		%c	- char
54
-		%s	- string
55
-		%I	- Internet address in x.x.x.x notation
56
-	Note: width specification not supported
57
-**************************************************************************/
58
-static char *do_printf(char *buf, const char *fmt, const int *dp)
59
-{
60
-	register char *p;
61
-	int alt;
62
-	char tmp[16];
63
-	static const char hex[]="0123456789ABCDEF";
64
-
65
-	while (*fmt) {
66
-		if (*fmt == '%') {	/* switch() uses more space */
67
-			alt = 0;
68
-			fmt++;
69
-			if (*fmt == '#') {
70
-				alt = 1;
71
-				fmt++;
72
-			}
73
-			if (*fmt == 'X') {
74
-				const long *lp = (const long *)dp;
75
-				register long h = *lp++;
76
-				dp = (const int *)lp;
77
-				if (alt) {
78
-					*buf++ = '0';
79
-					*buf++ = 'x';
80
-				}
81
-				*(buf++) = hex[(h>>28)& 0x0F];
82
-				*(buf++) = hex[(h>>24)& 0x0F];
83
-				*(buf++) = hex[(h>>20)& 0x0F];
84
-				*(buf++) = hex[(h>>16)& 0x0F];
85
-				*(buf++) = hex[(h>>12)& 0x0F];
86
-				*(buf++) = hex[(h>>8)& 0x0F];
87
-				*(buf++) = hex[(h>>4)& 0x0F];
88
-				*(buf++) = hex[h& 0x0F];
89
-			}
90
-			if (*fmt == 'x') {
91
-				register int h = *(dp++);
92
-				if (alt) {
93
-					*buf++ = '0';
94
-					*buf++ = 'x';
95
-				}
96
-				*(buf++) = hex[(h>>12)& 0x0F];
97
-				*(buf++) = hex[(h>>8)& 0x0F];
98
-				*(buf++) = hex[(h>>4)& 0x0F];
99
-				*(buf++) = hex[h& 0x0F];
100
-			}
101
-			if (*fmt == 'b') {
102
-				register int h = *(dp++);
103
-				*(buf++) = hex[(h>>4)& 0x0F];
104
-				*(buf++) = hex[h& 0x0F];
105
-			}
106
-			if (*fmt == 'd') {
107
-				register int dec = *(dp++);
108
-				p = tmp;
109
-				if (dec < 0) {
110
-					*(buf++) = '-';
111
-					dec = -dec;
112
-				}
113
-				do {
114
-					*(p++) = '0' + (dec%10);
115
-					dec = dec/10;
116
-				} while(dec);
117
-				while ((--p) >= tmp) *(buf++) = *p;
118
-			}
119
-			if (*fmt == 'I') {
120
-				union {
121
-					long		l;
122
-					unsigned char	c[4];
123
-				} u;
124
-				const long *lp = (const long *)dp;
125
-				u.l = *lp++;
126
-				dp = (const int *)lp;
127
-				buf = sprintf(buf,"%d.%d.%d.%d",
128
-					u.c[0], u.c[1], u.c[2], u.c[3]);
129
-			}
130
-			if (*fmt == 'c')
131
-				*(buf++) = *(dp++);
132
-			if (*fmt == 's') {
133
-				p = (char *)*dp++;
134
-				while (*p) *(buf++) = *p++;
135
-			}
136
-		} else *(buf++) = *fmt;
137
-		fmt++;
138
-	}
139
-	*buf = '\0';
140
-	return(buf);
141
-}
142
-
143
-char *sprintf(char *buf, const char *fmt, ...)
144
-{
145
-	return do_printf(buf, fmt, ((const int *)&fmt)+1);
146
-}
147
-
148
-void printf(const char *fmt, ...)
149
-{
150
-	char buf[120], *p;
151
-
152
-	p = buf;
153
-	do_printf(buf, fmt, ((const int *)&fmt)+1);
154
-	while (*p) putchar(*p++);
155
-}
156
-
157
-#ifdef	IMAGE_MENU
158
-/**************************************************************************
159
-INET_ATON - Convert an ascii x.x.x.x to binary form
160
-**************************************************************************/
161
-int inet_aton(char *p, in_addr *i)
162
-{
163
-	unsigned long ip = 0;
164
-	int val;
165
-	if (((val = getdec(&p)) < 0) || (val > 255)) return(0);
166
-	if (*p != '.') return(0);
167
-	p++;
168
-	ip = val;
169
-	if (((val = getdec(&p)) < 0) || (val > 255)) return(0);
170
-	if (*p != '.') return(0);
171
-	p++;
172
-	ip = (ip << 8) | val;
173
-	if (((val = getdec(&p)) < 0) || (val > 255)) return(0);
174
-	if (*p != '.') return(0);
175
-	p++;
176
-	ip = (ip << 8) | val;
177
-	if (((val = getdec(&p)) < 0) || (val > 255)) return(0);
178
-	i->s_addr = htonl((ip << 8) | val);
179
-	return(1);
180
-}
181
-
182
-#endif	/* IMAGE_MENU */
183
-
184
-int getdec(char **ptr)
185
-{
186
-	char *p = *ptr;
187
-	int ret=0;
188
-	if ((*p < '0') || (*p > '9')) return(-1);
189
-	while ((*p >= '0') && (*p <= '9')) {
190
-		ret = ret*10 + (*p - '0');
191
-		p++;
192
-	}
193
-	*ptr = p;
194
-	return(ret);
195
-}
196
-
197
-#define K_RDWR		0x60		/* keyboard data & cmds (read/write) */
198
-#define K_STATUS	0x64		/* keyboard status */
199
-#define K_CMD		0x64		/* keybd ctlr command (write-only) */
200
-
201
-#define K_OBUF_FUL	0x01		/* output buffer full */
202
-#define K_IBUF_FUL	0x02		/* input buffer full */
203
-
204
-#define KC_CMD_WIN	0xd0		/* read  output port */
205
-#define KC_CMD_WOUT	0xd1		/* write output port */
206
-#define KB_SET_A20	0xdf		/* enable A20,
207
-					   enable output buffer full interrupt
208
-					   enable data line
209
-					   disable clock line */
210
-#define KB_UNSET_A20	0xdd		/* enable A20,
211
-					   enable output buffer full interrupt
212
-					   enable data line
213
-					   disable clock line */
214
-#ifndef	IBM_L40
215
-static void empty_8042(void)
216
-{
217
-	unsigned long time;
218
-	char st;
219
-
220
-	time = currticks() + TICKS_PER_SEC;	/* max wait of 1 second */
221
-	while ((((st = inb(K_CMD)) & K_OBUF_FUL) ||
222
-	       (st & K_IBUF_FUL)) &&
223
-	       currticks() < time)
224
-		inb(K_RDWR);
225
-}
226
-#endif	IBM_L40
227
-
228
-/*
229
- * Gate A20 for high memory
230
- */
231
-void gateA20_set(void)
232
-{
233
-#ifdef	IBM_L40
234
-	outb(0x2, 0x92);
235
-#else	/* IBM_L40 */
236
-	empty_8042();
237
-	outb(KC_CMD_WOUT, K_CMD);
238
-	empty_8042();
239
-	outb(KB_SET_A20, K_RDWR);
240
-	empty_8042();
241
-#endif	/* IBM_L40 */
242
-}
243
-
244
-#ifdef	TAGGED_IMAGE
245
-/*
246
- * Unset Gate A20 for high memory - some operating systems (mainly old 16 bit
247
- * ones) don't expect it to be set by the boot loader.
248
- */
249
-void gateA20_unset(void)
250
-{
251
-#ifdef	IBM_L40
252
-	outb(0x0, 0x92);
253
-#else	/* IBM_L40 */
254
-	empty_8042();
255
-	outb(KC_CMD_WOUT, K_CMD);
256
-	empty_8042();
257
-	outb(KB_UNSET_A20, K_RDWR);
258
-	empty_8042();
259
-#endif	/* IBM_L40 */
260
-}
261
-#endif
262
-
263
-#ifdef	ETHERBOOT32
264
-/* Serial console is only implemented in ETHERBOOT32 for now */
265
-void
266
-putchar(int c)
267
-{
268
-#ifndef	ANSIESC
269
-	if (c == '\n')
270
-		putchar('\r');
271
-#endif
272
-
273
-#ifdef	CONSOLE_CRT
274
-#ifdef	ANSIESC
275
-	handleansi(c);
276
-#else
277
-	putc(c);
278
-#endif
279
-#endif
280
-#ifdef	CONSOLE_SERIAL
281
-#ifdef	ANSIESC
282
-	if (c == '\n')
283
-		serial_putc('\r');
284
-#endif
285
-	serial_putc(c);
286
-#endif
287
-}
288
-
289
-/**************************************************************************
290
-GETCHAR - Read the next character from the console WITHOUT ECHO
291
-**************************************************************************/
292
-int
293
-getchar(void)
294
-{
295
-	int c = 256;
296
-
297
-#if defined CONSOLE_CRT || defined CONSOLE_SERIAL
298
-	do {
299
-#ifdef	CONSOLE_CRT
300
-		if (ischar())
301
-			c = getc();
302
-#endif
303
-#ifdef	CONSOLE_SERIAL
304
-		if (serial_ischar())
305
-			c = serial_getc();
306
-#endif
307
-	} while (c==256);
308
-	if (c == '\r')
309
-		c = '\n';
310
-#endif		
311
-	return c;
312
-}
313
-
314
-int
315
-iskey(void)
316
-{
317
-#ifdef	CONSOLE_CRT
318
-	if (ischar())
319
-		return 1;
320
-#endif
321
-#ifdef	CONSOLE_SERIAL
322
-	if (serial_ischar())
323
-		return 1;
324
-#endif
325
-	return 0;
326
-}
327
-#endif	/* ETHERBOOT32 */
328
-
329
-/*
330
- * Local variables:
331
- *  c-basic-offset: 8
332
- * End:
333
- */
334
- 
335
-#include <asm/msr.h>
336
-
337
-#define CPUCLOCK 166
338
-
339
-unsigned long currticks(void)
340
-{
341
-    register unsigned long l, h;
342
-    long long unsigned p;
343
-    long long unsigned hh,ll;
344
-    
345
-    rdtsc(l, h);
346
-    ll = l, hh = h;
347
-
348
-    p = (ll + hh * 0x100000000LL) * 182 / (CPUCLOCK * 100000LL);
349
-    return (unsigned)p;
350
-}
351
-

+ 0
- 756
contrib/baremetal/startmpcc.S 查看文件

@@ -1,756 +0,0 @@
1
-/* #defines because ljmp wants a number, probably gas bug */
2
-/*	.equ	KERN_CODE_SEG,_pmcs-_gdt	*/
3
-#define	KERN_CODE_SEG	0x08
4
-	.equ	KERN_DATA_SEG,_pmds-_gdt
5
-/*	.equ	REAL_CODE_SEG,_rmcs-_gdt	*/
6
-#define	REAL_CODE_SEG	0x18
7
-	.equ	REAL_DATA_SEG,_rmds-_gdt
8
-	.equ	CR0_PE,1
9
-
10
-#ifdef	GAS291
11
-#define DATA32 data32;
12
-#define ADDR32 addr32;
13
-#define	LJMPI(x)	ljmp	x
14
-#else
15
-#define DATA32 data32
16
-#define ADDR32 addr32
17
-/* newer GAS295 require #define	LJMPI(x)	ljmp	*x */
18
-#define	LJMPI(x)	ljmp	x
19
-#endif
20
-
21
-#define PIC1_VBS  0x08      /* PIC1 interrupts start at vector 64  */
22
-#define PIC2_VBS  0x70      /* PIC1 interrupts start at vector 112  */
23
-
24
-/*
25
- * NOTE: if you write a subroutine that is called from C code (gcc/egcs),
26
- * then you only have to take care of %ebx, %esi, %edi and %ebp.  These
27
- * registers must not be altered under any circumstance.  All other registers
28
- * may be clobbered without any negative side effects.  If you don't follow
29
- * this rule then you'll run into strange effects that only occur on some
30
- * gcc versions (because the register allocator may use different registers).
31
- *
32
- * All the data32 prefixes for the ljmp instructions are necessary, because
33
- * the assembler emits code with a relocation address of 0.  This means that
34
- * all destinations are initially negative, which the assembler doesn't grok,
35
- * because for some reason negative numbers don't fit into 16 bits. The addr32
36
- * prefixes are there for the same reasons, because otherwise the memory
37
- * references are only 16 bit wide.  Theoretically they are all superfluous.
38
- * One last note about prefixes: the data32 prefixes on all call _real_to_prot
39
- * instructions could be removed if the _real_to_prot function is changed to
40
- * deal correctly with 16 bit return addresses.  I tried it, but failed.
41
- */
42
-
43
-/**************************************************************************
44
-START - Where all the fun begins....
45
-**************************************************************************/
46
-/* this must be the first thing in the file because we enter from the top */
47
-	.global	_start
48
-	.code32
49
-_start:
50
-	cli
51
-	
52
-	/* load new IDT and GDT */
53
-	lgdt	gdtarg
54
-	lidt	Idt_Reg
55
-	/* flush prefetch queue, and reload %cs:%eip */
56
-	ljmp	$KERN_CODE_SEG,$1f
57
-1:
58
-	
59
-	/* reload other segment registers */
60
-	movl	$KERN_DATA_SEG,%eax
61
-	movl	%eax,%ds
62
-	movl	%eax,%es
63
-	movl	%eax,%ss
64
-        movl    $stktop,%esp
65
-
66
-	/* program the PITs in order to stop them */
67
-        mov	$0x30,%al
68
-	out	%al,$0x43
69
-	out	%al,$0x40
70
-        mov	$0x70,%al
71
-	out	%al,$0x43
72
-	out	%al,$0x41
73
-        mov	$0xf0,%al
74
-	out	%al,$0x43
75
-	out	%al,$0x42	
76
-
77
-	call	main
78
-	/* fall through */
79
-
80
-	.globl	exit
81
-exit:
82
-2:
83
-        ljmp $KERN_CODE_SEG,$2b
84
-
85
-/**************************************************************************
86
-MEMSIZE - Determine size of extended memory
87
-**************************************************************************/
88
-	.globl	memsize
89
-memsize:
90
-#if 0
91
-	pushl	%ebx
92
-	pushl	%esi
93
-	pushl	%edi
94
-	call	_prot_to_real
95
-	.code16
96
-	movw	$0xe801,%ax
97
-	stc
98
-	int	$0x15
99
-	jc	1f
100
-	andl	$0xffff,%eax
101
-	andl	$0xffff,%ebx
102
-	shll	$6,%ebx
103
-	addl	%ebx,%eax
104
-	jmp	2f
105
-1:
106
-	movw	$0x8800,%ax
107
-	int	$0x15
108
-	andl	$0xffff,%eax
109
-2:
110
-	movl	%eax,%esi
111
-	DATA32 call	_real_to_prot
112
-	.code32
113
-	movl	%esi,%eax
114
-	popl	%edi
115
-	popl	%esi
116
-	popl	%ebx
117
-#else
118
-	mov	$32768,%eax
119
-#endif
120
-	ret
121
-
122
-/**************************************************************************
123
-XSTART - Transfer control to the kernel just loaded
124
-**************************************************************************/
125
-	.code16
126
-
127
-	.globl _int08_handler
128
-_int08_handler:
129
-	movb	$0x20, %al
130
-	outb	%al, $0x20
131
-	iret
132
-
133
-	.globl _int10_handler
134
-_int10_handler:
135
-	cmp	$0x3, %ah
136
-	jnz	_int10_04
137
-	mov	$0x0, %dx
138
-	mov	$0x0, %cx
139
-	iret
140
-_int10_04:
141
-	cmp	$0x4, %ah
142
-	jnz	_int10_05
143
-	mov	$0x0, %ah
144
-	iret
145
-_int10_05:
146
-	cmp	$0x5, %ah
147
-	jnz	_int10_08
148
-	mov	$0x0, %al
149
-	iret
150
-_int10_08:
151
-	cmp	$0x8, %ah
152
-	jnz	_int10_0D
153
-	mov 	$0x20, %al
154
-	mov 	$0x7,  %ah
155
-	iret
156
-_int10_0D:
157
-	cmp	$0xD, %ah
158
-	jnz	_int10_0F
159
-	mov	$0x0, %al
160
-	iret
161
-_int10_0F:
162
-	cmp	$0xF, %ah
163
-	jnz	_int10_XX
164
-	mov	$0xb, %al
165
-	mov	$80, %ah
166
-	mov	$0, %bh
167
-_int10_XX:
168
-	iret
169
-	
170
-	.globl _int11_handler
171
-_int11_handler:
172
-	mov	$0x22, %ax
173
-	iret
174
-	
175
-	.globl _int12_handler
176
-_int12_handler:
177
-	mov	$640, %ax
178
-	iret
179
-	
180
-	.globl _int13_handler
181
-_int13_handler:
182
-	clc
183
-	mov	$0, %ah
184
-	iret
185
-
186
-	.globl _int14_handler
187
-_int14_handler:
188
-	iret
189
-
190
-	.globl _int15_handler
191
-_int15_handler:
192
-	cmp	$0xe801,%ax
193
-	jz	_int15_008
194
-	cmp	$0x0, %ah
195
-	jz	_int15_000
196
-	cmp	$0x1, %ah
197
-	jz	_int15_000
198
-	cmp	$0x2, %ah
199
-	jz	_int15_000
200
-	cmp	$0x3, %ah
201
-	jz	_int15_000
202
-	cmp	$0xf, %ah
203
-	jz	_int15_000
204
-	cmp	$0x21, %ah
205
-	jz	_int15_000
206
-	cmp	$0x40, %ah
207
-	jz	_int15_000
208
-	cmp	$0x41, %ah
209
-	jz	_int15_000
210
-	cmp	$0x42, %ah
211
-	jz	_int15_000
212
-	cmp	$0x43, %ah
213
-	jz	_int15_000
214
-	cmp	$0x44, %ah
215
-	jz	_int15_000
216
-	cmp	$0x80, %ah
217
-	jz	_int15_001
218
-	cmp	$0x81, %ah
219
-	jz	_int15_001
220
-	cmp	$0x82, %ah
221
-	jz	_int15_002
222
-	cmp	$0x83, %ah
223
-	jz	_int15_003
224
-	cmp	$0x84, %ah
225
-	jz	_int15_000
226
-	cmp	$0x85, %ah
227
-	jz	_int15_004
228
-	cmp	$0x86, %ah
229
-	jz	_int15_003
230
-	cmp	$0x87, %ah
231
-	jz	_int15_005
232
-	cmp	$0x88, %ah
233
-	jz	_int15_006
234
-	cmp	$0x89, %ah
235
-	jz	_int15_005
236
-	cmp	$0x90, %ah
237
-	jz	_int15_007
238
-	cmp	$0xc0, %ah
239
-	jz	_int15_000
240
-	cmp	$0xc1, %ah
241
-	jz	_int15_000
242
-	cmp	$0xc2, %ah
243
-	jz	_int15_000
244
-	cmp	$0xc3, %ah
245
-	jz	_int15_000
246
-	cmp	$0xc4, %ah
247
-	jz	_int15_000
248
-	iret
249
-
250
-_int15_000:
251
-	mov	$0x86, %ah
252
-	stc
253
-	iret
254
-
255
-_int15_001:
256
-	mov	$0, %bx
257
-	mov	$0, %cx
258
-	iret
259
-
260
-_int15_002:
261
-	mov	$0, %bx
262
-	iret
263
-
264
-_int15_003:
265
-	clc
266
-	iret
267
-
268
-_int15_004:
269
-	mov	$0, %al
270
-	iret
271
-
272
-_int15_005:
273
-	mov	$0, %ah
274
-	clc
275
-	cmp 	$0, %ah
276
-	iret
277
-
278
-_int15_006:
279
-	mov	$0xf000, %ax
280
-	iret
281
-
282
-_int15_007:
283
-	stc
284
-	iret
285
-
286
-_int15_008:
287
-	clc
288
-	mov	$1024, %dx	/* dx -> extended memory size (in 64K chuncks) */
289
-	mov	$640, %cx	/* cx -> conventional memory size (in 1 Kbytes chuncks) */
290
-	iret
291
-
292
-	.globl _int16_handler
293
-_int16_handler:
294
-	cmp	$0x0, %ah
295
-	jnz	_int16_01
296
-	mov	$0x20, %al
297
-	mov 	$0x39, %ah
298
-	iret
299
-_int16_01:
300
-	cmp	$0x1, %ah
301
-	jnz	_int16_02
302
-	iret
303
-_int16_02:
304
-	cmp	$0x2, %ah
305
-	jnz	_int16_05
306
-	mov	$0, %al
307
-	iret
308
-_int16_05:
309
-	cmp	$0x5, %ah
310
-	jnz	_int16_10
311
-	mov	$0, %al
312
-	iret
313
-_int16_10:
314
-	cmp	$0x10, %ah
315
-	jnz	_int16_11
316
-	mov	$0x20, %al
317
-	mov 	$0x39, %ah
318
-	iret
319
-_int16_11:
320
-	cmp	$0x11, %ah
321
-	jnz	_int16_12
322
-	iret
323
-_int16_12:
324
-	cmp	$0x12, %ah
325
-	jnz	_int16_XX
326
-	mov $0, %ax
327
-	iret
328
-_int16_XX:
329
-	iret
330
-
331
-	.globl _int17_handler
332
-_int17_handler:
333
-	mov $0xd0, %ah
334
-	iret
335
-
336
-	.globl _int19_handler
337
-_int19_handler:
338
-	hlt
339
-	iret
340
-
341
-	.globl _int1A_handler
342
-_int1A_handler:
343
-	stc
344
-	iret
345
-
346
-	.code32
347
-	.globl	xstart
348
-xstart:
349
-	/* reprogram the PICs so that interrupt are masked */
350
-        movb    $0x11,%al	/* ICW1 [ICW4 NEEDED, EDGE TRIGGERED]*/
351
-	outb    %al,$0x20
352
-        movb    $PIC1_VBS, %al
353
-	outb    %al,$0x21
354
-        movb    $0x4,%al
355
-	outb    %al,$0x21
356
-        movb    $0x1,%al
357
-	outb    %al,$0x21
358
-        movb    $0xff,%al
359
-	outb    %al,$0x21
360
-	
361
-        movb    $0x11,%al	/* ICW1 [ICW4 NEEDED, EDGE TRIGGERED]*/
362
-	outb    %al,$0xa0
363
-        movb    $PIC2_VBS, %al
364
-	outb    %al,$0xa1
365
-        movb    $0x2,%al
366
-	outb    %al,$0xa1
367
-        movb    $0x1,%al
368
-	outb    %al,$0xa1
369
-        movb    $0xff,%al
370
-	outb    %al,$0xa1
371
-
372
-	pushl	%ebp
373
-	movl	%esp,%ebp
374
-	pushl	%ebx
375
-	pushl	%esi
376
-	pushl	%edi
377
-	movl	8(%ebp),%eax
378
-	movl	%eax,_execaddr
379
-	movl	12(%ebp),%ebx
380
-	movl	16(%ebp),%ecx	/* bootp record (32bit pointer) */
381
-	addl	$28,%ecx	/* ip, udp header */
382
-	shll	$12,%ecx
383
-	shrw	$12,%cx
384
-	call	_prot_to_real
385
-	.code16
386
-/* MP: add int10 handler */
387
-	push	%eax
388
-	push	%ebx
389
-	push	%es
390
-	mov	$0,%ax
391
-	mov	%ax,%es
392
-	mov	%cs,%ax
393
-	shl	$16,%eax
394
-
395
-	ADDR32 mov	$(_int08_handler-_start),%ax
396
-	mov	$0x20,%ebx
397
-	mov	%eax,%es:(%bx)
398
-
399
-	ADDR32 mov	$(_int10_handler-_start),%ax
400
-	mov	$0x40,%ebx
401
-	mov	%eax,%es:(%bx)
402
-
403
-	ADDR32 mov	$(_int11_handler-_start),%ax
404
-	mov	$0x44,%ebx
405
-	mov	%eax,%es:(%bx)
406
-
407
-	ADDR32 mov	$(_int12_handler-_start),%ax
408
-	mov	$0x48,%ebx
409
-	mov	%eax,%es:(%bx)
410
-
411
-	ADDR32 mov	$(_int13_handler-_start),%ax
412
-	mov	$0x4c,%ebx
413
-	mov	%eax,%es:(%bx)
414
-
415
-	ADDR32 mov	$(_int14_handler-_start),%ax
416
-	mov	$0x50,%ebx
417
-	mov	%eax,%es:(%bx)
418
-
419
-	ADDR32 mov	$(_int15_handler-_start),%ax
420
-	mov	$0x54,%ebx
421
-	mov	%eax,%es:(%bx)
422
-
423
-	ADDR32 mov	$(_int16_handler-_start),%ax
424
-	mov	$0x58,%ebx
425
-	mov	%eax,%es:(%bx)
426
-
427
-	ADDR32 mov	$(_int17_handler-_start),%ax
428
-	mov	$0x5c,%ebx
429
-	mov	%eax,%es:(%bx)
430
-
431
-	ADDR32 mov	$(_int19_handler-_start),%ax
432
-	mov	$0x64,%ebx
433
-	mov	%eax,%es:(%bx)
434
-
435
-	ADDR32 mov	$(_int1A_handler-_start),%ax
436
-	mov	$0x68,%ebx
437
-	mov	%eax,%es:(%bx)
438
-
439
-	pop	%es
440
-	pop	%ebx
441
-	pop	%eax
442
-/* */
443
-	pushl	%ecx		/* bootp record */
444
-	pushl	%ebx		/* file header */
445
-	movl	$((RELOC<<12)+(1f-RELOC)),%eax
446
-	pushl	%eax
447
-	ADDR32	LJMPI(_execaddr-_start)
448
-1:
449
-	addw	$8,%sp		/* XXX or is this 10 in case of a 16bit "ret" */
450
-	DATA32 call	_real_to_prot
451
-	.code32
452
-	popl	%edi
453
-	popl	%esi
454
-	popl	%ebx
455
-	popl	%ebp
456
-	ret
457
-
458
-_execaddr:
459
-	.long	0
460
-
461
-#ifdef	IMAGE_MULTIBOOT
462
-/**************************************************************************
463
-XEND - Restart Etherboot from the beginning (from protected mode)
464
-**************************************************************************/
465
-
466
-	.globl	xend
467
-xend:
468
-	cs
469
-	lidt	idtarg_realmode-_start+RELOC
470
-	cs
471
-	lgdt	gdtarg-_start+RELOC
472
-#ifdef	GAS291
473
-	ljmp	$REAL_CODE_SEG,$1f-RELOC	/* jump to a 16 bit segment */
474
-#else
475
-	ljmp	$REAL_CODE_SEG,$1f-_start	/* jump to a 16 bit segment */
476
-#endif	/* GAS291 */
477
-1:
478
-	.code16
479
-	movw	$REAL_DATA_SEG,%ax
480
-	movw	%ax,%ds
481
-	movw	%ax,%ss
482
-	movw	%ax,%es
483
-
484
-	/* clear the PE bit of CR0 */
485
-	movl	%cr0,%eax
486
-	andl	$0!CR0_PE,%eax
487
-	movl	%eax,%cr0
488
-
489
-	/* make intersegment jmp to flush the processor pipeline
490
-	 * and reload %cs:%eip (to clear upper 16 bits of %eip).
491
-	 */
492
-	DATA32 ljmp	$(RELOC)>>4,$2f-_start
493
-2:
494
-	/* we are in real mode now
495
-	 * set up the real mode segment registers : %ds, %ss, %es
496
-	 */
497
-	movw	%cs,%ax
498
-	movw	%ax,%ds
499
-	movw	%ax,%es
500
-	movw	%ax,%ss
501
-	xorl	%esp,%esp
502
-	ADDR32 movw	initsp-RELOC,%sp
503
-
504
-	movw	$0,%ax
505
-	movw	%ax,%fs
506
-	movw	%ax,%gs
507
-
508
-	sti
509
-	jmp	_start
510
-
511
-	.code32
512
-#endif	/* IMAGE_MULTIBOOT */
513
-
514
-.global get_cs
515
-get_cs:
516
-	xorl	%eax,%eax
517
-	movw	%cs,%ax
518
-	ret
519
-
520
-.global get_ds
521
-get_ds:
522
-	xorl	%eax,%eax
523
-	movw	%ds,%ax
524
-	ret
525
-
526
-.global getsp
527
-getsp:
528
-	movl	%esp,%eax	/* GET STACK POINTER */
529
-	subl	$4, %eax 	/* ACCOUNT FOR RETURN ADDRESS ON */
530
-	ret
531
-
532
-.global get_gdtbase
533
-get_gdtbase:
534
-	sub	$8,%esp			/* ALLOCATE ROOM ON THE STACK */
535
-	sgdt	(%esp,1)		/*STORE IGDT REGISTER ON STACK */
536
-	mov	2(%esp),%eax		/* READ GDT BASE ADDRESS */
537
-	mov	$KERN_DATA_SEG,%dx 	/* ASSUME UNIVERSAL DS. */
538
-	add	$8,%esp			/* RESTORE STACK */
539
-	ret				/* DONE */
540
-
541
-.global get_gdtsize
542
-get_gdtsize:
543
-	sub 	$8,%esp	/* ALLOCATE ROOM ON THE STACK */
544
-	sgdt	(%esp,1)	/*STORE IGDT REGISTER ON STACK */
545
-	xor	%eax,%eax
546
-	mov	2(%esp),%eax	/* READ GDT BASE ADDRESS */
547
-	mov	(%ESP),%ax
548
-	shr	$3,%ax
549
-	add	$8,%esp	/* RESTORE STACK */
550
-	ret			/* DONE */
551
-
552
-.global get_idtbase
553
-get_idtbase:
554
-	sub	$8,%esp
555
-	sidt   (%esp,1) 	/* STORE IIDT REGISTER ON STACK */
556
-	mov	2(%esp),%eax
557
-	mov	$KERN_DATA_SEG,%dx
558
-	add	$8,%esp
559
-	ret
560
-
561
-.global get_lw
562
-get_lw:
563
-	xor	%edx,%edx
564
-	mov	8(%esp),%eax
565
-	mov	4(%esp),%dx
566
-	ret
567
-	 
568
-/**************************************************************************
569
-SETJMP - Save stack context for non-local goto
570
-**************************************************************************/
571
-	.globl	setjmp
572
-setjmp:
573
-	mov	4(%esp),%ecx
574
-	mov	0(%esp),%edx
575
-	mov	%edx,0(%ecx)
576
-	mov	%ebx,4(%ecx)
577
-	mov	%esp,8(%ecx)
578
-	mov	%ebp,12(%ecx)
579
-	mov	%esi,16(%ecx)
580
-	mov	%edi,20(%ecx)
581
-	mov	%eax,24(%ecx)
582
-	mov	$0,%eax
583
-	ret
584
-
585
-/**************************************************************************
586
-LONGJMP - Non-local jump to a saved stack context
587
-**************************************************************************/
588
-	.globl	longjmp
589
-longjmp:
590
-	mov	4(%esp),%edx
591
-	mov	8(%esp),%eax
592
-	mov	0(%edx),%ecx
593
-	mov	4(%edx),%ebx
594
-	mov	8(%edx),%esp
595
-	mov	12(%edx),%ebp
596
-	mov	16(%edx),%esi
597
-	mov	20(%edx),%edi
598
-	cmp	$0,%eax
599
-	jne	1f
600
-	mov	$1,%eax
601
-1:	mov	%ecx,0(%esp)
602
-	ret
603
-
604
-/**************************************************************************
605
-_REAL_TO_PROT - Go from REAL mode to Protected Mode
606
-**************************************************************************/
607
-	.globl	_real_to_prot
608
-_real_to_prot:
609
-	.code16
610
-	cli
611
-	cs
612
-	ADDR32 lgdt	gdtarg-_start
613
-	movl	%cr0,%eax
614
-	orl	$CR0_PE,%eax
615
-	movl	%eax,%cr0		/* turn on protected mode */
616
-
617
-	/* flush prefetch queue, and reload %cs:%eip */
618
-	DATA32 ljmp	$KERN_CODE_SEG,$1f
619
-1:
620
-	.code32
621
-	/* reload other segment registers */
622
-	movl	$KERN_DATA_SEG,%eax
623
-	movl	%eax,%ds
624
-	movl	%eax,%es
625
-	movl	%eax,%ss
626
-	addl	$RELOC,%esp		/* Fix up stack pointer */
627
-	xorl	%eax,%eax
628
-	movl	%eax,%fs
629
-	movl	%eax,%gs
630
-	popl	%eax			/* Fix up return address */
631
-	addl	$RELOC,%eax
632
-	pushl	%eax
633
-	ret
634
-
635
-/**************************************************************************
636
-_PROT_TO_REAL - Go from Protected Mode to REAL Mode
637
-**************************************************************************/
638
-	.globl	_prot_to_real
639
-_prot_to_real:
640
-	.code32
641
-	popl	%eax
642
-	subl	$RELOC,%eax		/* Adjust return address */
643
-	pushl	%eax
644
-	subl	$RELOC,%esp		/* Adjust stack pointer */
645
-#ifdef	GAS291
646
-	ljmp	$REAL_CODE_SEG,$1f-RELOC	/* jump to a 16 bit segment */
647
-#else
648
-	ljmp	$REAL_CODE_SEG,$1f-_start	/* jump to a 16 bit segment */
649
-#endif	/* GAS291 */
650
-1:
651
-	.code16
652
-	movw	$REAL_DATA_SEG,%ax
653
-	movw	%ax,%ds
654
-	movw	%ax,%ss
655
-	movw	%ax,%es
656
-	movw	%ax,%fs
657
-	movw	%ax,%gs
658
-	cli
659
-
660
-	/* clear the PE bit of CR0 */
661
-	movl	%cr0,%eax
662
-	andl	$0!CR0_PE,%eax
663
-	movl	%eax,%cr0
664
-
665
-	/* make intersegment jmp to flush the processor pipeline
666
-	 * and reload %cs:%eip (to clear upper 16 bits of %eip).
667
-	 */
668
-	DATA32 ljmp	$(RELOC)>>4,$2f-_start
669
-2:
670
-	/* we are in real mode now
671
-	 * set up the real mode segment registers : %ds, $ss, %es
672
-	 */
673
-	movw	%cs,%ax
674
-	movw	%ax,%ds
675
-	movw	%ax,%es
676
-	movw	%ax,%ss
677
-#if 0
678
-	sti
679
-#endif
680
-	DATA32 ret	/* There is a 32 bit return address on the stack */
681
-	.code32
682
-
683
-/**************************************************************************
684
-GLOBAL DESCRIPTOR TABLE
685
-**************************************************************************/
686
-	.align	4
687
-Idt_Reg:
688
-	.word 0x3ff
689
-	.long 0
690
-
691
-	.align	4
692
-_gdt:
693
-gdtarg:
694
-Gdt_Table:
695
-	.word	0x27			/* limit */
696
-	.long	_gdt			/* addr */
697
-	.word	0
698
-_pmcs:
699
-	/* 32 bit protected mode code segment */
700
-	.word	0xffff,0
701
-	.byte	0,0x9f,0xcf,0
702
-
703
-_pmds:
704
-	/* 32 bit protected mode data segment */
705
-	.word	0xffff,0
706
-	.byte	0,0x93,0xcf,0
707
-
708
-_rmcs:
709
-	/* 16 bit real mode code segment */
710
-	.word	0xffff,(RELOC&0xffff)
711
-	.byte	(RELOC>>16),0x9b,0x00,(RELOC>>24)
712
-
713
-_rmds:
714
-	/* 16 bit real mode data segment */
715
-	.word	0xffff,(RELOC&0xffff)
716
-	.byte	(RELOC>>16),0x93,0x00,(RELOC>>24)
717
-
718
-	.align	4
719
-RUN_GDT: 			/* POINTER TO GDT IN RAM */
720
-	 .byte	 0x7f,0		/* [BSP_GDT_NUM*8]-1 */
721
-	 .long	 Gdt_Table
722
-
723
-	.align	4
724
-
725
-	.section ".rodata"
726
-err_not386:
727
-	.ascii	"Etherboot/32 requires 386+"
728
-	.byte	0x0d, 0x0a
729
-err_not386_end:
730
-
731
-days:	.long	0
732
-irq_num: .long
733
-
734
-        .data
735
-	.align	4
736
-        .org 2048
737
-.global stktop
738
-stktop:
739
-	.long
740
-
741
-.section ".armando"
742
-/*                 1:::::::::2:::::::::3:::::::3 */
743
-/*        12345678901234567890123456789012345678 */
744
-/*       v----+----v----+----v----+----v----+--- */
745
-
746
-.global EtherbootString
747
-EtherbootString:
748
-.ascii	"EtherBoot MPCC  "	/* fw identifier */
749
-
750
-.byte	0, 0		/* mandatory hole */
751
-
752
-.long	_start		/* entry point */
753
-.word	0
754
-.byte	'E'		/* type */
755
-.byte	0		/* selector */
756
-.word	0		/* CRC */

+ 0
- 9
contrib/bin2intelhex/Makefile 查看文件

@@ -1,9 +0,0 @@
1
-
2
-CC=gcc
3
-CFLAGS=-Wall -O2
4
-
5
-bin2intelhex:
6
-
7
-
8
-clean:
9
-	rm -f bin2intelhex core *.o

+ 0
- 148
contrib/bin2intelhex/bin2intelhex.c 查看文件

@@ -1,148 +0,0 @@
1
-/* name : bin2intelhex.c
2
- * from : Jean Marc Lacroix <jeanmarc.lacroix@free.fr>
3
- * date : 06/12/1997.
4
- * abstract : Y have rewrite this program from ????? with some modifications
5
- * to add :
6
- * - the Intel specification.
7
- * - correct a bug because my prom programmer don't understand the
8
- * initial format. Y suspect a bug in the calcul of the lrc
9
- * in the original program.
10
- * - correct the format of printf . In the original program, it was
11
- *   %x, and it is in fact %X, because in the Intel Format, all the
12
- * char are in upper case.
13
- * - correct the lrc calculation.
14
- * usage:
15
- *-------
16
- * this program read the standard input and put to the standard output
17
- * the result of the conversion.
18
- * an example of use :
19
- * cat my_bin | bin2intelhex > my_bin.hex or.....
20
- * bin2intelhex < my_bin > my_bin.hex
21
- */
22
-
23
-
24
-/*
25
- * $Id$
26
- * $Log$
27
- * Revision 1.1  2005/05/17 16:45:06  mcb30
28
- * Initial revision
29
- *
30
- * Revision 1.9  1997/12/14 05:14:54  install
31
- * - some documentation....
32
- *
33
- */
34
-
35
-#include <stdio.h>
36
-#include <unistd.h>
37
-
38
-/* Intel Hex format specifications
39
-
40
-The 8-bit Intel Hex File Format is a printable ASCII format consisting of one
41
- or more data records followed by an end of file record. Each
42
-record consists of one line of information. Data records may appear in any
43
- order. Address and data values are represented as 2 or 4 hexadecimal
44
-digit values. 
45
-
46
-Record Format 
47
-:LLAAAARRDDDD......DDDDCC 
48
-
49
-
50
-LL
51
-AAAA
52
-RR
53
-DD
54
-CC
55
-Length field. Number of data bytes.
56
-Address field. Address of first byte.
57
-Record type field. 00 for data and 01 for end of record.
58
-Data field.
59
-Checksum field. One's complement of length, address, record type and data
60
- fields modulo 256. 
61
-CC = LL + AAAA + RR + all DD = 0
62
-
63
-Example: 
64
-:06010000010203040506E4 
65
-:00000001FF 
66
-
67
-The first line in the above example Intel Hex file is a data record addressed
68
- at location 100H with data values 1 to 6. The second line is the end
69
-of file record, so that the LL field is 0
70
-
71
-*/
72
-
73
-
74
-typedef unsigned char t_u8;
75
-typedef unsigned short t_u16;
76
-/*
77
- * the choice for the total length (16) of a line, but the specification
78
- * can support an another value
79
- */
80
-#define LL_MAX_LINE 16
81
-typedef struct 
82
-{ 
83
-  t_u8 intel_lg_data;
84
-  t_u16 intel_adr;
85
-  t_u8 intel_type;
86
-  t_u8 intel_data [LL_MAX_LINE];
87
-  t_u8 intel_lrc;
88
-} t_one_line;
89
-#define INTEL_DATA_TYPE 0
90
-#define EXIT_OK 0
91
-int main (const int argc, const char ** const argv)
92
-{
93
-  t_one_line line;
94
-  /*
95
-   * init for the adress, please note that it is assume that the program begin at 0
96
-   */
97
-  line.intel_adr = 0;
98
-  line.intel_type = INTEL_DATA_TYPE;
99
-  /*
100
-   * read the data on the standard input
101
-   */
102
-  while ((line.intel_lg_data = read (0, &line.intel_data [0] ,LL_MAX_LINE )) > 0) 
103
-    {
104
-      t_u8 i; 
105
-      /*
106
-       * and now for this line, calculate the lrc.
107
-       */
108
-      line.intel_lrc = line.intel_lg_data;
109
-      line.intel_lrc += ((line.intel_adr >> 8) & 0xff);
110
-      line.intel_lrc += (line.intel_adr &0xff);
111
-      line.intel_lrc += line.intel_type;
112
-      /*
113
-       * the structure is ready, print it to stdout in the
114
-       * right format
115
-       */
116
-      (void) printf (":%02X%04X%02X",
117
-		     line.intel_lg_data,
118
-		     line.intel_adr,
119
-		     line.intel_type);
120
-      /*
121
-       * edit all the data read
122
-       */
123
-      for (i=0; i<line.intel_lg_data; i++)
124
-	{
125
-	  (void) printf ("%02X",
126
-			 (line.intel_data [i] & 0xff));	  
127
-	  /*
128
-	   * add to the lrc the data print
129
-	   */
130
-	  line.intel_lrc +=line.intel_data [i];
131
-	}
132
-      /*
133
-       * edit the value of the lrc and new line for the next
134
-       */
135
-      (void) printf ("%02X\n",
136
-			 (0x100 - line.intel_lrc) & 0xff);
137
-      /* 
138
-       * prepare the new adress for the next line
139
-       */
140
-      line.intel_adr+=line.intel_lg_data;     
141
-    }
142
-  /*
143
-   * print the last line with a length of 0 data, so that the lrc is easy to
144
-   * calculate (ff+01 =0)
145
-   */
146
-  printf (":00000001FF\n");
147
-  exit (EXIT_OK); 
148
-}

+ 0
- 74
contrib/bin2intelhex/bin2intelhex.c.simple 查看文件

@@ -1,74 +0,0 @@
1
-/* 
2
-
3
-  Quick and dirty program to make intel-hex from a binary.
4
-
5
-  Written by R.E.Wolff@BitWizard.nl
6
-  This file is in the public domain
7
-
8
-  Typing started:
9
-
10
-  Mon Jun 16 00:24:15 MET DST 1997
11
-
12
-  programming stopped:
13
-
14
-  Mon Jun 16 00:31:27 MET DST 1997
15
-
16
-  debugging finished (2 bugs found):
17
-  Mon Jun 16 00:32:52 MET DST 1997
18
-
19
---------------------------------------------------------- 
20
-
21
-  Doc written in timeout. Everything else in this file was done while
22
-  the timer was running.
23
-
24
-  I promised "Mark Kopecki" that writing the bin-to-intel-hex
25
-  converter would cost less than 15 minutes, and that it would be more
26
-  trouble to find a converter on the net than to write the converter
27
-  myself.  I ended up spending over half an hour searching for
28
-  spec/converter/docs because of unreachable hosts on the internet. I
29
-  got a file with docs, after that it was 8 minutes.....
30
-
31
---------------------------------------------------------- 
32
-
33
-*/
34
-
35
-
36
-#include <stdio.h>
37
-#include <unistd.h>
38
-
39
-/* Intel Hex format:
40
-   
41
-   ll aaaa tt dd....dd cc
42
- 
43
-   ll = length
44
-   aaaa = address
45
-   tt = type
46
-   dd....dd = data
47
-   cc = checksum.
48
-*/
49
-
50
-
51
-int main (int argc, char **argv)
52
-{
53
-  unsigned char buf[32];
54
-  int addr = 0;
55
-  int n,i;
56
-
57
-  while ((n = read (0, buf+4, 16)) > 0) {
58
-    buf[0] = n;
59
-    buf[1] = addr >> 8;
60
-    buf[2] = addr & 0xff;
61
-    buf[3] = 0x00;
62
-    buf[4+n] = 0x00;
63
-
64
-    for (i=0;i<4+n;i++)
65
-      buf[4+n] -= buf[i];
66
-    printf (":");
67
-    for (i=0;i<= 4+n;i++)
68
-      printf ("%02x", buf[i]);
69
-    printf ("\n");
70
-    addr += n;
71
-  }
72
-  printf (":0000000001ff\n");
73
-  exit (0);
74
-}

+ 0
- 7
contrib/bochs/.gitignore 查看文件

@@ -1,7 +0,0 @@
1
-bochsout.txt
2
-parport.out
3
-ne2k-tx.log
4
-ne2k-txdump.txt
5
-tunctl
6
-bochs
7
-qemu

+ 0
- 10
contrib/bochs/Makefile 查看文件

@@ -1,10 +0,0 @@
1
-all : tunctl serial-console.1
2
-
3
-%.1 : %
4
-	pod2man $< > $@
5
-
6
-tunctl : tunctl.c
7
-	$(CC) -o $@ $<
8
-
9
-clean :
10
-	rm -f serial-console.1 tunctl

+ 0
- 95
contrib/bochs/README 查看文件

@@ -1,95 +0,0 @@
1
-Running Etherboot within Bochs
2
-==============================
3
-
4
-Michael Brown <mbrown@fensystems.co.uk>
5
-Based on an idea suggested by H. Peter Anvin <hpa@zytor.com>.
6
-
7
-$Id$
8
-
9
-Bochs is a program that simulates a complete Intel x86 computer,
10
-including hardware.  It can be used to test Etherboot.  There is a
11
-special pseudo NIC ("pnic") implemented in Bochs, with a corresponding
12
-driver in Etherboot.  (There is also an NE2000 ISA driver in Bochs,
13
-but it doesn't seem to quite work.)
14
-
15
-To get bochs running is fairly simple:
16
-
17
-1.  Build the utilities in this directory:
18
-      make
19
-
20
-2.  Get the bochs source code:
21
-      cvs -d:pserver:anonymous@bochs.cvs.sourceforge.net:/cvsroot/bochs \
22
-           login
23
-      cvs -d:pserver:anonymous@bochs.cvs.sourceforge.net:/cvsroot/bochs \
24
-           co bochs
25
-
26
-3.  Configure bochs with
27
-      pushd bochs
28
-      ./configure --enable-all-optimisations --enable-show-ips \
29
-		  --enable-cpu-level=6 \
30
-		  --enable-pci --enable-pnic --enable-ne2000 \
31
-                  --enable-debugger --enable-disasm
32
-      popd
33
-
34
-4.  Build bochs:
35
-      make -C bochs
36
-
37
-5.  As root, set up a TAP virtual network device:
38
-      /sbin/modprobe tun
39
-      chmod o+rw /dev/net/tun
40
-      ./tunctl -u <username> -t tap0
41
-      /sbin/ifconfig tap0 up 10.254.254.2 netmask 255.255.255.0
42
-
43
-6.  As root, add the following fragment to /etc/dhcpd.conf:
44
-      subnet 10.254.254.0 netmask 255.255.255.252 {
45
-        range dynamic-bootp 10.254.254.1 10.254.254.1;
46
-      }
47
-    You will also need to add in any of your usual declarations for
48
-    Etherboot, e.g. 'filename "vmlinuz.ltsp";'.  Note that this setup
49
-    assumes that your DHCP server, TFTP server etc. all live on the
50
-    machine you are using for running Bochs.  If not, then you're on
51
-    your own.
52
-
53
-7.  As root, restart dhcpd
54
-      /etc/init.d/dhcpd restart
55
-
56
-8.  Build Etherboot images
57
-      pushd ../../src
58
-      make bin/pnic.dsk
59
-      popd
60
-
61
-9.  Start Bochs
62
-      ./bochs/bochs -q
63
-    You should get to the debugger prompt "<bochs:1>".  Type "c" to
64
-    start running Bochs.
65
-
66
-You should see Bochs start up, load up Etherboot and attempt to boot
67
-from the network.
68
-
69
-
70
-
71
-Serial console
72
-==============
73
-
74
-You can use the program "serial-console" to obtain a virtual serial
75
-console for Etherboot running within Bochs.  Simply run
76
-"./serial-console" on a spare tty (e.g. a separate xterm window)
77
-before starting Bochs, and ensure that you have enabled CONSOLE_SERIAL
78
-in config.h.
79
-
80
-There is a manual page for "serial-console"; use
81
-"man ./serial-console.1" to view it.
82
-
83
-
84
-
85
-TODO
86
-====
87
-
88
-Packet forwarding/masquerading - document what must be set up.
89
-
90
-Mention possibility of using RFB as the display device - in
91
-conjunction with the serial console, gives you a test facility that
92
-can be accessed remotely.
93
-
94
-Mention use of BOCHSBP instruction (xchgw %bx,%bx) to avoid need to
95
-calculate breakpoints.

+ 0
- 79
contrib/bochs/README.qemu 查看文件

@@ -1,79 +0,0 @@
1
-Running gPXE within qemu
2
-========================
3
-
4
-Michael Brown <mbrown@fensystems.co.uk>
5
-
6
-To get qemu running is fairly simple:
7
-
8
-1.  Build the utilities in this directory:
9
-      make
10
-
11
-2.  Get the qemu source code:
12
-      svn co svn://svn.savannah.nongnu.org/qemu/trunk qemu
13
-
14
-2a. Patch the qemu code.  There is currently a bug that causes qemu to
15
-    execute gPXE incredibly slowly.  The bug seems to be related
16
-    to the relative prioritisation of CPU and I/O operations within
17
-    qemu.  This patch (which I found via Google) isn't a proper fix,
18
-    but it does work around the problem:
19
-      patch -p0 < qemu-patch
20
-
21
-3.  Configure qemu with
22
-      pushd qemu
23
-      ./configure --target-list=i386-softmmu,x86_64-softmmu
24
-      popd
25
-
26
-4.  Build qemu:
27
-      make -C qemu
28
-
29
-5.  As root, set up a TAP virtual network device:
30
-      /sbin/modprobe tun
31
-      chmod o+rw /dev/net/tun
32
-      ./tunctl -u <username> -t tap0
33
-      /sbin/ifconfig tap0 up 10.254.254.2 netmask 255.255.255.0
34
-
35
-6.  As root, add the following fragment to /etc/dhcpd.conf:
36
-      subnet 10.254.254.0 netmask 255.255.255.252 {
37
-        range dynamic-bootp 10.254.254.1 10.254.254.1;
38
-      }
39
-    You will also need to add in any of your usual declarations for
40
-    gPXE, e.g. 'filename "vmlinuz.ltsp";'.  Note that this setup
41
-    assumes that your DHCP server, TFTP server etc. all live on the
42
-    machine you are using for running qemu.  If not, then you're on
43
-    your own.
44
-
45
-7.  As root, restart dhcpd
46
-      /etc/init.d/dhcpd restart
47
-
48
-8.  Build gPXE floppy disk images and pad to 1.44MB
49
-      pushd ../../src
50
-      make bin/rtl8139.dsk
51
-      popd
52
-
53
-9.  Start qemu
54
-      ./qemu/i386-softmmu/qemu -L qemu/pc-bios \
55
-			       -net nic,model=rtl8139 -net tap,ifname=tap0 \
56
-			       -boot a -fda ../../src/bin/rtl8139.dsk
57
-
58
-You should see qemu start up, load up gPXE and attempt to boot from
59
-the network.
60
-
61
-
62
-
63
-Serial console
64
-==============
65
-
66
-You can use the program "serial-console" to obtain a virtual serial
67
-console for gPXE running within qemu.  Run "./serial-console" on a
68
-spare tty (e.g. a separate xterm window) before starting qemu, and
69
-ensure that you have enabled CONSOLE_SERIAL in config.h.
70
-
71
-When serial-console starts, it will print out the message "Slave pty
72
-is /dev/pts/XX", where XX is a number.  You need to append the option
73
-
74
-   -serial /dev/pts/XX
75
-
76
-to the qemu command line.
77
-
78
-There is a manual page for "serial-console"; use "man
79
-./serial-console.1" to view it.

+ 0
- 31
contrib/bochs/README.windows-ris 查看文件

@@ -1,31 +0,0 @@
1
-Debugging Windows Remote Installation Services (RIS) can be
2
-problematic.  Here are some assorted notes on the process:
3
-
4
-
5
-Getting hold of the files
6
-=========================
7
-
8
-Add/Remove Windows Components -> Remote Installation Services
9
-
10
-Files will be placed in \windows\system32\reminst.  Copy them out to a
11
-TFTP server.  Configure DHCP to hand out startrom.com.
12
-
13
-
14
-Getting past the "Press F12" message
15
-====================================
16
-
17
-Passing F12 through to the guest machine is difficult.  It's easier to
18
-patch the startrom.com binary to accept a different key.  Open
19
-startrom.com in a hex editor, search for the hex string
20
-6681fb00860000, and replace it with 6681fb66210000.  startrom.com will
21
-now accept the "F" key instead of "F12".
22
-
23
-
24
-
25
-DHCP filename
26
-=============
27
-
28
-Must use Windows backslash separator e.g. 'filename
29
-"OSChooser\\i386\\startrom.com";', otherwise startrom.com fails to
30
-correctly identify the path to NTLDR.
31
-

+ 0
- 20
contrib/bochs/bochs-writable-ROM-patch 查看文件

@@ -1,20 +0,0 @@
1
-Index: memory/memory.cc
2
-===================================================================
3
-RCS file: /cvsroot/bochs/bochs/memory/memory.cc,v
4
-retrieving revision 1.71
5
-diff -u -r1.71 memory.cc
6
---- memory/memory.cc	18 Oct 2008 18:10:14 -0000	1.71
7
-+++ memory/memory.cc	21 Oct 2008 19:47:07 -0000
8
-@@ -172,7 +172,11 @@
9
-             break;
10
- 
11
-           case 0x0:   // Writes to ROM, Inhibit
12
--            BX_DEBUG(("Write to ROM ignored: address 0x" FMT_PHY_ADDRX ", data %02x", a20addr, *data_ptr));
13
-+            if ((a20addr & 0xfffe0000) == 0x000e0000) {
14
-+	      BX_DEBUG(("Write to ROM ignored: address 0x" FMT_PHY_ADDRX ", data %02x", a20addr, *data_ptr));
15
-+	    } else {
16
-+	      BX_MEM_THIS rom[(a20addr & EXROM_MASK) + BIOSROMSZ] = *data_ptr;
17
-+            }
18
-             break;
19
- 
20
-           default:

+ 0
- 750
contrib/bochs/bochsrc.txt 查看文件

@@ -1,750 +0,0 @@
1
-# You may now use double quotes around pathnames, in case
2
-# your pathname includes spaces.
3
-
4
-#=======================================================================
5
-# CONFIG_INTERFACE
6
-#
7
-# The configuration interface is a series of menus or dialog boxes that
8
-# allows you to change all the settings that control Bochs's behavior.
9
-# There are two choices of configuration interface: a text mode version
10
-# called "textconfig" and a graphical version called "wx".  The text
11
-# mode version uses stdin/stdout and is always compiled in.  The graphical
12
-# version is only available when you use "--with-wx" on the configure 
13
-# command.  If you do not write a config_interface line, Bochs will 
14
-# choose a default for you.
15
-#
16
-# NOTE: if you use the "wx" configuration interface, you must also use
17
-# the "wx" display library.
18
-#=======================================================================
19
-#config_interface: textconfig
20
-#config_interface: wx
21
-
22
-#=======================================================================
23
-# DISPLAY_LIBRARY
24
-#
25
-# The display library is the code that displays the Bochs VGA screen.  Bochs 
26
-# has a selection of about 10 different display library implementations for 
27
-# different platforms.  If you run configure with multiple --with-* options, 
28
-# the display_library command lets you choose which one you want to run with.
29
-# If you do not write a display_library line, Bochs will choose a default for
30
-# you.
31
-#
32
-# The choices are: 
33
-#   x              use X windows interface, cross platform
34
-#   win32          use native win32 libraries
35
-#   carbon         use Carbon library (for MacOS X)
36
-#   beos           use native BeOS libraries
37
-#   macintosh      use MacOS pre-10
38
-#   amigaos        use native AmigaOS libraries
39
-#   sdl            use SDL library, cross platform
40
-#   svga           use SVGALIB library for Linux, allows graphics without X11
41
-#   term           text only, uses curses/ncurses library, cross platform
42
-#   rfb            provides an interface to AT&T's VNC viewer, cross platform
43
-#   wx             use wxWidgets library, cross platform
44
-#   nogui          no display at all
45
-#
46
-# NOTE: if you use the "wx" configuration interface, you must also use
47
-# the "wx" display library.
48
-#
49
-# Specific options:
50
-# Some display libraries now support specific option to control their
51
-# behaviour. See the examples below for currently supported options.
52
-#=======================================================================
53
-#display_library: amigaos
54
-#display_library: beos
55
-#display_library: carbon
56
-#display_library: macintosh
57
-#display_library: nogui
58
-#display_library: rfb, options="timeout=60" # time to wait for client
59
-#display_library: sdl, options="fullscreen" # startup in fullscreen mode
60
-#display_library: term
61
-#display_library: win32, options="legacyF12" # use F12 to toggle mouse
62
-#display_library: wx
63
-#display_library: x
64
-
65
-#=======================================================================
66
-# ROMIMAGE:
67
-# The ROM BIOS controls what the PC does when it first powers on.
68
-# Normally, you can use a precompiled BIOS in the source or binary
69
-# distribution called BIOS-bochs-latest. The ROM BIOS is usually loaded
70
-# starting at address 0xf0000, and it is exactly 64k long.
71
-# You can also use the environment variable $BXSHARE to specify the
72
-# location of the BIOS.
73
-# The usage of external large BIOS images (up to 512k) at memory top is
74
-# now supported, but we still recommend to use the BIOS distributed with
75
-# Bochs. Now the start address can be calculated from image size.
76
-#=======================================================================
77
-romimage: file=bochs/bios/BIOS-bochs-latest, address=0xe0000
78
-#romimage: file=mybios.bin, address=0xfff80000 # 512k at memory top
79
-#romimage: file=mybios.bin # calculate start address from image size
80
-
81
-#=======================================================================
82
-# CPU:
83
-# This defines cpu-related parameters inside Bochs:
84
-#
85
-#  COUNT:
86
-#  Set the number of processors:cores per processor:threads per core 
87
-#  when Bochs is compiled for SMP emulation.
88
-#  Bochs currently supports up to 8 threads running simultaniosly. 
89
-#  If Bochs is compiled without SMP support, it won't accept values 
90
-#  different from 1.
91
-#
92
-#  RESET_ON_TRIPLE_FAULT:
93
-#  Reset the CPU when triple fault occur (highly recommended) rather than
94
-#  PANIC. Remember that if you trying to continue after triple fault the 
95
-#  simulation will be completely bogus !
96
-#
97
-#  IPS:
98
-#  Emulated Instructions Per Second.  This is the number of IPS that bochs
99
-#  is capable of running on your machine. You can recompile Bochs with
100
-#  --enable-show-ips option enabled, to find your workstation's capability.
101
-#  Measured IPS value will then be logged into your log file or status bar
102
-#  (if supported by the gui).
103
-#
104
-#  IPS is used to calibrate many time-dependent events within the bochs 
105
-#  simulation.  For example, changing IPS affects the frequency of VGA
106
-#  updates, the duration of time before a key starts to autorepeat, and
107
-#  the measurement of BogoMips and other benchmarks.
108
-#
109
-#  Examples:
110
-#  Machine                                         Mips
111
-# ________________________________________________________________
112
-#  2.1Ghz Athlon XP with Linux 2.6/g++ 3.4         12 to 15 Mips
113
-#  1.6Ghz Intel P4 with Win2000/g++ 3.3             5 to  7 Mips
114
-#  650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66  2 to  2.5 Mips
115
-#  400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3   1 to  1.8 Mips
116
-#=======================================================================
117
-cpu: count=1, ips=10000000, reset_on_triple_fault=1
118
-
119
-#=======================================================================
120
-# MEGS
121
-# Set the number of Megabytes of physical memory you want to emulate. 
122
-# The default is 32MB, most OS's won't need more than that.
123
-# The maximum amount of memory supported is 2048Mb.
124
-#=======================================================================
125
-#megs: 256
126
-#megs: 128
127
-#megs: 64
128
-megs: 32
129
-#megs: 16
130
-#megs: 8
131
-
132
-#=======================================================================
133
-# OPTROMIMAGE[1-4]:
134
-# You may now load up to 4 optional ROM images. Be sure to use a 
135
-# read-only area, typically between C8000 and EFFFF. These optional
136
-# ROM images should not overwrite the rombios (located at
137
-# F0000-FFFFF) and the videobios (located at C0000-C7FFF).
138
-# Those ROM images will be initialized by the bios if they contain 
139
-# the right signature (0x55AA) and a valid checksum.
140
-# It can also be a convenient way to upload some arbitrary code/data
141
-# in the simulation, that can be retrieved by the boot loader
142
-#=======================================================================
143
-#optromimage1: file=optionalrom.bin, address=0xd0000
144
-#optromimage2: file=optionalrom.bin, address=0xd1000
145
-#optromimage3: file=optionalrom.bin, address=0xd2000
146
-#optromimage4: file=optionalrom.bin, address=0xd3000
147
-optromimage1: file=../../src/bin/pnic.rom, address=0xd0000
148
-#optromimage1: file=../../src/bin/rtl8029.rom, address=0xd0000
149
-
150
-#optramimage1: file=/path/file1.img, address=0x0010000
151
-#optramimage2: file=/path/file2.img, address=0x0020000
152
-#optramimage3: file=/path/file3.img, address=0x0030000
153
-#optramimage4: file=/path/file4.img, address=0x0040000
154
-
155
-#=======================================================================
156
-# VGAROMIMAGE
157
-# You now need to load a VGA ROM BIOS into C0000.
158
-#=======================================================================
159
-#vgaromimage: file=bios/VGABIOS-elpin-2.40
160
-vgaromimage: file=bochs/bios/VGABIOS-lgpl-latest
161
-#vgaromimage: file=bios/VGABIOS-lgpl-latest-cirrus
162
-
163
-#=======================================================================
164
-# VGA:
165
-# Here you can specify the display extension to be used. With the value
166
-# 'none' you can use standard VGA with no extension. Other supported
167
-# values are 'vbe' for Bochs VBE and 'cirrus' for Cirrus SVGA support.
168
-#=======================================================================
169
-#vga: extension=cirrus
170
-#vga: extension=vbe
171
-vga: extension=none
172
-
173
-#=======================================================================
174
-# FLOPPYA:
175
-# Point this to pathname of floppy image file or device
176
-# This should be of a bootable floppy(image/device) if you're
177
-# booting from 'a' (or 'floppy').
178
-#
179
-# You can set the initial status of the media to 'ejected' or 'inserted'.
180
-#   floppya: 2_88=path, status=ejected             (2.88M 3.5" floppy)
181
-#   floppya: 1_44=path, status=inserted            (1.44M 3.5" floppy)
182
-#   floppya: 1_2=path, status=ejected              (1.2M  5.25" floppy)
183
-#   floppya: 720k=path, status=inserted            (720K  3.5" floppy)
184
-#   floppya: 360k=path, status=inserted            (360K  5.25" floppy)
185
-#   floppya: 320k=path, status=inserted            (320K  5.25" floppy)
186
-#   floppya: 180k=path, status=inserted            (180K  5.25" floppy)
187
-#   floppya: 160k=path, status=inserted            (160K  5.25" floppy)
188
-#   floppya: image=path, status=inserted           (guess type from image size)
189
-#
190
-# The path should be the name of a disk image file.  On Unix, you can use a raw
191
-# device name such as /dev/fd0 on Linux.  On win32 platforms, use drive letters
192
-# such as a: or b: as the path.  The parameter 'image' works with image files
193
-# only. In that case the size must match one of the supported types.
194
-#=======================================================================
195
-#floppya: 1_44=/dev/fd0, status=inserted
196
-#floppya: image=../1.44, status=inserted
197
-#floppya: 1_44=/dev/fd0H1440, status=inserted
198
-#floppya: 1_2=../1_2, status=inserted
199
-#floppya: 1_44=a:, status=inserted
200
-#floppya: 1_44=a.img, status=inserted
201
-#floppya: 1_44=/dev/rfd0a, status=inserted
202
-floppya: 1_44=../../src/bin/pnic.dsk, status=inserted
203
-
204
-#=======================================================================
205
-# FLOPPYB:
206
-# See FLOPPYA above for syntax
207
-#=======================================================================
208
-#floppyb: 1_44=b:, status=inserted
209
-floppyb: 1_44=b.img, status=inserted
210
-
211
-#=======================================================================
212
-# ATA0, ATA1, ATA2, ATA3
213
-# ATA controller for hard disks and cdroms
214
-#
215
-# ata[0-3]: enabled=[0|1], ioaddr1=addr, ioaddr2=addr, irq=number
216
-# 
217
-# These options enables up to 4 ata channels. For each channel
218
-# the two base io addresses and the irq must be specified.
219
-# 
220
-# ata0 and ata1 are enabled by default with the values shown below
221
-#
222
-# Examples:
223
-#   ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
224
-#   ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
225
-#   ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
226
-#   ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x360, irq=9
227
-#=======================================================================
228
-ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
229
-ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
230
-ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
231
-ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
232
-
233
-#=======================================================================
234
-# ATA[0-3]-MASTER, ATA[0-3]-SLAVE
235
-#
236
-# This defines the type and characteristics of all attached ata devices:
237
-#   type=       type of attached device [disk|cdrom] 
238
-#   mode=       only valid for disks [flat|concat|external|dll|sparse|vmware3]
239
-#   mode=       only valid for disks [undoable|growing|volatile]
240
-#   path=       path of the image
241
-#   cylinders=  only valid for disks
242
-#   heads=      only valid for disks
243
-#   spt=        only valid for disks
244
-#   status=     only valid for cdroms [inserted|ejected]
245
-#   biosdetect= type of biosdetection [none|auto], only for disks on ata0 [cmos]
246
-#   translation=type of translation of the bios, only for disks [none|lba|large|rechs|auto]
247
-#   model=      string returned by identify device command
248
-#   journal=    optional filename of the redolog for undoable and volatile disks
249
-#   
250
-# Point this at a hard disk image file, cdrom iso file, or physical cdrom
251
-# device.  To create a hard disk image, try running bximage.  It will help you
252
-# choose the size and then suggest a line that works with it.
253
-#
254
-# In UNIX it may be possible to use a raw device as a Bochs hard disk, 
255
-# but WE DON'T RECOMMEND IT.  In Windows there is no easy way.
256
-#
257
-# In windows, the drive letter + colon notation should be used for cdroms.
258
-# Depending on versions of windows and drivers, you may only be able to 
259
-# access the "first" cdrom in the system.  On MacOSX, use path="drive"
260
-# to access the physical drive.
261
-#
262
-# The path is always mandatory. For flat hard disk images created with
263
-# bximage geometry autodetection can be used (cylinders=0 -> cylinders are
264
-# calculated using heads=16 and spt=63). For other hard disk images and modes
265
-# the cylinders, heads, and spt are mandatory.
266
-#
267
-# Default values are:
268
-#   mode=flat, biosdetect=auto, translation=auto, model="Generic 1234"
269
-#
270
-# The biosdetect option has currently no effect on the bios
271
-#
272
-# Examples:
273
-#   ata0-master: type=disk, mode=flat, path=10M.sample, cylinders=306, heads=4, spt=17
274
-#   ata0-slave:  type=disk, mode=flat, path=20M.sample, cylinders=615, heads=4, spt=17
275
-#   ata1-master: type=disk, mode=flat, path=30M.sample, cylinders=615, heads=6, spt=17
276
-#   ata1-slave:  type=disk, mode=flat, path=46M.sample, cylinders=940, heads=6, spt=17
277
-#   ata2-master: type=disk, mode=flat, path=62M.sample, cylinders=940, heads=8, spt=17
278
-#   ata2-slave:  type=disk, mode=flat, path=112M.sample, cylinders=900, heads=15, spt=17
279
-#   ata3-master: type=disk, mode=flat, path=483M.sample, cylinders=1024, heads=15, spt=63
280
-#   ata3-slave:  type=cdrom, path=iso.sample, status=inserted
281
-#=======================================================================
282
-#ata0-master: type=disk, mode=flat, path="30M.sample", cylinders=615, heads=6, spt=17
283
-#ata0-slave: type=cdrom, path=D:, status=inserted
284
-#ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted
285
-#ata0-slave: type=cdrom, path="drive", status=inserted
286
-#ata0-slave: type=cdrom, path=/dev/rcd0d, status=inserted 
287
-
288
-#=======================================================================
289
-# BOOT:
290
-# This defines the boot sequence. Now you can specify up to 3 boot drives.
291
-# You can either boot from 'floppy', 'disk' or 'cdrom'
292
-# legacy 'a' and 'c' are also supported
293
-# Examples:
294
-#   boot: floppy
295
-#   boot: disk
296
-#   boot: cdrom
297
-#   boot: c
298
-#   boot: a
299
-#   boot: cdrom, floppy, disk
300
-#=======================================================================
301
-#boot: floppy
302
-#boot: disk
303
-
304
-#=======================================================================
305
-# CLOCK:
306
-# This defines the parameters of the clock inside Bochs:
307
-#
308
-#  SYNC:
309
-#  TO BE COMPLETED (see Greg explanation in feature request #536329)
310
-#
311
-#  TIME0:
312
-#  Specifies the start (boot) time of the virtual machine. Use a time 
313
-#  value as returned by the time(2) system call. If no time0 value is 
314
-#  set or if time0 equal to 1 (special case) or if time0 equal 'local', 
315
-#  the simulation will be started at the current local host time.
316
-#  If time0 equal to 2 (special case) or if time0 equal 'utc',
317
-#  the simulation will be started at the current utc time.
318
-#
319
-# Syntax:
320
-#  clock: sync=[none|slowdown|realtime|both], time0=[timeValue|local|utc]
321
-#
322
-# Example:
323
-#   clock: sync=none,     time0=local       # Now (localtime)
324
-#   clock: sync=slowdown, time0=315529200   # Tue Jan  1 00:00:00 1980
325
-#   clock: sync=none,     time0=631148400   # Mon Jan  1 00:00:00 1990
326
-#   clock: sync=realtime, time0=938581955   # Wed Sep 29 07:12:35 1999
327
-#   clock: sync=realtime, time0=946681200   # Sat Jan  1 00:00:00 2000
328
-#   clock: sync=none,     time0=1           # Now (localtime)
329
-#   clock: sync=none,     time0=utc         # Now (utc/gmt)
330
-# 
331
-# Default value are sync=none, time0=local
332
-#=======================================================================
333
-#clock: sync=none, time0=local
334
-
335
-
336
-#=======================================================================
337
-# FLOPPY_BOOTSIG_CHECK: disabled=[0|1]
338
-# Enables or disables the 0xaa55 signature check on boot floppies
339
-# Defaults to disabled=0
340
-# Examples:
341
-#   floppy_bootsig_check: disabled=0
342
-#   floppy_bootsig_check: disabled=1
343
-#=======================================================================
344
-#floppy_bootsig_check: disabled=1
345
-floppy_bootsig_check: disabled=0
346
-
347
-#=======================================================================
348
-# LOG:
349
-# Give the path of the log file you'd like Bochs debug and misc. verbiage
350
-# to be written to. If you don't use this option or set the filename to
351
-# '-' the output is written to the console. If you really don't want it,
352
-# make it "/dev/null" (Unix) or "nul" (win32). :^(
353
-#
354
-# Examples:
355
-#   log: ./bochs.out
356
-#   log: /dev/tty
357
-#=======================================================================
358
-#log: /dev/null
359
-log: bochsout.txt
360
-
361
-#=======================================================================
362
-# LOGPREFIX:
363
-# This handles the format of the string prepended to each log line.
364
-# You may use those special tokens :
365
-#   %t : 11 decimal digits timer tick
366
-#   %i : 8 hexadecimal digits of cpu current eip (ignored in SMP configuration)
367
-#   %e : 1 character event type ('i'nfo, 'd'ebug, 'p'anic, 'e'rror)
368
-#   %d : 5 characters string of the device, between brackets
369
-# 
370
-# Default : %t%e%d
371
-# Examples:
372
-#   logprefix: %t-%e-@%i-%d
373
-#   logprefix: %i%e%d
374
-#=======================================================================
375
-#logprefix: %t%e%d
376
-
377
-#=======================================================================
378
-# LOG CONTROLS
379
-#
380
-# Bochs now has four severity levels for event logging.
381
-#   panic: cannot proceed.  If you choose to continue after a panic, 
382
-#          don't be surprised if you get strange behavior or crashes.
383
-#   error: something went wrong, but it is probably safe to continue the
384
-#          simulation.
385
-#   info: interesting or useful messages.
386
-#   debug: messages useful only when debugging the code.  This may
387
-#          spit out thousands per second.
388
-#
389
-# For events of each level, you can choose to crash, report, or ignore.
390
-# TODO: allow choice based on the facility: e.g. crash on panics from
391
-#       everything except the cdrom, and only report those.
392
-#
393
-# If you are experiencing many panics, it can be helpful to change
394
-# the panic action to report instead of fatal.  However, be aware
395
-# that anything executed after a panic is uncharted territory and can 
396
-# cause bochs to become unstable.  The panic is a "graceful exit," so
397
-# if you disable it you may get a spectacular disaster instead.
398
-#=======================================================================
399
-panic: action=ask
400
-error: action=report
401
-info: action=report
402
-debug: action=ignore
403
-#pass: action=fatal
404
-
405
-#=======================================================================
406
-# DEBUGGER_LOG:
407
-# Give the path of the log file you'd like Bochs to log debugger output.
408
-# If you really don't want it, make it /dev/null or '-'. :^(
409
-#
410
-# Examples:
411
-#   debugger_log: ./debugger.out
412
-#=======================================================================
413
-#debugger_log: /dev/null
414
-#debugger_log: debugger.out
415
-debugger_log: -
416
-
417
-#=======================================================================
418
-# COM1, COM2, COM3, COM4:
419
-# This defines a serial port (UART type 16550A). In the 'term' you can specify
420
-# a device to use as com1. This can be a real serial line, or a pty.  To use
421
-# a pty (under X/Unix), create two windows (xterms, usually).  One of them will
422
-# run bochs, and the other will act as com1. Find out the tty the com1
423
-# window using the `tty' command, and use that as the `dev' parameter.
424
-# Then do `sleep 1000000' in the com1 window to keep the shell from
425
-# messing with things, and run bochs in the other window.  Serial I/O to
426
-# com1 (port 0x3f8) will all go to the other window.
427
-# Other serial modes are 'null' (no input/output), 'file' (output to a file
428
-# specified as the 'dev' parameter), 'raw' (use the real serial port - under
429
-# construction for win32), 'mouse' (standard serial mouse - requires
430
-# mouse option setting 'type=serial' or 'type=serial_wheel') and 'socket'
431
-# (connect a networking socket).
432
-#
433
-# Examples:
434
-#   com1: enabled=1, mode=null
435
-#   com1: enabled=1, mode=mouse
436
-#   com2: enabled=1, mode=file, dev=serial.out
437
-#   com3: enabled=1, mode=raw, dev=com1
438
-#   com3: enabled=1, mode=socket, dev=localhost:8888
439
-#=======================================================================
440
-#com1: enabled=1, mode=term, dev=/dev/ttyp9
441
-
442
-
443
-#=======================================================================
444
-# PARPORT1, PARPORT2:
445
-# This defines a parallel (printer) port. When turned on and an output file is
446
-# defined the emulated printer port sends characters printed by the guest OS
447
-# into the output file. On some platforms a device filename can be used to
448
-# send the data to the real parallel port (e.g. "/dev/lp0" on Linux, "lpt1" on
449
-# win32 platforms).
450
-#
451
-# Examples:
452
-#   parport1: enabled=1, file="parport.out"
453
-#   parport2: enabled=1, file="/dev/lp0"
454
-#   parport1: enabled=0
455
-#=======================================================================
456
-parport1: enabled=1, file="parport.out"
457
-
458
-#=======================================================================
459
-# SB16:
460
-# This defines the SB16 sound emulation. It can have several of the
461
-# following properties.
462
-# All properties are in the format sb16: property=value
463
-# midi: The filename is where the midi data is sent. This can be a
464
-#       device or just a file if you want to record the midi data.
465
-# midimode:
466
-#      0=no data
467
-#      1=output to device (system dependent. midi denotes the device driver)
468
-#      2=SMF file output, including headers
469
-#      3=output the midi data stream to the file (no midi headers and no
470
-#        delta times, just command and data bytes)
471
-# wave: This is the device/file where wave output is stored
472
-# wavemode:
473
-#      0=no data
474
-#      1=output to device (system dependent. wave denotes the device driver)
475
-#      2=VOC file output, incl. headers
476
-#      3=output the raw wave stream to the file
477
-# log:  The file to write the sb16 emulator messages to.
478
-# loglevel:
479
-#      0=no log
480
-#      1=resource changes, midi program and bank changes
481
-#      2=severe errors
482
-#      3=all errors
483
-#      4=all errors plus all port accesses
484
-#      5=all errors and port accesses plus a lot of extra info
485
-# dmatimer:
486
-#      microseconds per second for a DMA cycle.  Make it smaller to fix
487
-#      non-continuous sound.  750000 is usually a good value.  This needs a
488
-#      reasonably correct setting for the IPS parameter of the CPU option.
489
-#
490
-# For an example look at the next line:
491
-#=======================================================================
492
-
493
-#sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000
494
-
495
-#=======================================================================
496
-# VGA_UPDATE_INTERVAL:
497
-# Video memory is scanned for updates and screen updated every so many
498
-# virtual seconds.  The default is 40000, about 25Hz. Keep in mind that
499
-# you must tweak the 'cpu: ips=N' directive to be as close to the number
500
-# of emulated instructions-per-second your workstation can do, for this
501
-# to be accurate.
502
-#
503
-# Examples:
504
-#   vga_update_interval: 250000
505
-#=======================================================================
506
-vga_update_interval: 300000
507
-
508
-# using for Winstone '98 tests
509
-#vga_update_interval:  100000
510
-
511
-#=======================================================================
512
-# KEYBOARD_SERIAL_DELAY:
513
-# Approximate time in microseconds that it takes one character to
514
-# be transfered from the keyboard to controller over the serial path.
515
-# Examples:
516
-#   keyboard_serial_delay: 200
517
-#=======================================================================
518
-keyboard_serial_delay: 250
519
-
520
-#=======================================================================
521
-# KEYBOARD_PASTE_DELAY:
522
-# Approximate time in microseconds between attempts to paste
523
-# characters to the keyboard controller. This leaves time for the
524
-# guest os to deal with the flow of characters.  The ideal setting
525
-# depends on how your operating system processes characters.  The
526
-# default of 100000 usec (.1 seconds) was chosen because it works 
527
-# consistently in Windows.
528
-#
529
-# If your OS is losing characters during a paste, increase the paste
530
-# delay until it stops losing characters.
531
-#
532
-# Examples:
533
-#   keyboard_paste_delay: 100000
534
-#=======================================================================
535
-keyboard_paste_delay: 100000
536
-
537
-#=======================================================================
538
-# MOUSE: 
539
-# This option prevents Bochs from creating mouse "events" unless a mouse
540
-# is  enabled. The hardware emulation itself is not disabled by this.
541
-# You can turn the mouse on by setting enabled to 1, or turn it off by
542
-# setting enabled to 0. Unless you have a particular reason for enabling
543
-# the mouse by default, it is recommended that you leave it off.
544
-# You can also toggle the mouse usage at runtime (control key + middle
545
-# mouse button on X11, SDL, wxWidgets and Win32).
546
-# With the mouse type option you can select the type of mouse to emulate.
547
-# The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
548
-# on PS/2), 'serial', 'serial_wheel' (one com port requires setting
549
-# 'mode=mouse') and 'usb' (3-button mouse - one of the USB ports must be
550
-# connected with the 'mouse' device - requires PCI and USB support).
551
-#
552
-# Examples:
553
-#   mouse: enabled=1
554
-#   mouse: enabled=1, type=imps2
555
-#   mouse: enabled=1, type=serial
556
-#   mouse: enabled=0
557
-#=======================================================================
558
-mouse: enabled=0
559
-
560
-#=======================================================================
561
-# private_colormap: Request that the GUI create and use it's own
562
-#                   non-shared colormap.  This colormap will be used
563
-#                   when in the bochs window.  If not enabled, a
564
-#                   shared colormap scheme may be used.  Not implemented
565
-#                   on all GUI's.
566
-#
567
-# Examples:
568
-#   private_colormap: enabled=1
569
-#   private_colormap: enabled=0
570
-#=======================================================================
571
-private_colormap: enabled=0
572
-
573
-#=======================================================================
574
-# fullscreen: ONLY IMPLEMENTED ON AMIGA
575
-#             Request that Bochs occupy the entire screen instead of a 
576
-#             window.
577
-#
578
-# Examples:
579
-#   fullscreen: enabled=0
580
-#   fullscreen: enabled=1
581
-#=======================================================================
582
-#fullscreen: enabled=0
583
-#screenmode: name="sample"
584
-
585
-#=======================================================================
586
-# ne2k: NE2000 compatible ethernet adapter
587
-#
588
-# Examples:
589
-# ne2k: ioaddr=IOADDR, irq=IRQ, mac=MACADDR, ethmod=MODULE, ethdev=DEVICE, script=SCRIPT
590
-#
591
-# ioaddr, irq: You probably won't need to change ioaddr and irq, unless there
592
-# are IRQ conflicts.
593
-#
594
-# mac: The MAC address MUST NOT match the address of any machine on the net.
595
-# Also, the first byte must be an even number (bit 0 set means a multicast
596
-# address), and you cannot use ff:ff:ff:ff:ff:ff because that's the broadcast
597
-# address.  For the ethertap module, you must use fe:fd:00:00:00:01.  There may
598
-# be other restrictions too.  To be safe, just use the b0:c4... address.
599
-#
600
-# ethdev: The ethdev value is the name of the network interface on your host
601
-# platform.  On UNIX machines, you can get the name by running ifconfig.  On
602
-# Windows machines, you must run niclist to get the name of the ethdev.
603
-# Niclist source code is in misc/niclist.c and it is included in Windows 
604
-# binary releases.
605
-#
606
-# script: The script value is optional, and is the name of a script that 
607
-# is executed after bochs initialize the network interface. You can use 
608
-# this script to configure this network interface, or enable masquerading.
609
-# This is mainly useful for the tun/tap devices that only exist during
610
-# Bochs execution. The network interface name is supplied to the script
611
-# as first parameter
612
-#
613
-# If you don't want to make connections to any physical networks,
614
-# you can use the following 'ethmod's to simulate a virtual network.
615
-#   null: All packets are discarded, but logged to a few files.
616
-#   arpback: ARP is simulated. Disabled by default.
617
-#   vde:  Virtual Distributed Ethernet
618
-#   vnet: ARP, ICMP-echo(ping), DHCP and read/write TFTP are simulated.
619
-#         The virtual host uses 192.168.10.1.
620
-#         DHCP assigns 192.168.10.2 to the guest.
621
-#         TFTP uses the ethdev value for the root directory and doesn't
622
-#         overwrite files.
623
-#
624
-#=======================================================================
625
-# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=fbsd, ethdev=en0 #macosx
626
-# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0
627
-# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0
628
-# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD
629
-# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
630
-# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun0, script=./tunconfig
631
-# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=null, ethdev=eth0
632
-# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=vde, ethdev="/tmp/vde.ctl"
633
-# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=vnet, ethdev="c:/temp"
634
-pnic: mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun:tap0
635
-#ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun:tap0
636
-
637
-#=======================================================================
638
-# KEYBOARD_MAPPING:
639
-# This enables a remap of a physical localized keyboard to a 
640
-# virtualized us keyboard, as the PC architecture expects.
641
-# If enabled, the keymap file must be specified.
642
-# 
643
-# Examples:
644
-#   keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map
645
-#=======================================================================
646
-keyboard_mapping: enabled=0, map=
647
-
648
-#=======================================================================
649
-# KEYBOARD_TYPE:
650
-# Type of keyboard return by a "identify keyboard" command to the
651
-# keyboard controler. It must be one of "xt", "at" or "mf".
652
-# Defaults to "mf". It should be ok for almost everybody. A known
653
-# exception is french macs, that do have a "at"-like keyboard.
654
-#
655
-# Examples:
656
-#   keyboard_type: mf
657
-#=======================================================================
658
-#keyboard_type: mf
659
-
660
-#=======================================================================
661
-# USER_SHORTCUT:
662
-# This defines the keyboard shortcut to be sent when you press the "user"
663
-# button in the headerbar. The shortcut string is a combination of maximum
664
-# 3 key names (listed below) separated with a '-' character. The old-style
665
-# syntax (without the '-') still works for the key combinations supported
666
-# in Bochs 2.2.1.
667
-# Valid key names:
668
-# "alt", "bksl", "bksp", "ctrl", "del", "down", "end", "enter", "esc",
669
-# "f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup",
670
-# "plus", "right", "shift", "space", "tab", "up", and "win".
671
-#
672
-# Example:
673
-#   user_shortcut: keys=ctrl-alt-del
674
-#=======================================================================
675
-user_shortcut: keys=ctrl-alt-del
676
-
677
-#=======================================================================
678
-# I440FXSUPPORT:
679
-# This option controls the presence of the i440FX PCI chipset. You can
680
-# also specify the devices connected to PCI slots. Up to 5 slots are
681
-# available now. These devices are currently supported: ne2k, pcivga,
682
-# pcidev and pcipnic. If Bochs is compiled with Cirrus SVGA support
683
-# you'll have the additional choice 'cirrus'.
684
-#
685
-# Example:
686
-#   i440fxsupport: enabled=1, slot1=pcivga, slot2=ne2k
687
-#=======================================================================
688
-i440fxsupport: enabled=1, slot1=pcipnic
689
-#i440fxsupport: enabled=1, slot1=ne2k
690
-
691
-#=======================================================================
692
-# USB1:
693
-# This option controls the presence of the USB root hub which is a part
694
-# of the i440FX PCI chipset. With the portX option you can connect devices
695
-# to the hub (currently supported: 'mouse' and 'keypad'). If you connect
696
-# the mouse to one of the ports and use the mouse option 'type=usb' you'll
697
-# have a 3-button USB mouse.
698
-#
699
-# Example:
700
-#   usb1: enabled=1, port1=mouse, port2=keypad
701
-#=======================================================================
702
-#usb1: enabled=1
703
-
704
-#=======================================================================
705
-# CMOSIMAGE:
706
-# This defines image file that can be loaded into the CMOS RAM at startup.
707
-# The rtc_init parameter controls whether initialize the RTC with values stored
708
-# in the image. By default the time0 argument given to the clock option is used.
709
-# With 'rtc_init=image' the image is the source for the initial time.
710
-#
711
-# Example:
712
-#   cmosimage: file=cmos.img, rtc_init=image
713
-#=======================================================================
714
-#cmosimage: file=cmos.img, rtc_init=time0
715
-
716
-#=======================================================================
717
-# other stuff
718
-#=======================================================================
719
-magic_break: enabled=1
720
-#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log
721
-#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img
722
-#text_snapshot_check: enable
723
-
724
-#-------------------------
725
-# PCI host device mapping
726
-#-------------------------
727
-#pcidev: vendor=0x1234, device=0x5678
728
-
729
-#=======================================================================
730
-# GDBSTUB:
731
-# Enable GDB stub. See user documentation for details.
732
-# Default value is enabled=0.
733
-#=======================================================================
734
-#gdbstub: enabled=0, port=1234, text_base=0, data_base=0, bss_base=0
735
-
736
-#=======================================================================
737
-# IPS:
738
-# The IPS directive is DEPRECATED. Use the parameter IPS of the CPU
739
-# directive instead.
740
-#=======================================================================
741
-#ips: 10000000
742
-
743
-#=======================================================================
744
-# for Macintosh, use the style of pathnames in the following
745
-# examples.
746
-#
747
-# vgaromimage: :bios:VGABIOS-elpin-2.40
748
-# romimage: file=:bios:BIOS-bochs-latest, address=0xf0000
749
-# floppya: 1_44=[fd:], status=inserted
750
-#=======================================================================

+ 0
- 26
contrib/bochs/qemu-patch 查看文件

@@ -1,26 +0,0 @@
1
-Index: qemu/cpu-exec.c
2
-===================================================================
3
-RCS file: /sources/qemu/qemu/cpu-exec.c,v
4
-retrieving revision 1.84
5
-diff -u -r1.84 cpu-exec.c
6
---- qemu/cpu-exec.c	29 Jul 2006 19:09:31 -0000	1.84
7
-+++ qemu/cpu-exec.c	28 Aug 2006 01:54:15 -0000
8
-@@ -788,6 +788,18 @@
9
-                     cpu_loop_exit();
10
-                 }
11
- #endif
12
-+#if 1
13
-+#define MIN_CYCLE_COUNT 100
14
-+		{
15
-+                    static int cycle_count;
16
-+		  
17
-+		    if (++cycle_count > MIN_CYCLE_COUNT) {
18
-+                        cycle_count = 0;
19
-+                        env->exception_index = EXCP_INTERRUPT;
20
-+                        cpu_loop_exit();
21
-+                    }
22
-+		}
23
-+#endif
24
-             }
25
-         } else {
26
-             env_to_regs();

+ 0
- 278
contrib/bochs/serial-console 查看文件

@@ -1,278 +0,0 @@
1
-#!/usr/bin/perl -w
2
-
3
-=head1 NAME
4
-
5
-serial-console
6
-
7
-=head1 SYNOPSIS
8
-
9
-serial-console [options]
10
-
11
-Options:
12
-
13
-    -h,--help         Display brief help message
14
-    -v,--verbose      Increase verbosity
15
-    -q,--quiet        Decrease verbosity
16
-    -l,--log FILE     Log output to file
17
-    -r,--rcfile	FILE  Modify specified bochsrc file
18
-
19
-=head1 DESCRIPTION
20
-
21
-C<serial-console> provides a virtual serial console for use with
22
-Bochs.  Running C<serial-console> creates a pseudo-tty.  The master
23
-side of this pty is made available to the user for interaction; the
24
-slave device is written to the Bochs configuration file
25
-(C<bochsrc.txt>) for use by a subsequent Bochs session.
26
-
27
-=head1 EXAMPLES
28
-
29
-=over 4
30
-
31
-=item C<serial-console>
32
-
33
-Create a virtual serial console for Bochs, modify C<bochsrc.txt>
34
-appropriately.
35
-
36
-=item C<serial-console -r ../.bochsrc -l serial.log>
37
-
38
-Create a virtual serial console for Bochs, modify C<../.bochsrc>
39
-appropriately, log output to C<serial.log>.
40
-
41
-=back
42
-
43
-=head1 INVOCATION
44
-
45
-Before starting Bochs, run C<serial-console> in a different session
46
-(e.g. a different xterm window).  When you subsequently start Bochs,
47
-anything that the emulated machine writes to its serial port will
48
-appear in the window running C<serial-console>, and anything typed in
49
-the C<serial-console> window will arrive on the emulated machine's
50
-serial port.
51
-
52
-You do B<not> need to rerun C<serial-console> afresh for each Bochs
53
-session.
54
-
55
-=head1 OPTIONS
56
-
57
-=over 4
58
-
59
-=item B<-l,--log FILE>
60
-
61
-Log all output (i.e. everything that is printed in the
62
-C<serial-console> window) to the specified file.
63
-
64
-=item B<-r,--rcfile FILE>
65
-
66
-Modify the specified bochsrc file.  The file will be updated to
67
-contain the path to the slave side of the psuedo tty that we create.
68
-The original file will be restored when C<serial-console> exits.  The
69
-default is to modify the file C<bochsrc.txt> in the current directory.
70
-
71
-To avoid modifying any bochsrc file, use C<--norcfile>.
72
-
73
-=back
74
-
75
-=cut
76
-
77
-use IO::Pty;
78
-use IO::Select;
79
-use File::Spec::Functions qw ( :ALL );
80
-use Getopt::Long;
81
-use Pod::Usage;
82
-use POSIX qw ( :termios_h );
83
-use strict;
84
-use warnings;
85
-
86
-my $o;
87
-my $restore_file = {};
88
-my $restore_termios;
89
-use constant BLOCKSIZE => 8192;
90
-
91
-##############################################################################
92
-#
93
-# Parse command line options into options hash ($o)
94
-#
95
-# $o = parse_opts();
96
-
97
-sub parse_opts {
98
-  # $o is the hash that will hold the options
99
-  my $o = {
100
-    verbosity => 1,
101
-    rcfile => 'bochsrc.txt',
102
-  };
103
-  # Special handlers for some options
104
-  my $opt_handlers = {
105
-    verbose => sub { $o->{verbosity}++; },
106
-    quiet => sub { $o->{verbosity}--; },
107
-    help => sub { pod2usage(1); },
108
-    norcfile => sub { delete $o->{rcfile}; },
109
-  };
110
-  # Merge handlers into main options hash (so that Getopt::Long can find them)
111
-  $o->{$_} = $opt_handlers->{$_} foreach keys %$opt_handlers;
112
-  # Option specifiers for Getopt::Long
113
-  my @optspec = ( 'help|h|?',
114
-                  'quiet|q+',
115
-                  'verbose|v+',
116
-		  'log|l=s',
117
-		  'rcfile|r=s',
118
-		  'norcfile',
119
-                  );
120
-  # Do option parsing
121
-  Getopt::Long::Configure ( 'bundling' );
122
-  pod2usage("Error parsing command-line options") unless GetOptions (
123
-  $o, @optspec );
124
-  # Clean up $o by removing the handlers
125
-  delete $o->{$_} foreach keys %$opt_handlers;
126
-  return $o;
127
-}
128
-
129
-##############################################################################
130
-#
131
-# Modify bochsrc file
132
-
133
-sub patch_bochsrc {
134
-  my $active = shift;
135
-  my $pty = shift;
136
-
137
-  # Rename active file to backup file
138
-  ( my $vol, my $dir, my $file ) = splitpath ( $active );
139
-  $file = '.'.$file.".serial-console";
140
-  my $backup = catpath ( $vol, $dir, $file );
141
-  rename $active, $backup
142
-      or die "Could not back up $active to $backup: $!\n";
143
-
144
-  # Derive line to be inserted
145
-  my $patch = "com1: enabled=1, mode=term, dev=$pty\n";
146
-
147
-  # Modify file
148
-  open my $old, "<$backup" or die "Could not open $backup: $!\n";
149
-  open my $new, ">$active" or die "Could not open $active: $!\n";
150
-  print $new <<"EOF";
151
-##################################################
152
-#
153
-# This file has been modified by serial-console.
154
-#
155
-# Do not modify this file; it will be erased when
156
-# serial-console (pid $$) exits and will be
157
-# replaced with the backup copy held in
158
-# $backup.
159
-#
160
-##################################################
161
-
162
-
163
-EOF
164
-  my $patched;
165
-  while ( my $line = <$old> ) {
166
-    if ( $line =~ /^\s*\#?\s*com1:\s*\S/ ) {
167
-      if ( ! $patched ) {
168
-	$line = $patch;
169
-	$patched = 1;
170
-      } else {
171
-	$line = '# '.$line unless $line =~ /^\s*\#/;
172
-      }
173
-    }
174
-    print $new $line;
175
-  }
176
-  print $new $patch unless $patched;
177
-  close $old;
178
-  close $new;
179
-
180
-  return $backup;
181
-}
182
-
183
-##############################################################################
184
-#
185
-# Attach/detach message printing and terminal settings
186
-
187
-sub bochs_attached {
188
-  print STDERR "Bochs attached.\n\n\n"
189
-      if $o->{verbosity} >= 1;
190
-}
191
-
192
-sub bochs_detached {
193
-  print STDERR "\n\nWaiting for bochs to attach...\n"
194
-      if $o->{verbosity} >= 1;
195
-}
196
-
197
-##############################################################################
198
-#
199
-# Main program
200
-
201
-$o = parse_opts();
202
-pod2usage(1) if @ARGV;
203
-
204
-# Catch signals
205
-my $sigdie = sub { die "Exiting via signal\n"; };
206
-$SIG{INT} = $sigdie;
207
-
208
-# Create Pty, close slave side
209
-my $pty = IO::Pty->new();
210
-$pty->close_slave();
211
-$pty->set_raw();
212
-print STDERR "Slave pty is ".$pty->ttyname."\n" if $o->{verbosity} >= 1;
213
-
214
-# Open logfile
215
-my $log;
216
-if ( $o->{log} ) {
217
-  open $log, ">$o->{log}" or die "Could not open $o->{log}: $!\n";
218
-}
219
-
220
-# Set up terminal
221
-my $termios;
222
-if ( -t STDIN ) {
223
-  $termios = POSIX::Termios->new;
224
-  $restore_termios = POSIX::Termios->new;
225
-  $termios->getattr ( fileno(STDIN) );
226
-  $restore_termios->getattr ( fileno(STDIN) );
227
-  $termios->setlflag ( $termios->getlflag & ~(ICANON) & ~(ECHO) );
228
-  $termios->setiflag ( $termios->getiflag & ~(ICRNL) );
229
-  $termios->setattr ( fileno(STDIN), TCSANOW );
230
-}
231
-
232
-# Modify bochsrc file
233
-$restore_file = { $o->{rcfile} =>
234
-		  patch_bochsrc ( $o->{rcfile}, $pty->ttyname ) }
235
-    if $o->{rcfile};
236
-
237
-# Start character shunt
238
-my $attached = 1;
239
-my $select = IO::Select->new ( \*STDIN, $pty );
240
-while ( 1 ) {
241
-  my %can_read = map { $_ => 1 }
242
-  		     $select->can_read ( $attached ? undef : 1 );
243
-  if ( $can_read{\*STDIN} ) {
244
-    sysread ( STDIN, my $data, BLOCKSIZE )
245
-	or die "Cannot read from STDIN: $!\n";
246
-    $pty->syswrite ( $data );
247
-  }
248
-  if ( $can_read{$pty} ) {
249
-    if ( $pty->sysread ( my $data, BLOCKSIZE ) ) {
250
-      # Actual data available
251
-      bochs_attached() if $attached == 0;
252
-      $attached = 1;
253
-      syswrite ( STDOUT, $data );
254
-      $log->syswrite ( $data ) if $log;
255
-    } else {
256
-      # No data available but select() says we can read.  This almost
257
-      # certainly indicates that nothing is attached to the slave.
258
-      bochs_detached() if $attached == 1;
259
-      $attached = 0;
260
-      sleep ( 1 );
261
-    }
262
-  } else {
263
-    bochs_attached() if $attached == 0;
264
-    $attached = 1;
265
-  }
266
-}
267
-
268
-END {
269
-  # Restore bochsrc file if applicable
270
-  if ( ( my $orig_file, my $backup_file ) = %$restore_file ) {
271
-    unlink $orig_file;
272
-    rename $backup_file, $orig_file;
273
-  }
274
-  # Restore terminal settings if applicable
275
-  if ( $restore_termios ) {
276
-    $restore_termios->setattr ( fileno(STDIN), TCSANOW );
277
-  }
278
-}

+ 0
- 191
contrib/bochs/serial-console.1 查看文件

@@ -1,191 +0,0 @@
1
-.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2
-.\"
3
-.\" Standard preamble:
4
-.\" ========================================================================
5
-.de Sh \" Subsection heading
6
-.br
7
-.if t .Sp
8
-.ne 5
9
-.PP
10
-\fB\\$1\fR
11
-.PP
12
-..
13
-.de Sp \" Vertical space (when we can't use .PP)
14
-.if t .sp .5v
15
-.if n .sp
16
-..
17
-.de Vb \" Begin verbatim text
18
-.ft CW
19
-.nf
20
-.ne \\$1
21
-..
22
-.de Ve \" End verbatim text
23
-.ft R
24
-.fi
25
-..
26
-.\" Set up some character translations and predefined strings.  \*(-- will
27
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28
-.\" double quote, and \*(R" will give a right double quote.  | will give a
29
-.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30
-.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
32
-.tr \(*W-|\(bv\*(Tr
33
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34
-.ie n \{\
35
-.    ds -- \(*W-
36
-.    ds PI pi
37
-.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38
-.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39
-.    ds L" ""
40
-.    ds R" ""
41
-.    ds C` ""
42
-.    ds C' ""
43
-'br\}
44
-.el\{\
45
-.    ds -- \|\(em\|
46
-.    ds PI \(*p
47
-.    ds L" ``
48
-.    ds R" ''
49
-'br\}
50
-.\"
51
-.\" If the F register is turned on, we'll generate index entries on stderr for
52
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53
-.\" entries marked with X<> in POD.  Of course, you'll have to process the
54
-.\" output yourself in some meaningful fashion.
55
-.if \nF \{\
56
-.    de IX
57
-.    tm Index:\\$1\t\\n%\t"\\$2"
58
-..
59
-.    nr % 0
60
-.    rr F
61
-.\}
62
-.\"
63
-.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64
-.\" way too many mistakes in technical documents.
65
-.hy 0
66
-.if n .na
67
-.\"
68
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69
-.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70
-.    \" fudge factors for nroff and troff
71
-.if n \{\
72
-.    ds #H 0
73
-.    ds #V .8m
74
-.    ds #F .3m
75
-.    ds #[ \f1
76
-.    ds #] \fP
77
-.\}
78
-.if t \{\
79
-.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80
-.    ds #V .6m
81
-.    ds #F 0
82
-.    ds #[ \&
83
-.    ds #] \&
84
-.\}
85
-.    \" simple accents for nroff and troff
86
-.if n \{\
87
-.    ds ' \&
88
-.    ds ` \&
89
-.    ds ^ \&
90
-.    ds , \&
91
-.    ds ~ ~
92
-.    ds /
93
-.\}
94
-.if t \{\
95
-.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96
-.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97
-.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98
-.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99
-.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100
-.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101
-.\}
102
-.    \" troff and (daisy-wheel) nroff accents
103
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110
-.ds ae a\h'-(\w'a'u*4/10)'e
111
-.ds Ae A\h'-(\w'A'u*4/10)'E
112
-.    \" corrections for vroff
113
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115
-.    \" for low resolution devices (crt and lpr)
116
-.if \n(.H>23 .if \n(.V>19 \
117
-\{\
118
-.    ds : e
119
-.    ds 8 ss
120
-.    ds o a
121
-.    ds d- d\h'-1'\(ga
122
-.    ds D- D\h'-1'\(hy
123
-.    ds th \o'bp'
124
-.    ds Th \o'LP'
125
-.    ds ae ae
126
-.    ds Ae AE
127
-.\}
128
-.rm #[ #] #H #V #F C
129
-.\" ========================================================================
130
-.\"
131
-.IX Title "SERIAL-CONSOLE 1"
132
-.TH SERIAL-CONSOLE 1 "2004-03-10" "perl v5.8.0" "User Contributed Perl Documentation"
133
-.SH "NAME"
134
-serial\-console
135
-.SH "SYNOPSIS"
136
-.IX Header "SYNOPSIS"
137
-serial-console [options]
138
-.PP
139
-Options:
140
-.PP
141
-.Vb 5
142
-\&    -h,--help         Display brief help message
143
-\&    -v,--verbose      Increase verbosity
144
-\&    -q,--quiet        Decrease verbosity
145
-\&    -l,--log FILE     Log output to file
146
-\&    -r,--rcfile FILE  Modify specified bochsrc file
147
-.Ve
148
-.SH "DESCRIPTION"
149
-.IX Header "DESCRIPTION"
150
-\&\f(CW\*(C`serial\-console\*(C'\fR provides a virtual serial console for use with
151
-Bochs.  Running \f(CW\*(C`serial\-console\*(C'\fR creates a pseudo\-tty.  The master
152
-side of this pty is made available to the user for interaction; the
153
-slave device is written to the Bochs configuration file
154
-(\f(CW\*(C`bochsrc.txt\*(C'\fR) for use by a subsequent Bochs session.
155
-.SH "EXAMPLES"
156
-.IX Header "EXAMPLES"
157
-.ie n .IP """serial\-console""" 4
158
-.el .IP "\f(CWserial\-console\fR" 4
159
-.IX Item "serial-console"
160
-Create a virtual serial console for Bochs, modify \f(CW\*(C`bochsrc.txt\*(C'\fR
161
-appropriately.
162
-.ie n .IP """serial\-console \-r ../.bochsrc \-l serial.log""" 4
163
-.el .IP "\f(CWserial\-console \-r ../.bochsrc \-l serial.log\fR" 4
164
-.IX Item "serial-console -r ../.bochsrc -l serial.log"
165
-Create a virtual serial console for Bochs, modify \f(CW\*(C`../.bochsrc\*(C'\fR
166
-appropriately, log output to \f(CW\*(C`serial.log\*(C'\fR.
167
-.SH "INVOCATION"
168
-.IX Header "INVOCATION"
169
-Before starting Bochs, run \f(CW\*(C`serial\-console\*(C'\fR in a different session
170
-(e.g. a different xterm window).  When you subsequently start Bochs,
171
-anything that the emulated machine writes to its serial port will
172
-appear in the window running \f(CW\*(C`serial\-console\*(C'\fR, and anything typed in
173
-the \f(CW\*(C`serial\-console\*(C'\fR window will arrive on the emulated machine's
174
-serial port.
175
-.PP
176
-You do \fBnot\fR need to rerun \f(CW\*(C`serial\-console\*(C'\fR afresh for each Bochs
177
-session.
178
-.SH "OPTIONS"
179
-.IX Header "OPTIONS"
180
-.IP "\fB\-l,\-\-log \s-1FILE\s0\fR" 4
181
-.IX Item "-l,--log FILE"
182
-Log all output (i.e. everything that is printed in the
183
-\&\f(CW\*(C`serial\-console\*(C'\fR window) to the specified file.
184
-.IP "\fB\-r,\-\-rcfile \s-1FILE\s0\fR" 4
185
-.IX Item "-r,--rcfile FILE"
186
-Modify the specified bochsrc file.  The file will be updated to
187
-contain the path to the slave side of the psuedo tty that we create.
188
-The original file will be restored when \f(CW\*(C`serial\-console\*(C'\fR exits.  The
189
-default is to modify the file \f(CW\*(C`bochsrc.txt\*(C'\fR in the current directory.
190
-.Sp
191
-To avoid modifying any bochsrc file, use \f(CW\*(C`\-\-norcfile\*(C'\fR.

+ 0
- 113
contrib/bochs/tunctl.c 查看文件

@@ -1,113 +0,0 @@
1
-/* Copyright 2002 Jeff Dike
2
- * Licensed under the GPL
3
- */
4
-
5
-#include <stdio.h>
6
-#include <stdlib.h>
7
-#include <string.h>
8
-#include <errno.h>
9
-#include <fcntl.h>
10
-#include <unistd.h>
11
-#include <pwd.h>
12
-#include <net/if.h>
13
-#include <sys/ioctl.h>
14
-#include <linux/if_tun.h>
15
-
16
-static void Usage(char *name)
17
-{
18
-  fprintf(stderr, "Create: %s [-b] [-u owner] [-t device-name] "
19
-	  "[-f tun-clone-device]\n", name);
20
-  fprintf(stderr, "Delete: %s -d device-name [-f tun-clone-device]\n\n", 
21
-	  name);
22
-  fprintf(stderr, "The default tun clone device is /dev/net/tun - some systems"
23
-	  " use\n/dev/misc/net/tun instead\n\n");
24
-  fprintf(stderr, "-b will result in brief output (just the device name)\n");
25
-  exit(1);
26
-}
27
-
28
-int main(int argc, char **argv)
29
-{
30
-  struct ifreq ifr;
31
-  struct passwd *pw;
32
-  long owner = geteuid();
33
-  int tap_fd, opt, delete = 0, brief = 0;
34
-  char *tun = "", *file = "/dev/net/tun", *name = argv[0], *end;
35
-
36
-  while((opt = getopt(argc, argv, "bd:f:t:u:")) > 0){
37
-    switch(opt) {
38
-      case 'b':
39
-        brief = 1;
40
-        break;
41
-      case 'd':
42
-        delete = 1;
43
-	tun = optarg;
44
-        break;
45
-      case 'f':
46
-	file = optarg;
47
-	break;
48
-      case 'u':
49
-	pw = getpwnam(optarg);
50
-	if(pw != NULL){
51
-	  owner = pw->pw_uid;
52
-	  break;
53
-	}
54
-        owner = strtol(optarg, &end, 0);
55
-	if(*end != '\0'){
56
-	  fprintf(stderr, "'%s' is neither a username nor a numeric uid.\n",
57
-		  optarg);
58
-	  Usage(name);
59
-	}
60
-        break;
61
-      case 't':
62
-        tun = optarg;
63
-        break;
64
-      case 'h':
65
-      default:
66
-        Usage(name);
67
-    }
68
-  }
69
-
70
-  argv += optind;
71
-  argc -= optind;
72
-
73
-  if(argc > 0)
74
-    Usage(name);
75
-
76
-  if((tap_fd = open(file, O_RDWR)) < 0){
77
-    fprintf(stderr, "Failed to open '%s' : ", file);
78
-    perror("");
79
-    exit(1);
80
-  }
81
-
82
-  memset(&ifr, 0, sizeof(ifr));
83
-
84
-  ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
85
-  strncpy(ifr.ifr_name, tun, sizeof(ifr.ifr_name) - 1);
86
-  if(ioctl(tap_fd, TUNSETIFF, (void *) &ifr) < 0){
87
-    perror("TUNSETIFF");
88
-    exit(1);
89
-  }
90
-
91
-  if(delete){
92
-    if(ioctl(tap_fd, TUNSETPERSIST, 0) < 0){
93
-      perror("TUNSETPERSIST");
94
-      exit(1);
95
-    }    
96
-    printf("Set '%s' nonpersistent\n", ifr.ifr_name);
97
-  }
98
-  else {
99
-    if(ioctl(tap_fd, TUNSETPERSIST, 1) < 0){
100
-      perror("TUNSETPERSIST");
101
-      exit(1);
102
-    }
103
-    if(ioctl(tap_fd, TUNSETOWNER, owner) < 0){
104
-      perror("TUNSETPERSIST");
105
-      exit(1);
106
-    } 
107
-    if(brief)
108
-      printf("%s\n", ifr.ifr_name);
109
-    else printf("Set '%s' persistent and owned by uid %ld\n", ifr.ifr_name, 
110
-		owner);
111
-  }
112
-  return(0);
113
-}

+ 0
- 42
contrib/bootptodhcp/bootptodhcp.pl 查看文件

@@ -1,42 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# Quick hack to convert /etc/bootptab to format required by ISC DHCPD
4
-# This only outputs the fixed hosts portion of the config file
5
-# You still have to provide the global options and the subnet scoping
6
-#
7
-# Turn $useipaddr on if you prefer to use IP addresses in the config file
8
-# I run DNS so I prefer domain names
9
-$useipaddr = 0;
10
-# This will be appended to get the FQDN unless the hostname is already FQDN
11
-$domainname = "ken.com.au";
12
-$tftpdir = "/tftpdir/";
13
-open(B, "/etc/bootptab") or die "/etc/bootptab: $!\n";
14
-while(<B>) {
15
-	if (/^[^a-z]/) {
16
-		$prevline = $_;
17
-		next;
18
-	}
19
-	chomp($_);
20
-	($hostname, @tags) = split(/:/, $_, 5);
21
-	($fqdn = $hostname) .= ".$domainname" unless($hostname =~ /\./);
22
-	($macaddr) = grep(/^ha=/, @tags);
23
-	$macaddr =~ s/ha=//;
24
-	$macaddr =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/g;
25
-	($ipaddr) = grep(/^ip=/, @tags);
26
-	$ipaddr =~ s/ip=//;
27
-	($bootfile) = grep(/^bf=/, @tags);
28
-	$bootfile =~ s/bf=//;
29
-	$bootfile = $tftpdir . $bootfile;
30
-# I have a comment line above most entries and I like to carry this over
31
-	print $prevline if ($prevline =~ /^#/);
32
-	$address = $useipaddr ? $ipaddr : $fqdn;
33
-	print <<EOF
34
-	host $hostname {
35
-		hardware ethernet $macaddr;
36
-		fixed-address $address;
37
-		filename "$bootfile";
38
-	}
39
-EOF
40
-;
41
-	$prevline = $_;
42
-}

+ 0
- 23
contrib/compressor/COPYING 查看文件

@@ -1,23 +0,0 @@
1
-The compression code as implemented in "lzhuf.c" was taken from a BBS
2
-program written by Joachim Schurig <jschurig@zedat.fu-berlin.de>. He
3
-states that the code can be used freely for programs that are covered
4
-by a "freeware" license. This probably includes both BSD style
5
-licenses and the GPL.
6
-
7
-The code in "loader.asm" is a reimplementation of the uncompressor. It
8
-has been written from scratch and is hereby placed under the
9
-conditions of the GNU General Public License (GPL). The algorithm is
10
-outlined in "algorithm.doc".
11
-
12
-Thus, there are no copyright problems with using this code, but there
13
-still might be difficulties with software patents. These patents are
14
-not legal in most parts of the world, but if you live in a country
15
-that honors software patents then you should verify that using these
16
-algorithms is legally permitted. Unless you are absolutely sure, that
17
-there are no legal obstacles, you should use the code for educational
18
-purposes only (this assumes that your educational institution is
19
-exempted from patent laws). The author cannot be held responsible for
20
-using the program code in violation of applicable local laws.
21
-
22
-If you are aware of patents that might affect the legality of using
23
-the code in some parts of the world, please let me know.

+ 0
- 58
contrib/compressor/algorithm.doc 查看文件

@@ -1,58 +0,0 @@
1
-The  compressor achieves  an  average compression  rate of 60%  of the
2
-original size which is on par with "gzip". It seems that you cannot do
3
-much better for compressing  compiled  binaries.  This means that  the
4
-break even  point  for using compressed  images is   reached, once the
5
-uncompressed size approaches 1.5kB. We  can stuff more than 12kB  into
6
-an 8kB EPROM and more than 25kB into an 16kB EPROM.   As there is only
7
-32kB of RAM  for both the uncompressed  image  and its BSS  area, this
8
-means that 32kB EPROMs will hardly ever be required.
9
-
10
-The compression  algorithm uses a  4kB  ring buffer  for buffering the
11
-uncompressed data. Before   compression starts,  the  ring buffer   is
12
-filled  with spaces (ASCII  character  0x20).  The algorithm tries  to
13
-find repeated  input sequences of a  maximum length of  60 bytes.  All
14
-256 different input  bytes  plus the 58 (60   minus a threshold of  2)
15
-possible  repeat lengths form a set  of 314 symbols. These symbols are
16
-adaptively Huffman encoded.  The  algorithm starts out with a Huffmann
17
-tree  that  assigns equal code lengths    to each of  the  314 symbols
18
-(slightly favoring the repeat  symbols over symbols for regular  input
19
-characters), but  it will be changed whenever  the frequency of any of
20
-the symbols  changes. Frequency counts are  kept in 16bit  words until
21
-the total number of compressed codes totals 2^15.  Then, all frequency
22
-counts will be halfed (rounding to the bigger number).  For unrepeated
23
-characters (symbols 0..255) the Huffman code  is written to the output
24
-stream.  For repeated characters the  Huffmann code, which denotes the
25
-length of the repeated character sequence, is written out and then the
26
-index in the ring buffer is computed.   From this index, the algorithm
27
-computes  the offset   relative to  the current  index  into  the ring
28
-buffer. Thus,  for typical input data,  one would expect that short to
29
-medium range offsets are more frequent  than extremely short or medium
30
-range to long range offsets. Thus the  12bit (for a 4kB buffer) offset
31
-value  is statically Huffman encoded  using a precomputed Huffman tree
32
-that favors  those  offset  values    that  are deemed to   be    more
33
-frequent. The  Huffman encoded offset  is  written to the output  data
34
-stream,  directly  following the code  that   determines the length of
35
-repeated characters.
36
-
37
-This algorithm, as implemented in the  C example code, looks very good
38
-and  its operating parameters are   already well optimized. This  also
39
-explains   why  it achieves     compression ratios    comparable  with
40
-"gzip". Depending on the input data, it sometimes excells considerably
41
-beyond what "gzip -9" does, but this  phenomenon does not appear to be
42
-typical. There are some flaws with  the algorithm, such as the limited
43
-buffer  sizes, the  adaptive  Huffman tree  which takes  very  long to
44
-change, if    the input  characters  experience   a sudden   change in
45
-distribution, and the static Huffman   tree for encoding offsets  into
46
-the  buffer.   The slow  changes of   the  adaptive  Huffman  tree are
47
-partially counteracted by  artifically keeping  a 16bit precision  for
48
-the frequency counts, but  this does not  come into play until 32kB of
49
-compressed data is output, so  it does not  have any impact on our use
50
-for "etherboot", because  the BOOT Prom  does not support uncompressed
51
-data of more then 32kB (c.f. doc/spec.doc).
52
-
53
-Nonetheless,  these problems  do  not  seem  to affect  compression of
54
-compiled  programs very much.  Mixing  object code with English  text,
55
-would not work too  well though, and  the algorithm should be reset in
56
-between. Actually, we  might  gain a little  improvement, if  text and
57
-data   segments    were compressed  individually,    but   I have  not
58
-experimented with this option, yet.

+ 0
- 14
contrib/compressor/loader.h 查看文件

@@ -1,14 +0,0 @@
1
-/* Do not change these values unless you really know what you are doing;
2
-   the pre-computed lookup tables rely on the buffer size being 4kB or
3
-   smaller. The buffer size must be a power of two. The lookahead size has
4
-   to fit into 6 bits. If you change any of these numbers, you will also
5
-   have to adjust the decompressor accordingly.
6
- */
7
-
8
-#define BUFSZ           4096
9
-#define LOOKAHEAD       60
10
-#define THRESHOLD       2
11
-#define NCHAR           (256+LOOKAHEAD-THRESHOLD)
12
-#define TABLESZ         (NCHAR+NCHAR-1)
13
-#define NIL             ((unsigned short)-1)
14
-

+ 0
- 764
contrib/compressor/lzhuf.c 查看文件

@@ -1,764 +0,0 @@
1
-/*
2
-----------------------------------------------------------------------------
3
-
4
-M. LZHuf Compression
5
-
6
-This is the LZHuf compression algorithm as used in DPBOX and F6FBB.
7
-
8
-----------------------------------------------------------------------------
9
-*/
10
-/**************************************************************
11
-    lzhuf.c
12
-    written by Haruyasu Yoshizaki 11/20/1988
13
-    some minor changes 4/6/1989
14
-    comments translated by Haruhiko Okumura 4/7/1989
15
-
16
-    minor beautifications and adjustments for compiling under Linux
17
-    by Markus Gutschke <gutschk@math.uni-muenster.de>
18
-    						1997-01-27
19
-
20
-    Modifications to allow use as a filter by  Ken Yap <ken_yap@users.sourceforge.net>.
21
-						1997-07-01
22
-
23
-    Small mod to cope with running on big-endian machines
24
-    by Jim Hague <jim.hague@acm.org)
25
-						1998-02-06
26
-
27
-    Make compression statistics report shorter
28
-    by Ken Yap <ken_yap@users.sourceforge.net>.
29
-						2001-04-25
30
-**************************************************************/
31
-#include <stdio.h>
32
-#include <stdlib.h>
33
-#include <string.h>
34
-#include <ctype.h>
35
-#include <errno.h>
36
-
37
-#ifndef VERBOSE
38
-#define Fprintf(x)
39
-#define wterr     0
40
-#else
41
-#define Fprintf(x) fprintf x
42
-#if defined(ENCODE) || defined(DECODE)
43
-static char wterr[] = "Can't write.";
44
-#ifdef ENCODE
45
-static unsigned long int codesize = 0;
46
-#endif
47
-static unsigned long int printcount = 0;
48
-#endif
49
-#endif
50
-
51
-#ifndef MAIN
52
-extern
53
-#endif
54
-FILE  *infile, *outfile;
55
-
56
-#if defined(ENCODE) || defined(DECODE)
57
-static unsigned long int  textsize = 0;
58
-
59
-static __inline__ void Error(char *message)
60
-{
61
-    Fprintf((stderr, "\n%s\n", message));
62
-    exit(EXIT_FAILURE);
63
-}
64
-
65
-/* These will be a complete waste of time on a lo-endian */
66
-/* system, but it only gets done once so WTF. */
67
-static unsigned long i86ul_to_host(unsigned long ul)
68
-{
69
-    unsigned long res = 0;
70
-    int i;
71
-    union
72
-    {
73
-    	unsigned char c[4];
74
-	unsigned long ul;
75
-    } u;
76
-
77
-    u.ul = ul;
78
-    for (i = 3; i >= 0; i--)
79
-    	res = (res << 8) + u.c[i];
80
-    return res;
81
-}
82
-
83
-static unsigned long host_to_i86ul(unsigned long ul)
84
-{
85
-    int i;
86
-    union
87
-    {
88
-    	unsigned char c[4];
89
-	unsigned long ul;
90
-    } u;
91
-
92
-    for (i = 0; i < 4; i++)
93
-    {
94
-    	u.c[i] = ul & 0xff;
95
-	ul >>= 8;
96
-    }
97
-    return u.ul;
98
-}
99
-#endif
100
-
101
-/********** LZSS compression **********/
102
-
103
-#define N       4096    /* buffer size */
104
-/* Attention: When using this file for f6fbb-type compressed data exchange,
105
-   set N to 2048 ! (DL8HBS) */
106
-#define F       60  /* lookahead buffer size */
107
-#define THRESHOLD   2
108
-#define NIL     N   /* leaf of tree */
109
-
110
-#if defined(ENCODE) || defined(DECODE)
111
-static unsigned char
112
-        text_buf[N + F - 1];
113
-#endif
114
-
115
-#ifdef ENCODE
116
-static int     match_position, match_length,
117
-               lson[N + 1], rson[N + 257], dad[N + 1];
118
-
119
-static void InitTree(void)  /* initialize trees */
120
-{
121
-    int  i;
122
-
123
-    for (i = N + 1; i <= N + 256; i++)
124
-        rson[i] = NIL;          /* root */
125
-    for (i = 0; i < N; i++)
126
-        dad[i] = NIL;           /* node */
127
-}
128
-
129
-static void InsertNode(int r)  /* insert to tree */
130
-{
131
-    int  i, p, cmp;
132
-    unsigned char  *key;
133
-    unsigned c;
134
-
135
-    cmp = 1;
136
-    key = &text_buf[r];
137
-    p = N + 1 + key[0];
138
-    rson[r] = lson[r] = NIL;
139
-    match_length = 0;
140
-    for ( ; ; ) {
141
-        if (cmp >= 0) {
142
-            if (rson[p] != NIL)
143
-                p = rson[p];
144
-            else {
145
-                rson[p] = r;
146
-                dad[r] = p;
147
-                return;
148
-            }
149
-        } else {
150
-            if (lson[p] != NIL)
151
-                p = lson[p];
152
-            else {
153
-                lson[p] = r;
154
-                dad[r] = p;
155
-                return;
156
-            }
157
-        }
158
-        for (i = 1; i < F; i++)
159
-            if ((cmp = key[i] - text_buf[p + i]) != 0)
160
-                break;
161
-        if (i > THRESHOLD) {
162
-            if (i > match_length) {
163
-                match_position = ((r - p) & (N - 1)) - 1;
164
-                if ((match_length = i) >= F)
165
-                    break;
166
-            }
167
-            if (i == match_length) {
168
-                if ((c = ((r - p) & (N - 1)) - 1) < match_position) {
169
-                    match_position = c;
170
-                }
171
-            }
172
-        }
173
-    }
174
-    dad[r] = dad[p];
175
-    lson[r] = lson[p];
176
-    rson[r] = rson[p];
177
-    dad[lson[p]] = r;
178
-    dad[rson[p]] = r;
179
-    if (rson[dad[p]] == p)
180
-        rson[dad[p]] = r;
181
-    else
182
-        lson[dad[p]] = r;
183
-    dad[p] = NIL;  /* remove p */
184
-}
185
-
186
-static void DeleteNode(int p)  /* remove from tree */
187
-{
188
-    int  q;
189
-
190
-    if (dad[p] == NIL)
191
-        return;         /* not registered */
192
-    if (rson[p] == NIL)
193
-        q = lson[p];
194
-    else
195
-    if (lson[p] == NIL)
196
-        q = rson[p];
197
-    else {
198
-        q = lson[p];
199
-        if (rson[q] != NIL) {
200
-            do {
201
-                q = rson[q];
202
-            } while (rson[q] != NIL);
203
-            rson[dad[q]] = lson[q];
204
-            dad[lson[q]] = dad[q];
205
-            lson[q] = lson[p];
206
-            dad[lson[p]] = q;
207
-        }
208
-        rson[q] = rson[p];
209
-        dad[rson[p]] = q;
210
-    }
211
-    dad[q] = dad[p];
212
-    if (rson[dad[p]] == p)
213
-        rson[dad[p]] = q;
214
-    else
215
-        lson[dad[p]] = q;
216
-    dad[p] = NIL;
217
-}
218
-#endif
219
-
220
-/* Huffman coding */
221
-
222
-#define N_CHAR      (256 - THRESHOLD + F)
223
-                /* kinds of characters (character code = 0..N_CHAR-1) */
224
-#define T       (N_CHAR * 2 - 1)    /* size of table */
225
-#define R       (T - 1)         /* position of root */
226
-#define MAX_FREQ    0x8000      /* updates tree when the */
227
-                    /* root frequency comes to this value. */
228
-typedef unsigned char uchar;
229
-
230
-/* table for encoding and decoding the upper 6 bits of position */
231
-
232
-/* for encoding */
233
-
234
-#ifdef ENCODE
235
-static uchar p_len[64] = {
236
-    0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
237
-    0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06,
238
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
239
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
240
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
241
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
242
-    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
243
-    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08
244
-};
245
-
246
-static uchar p_code[64] = {
247
-    0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68,
248
-    0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C,
249
-    0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC,
250
-    0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE,
251
-    0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE,
252
-    0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE,
253
-    0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
254
-    0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
255
-};
256
-#endif
257
-
258
-#ifdef DECODE
259
-/* for decoding */
260
-static uchar d_code[256] = {
261
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
263
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
266
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
267
-    0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
268
-    0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
269
-    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
270
-    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
271
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
272
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
273
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
274
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
275
-    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
276
-    0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
277
-    0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
278
-    0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
279
-    0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D,
280
-    0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
281
-    0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11,
282
-    0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13,
283
-    0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15,
284
-    0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17,
285
-    0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B,
286
-    0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F,
287
-    0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23,
288
-    0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27,
289
-    0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B,
290
-    0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F,
291
-    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
292
-    0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
293
-};
294
-
295
-static uchar d_len[256] = {
296
-    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
297
-    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
298
-    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
299
-    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
300
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
301
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
302
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
303
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
304
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
305
-    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
306
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
307
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
308
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
309
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
310
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
311
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
312
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
313
-    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
314
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
315
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
316
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
317
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
318
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
319
-    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
320
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
321
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
322
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
323
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
324
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
325
-    0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
326
-    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
327
-    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
328
-};
329
-#endif
330
-
331
-#if defined(ENCODE) || defined(DECODE)
332
-static unsigned freq[T + 1];   /* frequency table */
333
-
334
-static int prnt[T + N_CHAR];   /* pointers to parent nodes, except for the */
335
-            /* elements [T..T + N_CHAR - 1] which are used to get */
336
-            /* the positions of leaves corresponding to the codes. */
337
-
338
-static int son[T];     /* pointers to child nodes (son[], son[] + 1) */
339
-#endif
340
-
341
-#ifdef DECODE
342
-static unsigned getbuf = 0;
343
-static uchar getlen = 0;
344
-
345
-static int GetBit(void)    /* get one bit */
346
-{
347
-    int i;
348
-
349
-    while (getlen <= 8) {
350
-        if ((i = getc(infile)) < 0) i = 0;
351
-        getbuf |= i << (8 - getlen);
352
-        getlen += 8;
353
-    }
354
-    i = getbuf;
355
-    getbuf <<= 1;
356
-    getlen--;
357
-    return ((signed short)i < 0);
358
-}
359
-
360
-static int GetByte(void)   /* get one byte */
361
-{
362
-    unsigned short i;
363
-
364
-    while (getlen <= 8) {
365
-        if ((signed short)(i = getc(infile)) < 0) i = 0;
366
-        getbuf |= i << (8 - getlen);
367
-        getlen += 8;
368
-    }
369
-    i = getbuf;
370
-    getbuf <<= 8;
371
-    getlen -= 8;
372
-    return i >> 8;
373
-}
374
-#endif
375
-
376
-#ifdef ENCODE
377
-static unsigned putbuf = 0;
378
-static uchar putlen = 0;
379
-
380
-static void Putcode(int l, unsigned c)     /* output c bits of code */
381
-{
382
-    putbuf |= c >> putlen;
383
-    if ((putlen += l) >= 8) {
384
-        if (putc(putbuf >> 8, outfile) == EOF) {
385
-            Error(wterr);
386
-        }
387
-        if ((putlen -= 8) >= 8) {
388
-            if (putc(putbuf, outfile) == EOF) {
389
-                Error(wterr);
390
-            }
391
-#ifdef VERBOSE
392
-            codesize += 2;
393
-#endif
394
-            putlen -= 8;
395
-            putbuf = c << (l - putlen);
396
-        } else {
397
-	  putbuf <<= 8;
398
-#ifdef VERBOSE
399
-	  codesize++;
400
-#endif
401
-        }
402
-    }
403
-}
404
-#endif
405
-
406
-/* initialization of tree */
407
-
408
-#if defined(ENCODE) || defined(DECODE)
409
-static void StartHuff(void)
410
-{
411
-    int i, j;
412
-
413
-    for (i = 0; i < N_CHAR; i++) {
414
-        freq[i] = 1;
415
-        son[i] = i + T;
416
-        prnt[i + T] = i;
417
-    }
418
-    i = 0; j = N_CHAR;
419
-    while (j <= R) {
420
-        freq[j] = freq[i] + freq[i + 1];
421
-        son[j] = i;
422
-        prnt[i] = prnt[i + 1] = j;
423
-        i += 2; j++;
424
-    }
425
-    freq[T] = 0xffff;
426
-    prnt[R] = 0;
427
-}
428
-
429
-/* reconstruction of tree */
430
-
431
-static void reconst(void)
432
-{
433
-    int i, j, k;
434
-    unsigned f, l;
435
-
436
-    /* collect leaf nodes in the first half of the table */
437
-    /* and replace the freq by (freq + 1) / 2. */
438
-    j = 0;
439
-    for (i = 0; i < T; i++) {
440
-        if (son[i] >= T) {
441
-            freq[j] = (freq[i] + 1) / 2;
442
-            son[j] = son[i];
443
-            j++;
444
-        }
445
-    }
446
-    /* begin constructing tree by connecting sons */
447
-    for (i = 0, j = N_CHAR; j < T; i += 2, j++) {
448
-        k = i + 1;
449
-        f = freq[j] = freq[i] + freq[k];
450
-        for (k = j - 1; f < freq[k]; k--);
451
-        k++;
452
-        l = (j - k) * 2;
453
-        memmove(&freq[k + 1], &freq[k], l);
454
-        freq[k] = f;
455
-        memmove(&son[k + 1], &son[k], l);
456
-        son[k] = i;
457
-    }
458
-    /* connect prnt */
459
-    for (i = 0; i < T; i++) {
460
-        if ((k = son[i]) >= T) {
461
-            prnt[k] = i;
462
-        } else {
463
-            prnt[k] = prnt[k + 1] = i;
464
-        }
465
-    }
466
-}
467
-
468
-/* increment frequency of given code by one, and update tree */
469
-
470
-static void update(int c)
471
-{
472
-    int i, j, k, l;
473
-
474
-    if (freq[R] == MAX_FREQ) {
475
-        reconst();
476
-    }
477
-    c = prnt[c + T];
478
-    do {
479
-        k = ++freq[c];
480
-
481
-        /* if the order is disturbed, exchange nodes */
482
-        if (k > freq[l = c + 1]) {
483
-            while (k > freq[++l]);
484
-            l--;
485
-            freq[c] = freq[l];
486
-            freq[l] = k;
487
-
488
-            i = son[c];
489
-            prnt[i] = l;
490
-            if (i < T) prnt[i + 1] = l;
491
-
492
-            j = son[l];
493
-            son[l] = i;
494
-
495
-            prnt[j] = c;
496
-            if (j < T) prnt[j + 1] = c;
497
-            son[c] = j;
498
-
499
-            c = l;
500
-        }
501
-    } while ((c = prnt[c]) != 0);   /* repeat up to root */
502
-}
503
-#endif
504
-
505
-#ifdef ENCODE
506
-#if 0
507
-static unsigned code, len;
508
-#endif
509
-
510
-static void EncodeChar(unsigned c)
511
-{
512
-    unsigned i;
513
-    int j, k;
514
-
515
-    i = 0;
516
-    j = 0;
517
-    k = prnt[c + T];
518
-
519
-    /* travel from leaf to root */
520
-    do {
521
-        i >>= 1;
522
-
523
-        /* if node's address is odd-numbered, choose bigger brother node */
524
-        if (k & 1) i += 0x8000;
525
-
526
-        j++;
527
-    } while ((k = prnt[k]) != R);
528
-    Putcode(j, i);
529
-#if 0
530
-    code = i;
531
-    len = j;
532
-#endif
533
-    update(c);
534
-}
535
-
536
-static void EncodePosition(unsigned c)
537
-{
538
-    unsigned i;
539
-
540
-    /* output upper 6 bits by table lookup */
541
-    i = c >> 6;
542
-    Putcode(p_len[i], (unsigned)p_code[i] << 8);
543
-
544
-    /* output lower 6 bits verbatim */
545
-    Putcode(6, (c & 0x3f) << 10);
546
-}
547
-
548
-static void EncodeEnd(void)
549
-{
550
-    if (putlen) {
551
-        if (putc(putbuf >> 8, outfile) == EOF) {
552
-            Error(wterr);
553
-        }
554
-#ifdef VERBOSE
555
-        codesize++;
556
-#endif
557
-    }
558
-}
559
-#endif
560
-
561
-#ifdef DECODE
562
-static int DecodeChar(void)
563
-{
564
-    unsigned c;
565
-
566
-    c = son[R];
567
-
568
-    /* travel from root to leaf, */
569
-    /* choosing the smaller child node (son[]) if the read bit is 0, */
570
-    /* the bigger (son[]+1} if 1 */
571
-    while (c < T) {
572
-        c += GetBit();
573
-        c = son[c];
574
-    }
575
-    c -= T;
576
-    update(c);
577
-    return c;
578
-}
579
-
580
-static int DecodePosition(void)
581
-{
582
-    unsigned i, j, c;
583
-
584
-    /* recover upper 6 bits from table */
585
-    i = GetByte();
586
-    c = (unsigned)d_code[i] << 6;
587
-    j = d_len[i];
588
-
589
-    /* read lower 6 bits verbatim */
590
-    j -= 2;
591
-    while (j--) {
592
-        i = (i << 1) + GetBit();
593
-    }
594
-    return c | (i & 0x3f);
595
-}
596
-#endif
597
-
598
-#ifdef ENCODE
599
-/* compression */
600
-
601
-void Encode(void)  /* compression */
602
-{
603
-    int  i, c, len, r, s, last_match_length;
604
-    unsigned long tw;
605
-
606
-    fseek(infile, 0L, 2);
607
-    textsize = ftell(infile);
608
-#ifdef VERBOSE
609
-    if ((signed long)textsize < 0)
610
-      Fprintf((stderr, "Errno: %d", errno));
611
-#endif
612
-    tw = host_to_i86ul(textsize);
613
-    if (fwrite(&tw, sizeof tw, 1, outfile) < 1)
614
-        Error(wterr);   /* output size of text */
615
-    if (textsize == 0)
616
-        return;
617
-    rewind(infile);
618
-    textsize = 0;           /* rewind and re-read */
619
-    StartHuff();
620
-    InitTree();
621
-    s = 0;
622
-    r = N - F;
623
-    for (i = s; i < r; i++)
624
-        text_buf[i] = ' ';
625
-    for (len = 0; len < F && (c = getc(infile)) != EOF; len++)
626
-        text_buf[r + len] = c;
627
-    textsize = len;
628
-    for (i = 1; i <= F; i++)
629
-        InsertNode(r - i);
630
-    InsertNode(r);
631
-    do {
632
-        if (match_length > len)
633
-            match_length = len;
634
-        if (match_length <= THRESHOLD) {
635
-            match_length = 1;
636
-            EncodeChar(text_buf[r]);
637
-        } else {
638
-            EncodeChar(255 - THRESHOLD + match_length);
639
-            EncodePosition(match_position);
640
-        }
641
-        last_match_length = match_length;
642
-        for (i = 0; i < last_match_length &&
643
-                (c = getc(infile)) != EOF; i++) {
644
-            DeleteNode(s);
645
-            text_buf[s] = c;
646
-            if (s < F - 1)
647
-                text_buf[s + N] = c;
648
-            s = (s + 1) & (N - 1);
649
-            r = (r + 1) & (N - 1);
650
-            InsertNode(r);
651
-        }
652
-        if ((textsize += i) > printcount) {
653
-#if defined(VERBOSE) && defined(EXTRAVERBOSE)
654
-            Fprintf((stderr, "%12ld\r", textsize));
655
-#endif
656
-            printcount += 1024;
657
-        }
658
-        while (i++ < last_match_length) {
659
-            DeleteNode(s);
660
-            s = (s + 1) & (N - 1);
661
-            r = (r + 1) & (N - 1);
662
-            if (--len) InsertNode(r);
663
-        }
664
-    } while (len > 0);
665
-    EncodeEnd();
666
-#ifdef	LONG_REPORT
667
-    Fprintf((stderr, "input size    %ld bytes\n", codesize));
668
-    Fprintf((stderr, "output size   %ld bytes\n", textsize));
669
-    Fprintf((stderr, "input/output  %.3f\n", (double)codesize / textsize));
670
-#else
671
-    Fprintf((stderr, "input/output = %ld/%ld = %.3f\n", codesize, textsize,
672
-		(double)codesize / textsize));
673
-#endif
674
-}
675
-#endif
676
-
677
-#ifdef DECODE
678
-void Decode(void)  /* recover */
679
-{
680
-    int  i, j, k, r, c;
681
-    unsigned long int  count;
682
-    unsigned long tw;
683
-
684
-    if (fread(&tw, sizeof tw, 1, infile) < 1)
685
-        Error("Can't read");  /* read size of text */
686
-    textsize = i86ul_to_host(tw);
687
-    if (textsize == 0)
688
-        return;
689
-    StartHuff();
690
-    for (i = 0; i < N - F; i++)
691
-        text_buf[i] = ' ';
692
-    r = N - F;
693
-    for (count = 0; count < textsize; ) {
694
-        c = DecodeChar();
695
-        if (c < 256) {
696
-            if (putc(c, outfile) == EOF) {
697
-                Error(wterr);
698
-            }
699
-            text_buf[r++] = c;
700
-            r &= (N - 1);
701
-            count++;
702
-        } else {
703
-            i = (r - DecodePosition() - 1) & (N - 1);
704
-            j = c - 255 + THRESHOLD;
705
-            for (k = 0; k < j; k++) {
706
-                c = text_buf[(i + k) & (N - 1)];
707
-                if (putc(c, outfile) == EOF) {
708
-                    Error(wterr);
709
-                }
710
-                text_buf[r++] = c;
711
-                r &= (N - 1);
712
-                count++;
713
-            }
714
-        }
715
-        if (count > printcount) {
716
-#if defined(VERBOSE) && defined(EXTRAVERBOSE)
717
-            Fprintf((stderr, "%12ld\r", count));
718
-#endif
719
-            printcount += 1024;
720
-        }
721
-    }
722
-    Fprintf((stderr, "%12ld\n", count));
723
-}
724
-#endif
725
-
726
-#ifdef MAIN
727
-int main(int argc, char *argv[])
728
-{
729
-    char  *s;
730
-    FILE  *f;
731
-    int    c;
732
-
733
-    if (argc == 2) {
734
-	outfile = stdout;
735
-	if ((f = tmpfile()) == NULL) {
736
-	    perror("tmpfile");
737
-	    return EXIT_FAILURE;
738
-	}
739
-	while ((c = getchar()) != EOF)
740
-	    fputc(c, f);
741
-	rewind(infile = f);
742
-    }
743
-    else if (argc != 4) {
744
-        Fprintf((stderr, "'lzhuf e file1 file2' encodes file1 into file2.\n"
745
-                "'lzhuf d file2 file1' decodes file2 into file1.\n"));
746
-        return EXIT_FAILURE;
747
-    }
748
-    if (argc == 4) {
749
-	if ((s = argv[1], s[1] || strpbrk(s, "DEde") == NULL)
750
-	  || (s = argv[2], (infile  = fopen(s, "rb")) == NULL)
751
-	  || (s = argv[3], (outfile = fopen(s, "wb")) == NULL)) {
752
-	    Fprintf((stderr, "??? %s\n", s));
753
-	    return EXIT_FAILURE;
754
-	}
755
-    }
756
-    if (toupper(*argv[1]) == 'E')
757
-        Encode();
758
-    else
759
-        Decode();
760
-    fclose(infile);
761
-    fclose(outfile);
762
-    return EXIT_SUCCESS;
763
-}
764
-#endif

+ 0
- 16
contrib/dhcpdconfeg/dhcpd.conf 查看文件

@@ -1,16 +0,0 @@
1
-This is an example of using vendor tags in DHCPD config, supplied by
2
-Bernd Wiebelt.
3
-
4
-
5
-subnet 10.97.0.0 netmask 255.255.0.0 {
6
-	range 10.97.0.2 10.97.0.254;
7
-	option option-128  e4:45:74:68:0:0;
8
-	option option-160 "default=193";
9
-	option option-184  "HALLO";
10
-       	option option-192 "Linux:::linux.tagged:";
11
-	option option-193 "DOS Bootdisk:::dosboot.tagged";
12
-	option option-194 "RH61 Bootdisk:::boot.tagged";
13
-	option option-195 "Local Disk:::/dev/hda:85b103482a20682da703aa388933a6d8";
14
-}
15
-
16
-

+ 0
- 140
contrib/dhcpdconfeg/vendorclassid.txt 查看文件

@@ -1,140 +0,0 @@
1
-From: Dax Kelson
2
-To: Etherboot users list
3
-Subject: [Etherboot-users] Example ISC DHCP v3 dhcpd.conf using conditional operations
4
-Date: Wed, 13 Jun 2001 20:22:21 -0600
5
-
6
-Hopefully someone will find this useful.  I spent a long time tracking
7
-down and figuring out all the pieces.  To the powers that be, feel free to
8
-stick this in contrib if you like it.
9
-
10
-Goal:  Use the vendor-class-identifier and ISC DHCP v3 "match" option to
11
-conditionally send proper options only when the DHCP discover/request from
12
-etherboot comes in.  We use static-MAC-to-IP mappings for classroom
13
-computers, and dynamic dhcp ranges for other clients (student laptops,
14
-etc).
15
-
16
-I used Etherboot 5.0.1 and the patch (required) in this email:
17
-
18
-http://www.geocrawler.com/lists/3/SourceForge/5299/0/5952625/
19
-
20
-Furture versions of Etherboot will likely already have this patch
21
-included.
22
-
23
-Dax Kelson
24
-Guru Labs
25
-
26
-######### Begin ISC DHCP v3 dhcpd.conf #############
27
-
28
-ddns-update-style ad-hoc;
29
-
30
-# Global default, can be overridden
31
-filename "/exports/kickstart/class1-rh7.1.ks";
32
-
33
-# Define options for Etherboot
34
-# There are more, these are just the ones I'm using
35
-option ebootmagic code 128 = string;
36
-option cmdline code 129 = string;
37
-option menudflts code 160 = string;
38
-option menuline1 code 192 = string;
39
-option menuline2 code 193 = string;
40
-option menuline3 code 194 = string;
41
-option menuline4 code 195 = string;
42
-option menuline5 code 196 = string;
43
-option menuline6 code 197 = string;
44
-option menuline7 code 198 = string;
45
-option menuline8 code 199 = string;
46
-option menuline9 code 200 = string;
47
-option menuline10 code 201 = string;
48
-option menuline11 code 202 = string;
49
-option menuline12 code 203 = string;
50
-option menuline13 code 204 = string;
51
-option menuline14 code 205 = string;
52
-option menuline15 code 206 = string;
53
-option menuline16 code 207 = string;
54
-option motdline1 code 184 = string;
55
-
56
-class "Etherboot" {
57
-    match if substring (option vendor-class-identifier, 0, 9) = "Etherboot";
58
-
59
-        option ebootmagic  = E4:45:74:68:00:00;
60
-
61
-# We don't use this here, because different menu items require
62
-# different cmdlines.  In our ".nbi" files we specify the cmdlines
63
-
64
-#        option cmdline  = "ks initrd=initrd.img lang= devfs=nomount";
65
-
66
-        option motdline1  = "Welcome to Guru Labs classroom";
67
-
68
-        option menudflts  = "timeout=30:default=192";
69
-
70
-        option menuline1  = "Boot from Hard Drive (Default):::/dev/hda:::";
71
-        option menuline2  = "Boot from Floppy:::/dev/fd0:::";
72
-        option menuline3  = "Boot from CDROM::::::";
73
-        option menuline4  = "Kickstart install Red Hat 7.1:::rh71-ks-etherboot.nbi:::";
74
-        option menuline5  = "Red Hat 7.1 network rescue:::rh71-rescue-etherboot.nbi:::";
75
-        option menuline6  = "Boot Win98SE startup floppy:::win98se-startupdisk.nbi:::";
76
-        option menuline7  = "Jumpstart install Solaris 8 (not working yet):::/dev/hda:::";
77
-        option menuline8  = "Install Windows 98 SE (not working yet):::/dev/hda:::";
78
-        option menuline9  = "Install Windows 2000 (not working yet):::/dev/hda:::";
79
-        option menuline10  = "Install FreeBSD 4.3 (not working yet):::/dev/hda:::";
80
-        option menuline11  = "Install OpenBSD 2.9 (not working yet):::/dev/hda:::";
81
-
82
-	# This is a hidden menu item, it should be password protected too
83
-        option menuline12  = "^[[3D^[[K^[[1A^M:::/dev/hda:::";
84
-
85
-# We are using the menu, with different bootfiles.  So we don't use this.
86
-# If you weren't using a menu, you could use this override the global
87
-# default "filename" setting.
88
-
89
-#        filename "rh71-ks-etherboot";
90
-
91
-# Use the following if etherboot compiled with -DREQUIRE_VCI_ETHERBOOT
92
-
93
-        option vendor-encapsulated-options 3c:09:45:74:68:65:72:62:6f:6f:74:ff;
94
-
95
-}
96
-
97
-subnet 10.100.0.0 netmask 255.255.255.0 {
98
-        authoritative;
99
-        option routers                  10.100.0.254;
100
-        option subnet-mask              255.255.255.0;
101
-        option domain-name              "example.com";
102
-        option domain-name-servers      10.100.0.254;
103
-        option time-offset              -7; # US/Mountain
104
-        option ntp-servers              10.100.0.254;
105
-        range dynamic-bootp 10.100.0.175 10.100.0.250;
106
-        default-lease-time 21600;
107
-        max-lease-time 43200;
108
-        option netbios-name-servers     10.100.0.254;
109
-        option netbios-node-type 2;
110
-        use-host-decl-names on;
111
-        next-server server1.example.com;
112
-
113
-}
114
-
115
-host station1 {
116
-        hardware ethernet 00:01:03:de:57:e2;
117
-        fixed-address 10.100.0.1;
118
-}
119
-host station2 {
120
-        hardware ethernet 00:01:03:de:57:e7;
121
-        fixed-address 10.100.0.2;
122
-}
123
-host station3 {
124
-        hardware ethernet 00:01:03:de:57:b4;
125
-        fixed-address 10.100.0.3;
126
-}
127
-host station4 {
128
-        hardware ethernet 00:01:03:de:57:38;
129
-        fixed-address 10.100.0.4;
130
-}
131
-host station5 {
132
-        hardware ethernet 00:01:03:de:58:3d;
133
-        fixed-address 10.100.0.5;
134
-}
135
-
136
-#
137
-# Etc, etc
138
-#
139
-
140
-############## End ISC DHCP v3 dhcpd.conf #############

+ 0
- 884
contrib/dhcpid/dhcpid.txt 查看文件

@@ -1,884 +0,0 @@
1
-From daniel@insu.com Thu Apr 27 14:14:55 2000
2
-Sender: root@iNsu.COM
3
-Message-ID: <39075669.FAEB20F2@insu.com>
4
-Date: Wed, 26 Apr 2000 16:49:45 -0400
5
-From: Daniel Shane <daniel@insu.com>
6
-X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)
7
-X-Accept-Language: en
8
-MIME-Version: 1.0
9
-Subject: Re: New feature added to etherboot
10
-References: <20000425170804.6677127D8A@Goffman.iNsu.COM>
11
-Content-Type: multipart/mixed;
12
- boundary="------------4734FDA0BF2F2FBDF8EB8DF6"
13
-
14
-This is a multi-part message in MIME format.
15
---------------4734FDA0BF2F2FBDF8EB8DF6
16
-Content-Type: text/plain; charset=us-ascii
17
-Content-Transfer-Encoding: 7bit
18
-
19
-Ok, here is a diff for etherboot 4.6.0 that adds identifiers.
20
-
21
-To test this you need to use a class in the dhcpd.conf file and
22
-also send back a string in option 208.
23
-
24
-These identifiers prevent a client from booting from other DHCP
25
-servers when you have more than 1 in your network.
26
-
27
-In will also prevent any client, except the valid ones, to use this
28
-DHCP server.
29
-
30
-Here is a subset of my dhcpd.conf :
31
-
32
-option iNdiskless-state code 208 = text;
33
-
34
-class "iNdiskless-boot" {
35
-    match if substring(option iNdiskless-state,0,4) = "BOOT";
36
-}
37
-class "iNdiskless-setup" {
38
-    match if substring(option iNdiskless-state,0,5) = "SETUP";
39
-}           
40
-
41
-subnet 10.4.1.0 netmask 255.255.255.0 {
42
-pool {
43
-  allow members of "iNdiskless-boot";
44
-  deny unknown clients;
45
-  range 10.4.1.2 10.4.1.200;
46
-  next-server 10.4.1.1;
47
-
48
-# Identify ourselves to the etherboot/DHCP client
49
-  option iNdiskless-state       "BOOT"; 
50
-
51
-  host labo01 {
52
-       hardware ethernet 00:80:c8:ec:04:1b;
53
-     }
54
-  host labo02 {
55
-       hardware ethernet 00:4f:4c:04:45:d6;
56
-     }
57
-  host labo03 {
58
-       hardware ethernet 00:50:ba:c8:db:d6;
59
-  }
60
-}
61
-pool {
62
-  allow members of "iNdiskless-setup";
63
-  range 10.4.1.201 10.4.1.254;
64
-  option iNdiskless-state       "SETUP";
65
-
66
-# send another kernel to setup the diskless workstation
67
-  }
68
-}    
69
-
70
-Daniel Shane.
71
---------------4734FDA0BF2F2FBDF8EB8DF6
72
-Content-Type: text/plain; charset=us-ascii;
73
- name="main.c.diff"
74
-Content-Transfer-Encoding: 7bit
75
-Content-Disposition: inline;
76
- filename="main.c.diff"
77
-
78
---- etherboot-4.6.0/src/main.c	Tue Apr 25 08:30:01 2000
79
-+++ etherboot-4.5.6-new/src/main.c	Wed Apr 26 16:17:09 2000
80
-@@ -42,6 +42,23 @@ char	*motd[RFC1533_VENDOR_NUMOFMOTD];
81
- #ifdef	IMAGE_FREEBSD
82
- int freebsd_howto = 0;
83
- #endif
84
-+
85
-+#ifdef SERVER_IDENT 
86
-+#ifdef DEFAULT_SERVER_IDENT
87
-+char server_ident[9] = DEFAULT_SERVER_IDENT;
88
-+#else
89
-+char server_ident[9] = {};
90
-+#endif   
91
-+#endif
92
-+
93
-+#ifdef CLIENT_IDENT 
94
-+#ifdef DEFAULT_CLIENT_IDENT
95
-+char client_ident[9] = DEFAULT_CLIENT_IDENT;
96
-+#else
97
-+char client_ident[9] = {};
98
-+#endif
99
-+#endif
100
-+
101
- int     vendorext_isvalid;
102
- char	config_buffer[TFTP_MAX_PACKET+1];	/* +1 for null byte */
103
- unsigned long	netmask;
104
-@@ -63,61 +80,85 @@ char    rfc1533_cookie[5] = { RFC1533_CO
105
- char    rfc1533_cookie[] = { RFC1533_COOKIE};
106
- char    rfc1533_end[]={RFC1533_END };
107
- static const char dhcpdiscover[]={
108
--		RFC2132_MSG_TYPE,1,DHCPDISCOVER,
109
--		RFC2132_MAX_SIZE,2,2,64,
110
--		RFC2132_PARAM_LIST,4,RFC1533_NETMASK,RFC1533_GATEWAY,
111
--		RFC1533_HOSTNAME,RFC1533_EXTENSIONPATH
112
--	};
113
--static const char dhcprequest []={
114
--		RFC2132_MSG_TYPE,1,DHCPREQUEST,
115
--		RFC2132_SRV_ID,4,0,0,0,0,
116
--		RFC2132_REQ_ADDR,4,0,0,0,0,
117
--		RFC2132_MAX_SIZE,2,2,64,
118
--		/* request parameters */
119
--		RFC2132_PARAM_LIST,
120
--#ifdef	IMAGE_FREEBSD
121
--		/* 4 standard + 4 vendortags + 8 motd + 16 menu items */
122
--		4 + 4 + 8 + 16,
123
-+	RFC2132_MSG_TYPE,1,DHCPDISCOVER,
124
-+	RFC2132_MAX_SIZE,2,2,64,
125
-+#ifdef CLIENT_IDENT 
126
-+	RFC1533_VENDOR_CLIENT_IDENT,8,0,0,0,0,0,0,0,0,
127
-+#endif
128
-+	RFC2132_PARAM_LIST,
129
-+#ifdef SERVER_IDENT 
130
-+	5,
131
- #else
132
--		/* 4 standard + 3 vendortags + 8 motd + 16 menu items */
133
--		4 + 3 + 8 + 16,
134
-+	4,
135
- #endif
136
--		/* Standard parameters */
137
--		RFC1533_NETMASK, RFC1533_GATEWAY,
138
--		RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH,
139
--		/* Etherboot vendortags */
140
--		RFC1533_VENDOR_MAGIC,
141
-+#ifdef SERVER_IDENT 
142
-+	RFC1533_VENDOR_SERVER_IDENT,   
143
-+#endif
144
-+	RFC1533_NETMASK,
145
-+	RFC1533_GATEWAY,
146
-+	RFC1533_HOSTNAME,
147
-+	RFC1533_EXTENSIONPATH
148
-+};
149
-+static const char dhcprequest []={
150
-+	RFC2132_MSG_TYPE,1,DHCPREQUEST,
151
-+	RFC2132_SRV_ID,4,0,0,0,0,
152
-+	RFC2132_REQ_ADDR,4,0,0,0,0,
153
-+#ifdef CLIENT_IDENT 
154
-+	RFC1533_VENDOR_CLIENT_IDENT,8,0,0,0,0,0,0,0,0,
155
-+#endif
156
-+	RFC2132_MAX_SIZE,2,2,64,
157
-+	/* request parameters */
158
-+	RFC2132_PARAM_LIST,
159
-+	/* 4 standard + 3 vendortags + 8 motd + 16 menu items */
160
-+	4 + 
161
-+	3 + 
162
-+#ifdef  IMAGE_FREEBSD
163
-+	1 + /* One more vendortags for VENDOR_HOWTO */
164
-+#endif
165
-+#ifdef SERVER_IDENT 
166
-+	1 + /* One more vendortags for VENDOR_SERVER_IDENT */
167
-+#endif
168
-+	8 + 
169
-+	16,
170
-+	/* Standard parameters */
171
-+	RFC1533_NETMASK, RFC1533_GATEWAY,
172
-+	RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH,
173
-+	/* Etherboot vendortags */
174
-+	RFC1533_VENDOR_MAGIC,
175
- #ifdef	IMAGE_FREEBSD
176
--		RFC1533_VENDOR_HOWTO,
177
-+	RFC1533_VENDOR_HOWTO,
178
- #endif
179
--		RFC1533_VENDOR_MNUOPTS, RFC1533_VENDOR_SELECTION,
180
--		/* 8 MOTD entries */
181
--		RFC1533_VENDOR_MOTD,
182
--		RFC1533_VENDOR_MOTD+1,
183
--		RFC1533_VENDOR_MOTD+2,
184
--		RFC1533_VENDOR_MOTD+3,
185
--		RFC1533_VENDOR_MOTD+4,
186
--		RFC1533_VENDOR_MOTD+5,
187
--		RFC1533_VENDOR_MOTD+6,
188
--		RFC1533_VENDOR_MOTD+7,
189
--		/* 16 image entries */
190
--		RFC1533_VENDOR_IMG,
191
--		RFC1533_VENDOR_IMG+1,
192
--		RFC1533_VENDOR_IMG+2,
193
--		RFC1533_VENDOR_IMG+3,
194
--		RFC1533_VENDOR_IMG+4,
195
--		RFC1533_VENDOR_IMG+5,
196
--		RFC1533_VENDOR_IMG+6,
197
--		RFC1533_VENDOR_IMG+7,
198
--		RFC1533_VENDOR_IMG+8,
199
--		RFC1533_VENDOR_IMG+9,
200
--		RFC1533_VENDOR_IMG+10,
201
--		RFC1533_VENDOR_IMG+11,
202
--		RFC1533_VENDOR_IMG+12,
203
--		RFC1533_VENDOR_IMG+13,
204
--		RFC1533_VENDOR_IMG+14,
205
--		RFC1533_VENDOR_IMG+15,
206
--	};
207
-+#ifdef SERVER_IDENT
208
-+	RFC1533_VENDOR_SERVER_IDENT,
209
-+#endif
210
-+	RFC1533_VENDOR_MNUOPTS, RFC1533_VENDOR_SELECTION,
211
-+	/* 8 MOTD entries */
212
-+	RFC1533_VENDOR_MOTD,
213
-+	RFC1533_VENDOR_MOTD+1,
214
-+	RFC1533_VENDOR_MOTD+2,
215
-+	RFC1533_VENDOR_MOTD+3,
216
-+	RFC1533_VENDOR_MOTD+4,
217
-+	RFC1533_VENDOR_MOTD+5,
218
-+	RFC1533_VENDOR_MOTD+6,
219
-+	RFC1533_VENDOR_MOTD+7,
220
-+	/* 16 image entries */
221
-+	RFC1533_VENDOR_IMG,
222
-+	RFC1533_VENDOR_IMG+1,
223
-+	RFC1533_VENDOR_IMG+2,
224
-+	RFC1533_VENDOR_IMG+3,
225
-+	RFC1533_VENDOR_IMG+4,
226
-+	RFC1533_VENDOR_IMG+5,
227
-+	RFC1533_VENDOR_IMG+6,
228
-+	RFC1533_VENDOR_IMG+7,
229
-+	RFC1533_VENDOR_IMG+8,
230
-+	RFC1533_VENDOR_IMG+9,
231
-+	RFC1533_VENDOR_IMG+10,
232
-+	RFC1533_VENDOR_IMG+11,
233
-+	RFC1533_VENDOR_IMG+12,
234
-+	RFC1533_VENDOR_IMG+13,
235
-+	RFC1533_VENDOR_IMG+14,
236
-+	RFC1533_VENDOR_IMG+15,
237
-+};
238
- 
239
- #endif	/* NO_DHCP_SUPPORT */
240
- static const char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
241
-@@ -176,6 +217,55 @@ done:
242
- 			break;
243
- 	}
244
- #endif
245
-+
246
-+#ifdef SHIFTED_IDENT_INPUT
247
-+	if (getshift() & 3)
248
-+		{
249
-+#endif
250
-+	
251
-+#ifdef  CLIENT_IDENT
252
-+#   ifdef ASK_CLIENT_IDENT
253
-+			{
254
-+				char tmp_ident[9] = {};
255
-+#      ifdef  DEFAULT_CLIENT_IDENT
256
-+				printf("Enter the client identifier (8 char max.) default [%s] : ",client_ident);
257
-+#      else
258
-+				printf("Enter the client identifier (8 char max.) : ");
259
-+#      endif
260
-+				getstr(tmp_ident,8);
261
-+				if (strlen(tmp_ident) != 0)
262
-+					memcpy(client_ident,tmp_ident,8);
263
-+				else
264
-+					printf("%s",client_ident);
265
-+				putchar('\n');
266
-+			}
267
-+#   endif
268
-+#endif
269
-+
270
-+#ifdef  SERVER_IDENT
271
-+#   ifdef ASK_SERVER_IDENT
272
-+			{
273
-+				char tmp_ident[9] = {};
274
-+#      ifdef  DEFAULT_SERVER_IDENT
275
-+				printf("Enter the server identifier (8 char max.) default [%s] : ",server_ident);
276
-+#      else
277
-+				printf("Enter the server identifier (8 char max.) : ");
278
-+#      endif
279
-+				getstr(tmp_ident,8);
280
-+				if (strlen(tmp_ident) != 0)
281
-+					memcpy(server_ident,tmp_ident,8);
282
-+				else
283
-+					printf("%s",server_ident);
284
-+				putchar('\n');
285
-+			}
286
-+#   endif
287
-+#endif
288
-+
289
-+#ifdef SHIFTED_IDENT_INPUT
290
-+		}
291
-+#endif
292
-+
293
-+	print_config();
294
- #if	(TRY_FLOPPY_FIRST > 0) && defined(FLOPPY)
295
- 	disk_init();
296
- 	printf("Trying floppy");
297
-@@ -188,7 +278,7 @@ done:
298
- 	}
299
- 	printf("no floppy\n");
300
- #endif	/* TRY_FLOPPY_FIRST && FLOPPY */
301
--	print_config();
302
-+        print_config();
303
- 	gateA20_set();
304
- #ifdef	EMERGENCYDISKBOOT
305
- 	if (!eth_probe()) {
306
-@@ -663,6 +753,8 @@ BOOTP - Get my IP address and load infor
307
- int bootp()
308
- {
309
- 	int retry;
310
-+        int offset = 0;
311
-+
312
- #ifndef	NO_DHCP_SUPPORT
313
- 	int retry1;
314
- #endif	/* NO_DHCP_SUPPORT */
315
-@@ -680,11 +772,18 @@ int bootp()
316
- 	bp.bp_xid = xid = starttime = currticks();
317
- 	memcpy(bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETHER_ADDR_SIZE);
318
- #ifdef	NO_DHCP_SUPPORT
319
--	memcpy(bp.bp_vend, rfc1533_cookie, 5); /* request RFC-style options */
320
-+	memcpy(bp.bp_vend+offset, rfc1533_cookie, 5); /* request RFC-style options */
321
-+	offset += sizeof rfc1533_cookie;
322
- #else
323
--	memcpy(bp.bp_vend, rfc1533_cookie, sizeof rfc1533_cookie); /* request RFC-style options */
324
--	memcpy(bp.bp_vend+sizeof rfc1533_cookie, dhcpdiscover, sizeof dhcpdiscover);
325
--	memcpy(bp.bp_vend+sizeof rfc1533_cookie +sizeof dhcpdiscover, rfc1533_end, sizeof rfc1533_end);
326
-+	memcpy(bp.bp_vend+offset, rfc1533_cookie, sizeof rfc1533_cookie); /* request RFC-style options */
327
-+	offset += sizeof rfc1533_cookie; 	
328
-+	memcpy(bp.bp_vend+offset, dhcpdiscover, sizeof dhcpdiscover);
329
-+	offset += sizeof dhcpdiscover;
330
-+#ifdef CLIENT_IDENT 
331
-+	memcpy(bp.bp_vend+13, client_ident, strlen(client_ident));
332
-+#endif
333
-+	memcpy(bp.bp_vend+offset, rfc1533_end, sizeof rfc1533_end);
334
-+	offset += sizeof rfc1533_end;
335
- #endif	/* NO_DHCP_SUPPORT */
336
- 
337
- 	for (retry = 0; retry < MAX_BOOTP_RETRIES; ) {
338
-@@ -715,19 +814,22 @@ int bootp()
339
- #else
340
- 		if (await_reply(AWAIT_BOOTP, 0, NULL, TIMEOUT)){
341
- 			if (dhcp_reply==DHCPOFFER){
342
--		dhcp_reply=0;
343
--		memcpy(bp.bp_vend, rfc1533_cookie, sizeof rfc1533_cookie);
344
--		memcpy(bp.bp_vend+sizeof rfc1533_cookie, dhcprequest, sizeof dhcprequest);
345
--		memcpy(bp.bp_vend+sizeof rfc1533_cookie +sizeof dhcprequest, rfc1533_end, sizeof rfc1533_end);
346
--		memcpy(bp.bp_vend+9, &dhcp_server, sizeof(in_addr));
347
--		memcpy(bp.bp_vend+15, &dhcp_addr, sizeof(in_addr));
348
--			for (retry1 = 0; retry1 < MAX_BOOTP_RETRIES;) {
349
--			udp_transmit(IP_BROADCAST, 0, BOOTP_SERVER,
350
--				sizeof(struct bootp_t), &bp);
351
- 				dhcp_reply=0;
352
--				if (await_reply(AWAIT_BOOTP, 0, NULL, TIMEOUT))
353
--					if (dhcp_reply==DHCPACK)
354
--						return(1);
355
-+				memcpy(bp.bp_vend, rfc1533_cookie, sizeof rfc1533_cookie);
356
-+				memcpy(bp.bp_vend+sizeof rfc1533_cookie, dhcprequest, sizeof dhcprequest);
357
-+				memcpy(bp.bp_vend+sizeof rfc1533_cookie +sizeof dhcprequest, rfc1533_end, sizeof rfc1533_end);
358
-+				memcpy(bp.bp_vend+9, &dhcp_server, sizeof(in_addr));
359
-+				memcpy(bp.bp_vend+15, &dhcp_addr, sizeof(in_addr));
360
-+#ifdef CLIENT_IDENT
361
-+				memcpy(bp.bp_vend+21, client_ident, strlen(client_ident));
362
-+#endif
363
-+				for (retry1 = 0; retry1 < MAX_BOOTP_RETRIES;) {
364
-+					udp_transmit(IP_BROADCAST, 0, BOOTP_SERVER,
365
-+						     sizeof(struct bootp_t), &bp);
366
-+					dhcp_reply=0;
367
-+					if (await_reply(AWAIT_BOOTP, 0, NULL, TIMEOUT))
368
-+						if (dhcp_reply==DHCPACK)
369
-+							return(1);
370
- 					rfc951_sleep(++retry1);
371
- 				}
372
- 			} else
373
-@@ -750,6 +852,7 @@ AWAIT_REPLY - Wait until we get a respon
374
- **************************************************************************/
375
- int await_reply(int type, int ival, void *ptr, int timeout)
376
- {
377
-+	int result;
378
- 	unsigned long time;
379
- 	struct	iphdr *ip;
380
- 	struct	udphdr *udp;
381
-@@ -757,6 +860,7 @@ int await_reply(int type, int ival, void
382
- 	struct	bootp_t *bootpreply;
383
- 	struct	rpc_t *rpc;
384
- 	unsigned short ptype;
385
-+	unsigned int min_packetlen;
386
- 
387
- 	unsigned int protohdrlen = ETHER_HDR_SIZE + sizeof(struct iphdr) +
388
- 				sizeof(struct udphdr);
389
-@@ -766,35 +870,35 @@ int await_reply(int type, int ival, void
390
- 	 * needs a negligible amount of time.  */
391
- 	for (;;) {
392
- 		if (eth_poll()) {	/* We have something! */
393
--					/* Check for ARP - No IP hdr */
394
-+			/* Check for ARP - No IP hdr */
395
- 			if (nic.packetlen >= ETHER_HDR_SIZE) {
396
- 				ptype = ((unsigned short) nic.packet[12]) << 8
397
- 					| ((unsigned short) nic.packet[13]);
398
- 			} else continue; /* what else could we do with it? */
399
- 			if ((nic.packetlen >= ETHER_HDR_SIZE +
400
--				sizeof(struct arprequest)) &&
401
--			   (ptype == ARP) ) {
402
-+			     sizeof(struct arprequest)) &&
403
-+			    (ptype == ARP) ) {
404
- 				unsigned long tmp;
405
--
406
-+				
407
- 				arpreply = (struct arprequest *)
408
- 					&nic.packet[ETHER_HDR_SIZE];
409
- 				if ((arpreply->opcode == ntohs(ARP_REPLY)) &&
410
--				   !memcmp(arpreply->sipaddr, ptr, sizeof(in_addr)) &&
411
--				   (type == AWAIT_ARP)) {
412
-+				    !memcmp(arpreply->sipaddr, ptr, sizeof(in_addr)) &&
413
-+				    (type == AWAIT_ARP)) {
414
- 					memcpy(arptable[ival].node, arpreply->shwaddr, ETHER_ADDR_SIZE);
415
- 					return(1);
416
- 				}
417
- 				memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr));
418
- 				if ((arpreply->opcode == ntohs(ARP_REQUEST)) &&
419
--					(tmp == arptable[ARP_CLIENT].ipaddr.s_addr)) {
420
-+				    (tmp == arptable[ARP_CLIENT].ipaddr.s_addr)) {
421
- 					arpreply->opcode = htons(ARP_REPLY);
422
- 					memcpy(arpreply->tipaddr, arpreply->sipaddr, sizeof(in_addr));
423
- 					memcpy(arpreply->thwaddr, arpreply->shwaddr, ETHER_ADDR_SIZE);
424
- 					memcpy(arpreply->sipaddr, &arptable[ARP_CLIENT].ipaddr, sizeof(in_addr));
425
- 					memcpy(arpreply->shwaddr, arptable[ARP_CLIENT].node, ETHER_ADDR_SIZE);
426
- 					eth_transmit(arpreply->thwaddr, ARP,
427
--						sizeof(struct  arprequest),
428
--						arpreply);
429
-+						     sizeof(struct  arprequest),
430
-+						     arpreply);
431
- #ifdef	MDEBUG
432
- 					memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr));
433
- 					printf("Sent ARP reply to: %I\n",tmp);
434
-@@ -802,20 +906,20 @@ int await_reply(int type, int ival, void
435
- 				}
436
- 				continue;
437
- 			}
438
--
439
-+			
440
- 			if (type == AWAIT_QDRAIN) {
441
- 				continue;
442
- 			}
443
--
444
--					/* Check for RARP - No IP hdr */
445
-+			
446
-+			/* Check for RARP - No IP hdr */
447
- 			if ((type == AWAIT_RARP) &&
448
--			   (nic.packetlen >= ETHER_HDR_SIZE +
449
--				sizeof(struct arprequest)) &&
450
--			   (ptype == RARP)) {
451
-+			    (nic.packetlen >= ETHER_HDR_SIZE +
452
-+			     sizeof(struct arprequest)) &&
453
-+			    (ptype == RARP)) {
454
- 				arpreply = (struct arprequest *)
455
- 					&nic.packet[ETHER_HDR_SIZE];
456
- 				if ((arpreply->opcode == ntohs(RARP_REPLY)) &&
457
--				   !memcmp(arpreply->thwaddr, ptr, ETHER_ADDR_SIZE)) {
458
-+				    !memcmp(arpreply->thwaddr, ptr, ETHER_ADDR_SIZE)) {
459
- 					memcpy(arptable[ARP_SERVER].node, arpreply->shwaddr, ETHER_ADDR_SIZE);
460
- 					memcpy(& arptable[ARP_SERVER].ipaddr, arpreply->sipaddr, sizeof(in_addr));
461
- 					memcpy(& arptable[ARP_CLIENT].ipaddr, arpreply->tipaddr, sizeof(in_addr));
462
-@@ -823,64 +927,72 @@ int await_reply(int type, int ival, void
463
- 				}
464
- 				continue;
465
- 			}
466
--
467
--					/* Anything else has IP header */
468
-+			
469
-+			/* Anything else has IP header */
470
- 			if ((nic.packetlen < protohdrlen) ||
471
--			   (ptype != IP) ) continue;
472
-+			    (ptype != IP) ) continue;
473
- 			ip = (struct iphdr *)&nic.packet[ETHER_HDR_SIZE];
474
- 			if ((ip->verhdrlen != 0x45) ||
475
--				ipchksum((unsigned short *)ip, sizeof(struct iphdr)) ||
476
--				(ip->protocol != IP_UDP)) continue;
477
-+			    ipchksum((unsigned short *)ip, sizeof(struct iphdr)) ||
478
-+			    (ip->protocol != IP_UDP)) continue;
479
- 			udp = (struct udphdr *)&nic.packet[ETHER_HDR_SIZE +
480
--				sizeof(struct iphdr)];
481
--
482
--					/* BOOTP ? */
483
-+							  sizeof(struct iphdr)];
484
-+			
485
-+			/* BOOTP ? */
486
- 			bootpreply = (struct bootp_t *)&nic.packet[ETHER_HDR_SIZE];
487
--			if ((type == AWAIT_BOOTP) &&
488
--			   (nic.packetlen >= (ETHER_HDR_SIZE +
489
--#ifdef	NO_DHCP_SUPPORT
490
--			     sizeof(struct bootp_t))) &&
491
-+#ifdef  NO_DHCP_SUPPORT
492
-+			min_packetlen = ETHER_HDR_SIZE + sizeof(struct bootp_t);
493
- #else
494
--			     sizeof(struct bootp_t))-DHCP_OPT_LEN) &&
495
--#endif	/* NO_DHCP_SUPPORT */
496
--			   (ntohs(udp->dest) == BOOTP_CLIENT) &&
497
--			   (bootpreply->bp_op == BOOTP_REPLY) &&
498
--			   (bootpreply->bp_xid == xid)) {
499
--				arptable[ARP_CLIENT].ipaddr.s_addr =
500
--					bootpreply->bp_yiaddr.s_addr;
501
-+			min_packetlen = ETHER_HDR_SIZE + sizeof(struct bootp_t) - DHCP_OPT_LEN;
502
-+#endif
503
-+			if (
504
-+			    (type == AWAIT_BOOTP) &&
505
-+			    (nic.packetlen >= min_packetlen) &&
506
-+			    (ntohs(udp->dest) == BOOTP_CLIENT) &&
507
-+			    (bootpreply->bp_op == BOOTP_REPLY) &&
508
-+			    (bootpreply->bp_xid == xid)
509
-+			    ) {
510
-+				arptable[ARP_CLIENT].ipaddr.s_addr = bootpreply->bp_yiaddr.s_addr;
511
- #ifndef	NO_DHCP_SUPPORT
512
- 				dhcp_addr.s_addr = bootpreply->bp_yiaddr.s_addr;
513
- #endif	/* NO_DHCP_SUPPORT */
514
- 				netmask = default_netmask();
515
--				arptable[ARP_SERVER].ipaddr.s_addr =
516
--					bootpreply->bp_siaddr.s_addr;
517
-+				arptable[ARP_SERVER].ipaddr.s_addr = bootpreply->bp_siaddr.s_addr;
518
- 				memset(arptable[ARP_SERVER].node, 0, ETHER_ADDR_SIZE);  /* Kill arp */
519
--				arptable[ARP_GATEWAY].ipaddr.s_addr =
520
--					bootpreply->bp_giaddr.s_addr;
521
-+				arptable[ARP_GATEWAY].ipaddr.s_addr = bootpreply->bp_giaddr.s_addr;
522
- 				memset(arptable[ARP_GATEWAY].node, 0, ETHER_ADDR_SIZE);  /* Kill arp */
523
- 				if (bootpreply->bp_file[0]) {
524
- 					memcpy(kernel_buf, bootpreply->bp_file, 128);
525
- 					kernel = kernel_buf;
526
- 				}
527
- 				memcpy((char *)BOOTP_DATA_ADDR, (char *)bootpreply, sizeof(struct bootpd_t));
528
--				decode_rfc1533(BOOTP_DATA_ADDR->bootp_reply.bp_vend,
529
--#ifdef	NO_DHCP_SUPPORT
530
--					       0, BOOTP_VENDOR_LEN +
531
--					       MAX_BOOTP_EXTLEN, 1);
532
--#else
533
--					       0, DHCP_OPT_LEN, 1);
534
--#endif	/* NO_DHCP_SUPPORT */
535
--				return(1);
536
-+#ifdef  NO_DHCP_SUPPORT
537
-+				if (decode_rfc1533(BOOTP_DATA_ADDR->bootp_reply.bp_vend,
538
-+						   0, BOOTP_VENDOR_LEN +
539
-+						   MAX_BOOTP_EXTLEN, 1)) {
540
-+					return(1);
541
-+				}
542
-+				else {
543
-+					continue;
544
-+				}
545
-+#else	
546
-+				if (decode_rfc1533(BOOTP_DATA_ADDR->bootp_reply.bp_vend,
547
-+						   0, DHCP_OPT_LEN, 1)) {
548
-+					return(1);
549
-+				}
550
-+				else {
551
-+					continue;
552
-+				}
553
- 			}
554
--
555
-+#endif	/* NO_DHCP_SUPPORT */
556
- #ifdef	DOWNLOAD_PROTO_TFTP
557
--					/* TFTP ? */
558
-+			/* TFTP ? */
559
- 			if ((type == AWAIT_TFTP) &&
560
--				(ntohs(udp->dest) == ival)) return(1);
561
-+			    (ntohs(udp->dest) == ival)) return(1);
562
- #endif	/* DOWNLOAD_PROTO_TFTP */
563
--
564
-+			
565
- #ifdef	DOWNLOAD_PROTO_NFS
566
--					/* RPC ? */
567
-+			/* RPC ? */
568
- 			rpc = (struct rpc_t *)&nic.packet[ETHER_HDR_SIZE];
569
- 			if ((type == AWAIT_RPC) &&
570
- 			    (ntohs(udp->dest) == ival) &&
571
-@@ -889,19 +1001,19 @@ int await_reply(int type, int ival, void
572
- 				return (1);
573
- 			}
574
- #endif	/* DOWNLOAD_PROTO_NFS */
575
--
576
-+			
577
- 		} else {
578
--			/* Check for abort key only if the Rx queue is empty -
579
--			 * as long as we have something to process, don't
580
--			 * assume that something failed.  It is unlikely that
581
--			 * we have no processing time left between packets.  */
582
-+				/* Check for abort key only if the Rx queue is empty -
583
-+				 * as long as we have something to process, don't
584
-+				 * assume that something failed.  It is unlikely that
585
-+				 * we have no processing time left between packets.  */
586
- 			if (iskey() && (getchar() == ESC))
587
- #ifdef	EMERGENCYDISKBOOT
588
- 				exit(0);
589
- #else
590
--				longjmp(jmp_bootmenu,1);
591
-+			longjmp(jmp_bootmenu,1);
592
- #endif
593
--			/* Do the timeout after at least a full queue walk.  */
594
-+				/* Do the timeout after at least a full queue walk.  */
595
- 			if ((timeout == 0) || (currticks() > time)) {
596
- 				break;
597
- 			}
598
-@@ -914,13 +1026,15 @@ int await_reply(int type, int ival, void
599
- DECODE_RFC1533 - Decodes RFC1533 header
600
- **************************************************************************/
601
- int decode_rfc1533(p, block, len, eof)
602
--	register unsigned char *p;
603
--	int block, len, eof;
604
-+        register unsigned char *p;
605
-+        int block, len, eof;  
606
- {
607
- 	static unsigned char *extdata = NULL, *extend = NULL;
608
- 	unsigned char        *extpath = NULL;
609
- 	unsigned char        *endp;
610
--
611
-+#ifdef SERVER_IDENT
612
-+	char rcvd_server_ident[9] = {};
613
-+#endif
614
- 	if (block == 0) {
615
- #ifdef	IMAGE_MENU
616
- 		memset(imagelist, 0, sizeof(imagelist));
617
-@@ -1002,11 +1116,16 @@ int decode_rfc1533(p, block, len, eof)
618
- 			}
619
- #endif
620
- #ifdef	MOTD
621
--			else if (c >= RFC1533_VENDOR_MOTD &&
622
-+                        else if (c >= RFC1533_VENDOR_MOTD &&
623
- 				 c < RFC1533_VENDOR_MOTD +
624
- 				 RFC1533_VENDOR_NUMOFMOTD)
625
- 				motd[c - RFC1533_VENDOR_MOTD] = p;
626
- #endif
627
-+#ifdef SERVER_IDENT 
628
-+			else if (c == RFC1533_VENDOR_SERVER_IDENT) {
629
-+				memcpy(rcvd_server_ident,p+2,TAG_LEN(p));
630
-+			}
631
-+#endif
632
- 			else {
633
- #if	0
634
- 				unsigned char *q;
635
-@@ -1018,6 +1137,30 @@ int decode_rfc1533(p, block, len, eof)
636
- 			}
637
- 			p += TAG_LEN(p) + 2;
638
- 		}
639
-+#if defined(SERVER_IDENT) && defined(DBG_IDENT)
640
-+		if (strcasecmp(rcvd_server_ident,server_ident)) {
641
-+			char ip[16];
642
-+
643
-+			inet_ntoa(dhcp_server,ip);
644
-+			printf("[%s]: Option %d (%s), invalid response. Wanted (%s).\n",
645
-+			       ip,
646
-+			       RFC1533_VENDOR_SERVER_IDENT,
647
-+			       rcvd_server_ident,
648
-+			       server_ident);
649
-+			strcpy(rcvd_server_ident,"");
650
-+			return(0);
651
-+		}
652
-+	        else {
653
-+			char ip[16];
654
-+
655
-+			inet_ntoa(dhcp_server,ip);
656
-+			printf("[%s]: Option %d (%s), valid response.\n",
657
-+			       ip,
658
-+			       RFC1533_VENDOR_SERVER_IDENT,
659
-+			       rcvd_server_ident);
660
-+			strcpy(rcvd_server_ident,"");
661
-+		}
662
-+#endif
663
- 		extdata = extend = endp;
664
- 		if (block == 0 && extpath != NULL) {
665
- 			char fname[64];
666
-@@ -1103,3 +1246,4 @@ void cleanup(void)
667
-  *  c-basic-offset: 8
668
-  * End:
669
-  */
670
-+
671
-
672
---------------4734FDA0BF2F2FBDF8EB8DF6
673
-Content-Type: text/plain; charset=us-ascii;
674
- name="misc.c.diff"
675
-Content-Transfer-Encoding: 7bit
676
-Content-Disposition: inline;
677
- filename="misc.c.diff"
678
-
679
---- etherboot-4.6.0/src/misc.c	Tue Apr 25 08:30:25 2000
680
-+++ etherboot-4.5.6-new/src/misc.c	Wed Apr 26 16:26:38 2000
681
-@@ -140,9 +140,11 @@ void printf(const char *fmt, ...)
682
- 
683
- #ifdef	IMAGE_MENU
684
- /**************************************************************************
685
--INET_ATON - Convert an ascii x.x.x.x to binary form
686
-+INET_NTOA - Convert an ascii x.x.x.x to binary form
687
- **************************************************************************/
688
--int inet_aton(char *p, in_addr *i)
689
-+int inet_aton(p, i)
690
-+	char *p;
691
-+	in_addr *i;
692
- {
693
- 	unsigned long ip = 0;
694
- 	int val;
695
-@@ -165,7 +167,19 @@ int inet_aton(char *p, in_addr *i)
696
- 
697
- #endif	/* IMAGE_MENU */
698
- 
699
--int getdec(char **ptr)
700
-+#if  defined(CLIENT_IDENT) || defined (SERVER_IDENT)
701
-+/**************************************************************************
702
-+INET_NTOA - Convert a binary form to an ascii x.x.x.x form
703
-+**************************************************************************/
704
-+char *inet_ntoa(in_addr i, char *p)
705
-+{
706
-+	sprintf(p,"%d.%d.%d.%d",i.s_addr>>24,i.s_addr<<8>>24,i.s_addr<<16>>24,i.s_addr<<24>>24);
707
-+	return p;
708
-+}
709
-+#endif
710
-+
711
-+int getdec(ptr)
712
-+	char **ptr;
713
- {
714
- 	char *p = *ptr;
715
- 	int ret=0;
716
-@@ -308,6 +322,45 @@ iskey(void)
717
- 	return 0;
718
- }
719
- #endif	/* ETHERBOOT32 */
720
-+
721
-+/**************************************************************************
722
-+GETSTR - Read a string of size bytes from the keyboard 
723
-+(without echoing the final return)
724
-+**************************************************************************/
725
-+void getstr(char *s, int size)
726
-+{
727
-+   int i=0;
728
-+   char c;
729
-+
730
-+   while(1) {
731
-+      c = getc();
732
-+	  
733
-+			    
734
-+      if (c == 13)
735
-+         {
736
-+	   s[i]='\0';
737
-+	   break;
738
-+         }
739
-+      else if ( 
740
-+		((c >= 'a') && (c <='z')) ||  
741
-+		((c >= 'A') && (c <='Z')) ||
742
-+		((c >= '0') && (c <='9'))
743
-+	      ) {
744
-+                 if (i==8) {
745
-+                     putchar(8);
746
-+                     putchar(s[i-1]=c);
747
-+                  }
748
-+                  else
749
-+                     putchar(s[i++]=c);      
750
-+                }
751
-+     else if ( c == 8 ) {   
752
-+	   if (i != 0) {
753
-+		   --i;
754
-+		   s[i]='\0';
755
-+		   putchar(8);
756
-+		   putchar(32);
757
-+		   putchar(8);
758
-+	   }
759
-+     }
760
-+   }
761
-+}
762
- 
763
- /*
764
-  * Local variables:
765
-
766
---------------4734FDA0BF2F2FBDF8EB8DF6
767
-Content-Type: text/plain; charset=us-ascii;
768
- name="Config.diff"
769
-Content-Transfer-Encoding: 7bit
770
-Content-Disposition: inline;
771
- filename="Config.diff"
772
-
773
---- etherboot-4.6.0/src/Config	Tue Apr 25 08:30:57 2000
774
-+++ etherboot-4.5.6-new/src/Config	Wed Apr 26 15:55:57 2000
775
-@@ -59,6 +59,27 @@
776
- #			  may no longer be appropriate.  You might need to set
777
- #			  MAX_ARP_RETRIES, MAX_BOOTP_RETRIES, MAX_TFTP_RETRIES
778
- #			  and MAX_RPC_RETRIES to a larger value.
779
-+#	-DDEFAULT_CLIENT_IDENT
780
-+#			  The default client identifier that is sent to the
781
-+#			  DHCP server to identify itself. 
782
-+#	-DDEFAULT_SERVER_IDENT
783
-+#			  The expected response that the client will wait
784
-+#			  for when a DHCP server responds to the the initial
785
-+#			  client discovery.
786
-+#	-DASK_CLIENT_IDENT
787
-+#	-DASK_SERVER_IDENT
788
-+#			  If these are set, the boot process will include
789
-+#			  a question period where you can manualy specify
790
-+#			  the client and/or server identifiers.
791
-+#	-DSHIFTED_IDENT_INPUT
792
-+#			  If this is set then the boot process will only
793
-+#			  ask for the identifiers if one of the shift keys
794
-+#			  is pressed. Else it will send the default identifiers
795
-+#			  automatically
796
-+#	-DDBG_IDENT
797
-+#			  This will give show all the DHCP responses with
798
-+#			  their identifiers.
799
-+#			  
800
- #
801
- # Etherboot/32 only options:
802
- #	-DAOUT_IMAGE	- Add a.out kernel boot support (generic)
803
-@@ -147,6 +168,14 @@ CFLAGS32+=	-DASK_BOOT=3 -DANS_DEFAULT=AN
804
- 
805
- # Change download protocol to NFS.  Only available for Etherboot/32 for now.
806
- # CFLAGS32+=	-DDOWNLOAD_PROTO_NFS
807
-+
808
-+# If you have more than one DHCP server you might want to
809
-+# enable these to be able to sort out which one you want to
810
-+# respond to.  
811
-+CFLAGS32+= -DDEFAULT_CLIENT_IDENT=\"BOOT\" -DDEFAULT_SERVER_IDENT=\"BOOT\"
812
-+CFLAGS32+= -DASK_CLIENT_IDENT -DASK_SERVER_IDENT
813
-+CFLAGS32+= -DSHIFTED_IDENT_INPUT
814
-+CFLAGS32+= -DDBG_IDENT 
815
- 
816
- # These flags affect the loader that is prepended to the Etherboot image
817
- LCONFIG+=	-DMOVEROM
818
-
819
---------------4734FDA0BF2F2FBDF8EB8DF6
820
-Content-Type: text/plain; charset=us-ascii;
821
- name="etherboot.h.diff"
822
-Content-Transfer-Encoding: 7bit
823
-Content-Disposition: inline;
824
- filename="etherboot.h.diff"
825
-
826
---- etherboot-4.6.0/src/etherboot.h	Tue Apr 25 08:30:55 2000
827
-+++ etherboot-4.5.6-new/src/etherboot.h	Wed Apr 26 16:07:16 2000
828
-@@ -8,6 +8,14 @@ Author: Martin Renters
829
- 
830
- #include "osdep.h"
831
- 
832
-+#if (! defined(NO_DHCP_SUPPORT)) && (defined(ASK_CLIENT_IDENT) || defined(DEFAULT_CLIENT_IDENT))
833
-+#   define CLIENT_IDENT
834
-+#endif
835
-+
836
-+#if (! defined(NO_DHCP_SUPPORT)) && (defined(ASK_SERVER_IDENT) || defined(DEFAULT_SERVER_IDENT))
837
-+#   define SERVER_IDENT
838
-+#endif
839
-+
840
- /* These could be customised for different languages perhaps */
841
- #define	ASK_PROMPT	"Boot from (N)etwork or from (L)ocal? "
842
- #define	ANS_NETWORK	'N'
843
-@@ -224,6 +232,12 @@ Author: Martin Renters
844
- #ifdef	IMAGE_FREEBSD
845
- #define RFC1533_VENDOR_HOWTO    132
846
- #endif
847
-+#ifdef CLIENT_IDENT
848
-+#define RFC1533_VENDOR_CLIENT_IDENT    208
849
-+#endif
850
-+#ifdef SERVER_IDENT
851
-+#define RFC1533_VENDOR_SERVER_IDENT    208
852
-+#endif
853
- #define RFC1533_VENDOR_MNUOPTS	160
854
- #define RFC1533_VENDOR_SELECTION 176
855
- #define RFC1533_VENDOR_MOTD	184
856
-@@ -477,11 +491,13 @@ extern int getdec P((char **));
857
- extern void printf P((const char *, ...));
858
- extern char *sprintf P((char *, const char *, ...));
859
- extern int inet_aton P((char *p, in_addr *i));
860
-+extern char *inet_ntoa P((in_addr i, char *p));
861
- extern void gateA20_set P((void));
862
- extern void gateA20_unset P((void));
863
- extern void putchar P((int));
864
- extern int getchar P((void));
865
- extern int iskey P((void));
866
-+extern void getstr P((char *s, int size));
867
- 
868
- /* start*.S */
869
- extern int getc P((void));
870
-@@ -528,8 +544,10 @@ extern int hostnamelen;
871
- extern unsigned long netmask;
872
- extern int jmp_bootmenu[10];
873
- extern struct arptable_t arptable[MAX_ARP];
874
--#ifdef	IMAGE_MENU
875
-+#ifdef MOTD
876
- extern char *motd[RFC1533_VENDOR_NUMOFMOTD];
877
-+#endif
878
-+#ifdef	IMAGE_MENU
879
- extern int menutmo,menudefault;
880
- extern unsigned char *defparams;
881
- extern int defparams_max;
882
-
883
---------------4734FDA0BF2F2FBDF8EB8DF6--
884
-

+ 0
- 73
contrib/eepro100notes/flash-1.txt 查看文件

@@ -1,73 +0,0 @@
1
-Date: Tue, 18 May 1999 15:45:55 +0200 (MEST)
2
-From: Erik Starback <erik@math.uu.se>
3
-To: netboot@baghira.han.de
4
-Subject: Netboot with Intel EEPRO100+ Management
5
-Message-ID: <Pine.LNX.3.96.990518154313.3875A-100000@anarchy.math.uu.se>
6
-MIME-Version: 1.0
7
-Content-Type: TEXT/PLAIN; charset=iso-8859-1
8
-Content-Transfer-Encoding: 8BIT
9
-Sender: owner-netboot@baghira.han.de
10
-Precedence: bulk
11
-Reply-To: netboot@baghira.han.de
12
-X-Moderator: netboot-owner@baghira.han.de
13
-X-UIDL: 6ca8453c19c46d622813e9be8ada9517
14
-Status: O
15
-X-Status: 
16
-
17
-Hello!
18
-
19
-When Intel eepro100+ NIC disappeared from the market, I didn't know
20
-what to do. I didn't find any information if anyone has used the
21
-new eepro100+ Management Adapter to netboot linux. 
22
-
23
-I thought that the card should netboot with the same configuration as
24
-the old card when I read Donald Beckers comment:
25
-> The driver should "just work" with the '559. It's not supposed to be
26
-> substantially different than the '558. (I don't have a datasheet
27
-> or sample card to confirm this statement.)
28
-
29
-The problem was now only to put the netboot-program to the built in
30
-flash memory on the NIC. With the old card I used a flash memory (Intel
31
-N28F020 [N28010 didn't work])) and the program FUTIL.EXE from Intel to
32
-flash it. FUTIL did't recognize the memory on the management card
33
-and did not work therefore.
34
-
35
-I found the intel program FBOOT.EXE that was made to upgrade the built
36
-in Intel BOOT agent. I did: Boot dos from floppy, Run FBOOT (choose
37
-adapter), choose (u)pdate, choose Create restore image, rename the
38
-backup file (in my case 2743BE52.FLS [the eight last hex digits from
39
-the MAC address]), rename your netboot code (in my case netboot 0.8.1)
40
-to the backup files original name (in my case 2743BE52.FLS), run
41
-FBOOT, choose (r)estore.
42
-
43
-Voila!
44
-
45
-A shorter way (if you don't need the backup of the old Intel BOOT
46
-agent code) is of course: rename netboot file to [the eight last hex
47
-digits from the MAC address].FLS, run FBOOT, choose restore.
48
- 
49
-Caution: I think it is possible to make a NIC unusable if you have
50
-made the netboot (or etherboot) file with "wrong" parameters. A couple
51
-of month ago I did a etherboot boot file and put it on an old
52
-EEPRO100+ card. It worked fine, but it was impossible to boot local
53
-with it. So I could not boot dos and with FUTIL or FBOOT erase the
54
-flash memory!  To erase the chip I had to take out the memory chip,
55
-boot dos and then put in the memory chip. This isn't possible when the
56
-memory chip is build in.
57
-
58
-Links:
59
-<http://support.intel.com/support/landesk/configmgr/LSA1_193.HTM>
60
-FUTIL.EXE  is a part of LSA1_193.ZIP
61
-
62
-<http://support.intel.com/support/etherexpress/pro100/100pboot.htm>
63
-FBOOT.EXE is a part of 100pboot.exe
64
-
65
-/Erik S
66
-
67
--------------------------------------------------------------------------
68
-Erik Starbäck, System administrator    E-mail address:    erik@math.uu.se
69
-Uppsala University                     Telephone (o):     +46 18 4713277
70
-Department of Mathematics              Cellular phone:    +46 70 4250260
71
-P. O. Box 480                          Fax (o):           +46 18 4713201
72
-SE-751 06  UPPSALA                  
73
-Sweden                                

+ 0
- 149
contrib/eepro100notes/flash-2.txt 查看文件

@@ -1,149 +0,0 @@
1
-Subject: Look Mom, no PROM burner! (eepro100b flashing instructions) :-)
2
-Date: Sun, 23 Jan 2000 01:53:08 -0500
3
-x-sender: mdc%thinguin.org@cdi.entity.com
4
-x-mailer: Claris Emailer 2.0v3, January 22, 1998
5
-From: Marty Connor <mdc@thinguin.org>
6
-To: "Netboot List" <netboot@baghira.han.de>
7
-Mime-Version: 1.0
8
-Content-Type: text/plain; charset="US-ASCII"
9
-Message-ID: <1263512144-341319205@entity.com>
10
-
11
-Continuing the Etherboot World Domination theme, I noticed that there was 
12
-a PCI ethernet card on my bookshelf that still contained the original 
13
-vendor's code in its flash memory.  The card virtually cried out to be 
14
-flashed with Etherboot 4.4.1. :-)
15
-
16
-After having figured out how to flash the 3C905C last week, and owing to 
17
-the fact that the temperature here in Cambridge, Massachusetts (USA) has 
18
-dropped well below freezing, I decided to explore the possibility of 
19
-flashing the Intel eepro100b that was sitting on my bookcase.
20
-
21
-After determining that it was unlikely that one could flash the chip in 
22
-user mode under linux like the 3C509C,  I turned to other options.  (the 
23
-reason is that the flash is memory mapped to a place that causes a core 
24
-dump if accessed.  i suppose one could to patch the kernel to flash the 
25
-card, or add a linux device driver, but... :-)  
26
-
27
-By the way, If you are ever looking for Linux utilities for Ethernet 
28
-cards, you may want to check out: 
29
-
30
-   http://cesdis.gsfc.nasa.gov/linux/diag/
31
-
32
-which is a treasure trove of tools for manipulating and testing Ethernet 
33
-cards, all with source, courtesy of Donald Becker.
34
-
35
-At this point, I felt it was time to make a virtual trip to the Intel 
36
-site (http://www.intel.com/), and search for utilities that might work 
37
-with the eepro100B.  I found two candidates:  FUTIL and FBOOT.  I 
38
-downloaded, decompressed, and transferred them to a DOS formatted floppy. 
39
-Next I determined (after a few tries) that F8 will let me get to DOS 
40
-instead of booting windows. (I tend to avoid Windows when I can).
41
-
42
-I first tried FUTIL.EXE.  No good.  It told me it didn't recognize the 
43
-flash on my eepro100B.  how unfortunate.  and I had such hopes :-)
44
-
45
-Next I tested FBOOT.EXE  (available at 
46
-http://support.intel.com/support/network/adapter/pro100/100PBOOT.htm)  
47
-This program did in fact recognize my eepro100b card.
48
-
49
-The thing about FBOOT however, is that it thinks it only can load certain 
50
-files.  I of course needed to load an Etherboot image.  It appeared to 
51
-have no option for doing that.  Things looked grim.
52
-
53
-Then I noticed that FBOOT was kind enough to do the following dialog:
54
-
55
-   Select Option (U)pdate or (R)estore: U
56
-
57
-I chose Update and it then offered to back up my flash rom for later 
58
-restore:
59
-
60
-   Create Restore Image (Y)es or (N)o: Y
61
-
62
-I chose "Y" and it proceeded to write a file of my flash memory, which 
63
-contained the Intel code.
64
-
65
-   Writing FLASH image to file... 100%
66
-
67
-It then erased the device:
68
-
69
-   Erasing FLASH Device... 100%
70
-
71
-and then programmed it with fresh code (stored inside the program, no 
72
-doubt):
73
-
74
-   Programming FLASH Device... 100%
75
-
76
-So now I had a backup of the Intel boot code in a file strangely called:
77
-
78
-   2794FC60.FLS
79
-
80
-Hmmmm, interesting name.  The MAC address of the card is 09902794FC60.  
81
-They just name the file with the last 4 octets of the MAC address and 
82
-.FLS.  The file is exactly 65536 bytes, which would make sense for a 64K 
83
-Flash Memory device.
84
-
85
-Then I got to thinking, I wonder how carefully the "restore" part of 
86
-FBOOT looks at what it is loading?  What if I took an Etherboot .rom 
87
-file, padded it with 48K of 0xFFs and named it 2794FC60.FLS.  What if I 
88
-then told FBOOT.EXE to "restore" that?
89
-
90
-Well, I guess by now, you know it worked :-) 
91
-
92
-The card came up with the delightful Etherboot banner, Did DHCP, tftp, 
93
-and started a kernel.
94
-
95
-The only unfortunate part is that you need to do this under DOS because 
96
-you seem to need to be in real mode to program the card.  Oh well, 
97
-sacrifices have to be made :-)
98
-
99
-So, in summary, to prepare Etherboot image for flashing into the Intel 
100
-EEPRO100B card with FBOOT, you need to first make an eepro100.rom file, 
101
-as usual.
102
-
103
-Then, see how large it is, with an "ls -l eepro100.rom". the answer will 
104
-probably be 16,384.  You need to pad it with hex FFs to make it 64K for 
105
-FBOOT.  I used the following two lines to create the flash image file.
106
-
107
-   $ perl -e 'print "\xFF" x 49152' > 48kpad.bin
108
-   $ cat eepro100.rom 48kpad.bin > 2794FC60.FLS
109
-
110
-Next write it to a DOS Floppy:
111
-
112
-   $ mount -t msdos /dev/fd0 /mnt/floppy
113
-   $ cp 2794FC60.FLS /mnt/floppy
114
-   $ umount /mnt/floppy
115
-
116
-Now you need to get to DOS.  You could actually use a bootable DOS floppy 
117
-with FBOOT.EXE and 2794FC60.FLS on it.  I started a Windows box and hit 
118
-F8 right before Windows started, and chose option 5, "Command Prompt 
119
-Only", which gives you DOS.  This program can't run in a DOS window under 
120
-Windows or anything like that.  You need to be in real DOS.
121
-
122
-Next it's time to run FBOOT.  It will detect your ethernet card(s), ask 
123
-you which one you want to program, and let you choose it from a menu.
124
-
125
-now the fun part:
126
-
127
-   Select Option (U)pdate or (R)estore: R
128
-   Erasing FLASH Device... 100%
129
-   Writing FLASH image from file... 100%
130
-
131
-Time to reboot and let Etherboot take over.
132
-
133
-So there you go, a way to make Intel EEPRO100Bs play nicely with 
134
-Etherboot.  Maybe we should put these instructions in the Etherboot 
135
-contrib directory so people who have eepro100b cards will be able to 
136
-avoid 3C905C envy :-)
137
-
138
-I hope this helps a few people out.
139
-
140
-Regards,
141
-
142
-Marty
143
-
144
----
145
-   Name: Martin D. Connor
146
-US Mail: Entity Cyber, Inc.; P.O. Box 391827; Cambridge, MA 02139; USA
147
-  Voice: (617) 491-6935, Fax: (617) 491-7046 
148
-  Email: mdc@thinguin.org
149
-    Web: http://www.thinguin.org/

+ 0
- 57
contrib/eepro100notes/flash-3.txt 查看文件

@@ -1,57 +0,0 @@
1
-Date: Sun, 23 Jan 2000 09:47:15 +0100 (MET)
2
-From: Erik Starbäck <erik@math.uu.se>
3
-To: Netboot List <netboot@baghira.han.de>
4
-Subject: Re: Look Mom, no PROM burner! (eepro100b flashing instructions) :-)
5
-In-Reply-To: <1263512144-341319205@entity.com>
6
-Message-ID: <Pine.LNX.3.96.1000123094505.28562A-100000@anarchy.math.uu.se>
7
-MIME-Version: 1.0
8
-Content-Type: TEXT/PLAIN; charset=iso-8859-1
9
-Content-Transfer-Encoding: 8BIT
10
-Sender: owner-netboot@baghira.han.de
11
-Precedence: bulk
12
-Reply-To: netboot@baghira.han.de
13
-X-Moderator: netboot-owner@baghira.han.de
14
-
15
-
16
-Hello!
17
-
18
-In <http://www.han.de/~gero/netboot/archive/msg01718.html> I wrote what I
19
-did know about futil and fboot then. It is about the same as Martys
20
-instructions, but I have a few comments now.
21
-
22
-> Then, see how large it is, with an "ls -l eepro100.rom". the answer will 
23
-> probably be 16,384.  You need to pad it with hex FFs to make it 64K for 
24
-> FBOOT.  I used the following two lines to create the flash image file.
25
-
26
->   $ perl -e 'print "\xFF" x 49152' > 48kpad.bin
27
->   $ cat eepro100.rom 48kpad.bin > 2794FC60.FLS
28
-
29
-It worked for me without any padding. When I burned a smaller image
30
-the program printed 50% instead of 100% and then it
31
-stopped. Everything worked anyway.
32
-
33
-
34
-I also did a brutal way of install etherboot or netboot on a
35
-EEPRO100+Mng without creating a file of type "2794FC60.FLS" for
36
-every card. It was necessary for me when I installed 70 clients...
37
-
38
-I chopped the binary file fboot.exe (my version was 99811 bytes, I
39
-don't remember the version name) in three parts:
40
-
41
-fboot1 30096 bytes
42
-fboot2 65536 bytes
43
-fboot3 4179  bytes
44
-
45
-Then you cat put them together again, but with a different part 2 and
46
-save it as fbootown.exe and execute it. It worked for me anyway. Of
47
-course you have to use padding to get a 64k part instead of fboot2.
48
-
49
-/Erik S
50
-
51
--------------------------------------------------------------------------
52
-Erik Starbäck, System administrator    E-mail address:    erik@math.uu.se
53
-Uppsala University                     Telephone (o):     +46 18 4713277
54
-Department of Mathematics              Cellular phone:    +46 70 4250260
55
-P. O. Box 480                          Fax (o):           +46 18 4713201
56
-SE-751 06  UPPSALA                  
57
-Sweden                                

+ 0
- 29
contrib/flashimg/Makefile 查看文件

@@ -1,29 +0,0 @@
1
-CPPFLAGS	= -x assembler-with-cpp
2
-AS86		= as86
3
-LD86		= ld86
4
-OBJDUMP		= objdump
5
-
6
-.SUFFIXES:	.s86 .asm .aout .img
7
-
8
-all:	flashimg.img
9
-
10
-clean:
11
-	rm -rf *.o *.s86 *.aout *.img
12
-
13
-realclean: clean
14
-	rm -rf *.img
15
-
16
-.asm.s86: $*.asm $*.inc
17
-	  $(CPP) $(CPPFLAGS) -o $@ $*.asm
18
-
19
-.s86.img: $*.s86
20
-	  $(AS86) -0 -b $@ $*.s86
21
-
22
-# .s86.o:	$*.s86
23
-# 	  $(AS86) -0 -a -o $@ $*.s86
24
-# 
25
-# .o.aout: $*.o
26
-# 	  $(LD86) -0 -s -o $@ $*.o
27
-# 
28
-# .aout.img:
29
-# 	  dd if=$*.aout of=$@ bs=32 skip=1

+ 0
- 497
contrib/flashimg/flashimg.asm 查看文件

@@ -1,497 +0,0 @@
1
-; Copyright (C) 1997 Markus Gutschke <gutschk@uni-muenster.de>
2
-;
3
-; This program is free software; you can redistribute it and/or modify
4
-; it under the terms of the GNU General Public License as published by
5
-; the Free Software Foundation; either version 2 of the License, or
6
-; any later version.
7
-;
8
-; This program is distributed in the hope that it will be useful,
9
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
-; GNU General Public License for more details.
12
-;
13
-; You should have received a copy of the GNU General Public License
14
-; along with this program; if not, write to the Free Software
15
-; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
-
17
-; Prepend this image file to an arbitrary ROM image. The resulting binary
18
-; can be loaded from any BOOT-Prom that supports the "nbi" file format.
19
-; When started, the image will reprogram the flash EPROM on the FlashCard
20
-; ISA card. The flash EPROM has to be an AMD 29F010, and the programming
21
-; algorithm is the same as that suggested by AMD in the appropriate data
22
-; sheets.
23
-
24
-
25
-#define SEGLOW		0xC800		/* lower range for EPROM segment     */
26
-#define SEGHIGH		0xE800		/* upper range for EPROM segment     */
27
-#define AMD_ID		0x2001		/* flash EPROM ID, only support AMD  */
28
-#define ERASE1_CMD	0x80		/* first cmd for erasing full chip   */
29
-#define ERASE2_CMD	0x10		/* second cmd for erasing full chip  */
30
-#define READID_CMD	0x90		/* cmd to read chip ID               */
31
-#define PROG_CMD	0xA0		/* cmd to program a byte             */
32
-#define RESET_CMD	0xF0		/* cmd to reset chip state machine   */
33
-
34
-;----------------------------------------------------------------------------
35
-
36
-
37
-	.text
38
-	.org	0
39
-
40
-;	.globl	_main
41
-_main:	mov	ax,#0x0FE0
42
-	mov	ds,ax
43
-	mov	ax,magic		; verify that we have been loaded by
44
-	cmp	ax,#0xE4E4		; boot prom
45
-	jnz	lderr
46
-	jmpi	0x200,0x0FE0		; adjust code segment
47
-lderr:	mov	si,#loaderr
48
-	cld
49
-lderrlp:seg	cs
50
-	lodsb				; loop over all characters of
51
-	or	al,al			; string
52
-	jnz	lderrnx
53
-	xor	ah,ah
54
-	int	0x16			; wait for keypress
55
-	jmpi	0x0000,0xFFFF		; reboot!
56
-lderrnx:mov	ah,#0x0E		; print it
57
-	mov	bl,#0x07
58
-	xor	bh,bh
59
-	int	0x10
60
-	jmp	lderrlp
61
-
62
-loaderr:.ascii	"The flash EPROM utility has to be loaded from a BOOT-Prom"
63
-	.byte	0xa,0xd
64
-	.ascii	"that knows about the 'nbi' file format!"
65
-	.byte	0xa,0xd
66
-	.ascii	"Reboot to proceed..."
67
-	.byte	0
68
-
69
-	.org	510
70
-	.byte	0x55,0xAA
71
-
72
-!----------------------------------------------------------------------------
73
-
74
-start:	mov	ax,cs
75
-	mov	ds,ax
76
-	mov	ax,romdata		; verify that there is an Prom image
77
-	cmp	ax,#0xAA55		; attached to the utility
78
-	jnz	resmag
79
-	mov	al,romdata+2
80
-	or	al,al			; non-zero size is required
81
-	jnz	magicok
82
-resmag:	mov	si,#badmagic		; print error message
83
-reset:	call	prnstr
84
-	xor	ah,ah
85
-	int	0x16			; wait for keypress
86
-	jmpi	0x0000,0xFFFF		; reboot!
87
-magicok:mov	di,#clrline1
88
-	mov	si,#welcome		; print welcome message
89
-inpnew:	call	prnstr
90
-inprest:xor	bx,bx
91
-	mov	cl,#0xC			; expect 4 nibbles input data
92
-inploop:xor	ah,ah
93
-	int	0x16
94
-	cmp	al,#0x8			; <Backspace>
95
-	jnz	inpnobs
96
-	or	bx,bx			; there has to be at least one input ch
97
-	jz	inperr
98
-	mov	si,#delchar		; wipe out char from screen
99
-	call	prnstr
100
-	add	cl,#4			; compute bitmask for removing input
101
-	mov	ch,cl
102
-	mov	cl,#0xC
103
-	sub	cl,ch
104
-	mov	ax,#0xFFFF
105
-	shr	ax,cl
106
-	not	ax
107
-	and	bx,ax
108
-	mov	cl,ch
109
-inploop1:jmp	inploop
110
-inpnobs:cmp	al,#0x0D		; <Return>
111
-	jnz	inpnocr
112
-	or	bx,bx			; zero input -> autoprobing
113
-	jz	inpdone
114
-	cmp	cl,#-4			; otherwise there have to be 4 nibbles
115
-	jz	inpdone
116
-inperr:	mov	al,#7			; ring the console bell
117
-	jmp	inpecho
118
-inpnocr:cmp	al,#0x15		; <CTRL-U>
119
-	jnz	inpnokl
120
-	mov	si,di
121
-	call	prnstr			; clear entire input and restart
122
-	jmp	inprest
123
-inpnokl:cmp	cl,#-4			; cannot input more than 4 nibbles
124
-	jz	inperr
125
-	cmp	al,#0x30		; '0'
126
-	jb	inperr
127
-	ja	inpdig
128
-	or	bx,bx			; leading '0' is not allowed
129
-	jz	inperr
130
-inpdig:	cmp	al,#0x39		; '9'
131
-	ja	inpnodg
132
-	mov	ch,al
133
-	sub	al,#0x30
134
-inpnum:	xor	ah,ah			; compute new input value
135
-	shl	ax,cl
136
-	add	ax,bx
137
-	test	ax,#0x1FF		; test for 8kB boundary
138
-	jnz	inperr
139
-	cmp	ax,#SEGHIGH		; input has to be below E800
140
-	jae	inperr
141
-	cmp	ax,#SEGLOW		; and above/equal C800
142
-	jae	inpok
143
-	cmp	cl,#0xC			; if there is just one nibble, yet,
144
-	jnz	inperr			;   then the lower limit ix C000
145
-	cmp	ax,#0xC000
146
-	jb	inperr
147
-inpok:	mov	bx,ax			; adjust bitmask
148
-	sub	cl,#4
149
-	mov	al,ch
150
-inpecho:call	prnchr			; output new character
151
-	jmp	inploop1
152
-inpnodg:and	al,#0xDF		; lower case -> upper case
153
-	cmp	al,#0x41		; 'A'
154
-	jb	inperr
155
-	cmp	al,#0x46		; 'F'
156
-	ja	inperr
157
-	mov	ch,al
158
-	sub	al,#0x37
159
-	jmp	inpnum
160
-inpdone:or	bx,bx			; zero -> autoprobing
161
-	jnz	probe
162
-	mov	si,#automsg
163
-	call	prnstr
164
-	mov	cx,#0x10
165
-	mov	bx,#SEGHIGH		; scan from E800 to C800
166
-autoprb:sub	bx,#0x0200		; stepping down in 8kB increments
167
-	mov	di,bx
168
-	call	readid
169
-	cmp	ax,#AMD_ID
170
-	jz	prbfnd
171
-	loop	autoprb
172
-	mov	si,#failmsg
173
-nofnd:	mov	di,#clrline2
174
-	jmp	near inpnew		; failure -> ask user for new input
175
-probe:	mov	di,bx
176
-	test	bx,#0x07FF		; EPROM might have to be aligned to
177
-	jz	noalign			;   32kB boundary
178
-	call	readid
179
-	cmp	ax,#AMD_ID		; check for AMDs id
180
-	jz	prbfnd
181
-	mov	si,#alignmsg
182
-	call	prnstr
183
-	and	bx,#0xF800		; enforce alignment of hardware addr
184
-noalign:call	readid			; check for AMDs id
185
-	cmp	ax,#AMD_ID
186
-	jz	prbfnd
187
-	mov	si,#nofndmsg		; could not find any EPROM at speci-
188
-	call	prnstr			;   fied location --- even tried
189
-	mov	si,#basemsg		;   aligning to 32kB boundary
190
-	jmp	nofnd			; failure -> ask user for new input
191
-prbfnd:	mov	si,#fndmsg
192
-	call	prnstr			; we found a flash EPROM
193
-	mov	ax,bx
194
-	call	prnwrd
195
-	mov	si,#ersmsg
196
-	call	prnstr
197
-	call	erase			; erase old contents
198
-	jnc	ersdone
199
-	mov	si,#failresmsg		; failure -> reboot machine
200
-	jmp	near reset
201
-ersdone:mov	si,#prg1msg		; tell user that we are about
202
-	call	prnstr			;   to program the new data into
203
-	mov	ax,di			;   the specified range
204
-	call	prnwrd
205
-	mov	si,#prg2msg
206
-	call	prnstr
207
-	xor	dh,dh
208
-	mov	dl,romdata+2
209
-	shl	dx,#1
210
-	mov	ah,dh
211
-	mov	cl,#4
212
-	shl	ah,cl
213
-	xor	al,al
214
-	add	ax,di
215
-	call	prnwrd
216
-	mov	al,#0x3A		; ':'
217
-	call	prnchr
218
-	mov	ah,dl
219
-	xor	al,al
220
-	dec	ax
221
-	call	prnwrd
222
-	mov	al,#0x20
223
-	call	prnchr
224
-	mov	dh,romdata+2		; number of 512 byte blocks
225
-	push	ds
226
-	mov	ax,ds
227
-	add	ax,#romdata>>4		; adjust segment descriptor, so that
228
-	mov	ds,ax			;   we can handle images which are
229
-prgloop:mov	cx,#0x200		;   larger than 64kB
230
-	xor	si,si
231
-	xor	bp,bp
232
-	call	program			; program 512 data bytes
233
-	jc	prgerr			; check error condition
234
-	mov	ax,ds
235
-	add	ax,#0x20		; increment segment descriptors
236
-	mov	ds,ax
237
-	add	di,#0x20
238
-	dec	dh			; decrement counter
239
-	jnz	prgloop
240
-	pop	ds
241
-	mov	si,#donemsg		; success -> reboot
242
-prgdone:call	prnstr
243
-	mov	si,#resetmsg
244
-	jmp	near reset
245
-prgerr:	pop	ds			; failure -> reboot
246
-	mov	si,#failresmsg
247
-	jmp	prgdone
248
-
249
-
250
-;----------------------------------------------------------------------------
251
-
252
-; READID -- read EPROM id number, base address is passed in BX
253
-; ======
254
-;
255
-; changes: AX, DL, ES
256
-
257
-readid:	mov	dl,#RESET_CMD		; reset chip
258
-	call	sendop
259
-	mov	dl,#READID_CMD
260
-	call	sendop			; send READID command
261
-	mov	es,bx
262
-	seg	es
263
-	mov	ax,0x00			; read manufacturer ID
264
-	mov	dl,#RESET_CMD
265
-	jmp	sendop			; reset chip
266
-
267
-
268
-;----------------------------------------------------------------------------
269
-
270
-; ERASE -- erase entire EPROM, base address is passed in BX
271
-; =====
272
-;
273
-; changes: AL, CX, DL, ES, CF
274
-
275
-erase:	mov	dl,#ERASE1_CMD
276
-	call	sendop			; send ERASE1 command
277
-	mov	dl,#ERASE2_CMD
278
-	call	sendop			; send ERASE2 command
279
-	xor	bp,bp
280
-	mov	al,#0xFF
281
-	push	di
282
-	mov	di,bx
283
-	call	waitop			; wait until operation finished
284
-	pop	di
285
-	jnc	erfail
286
-	mov	dl,#RESET_CMD
287
-	call	sendop			; reset chip
288
-	stc
289
-erfail:	ret
290
-
291
-
292
-;----------------------------------------------------------------------------
293
-
294
-; PROGRAM -- write data block at DS:SI of length CX into EPROM at DI:BP
295
-; =======
296
-;
297
-; changes: AX, CX, DL, BP, ES, CF
298
-
299
-program:mov	dl,#PROG_CMD
300
-	call	sendop			; send programming command
301
-	lodsb				; get next byte from buffer
302
-	mov	es,di
303
-	seg	es
304
-	mov	byte ptr [bp],al	; write next byte into flash EPROM
305
-	call	waitop			; wait until programming operation is
306
-	jc	progdn			; completed
307
-	inc	bp
308
-	loop	program			; continue with next byte
309
-	clc				; return without error
310
-progdn:	ret
311
-
312
-
313
-;----------------------------------------------------------------------------
314
-
315
-; SENDOP -- send command in DL to EPROM, base address is passed in BX
316
-; ======
317
-;
318
-; changes: ES
319
-
320
-sendop:	mov	es,bx
321
-	seg	es
322
-	mov	byte ptr 0x5555,#0xAA	; write magic data bytes into
323
-	jcxz	so1			;   magic locations. This unlocks
324
-so1:	jcxz	so2			;   the flash EPROM. N.B. that the
325
-so2:	seg	es			;   magic locations are mirrored
326
-	mov	byte ptr 0x2AAA,#0x55	;   every 32kB; the hardware address
327
-	jcxz	so3			;   might have to be adjusted to a
328
-so3:	jcxz	so4			;   32kB boundary
329
-so4:	seg	es
330
-	mov	byte ptr 0x5555,dl
331
-	ret
332
-
333
-
334
-;----------------------------------------------------------------------------
335
-
336
-; WAITOP -- wait for command to complete, address is passed in DI:BP
337
-; ======
338
-;
339
-; for details on the programming algorithm, c.f. http://www.amd.com
340
-;
341
-; changes: AX, DL, ES, CF
342
-
343
-waitop:	and	al,#0x80		; monitor bit 7
344
-	mov	es,di
345
-wait1:	seg	es			; read contents of EPROM cell that is
346
-	mov	ah,byte ptr [bp]	;   being programmed
347
-	mov	dl,ah
348
-	and	ah,#0x80
349
-	cmp	al,ah			; bit 7 indicates sucess
350
-	je	waitok
351
-	test	dl,#0x20		; bit 5 indicates timeout/error
352
-	jz	wait1			; otherwise wait for cmd to complete
353
-	seg	es
354
-	mov	ah,byte ptr [bp]	; check error condition once again,
355
-	and	ah,#0x80		;   because bits 7 and 5 can change
356
-	cmp	al,ah			;   simultaneously
357
-	je	waitok
358
-	stc
359
-	ret
360
-waitok:	clc
361
-	ret
362
-
363
-;----------------------------------------------------------------------------
364
-
365
-; PRNSTR -- prints a string in DS:SI onto the console
366
-; ======
367
-;
368
-; changes: AL
369
-
370
-prnstr:	push	si
371
-	cld
372
-prns1:	lodsb				; loop over all characters of
373
-	or	al,al			; string
374
-	jz	prns2
375
-	call	prnchr			; print character
376
-	jmp	prns1
377
-prns2:	pop	si
378
-	ret
379
-
380
-
381
-;----------------------------------------------------------------------------
382
-
383
-; PRNWRD, PRNBYT, PRNNIB, PRNCHR -- prints hexadezimal values, or ASCII chars
384
-; ======  ======  ======  ======
385
-;
386
-; changes: AX
387
-
388
-prnwrd:	push	ax
389
-	mov	al,ah
390
-	call	prnbyt			; print the upper byte
391
-	pop	ax
392
-prnbyt: push	ax
393
-	shr	al,1			; prepare upper nibble
394
-	shr	al,1
395
-	shr	al,1
396
-	shr	al,1
397
-	call	prnnib			; print it
398
-	pop	ax
399
-prnnib:	and	al,#0x0F		; prepare lower nibble
400
-	add	al,#0x30
401
-	cmp	al,#0x39		; convert it into hex
402
-	jle	prnchr
403
-	add	al,#7
404
-prnchr:	push	bx
405
-	mov	ah,#0x0E		; print it
406
-	mov	bl,#0x07
407
-	xor	bh,bh
408
-	int	0x10
409
-	pop	bx
410
-	ret
411
-
412
-
413
-;----------------------------------------------------------------------------
414
-
415
-magic:	.byte	0xE4,0xE4
416
-
417
-badmagic:.byte	0xa,0xd
418
-	.ascii	"There does not appear to be a ROM image attached to the"
419
-	.ascii	"flash EPROM utility;"
420
-	.byte	0xa,0xd
421
-resetmsg:.ascii	"Reboot to proceed..."
422
-	.byte	0
423
-	
424
-welcome:.byte	0xa,0xd
425
-	.ascii	"Flash EPROM programming utility V1.0"
426
-	.byte	0xa,0xd
427
-	.ascii	"Copyright (c) 1997 by M. Gutschke <gutschk@uni-muenster.de>"
428
-	.byte	0xa,0xd
429
-	.ascii	"==========================================================="
430
-	.byte	0xa,0xd
431
-prompt:	.byte	0xa,0xd
432
-	.ascii	"Enter base address for AMD29F010 flash EPROM on FlashCard or"
433
-	.byte	0xa,0xd
434
-	.ascii	"press <RETURN> to start autoprobing; the base address has"
435
-	.byte	0xa
436
-clrline1:.byte	0xd
437
-	.ascii	"to be in the range C800..E600: "
438
-	.ascii	"    "
439
-	.byte	0x8,0x8,0x8,0x8
440
-	.byte	0
441
-
442
-delchar:.byte	0x8,0x20,0x8
443
-	.byte	0
444
-
445
-automsg:.ascii	"autoprobing... "
446
-	.byte	0
447
-
448
-failmsg:.ascii	"failed!"
449
-basemsg:.byte	0xa
450
-clrline2:.byte	0xd
451
-	.ascii	"Enter base address: "
452
-	.ascii	"    "
453
-	.byte	0x8,0x8,0x8,0x8
454
-	.byte	0
455
-
456
-fndmsg:	.byte	0xa,0xd
457
-	.ascii	"Found flash EPROM at: "
458
-	.byte	0
459
-
460
-alignmsg:.byte	0xa,0xd
461
-	.ascii	"FlashCard requires the hardware address to be aligned to a"
462
-	.byte	0xa,0xd
463
-	.ascii	"32kB boundary; automatically adjusting..."
464
-	.byte	0
465
-	
466
-nofndmsg:.byte	0xa,0xd
467
-	.ascii	"No AMD29F010 flash EPROM found"
468
-	.byte	0
469
-
470
-ersmsg:	.byte	0xa,0xd
471
-	.ascii	"Erasing old contents... "
472
-	.byte	0
473
-
474
-prg1msg:.ascii	"done"
475
-	.byte	0xa,0xd
476
-	.ascii	"Programming from "
477
-	.byte	0
478
-	
479
-prg2msg:.ascii	":0000 to "
480
-	.byte	0
481
-
482
-donemsg:.ascii	"done!"
483
-	.byte	0xa,0xd
484
-	.byte	0
485
-       
486
-failresmsg:
487
-	.ascii	"failed!"
488
-	.byte	0xa,0xd
489
-	.byte	0
490
-
491
-
492
-;----------------------------------------------------------------------------
493
-
494
-	.align	16
495
-	.org	*-1
496
-	.byte	0x00
497
-romdata:

二進制
contrib/flashimg/flashimg.img 查看文件


+ 0
- 15
contrib/hdload/Makefile 查看文件

@@ -1,15 +0,0 @@
1
-# Use nasm or as86
2
-ASM=nasm
3
-# ASM=as86
4
-
5
-hdload.bin:	hdload.S
6
-ifeq ($(ASM),as86)
7
-	gcc $(CFLAGS) -DUSE_AS86 -E -traditional -o hdload.s hdload.S
8
-	as86 -0 -b hdload.bin hdload.s
9
-else
10
-	gcc $(CFLAGS) -DUSE_NASM -E -traditional -o hdload.s hdload.S
11
-	nasm -f bin hdload.s -o hdload.bin
12
-endif
13
-
14
-clean:
15
-	$(RM) -f hdload.s hdload.bin

+ 0
- 162
contrib/hdload/hdload.S 查看文件

@@ -1,162 +0,0 @@
1
-#if	!defined(USE_NASM) && !defined(USE_AS86)
2
-#define	USE_AS86
3
-#endif
4
-
5
-#ifdef	USE_AS86
6
-#define	CON(x)		*x
7
-#define	BCON(x)		*x
8
-#define	WCON(x)		*x
9
-#define	LOC(x)		x
10
-#define	BLOC(x)		byte ptr x
11
-#define	WLOC(x)		word ptr x
12
-#define	JMP(x)		jmp x
13
-#define	STRDECL(s)	.ascii	s
14
-#define	SEGCS		seg	cs
15
-#define	SEGES		seg	es
16
-#define	ALIGN(x)	.align	x
17
-#define	SPACE(x)	.space	x
18
-#endif
19
-
20
-#ifdef	USE_NASM
21
-#define	CON(x)		x
22
-#define	BCON(x)		byte x
23
-#define	WCON(x)		word x
24
-#define	LOC(x)		[x]
25
-#define	BLOC(x)		byte [x]
26
-#define	WLOC(x)		word [x]
27
-#define	JMP(x)		jmp short x
28
-#define	STRDECL(s)	db	s
29
-#define	SEGCS		cs
30
-#define	SEGES		es
31
-#define	ALIGN(x)	align x, db 0
32
-#define	SPACE(x)	times x db 0
33
-#endif
34
-
35
-ROMLOAD	equ	0x5000
36
-
37
-start:
38
-	cli
39
-	xor	ax, ax
40
-	mov	ss, ax
41
-	mov	sp, CON(0x7C00)
42
-	mov	si, sp
43
-	mov	es, ax
44
-	mov	ds, ax
45
-	sti
46
-	cld
47
-	mov	di, CON(0x600)
48
-	mov	cx, CON(0x100)
49
-	rep
50
-	movsw
51
-	db	0xEA
52
-	dw	jump
53
-	dw	0
54
-jump:
55
-	mov	si, CON(Hlaska)
56
-	call	print
57
-
58
-        ; rozmery prvniho HD
59
-        mov     ah, CON(8)
60
-        mov     dl, CON(0x80)
61
-        int     0x13
62
-        jc      chyba
63
-        ; dh - H, cx - CS
64
-
65
-        ; prvi stopa obsahuje bootrom, tak ji natahneme do RAM
66
-        mov     ah, CON(2)
67
-        mov     al, cl
68
-        and     al, CON(0x3F)
69
-        dec     al
70
-        mov     dx, CON(0x80)
71
-        mov     cx, CON(2)
72
-        mov     bx, CON(ROMLOAD)
73
-        mov     es, bx
74
-        xor     bx, bx
75
-        int     0x13
76
-        jc      chyba
77
-
78
-        ; hromada kodu podle zdrojaku netboot
79
-        xor     di, di
80
-        mov     es, di
81
-        mov     di, CON(0x380)
82
-        push    di
83
-        mov     cx, CON(10)
84
-        cld
85
-        rep
86
-	stosw
87
-        pop     di
88
-#ifdef	USE_AS86
89
-        mov     word ptr [ di ], CON(0x5a5a)
90
-        mov     byte ptr [ di + 2 ], CON(0x50)
91
-        mov     word ptr [ di + 0x10 ], CON(0xFFFF)
92
-        mov     word ptr [ di + 0x12 ], CON(0xFFFF)
93
-#endif
94
-#ifdef	USE_NASM
95
-        mov     word [ di ], CON(0x5a5a)
96
-        mov     byte [ di + 2 ], CON(0x50)
97
-        mov     word [ di + 10h ], CON(0xFFFF)
98
-        mov     word [ di + 12h ], CON(0xFFFF)
99
-#endif
100
-
101
-        ; navratova adresa, kdyby nezabrala ROM
102
-	SEGCS
103
-        mov	WLOC(OfsErr), CON(RomErr)
104
-        push    cs
105
-        push    WCON(chyba)
106
-        mov     ax, CON(ROMLOAD)
107
-        mov     es, ax
108
-        push    es
109
-        ; kouzelny jump....
110
-	SEGES
111
-        mov     si, [ 0x1a ]
112
-	SEGES
113
-#ifdef	USE_AS86
114
-        push    word ptr [ si + 0x1a ] ; ...do bootrom v RAM
115
-#endif
116
-#ifdef	USE_NASM
117
-        push    word [ si + 0x1a ] ; ...do bootrom v RAM
118
-#endif
119
-        retf
120
-
121
-chyba:
122
-	SEGCS
123
-	mov	si, LOC(OfsErr)
124
-	call	print
125
-        mov     si, CON(CRLF)
126
-	call	print
127
-        JMP(chyba)
128
-
129
-print:
130
-	lodsb
131
-	cmp	al,CON(0)
132
-	je	navrat
133
-	push	si
134
-	mov	bx,CON(7)
135
-	mov	ah,CON(0x0E)
136
-	int	0x10
137
-	pop	si
138
-	JMP(print)
139
-
140
-navrat:
141
-	ret
142
-
143
-Hlaska:	db	13, 10
144
-	STRDECL('HD Net Loader v1.0 (c) poli 1999')
145
-	db	13, 10, 0
146
-CRLF:	db	13, 10, 0
147
-OfsErr:	dw	Error
148
-Error:	STRDECL('Error load from HD !')
149
-	db	0
150
-RomErr:	STRDECL('ROM Error !')
151
-	db	0
152
-
153
-mbrend:
154
-	ret
155
-
156
-#ifdef  USE_AS86
157
-	org     510
158
-#endif
159
-#ifdef  USE_NASM
160
-	times   510-($-$$) db 0
161
-#endif
162
-        dw	0xAA55

+ 0
- 175
contrib/hdload/petr.msg 查看文件

@@ -1,175 +0,0 @@
1
-From netboot-owner@baghira.han.de Thu Sep 16 12:08:44 1999
2
-Return-Path: <netboot-owner@baghira.han.de>
3
-Received: (from factotum@localhost)
4
-	by baghira.han.de (8.9.3/8.9.3) id NAA23838
5
-	for netboot-outgoing; Wed, 15 Sep 1999 13:12:44 +0200
6
-X-Authentication-Warning: baghira.han.de: factotum set sender to owner-netboot using -f
7
-Received: from hathi.han.de (root@hathi.han.de [192.109.225.1])
8
-	by baghira.han.de (8.9.3/8.9.3) with ESMTP id NAA23785
9
-	for <netboot@baghira.han.de>; Wed, 15 Sep 1999 13:11:02 +0200
10
-Received: from vsb.cz (root@decsys.vsb.cz [158.196.149.9])
11
-	by hathi.han.de (8.9.3/8.9.3) with ESMTP id NAA04707
12
-	for <netboot@baghira.han.de>; Wed, 15 Sep 1999 13:11:00 +0200
13
-Received: from nwfei1.vsb.cz (nwfei1.vsb.cz [158.196.146.13])
14
-	by vsb.cz (8.9.3/8.9.1) with ESMTP id NAA22363
15
-	for <netboot@baghira.han.de>; Wed, 15 Sep 1999 13:10:52 +0200 (MET DST)
16
-Received: from FEI1/SpoolDir by nwfei1.vsb.cz (Mercury 1.44);
17
-    15 Sep 99 13:10:50 +0100
18
-Received: from SpoolDir by FEI1 (Mercury 1.44); 15 Sep 99 13:10:27 +0100
19
-Received: from pcd403z.vsb.cz (158.196.146.9) by nwfei1.vsb.cz (Mercury 1.44) with ESMTP;
20
-    15 Sep 99 13:10:25 +0100
21
-Received: from oli10 by pcd403z.vsb.cz with local-esmtp (Exim 2.05 #1 (Debian))
22
-	id 11RCxI-0000oT-00; Wed, 15 Sep 1999 13:10:28 +0200
23
-Date: Wed, 15 Sep 1999 13:10:28 +0200 (CEST)
24
-From: Petr Olivka <Petr.Olivka@vsb.cz>
25
-To: netboot@baghira.han.de
26
-Subject: netboot image on hard disk - it is easy
27
-In-Reply-To: <37DF4BD4.E8FFF8FC@gsmbox.com>
28
-Message-ID: <Pine.LNX.4.10.9909151247430.2936-100000@pcd403z.vsb.cz>
29
-MIME-Version: 1.0
30
-Content-Type: TEXT/PLAIN; charset=US-ASCII
31
-Sender: owner-netboot@baghira.han.de
32
-Precedence: bulk
33
-Reply-To: netboot@baghira.han.de
34
-X-Moderator: netboot-owner@baghira.han.de
35
-
36
-It is good joke, at this moment I have only simple version of MBR to load
37
-image from HD, but only from track 0. HD have to have enough sectors per
38
-track for rom image.
39
-And small program in turbo-pascal to download image to HD.
40
-
41
-below is assembler code for MBR. Is writen for tasm and tlink. 
42
-If you have 512 bytes binary file with MBR code, then concat it with
43
-rom-image and download to hda. BUT NOT DIRECTLY !!!! You have to copy 
44
-partition table ( and NT signature ) to MBR and then download. BUT ONLY tO
45
-TRACK 0.
46
-
47
-Everything in your own risk.
48
-
49
-If I will have some free time, I will write some code directly to netboot.
50
-
51
-poli
52
-
53
-.model large, pascal
54
-
55
-.code
56
-.386
57
-	public 	mbrasm, mbrend
58
-
59
-ROMLOAD	equ	5000h
60
-
61
-	org	600h
62
-
63
-mbrasm	proc
64
-
65
-	cli
66
-	xor	ax, ax
67
-	mov	ss, ax
68
-	mov	sp, 7C00h
69
-	mov	si, sp
70
-	mov	es, ax
71
-	mov	ds, ax
72
-	sti
73
-	cld
74
-	mov	di, 600h
75
-	mov	cx, 100h
76
-	rep	movsw
77
-	db	0EAh
78
-	dw	offset @@jump
79
-	dw	0
80
-@@jump:
81
-	mov	si, offset Hlaska
82
-	call	@@print
83
-
84
-        ; rozmery prvniho HD
85
-        mov     ah, 8
86
-        mov     dl, 80h
87
-        int     13h
88
-        jc      @@chyba
89
-        ; dh - H, cx - CS
90
-
91
-        ; prvi stopa obsahuje bootrom, tak ji natahneme do RAM
92
-        mov     ah, 2
93
-        mov     al, cl
94
-        and     al, 3Fh
95
-        dec     al
96
-        mov     dx, 80h
97
-        mov     cx, 2
98
-        mov     bx, ROMLOAD
99
-        mov     es, bx
100
-        xor     bx, bx
101
-        int     13h
102
-        jc      @@chyba
103
-
104
-        ; hromada kodu podle zdrojaku netboot
105
-        xor     di, di
106
-        mov     es, di
107
-        mov     di, 380h
108
-        push    di
109
-        mov     cx, 10
110
-        cld
111
-        rep     stosw
112
-        pop     di
113
-        mov     word ptr [ di ], 5a5ah
114
-        mov     byte ptr [ di + 2 ], 50h
115
-        mov     word ptr [ di + 10h ], 0FFFFh
116
-        mov     word ptr [ di + 12h ], 0FFFFh
117
-
118
-        ; navratova adresa, kdyby nezabrala ROM
119
-        mov	OfsErr, offset RomErr
120
-        push    cs
121
-        push    offset @@chyba
122
-
123
-        mov     ax, ROMLOAD
124
-        mov     es, ax
125
-        push    es
126
-        ; kouzelny jump....
127
-        mov     si,  es:[ 1ah ]
128
-        push    word ptr es:[ si + 1ah ] ; ...do bootrom v RAM
129
-        retf
130
-
131
-@@chyba:
132
-	mov	si, OfsErr
133
-	call	@@print
134
-        mov     si, offset CRLF
135
-	call	@@print
136
-        jmp     @@chyba
137
-
138
-@@print:
139
-	lodsb
140
-	cmp	al,0
141
-	je	@@navrat
142
-	push	si
143
-	mov	bx,7
144
-	mov	ah,0Eh
145
-	int	10h
146
-	pop	si
147
-	jmp	@@print
148
-
149
-@@navrat:
150
-	retn
151
-
152
-Hlaska	db	13, 10, 'HD Net Loader v1.0 (c) poli 1999', 13, 10, 0
153
-CRLF	db	13, 10, 0
154
-OfsErr	dw	offset Error
155
-Error	db	'Error load from HD !', 0
156
-RomErr	db	'ROM Error !', 0
157
-
158
-mbrasm	endp
159
-
160
-mbrend	proc
161
-	ret
162
-mbrend	endp
163
-
164
-        org 800h - 2
165
-        dw  0AA55h
166
-
167
-end
168
-
169
-===========================================================================
170
-This Mail was sent to netboot mailing list by:
171
-Petr Olivka <Petr.Olivka@vsb.cz>
172
-To get help about this list, send a mail with 'help' as the only string in
173
-it's body to majordomo@baghira.han.de. If you have problems with this list,
174
-send a mail to netboot-owner@baghira.han.de.
175
-

+ 0
- 46
contrib/initrd/ChangeLog 查看文件

@@ -1,46 +0,0 @@
1
-mkinitrd-net ChangeLog
2
-
3
-Last Modified: Fri Jul 26 23:08:28 2002
4
-
5
-$Log$
6
-Revision 1.1  2005/05/17 16:45:02  mcb30
7
-Initial revision
8
-
9
-Revision 1.1  2002/11/06 06:31:06  ken_yap
10
-Contributed by Michael Brown.
11
-
12
-Revision 1.10  2002/07/26 23:09:13  mcb30
13
-Support for new binary etherboot.nic-dev-id structure
14
-Added --kernel option patch from Stew Benedict at MandrakeSoft
15
-Only try to use sudo if we are not already root
16
-
17
-Revision 1.9  2002/06/05 13:31:50  mcb30
18
-Modifications to allow DHCP, TFTP and NFS servers to be separate machines.
19
-
20
-Revision 1.8  2002/05/30 11:41:18  mcb30
21
-/tftpboot symlinked to /var/lib/tftpboot
22
-Has ability to be quiet if "quiet" specified on kernel cmdline
23
-
24
-Revision 1.7  2002/05/26 11:15:04  mcb30
25
-PCI-ID auto-mapping via dhcpd.conf.etherboot-pcimap.include
26
-
27
-Revision 1.6  2002/05/24 02:05:11  mcb30
28
-Bugfixes, migrated /tftpboot to /var/lib/tftpboot
29
-
30
-Revision 1.5  2002/05/23 21:29:58  mcb30
31
-Now includes dhcpd.conf.etherboot.include
32
-Automatically scans for all network modules in the pcimap file
33
-
34
-Revision 1.4  2002/05/08 09:04:31  mcb30
35
-Bugfixes: tmpdir selection, linuxrc typos, ifconfig peculiarities
36
-
37
-Revision 1.3  2002/05/04 21:44:13  mcb30
38
-During %make, LIBDIR must be set for mknbi
39
-Added %post scriptlet since %trigger seems not to be being triggered...
40
-
41
-Revision 1.2  2002/05/04 21:20:32  mcb30
42
-Added extra sources instead of requiring "make" to download them
43
-
44
-Revision 1.1  2002/05/04 13:19:40  mcb30
45
-First attempt at an RPM package
46
-

+ 0
- 187
contrib/initrd/Makefile 查看文件

@@ -1,187 +0,0 @@
1
-UCLIBC_VERSION = 0.9.11
2
-UCLIBC = uClibc-$(UCLIBC_VERSION)
3
-$(UCLIBC)_SOURCE = http://www.uclibc.org/downloads/$(UCLIBC).tar.bz2
4
-UCLIBC_INSTALL = $(CURDIR)/uClibc
5
-
6
-UDHCP_VERSION = 0.9.7
7
-UDHCP = udhcp-$(UDHCP_VERSION)
8
-$(UDHCP)_SOURCE = http://udhcp.busybox.net/source/$(UDHCP).tar.gz
9
-
10
-BUSYBOX_VERSION = 0.60.3
11
-BUSYBOX = busybox-$(BUSYBOX_VERSION)
12
-$(BUSYBOX)_SOURCE = http://www.busybox.net/downloads/$(BUSYBOX).tar.bz2
13
-
14
-LINUX_WLAN_VERSION = 0.1.13
15
-LINUX_WLAN = linux-wlan-ng-$(LINUX_WLAN_VERSION)
16
-$(LINUX_WLAN)_SOURCE = ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/$(LINUX_WLAN).tar.gz
17
-
18
-MKNBI_VERSION = 1.2
19
-MKNBI = mknbi-$(MKNBI_VERSION)
20
-$(MKNBI)_SOURCE = http://belnet.dl.sourceforge.net/sourceforge/etherboot/$(MKNBI).tar.gz
21
-
22
-export PATH := $(UCLIBC_INSTALL)/bin:$(PATH)
23
-
24
-all : utils initrd-skel mknbi mknbi-linux
25
-	# Run "make tftpboot/initrd-kernel_module.img" to generate a suitable initrd
26
-	# Run "make tftpboot/boot-kernel_module.nbi" to generate a suitable NBI
27
-	# Run "make all-nbi" to generate a complete set of NBIs
28
-
29
-%.tar.bz2 :
30
-	[ -d $* ] || wget $($*_SOURCE)
31
-	[ -f $*.t*gz ] && ( gunzip $*.t*gz ; bzip2 -9 $*.tar ) || true
32
-
33
-UTILS = udhcpc busybox wlanctl
34
-
35
-utils : $(UTILS)
36
-
37
-clean : partlyclean
38
-	rm -rf uClibc
39
-	rm -rf $(UCLIBC)
40
-	rm -rf tftpboot/*
41
-
42
-partlyclean :
43
-	rm -rf $(UDHCP)
44
-	rm -rf $(BUSYBOX)
45
-	rm -rf $(LINUX_WLAN)
46
-	rm -rf $(MKNBI)
47
-	rm -rf initrd-skel
48
-	rm -f *.img *.ird *.nbi insert-modules
49
-	rm -f $(UTILS) mknbi-linux
50
-	rm -f *.uClibc *.busybox *.udhcpc *.wlanctl
51
-
52
-.PHONY : all utils clean partlyclean
53
-
54
-uClibc : $(UCLIBC)
55
-	rm -rf $@
56
-	$(MAKE) -C $(UCLIBC) install
57
-
58
-$(UCLIBC) : $(UCLIBC).tar.bz2
59
-	[ -d $@ ] || tar xvjf $<
60
-	[ -f $(UCLIBC)/Config ] || perl -pe 's/^(INCLUDE_RPC).*/$$1 = true/ ;' \
61
-		-e 's{^(DEVEL_PREFIX).*}{$$1 = $(UCLIBC_INSTALL)} ;' \
62
-		-e 's{^(SHARED_LIB_LOADER_PATH).*}{$$1 = /lib} ;' \
63
-		$(UCLIBC)/extra/Configs/Config.i386 > $(UCLIBC)/Config
64
-	# Stripping out spurious CVS directories (screws up local cvs update)
65
-	rm -rf `find $(UCLIBC) -name CVS`
66
-	$(MAKE) -C $(UCLIBC)
67
-	install -m 644 $(UCLIBC)/COPYING.LIB COPYING.uClibc
68
-
69
-udhcpc : $(UDHCP)
70
-	install -m 755 -s $(UDHCP)/$@ $@
71
-
72
-$(UDHCP) : $(UDHCP).tar.bz2 uClibc
73
-	[ -d $@ ] || tar xvjf $<
74
-	if [ ! -f $@/.script.c.patch ]; then \
75
-		patch -d $@ -b -z .orig < script.c.patch ; \
76
-		touch $@/.script.c.patch ; \
77
-	fi
78
-	$(MAKE) LDFLAGS+=-static -C $(UDHCP)
79
-	install -m 644 $(UDHCP)/AUTHORS AUTHORS.udhcpc
80
-	install -m 644 $(UDHCP)/COPYING COPYING.udhcpc
81
-
82
-busybox : $(BUSYBOX)
83
-	install -m 755 -s $(BUSYBOX)/$@ $@
84
-
85
-$(BUSYBOX) : $(BUSYBOX).tar.bz2 uClibc
86
-	[ -d $@ ] || tar xvjf $<
87
-	perl -pi.orig -e \
88
-	  's/^.*(#define BB_(FEATURE_NFSMOUNT|INSMOD|PIVOT_ROOT|IFCONFIG|ROUTE)).*/$$1/' \
89
-	  $(BUSYBOX)/Config.h
90
-	perl -pi.orig -e \
91
-	  's/^(DOSTATIC).*$$/$$1 = true/' \
92
-	  $(BUSYBOX)/Makefile
93
-	$(MAKE) -C $(BUSYBOX)
94
-	install -m 644 $(BUSYBOX)/AUTHORS AUTHORS.busybox
95
-	install -m 644 $(BUSYBOX)/LICENSE LICENSE.busybox
96
-
97
-wlanctl : $(LINUX_WLAN)
98
-	install -m 755 -s $(LINUX_WLAN)/src/wlanctl/$@ $@
99
-
100
-$(LINUX_WLAN) : $(LINUX_WLAN).tar.bz2 uClibc linux-wlan.cfg
101
-	[ -d $@ ] || tar xvjf $<
102
-	cd $(LINUX_WLAN) ; ./Configure -d ../linux-wlan.cfg
103
-	perl -pi.orig -e \
104
-	  's/(-o wlanctl)/-static $$1/' \
105
-	  $(LINUX_WLAN)/src/wlanctl/Makefile
106
-	$(MAKE) -C $(LINUX_WLAN)/src/wlanctl
107
-	install -m 644 $(LINUX_WLAN)/COPYING COPYING.wlanctl
108
-	install -m 644 $(LINUX_WLAN)/LICENSE LICENSE.wlanctl
109
-	install -m 644 $(LINUX_WLAN)/THANKS THANKS.wlanctl
110
-
111
-mknbi-linux : $(MKNBI)
112
-
113
-mknbi : $(MKNBI)
114
-
115
-$(MKNBI) : $(MKNBI).tar.bz2
116
-	[ -d $@ ] || tar xvjf $<
117
-	if [ ! -f $@/.mknbi-encap.patch ]; then \
118
-		patch -d $@ -b -z .orig < mknbi-encap.patch ; \
119
-		touch $@/.mknbi-encap.patch ; \
120
-	fi
121
-	make -C $(MKNBI) LIBDIR=`pwd`/$(MKNBI) mknbi
122
-	install -m 755 $(MKNBI)/mknbi mknbi-linux
123
-	make -C $(MKNBI) clean
124
-	make -C $(MKNBI)
125
-
126
-initrd-skel : $(UTILS) linuxrc udhcpc-post include-modules
127
-	rm -rf $@
128
-	mkdir -p $@
129
-	mkdir -p $@/dev
130
-	mkdir -p $@/etc
131
-	mkdir -p $@/bin
132
-	mkdir -p $@/lib
133
-	mkdir -p $@/lib/modules
134
-	mkdir -p $@/proc
135
-	mkdir -p $@/sysroot
136
-	ln -s bin $@/sbin
137
-	install -m 755 busybox $@/bin/
138
-	install -m 755 udhcpc $@/bin/
139
-	install -m 755 wlanctl $@/bin/
140
-	ln -s busybox $@/bin/sh
141
-	ln -s busybox $@/bin/echo
142
-	ln -s busybox $@/bin/mknod
143
-	ln -s busybox $@/bin/chmod
144
-	ln -s busybox $@/bin/insmod
145
-	ln -s busybox $@/bin/ifconfig
146
-	ln -s busybox $@/bin/route
147
-	ln -s busybox $@/bin/mount
148
-	ln -s busybox $@/bin/pivot_root
149
-	ln -s busybox $@/bin/umount
150
-	ln -s busybox $@/bin/[
151
-	ln -s busybox $@/bin/sleep
152
-	ln -s busybox $@/bin/grep
153
-
154
-	install -m 755 linuxrc $@/linuxrc
155
-	install -m 755 udhcpc-post $@/bin/udhcpc-post
156
-
157
-tftpboot/initrd-%.img : initrd-skel
158
-	./mkinitrd-net -l `echo $* | tr . " "`
159
-
160
-tftpboot/boot-%.nbi : tftpboot/initrd-%.img mknbi-linux
161
-	./mknbi-linux --format=nbi --target=linux /boot/vmlinuz $< > $@
162
-	sudo cp $@ $(tftpbootdir)
163
-
164
-all-nbi : all
165
-	./mknbi-set -l -v
166
-	ls tftpboot
167
-
168
-prefix = /usr
169
-sysconfdir = /etc
170
-bindir = $(prefix)/bin
171
-libdir = $(prefix)/lib
172
-mandir = $(prefix)/share/man
173
-docdir = $(prefix)/share/doc
174
-tftpbootdir = /var/lib/tftpboot
175
-initrdskeldir = $(prefix)/lib/mkinitrd-net/initrd-skel
176
-
177
-install :
178
-	mkdir -p $(libdir)/mknbi
179
-	mkdir -p $(bindir)
180
-	mkdir -p $(sysconfdir)
181
-	mkdir -p $(tftpbootdir)
182
-	mkdir -p $(initrdskeldir)
183
-	install -m 755 mkinitrd-net include-modules mknbi-set $(bindir)/
184
-	cp -a initrd-skel/* $(initrdskeldir)/
185
-	install -m 644 mknbi-set.conf dhcpd.conf.etherboot.include $(sysconfdir)
186
-	make -C $(MKNBI) INSTPREFIX=$(prefix) MANDIR=$(mandir)/man1 \
187
-		DOCDIR=$(docdir)/$(MKNBI) install

+ 0
- 15
contrib/initrd/Manifest 查看文件

@@ -1,15 +0,0 @@
1
-initrd/ChangeLog
2
-initrd/Makefile
3
-initrd/Manifest
4
-initrd/README
5
-initrd/dhcpd.conf.etherboot.include
6
-initrd/include-modules
7
-initrd/linux-wlan.cfg
8
-initrd/linuxrc
9
-initrd/mkinitrd-net
10
-initrd/mkinitrd-net.spec
11
-initrd/mknbi-encap.patch
12
-initrd/mknbi-set
13
-initrd/mknbi-set.conf
14
-initrd/script.c.patch
15
-initrd/udhcpc-post

+ 0
- 37
contrib/initrd/README 查看文件

@@ -1,37 +0,0 @@
1
-README for mkinitrd-net
2
-
3
-mkinitrd-net enables you to use your distribution's stock kernel for
4
-diskless workstations, without having to compile in support for the
5
-relevant network card(s).  It creates an initial ramdisk image containing
6
-the required network-card kernel modules and bootstrap scripts to load the
7
-module, obtain an IP address via DHCP and mount the root filesystem via
8
-NFS.
9
-
10
-mkinitrd-net also generates a dhcpd.conf file fragment that can be used to
11
-automate the process of mapping NBI files to clients, based on the PCI IDs
12
-of their network cards.  Etherboot will send the PCI ID of the network
13
-card to the DHCP server in the etherboot-encapsulated-options field
14
-(Etherboot 5.0.7 and newer) and the DHCP server can use this to identify
15
-the correct NBI to point the client towards.
16
-
17
-The end result is that:
18
-
19
-a) You can avoid the hassle of compiling custom kernels for diskless
20
-   workstations.
21
-
22
-b) Diskless workstations will automatically download the correct
23
-   kernel+initrd.
24
-
25
-c) You have an easier life! :-)
26
-
27
-
28
-
29
-mkinitrd-net is Copyright Fen Systems Ltd. 2001.  mkinitrd-net itself is
30
-licensed under the GNU GPL.  It incorporates code from the uClibc,
31
-busybox, udhcpc and Etherboot projects, each of which has its own licence
32
-terms.  Standard disclaimers apply.
33
-
34
-The copy of mkinitrd-net in the Etherboot contribs is not the
35
-authoritative copy of mkinitrd-net; please do not make modifications to
36
-this copy.  Patches should be sent to Michael Brown
37
-<mbrown@fensystems.co.uk>.

+ 0
- 207
contrib/initrd/dhcpd.conf.etherboot.include 查看文件

@@ -1,207 +0,0 @@
1
-# dhcpd.conf include file for Etherboot
2
-#
3
-# Include this file from your /etc/dhcpd.conf
4
-# $Id$
5
-
6
-# Definition of Etherboot options
7
-# (taken from vendortags.html)
8
-
9
-# We use an encapsulated option space to avoid polluting the site-local DHCP option space
10
-#
11
-option space etherboot;
12
-option etherboot-encapsulated-options code 150 = encapsulate etherboot;
13
-
14
-# Definition of option codes within the etherboot-encapsulated-options space
15
-#
16
-option etherboot.extensions-path code 18 = string;
17
-option etherboot.magic		code 128 = string;
18
-option etherboot.kernel-cmdline	code 129 = string;
19
-option etherboot.menu-opts	code 160 = string;
20
-option etherboot.nic-dev-id	code 175 = string;
21
-option etherboot.menu-selection	code 176 = unsigned integer 8;
22
-option etherboot.motd-1		code 184 = string;
23
-option etherboot.motd-2		code 185 = string;
24
-option etherboot.motd-3		code 186 = string;
25
-option etherboot.motd-4		code 187 = string;
26
-option etherboot.motd-5		code 188 = string;
27
-option etherboot.motd-6		code 189 = string;
28
-option etherboot.motd-7		code 190 = string;
29
-option etherboot.motd-8		code 191 = string;
30
-option etherboot.image-1	code 192 = string;
31
-option etherboot.image-2	code 193 = string;
32
-option etherboot.image-3	code 194 = string;
33
-option etherboot.image-4	code 195 = string;
34
-option etherboot.image-5	code 196 = string;
35
-option etherboot.image-6	code 197 = string;
36
-option etherboot.image-7	code 198 = string;
37
-option etherboot.image-8	code 199 = string;
38
-option etherboot.image-9	code 200 = string;
39
-option etherboot.image-10	code 201 = string;
40
-option etherboot.image-11	code 202 = string;
41
-option etherboot.image-12	code 203 = string;
42
-option etherboot.image-13	code 204 = string;
43
-option etherboot.image-14	code 205 = string;
44
-option etherboot.image-15	code 206 = string;
45
-option etherboot.image-16	code 207 = string;
46
-option etherboot.kmod		code 254 = string;
47
-
48
-# Legacy support for Etherboot options as site-local options (i.e. non-encapsulated)
49
-# Note: options defined after the switch to encapsulated options should not be defined here
50
-#
51
-option legacy-etherboot-magic		code 128 = string;
52
-option legacy-etherboot-kernel-cmdline	code 129 = string;
53
-option legacy-etherboot-menu-opts	code 160 = string;
54
-option legacy-etherboot-menu-selection	code 176 = unsigned integer 8;
55
-option legacy-etherboot-motd-1		code 184 = string;
56
-option legacy-etherboot-motd-2		code 185 = string;
57
-option legacy-etherboot-motd-3		code 186 = string;
58
-option legacy-etherboot-motd-4		code 187 = string;
59
-option legacy-etherboot-motd-5		code 188 = string;
60
-option legacy-etherboot-motd-6		code 189 = string;
61
-option legacy-etherboot-motd-7		code 190 = string;
62
-option legacy-etherboot-motd-8		code 191 = string;
63
-option legacy-etherboot-image-1		code 192 = string;
64
-option legacy-etherboot-image-2		code 193 = string;
65
-option legacy-etherboot-image-3		code 194 = string;
66
-option legacy-etherboot-image-4		code 195 = string;
67
-option legacy-etherboot-image-5		code 196 = string;
68
-option legacy-etherboot-image-6		code 197 = string;
69
-option legacy-etherboot-image-7		code 198 = string;
70
-option legacy-etherboot-image-8		code 199 = string;
71
-option legacy-etherboot-image-9 	code 200 = string;
72
-option legacy-etherboot-image-10	code 201 = string;
73
-option legacy-etherboot-image-11	code 202 = string;
74
-option legacy-etherboot-image-12	code 203 = string;
75
-option legacy-etherboot-image-13	code 204 = string;
76
-option legacy-etherboot-image-14	code 205 = string;
77
-option legacy-etherboot-image-15	code 206 = string;
78
-option legacy-etherboot-image-16	code 207 = string;
79
-
80
-# Apply Etherboot options only for Etherboot clients
81
-#
82
-if substring ( option vendor-class-identifier, 0, 9 ) = "Etherboot" {
83
-
84
-  # We must specify this value for etherboot-magic, or Etherboot will
85
-  # ignore all other options.
86
-  #
87
-  option etherboot.magic E4:45:74:68:00:00;
88
-
89
-  # Bootfile name: derive from etherboot.kmod (calculated below)
90
-  # Use boot.nbi if no NIC_DEV_ID option present
91
-  # (i.e. if etherboot.kmod doesn't get set)
92
-  # Also pass filename back in filename field
93
-  #
94
-  option bootfile-name = pick-first-value ( concat ( "boot-",
95
-						     config-option etherboot.kmod,
96
-						     ".nbi" ),
97
-					    "boot.nbi" ) ;
98
-  filename = config-option bootfile-name;
99
-
100
-  # "Sensible" default values for some options
101
-
102
-  # Mount devfs (will probably be needed for a network-boot)
103
-  option etherboot.kernel-cmdline " devfs=mount";
104
-
105
-  # Info message (includes client IP address, MAC address, hardware ID string,
106
-  # server IP address and name of boot file)
107
-  option etherboot.motd-4 = concat ( "Using Etherboot to boot ",
108
-				     binary-to-ascii ( 10, 8, ".", leased-address ),
109
-				     " [",
110
-				     binary-to-ascii ( 16, 8, ":", suffix ( hardware, 6 ) ),
111
-				     "] [",
112
-				     pick-first-value ( option etherboot.nic-dev-id, "unknown card" ),
113
-				     "]", 0d:0a, "  from ",
114
-				     binary-to-ascii ( 10, 8, ".", option dhcp-server-identifier ),
115
-				     " with file ",
116
-				     config-option tftp-server-name,
117
-				     ":",
118
-				     config-option bootfile-name,
119
-				     " [",
120
-				     pick-first-value ( config-option etherboot.kmod, "unknown module" ),
121
-				     "]", 0d:0a );
122
-
123
-  # Legacy site-local option support
124
-  # If client does not include an etherboot-encapsulated-options field in its DHCPREQUEST, then
125
-  # it will not understand etherboot-encapsulated-options in the DHCPACK and so we must send
126
-  # back the options as site-local options (i.e. not encapsulated).
127
-  # Note: we need do this only for options that existed prior to the switch to encapsulation.
128
-  #
129
-  if not exists etherboot-encapsulated-options {
130
-    option legacy-etherboot-magic	= config-option etherboot.magic;
131
-    option legacy-etherboot-kernel-cmdline = config-option etherboot.kernel-cmdline;
132
-    option legacy-etherboot-menu-opts	= config-option etherboot.menu-opts;
133
-    option legacy-etherboot-menu-selection = config-option etherboot.menu-selection;
134
-    option legacy-etherboot-motd-1	= config-option etherboot.motd-1;
135
-    option legacy-etherboot-motd-2	= config-option etherboot.motd-2;
136
-    option legacy-etherboot-motd-3	= config-option etherboot.motd-3;
137
-    option legacy-etherboot-motd-4	= config-option etherboot.motd-4;
138
-    option legacy-etherboot-motd-5	= config-option etherboot.motd-5;
139
-    option legacy-etherboot-motd-6	= config-option etherboot.motd-6;
140
-    option legacy-etherboot-motd-7	= config-option etherboot.motd-7;
141
-    option legacy-etherboot-motd-8	= config-option etherboot.motd-8;
142
-    option legacy-etherboot-image-1	= config-option etherboot.image-1;
143
-    option legacy-etherboot-image-2	= config-option etherboot.image-2;
144
-    option legacy-etherboot-image-3	= config-option etherboot.image-3;
145
-    option legacy-etherboot-image-4	= config-option etherboot.image-4;
146
-    option legacy-etherboot-image-5	= config-option etherboot.image-5;
147
-    option legacy-etherboot-image-6	= config-option etherboot.image-6;
148
-    option legacy-etherboot-image-7	= config-option etherboot.image-7;
149
-    option legacy-etherboot-image-8	= config-option etherboot.image-8;
150
-    option legacy-etherboot-image-9	= config-option etherboot.image-9;
151
-    option legacy-etherboot-image-10	= config-option etherboot.image-10;
152
-    option legacy-etherboot-image-11	= config-option etherboot.image-11;
153
-    option legacy-etherboot-image-12	= config-option etherboot.image-12;
154
-    option legacy-etherboot-image-13	= config-option etherboot.image-13;
155
-    option legacy-etherboot-image-14	= config-option etherboot.image-14;
156
-    option legacy-etherboot-image-15	= config-option etherboot.image-15;
157
-    option legacy-etherboot-image-16	= config-option etherboot.image-16;
158
-  }
159
-}
160
-
161
-# Some options should be set for both Etherboot and the udhcpc client
162
-#
163
-if ( ( substring ( option vendor-class-identifier, 0, 9 ) = "Etherboot" ) 
164
-     or ( substring ( option vendor-class-identifier, 0, 5 ) = "udhcp" ) ) {
165
-
166
-  # TFTP server defaults to DHCP server and is specified in both
167
-  # next-server field and tftp-server-name option field
168
-  #
169
-  option tftp-server-name = binary-to-ascii ( 10, 8, ".", config-option dhcp-server-identifier );
170
-  server-name = config-option tftp-server-name;
171
-  next-server = config-option dhcp-server-identifier;
172
-
173
-  # Root path defaults to root of TFTP server
174
-  option root-path = concat ( config-option tftp-server-name, ":/" );
175
-
176
-  # A fallback hostname, generated from the IP address
177
-  option host-name = concat ( "client_", binary-to-ascii ( 10, 8, "_", leased-address ) );
178
-}
179
-
180
-# Force some items onto parameter request list for udhcp
181
-#
182
-if substring ( option vendor-class-identifier, 0, 5 ) = "udhcp" {
183
-  # Forcibly add root-path to list
184
-  option dhcp-parameter-request-list = concat ( option dhcp-parameter-request-list, 11 );
185
-}
186
-
187
-# Etherboot sends a string to identify the NIC in etherboot.nic-dev-id.
188
-# For PCI NICs, this string is of the form "PCI:vvvv:dddd" where vvvv is the 
189
-# vendor identifier and dddd the device identifier, in lower-case ASCII hex.
190
-# For ISA NICs, the format of the string is "ISA:..." where ... is not yet
191
-# decided upon.
192
-#
193
-# We use the identifier to select the NBI image that will be specified via
194
-# the "bootfile-name" option.
195
-#
196
-# PCI NICs - use PCI vendor and device IDs
197
-# Listed in file generated by mknbi-set
198
-#
199
-include "/etc/dhcpd.conf.etherboot-pcimap.include";
200
-
201
-# ISA NICs
202
-#
203
-if substring ( option vendor-class-identifier, 0, 9 ) = "Etherboot" {
204
-  if exists etherboot.nic-dev-id {
205
-
206
-  }
207
-}

+ 0
- 63
contrib/initrd/include-modules 查看文件

@@ -1,63 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# Retrieve modules required for an initrd image
4
-# $Id$
5
-
6
-unless ( @ARGV ) {
7
-  die "Syntax: $0 [ -d target_directory ] module_1 module_2 module_3\n"
8
-}
9
-
10
-# Parse command line arguments
11
-my @requested_modules = ();
12
-my $target_dir = "";
13
-my $kernel_ver;
14
-my $quiet;
15
-chomp ( my $current_kernel_ver = `uname -r` );
16
-while ( $_ = shift ) {
17
-  if    ( /-d/ ) { $target_dir = shift }
18
-  elsif ( /-k/ ) { $kernel_ver = shift }
19
-  elsif ( /-q/ ) { $quiet = 1 }
20
-  else           { push @requested_modules, $_ };
21
-}
22
-
23
-# Create target directory if required
24
-if ( $target_dir ) {
25
-  print STDERR "Target directory is $target_dir\n" unless $quiet;
26
-  system ( "mkdir -p $target_dir" );
27
-  chdir $target_dir;
28
-}
29
-
30
-# Use modprobe -nav to retrieve locations of modules and their dependencies
31
-print STDERR "Requested modules ". join (' ', @requested_modules)."\n" unless $quiet;
32
-my @modules_dups;
33
-foreach my $module ( @requested_modules ) {
34
-  my @module_list = map { /^\S+\s+(.*)$/ ; $1 } `/sbin/modprobe -nva $module`;
35
-  die "Cannot find any modules matching $module\n" unless @module_list;
36
-  push @modules_dups, @module_list;
37
-}
38
-
39
-# Remove duplicates from list
40
-my %module_basenames = ();
41
-my @modules = ();
42
-foreach my $module ( @modules_dups ) {
43
-  # Ugly hack : assume that dependencies are independent of kernel version
44
-  # This seems to be necessary because we can't run modprobe and specify
45
-  # an alternate modules.dep file; it refuses to understand lines of the 
46
-  # form "depfile=XXX" as documented in modules.conf(5)
47
-  $module =~ s/$current_kernel_ver/$kernel_ver/ if $kernel_ver;
48
-  push @modules, $module unless $module_basenames{$module};
49
-  ( my $basename ) = ( $module =~ /([^\/]+)\.o/ ); 
50
-  $module_basenames{$module} = $basename;
51
-}
52
-
53
-# Process module list
54
-print "#!/bin/sh\n";
55
-foreach my $module ( @modules ) {
56
-  my $basename = $module_basenames{$module};
57
-  # Report via stdout
58
-  print STDERR "Using module $basename from $module\n" unless $quiet;
59
-  # Copy uncompressed module to current directory
60
-  system ("gunzip -c $module > $basename.o");
61
-  # Print insmod line to stdout
62
-  print "insmod $basename\n";
63
-}

+ 0
- 7
contrib/initrd/linux-wlan.cfg 查看文件

@@ -1,7 +0,0 @@
1
-# Dummy config file for building only wlanctl
2
-# $Id$
3
-
4
-PRISM2_PLX=n
5
-PRISM2_PCMCIA=n
6
-PRISM2_PCI=n
7
-PRISM2_USB=n

+ 0
- 76
contrib/initrd/linuxrc 查看文件

@@ -1,76 +0,0 @@
1
-#!/bin/sh
2
-# $Id$
3
-
4
-PATH=/sbin:/bin
5
-
6
-echo Busybox /linuxrc starting
7
-
8
-echo Mounting /proc filesystem
9
-mount -t proc none /proc
10
-
11
-echo=echo
12
-if grep '\bquiet\b' /proc/cmdline > /dev/null; then
13
-  echo=true
14
-  quiet=1
15
-fi
16
-
17
-$echo Creating root device
18
-mknod /dev/root b 1 0 2>/dev/null
19
-chmod 700 /dev/root
20
-echo 0x100 > /proc/sys/kernel/real-root-dev
21
-
22
-$echo Inserting modules
23
-if [ -z "$quiet" ]; then
24
-  /bin/insert-modules
25
-else
26
-  /bin/insert-modules >/dev/null
27
-fi
28
-
29
-$echo Bringing up loopback interface
30
-ifconfig lo 127.0.0.1 up
31
-route add -net 127.0.0.0 netmask 255.0.0.0 lo
32
-
33
-# Hack required for prism2 cards
34
-# It is not yet possible to use iwconfig to configure these cards,
35
-# so we need wlanctl.
36
-if ifconfig wlan0 down 2> /dev/null; then
37
-  $echo Setting up wireless link
38
-  wlanctl wlan0 lnxreq_ifstate ifstate=enable
39
-  wlanctl wlan0 lnxreq_autojoin ssid= authtype=opensystem
40
-fi
41
-
42
-$echo Obtaining IP address via DHCP
43
-$echo Trying to obtain IP address via wired link [eth0]
44
-if udhcpc -i eth0 -f -n -q -s /bin/udhcpc-post; then
45
-  $echo Successfully obtained IP address via wired link [eth0]
46
-else
47
-  $echo Failed to obtain IP address via wired link [eth0]
48
-  $echo Trying to obtain IP address via wireless link [wlan0]
49
-  udhcpc -i wlan0 -f -n -q -s /bin/udhcpc-post
50
-fi
51
-
52
-if [ -d /sysroot/initrd ]; then
53
-  $echo Unmounting /proc prior to pivot_root
54
-  umount /proc
55
-
56
-  $echo Pivoting root to /sysroot
57
-  pivot_root /sysroot /sysroot/initrd
58
-  cd /
59
-
60
-  $echo Remounting devfs at correct place
61
-  mount -t devfs none /dev
62
-
63
-  $echo Releasing locks on old devfs
64
-  exec 0</dev/null
65
-  exec 1>/dev/console
66
-  exec 2>/dev/console
67
-
68
-  $echo Unmounting old devfs
69
-  umount /initrd/dev
70
-else
71
-  # Failed to mount root: report error and hang
72
-  echo FATAL ERROR: Failed to mount root filesystem
73
-  echo Press Alt-SysRq-B or hit the reset switch to reboot
74
-  while : ; do sleep 6000 ; done
75
-fi
76
-

+ 0
- 165
contrib/initrd/mkinitrd-net 查看文件

@@ -1,165 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# $Id$
4
-# initrd builder for network booting
5
-
6
-# Utility function to determine whether or not a filesystem is usable for
7
-# loopback mounts.  Lifted verbatim from Erik Troan's mkinitrd script.
8
-#
9
-is_good_fs() {
10
-    local parttype= tmpname=
11
-    local dir=$1
12
-    [[ -d $dir ]] || return 1
13
-    [[ -w $dir ]] || return 1
14
-    [[ $dir == */ ]] && dir=${dir%/}
15
-    parttype=$(awk "{if (\$2 == \""$dir"\") print \$3 }" /proc/mounts)
16
- 
17
-    while tmpname=${dir%/*} && [[ -z $parttype ]];do
18
-        [[ -z $tmpname ]] && tmpname=/
19
-        parttype=$(awk "{if (\$2 == \""$tmpname"\") print \$3 }" /proc/mounts)
20
-        dir=$tmpname
21
-    done
22
- 
23
-    case $parttype in
24
-        nfs|tmpfs) return 1;;
25
-        *) return 0;
26
-    esac
27
-}
28
-
29
-# Find a suitable temporary directory (i.e. not tmpfs or nfs)
30
-if is_good_fs $TMPDIR; then
31
-  tmpdir=$TMPDIR
32
-elif is_good_fs /tmp; then
33
-  tmpdir=/tmp
34
-elif is_good_fs /var/tmp; then
35
-  tmpdir=/var/tmp
36
-elif is_good_fs /root/tmp; then
37
-  tmpdir=/root/tmp
38
-else
39
-  echo "Cannot use a tmp directory" >&2
40
-  exit 1
41
-fi
42
-
43
-# Default settings (some can be overridden by command-line options)
44
-include_modules=include-modules
45
-initrd_skel=/usr/lib/mkinitrd-net/initrd-skel
46
-kernel_ver=`uname -r`
47
-use_sudo=y
48
-keep=n
49
-output_dir=/var/lib/tftpboot
50
-make_link=y
51
-quiet=
52
-
53
-# No need to use sudo if we are root
54
-if [ $UID -eq 0 ]; then
55
-  use_sudo=n
56
-fi
57
-
58
-USAGE="Usage: $0 [-k|--kernel <kernel_ver>] [-n|--nolink] [-q|--quiet] [-l|--local] [--nosudo] [--keep] [--help] module_list ..."
59
-
60
-# Parse command-line options
61
-while [ $# -gt 0 ]; do
62
-  case "$1" in
63
-    -l|--local)
64
-		shift
65
-		use_local=y ;;
66
-    -k|--kernel)
67
-		shift
68
-		kernel_ver=$1
69
-		shift ;;
70
-    --nosudo)   shift ; use_sudo=n ;;
71
-    --keep)     shift ; keep=y ;;
72
-    --n|--nolink)
73
-		shift ; make_link=n ;;
74
-    -q|--quiet) shift ; quiet=-q ;;
75
-    --help)	shift ; do_help=y ;;
76
-    --)		shift ; break ;;
77
-    -*)		echo "${0}: ${1}: invalid option" >&2
78
-		echo $USAGE >& 2
79
-		exit 2 ;;
80
-    *)		break ;;
81
-  esac
82
-done
83
-
84
-# Build list of requested modules
85
-modules="$*"
86
-requested_modules="$modules"
87
-modules="$modules nfs" # Always require nfs for nfs mount
88
-modules="$modules af_packet" # Always require af_packet for udhcpc
89
-
90
-# --help => Print help message
91
-if [ "$do_help" == "y" ]; then
92
-  echo $USAGE
93
-  echo "  -k, --kernel   Specify kernel version"
94
-  echo "  -n, --nolink   Do not create a matching symbolic link"
95
-  echo "  -l, --local    Run locally from CVS (for developers only)"
96
-  echo "  --nosudo       Do not use sudo (i.e. must run as root instead)"
97
-  echo "  --keep         Keep temporary files instead of deleting them"
98
-  exit 0;
99
-fi
100
-
101
-# --local => we are running directly from CVS, rather than
102
-# from an installed copy, so use local files and directories
103
-if [ "$use_local" == "y" ]; then
104
-  include_modules=./include-modules
105
-  initrd_skel=initrd-skel
106
-  output_dir=tftpboot
107
-fi
108
-
109
-# If use_sudo is set, check that sudo exists
110
-sudo=/usr/bin/sudo
111
-if [ "$use_sudo" == "y" ]; then
112
-  if [ ! -x $sudo ]; then
113
-    use_sudo=n
114
-    echo "WARNING: --nosudo not specified but $sudo not found"
115
-  fi
116
-fi
117
-if [ "$use_sudo" == "n" ]; then
118
-  sudo=
119
-fi
120
-
121
-# Create temporary working files
122
-initrd=`mktemp -d ${tmpdir}/initrd.XXXXXX`
123
-initrdimg=`mktemp ${tmpdir}/initrd.img.XXXXXX`
124
-initrdmnt=`mktemp -d ${tmpdir}/initrd.mnt.XXXXXX`
125
-
126
-# Copy skeleton into temporary area
127
-cp -a $initrd_skel/* $initrd/
128
-mkdir -p $initrd/lib/modules/$kernel_ver
129
-$include_modules $quiet -k $kernel_ver -d $initrd/lib/modules/$kernel_ver $modules > $initrd/bin/insert-modules || exit 1
130
-chmod 755 $initrd/bin/insert-modules
131
-
132
-# Create empty ext2fs image file
133
-dd if=/dev/zero bs=1k of=$initrdimg count=$((`du -sk $initrd | cut -f1` * 7 / 6)) 2> /dev/null
134
-/sbin/mke2fs -q -F $initrdimg 2> /dev/null
135
-
136
-# Mount image file, copy files on, create /dev entries, display free space, umount
137
-$sudo mount -o loop $initrdimg $initrdmnt
138
-cp -a $initrd/* $initrdmnt/
139
-$sudo mknod $initrdmnt/dev/console c 5 1
140
-$sudo mknod $initrdmnt/dev/null c 1 3
141
-$sudo mknod $initrdmnt/dev/ram b 1 1
142
-$sudo mknod $initrdmnt/dev/systty c 4 0
143
-for i in 1 2 3 4; do $sudo mknod $initrdmnt/dev/tty$i c 4 $i; done
144
-if [ "$quiet" == "n" ]; then
145
-  df -h $initrdmnt
146
-fi
147
-$sudo umount $initrdmnt
148
-
149
-# Create output file
150
-initrd_suffix=`echo $requested_modules | tr " " .`
151
-gzip -9 -n -c $initrdimg > $output_dir/initrd-$initrd_suffix.$kernel_ver.img
152
-
153
-# Create symlink
154
-if [ "$make_link" == "y" ]; then
155
-  link=$output_dir/initrd-$initrd_suffix.img
156
-  [ -L $link ] && rm -f $link
157
-  ln -s initrd-$initrd_suffix.$kernel_ver.img $link
158
-fi
159
-
160
-# Remove temporary files
161
-if [ "$keep" == "n" ]; then
162
-  rm -rf $initrd
163
-  rm -f $initrdimg
164
-  rmdir $initrdmnt
165
-fi

+ 0
- 112
contrib/initrd/mkinitrd-net.spec 查看文件

@@ -1,112 +0,0 @@
1
-%define name mkinitrd-net
2
-%define version 1.10
3
-%define release 1fs
4
-
5
-Summary: Network-booting initrd builder 
6
-Name: %{name}
7
-Version: %{version}
8
-Release: %{release}
9
-Source0: %{name}-%{version}.tar.bz2
10
-Source1: http://belnet.dl.sourceforge.net/sourceforge/etherboot/mknbi-1.2.tar.bz2
11
-Source2: http://www.busybox.net/downloads/busybox-0.60.3.tar.bz2
12
-Source3: http://www.uclibc.org/downloads/uClibc-0.9.11.tar.bz2
13
-Source4: ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/linux-wlan-ng-0.1.13.tar.bz2
14
-Source5: http://udhcp.busybox.net/source/udhcp-0.9.7.tar.bz2
15
-Copyright: GPL/LGPL/MPL
16
-Group: System/Kernel and hardware
17
-BuildRoot: %{_tmppath}/%{name}-buildroot
18
-Prefix: %{_prefix}
19
-Requires: tftp-server
20
-
21
-%description
22
-mkinitrd-net allows you to build initial ramdisk images (initrds) suitable
23
-for use with Etherboot and other network-booting software.  This package
24
-contains two main utilities: mkinitrd-net (to build an initrd containing a
25
-specified set of network-card modules) and mknbi (to generate
26
-Etherboot-usable NBI images from a given kernel and initrd).  It also
27
-contains a helper script mknbi-set which will maintain sets of initrds to
28
-match all your currently-installed kernels.
29
-
30
-mkinitrd-net uses code from the uClibc, busybox, udhcp and Etherboot
31
-projects.
32
-
33
-%prep
34
-%setup -n initrd -a1 -a2 -a3 -a4 -a5
35
-
36
-%build
37
-%make LIBDIR=%{_libdir}/mknbi
38
-
39
-%install
40
-rm -rf $RPM_BUILD_ROOT
41
-%makeinstall tftpbootdir=$RPM_BUILD_ROOT%{_localstatedir}/tftpboot
42
-touch $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf.etherboot-pcimap.include
43
-ln -s %{_localstatedir}/tftpboot $RPM_BUILD_ROOT/tftpboot
44
-
45
-%clean
46
-rm -rf $RPM_BUILD_ROOT
47
-
48
-%post
49
-%{_bindir}/mknbi-set
50
-
51
-%triggerin -- kernel kernel-smp kernel-secure kernel-enterprise
52
-%{_bindir}/mknbi-set
53
-
54
-%files
55
-%defattr(-,root,root)
56
-%config(noreplace) %{_sysconfdir}/mknbi-set.conf
57
-%config(noreplace) %{_sysconfdir}/dhcpd.conf.etherboot.include
58
-%ghost %{_sysconfdir}/dhcpd.conf.etherboot-pcimap.include
59
-%{_bindir}/mknbi-*
60
-%{_bindir}/mkelf-*
61
-%{_bindir}/dis*
62
-%{_bindir}/mkinitrd-net
63
-%{_bindir}/include-modules
64
-%{_libdir}/mknbi
65
-%{_libdir}/mkinitrd-net
66
-%{_mandir}/man*/*
67
-/tftpboot
68
-%{_localstatedir}/tftpboot
69
-%doc README
70
-%doc AUTHORS.busybox LICENSE.busybox
71
-%doc AUTHORS.udhcpc COPYING.udhcpc
72
-%doc COPYING.wlanctl LICENSE.wlanctl THANKS.wlanctl
73
-%doc COPYING.uClibc
74
-%docdir %{_docdir}/mknbi*
75
-%{_docdir}/mknbi*
76
-
77
-%changelog
78
-* Fri Jul 26 2002 Michael Brown <mbrown@fensystems.co.uk> 1.10-1fs
79
-- Support for new binary etherboot.nic-dev-id structure
80
-- Added --kernel option patch from Stew Benedict at MandrakeSoft
81
-- Only try to use sudo if we are not already root
82
-
83
-* Wed Jun 05 2002 Michael Brown <mbrown@fensystems.co.uk> 1.9-1fs
84
-- Modifications to allow DHCP, TFTP and NFS servers to be separate machines.
85
-
86
-* Thu May 30 2002 Michael Brown <mbrown@fensystems.co.uk> 1.8-1fs
87
-- /tftpboot symlinked to /var/lib/tftpboot
88
-- Has ability to be quiet if "quiet" specified on kernel cmdline
89
-
90
-* Sun May 26 2002 Michael Brown <mbrown@fensystems.co.uk> 1.7-1fs
91
-- PCI-ID auto-mapping via dhcpd.conf.etherboot-pcimap.include
92
-
93
-* Fri May 24 2002 Michael Brown <mbrown@fensystems.co.uk> 1.6-1fs
94
-- Bugfixes, migrated /tftpboot to /var/lib/tftpboot
95
-
96
-* Thu May 23 2002 Michael Brown <mbrown@fensystems.co.uk> 1.5-1fs
97
-- Now includes dhcpd.conf.etherboot.include
98
-- Automatically scans for all network modules in the pcimap file
99
-
100
-* Wed May 08 2002 Michael Brown <mbrown@fensystems.co.uk> 1.4-1fs
101
-- Bugfixes: tmpdir selection, linuxrc typos, ifconfig peculiarities
102
-
103
-* Sat May 04 2002 Michael Brown <mbrown@fensystems.co.uk> 1.3-1fs
104
-- During %make, LIBDIR must be set for mknbi
105
-- Added %post scriptlet since %trigger seems not to be being triggered...
106
-
107
-* Sat May 04 2002 Michael Brown <mbrown@fensystems.co.uk> 1.2-1fs
108
-- Added extra sources instead of requiring "make" to download them
109
-
110
-* Sat May 04 2002 Michael Brown <mbrown@fensystems.co.uk> 1.1-1fs
111
-- First attempt at an RPM package
112
-

+ 0
- 200
contrib/initrd/mknbi-set 查看文件

@@ -1,200 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# $Id$
4
-# Maintains set of NBIs based on currently-installed kernels
5
-# Network card module sets are taken from /etc/mknbi-set.conf
6
-
7
-use strict;
8
-use vars qw($verbosity);
9
-
10
-use constant EB_PCI_DEVICE => 1;
11
-
12
-# Utility function: calculate output id given a kernel file name and
13
-# space-separated list of modules
14
-sub calc_output_id ($$) {
15
-  my $kernel = shift;
16
-  my $moduleset = shift;
17
-  my $kernel_ver = "";
18
-  ( $kernel_ver ) = ( $kernel =~ /vmlinuz-(.*)$/ );
19
-  ( my $output_id = "$moduleset".( $kernel_ver ? ".$kernel_ver" : "" ) ) =~ tr/,/./;
20
-  return ( $kernel_ver, $output_id );
21
-}
22
-
23
-# Utility function: read modules.pcimap-style file
24
-# Add modules to modulesets hash, write out dhcpd.conf fragment
25
-sub read_config_file ($$$$) {
26
-  my $configfile = shift;
27
-  my $modulesets = shift;
28
-  my $dhcpfh = shift;
29
-  my $alwaysuse = shift;
30
-
31
-  print "Scanning through $configfile for network modules...\n" if $verbosity >= 1;
32
-  open CF, $configfile or die "Could not open $configfile: $!\n";
33
-  chomp ( my $tempmodule = `mktemp /tmp/mknbi-set.XXXXXX` );
34
-  chomp ( my $cwd = `pwd` ); chdir '/'; # Modprobe searches the current directory...
35
-  print $dhcpfh "    \# Generated from $configfile\n";
36
-  while (<CF>) {
37
-    chomp;
38
-    next if /^[\#;]/ or /^\s*$/;
39
-    ( my $module, undef, my $vendor, my $device ) = /^(\S+)(\s+(\S+)\s+(\S+))?/ ;
40
-    $modulesets->{$module} = 1 if $alwaysuse;
41
-    if ( ! exists $modulesets->{$module} ) {
42
-      # Check to see if module is a network module
43
-      # Only do this the first time we encounter a module
44
-      my @modulepaths = `/sbin/modprobe -l $module.o*` ;
45
-      chomp ( my $modulepath = $modulepaths[0] );
46
-      if ( $modulepath ) {
47
-	if ( $modulepath =~ /.o.gz$/ ) {
48
-	  system ( "zcat $modulepath > $tempmodule" );
49
-	} else {
50
-	  system ( "cp $modulepath $tempmodule" );
51
-	}
52
-	$modulesets->{$module} = 0;
53
-	foreach ( `nm $tempmodule` ) {
54
-	  chomp;
55
-	  $modulesets->{$module} = 1 if /(ether|wlan)/ ;
56
-	}
57
-	unlink $tempmodule;
58
-      } else {
59
-	print STDERR "Cannot locate module $module specified in $configfile\n";
60
-      }
61
-    }
62
-    if ( $modulesets->{$module} ) {
63
-      if ( $vendor ) {
64
-	print "$module ($vendor,$device) listed in $configfile\n" if $verbosity >= 2;
65
-	printf $dhcpfh ( "    if option etherboot.nic-dev-id = %02x:%02x:%02x:%02x:%02x { option etherboot.kmod \"%s\"; }\n",
66
-			 EB_PCI_DEVICE,
67
-			 ( hex($vendor) >> 8 ) & 0xff, hex($vendor) & 0xff,
68
-			 ( hex($device) >> 8 ) & 0xff, hex($device) & 0xff,
69
-			 $module );
70
-      } else {
71
-	print "$module (without PCI IDs) listed in $configfile\n" if $verbosity >= 2;
72
-      }
73
-    }
74
-  }
75
-  close CF;
76
-  print $dhcpfh "\n";
77
-  chdir $cwd;
78
-}
79
-
80
-my $conffile = '/etc/mknbi-set.conf';
81
-my $mkinitrd_net = 'mkinitrd-net';
82
-my $mknbi = 'mknbi-linux';
83
-my $output_dir = '/var/lib/tftpboot';
84
-my $dhcpfile = '/etc/dhcpd.conf.etherboot-pcimap.include';
85
-my $use_local;
86
-our $verbosity = 1;
87
-my $modulesets = {};
88
-my $kernel = '';
89
-my @kernels = ();
90
-
91
-my $usage="Usage: $0 [-l|--local] [-q] [-v] [-r|--refresh module[,module...]] [--help]";
92
-
93
-# Parse command-line options
94
-while ( $_ = shift ) {
95
-  if ( /-l|--local/ ) {
96
-    $conffile = 'mknbi-set.conf';
97
-    $mkinitrd_net = './mkinitrd-net';
98
-    $mknbi = './mknbi-linux --format=nbi --target=linux';
99
-    $output_dir = 'tftpboot';
100
-    $dhcpfile = 'tftpboot/dhcpd.conf.etherboot-pcimap.include';
101
-    $use_local = 1;
102
-  } elsif ( /-r|--refresh/ ) {
103
-    my $moduleset = shift;
104
-    $modulesets->{$moduleset} = 1;
105
-  } elsif ( /-k|--kernel/ ) {
106
-    $kernel = shift;
107
-  } elsif ( /-v|--verbose/ ) {
108
-    $verbosity++;
109
-  } elsif ( /-q|--quiet/ ) {
110
-    $verbosity--;
111
-  } elsif ( /--help/ ) {
112
-    die "$usage\n".
113
-	"  -k, --kernel   Build NBIs for a particular kernel\n".
114
-        "  -l, --local    Run locally from CVS (for developers only)\n".
115
-	"  -r, --refresh  Refresh NBI for a particular module\n".
116
-	"  -v, --verbose  Be more verbose\n".
117
-	"  -q, --quiet    Be less verbose\n";
118
-  } else {
119
-    die "$usage\n";
120
-  }
121
-}
122
-
123
-# Get set of current kernels
124
-if ($kernel) {
125
-  @kernels = ( $kernel );
126
-} else {
127
-  @kernels = glob('/boot/vmlinuz*');
128
-}
129
-die "Could not find any kernels in /boot\n" unless @kernels;
130
-
131
-# If modules have been specified via --refresh, do not scan for modules or rewrite the
132
-# dhcpd.conf fragment file
133
-unless ( %$modulesets ) {
134
-  # Write dhcpd.conf fragment file
135
-  open my $dhcpfh, ">$dhcpfile" or die "Could not open $dhcpfile for writing: $!\n";
136
-  print $dhcpfh "# Etherboot PCI ID -> Linux kernel module mapping file\n";
137
-  print $dhcpfh "# Generated by mknbi-set on ".(scalar localtime)."\n";
138
-  print $dhcpfh "#\n";
139
-  print $dhcpfh "if substring ( option vendor-class-identifier, 0, 9 ) = \"Etherboot\" {\n";
140
-  print $dhcpfh "  if exists etherboot.nic-dev-id {\n";
141
-  print $dhcpfh "    \# Legacy nic-dev-id mechanism: there are some DLink DFE538 cards in circulation that\n";
142
-  print $dhcpfh "    \# predated the change to the new nic-dev-id binary structure\n";
143
-  print $dhcpfh "    if option etherboot.nic-dev-id = \"PCI:1186:1300\" { option etherboot.kmod \"8139too\"; }\n";
144
-  print $dhcpfh "\n";
145
-
146
-  # Get set of network modules to build NBIs for
147
-  # Read explicitly-specified module sets from $conffile
148
-  read_config_file($conffile, $modulesets, $dhcpfh, 1);
149
-  # Obtain list of all network modules from pcimap file
150
-  my $pcimap;
151
-  foreach ( `/sbin/modprobe -c` ) {
152
-    $pcimap = $1 if /^pcimap.*?=(.*)$/;
153
-  }
154
-  if ( $pcimap ) {
155
-    read_config_file($pcimap, $modulesets, $dhcpfh, 0);
156
-  } else {
157
-    print STDERR "Could not identify pcimap file\n";
158
-  }
159
-  # Finish off dhcpd.conf fragment file
160
-  print $dhcpfh "  }\n}\n";
161
-  close $dhcpfh;
162
-}
163
-
164
-# Build initrd and nbi for each kernel-moduleset combination
165
-foreach my $moduleset ( sort keys %$modulesets ) {
166
-  next unless $modulesets->{$moduleset}; # Ignore if value is 0
167
-  print "Building NBIs for module set $moduleset\n" if $verbosity >= 1;
168
-  foreach my $kernel ( @kernels ) {
169
-    ( my $kernel_ver, my $output_id ) = calc_output_id ( $kernel, $moduleset );
170
-    if ( -l $kernel ) {
171
-      # Symbolic link; create matching symlink
172
-      my $real_kernel = readlink ( $kernel );
173
-      ( my $real_kernel_ver, my $real_output_id ) = calc_output_id ( $real_kernel, $moduleset );
174
-      print "Symlinking $output_id to $real_output_id\n" if $verbosity >= 2;
175
-      my $initrd_file = "$output_dir/initrd-$output_id.img";
176
-      unlink ( $initrd_file ) if -l $initrd_file;
177
-      system ( "ln -s initrd-$real_output_id.img $initrd_file" ) == 0 or print STDERR "Could not symlink $initrd_file to initrd-$real_output_id.img: $!\n";
178
-      my $nbi_file = "$output_dir/boot-$output_id.nbi";
179
-      unlink ( $nbi_file ) if -l $nbi_file;
180
-      system ( "ln -s boot-$real_output_id.nbi $nbi_file" ) == 0 or print STDERR "Could not symlink $nbi_file to boot-$real_output_id.nbi: $!\n";
181
-    } else {
182
-      # Real file: create initrd and nbi
183
-      print "Creating initrd and nbi for $output_id\n" if $verbosity >= 2;
184
-      ( my $moduleset_spaces = $moduleset ) =~ tr/,/ /;
185
-      my $initrd_cmd = "$mkinitrd_net --nolink ".
186
-	  ( $use_local ? "--local " : "" ).
187
-	      ( $kernel_ver ? "--kernel $kernel_ver " : "" ).
188
-		  ( $verbosity >= 2 ? "" : "-q " ).
189
-		      $moduleset_spaces;
190
-      print "$initrd_cmd\n" if $verbosity >= 3;
191
-      if ( system ( $initrd_cmd ) == 0 ) {
192
-	my $mknbi_cmd = "$mknbi $kernel $output_dir/initrd-$output_id.img > $output_dir/boot-$output_id.nbi";
193
-	print "$mknbi_cmd\n" if $verbosity >= 3;
194
-	system ( $mknbi_cmd ) == 0 or print STDERR "mknbi failed: $!\n";
195
-      } else {
196
-	print STDERR "$initrd_cmd failed: $!\n";
197
-      }
198
-    }
199
-  }
200
-}

+ 0
- 27
contrib/initrd/mknbi-set.conf 查看文件

@@ -1,27 +0,0 @@
1
-# This file specifies the network cards for which NBI images should be built
2
-# Each line contains a list of kernel modules to be used, separated by commas
3
-# You can optionally specify PCI vendor and device IDs that should be automatically
4
-# mapped to this module.
5
-#
6
-# The format is similar to modutils' modules.pcimap file.
7
-#
8
-# Examples:
9
-#   RTL8139-based ethernet card
10
-; 8139too
11
-#   RTL8139-based ethernet card with PCI IDs vendor=0x1186, device=0x1300
12
-; 8139too	0x1186	0x1300
13
-#   RTL8139 and Prism2_pci in same image
14
-; 8139too,prism2_pci
15
-
16
-# Some modules do not include the MODULE_DEVICE_TABLE macro, and so end up not
17
-# being listed in the pcimap file.  These modules are included here to force
18
-# the creation of corresponding initrds.
19
-prism2_pci	0x1260	0x3873
20
-prism2_plx	0x1638	0x1100
21
-prism2_plx	0x16ab	0x1101
22
-prism2_plx	0x16ab	0x1102
23
-prism2_plx	0x1385	0x4100
24
-prism2_plx	0x15e8	0x0130
25
-prism2_plx	0x16ec	0x3685
26
-prism2_plx	0x16ab	0x1102
27
-prism2_plx	0x15e8	0x0131

+ 0
- 11
contrib/initrd/script.c.patch 查看文件

@@ -1,11 +0,0 @@
1
---- script.c.orig	Tue Apr  2 23:49:33 2002
2
-+++ script.c	Wed Jun  5 14:17:22 2002
3
-@@ -179,7 +179,7 @@
4
- 	}
5
- 	if (packet->siaddr) {
6
- 		envp[j] = malloc(sizeof("siaddr=255.255.255.255"));
7
--		sprintip(envp[j++], "siaddr=", (unsigned char *) &packet->yiaddr);
8
-+		sprintip(envp[j++], "siaddr=", (unsigned char *) &packet->siaddr);
9
- 	}
10
- 	if (!(over & FILE_FIELD) && packet->file[0]) {
11
- 		/* watch out for invalid packets */

+ 0
- 25
contrib/initrd/udhcpc-post 查看文件

@@ -1,25 +0,0 @@
1
-#!/bin/sh
2
-# $Id$
3
-
4
-if [ "$1" = "deconfig" ]; then
5
-  ifconfig $interface 0.0.0.0 up
6
-else if [ "$1" = "bound" ] ; then
7
-    echo UDHCPC: I am $ip [$hostname], booting from $serverid
8
-    [ -n "$hostname" ] && echo $hostname > /proc/sys/kernel/hostname
9
-    [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
10
-    [ -n "$subnet" ] && NETMASK="netmask $subnet" 
11
-    ifconfig $interface $ip $BROADCAST $NETMASK
12
-    route add default gw $router dev $interface
13
-    echo -n > /etc/resolv.conf
14
-    for i in $dns; do
15
-      echo nameserver $i >> /etc/resolv.conf
16
-    done
17
-    [ -n "$siaddr" ] || siaddr=$serverid
18
-    [ -n "$rootpath" ] || rootpath=$siaddr:/
19
-    echo Mounting root filesystem $rootpath at /sysroot
20
-    echo If this appears to hang, check that the server of $rootpath is able to
21
-    echo reverse-map my IP address $ip to obtain my hostname $hostname
22
-    mount -t nfs -o nolock,rsize=8192,wsize=8192 $rootpath /sysroot
23
-  fi
24
-fi
25
-

+ 0
- 92
contrib/linux-2.0-transname.lsm 查看文件

@@ -1,93 +0,0 @@
1
-Xref: news.nsw.CSIRO.AU comp.os.linux.announce:2827
2
-Path: news.nsw.CSIRO.AU!metro!metro!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!newsrelay.netins.net!newsfeed.dacom.co.kr!arclight.uoregon.edu!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!in3.uu.net!liw.clinet.fi!usenet
3
-From: schoebel@informatik.uni-stuttgart.de (Thomas Schoebel-Theuer)
4
-Newsgroups: comp.os.linux.announce
5
-Subject: linux-2.0.21-transname - Patch for easier pool administration
6
-Followup-To: comp.os.linux.misc
7
-Date: 30 Oct 1996 10:53:38 GMT
8
-Organization: Informatik, Uni Stuttgart, Germany
9
-Lines: 76
10
-Approved: linux-announce@news.ornl.gov (Lars Wirzenius)
11
-Message-ID: <pgpmoose.199610301253.4416@liw>
12
-NNTP-Posting-Host: liw
13
-X-Auth: PGPMoose V1.1 PGP comp.os.linux.announce
14
-	iQBVAwUBMnczrjiesvPHtqnBAQEO6gH/WRtFpTPyVtwi0cFVPZ1Xhn8cvfb6i3mk
15
-	LQY2kgpAPquP2TeXYWb5Ta3HxqK15pR1AgaEy5BmPS6+66ixZFvKRQ==
16
-	=hhea
17
-
18
------BEGIN PGP SIGNED MESSAGE-----
19
-
20
-linux-2.0.21-transname.patch enables diskless clients, X-terminals etc to
21
-mount the *root filesystem* of the server. This makes administration of
22
-large pools *a lot* easier.
23
-
24
-Currently different diskless clients must have their root "/" on different
25
-directories on the server, beause each client has _some_ different
26
-configuration files. However, most administration files (typically about 99%)
27
-have the same contents on the clients and on the server, but have to be
28
-(and maintained separately) just because of the 1% differences.
29
-
30
-This duplication causes very large efforts in practice, since at least
31
-the /etc directory has to be duplicated for every client. Even in /etc
32
-many files are identical, for example sendmail.cf, initrc scripts and
33
-others. Maintaining a large pool means to ensure coherence amoung the
34
-duplicates. Classical methods like symlinks are unconvenient
35
-for this task because they have to be valid in the view of mounted
36
-filesystems at the client, not at the server.
37
-
38
-linux-2.0-transname.patch overcomes this problem by allowing filenames
39
-to be context-dependend. For example, if you have a file "/etc/config"
40
-that should differ on the hosts "myserver" and "myclient", you just
41
-create two different files named "/etc/config#host=myserver#" and
42
-"/etc/config#host=myclient#". On host "myserver", the file
43
-"/etc/config#host=myserver#" will appear as if it were hardlinked to
44
-file "/etc/config" (without the #...=...# suffix). On host "myclient",
45
-the corresponding other file will appear as "/etc/config". So you
46
-can access the right file contents under the same name, depending
47
-on which host you are.
48
-
49
-As a result, you may use different contexts for e.g. /etc/fstab, but
50
-have one shared /etc/passwd for all pool machines. So you don't need
51
-yp or NYS any more.
52
-
53
-The kernel patch was developped for and is used at our Linux pool at the
54
-University of Stuttgart with good results. Maintainance of the pool is
55
-at a minimum, and adding new clients is a child's play. No worry with
56
-keeping up mail configurations, newly installed tools, changed /etc/services,
57
-/etc/shells, /etc/resolv.conf and many, many others. In contrast to a
58
-sophisticated symlink solution, adding a new file to the /etc directory
59
-is seen immediately by all clients. I never had less trouble with
60
-administration before.
61
-
62
-I just uploaded the patch to
63
-  ftp://ftp.lmh.ox.ac.uk
64
-         where it should appear in /pub/linux-kernel-patch-archive/
65
-and also to
66
-  ftp://sunsite.unc.edu/pub/Linux/Incoming/
67
-         where it should be moved to /pub/Linux/kernel/patches/misc/ soon.
68
-
69
-More details can be found in the README there, and also in the
70
-configure-help.
71
-
72
-Enjoy,
73
-
74
-- -- Thomas
75
-
76
-
77
------BEGIN PGP SIGNATURE-----
78
-Version: 2.6.3i
79
-Charset: noconv
80
-
81
-iQCVAwUBMnczhYQRll5MupLRAQHzuwP9HGYa4I3bZpt22Y3oQIwEKZGfvnaS5AaD
82
-fVG8wOQ/T7Nrant9JtTktsTVlxGVlYVnziRY4c0ew2qExapK9FqY/ItN0NJXy5aT
83
-a4eSkn86rp6Un7m90RK1xVY5AyVAq49Rdw2StGxr7uj+davnmg3Np+U0MiAILq91
84
-52jKGaR3fvc=
85
-=LSD6
86
------END PGP SIGNATURE-----
87
-
88
-This article has been digitally signed by the moderator, using PGP.
89
-http://www.iki.fi/liw/lars-public-key.asc has PGP key for validating signature.
90
-Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov
91
-PLEASE remember a short description of the software and the LOCATION.
92
-This group is archived at http://www.iki.fi/liw/linux/cola.html

+ 0
- 24
contrib/linux-3c503-patch/3c503.patch 查看文件

@@ -1,24 +0,0 @@
1
-diff -Naur linux.orig/drivers/net/3c503.c linux/drivers/net/3c503.c
2
---- linux.orig/drivers/net/3c503.c	Thu Feb 19 23:14:04 1998
3
-+++ linux/drivers/net/3c503.c	Thu Feb 19 23:16:24 1998
4
-@@ -179,7 +179,8 @@
5
-        for both the old and new 3Com prefix */
6
-     outb(ECNTRL_SAPROM|ECNTRL_THIN, ioaddr + 0x406);
7
-     vendor_id = inb(ioaddr)*0x10000 + inb(ioaddr + 1)*0x100 + inb(ioaddr + 2);
8
--    if ((vendor_id != OLD_3COM_ID) && (vendor_id != NEW_3COM_ID)) {
9
-+    if ((vendor_id != OLD_3COM_ID) && (vendor_id != NEW_3COM_ID) &&
10
-+    	(vendor_id != BULL_3COM_ID)) {
11
- 	/* Restore the register we frobbed. */
12
- 	outb(saved_406, ioaddr + 0x406);
13
- 	return ENODEV;
14
-diff -Naur linux.orig/drivers/net/3c503.h linux/drivers/net/3c503.h
15
---- linux.orig/drivers/net/3c503.h	Thu Feb 19 23:14:05 1998
16
-+++ linux/drivers/net/3c503.h	Mon Feb 16 11:41:56 1998
17
-@@ -11,6 +11,7 @@
18
- 
19
- #define OLD_3COM_ID	0x02608c
20
- #define NEW_3COM_ID	0x0020af
21
-+#define BULL_3COM_ID	0x000062
22
- 
23
- /* Shared memory management parameters. NB: The 8 bit cards have only
24
-    one bank (MB1) which serves both Tx and Rx packet space. The 16bit

+ 0
- 7
contrib/linux-3c503-patch/README 查看文件

@@ -1,7 +0,0 @@
1
-As part of determining whether a 3c503 is present, the Linux driver
2
-examines the first 3 bytes of the ethernet address (the vendor ID)
3
-to see if it corresponds to a known 3Com vendor ID.
4
-
5
-The Bull discless 386 workstation I have (don't laugh) has an
6
-unknown vendor ID 0x000062. This trivial patch adds it to those
7
-known to the driver.

+ 0
- 339
contrib/mini-slamd/COPYING 查看文件

@@ -1,339 +0,0 @@
1
-		    GNU GENERAL PUBLIC LICENSE
2
-		       Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
-                          675 Mass Ave, Cambridge, MA 02139, USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
-			    Preamble
10
-
11
-  The licenses for most software are designed to take away your
12
-freedom to share and change it.  By contrast, the GNU General Public
13
-License is intended to guarantee your freedom to share and change free
14
-software--to make sure the software is free for all its users.  This
15
-General Public License applies to most of the Free Software
16
-Foundation's software and to any other program whose authors commit to
17
-using it.  (Some other Free Software Foundation software is covered by
18
-the GNU Library General Public License instead.)  You can apply it to
19
-your programs, too.
20
-
21
-  When we speak of free software, we are referring to freedom, not
22
-price.  Our General Public Licenses are designed to make sure that you
23
-have the freedom to distribute copies of free software (and charge for
24
-this service if you wish), that you receive source code or can get it
25
-if you want it, that you can change the software or use pieces of it
26
-in new free programs; and that you know you can do these things.
27
-
28
-  To protect your rights, we need to make restrictions that forbid
29
-anyone to deny you these rights or to ask you to surrender the rights.
30
-These restrictions translate to certain responsibilities for you if you
31
-distribute copies of the software, or if you modify it.
32
-
33
-  For example, if you distribute copies of such a program, whether
34
-gratis or for a fee, you must give the recipients all the rights that
35
-you have.  You must make sure that they, too, receive or can get the
36
-source code.  And you must show them these terms so they know their
37
-rights.
38
-
39
-  We protect your rights with two steps: (1) copyright the software, and
40
-(2) offer you this license which gives you legal permission to copy,
41
-distribute and/or modify the software.
42
-
43
-  Also, for each author's protection and ours, we want to make certain
44
-that everyone understands that there is no warranty for this free
45
-software.  If the software is modified by someone else and passed on, we
46
-want its recipients to know that what they have is not the original, so
47
-that any problems introduced by others will not reflect on the original
48
-authors' reputations.
49
-
50
-  Finally, any free program is threatened constantly by software
51
-patents.  We wish to avoid the danger that redistributors of a free
52
-program will individually obtain patent licenses, in effect making the
53
-program proprietary.  To prevent this, we have made it clear that any
54
-patent must be licensed for everyone's free use or not licensed at all.
55
-
56
-  The precise terms and conditions for copying, distribution and
57
-modification follow.
58
-
59
-		    GNU GENERAL PUBLIC LICENSE
60
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
-
62
-  0. This License applies to any program or other work which contains
63
-a notice placed by the copyright holder saying it may be distributed
64
-under the terms of this General Public License.  The "Program", below,
65
-refers to any such program or work, and a "work based on the Program"
66
-means either the Program or any derivative work under copyright law:
67
-that is to say, a work containing the Program or a portion of it,
68
-either verbatim or with modifications and/or translated into another
69
-language.  (Hereinafter, translation is included without limitation in
70
-the term "modification".)  Each licensee is addressed as "you".
71
-
72
-Activities other than copying, distribution and modification are not
73
-covered by this License; they are outside its scope.  The act of
74
-running the Program is not restricted, and the output from the Program
75
-is covered only if its contents constitute a work based on the
76
-Program (independent of having been made by running the Program).
77
-Whether that is true depends on what the Program does.
78
-
79
-  1. You may copy and distribute verbatim copies of the Program's
80
-source code as you receive it, in any medium, provided that you
81
-conspicuously and appropriately publish on each copy an appropriate
82
-copyright notice and disclaimer of warranty; keep intact all the
83
-notices that refer to this License and to the absence of any warranty;
84
-and give any other recipients of the Program a copy of this License
85
-along with the Program.
86
-
87
-You may charge a fee for the physical act of transferring a copy, and
88
-you may at your option offer warranty protection in exchange for a fee.
89
-
90
-  2. You may modify your copy or copies of the Program or any portion
91
-of it, thus forming a work based on the Program, and copy and
92
-distribute such modifications or work under the terms of Section 1
93
-above, provided that you also meet all of these conditions:
94
-
95
-    a) You must cause the modified files to carry prominent notices
96
-    stating that you changed the files and the date of any change.
97
-
98
-    b) You must cause any work that you distribute or publish, that in
99
-    whole or in part contains or is derived from the Program or any
100
-    part thereof, to be licensed as a whole at no charge to all third
101
-    parties under the terms of this License.
102
-
103
-    c) If the modified program normally reads commands interactively
104
-    when run, you must cause it, when started running for such
105
-    interactive use in the most ordinary way, to print or display an
106
-    announcement including an appropriate copyright notice and a
107
-    notice that there is no warranty (or else, saying that you provide
108
-    a warranty) and that users may redistribute the program under
109
-    these conditions, and telling the user how to view a copy of this
110
-    License.  (Exception: if the Program itself is interactive but
111
-    does not normally print such an announcement, your work based on
112
-    the Program is not required to print an announcement.)
113
-
114
-These requirements apply to the modified work as a whole.  If
115
-identifiable sections of that work are not derived from the Program,
116
-and can be reasonably considered independent and separate works in
117
-themselves, then this License, and its terms, do not apply to those
118
-sections when you distribute them as separate works.  But when you
119
-distribute the same sections as part of a whole which is a work based
120
-on the Program, the distribution of the whole must be on the terms of
121
-this License, whose permissions for other licensees extend to the
122
-entire whole, and thus to each and every part regardless of who wrote it.
123
-
124
-Thus, it is not the intent of this section to claim rights or contest
125
-your rights to work written entirely by you; rather, the intent is to
126
-exercise the right to control the distribution of derivative or
127
-collective works based on the Program.
128
-
129
-In addition, mere aggregation of another work not based on the Program
130
-with the Program (or with a work based on the Program) on a volume of
131
-a storage or distribution medium does not bring the other work under
132
-the scope of this License.
133
-
134
-  3. You may copy and distribute the Program (or a work based on it,
135
-under Section 2) in object code or executable form under the terms of
136
-Sections 1 and 2 above provided that you also do one of the following:
137
-
138
-    a) Accompany it with the complete corresponding machine-readable
139
-    source code, which must be distributed under the terms of Sections
140
-    1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
-    b) Accompany it with a written offer, valid for at least three
143
-    years, to give any third party, for a charge no more than your
144
-    cost of physically performing source distribution, a complete
145
-    machine-readable copy of the corresponding source code, to be
146
-    distributed under the terms of Sections 1 and 2 above on a medium
147
-    customarily used for software interchange; or,
148
-
149
-    c) Accompany it with the information you received as to the offer
150
-    to distribute corresponding source code.  (This alternative is
151
-    allowed only for noncommercial distribution and only if you
152
-    received the program in object code or executable form with such
153
-    an offer, in accord with Subsection b above.)
154
-
155
-The source code for a work means the preferred form of the work for
156
-making modifications to it.  For an executable work, complete source
157
-code means all the source code for all modules it contains, plus any
158
-associated interface definition files, plus the scripts used to
159
-control compilation and installation of the executable.  However, as a
160
-special exception, the source code distributed need not include
161
-anything that is normally distributed (in either source or binary
162
-form) with the major components (compiler, kernel, and so on) of the
163
-operating system on which the executable runs, unless that component
164
-itself accompanies the executable.
165
-
166
-If distribution of executable or object code is made by offering
167
-access to copy from a designated place, then offering equivalent
168
-access to copy the source code from the same place counts as
169
-distribution of the source code, even though third parties are not
170
-compelled to copy the source along with the object code.
171
-
172
-  4. You may not copy, modify, sublicense, or distribute the Program
173
-except as expressly provided under this License.  Any attempt
174
-otherwise to copy, modify, sublicense or distribute the Program is
175
-void, and will automatically terminate your rights under this License.
176
-However, parties who have received copies, or rights, from you under
177
-this License will not have their licenses terminated so long as such
178
-parties remain in full compliance.
179
-
180
-  5. You are not required to accept this License, since you have not
181
-signed it.  However, nothing else grants you permission to modify or
182
-distribute the Program or its derivative works.  These actions are
183
-prohibited by law if you do not accept this License.  Therefore, by
184
-modifying or distributing the Program (or any work based on the
185
-Program), you indicate your acceptance of this License to do so, and
186
-all its terms and conditions for copying, distributing or modifying
187
-the Program or works based on it.
188
-
189
-  6. Each time you redistribute the Program (or any work based on the
190
-Program), the recipient automatically receives a license from the
191
-original licensor to copy, distribute or modify the Program subject to
192
-these terms and conditions.  You may not impose any further
193
-restrictions on the recipients' exercise of the rights granted herein.
194
-You are not responsible for enforcing compliance by third parties to
195
-this License.
196
-
197
-  7. If, as a consequence of a court judgment or allegation of patent
198
-infringement or for any other reason (not limited to patent issues),
199
-conditions are imposed on you (whether by court order, agreement or
200
-otherwise) that contradict the conditions of this License, they do not
201
-excuse you from the conditions of this License.  If you cannot
202
-distribute so as to satisfy simultaneously your obligations under this
203
-License and any other pertinent obligations, then as a consequence you
204
-may not distribute the Program at all.  For example, if a patent
205
-license would not permit royalty-free redistribution of the Program by
206
-all those who receive copies directly or indirectly through you, then
207
-the only way you could satisfy both it and this License would be to
208
-refrain entirely from distribution of the Program.
209
-
210
-If any portion of this section is held invalid or unenforceable under
211
-any particular circumstance, the balance of the section is intended to
212
-apply and the section as a whole is intended to apply in other
213
-circumstances.
214
-
215
-It is not the purpose of this section to induce you to infringe any
216
-patents or other property right claims or to contest validity of any
217
-such claims; this section has the sole purpose of protecting the
218
-integrity of the free software distribution system, which is
219
-implemented by public license practices.  Many people have made
220
-generous contributions to the wide range of software distributed
221
-through that system in reliance on consistent application of that
222
-system; it is up to the author/donor to decide if he or she is willing
223
-to distribute software through any other system and a licensee cannot
224
-impose that choice.
225
-
226
-This section is intended to make thoroughly clear what is believed to
227
-be a consequence of the rest of this License.
228
-
229
-  8. If the distribution and/or use of the Program is restricted in
230
-certain countries either by patents or by copyrighted interfaces, the
231
-original copyright holder who places the Program under this License
232
-may add an explicit geographical distribution limitation excluding
233
-those countries, so that distribution is permitted only in or among
234
-countries not thus excluded.  In such case, this License incorporates
235
-the limitation as if written in the body of this License.
236
-
237
-  9. The Free Software Foundation may publish revised and/or new versions
238
-of the General Public License from time to time.  Such new versions will
239
-be similar in spirit to the present version, but may differ in detail to
240
-address new problems or concerns.
241
-
242
-Each version is given a distinguishing version number.  If the Program
243
-specifies a version number of this License which applies to it and "any
244
-later version", you have the option of following the terms and conditions
245
-either of that version or of any later version published by the Free
246
-Software Foundation.  If the Program does not specify a version number of
247
-this License, you may choose any version ever published by the Free Software
248
-Foundation.
249
-
250
-  10. If you wish to incorporate parts of the Program into other free
251
-programs whose distribution conditions are different, write to the author
252
-to ask for permission.  For software which is copyrighted by the Free
253
-Software Foundation, write to the Free Software Foundation; we sometimes
254
-make exceptions for this.  Our decision will be guided by the two goals
255
-of preserving the free status of all derivatives of our free software and
256
-of promoting the sharing and reuse of software generally.
257
-
258
-			    NO WARRANTY
259
-
260
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
262
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
266
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
267
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
-REPAIR OR CORRECTION.
269
-
270
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
-POSSIBILITY OF SUCH DAMAGES.
279
-
280
-		     END OF TERMS AND CONDITIONS
281
-
282
-	Appendix: How to Apply These Terms to Your New Programs
283
-
284
-  If you develop a new program, and you want it to be of the greatest
285
-possible use to the public, the best way to achieve this is to make it
286
-free software which everyone can redistribute and change under these terms.
287
-
288
-  To do so, attach the following notices to the program.  It is safest
289
-to attach them to the start of each source file to most effectively
290
-convey the exclusion of warranty; and each file should have at least
291
-the "copyright" line and a pointer to where the full notice is found.
292
-
293
-    <one line to give the program's name and a brief idea of what it does.>
294
-    Copyright (C) 19yy  <name of author>
295
-
296
-    This program is free software; you can redistribute it and/or modify
297
-    it under the terms of the GNU General Public License as published by
298
-    the Free Software Foundation; either version 2 of the License, or
299
-    (at your option) any later version.
300
-
301
-    This program is distributed in the hope that it will be useful,
302
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
303
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
304
-    GNU General Public License for more details.
305
-
306
-    You should have received a copy of the GNU General Public License
307
-    along with this program; if not, write to the Free Software
308
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
309
-
310
-Also add information on how to contact you by electronic and paper mail.
311
-
312
-If the program is interactive, make it output a short notice like this
313
-when it starts in an interactive mode:
314
-
315
-    Gnomovision version 69, Copyright (C) 19yy name of author
316
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
-    This is free software, and you are welcome to redistribute it
318
-    under certain conditions; type `show c' for details.
319
-
320
-The hypothetical commands `show w' and `show c' should show the appropriate
321
-parts of the General Public License.  Of course, the commands you use may
322
-be called something other than `show w' and `show c'; they could even be
323
-mouse-clicks or menu items--whatever suits your program.
324
-
325
-You should also get your employer (if you work as a programmer) or your
326
-school, if any, to sign a "copyright disclaimer" for the program, if
327
-necessary.  Here is a sample; alter the names:
328
-
329
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
-
332
-  <signature of Ty Coon>, 1 April 1989
333
-  Ty Coon, President of Vice
334
-
335
-This General Public License does not permit incorporating your program into
336
-proprietary programs.  If your program is a subroutine library, you may
337
-consider it more useful to permit linking proprietary applications with the
338
-library.  If this is what you want to do, use the GNU Library General
339
-Public License instead of this License.

+ 0
- 8
contrib/mini-slamd/Makefile 查看文件

@@ -1,8 +0,0 @@
1
-CC=gcc
2
-CFLAGS=-Wall -O2
3
-
4
-mini-slamd: mini-slamd.c
5
-	$(CC) $(CFLAGS) -o $@ $<
6
-
7
-clean:
8
-	rm -f mini-slamd

+ 0
- 521
contrib/mini-slamd/mini-slamd.c 查看文件

@@ -1,521 +0,0 @@
1
-/*
2
- * mini-slamd
3
- * (c) 2002 Eric Biederman
4
- */
5
-
6
-#include <string.h>
7
-#include <errno.h>
8
-#include <stdio.h>
9
-#include <stdint.h>
10
-#include <stdlib.h>
11
-#include <sys/types.h>
12
-#include <sys/poll.h>
13
-#include <sys/socket.h>
14
-#include <sys/stat.h>
15
-#include <netinet/ip.h>
16
-#include <netinet/in.h>
17
-#include <fcntl.h>
18
-#include <unistd.h>
19
-#include <arpa/inet.h>
20
-
21
-/*
22
- * To specify the default interface for multicast packets use:
23
- * route add -net 224.0.0.0 netmask 240.0.0.0 dev eth1
24
- * This server is stupid and does not override the default.
25
- */
26
-
27
-/* Sever states.
28
- *
29
- * Waiting for clients.
30
- * Sending data to clients.
31
- * Pinging clients for data.
32
- *
33
- */
34
-#define SLAM_PORT 10000
35
-#define SLAM_MULTICAST_IP ((239<<24)|(255<<16)|(1<<8)|(1<<0))
36
-#define SLAM_MULTICAST_PORT 10000
37
-#define SLAM_MULTICAST_TTL 1
38
-#define SLAM_MULTICAST_LOOPBACK 1
39
-#define SLAM_MAX_CLIENTS 10
40
-
41
-#define SLAM_PING_TIMEOUT	100 /* ms */
42
-
43
-/*** Packets Formats ***
44
- * Data Packet:
45
- *   transaction
46
- *   total bytes
47
- *   block size
48
- *   packet #
49
- *   data
50
- *
51
- * Status Request Packet
52
- *   transaction
53
- *   total bytes
54
- *   block packets
55
- *
56
- * Status Packet
57
- *   received packets
58
- *   requested packets
59
- *   received packets
60
- *   requested packets
61
- *   ...
62
- *   received packets
63
- *   requested packtes
64
- *   0
65
- */
66
-
67
-#define MAX_HDR (7 + 7 + 7) /* transaction, total size, block size */
68
-#define MIN_HDR (1 + 1 + 1) /* transaction, total size, block size */
69
-
70
-#define MAX_DATA_HDR (MAX_HDR + 7) /* header, packet # */
71
-#define MIN_DATA_HDR (MAX_HDR + 1) /* header, packet # */
72
-
73
-/* ETH_MAX_MTU 1500 - sizeof(iphdr) 20  - sizeof(udphdr) 8 = 1472 */
74
-#define SLAM_MAX_NACK		(1500 - (20 + 8))
75
-/* ETH_MAX_MTU 1500 - sizeof(iphdr) 20  - sizeof(udphdr) 8 - MAX_HDR = 1451 */
76
-#define SLAM_BLOCK_SIZE		(1500 - (20 + 8 + MAX_HDR))
77
-
78
-
79
-/* Define how many debug messages you want 
80
- * 1 - sparse but useful
81
- * 2 - everything
82
- */
83
-#ifndef DEBUG
84
-#define DEBUG 0
85
-#endif
86
-
87
-static int slam_encode(
88
-	unsigned char **ptr, unsigned char *end, unsigned long value)
89
-{
90
-	unsigned char *data = *ptr;
91
-	int bytes;
92
-	bytes = sizeof(value);
93
-	while ((bytes > 0) && ((0xff & (value >> ((bytes -1)<<3))) == 0)) {
94
-		bytes--;
95
-	}
96
-	if (bytes <= 0) {
97
-		bytes = 1;
98
-	}
99
-	if (data + bytes >= end) {
100
-		return -1;
101
-	}
102
-	if ((0xe0 & (value >> ((bytes -1)<<3))) == 0) {
103
-		/* packed together */
104
-		*data = (bytes << 5) | (value >> ((bytes -1)<<3));
105
-	} else {
106
-		bytes++;
107
-		*data = (bytes << 5);
108
-	}
109
-	bytes--;
110
-	data++;
111
-	while(bytes) {
112
-		*(data++) = 0xff & (value >> ((bytes -1)<<3));
113
-		bytes--;
114
-	}
115
-	*ptr = data;
116
-	return 0;
117
-}
118
-
119
-static unsigned long slam_decode(unsigned char **ptr, unsigned char *end, int *err)
120
-{
121
-	unsigned long value;
122
-	unsigned bytes;
123
-	if (*ptr >= end) {
124
-		*err = -1;
125
-	}
126
-	bytes = ((**ptr) >> 5) & 7;
127
-	if ((bytes == 0) || (bytes > sizeof(unsigned long))) {
128
-		*err = -1;
129
-		return 0;
130
-	}
131
-	if ((*ptr) + bytes >= end) {
132
-		*err =  -1;
133
-	}
134
-	value = (**ptr) & 0x1f;
135
-	bytes--;
136
-	(*ptr)++;
137
-	while(bytes) {
138
-		value <<= 8;
139
-		value |= **ptr;
140
-		(*ptr)++;
141
-		bytes--;
142
-	}
143
-	return value;
144
-}
145
-
146
-
147
-static struct sockaddr_in client[SLAM_MAX_CLIENTS];
148
-static int clients;
149
-
150
-
151
-void del_client(struct sockaddr_in *old)
152
-{
153
-	int i;
154
-	for(i = 0; i < clients; i++) {
155
-		if ((client[i].sin_family == old->sin_family) &&
156
-			(client[i].sin_addr.s_addr == old->sin_addr.s_addr) &&
157
-			(client[i].sin_port == old->sin_port)) {
158
-			memmove(&client[i], &client[i+1],
159
-				(clients - (i+1))*sizeof(client[0]));
160
-			clients--;
161
-		}
162
-	}
163
-}
164
-
165
-void add_client(struct sockaddr_in *new)
166
-{
167
-	del_client(new);
168
-	if (clients >= SLAM_MAX_CLIENTS)
169
-		return;
170
-	memcpy(&client[clients], new, sizeof(*new));
171
-	clients++;
172
-}
173
-
174
-void push_client(struct sockaddr_in *new)
175
-{
176
-	del_client(new);
177
-	if (clients >= SLAM_MAX_CLIENTS) {
178
-		clients--;
179
-	}
180
-	memmove(&client[1], &client[0], clients*sizeof(*new));
181
-	memcpy(&client[0], new, sizeof(*new));
182
-	clients++;
183
-}
184
-
185
-
186
-void next_client(struct sockaddr_in *next)
187
-{
188
-	/* Find the next client we want to ping next */
189
-	if (!clients) {
190
-		next->sin_family = AF_UNSPEC;
191
-		return;
192
-	}
193
-	/* Return the first client */
194
-	memcpy(next, &client[0], sizeof(*next));
195
-}
196
-
197
-int main(int argc, char **argv)
198
-{
199
-	char *filename;
200
-	uint8_t nack_packet[SLAM_MAX_NACK];
201
-	int nack_len;
202
-	uint8_t request_packet[MAX_HDR];
203
-	int request_len;
204
-	uint8_t data_packet[MAX_DATA_HDR +  SLAM_BLOCK_SIZE];
205
-	int data_len;
206
-	uint8_t *ptr, *end;
207
-	struct sockaddr_in master_client;
208
-	struct sockaddr_in sa_src;
209
-	struct sockaddr_in sa_mcast;
210
-	uint8_t mcast_ttl;
211
-	uint8_t mcast_loop;
212
-	int sockfd, filefd;
213
-	int result;
214
-	struct pollfd fds[1];
215
-	int state;
216
-#define STATE_PINGING      1
217
-#define STATE_WAITING      2
218
-#define STATE_RECEIVING    3
219
-#define STATE_TRANSMITTING 4
220
-	off_t size;
221
-	struct stat st;
222
-	uint64_t transaction;
223
-	unsigned long packet;
224
-	unsigned long packet_count;
225
-	unsigned slam_port, slam_multicast_port;
226
-	struct in_addr slam_multicast_ip;
227
-
228
-	slam_port = SLAM_PORT;
229
-	slam_multicast_port = SLAM_MULTICAST_PORT;
230
-	slam_multicast_ip.s_addr = htonl(SLAM_MULTICAST_IP);
231
-	
232
-	if (argc != 2) {
233
-		fprintf(stderr, "Bad argument count\n");
234
-		fprintf(stderr, "Usage: mini-slamd filename\n");
235
-		exit(EXIT_FAILURE);
236
-	}
237
-	filename = argv[1];
238
-	filefd = -1;
239
-	size = 0;
240
-	transaction = 0;
241
-
242
-	/* Setup the udp socket */
243
-	sockfd = socket(PF_INET, SOCK_DGRAM, 0);
244
-	if (sockfd < 0) {
245
-		fprintf(stderr, "Cannot create socket\n");
246
-		exit(EXIT_FAILURE);
247
-	}
248
-	memset(&sa_src, 0, sizeof(sa_src));
249
-	sa_src.sin_family = AF_INET;
250
-	sa_src.sin_port = htons(slam_port);
251
-	sa_src.sin_addr.s_addr = INADDR_ANY;
252
-
253
-	result = bind(sockfd, &sa_src, sizeof(sa_src));
254
-	if (result < 0) { 
255
-		fprintf(stderr, "Cannot bind socket to port %d\n", 
256
-			ntohs(sa_src.sin_port));
257
-		exit(EXIT_FAILURE);
258
-	}
259
-
260
-	/* Setup the multicast transmission address */
261
-	memset(&sa_mcast, 0, sizeof(sa_mcast));
262
-	sa_mcast.sin_family = AF_INET;
263
-	sa_mcast.sin_port = htons(slam_multicast_port);
264
-	sa_mcast.sin_addr.s_addr = slam_multicast_ip.s_addr;
265
-	if (!IN_MULTICAST(ntohl(sa_mcast.sin_addr.s_addr))) {
266
-		fprintf(stderr, "Not a multicast ip\n");
267
-		exit(EXIT_FAILURE);
268
-	}
269
-
270
-	/* Set the multicast ttl */
271
-	mcast_ttl = SLAM_MULTICAST_TTL;
272
-	setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL,
273
-		&mcast_ttl, sizeof(mcast_ttl));
274
-
275
-	/* Set the multicast loopback status */
276
-	mcast_loop = SLAM_MULTICAST_LOOPBACK;
277
-	setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &mcast_loop, sizeof(mcast_loop));
278
-
279
-
280
-	state = STATE_WAITING;
281
-	packet = 0;
282
-	packet_count = 0;
283
-	fds[0].fd = sockfd;
284
-	fds[0].events = POLLIN;
285
-	fds[0].revents = 0;
286
-	for(;;) {
287
-		switch(state) {
288
-		case STATE_PINGING:
289
-			state = STATE_WAITING;
290
-			next_client(&master_client);
291
-			if (master_client.sin_family == AF_UNSPEC) {
292
-				break;
293
-			}
294
-#if DEBUG
295
-			printf("Pinging %s:%d\n", 
296
-				inet_ntoa(master_client.sin_addr),
297
-				ntohs(master_client.sin_port));
298
-			fflush(stdout);
299
-#endif
300
-
301
-			/* Prepare the request packet, it is all header */
302
-			ptr = request_packet;
303
-			end = &request_packet[sizeof(request_packet) -1];
304
-			slam_encode(&ptr, end, transaction);
305
-			slam_encode(&ptr, end, size);
306
-			slam_encode(&ptr, end, SLAM_BLOCK_SIZE);
307
-			request_len = ptr - request_packet;
308
-
309
-			result = sendto(sockfd, request_packet, request_len, 0,
310
-				&master_client, sizeof(master_client));
311
-			/* Forget the client I just asked, when the reply
312
-			 * comes in we will remember it again.
313
-			 */
314
-			del_client(&master_client);
315
-			break;
316
-		case STATE_WAITING:
317
-		{
318
-			int timeout;
319
-			int from_len;
320
-			timeout = -1;
321
-			if (master_client.sin_family != AF_UNSPEC) {
322
-				timeout = SLAM_PING_TIMEOUT;
323
-			}
324
-			result = poll(fds, sizeof(fds)/sizeof(fds[0]), timeout);
325
-			if (result == 0) {
326
-				/* On a timeout try the next client */
327
-				state = STATE_PINGING;
328
-				break;
329
-			}
330
-			if (result > 0) {
331
-				from_len = sizeof(master_client);
332
-				result = recvfrom(sockfd, 
333
-					nack_packet, 	sizeof(nack_packet), 0,
334
-					&master_client, &from_len);
335
-				if (result < 0)
336
-					break;
337
-				nack_len = result;
338
-#if DEBUG
339
-				printf("Received Nack from %s:%d\n",
340
-					inet_ntoa(master_client.sin_addr),
341
-					ntohs(master_client.sin_port));
342
-				fflush(stdout);
343
-#endif
344
-#if DEBUG
345
-				{
346
-					ptr = nack_packet;
347
-					end = ptr + result;
348
-					packet = 0;
349
-					result = 0;
350
-					while(ptr < end) {
351
-						packet += slam_decode(&ptr, end, &result);
352
-						if (result < 0) break;
353
-						packet_count = slam_decode(&ptr, end, &result);
354
-						if (result < 0) break;
355
-						printf("%d-%d ",
356
-							packet, packet + packet_count -1);
357
-					}
358
-					printf("\n");
359
-					fflush(stdout);
360
-				}
361
-#endif
362
-				/* Forget this client temporarily.
363
-				 * If the packet appears good they will be
364
-				 * readded.
365
-				 */
366
-				del_client(&master_client);
367
-				ptr = nack_packet;
368
-				end = ptr + nack_len;
369
-				result = 0;
370
-				packet = slam_decode(&ptr, end, &result);
371
-				if (result < 0)
372
-					break;
373
-				packet_count = slam_decode(&ptr, end, &result);
374
-				if (result < 0)
375
-					break;
376
-				/* We appear to have a good packet, keep
377
-				 * this client.
378
-				 */
379
-				push_client(&master_client);
380
-
381
-				/* Reopen the file to transmit */
382
-				if (filefd != -1) {
383
-					close(filefd);
384
-				}
385
-				filefd = open(filename, O_RDONLY);
386
-				if (filefd < 0) {
387
-					fprintf(stderr, "Cannot open %s: %s\n",
388
-						filename, strerror(errno));
389
-					break;
390
-				}
391
-				size = lseek(filefd, 0, SEEK_END);
392
-				if (size < 0) {
393
-					fprintf(stderr, "Seek failed on %s: %s\n",
394
-						filename, strerror(errno));
395
-					break;
396
-				}
397
-				result = fstat(filefd, &st);
398
-				if (result < 0) {
399
-					fprintf(stderr, "Stat failed on %s: %s\n",
400
-						filename, strerror(errno));
401
-					break;
402
-				}
403
-				transaction = st.st_mtime;
404
-				
405
-				state = STATE_TRANSMITTING;
406
-				break;
407
-			}
408
-			break;
409
-		}
410
-		case STATE_RECEIVING:
411
-			/* Now clear the queue of received packets */
412
-		{
413
-			struct sockaddr_in from;
414
-			int from_len;
415
-			uint8_t dummy_packet[SLAM_MAX_NACK];
416
-			state = STATE_TRANSMITTING;
417
-			result = poll(fds, sizeof(fds)/sizeof(fds[0]), 0);
418
-			if (result < 1)
419
-				break;
420
-			from_len = sizeof(from);
421
-			result = recvfrom(sockfd, 
422
-				dummy_packet, sizeof(dummy_packet), 0,
423
-				&from, &from_len);
424
-			if (result <= 0)
425
-				break;
426
-#if DEBUG				
427
-			printf("Received Nack from %s:%d\n",
428
-				inet_ntoa(from.sin_addr),
429
-				ntohs(from.sin_port));
430
-			fflush(stdout);
431
-#endif
432
-			/* Receive packets until I don't get any more */
433
-			state = STATE_RECEIVING;
434
-			/* Process a  packet */
435
-			if (dummy_packet[0] == '\0') {
436
-				/* If the first byte is null it is a disconnect
437
-				 * packet.  
438
-				 */
439
-				del_client(&from);
440
-			}
441
-			else {
442
-				/* Otherwise attempt to add the client. */
443
-				add_client(&from);
444
-			}
445
-			break;
446
-		}
447
-		case STATE_TRANSMITTING:
448
-		{
449
-			off_t off;
450
-			off_t offset;
451
-			ssize_t bytes;
452
-			uint8_t *ptr2, *end2;
453
-
454
-			/* After I transmit a packet check for packets to receive. */
455
-			state = STATE_RECEIVING;
456
-
457
-			/* Find the packet to transmit */
458
-			offset = packet * SLAM_BLOCK_SIZE;
459
-
460
-			/* Seek to the desired packet */
461
-			off = lseek(filefd, offset, SEEK_SET);
462
-			if ((off < 0) || (off != offset)) {
463
-		 		fprintf(stderr, "Seek failed on %s:%s\n",
464
-					filename, strerror(errno));
465
-				break;
466
-			}
467
-			/* Encode the packet header */
468
-			ptr2 = data_packet;
469
-			end2 = data_packet + sizeof(data_packet);
470
-			slam_encode(&ptr2, end2, transaction);
471
-			slam_encode(&ptr2, end2, size);
472
-			slam_encode(&ptr2, end2, SLAM_BLOCK_SIZE);
473
-			slam_encode(&ptr2, end2, packet);
474
-			data_len = ptr2 - data_packet;
475
-			
476
-			/* Read in the data */
477
-			bytes = read(filefd, &data_packet[data_len], 
478
-				SLAM_BLOCK_SIZE);
479
-			if (bytes <= 0) {
480
-				fprintf(stderr, "Read failed on %s:%s\n",
481
-					filename, strerror(errno));
482
-				break;
483
-			}
484
-			data_len += bytes;
485
-			/* Write out the data */
486
-			result = sendto(sockfd, data_packet, data_len, 0,
487
-				&sa_mcast, sizeof(sa_mcast));
488
-			if (result != data_len) {
489
-				fprintf(stderr, "Send failed %s\n",
490
-					strerror(errno));
491
-				break;
492
-			}
493
-#if DEBUG > 1
494
-			printf("Transmitted: %d\n", packet);
495
-			fflush(stdout);
496
-#endif
497
-			/* Compute the next packet */
498
-			packet++;
499
-			packet_count--;
500
-			if (packet_count == 0) {
501
-				packet += slam_decode(&ptr, end, &result);
502
-				if (result >= 0)
503
-					packet_count = slam_decode(&ptr, end, &result);
504
-				if (result < 0) {
505
-					/* When a transmission is done close the file,
506
-					 * so it may be updated.  And then ping then start
507
-					 * pinging clients to get the transmission started
508
-					 * again.
509
-					 */
510
-					state = STATE_PINGING;
511
-					close(filefd);
512
-					filefd = -1;
513
-					break;
514
-				}
515
-			}
516
-			break;
517
-		}
518
-		}
519
-	}
520
-	return EXIT_SUCCESS;
521
-}

+ 0
- 10
contrib/mkQNXnbi/Makefile 查看文件

@@ -1,10 +0,0 @@
1
-# Makefile for the mkQNXnbi filter
2
-
3
-all:		mkQNXnbi
4
-
5
-mkQNXnbi:	mkQNXnbi.o
6
-
7
-mkQNXnbi.o:	mkQNXnbi.c
8
-
9
-clean:
10
-	rm -f mkQNXnbi *.o 

+ 0
- 36
contrib/mkQNXnbi/README 查看文件

@@ -1,36 +0,0 @@
1
-mkQNXnbi is a quick hack to generate tagged images from QNX boot images.
2
-
3
-To boot a QNX client with Etherboot you have to consider the following:
4
-1. You MUST have another QNX box running in the network to provide the
5
-   root filesystem and the license info to the client. QNX cannot use
6
-   e.g. NFS for its root filesystem, as it needs to load a valid license
7
-   from a file on the root fs before being able to start TCP/IP. This
8
-   would lead to a chicken-and-egg problem.
9
-2. The Net task normally determines the size of its internal tables from
10
-   the actual number of licensed nodes. Since this information is not
11
-   available at boot time when booting from the network, you will have
12
-   to set the max. number of nodes as well as a valid netmap entry for
13
-   the node providing the root filesystem as an option to Net in the
14
-   build file.
15
-   See examples/ws.etherboot and fill in the <blanks>.
16
-3. The client does not need a TCP/IP license in order to boot.
17
-4. You can use the boot-server OS of your choice. If you choose to use
18
-   QNX as boot server, the server of course needs a TCP/IP run-time
19
-   license.  In this case you have the option of creating the boot image
20
-   on-the-fly and use the macro $(netmap) instead of a hard-coded MAC
21
-   address.
22
-   See examples/ws.etherboot.on-the-fly and fill in the <blanks>.
23
-   A template bootptab for the QNX bootp server is placed in the
24
-   examples directory.
25
-5. mkQNXnbi expects the QNX image to be supplied on stdin and generates
26
-   the tagged image to stdout. This can be overridden on the command line
27
-   using the options -i <input-file> and -o <output-file>.
28
-
29
-mkQNXnbi can be compiled using e.g. Linux/gcc or on QNX using Watcom C
30
-(or gcc, if you have it - see http://w3c.teaser.fr/~jcmichot/)
31
-
32
-Bug-reports to <al@alarsen.net>
33
-
34
-2002-01-25
35
-Anders Larsen
36
-<al@alarsen.net>

+ 0
- 29
contrib/mkQNXnbi/examples/bootptab 查看文件

@@ -1,29 +0,0 @@
1
-# /etc/bootptab: database for QNX bootp server (/etc/bootpd)
2
-
3
-# First, we define a global entry which specifies the stuff every host uses.
4
-global:\
5
-  :hd=/boot:\
6
-  :ht=ethernet:\
7
-  :sm=<your netmask here>:\
8
-  :bf=|cd /boot; buildqnx -b 0x10000 build/<your build-file here> | mkQNXnbi:\
9
-  :hn:
10
-
11
-# node 2 uses the default build-file
12
-node2:\
13
-  :tc=global:\
14
-  :ha=<your MAC here>:\
15
-  :ip=<your IP address here>:
16
-
17
-# node 3 uses its own build-file
18
-node3:\
19
-  :tc=global:\
20
-  :ha=<your MAC here>:\
21
-  :ip=<your IP address here>:\
22
-  :bf=|cd /boot; buildqnx -b 0x10000 build/<your build-file here> | mkQNXnbi:
23
-
24
-# node 4 uses a pre-built boot image
25
-node3:\
26
-  :tc=global:\
27
-  :ha=<your MAC here>:\
28
-  :ip=<your IP address here>:\
29
-  :bf=images/<your image-file here>:

+ 0
- 22
contrib/mkQNXnbi/examples/ws.etherboot 查看文件

@@ -1,22 +0,0 @@
1
-# /boot/build/ws.etherboot
2
-
3
-sys/boot
4
-$ boot -v
5
-
6
-sys/Proc32
7
-$ Proc32 -l <target node number>
8
-
9
-sys/Slib32
10
-$ Slib32
11
-
12
-sys/Slib16
13
-$ Slib16
14
-
15
-/bin/Net
16
-$ Net -n <highest QNX node number in network> -m "<node number of boot server> 1 <MAC of boot server node here>"
17
-
18
-/bin/Net.<network driver>
19
-$ Net.<network driver>
20
-
21
-/bin/sinit
22
-$ sinit -r //<node number of boot server>/ TERM=<your terminal emulation {QNX|qansi}>

+ 0
- 22
contrib/mkQNXnbi/examples/ws.etherboot.on-the-fly 查看文件

@@ -1,22 +0,0 @@
1
-# /boot/build/ws.etherboot.on-the-fly
2
-
3
-sys/boot
4
-$ boot -v
5
-
6
-sys/Proc32
7
-$ Proc32 -l $(lnode)
8
-
9
-sys/Slib32
10
-$ Slib32
11
-
12
-sys/Slib16
13
-$ Slib16
14
-
15
-/bin/Net
16
-$ Net -n <highest QNX node number in network> -m $(netmap)
17
-
18
-/bin/Net.<network driver>
19
-$ Net.<network driver>
20
-
21
-/bin/sinit
22
-$ sinit -r //$(bnode)/ TERM=<your terminal emulation {QNX|qansi}>

+ 0
- 196
contrib/mkQNXnbi/mkQNXnbi.c 查看文件

@@ -1,196 +0,0 @@
1
-//*****************************************************************************
2
-//
3
-//      Purpose:        Make a boot-image for EtherBoot
4
-//
5
-//
6
-//      Compiler:       This source can be compiled with gcc and Watcom C
7
-//
8
-//
9
-//      Note:           The QNX boot image can be build with any reasonable
10
-//                      start address, e.g. 0x1000 (default) or 0x10000
11
-//                      (widespread Boot-Rom address)
12
-//
13
-//
14
-//      Author:         Anders Larsen
15
-//
16
-//
17
-//      Copyright:      (C) 1999 by
18
-//
19
-//                      Anders Larsen
20
-//                      systems engineer
21
-//                      Gutleuthausstr. 3
22
-//                      D-69469 Weinheim
23
-//                      Germany
24
-//                      phone:  +49-6201-961717
25
-//                      fax:    +49-6201-961718
26
-//                      e-mail: al@alarsen.net
27
-//
28
-//      This program is free software; you can redistribute it and/or modify
29
-//      it under the terms of the GNU General Public License as published by
30
-//      the Free Software Foundation; either version 2 of the License, or
31
-//      (at your option) any later version.
32
-//
33
-//      This program is distributed in the hope that it will be useful,
34
-//      but WITHOUT ANY WARRANTY; without even the implied warranty of
35
-//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36
-//      GNU General Public License for more details.
37
-//
38
-//      You should have received a copy of the GNU General Public License
39
-//      along with this program; if not, write to the Free Software
40
-//      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
41
-//
42
-//-----------------------------------------------------------------------------
43
-//
44
-//      Change Log:
45
-//        V0.2: Sun 1999-12-13 Anders Larsen <al@alarsen.net>
46
-//*****************************************************************************
47
-
48
-#include <stdio.h>
49
-#include <stdlib.h>
50
-#include <string.h>
51
-#include <unistd.h>
52
-#include <sys/types.h>
53
-
54
-
55
-// max. size of QNX OS boot image is 512K
56
-#define MAXSIZE (512*1024)
57
-
58
-typedef unsigned short ushort_t;
59
-typedef unsigned long  ulong_t;
60
-
61
-
62
-// global header of tagged image:
63
-struct initial_t
64
-{
65
-  ulong_t magic;
66
-  ulong_t length;
67
-  ulong_t location;
68
-  ulong_t start;
69
-};
70
-
71
-
72
-// header of each image:
73
-struct header_t
74
-{
75
-  ulong_t flags;
76
-  ulong_t loadaddr;
77
-  ulong_t imgsize;
78
-  ulong_t memsize;
79
-};
80
-
81
-
82
-// global header of the QNX EtherBoot image:
83
-struct qnx_loader_t
84
-{
85
-  struct initial_t setup;
86
-  struct header_t  qnx;
87
-};
88
-
89
-
90
-// global header:
91
-union
92
-{
93
-  struct qnx_loader_t h;
94
-  char                filler[512];
95
-} header;
96
-
97
-
98
-char buffer[MAXSIZE];
99
-
100
-
101
-int usage( char* const* argv )
102
-{
103
-  fprintf( stderr, "%s - make a tagged boot image for EtherBoot\n", *argv );
104
-  fprintf( stderr, "\nuse:\n" );
105
-  fprintf( stderr, "%s [ -<option> ]*\n", *argv );
106
-  fprintf( stderr, "\noptions:\n" );
107
-  fprintf( stderr, "  i <input file>  : QNX boot file     (default: stdin)\n" );
108
-  fprintf( stderr, "  o <output file> : tagged image file (default: stdout)\n" );
109
-  fprintf( stderr, "  v               : be verbose\n" );
110
-  return EXIT_FAILURE;
111
-}
112
-
113
-#ifdef __USAGE
114
-%C - make a tagged boot image for EtherBoot
115
-
116
-use:
117
-%C [ -<option> ]* 
118
-
119
-options:
120
-  i <input file>  : QNX boot file     (default: stdin)
121
-  o <output file> : tagged image file (default: stdout)
122
-  v               : be verbose
123
-#endif
124
-
125
-
126
-int main( int argc, char* const* argv )
127
-{
128
-  int ch, l;
129
-  int verbose = 0;
130
-
131
-  while ( ( ch = getopt( argc, argv, "hi:o:v" ) ) != EOF )
132
-    switch ( ch )
133
-    {
134
-      case 'i':
135
-        if ( !freopen( optarg, "r", stdin ) )
136
-        {
137
-          perror( "can't open input file" );
138
-          return EXIT_FAILURE;
139
-        }
140
-        break;
141
-
142
-      case 'o':
143
-        if ( !freopen( optarg, "w", stdout ) )
144
-        {
145
-          perror( "can't create output file" );
146
-          return EXIT_FAILURE;
147
-        }
148
-        break;
149
-
150
-      case 'v':
151
-        verbose++;
152
-        break;
153
-
154
-      case 'h':
155
-      default:
156
-        return usage( argv );
157
-    }
158
-  if ( optind != argc )
159
-    return usage( argv );
160
-
161
-  memset( &header, 0, sizeof header );
162
-  header.h.setup.magic     = 0x1b031336;    // magic number
163
-  header.h.setup.length    =          4;
164
-  header.h.setup.location  = 0x93e00000;    // just below the EtherBoot rom
165
-  header.h.setup.start     =          0;    // filled in dynamically
166
-  header.h.qnx.flags       = 0x04000004;    // single image only
167
-  header.h.qnx.loadaddr    =          0;    // filled in dynamically
168
-  header.h.qnx.imgsize     =          0;    // filled in dynamically
169
-  header.h.qnx.memsize     =          0;    // filled in dynamically
170
-
171
-  // read the QNX image from stdin:
172
-  for ( ; ( l = fread( buffer + header.h.qnx.imgsize, 1, 1024, stdin ) ) > 0;
173
-        header.h.qnx.imgsize += l
174
-      )
175
-    ;
176
-  header.h.qnx.memsize = header.h.qnx.imgsize;
177
-
178
-  // fill in the real load-address of the QNX boot image:
179
-  header.h.setup.start  = *(ushort_t*)&buffer[10] << 16;
180
-  header.h.qnx.loadaddr = *(ushort_t*)&buffer[10] <<  4;
181
-
182
-  // write the tagged image file to stdout:
183
-  fwrite( &header, 1, 512, stdout );
184
-  fwrite( buffer, 1, header.h.qnx.imgsize, stdout );
185
-
186
-  if ( verbose )
187
-  {
188
-    // print diagnostic information:
189
-    fprintf( stderr, "QNX image size: %d bytes (%dK), load addr: 0x%05X\n",
190
-             header.h.qnx.imgsize,
191
-             header.h.qnx.imgsize / 1024,
192
-             header.h.qnx.loadaddr
193
-           );
194
-  }
195
-  return EXIT_SUCCESS;
196
-}

+ 0
- 76
contrib/mkffwnb/2.0.10/linuxrc 查看文件

@@ -1,76 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# floppyfw initfile
4
-#
5
-# nicked from:
6
-# hal91's initfile (/linuxrc), the bootup script of the system
7
-#
8
-
9
-VERSION=2.1.6
10
-
11
-load_fsmod () {
12
-	case $1 in
13
-	/dev/hd*)
14
-		insmod ide-cd
15
-		insmod cdrom
16
-		;;
17
-	esac
18
-	case $2 in
19
-	vfat)
20
-		echo vfat support is builtin
21
-		;;
22
-	iso9660)
23
-		insmod isofs
24
-		;;
25
-	esac
26
-}
27
-
28
-#
29
-/bin/busybox echo "Booting floppyfw" 
30
-
31
-PATH="/bin:/sbin:/usr/bin:/usr/sbin"
32
-#PATH="/bin"
33
-TERM=linux
34
-ignoreeof=10
35
-no_exit_on_failed_exec=yes
36
-export PATH TERM ignoreeof
37
-umask 022
38
-
39
-/bin/busybox echo "mounting: proc"
40
-/bin/busybox mount -t proc /proc /proc
41
-
42
-/bin/busybox echo "Generating links. (Thanks to busybox.lineo.com)"
43
-/bin/busybox --install -s
44
-
45
-echo "Generated"
46
-
47
-# Modified by Gem, based on coyote distro, changes by Ken Yap
48
-ROOTDEV=`sed -e 's/$/ /' -e 's/.*root=\([^ ]*\) .*/\1/' -e 's/,/ /g' -e 's:/dev/nfs:/dev/fd0:' /proc/cmdline`
49
-set -- $ROOTDEV
50
-# Backward compatibility with a single device argument
51
-if [ $# -eq 1 ]
52
-then
53
-	set -- $1 vfat
54
-fi
55
-while [ "$1" -a "$2" ]
56
-do
57
-	echo "attempting to mount $1 ($2)"
58
-	load_fsmod $1 $2
59
-	if mount -t $2 $1 /mnt/tmp
60
-	then
61
-		echo "mounted $1 on /mnt/tmp"
62
-		break
63
-	fi
64
-	shift; shift
65
-done
66
-
67
-[ -f /mnt/tmp/floppyfw/floppyfw.ini ] && cat /mnt/tmp/floppyfw/floppyfw.ini \
68
-| tr -d '\015' >/floppyfw.ini
69
-
70
-[ -f /floppyfw.ini ] && chmod 777 /floppyfw.ini
71
-[ -f /floppyfw.ini ] && exec /floppyfw.ini
72
-
73
-echo
74
-echo "** floppyfw.ini failed.. starting a shell"
75
-echo
76
-exec sh

+ 0
- 43
contrib/mkffwnb/Extendinitrd.pm 查看文件

@@ -1,43 +0,0 @@
1
-#!/usr/bin/perl -w
2
-
3
-sub status_system ($$) {
4
-	my ($command, $message) = @_;
5
-
6
-	$status = system($command);
7
-	$status <<= 8;
8
-	if ($status < 0) {
9
-		print STDERR "$!\n";
10
-	}
11
-	if ($status != 0) {
12
-		print STDERR "$message\n";
13
-	}
14
-}
15
-
16
-sub extendinitrd ($$) {
17
-	my ($initrd, $nblocks) = @_;
18
-
19
-	if ($nblocks <= 1440) {
20
-		print STDERR "nblocks must be >= 1440\n";
21
-		return (1);
22
-	}
23
-	(undef, $type, undef, $fnlen, undef)  = split(' ', `file $initrd`, 5);
24
-	print "$type $fnlen\n";
25
-	if ($type ne 'Minix' || $fnlen != 30) {
26
-		die "Can only handle Minix initrds with 30 char filenames\n";
27
-		return (1);
28
-	}
29
-	status_system("dd if=/dev/zero of=newinitrd bs=1k count=$nblocks", "Cannot create new initrd\n");
30
-	status_system("mkfs.minix -n 30 newinitrd $nblocks", "Cannot mkfs.minix new initrd\n");
31
-	mkdir("initrd.from") || print STDERR "Cannot make temp mount point initrd.from\n";
32
-	mkdir("initrd.to") || print STDERR "Cannot make temp mount point initrd.to\n";
33
-	status_system("mount -o ro,loop $initrd initrd.from", "Cannot mount $initrd on initrd.from");
34
-	status_system("mount -o loop newinitrd initrd.to", "Cannot mount newinitrd on initrd.to");
35
-	status_system("cp -a initrd.from/* initrd.to/", "Cannot copy initrd to newinitrd");
36
-	status_system("umount initrd.from", "Cannot umount initrd.from");
37
-	status_system("umount initrd.to", "Cannot umount initrd.to");
38
-	rmdir("initrd.from") || print STDERR "Cannot remove temp mount point initrd.from\n";
39
-	rmdir("initrd.to") || print STDERR "Cannot remove temp mount point initrd.to\n";
40
-	return (0);
41
-}
42
-
43
-1;

+ 0
- 69
contrib/mkffwnb/README 查看文件

@@ -1,69 +0,0 @@
1
-This is a quick and dirty script to convert a floppyfw floppy
2
-(http://www.zelow.no/floppyfw/) to a tagged image for booting with
3
-Etherboot (http://etherboot.sourceforge.net/). The advantages of network
4
-booting include: it's much faster loading from the network than from a
5
-floppy disk, you can boot from any size floppy, and you are not limited
6
-to the maximum of 1.44 MB of the physical floppy. If you have enough RAM
7
-and use a virtual floppy to build the initial boot image, you can put as
8
-much on it as will fit the ramdisk.
9
-
10
-See further down under -nonet if you want to boot from HD or CDROM.
11
-
12
-This program requires mtools, tar, bzip2, loopback mount in the kernel,
13
-and root privileges to execute. Hope you have them.
14
-
15
-This script works for any of the releases for which a subdirectory of
16
-that name is provided, but it should not be too hard to make it work for
17
-other releases, all that is done here is to substitute some scripts for
18
-the distributed ones.
19
-
20
-First of all you should make the floppy work the way you want before
21
-converting it to a tagged image. This involves editing the various
22
-config files on the floppy. Instructions on this are distributed from
23
-the floppyfw web page mentioned above.
24
-
25
-Edit the $tftpdir assignment for the directory where you put your tagged
26
-images.  Edit the $libdir assignment and the use lib directive near the
27
-top if you decide to put this package somewhere other than
28
-/usr/local/lib/mkffwnb/. Adjust the instructions below as necessary.
29
-
30
-Copy everything to $libdir.
31
-
32
-	mkdir -p /usr/local/lib/mkffwnb/
33
-	cp -a . /usr/local/lib/mkffwnb/
34
-
35
-Make a link from /usr/local/lib/mkffwnb/mkffwnb.pl to
36
-/usr/local/bin/mkffwnb so that it's in your path.
37
-
38
-	ln -s /usr/local/lib/mkffwnb/mkffwnb.pl /usr/local/bin/mkffwnb
39
-
40
-Then run it as:
41
-
42
-	mkffwnb
43
-
44
-You can also provide a floppy drive as an argument, e.g.
45
-
46
-	mkffwnb x:
47
-
48
-where x: could be mapped to a disk file. This allows you to build an
49
-image without a real floppy drive. Remember that for virtual drives root
50
-must have the mapping for the drive in question in ~root/.mtoolsrc.
51
-
52
-You can use the option --localtime=/etc/localtime to specify that the
53
-file /etc/localtime is to be copied to /etc/localtime on the initrd.
54
-Instead of /etc/localtime, you can use any of the timezone files under
55
-/usr/share/zoneinfo/, it's just that /etc/localtime will usually be the
56
-correct one for your timezone.
57
-
58
-If you use the option -nonet, it leaves the intermediate files in
59
-$tempdir, /tmp/mkffwnb by default. This is useful if you want the
60
-vmlinuz and initrd.gz files for use with LILO or isolinux to boot from
61
-HD or CDROM. Actually you can also use these with a floppy, it loads
62
-faster if you fold all the scripts and modules into the initrd ahead
63
-of time.
64
-
65
-mkffwnb has to be run as root because it uses loopback mounts and also
66
-because the files inside the initrd are owned by root.
67
-
68
-Ken Yap
69
-2003-04-20

+ 0
- 226
contrib/mkffwnb/mkffwnb.pl 查看文件

@@ -1,226 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# Perl script to make a bootable image from a floppyfw floppy
4
-# The basic idea is to unpack and replace or convert all
5
-# the necessary config files into the initrd
6
-# and then make a bootable image out of it
7
-#
8
-# The --format= option overrides the default of nbi or elf hardcoded
9
-# in the source. Valid arguments are nbi or elf.
10
-#
11
-# The --output= options specifies an output file instead of stdout
12
-# The --nonet option specifies that a netbootable image is not to
13
-# be built but the vmlinuz and initrd.gz files left behind in $tempdir
14
-# The --localtime=f option specifies a timezone file that's to be
15
-# copied to /etc/localtime in the initrd, allowing a different timezone.
16
-# The --ffw29 option is intended for 2.9.x and above and extends
17
-# the size of the initrd by making a bigger one and copying the original over.
18
-#
19
-# The first non-option argument is taken to be the letter of a floppy to
20
-# convert, e.g. a:, b: or even x: where x: is mapped to a file using
21
-# mtools mapping in $HOME/.mtoolsrc. See the mtools documentation.
22
-# Thus you can work on a floppy image in a disk file and only write
23
-# to a floppy with dd or cp when you need to test the image.
24
-
25
-use Getopt::Long;
26
-
27
-use lib '/usr/local/lib/mkffwnb/';
28
-use Extendinitrd;
29
-
30
-use strict;
31
-
32
-use vars qw($testing $verbose $localtime $nonet $format $ffw29 $imagefile
33
-	$floppy $libdir $tftpdir $output $tempdir $tempmount);
34
-
35
-sub findversion () {
36
-	my ($version) = grep(/FloppyFW/, `mtype $imagefile ${floppy}floppyfw.msg`);
37
-	return '' unless defined($version) and $version ne '';
38
-	chomp($version);
39
-	$version =~ s/.*FloppyFW (\d+\.\d+\.\d+(\.\d+)?).*/$1/;
40
-	return ($version);
41
-}
42
-
43
-sub getappendargs () {
44
-	my ($append) = join(' ', grep(/^\s*(append\s|console=)/, `mtype $imagefile ${floppy}syslinux.cfg`));
45
-	chomp ($append);
46
-	my @args = split(/\s+/, $append);
47
-	my @result = ();
48
-	foreach $_ (@args) {
49
-		next if (/^$/ or /^append/ or /^initrd=/);
50
-		next if (!$ffw29 and /^root=/);
51
-		push (@result, $_);
52
-	}
53
-	return (join(' ', @result));
54
-}
55
-
56
-# Copy whole floppy to the current directory
57
-# m preserves timestamps, n overwrites without warning and / means recursive
58
-sub mcopy ($) {
59
-	my ($tempdir) = @_;
60
-
61
-	print "mcopy $imagefile -mn/ ${floppy}* $tempdir\n";
62
-	my $status = system("mcopy -mn/ $imagefile ${floppy}* $tempdir");
63
-	return ($status / 256);
64
-}
65
-
66
-# Gunzip file, -f forces overwriting of uncompressed file
67
-sub gunzip ($) {
68
-	my ($file) = @_;
69
-
70
-	print "Gunzipping $file\n" if ($verbose);
71
-	my $status = system('gunzip', '-f', $file);
72
-	return ($status / 256);
73
-}
74
-
75
-# Gzip file, -f forces overwriting of compressed file
76
-sub gzip ($) {
77
-	my ($file) = @_;
78
-
79
-	print "Gzipping $file\n" if ($verbose);
80
-	my $status = system('gzip', '-9', '-f', $file);
81
-	return ($status / 256);
82
-}
83
-
84
-sub loopbackmount ($$) {
85
-	my ($file, $point) = @_;
86
-
87
-	print "Mounting $file on $point loopback\n" if ($verbose);
88
-	my $status = system('mount', '-o', 'loop', $file, $point);
89
-	return ($testing ? 0 : $status / 256);
90
-}
91
-
92
-sub loopbackumount ($) {
93
-	my ($point) = @_;
94
-
95
-	print "Umounting $point\n" if ($verbose);
96
-	my $status = system('umount', $point);
97
-	return ($testing ? 0 : $status / 256);
98
-}
99
-
100
-# Convert DOS CR-NL to Unix NL. $dst has implied prefix of $tempmount
101
-# Use @output for temporary storage in case we write back to the same file
102
-sub dostounix ($$) {
103
-	my ($src, $dst) = @_;
104
-	my @output = ();
105
-
106
-	$dst = "$tempmount/$dst";
107
-	print "Converting $src to $dst\n" if ($verbose);
108
-	unless (open(S, $src)) {
109
-		print "$src: $!\n";
110
-		return (0);
111
-	}
112
-	while (<S>) {
113
-		chomp;
114
-		tr /\015//d;
115
-		push(@output, $_);
116
-	}
117
-	close(S);
118
-	open(D, ">$dst") or return;
119
-	for $_ (@output) {
120
-		print D "$_\n";
121
-	}
122
-	close(D);
123
-	chmod(0755, $dst);
124
-	return (1);
125
-}
126
-
127
-sub bunzip2untar ($$) {
128
-	my ($file, $dir) = @_;
129
-
130
-	print "Unpacking $file into $dir\n" if ($verbose);
131
-	system("bunzip2 < $file | (cd $dir; tar xf -)");
132
-}
133
-
134
-$testing = $< != 0;
135
-$verbose = 1;
136
-$format = '';
137
-$imagefile = '';
138
-GetOptions('output=s' => \$output,
139
-	'nonet!' => \$nonet,
140
-	'localtime=s' => \$localtime,
141
-	'format=s' => \$format,
142
-	'ffw29!' => \$ffw29,
143
-	'ffw30!' => \$ffw29,
144
-	'i=s' => \$imagefile);
145
-if (defined($output) and $output !~ m(^/)) {
146
-	my $d = `pwd`;
147
-	chomp($d);
148
-	$output = "$d/$output";
149
-}
150
-if ($imagefile) {
151
-	$imagefile = "-i $imagefile";
152
-}
153
-$libdir = '/usr/local/lib/mkffwnb';
154
-$tftpdir = '/usr/local/var/tftpboot';
155
-# default can also be 'elf'
156
-$format = 'nbi' if ($format ne 'elf' and $format ne 'nbi');
157
-$floppy = $#ARGV >= 0 ? $ARGV[0] : 'a:';
158
-print <<EOF;
159
-This program requires mtools, tar, bzip2, loopback mount in the kernel,
160
-and root privileges to execute. Hope you have them.
161
-EOF
162
-my $version = &findversion();
163
-$version ne '' or die "Cannot determine version\n";
164
-print "Version $version\n";
165
-my $append = &getappendargs();
166
-$append = "--append='$append'" if $append ne '';
167
-print "$append\n";
168
-$libdir .= '/' . $version;
169
--d $libdir or die "Cannot find files for $version\n";
170
-$tempdir = $nonet ? '/tmp/mkffwnb' : "/tmp/mkffwnb$$";
171
-$tempmount = 'tmpmount';
172
-mkdir($tempdir, 0755);
173
-print "Copying files off floppy, please be patient...\n";
174
-&mcopy($tempdir) == 0 or die "Mcopy failed, diskette problem?\n";
175
-chdir($tempdir);
176
-&gunzip('initrd.gz') == 0 or die "Gunzip of initrd.gz failed\n";
177
-if ($ffw29) {
178
-	extendinitrd("initrd", 5760);
179
-	system("mv newinitrd initrd");
180
-}
181
-mkdir($tempmount, 0755);
182
-&loopbackmount('initrd', $tempmount) == 0 or die "Loopback mount failed\n";
183
-&dostounix("$libdir/linuxrc", "linuxrc") if (-r "$libdir/linuxrc");
184
-unless (&dostounix("$libdir/floppyfw.ini", "floppyfw.ini")) {
185
-	&dostounix("floppyfw/floppyfw.ini", $ffw29 ? "etc/floppyfw.ini" : "floppyfw.ini");
186
-}
187
-&dostounix("config", $ffw29 ? "etc/config.prelogin" : "etc/config");
188
-for my $i (glob('*.bz2 floppyfw/add.bz2 modules/*.bz2 packages/*.bz2')) {
189
-	&bunzip2untar($i, $tempmount);
190
-}
191
-for my $i (glob('packages/*.ini')) {
192
-	my $file = $i;
193
-	$file =~ s:packages/::;
194
-	&dostounix($i, "etc/$file");
195
-}
196
-&dostounix("hosts", "etc/hosts");
197
-&dostounix("modules.lst", "etc/modules.lst");
198
-&dostounix("network.ini", "etc/network.init");
199
-&dostounix("firewall.ini", "etc/firewall.init");
200
-&dostounix("syslog.cfg", "etc/syslog.conf");
201
-&dostounix("packages/timeinfo", "etc/localtime");
202
-system("cp -p licenses/* $tempmount/licenses/");
203
-# This conditional code is for 1.1.2 and below
204
-unless (glob('modules/*.bz2')) {
205
-	print "Copying additional modules\n" if ($verbose);
206
-	system("cp -p modules/* $tempmount/lib/modules/");
207
-}
208
-# If a timezone file has been specified, copy that onto initrd
209
-if (defined($localtime)) {
210
-	if (-r $localtime) {
211
-		print "Copying $localtime to $tempmount/etc/localtime\n";
212
-		system("cp -p $localtime $tempmount/etc/localtime");
213
-	} else {
214
-		print "$localtime: $!\n";
215
-	}
216
-}
217
-&loopbackumount($tempmount) == 0 or die "Loopback umount failed\n";
218
-&gzip('initrd') == 0 or die "Gzip of initrd failed\n";
219
-if ($nonet) {
220
-	print "Floppyfw directory in $tempdir\n";
221
-} else {
222
-	print "Calling mk$format-linux to make the netbootable image\n" if ($verbose);
223
-	$output = "$tftpdir/floppyfw-$version.nb" if (!defined($output));
224
-	system("mk$format-linux $append --output=$output vmlinuz initrd.gz");
225
-	system("rm -fr $tempdir");
226
-}

+ 0
- 4
contrib/mklrpnb/README.txt 查看文件

@@ -1,4 +0,0 @@
1
-This is a quick and dirty Perl program to make a netbootable
2
-image from a Linux Router floppy. It was tested with a Coyote Linux
3
-(http://www.coyotelinux.com) floppy which is based on LRP.  You need tar,
4
-mtools, mknbi-1.0, and of course, perl, to run this script.

+ 0
- 191
contrib/mklrpnb/extractdach.pl 查看文件

@@ -1,191 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# A program to make a netbootable image from a LRP firewall floppy
4
-#
5
-# Tested on a Dachstein Linux floppy image available from
6
-# http://lrp1.steinkuehler.net/ or via http://leaf.sourceforge.net/
7
-
8
-# The most recent version of this script and a companion HowTo is available at
9
-# http://members.optushome.com.au/graybeard/linux/netboot.html
10
-#
11
-# Modified from the mklrpnb file found in the contrib/mklrpnb directory of the
12
-# Etherboot source at http://etherboot.sourceforge.net/
13
-#
14
-# Modifications by Glenn McK <graybeard@users.sourceforge.net> 
15
-# $Id$
16
-##################################### 
17
-
18
-# this entry will need changing
19
-$image = "/home/graybeard/etherboot/dachstein-v1.0.2-1680.bin";
20
-
21
-# these can remain, but change them if desired
22
-#
23
-# the next argument defaults to firewall if no other name is passed via the
24
-# command line, this will be the directory where distribution will be expanded
25
-# under $base and also the directory in /tftpboot for lrp.nb
26
-
27
-my $uniqdir = shift || 'firewall';
28
-
29
-$mntdir   = "/mnt/floppy";          # where the above image file can be mounted
30
-$tftpbase = "/tftpboot";
31
-$tftpboot = "$tftpbase/$uniqdir";   # where the netboot images will be available
32
-$base     = "/usr/src/LRP";
33
-$dachorg = "$base/dach-org-$uniqdir"; # a copy required to make the distribution
34
-$dachnew = "$base/lrp-$uniqdir";      # the base files for the new distribution
35
-$packages = "$dachnew/var/lib/lrpkg"; # list to allow lrcfg to display Packages
36
-
37
-# everything below should be okay
38
-######################################
39
-
40
-if ( !-e $image ) {
41
-    print
42
-"\n\tA valid LRP file and directory are required\n\tdownload one then edit $0\n\n";
43
-    exit 1;
44
-}
45
-if ( !-d $base ) {
46
-    mkdir( $base, 0700 );
47
-}
48
-
49
-if ( !-d $dachorg ) {
50
-    mkdir( $dachorg, 0700 );
51
-}
52
-
53
-if ( !-d $dachnew ) {
54
-    mkdir( $dachnew, 0700 );
55
-    `umount $mntdir`;
56
-    `mount -o ro,loop $image $mntdir`;
57
-
58
-    `cp -vr $mntdir/* $dachorg/`;
59
-
60
-    @cfg = `cat $mntdir/syslinux.cfg`;
61
-
62
-    unless ( defined(@cfg) ) {
63
-        print "Cannot find syslinux.cfg on $mntdir\n";
64
-        exit 1;
65
-    }
66
-    print "cfg = @cfg\n";
67
-    ($append) = grep( /append/, @cfg );    # find the append= line
68
-    print "append = \n$append\n";
69
-    chomp($append);                        # remove trailing newline
70
-    $append =~ s/append=//;                # remove the append= at beginning
71
-    print "strip append = \n$append\n\n";
72
-    @args = split ( / /, $append );        # split into arguments at whitespace
73
-    ($root) = grep( /^initrd=/, @args );   # find the initrd= argument
74
-    $root =~ s/^initrd=//;                 # remove the initrd= at beginning
75
-    $root =~ s/\.lrp$//;                   # cleanup for paclages list
76
-    print "strip initrd = \n$root\n\n";
77
-    ($lrp) = grep( /^LRP=/, @args );       # find the LRP= argument
78
-    $lrp =~ s/^LRP=//;                     # remove the LRP= at beginning
79
-    print "strip LRP =\n$lrp\n\n";
80
-    @lrp = split ( /,/, $lrp );            # split into filenames at ,
81
-    unshift ( @lrp, $root );               # prepend the root LRP filename
82
-    @pack = @lrp;
83
-    print "LRP =\n@lrp\n\n";
84
-    $append = '';
85
-
86
-    foreach $i (@args) {                   # rebuild the append string
87
-        next if ( $i =~ /^initrd=/ );      # minus the unneeded parameters
88
-        next if ( $i =~ /^LRP=/ );
89
-        next if ( $i =~ /^boot=/ );
90
-        next if ( $i =~ /^PKGPATH=/ );
91
-        print "$i = i\n";
92
-        $append .= "$i ";
93
-    }
94
-
95
-    print "final append = \n$append\n";
96
-
97
-    chdir($dachnew) or die "$dachnew: $!\n";
98
-    foreach $i (@lrp) {
99
-        $i .= '.lrp' if $i !~ /\.lrp$/;
100
-        print "\n\n\nUnpacking $i\n";
101
-        system("ln -svf $dachorg/$i ${dachorg}/${i}.tar.gz");
102
-        chmod 0600, "$dachorg/$i";
103
-        system("cat $mntdir/$i | tar zxvf -");
104
-    }
105
-
106
-    # create file for lrcfg to display packages
107
-    open( PACKAGES, ">$packages/packages" )
108
-      || print "unable to modify $packages:$!\n";
109
-    foreach $line (@pack) {
110
-        print PACKAGES "$line\n";
111
-    }
112
-    close PACKAGES;
113
-
114
-    # prevent previous file from being overwritten during installation
115
-    # and also mess with some values in /linuxrc to hide non errors
116
-    open( LINUXRC, "$packages/root.linuxrc" );
117
-    @text = <LINUXRC>;
118
-    close LINUXRC;
119
-    open( LINUXRC, ">$packages/root.linuxrc" );
120
-    foreach $line (@text) {
121
-        $line =~ s/PFX\/packages/PFX\/packages-old \
122
-\t\t\t\t# packages changed to packages-old for netboot setup/;
123
-        $line =~
124
-s/^rc=1/# rc=1 changed to rc=0 to suppress error messages for netboot setup \
125
-rc=0/;
126
-        $line =~
127
-s/echo -n \" \(nf\!\)\"/#echo -n \" \(nf\!\)\" changed to reflect ToDo list \
128
-\t\t\techo -n \" netboot setup - No backups possible from this machine - ToFix ?"/;
129
-        print LINUXRC $line;
130
-    }
131
-    close LINUXRC;
132
-
133
-    # swap interfaces around in network config file
134
-    # eth1 is the new external eth0 is OUR internal server access
135
-    open( NETWORK, "$dachnew/etc/network.conf" )
136
-      || print "Unable to modify NETWORK:$!\n";
137
-    @text = <NETWORK>;
138
-    close NETWORK;
139
-    open( NETWORK, ">$dachnew/etc/network.conf" )
140
-      || print "Unable to modify NETWORK:$!\n";
141
-    foreach $line (@text) {
142
-        $line =~ s/eth0/eth00/;
143
-        $line =~ s/eth1/eth0/;
144
-        $line =~ s/eth00/eth1/;
145
-        print NETWORK $line;
146
-    }
147
-    close NETWORK;
148
-
149
-    `echo $append > $dachorg/appendstr`;
150
-
151
-    `umount /mnt/floppy`;
152
-    print "\nThe files have been extracted to $dachnew\n";
153
-    system("ls -al $dachnew");
154
-}
155
-else {
156
-    print "\n\n\t$image \n \thas already been extracted to $dachnew \
157
-\tNow skipping to the next step where the netboot file\
158
-\twill be created.\n";
159
-
160
-    $append = `cat $dachorg/appendstr`;
161
-    print "\nThe new append string will be...\n$append\n";
162
-
163
-    chdir($dachnew);
164
-    if ( !-d $tftpbase ) {
165
-        mkdir( $tftpbase, 0710 );
166
-        system("chgrp nobody $tftpbase");
167
-    }
168
-
169
-    unlink($tftpboot);
170
-
171
-    # these permissions really need changing to something secure
172
-    mkdir( $tftpboot, 0710 );
173
-    system("chgrp nobody $tftpboot");
174
-    print "\tRepacking to $tftpboot/lrp.lrp\n";
175
-    system("tar zcf $tftpboot/lrp.lrp *");
176
-    print "\tExtracting kernel image from $dachorg\n";
177
-    system("cat $dachorg/linux > $tftpboot/lrp.ker");
178
-    print "\tCreating netboot image $tftpboot/lrp.nb\n";
179
-    system(
180
-"mknbi-linux --append='$append' --output=$tftpboot/lrp.nb $tftpboot/lrp.ker $tftpboot/lrp.lrp"
181
-    );
182
-    chmod 0604, "$tftpboot/lrp.nb", "$tftpboot/lrp.ker", "$tftpboot/lrp.lrp";
183
-    print "\nThese netboot files are in $tftpboot\n";
184
-    system("ls -al $tftpboot");
185
-    print "\n   The owner and permissions for $tftpboot \
186
- and files should be checked for security. The above\
187
-permissions assume that tftp is running chroot (nobody)
188
-      drwx--r---   root:nobody   /tftpboot\n\n";
189
-}
190
-
191
-exit 0;

+ 0
- 45
contrib/mklrpnb/mklrpnb 查看文件

@@ -1,45 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# A program to make a netbootable image from a LRP firewall floppy
4
-# Tested on a Coyote Linux floppy
5
-#
6
-@cfg = `mtype a:syslinux.cfg`;
7
-unless (defined(@cfg)) {
8
-	print "Cannot find syslinux.cfg on floppy\n";
9
-	exit 1;
10
-}
11
-($append) = grep(/^append/, @cfg);	# find the append= line
12
-chomp($append);				# remove trailing newline
13
-$append =~ s/append=//;			# remove the append= at beginning
14
-@args = split(/ /, $append);		# split into arguments at whitespace
15
-($root) = grep(/^initrd=/, @args);	# find the initrd= argument
16
-$root =~ s/^initrd=//;			# remove the initrd= at beginning
17
-($lrp) = grep(/^LRP=/, @args);		# find the LRP= argument
18
-$lrp =~ s/^LRP=//;			# remove the LRP= at beginning
19
-@lrp = split(/,/, $lrp);		# split into filenames at ,
20
-unshift(@lrp, $root);			# prepend the root LRP filename
21
-$append = '';
22
-foreach $i (@args) {			# rebuild the append string
23
-	next if ($i =~ /^initrd=/);	# minus the unneeded parameters
24
-	next if ($i =~ /^LRP=/);
25
-	next if ($i =~ /^boot=/);
26
-	$append .= "$i ";
27
-}
28
-# print "$append\n";
29
-$tempdir = "/tmp/lrp$$";
30
-mkdir($tempdir, 0777) or die "$tempdir: $!\n";
31
-chdir($tempdir) or die "$tempdir: $!\n";
32
-foreach $i (@lrp) {
33
-	$i .= '.lrp' if $i !~ /\.lrp$/;
34
-	print "Unpacking $i\n";
35
-	system("mtype a:$i | tar zxvf -");
36
-}
37
-print "Repacking to /tmp/lrp.lrp\n";
38
-system("tar zcf /tmp/lrp.lrp *");
39
-chdir('/tmp') or die "/tmp: $!\n";
40
-system("rm -fr $tempdir");
41
-print "Extracting kernel image from floppy\n";
42
-system("mtype a:linux > /tmp/lrp.ker");
43
-print "Creating netboot image in /tmp/lrp.nb\n";
44
-system("mkelf-linux --append='$append' --output=/tmp/lrp.nb /tmp/lrp.ker /tmp/lrp.lrp");
45
-exit 0;

+ 0
- 97
contrib/mntnbi/mntnbi.pl 查看文件

@@ -1,97 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# Quick Perl program to decode and display details about 
4
-# tagged images created by mknbi, and then mount the contained
5
-# DOS filesystem using a loop-back mount
6
-#
7
-# Martin Atkins, November 1998
8
-# by hacking disnbi by
9
-# Ken Yap, September 1998
10
-#
11
-#
12
-
13
-sub getvendordata {
14
-	my ($flags) = @_;
15
-
16
-	my $vendordata = '';
17
-	my $vendorlen = ($flags & 0xff) >> 4;
18
-	if ($vendorlen > 0) {
19
-		$vendorlen *= 4;
20
-		$vendordata = unpack("A$vendorlen", substr($imageheader, $curoffset));
21
-		$curoffset += $vendorlen;
22
-	}
23
-	return ($vendordata);
24
-}
25
-
26
-sub decodesegmentflags {
27
-	my ($flags) = @_;
28
-
29
-	$flags >>= 24;
30
-	$flags &= 0x3;
31
-	($flags == 0) and $type = "Absolute";
32
-	($flags == 1) and $type = "Follows last segment";
33
-	($flags == 2) and $type = "Below end of memory";
34
-	($flags == 3) and $type = "Below last segment loaded";
35
-	return ($type);
36
-}
37
-
38
-sub onesegment
39
-{
40
-	my ($segnum) = @_;
41
-	my ($type, $vendordata);
42
-
43
-	my ($flags, $loadaddr, $imagelen, $memlength) = unpack("V4", substr($imageheader, $curoffset));
44
-	$curoffset += 16;
45
-	print "Segment number $segnum\n";
46
-	printf "Load address:\t\t%08x\n", $loadaddr;
47
-	printf "Image length:\t\t%d\n", $imagelen;
48
-	printf "Memory length:\t\t%d\n", $memlength;
49
-	$type = &decodesegmentflags($flags);
50
-	printf "Position:\t\t$type\n";
51
-	printf "Vendor tag:\t\t%d\n", ($flags >> 8) & 0xff;
52
-	if (($vendordata = &getvendordata($flags)) ne '') {
53
-		print "Vendor data:\t\t", $vendordata, "\n";
54
-	}
55
-	print "\n";
56
-	push (@seglengths, $imagelen);
57
-	return (($flags >> 26) & 1);
58
-}
59
-
60
-@seglengths = ();
61
-$#ARGV == 1 or die "Usage: mntnbi tagged-image-file dir\n";
62
-$imagefile= $ARGV[0];
63
-open(I, $ARGV[0]) or die "$imagefile: $!\n";
64
-(defined($status = sysread(I, $imageheader, 512)) and $status == 512)
65
-	or die "$imagefile: Cannot read header\n";
66
-$headerrecord = substr($imageheader, 0, 16);
67
-($magic, $flags, $bx, $ds, $ip, $cs) = unpack("a4Vv4", $headerrecord);
68
-$magic eq "\x36\x13\x03\x1B" or die "$imagefile: Not a tagged image file\n";
69
-$curoffset = 16;
70
-
71
-# Now decode the header
72
-
73
-printf "Header location:\t%04x:%04x\n", $ds, $bx;
74
-printf "Start address:\t\t%04x:%04x\n", $cs, $ip;
75
-printf "Flags:\n";
76
-	print "Return to loader after execution (extension)\n" if (($flags >> 8) &  1);
77
-if (($vendordata = &getvendordata($flags)) ne '') {
78
-	print "Vendor data:\t\t", $vendordata, "\n";
79
-}
80
-print "\n";
81
-
82
-# Now decode each segment record
83
-
84
-$segnum = 1;
85
-do {
86
-	$lastrecord = &onesegment($segnum);
87
-	++$segnum;
88
-} while (!$lastrecord);
89
-
90
-if ($#seglengths != 1) {
91
-	die "This is not a DOS image $#seglengths\n";
92
-}
93
-$offset = 512 + $seglengths[0];
94
-print "mounting filesystem at offset $offset in $ARGV[0] on $ARGV[1]\n";
95
-$rc = system "mount $ARGV[0] $ARGV[1] -t msdos -o loop,offset=$offset";
96
-print "Done\n" if ($rc == 0);
97
-exit(0);

+ 0
- 2
contrib/nfs-swap/README 查看文件

@@ -1,2 +0,0 @@
1
-For more information please check
2
-http://nfs-swap.dot-heine.de

+ 0
- 10
contrib/p910nd-0.8/Makefile 查看文件

@@ -1,10 +0,0 @@
1
-# Comment out the second command and uncomment the first command
2
-# below if you don't want to use libwrap (hosts.{allow,deny} access control)
3
-
4
-# If you don't have it in /var/log/subsys, uncomment and define
5
-#CFLAGS+=-DLOCKFILE_DIR=\"/var/log\"
6
-LIBWRAP=-lwrap
7
-
8
-p910nd:	p910nd.c
9
-#	$(CC) -Wall $(CFLAGS) -o $@ p910nd.c
10
-	$(CC) -Wall $(CFLAGS) -DUSE_LIBWRAP -o $@ p910nd.c $(LIBWRAP)

+ 0
- 9
contrib/p910nd-0.8/banner.pl 查看文件

@@ -1,9 +0,0 @@
1
-#!/usr/bin/perl
2
-while (1)
3
-{
4
-	exit 0 if read(STDIN,$c,1) == 0;
5
-	last if ($cl eq "\031" && $c eq "\001");
6
-	$cl = $c;
7
-}
8
-kill 'STOP',$$;
9
-exit 0

+ 0
- 58
contrib/p910nd-0.8/client.pl 查看文件

@@ -1,58 +0,0 @@
1
-#!/usr/bin/perl
2
-
3
-# edit this to the printer hostname
4
-$them = 'ken';
5
-$port = 9101;
6
-
7
-open(STDIN, "$ARGV[0]") if $#ARGV >= 0;
8
-
9
-use Socket;
10
-#use Sys::Hostname;
11
-
12
-#$hostname = hostname;
13
-
14
-($name, $aliases, $proto) = getprotobyname('tcp');
15
-($name, $aliases, $port) = getservbyname($port, 'tcp')
16
-	unless $port =~ /^\d+$/;
17
-
18
-#$thisaddr = inet_aton($hostname);
19
-#defined($thisaddr) or &errexit("inet_aton: cannot resolve $hostname\n");
20
-
21
-$thataddr = inet_aton($them);
22
-defined($thataddr) or &errexit("inet_aton: cannot resolve $them\n");
23
-
24
-socket(S, PF_INET, SOCK_STREAM, $proto) or &errexit("socket: $!\n");
25
-
26
-#$this = sockaddr_in(0, $thisaddr);
27
-#bind(S, $this) || &errexit("bind: $!\n");
28
-
29
-$that = sockaddr_in($port, $thataddr);
30
-connect(S, $that) || &errexit("connect: $!\n");
31
-
32
-select(S); $| = 1; select(STDOUT);
33
-
34
-$buffer = '';
35
-while (1)
36
-{
37
-	$rin = '';
38
-	vec($rin, fileno(S), 1) = 1;
39
-	$nfound = select($rout=$rin, $wout=$rin, undef, undef);
40
-	if (vec($rout, fileno(S), 1)) {
41
-		print STDERR "$buffer\n" if
42
-			defined($nread = sysread(S, $buffer, 8192));
43
-	}
44
-	if (vec($wout, fileno(S), 1)) {
45
-		$nread = read(STDIN, $buffer, 8192);
46
-		last if $nread == 0;
47
-		&errexit("write: $!\n") unless
48
-			defined($written = syswrite(S,$buffer,$nread));
49
-	}
50
-}
51
-close(S);
52
-exit 0;
53
-
54
-sub errexit
55
-{
56
-	print STDERR @_;
57
-	exit 2;
58
-}

+ 0
- 93
contrib/p910nd-0.8/p910nd.8 查看文件

@@ -1,93 +0,0 @@
1
-.TH P910ND 8 "1 August 2004"
2
-.SH NAME
3
-p910nd \- port 9100+n printer daemon
4
-.SH SYNOPSIS
5
-.B p910nd
6
-[\fB-f device\fR]
7
-[\fB-i bindaddr\fR]
8
-[\fB-bv\fR]
9
-[\fB0|1|2\fR]
10
-.SH DESCRIPTION
11
-.I p910nd
12
-is a small daemon that copies any data received on the port
13
-it is listening on to the corresponding printer port.
14
-It is primarily intended for diskless Linux hosts running as printer drivers
15
-but there is no reason why it could not be used on diskful hosts.
16
-Port 9100 is copied to /dev/lp0, 9101 to /dev/lp1 and 9102 to /dev/lp2.
17
-The default is port 9100 to /dev/lp0.
18
-.LP
19
-The \fB-f\fR option can be used to specify a different printer device,
20
-e.g. /dev/usblp0.
21
-.LP
22
-The \fB-i\fR option can be used to specify binding to one address instead
23
-of all interfaces which is the default.
24
-.LP
25
-The \fB-b\fR option turns on bidirectional copying.
26
-.LP
27
-The \fB-v\fR option shows the version number.
28
-.SH INSTALLATION
29
-.I p910nd
30
-can be run as a standalone daemon or from inetd.
31
-It will automatically detect if it is running under inetd.
32
-.LP
33
-A sample SysVinit script,
34
-.IR p910nd.sh ,
35
-is provided for operation as a daemon.
36
-.I p910nd
37
-will change its name under ps to match the printer port, i.e.
38
-.I p9100d, p9101d
39
-and
40
-.IR p9102d .
41
-.LP
42
-When running under inetd, the
43
-.I /etc/inetd.conf
44
-entry should look something like this (with tcpwrappers protection):
45
-.sp
46
-.nf
47
-p9101 stream tcp nowait root /usr/sbin/tcpd /sbin/p910nd
48
-.fi
49
-.sp
50
-Don't forget to add an entry in
51
-.I /etc/services
52
-for the corresponding port.
53
-.LP
54
-If operating with lprng, use the host%port syntax for the
55
-printer device to send jobs to it.
56
-.LP
57
-If operating with CUPS, this is supported as the AppSocket
58
-protocol, also known as the JetDirect (probably TM) protocol.
59
-.LP
60
-If operating with classic Berkeley lpd, a sample client,
61
-.IR client.pl ,
62
-is provided.
63
-This should be installed as the ifilter (if=) in /etc/printcap.
64
-.I banner.pl
65
-should be installed as the ofilter (of=) in /etc/printcap.
66
-It may be necessary to create a dummy spool file for lpd (lp=).
67
-This file will be opened but not written to.
68
-The corresponding C versions are left as an exercise for the reader.
69
-.LP
70
-When running under inetd, more than one instance could be started.
71
-To avoid problems with multiple instances attempting to access the
72
-printer at the same time, make sure that only one client is active
73
-at any one time. This can be done by designating one host as the
74
-spooler and sending all jobs to this host. You will probably
75
-need to set up an intermediate queue anyway to provide print job filtering.
76
-.LP
77
-If compiled with USE_LIBWRAP and linked with -lwrap, it uses the libwrap
78
-library (tcpwrappers). Access control can be done with /etc/hosts.allow
79
-and /etc/hosts.deny. The service name is p910nd.
80
-.SH DIAGNOSTICS
81
-.I p910nd
82
-logs error messages to syslog.
83
-.SH "SEE ALSO"
84
-printcap(5), hosts_access(5)
85
-.SH FILES
86
-/var/run/p9100d.pid, /var/lock/subsys/p9100d, /etc/hosts.allow, /etc/hosts.deny
87
-.SH COPYRIGHT
88
-.I p910nd
89
-is under the GNU Public License
90
-.SH AUTHOR
91
-Ken Yap (ken_yap@users.sourceforge.net)
92
-.SH DATE
93
-Version 0.8 October 2004

+ 0
- 420
contrib/p910nd-0.8/p910nd.c 查看文件

@@ -1,420 +0,0 @@
1
-/*
2
- *	Port 9100+n daemon
3
- *	Accepts a connection from port 9100+n and copy stream to
4
- *	/dev/lpn, where n = 0,1,2.
5
- *
6
- *	Run standalone as: p910nd [0|1|2]
7
- *
8
- *	Run under inetd as:
9
- *	p910n stream tcp nowait root /usr/sbin/tcpd p910nd [0|1|2]
10
- *	 where p910n is an /etc/services entry for
11
- *	 port 9100, 9101 or 9102 as the case may be.
12
- *	 root can be replaced by any uid with rw permission on /dev/lpn
13
- *
14
- *	Port 9100+n will then be passively opened
15
- *	n defaults to 0
16
- *
17
- *	Version 0.8
18
- *	Allow specifying address to bind to
19
- *
20
- *	Version 0.7
21
- *	Bidirectional data transfer
22
- *
23
- *	Version 0.6
24
- *	Arne Bernin fixed some cast warnings, corrected the version number
25
- *	and added a -v option to print the version.
26
- *
27
- *	Version 0.5
28
- *	-DUSE_LIBWRAP and -lwrap enables hosts_access (tcpwrappers) checking.
29
- *
30
- *	Version 0.4
31
- *	Ken Yap (ken_yap@users.sourceforge.net), April 2001
32
- *	Placed under GPL.
33
- *
34
- *	Added -f switch to specify device which overrides /dev/lpn.
35
- *	But number is still required get distinct ports and locks.
36
- *
37
- *	Added locking so that two invocations of the daemon under inetd
38
- *	don't try to open the printer at the same time. This can happen
39
- *	even if there is one host running clients because the previous
40
- *	client can exit after it has sent all data but the printer has not
41
- *	finished printing and inetd starts up a new daemon when the next
42
- *	request comes in too soon.
43
- *
44
- *	Various things could be Linux specific. I don't
45
- *	think there is much demand for this program outside of PCs,
46
- *	but if you port it to other distributions or platforms,
47
- *	I'd be happy to receive your patches.
48
- */
49
-
50
-#include	<unistd.h>
51
-#include	<stdlib.h>
52
-#include	<stdio.h>
53
-#include	<getopt.h>
54
-#include	<ctype.h>
55
-#include	<string.h>
56
-#include	<fcntl.h>
57
-#include	<netdb.h>
58
-#include	<syslog.h>
59
-#include	<errno.h>
60
-#include	<sys/types.h>
61
-#include	<sys/time.h>
62
-#include	<sys/resource.h>
63
-#include	<sys/stat.h>
64
-#include	<sys/socket.h>
65
-#include	<netinet/in.h>
66
-#include	<arpa/inet.h>
67
-
68
-#ifdef	USE_LIBWRAP
69
-#include	"tcpd.h"
70
-int		allow_severity, deny_severity;
71
-extern		int hosts_ctl(char *daemon, char *client_name,
72
-		char *client_addr, char *client_user);
73
-#endif
74
-
75
-#define		BASEPORT	9100
76
-#define		PIDFILE		"/var/run/p910%cd.pid"
77
-#ifdef		LOCKFILE_DIR
78
-#define		LOCKFILE	LOCKFILE_DIR "/p910%cd"
79
-#else
80
-#define		LOCKFILE	"/var/lock/subsys/p910%cd"
81
-#endif
82
-#define		PRINTERFILE	"/dev/lp%c"
83
-#define		LOGOPTS		LOG_ERR
84
-
85
-static char	*progname;
86
-static char	version[] = "p910nd Version 0.8";
87
-static int	lockfd = -1;
88
-static char	*device = 0;
89
-static int	bidir = 0;
90
-static char	*bindaddr = 0;
91
-
92
-void usage(void)
93
-{
94
-	fprintf(stderr, "Usage: %s [-f device] [-i bindaddr] [-bv] [0|1|2]\n", progname);
95
-	exit(1);
96
-}
97
-
98
-void show_version (void)
99
-{
100
-	fprintf(stdout, "%s \n", version);
101
-}
102
-
103
-FILE *open_printer(int lpnumber)
104
-{
105
-	FILE		*f;
106
-	char		lpname[sizeof(PRINTERFILE)];
107
-
108
-#ifdef	TESTING
109
-	(void)snprintf(lpname, sizeof(lpname), "/dev/tty");
110
-#else
111
-	(void)snprintf(lpname, sizeof(lpname), PRINTERFILE, lpnumber);
112
-#endif
113
-	if (device == 0)
114
-		device = lpname;
115
-	if ((f = fopen(device, bidir ? "w+" : "w")) == NULL)
116
-	{
117
-		syslog(LOGOPTS, "%s: %m\n", device);
118
-		exit(1);
119
-	}
120
-	return (f);
121
-}
122
-
123
-int get_lock(int lpnumber)
124
-{
125
-	char		lockname[sizeof(LOCKFILE)];
126
-	struct flock	lplock;
127
-
128
-	(void)snprintf(lockname, sizeof(lockname), LOCKFILE, lpnumber);
129
-	if ((lockfd = open(lockname, O_CREAT|O_RDWR)) < 0)
130
-	{
131
-		syslog(LOGOPTS, "%s: %m\n", lockname);
132
-		return (0);
133
-	}
134
-	memset(&lplock, 0, sizeof(lplock));
135
-	lplock.l_type = F_WRLCK;
136
-	lplock.l_pid = getpid();
137
-	if (fcntl(lockfd, F_SETLKW, &lplock) < 0)
138
-	{
139
-		syslog(LOGOPTS, "%s: %m\n", lockname);
140
-		return (0);
141
-	}
142
-	return (1);
143
-}
144
-
145
-void free_lock(void)
146
-{
147
-	if (lockfd >= 0)
148
-		(void)close(lockfd);
149
-}
150
-
151
-/* Copy network socket to FILE f until EOS */
152
-int copy_stream(int fd, FILE *f)
153
-{
154
-	int		nread;
155
-	char		buffer[8192];
156
-
157
-	if (bidir) {
158
-		FILE	*nf;
159
-
160
-		if ((nf = fdopen(fd, "w")) == NULL) {
161
-			syslog(LOGOPTS, "fdopen: %m\n");
162
-		}
163
-		for (;;) {
164
-			fd_set	readfds;
165
-			int result;
166
-			int maxfd = fileno(f) > fd ? fileno(f) : fd;
167
-			FD_ZERO(&readfds);
168
-			FD_SET(fileno(f), &readfds);
169
-			FD_SET(fd, &readfds);
170
-			result = select(maxfd + 1, &readfds, 0, 0, 0);
171
-			if (result < 0)
172
-				return (result);
173
-			if (result == 0)
174
-				continue;
175
-			if (FD_ISSET(fd, &readfds)) {
176
-				nread = read(fd, buffer, sizeof(buffer));
177
-				if (nread <= 0)
178
-					break;
179
-				(void)fwrite(buffer, sizeof(char), nread, f);
180
-			}
181
-			if (FD_ISSET(fileno(f), &readfds)) {
182
-				nread = read(fileno(f), buffer, sizeof(buffer));
183
-				if (nread > 0 && nf != NULL) {
184
-					(void)fwrite(buffer, sizeof(char), nread, nf);
185
-					(void)fflush(nf);
186
-				}
187
-			}
188
-		}
189
-		(void)fflush(f);
190
-		(void)fclose(nf);
191
-		return (0);
192
-	} else {
193
-		while ((nread = read(fd, buffer, sizeof(buffer))) > 0)
194
-			(void)fwrite(buffer, sizeof(char), nread, f);
195
-		(void)fflush(f);
196
-		return (nread);
197
-	}
198
-}
199
-
200
-void one_job(int lpnumber)
201
-{
202
-	FILE		*f;
203
-	struct sockaddr_in	client;
204
-	socklen_t	clientlen = sizeof(client);
205
-
206
-	if (getpeername(0, (struct sockaddr*) &client, &clientlen) >= 0)
207
-		syslog(LOGOPTS, "Connection from %s port %hu\n",
208
-			inet_ntoa(client.sin_addr),
209
-			ntohs(client.sin_port));
210
-	if (get_lock(lpnumber) == 0)
211
-		return;
212
-	f = open_printer(lpnumber);
213
-	if (copy_stream(0, f) < 0)
214
-		syslog(LOGOPTS, "copy_stream: %m\n");
215
-	fclose(f);
216
-	free_lock();
217
-}
218
-
219
-void server(int lpnumber)
220
-{
221
-	struct rlimit	resourcelimit;
222
-#ifdef	USE_GETPROTOBYNAME
223
-	struct protoent	*proto;
224
-#endif
225
-	int		netfd, fd, one = 1;
226
-	socklen_t	clientlen;
227
-	struct sockaddr_in	netaddr, client;
228
-	char		pidfilename[sizeof(PIDFILE)];
229
-	FILE		*f;
230
-	int		ipret;
231
-
232
-#ifndef	TESTING
233
-	switch (fork())
234
-	{
235
-	case -1:
236
-		syslog(LOGOPTS, "fork: %m\n");
237
-		exit (1);
238
-	case 0:		/* child */
239
-		break;
240
-	default:	/* parent */
241
-		exit(0);
242
-	}
243
-	/* Now in child process */
244
-	resourcelimit.rlim_max = 0;
245
-	if (getrlimit(RLIMIT_NOFILE, &resourcelimit) < 0)
246
-	{
247
-		syslog(LOGOPTS, "getrlimit: %m\n");
248
-		exit(1);
249
-	}
250
-	for (fd = 0; fd < resourcelimit.rlim_max; ++fd)
251
-		(void)close(fd);
252
-	if (setsid() < 0)
253
-	{
254
-		syslog(LOGOPTS, "setsid: %m\n");
255
-		exit(1);
256
-	}
257
-	(void)chdir("/");
258
-	(void)umask(022);
259
-	fd = open("/dev/null", O_RDWR);	/* stdin */
260
-	(void)dup(fd);			/* stdout */
261
-	(void)dup(fd);			/* stderr */
262
-	(void)snprintf(pidfilename, sizeof(pidfilename), PIDFILE, lpnumber);
263
-	if ((f = fopen(pidfilename, "w")) == NULL)
264
-	{
265
-		syslog(LOGOPTS, "%s: %m\n", pidfilename);
266
-		exit(1);
267
-	}
268
-	(void)fprintf(f, "%d\n", getpid());
269
-	(void)fclose(f);
270
-	if (get_lock(lpnumber) == 0)
271
-		exit(1);
272
-#endif
273
-	f = open_printer(lpnumber);
274
-#ifdef	USE_GETPROTOBYNAME
275
-	if ((proto = getprotobyname("tcp")) == NULL)
276
-	{
277
-		syslog(LOGOPTS, "Cannot find protocol for TCP!\n");
278
-		exit(1);
279
-	}
280
-	if ((netfd = socket(AF_INET, SOCK_STREAM, proto->p_proto)) < 0)
281
-#else
282
-	if ((netfd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) < 0)
283
-#endif
284
-	{
285
-		syslog(LOGOPTS, "socket: %m\n");
286
-		exit(1);
287
-	}
288
-	if (setsockopt(netfd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0)
289
-	{
290
-		syslog(LOGOPTS, "setsocketopt: %m\n");
291
-		exit(1);
292
-	}
293
-	netaddr.sin_port = htons(BASEPORT + lpnumber - '0');
294
-	if (bindaddr == 0) {
295
-		netaddr.sin_addr.s_addr = htonl(INADDR_ANY);
296
-	} else {
297
-		ipret = inet_pton(AF_INET, bindaddr, &netaddr.sin_addr.s_addr);
298
-		if (ipret < 0) {
299
-			syslog(LOGOPTS, "inet_pton: %m\n");
300
-			exit(1);
301
-		} else if (ipret == 0) {
302
-			syslog(LOGOPTS, "inet_pton: invalid bind IP address\n");
303
-			exit(1);
304
-		}
305
-	}
306
-	memset(netaddr.sin_zero, 0, sizeof(netaddr.sin_zero));
307
-	if (bind(netfd, (struct sockaddr*) &netaddr, sizeof(netaddr)) < 0)
308
-	{
309
-		syslog(LOGOPTS, "bind: %m\n");
310
-		exit(1);
311
-	}
312
-	if (listen(netfd, 5) < 0)
313
-	{
314
-		syslog(LOGOPTS, "listen: %m\n");
315
-		exit(1);
316
-	}
317
-	clientlen = sizeof(client);
318
-	memset(&client, 0, sizeof(client));
319
-	while ((fd = accept(netfd, (struct sockaddr*) &client, &clientlen)) >= 0)
320
-	{
321
-#ifdef	USE_LIBWRAP
322
-		if (hosts_ctl("p910nd", STRING_UNKNOWN,
323
-			inet_ntoa(client.sin_addr), STRING_UNKNOWN) == 0) {
324
-			syslog(LOGOPTS, "Connection from %s port %hd rejected\n",
325
-				inet_ntoa(client.sin_addr),
326
-				ntohs(client.sin_port));
327
-			close(fd);
328
-			continue;
329
-		}
330
-#endif
331
-		syslog(LOGOPTS, "Connection from %s port %hd accepted\n",
332
-			inet_ntoa(client.sin_addr),
333
-			ntohs(client.sin_port));
334
-		/*write(fd, "Printing", 8);*/
335
-		if (copy_stream(fd, f) < 0)
336
-			syslog(LOGOPTS, "copy_stream: %m\n");
337
-		(void)close(fd);
338
-	}
339
-	syslog(LOGOPTS, "accept: %m\n");
340
-	free_lock();
341
-	exit(1);
342
-}
343
-
344
-int is_standalone(void)
345
-{
346
-	struct sockaddr_in	bind_addr;
347
-	socklen_t		ba_len;
348
-
349
-	/*
350
-	 * Check to see if a socket was passed to us from inetd.
351
-	 *
352
-	 * Use getsockname() to determine if descriptor 0 is indeed a socket
353
-	 * (and thus we are probably a child of inetd) or if it is instead
354
-	 * something else and we are running standalone.
355
-	 */
356
-	ba_len = sizeof(bind_addr);
357
-	if (getsockname(0, (struct sockaddr*) &bind_addr, &ba_len) == 0)
358
-		return (0);		/* under inetd */
359
-	if (errno != ENOTSOCK)		/* strange... */
360
-		syslog(LOGOPTS, "getsockname: %m\n");
361
-	return (1);
362
-}
363
-
364
-int main(int argc, char *argv[])
365
-{
366
-	int		c, lpnumber;
367
-	char		*p;
368
-
369
-	if (argc <= 0)		/* in case not provided in inetd.conf */
370
-		progname = "p910nd";
371
-	else
372
-	{
373
-		progname = argv[0];
374
-		if ((p = strrchr(progname, '/')) != 0)
375
-			progname = p + 1;
376
-	}
377
-	lpnumber = '0';
378
-	while ((c = getopt(argc, argv, "bi:f:v")) != EOF)
379
-	{
380
-		switch (c)
381
-		{
382
-		case 'b':
383
-			bidir = 1;
384
-			break;
385
-		case 'f':
386
-			device = optarg;
387
-			break;
388
-		case 'i':
389
-			bindaddr = optarg;
390
-			break;
391
-		case 'v':
392
-	      	        show_version();
393
-			break;
394
-		default:
395
-			usage();
396
-			break;
397
-		}
398
-	}
399
-	argc -= optind;
400
-	argv += optind;
401
-	if (argc > 0)
402
-	{
403
-		if (isdigit(argv[0][0]))
404
-			lpnumber = argv[0][0];
405
-	}
406
-	/* change the n in argv[0] to match the port so ps will show that */
407
-	if ((p = strstr(progname, "p910n")) != NULL)
408
-		p[4] = lpnumber;
409
-	
410
-	/* We used to pass (LOG_PERROR|LOG_PID|LOG_LPR|LOG_ERR) to syslog, but
411
-	 * syslog ignored the LOG_PID and LOG_PERROR option.  I.e. the intention
412
-	 * was to add both options but the effect was to have neither.
413
-	 * I disagree with the intention to add PERROR.	 --Stef	 */
414
-	openlog (p, LOG_PID, LOG_LPR);
415
-	if (is_standalone())
416
-		server(lpnumber);
417
-	else
418
-		one_job(lpnumber);
419
-	return (0);
420
-}

+ 0
- 39
contrib/p910nd-0.8/p910nd.sh 查看文件

@@ -1,39 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# p910nd.sh	This shell script takes care of starting and stopping
4
-#               p910nd (port 9100+n printer daemon)
5
-#		This script only controls the one on port 9101.
6
-#		You can start others if you wish.
7
-#
8
-
9
-# Todo: Make it fully LSB
10
-
11
-# See how we were called.
12
-case "$1" in
13
-  start)
14
-	# Start daemons.
15
-	echo -n "Starting p910nd: "
16
-	# default port is 1 so it will appear as p9101d on a ps
17
-	start_daemon p910nd
18
-	echo
19
-	;;
20
-  stop)
21
-	# Stop daemons.
22
-	echo -n "Shutting down p910nd: "
23
-	killproc p9101d
24
-	echo
25
-	rm -f /var/run/p9101.pid
26
-        ;;
27
-  status)
28
-	status p9101d
29
-	;;
30
-  restart)
31
-	$0 stop
32
-	$0 start
33
-	;;
34
-  *)
35
-	echo "Usage: p910nd {start|stop|restart|status}"
36
-	exit 1
37
-esac
38
-
39
-exit 0

+ 0
- 67
contrib/ppmtoansi/Makefile 查看文件

@@ -1,67 +0,0 @@
1
-CPPFLAGS    =
2
-LDLIBS      = 
3
-CFLAGS      = -pipe -g -O2 -Wall
4
-LDFLAGS     = -pipe
5
-CC          = gcc
6
-LD          = gcc
7
-# Some "black" magic to determine optimal compiler flags for target
8
-# architecture
9
-TARGET_ARCH:= $(shell if [ \! -r .compile-options ] ; then ( \
10
-                cpu=`grep cpu /proc/cpuinfo 2>&1 |head -1| \
11
-                     cut -d : -f 2-| sed -e 's/ //g'`; \
12
-                if [ x"$$cpu" = x"" ] ; then \
13
-                  echo -fno-strength-reduce; \
14
-                else if [ "$$cpu" = "386" ] ; then \
15
-                  echo -m386 -fno-strength-reduce; \
16
-                else if [ "$$cpu" = "486" ] ; then \
17
-                  echo -m486 -fno-strength-reduce; \
18
-                else if [ "$$cpu" = "Alpha" ] ; then \
19
-                  echo -fno-strength-reduce; \
20
-                else echo main\(\)\{\} >.compile-options.c; \
21
-                  if gcc -mpentium -o .compile-options.o -c \
22
-                         .compile-options.c &>/dev/null; then \
23
-                     echo -mpentium -fstrength-reduce; \
24
-                 else if gcc -m486 -malign-functions=2 -malign-jumps=2 \
25
-                             -malign-loops=2 -o .compile-options.o -c \
26
-                             .compile-options.c &>/dev/null; then \
27
-                  echo -n -m486 -malign-functions=2 -malign-jumps=2; \
28
-                  echo ' '-malign-loops=2 -fno-strength-reduce; \
29
-                else echo -m486; \
30
-              fi;fi;fi;fi;fi;fi) > .compile-options; \
31
-              rm -f .compile-options.c .compile-options.o; \
32
-              fi; cat .compile-options)
33
-ASFLAGS     = $(TARGET_ARCH)
34
-
35
-OBJS        = ppmtoansi.o
36
-
37
-##############################################################################
38
-
39
-ifeq (.depend,$(wildcard .depend))
40
-all: ppmtoansi
41
-include .depend
42
-else
43
-all: depend
44
-	@$(MAKE) all
45
-endif
46
-
47
-##############################################################################
48
-
49
-ppmtoansi: $(OBJS)
50
-
51
-##############################################################################
52
-
53
-clean:
54
-	$(RM) *~ *.o *.dvi *.log *.aux *yacc.tab.[ch] *yacc.output *lex.[co] \
55
-              *.dat .depend .tmp_depend .compile-options*
56
-	strip ppmtoansi >&/dev/null || true
57
-
58
-distclean: clean
59
-	$(RM) -rf ppmtoansi
60
-
61
-##############################################################################
62
-
63
-depend:
64
-	for i in *.c;do $(CPP) $(CPPFLAGS) -MM $$i;done >.tmp_depend
65
-	mv .tmp_depend .depend
66
-
67
-##############################################################################

+ 0
- 1
contrib/ppmtoansi/demo/dos.ansi 查看文件

@@ -1 +0,0 @@
1
-[9;;1- [15;;1- [18;;5-Ûl[9;1;3-$€[13;1;3-$€[17;1;1-À[9;2;1- [12;2;1- [15;2;1- [17;2;1-À[9;3;1- [15;3;1- [18;3;5-Ûl[9;4;1- [15;4;1- [23;4;1-À[9;5;1- [15;5;1- [23;5;1-À[9;6;1- [15;6;1- [18;6;5-Ûl[8;8;4-I [14;8;4-m°[19;8;5-¶Ú[8;9;1-@[12;9;2-L[18;9;2-¬[8;10;1-@[11;10;1-`[13;10;1-@[18;10;1- [20;10;1-`[8;11;1-@[11;11;1-`[13;11;1-@[19;11;5-¶Ú[8;12;1-@[11;12;1-`[13;12;1-@[20;12;1-`[24;12;1- [8;13;1-@[12;13;2-L[18;13;2-l[24;13;1- [8;14;4-I [14;14;4-m°[19;14;5-¶Ú

+ 0
- 51
contrib/ppmtoansi/demo/dos.ppm 查看文件

@@ -1,51 +0,0 @@
1
-P3
2
-17 16
3
-65535
4
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
5
-0 0 0  65535 0 0  0 0 0  0 0 0  0 65535 65535  0 65535 65535
6
-0 65535 65535  0 65535 65535  0 65535 65535  0 0 0  0 0 0
7
-0 0 0  65535 0 0  65535 0 0  65535 0 0  0 0 0  65535 0 0
8
-65535 0 0  65535 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0
9
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
10
-0 0 0  65535 0 0  0 0 0  0 0 0  65535 0 0  0 0 0
11
-0 0 0  65535 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0
12
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
13
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
14
-0 0 0  65535 0 0  0 0 0  0 0 0  0 65535 65535  0 65535 65535
15
-0 65535 65535  0 65535 65535  0 65535 65535  0 0 0  0 0 0
16
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
17
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
18
-0 0 0  0 0 0  0 0 0  0 65535 65535  0 0 0
19
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
20
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
21
-0 0 0  0 0 0  0 0 0  0 65535 65535  0 0 0
22
-0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0
23
-0 0 0  65535 0 0  0 0 0  0 0 0  0 65535 65535  0 65535 65535
24
-0 65535 65535  0 65535 65535  0 65535 65535  0 0 0  0 0 0
25
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
26
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
27
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
28
-0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0  0 0 0
29
-65535 65535 0  65535 65535 0  65535 65535 0  65535 65535 0  0 0 0  65535 0 65535
30
-65535 0 65535  65535 0 65535  65535 0 65535  65535 0 65535  0 0 0
31
-0 65535 0  0 0 0  0 0 0  0 0 0  0 65535 0  65535 65535 0
32
-0 0 0  0 0 0  0 0 0  0 0 0  65535 0 65535  65535 65535 0
33
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
34
-0 65535 0  0 0 0  0 0 0  65535 65535 0  0 0 0  0 65535 0
35
-0 0 0  0 0 0  0 0 0  0 0 0  65535 0 65535  0 0 0
36
-65535 65535 0  0 0 0  0 0 0  0 0 0  0 0 0
37
-0 65535 0  0 0 0  0 0 0  65535 65535 0  0 0 0  0 65535 0
38
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  65535 0 65535
39
-65535 0 65535  65535 0 65535  65535 0 65535  65535 0 65535  0 0 0
40
-0 65535 0  0 0 0  0 0 0  65535 65535 0  0 0 0  0 65535 0
41
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
42
-65535 65535 0  0 0 0  0 0 0  0 0 0  65535 0 65535
43
-0 65535 0  0 0 0  0 0 0  0 0 0  0 65535 0  65535 65535 0
44
-0 0 0  0 0 0  0 0 0  0 0 0  65535 65535 0  65535 65535 0
45
-0 0 0  0 0 0  0 0 0  0 0 0  65535 0 65535
46
-0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0  0 0 0
47
-65535 65535 0  65535 65535 0  65535 65535 0  65535 65535 0  0 0 0  65535 0 65535
48
-65535 0 65535  65535 0 65535  65535 0 65535  65535 0 65535  0 0 0
49
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
50
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
51
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0

+ 0
- 29
contrib/ppmtoansi/demo/dos.xpm 查看文件

@@ -1,29 +0,0 @@
1
-/* XPM */
2
-static char *noname[] = {
3
-/* width height ncolors chars_per_pixel */
4
-"17 16 6 1",
5
-/* colors */
6
-"` c #000000",
7
-"a c #00FFFF",
8
-"b c #00FF00",
9
-"c c #FF00FF",
10
-"d c #FF0000",
11
-"e c #FFFF00",
12
-/* pixels */
13
-"`d`````d``aaaaa``",
14
-"`ddd`ddd`a```````",
15
-"`d``d``d`a```````",
16
-"`d`````d``aaaaa``",
17
-"`d`````d```````a`",
18
-"`d`````d```````a`",
19
-"`d`````d``aaaaa``",
20
-"`````````````````",
21
-"bbbb``eeee`ccccc`",
22
-"b```be````ce`````",
23
-"b``e`b````c`e````",
24
-"b``e`b`````ccccc`",
25
-"b``e`b``````e```c",
26
-"b```be````ee````c",
27
-"bbbb``eeee`ccccc`",
28
-"`````````````````"
29
-};

二進制
contrib/ppmtoansi/demo/etherboot.ansi 查看文件


+ 0
- 99
contrib/ppmtoansi/demo/etherboot.ppm 查看文件

@@ -1,99 +0,0 @@
1
-P3
2
-32 16
3
-65535
4
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
5
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
6
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
7
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
8
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
9
-0 0 0  0 0 0
10
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
11
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
12
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
13
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
14
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
15
-0 0 0  0 0 0
16
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
17
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
18
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
19
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
20
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
21
-65535 0 0  65535 0 0
22
-65535 0 0  0 0 0  0 0 0  0 65535 0  0 65535 0  0 65535 0
23
-0 65535 0  0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0
24
-0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0
25
-0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0
26
-0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0  0 0 0
27
-0 0 0  65535 0 0
28
-65535 0 0  0 0 0  0 0 0  0 65535 0  0 65535 0  0 65535 0
29
-0 65535 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 65535 0
30
-0 0 0  0 65535 0  0 0 0  0 0 0  0 65535 0  0 0 0
31
-0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 0 0
32
-0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0  0 0 0
33
-0 0 0  65535 0 0
34
-65535 0 0  0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0
35
-0 65535 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 65535 0
36
-0 0 0  0 65535 0  0 0 0  0 0 0  0 65535 0  0 0 0
37
-0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 0 0
38
-0 65535 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
39
-0 0 0  65535 0 0
40
-0 0 0  65535 0 0  0 0 0  0 65535 0  0 65535 0  0 65535 0
41
-0 65535 0  0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0
42
-0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0  0 0 0
43
-0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 0 0
44
-0 65535 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
45
-0 0 0  65535 0 0
46
-0 0 0  0 0 0  65535 0 0  0 0 0  0 0 0  0 0 0
47
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
48
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
49
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
50
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
51
-0 0 0  65535 0 0
52
-0 0 0  65535 0 0  0 0 0  0 65535 0  0 65535 0  0 65535 0
53
-0 65535 0  0 65535 0  0 0 0  0 65535 0  0 65535 0  0 65535 0
54
-0 65535 0  0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0
55
-0 65535 0  0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0
56
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
57
-0 0 0  65535 0 0
58
-65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 65535 0
59
-0 0 0  0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0
60
-0 0 0  0 0 0  0 0 0  0 0 0  0 65535 0  0 0 0
61
-0 0 0  0 0 0  0 65535 0  0 65535 0  0 65535 0  0 65535 0
62
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
63
-0 0 0  65535 0 0
64
-65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 65535 0
65
-0 0 0  0 0 0  0 0 0  0 65535 0  0 65535 0  0 65535 0
66
-0 0 0  0 0 0  0 0 0  0 0 0  0 65535 0  0 0 0
67
-0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 0 0
68
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
69
-0 0 0  65535 0 0
70
-65535 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 65535 0
71
-0 0 0  0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0
72
-0 0 0  0 0 0  0 0 0  0 0 0  0 65535 0  0 0 0
73
-0 0 0  0 0 0  0 65535 0  0 0 0  0 0 0  0 0 0
74
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
75
-0 0 0  65535 0 0
76
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
77
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
78
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
79
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
80
-65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0  65535 0 0
81
-65535 0 0  65535 0 0
82
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
83
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
84
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
85
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
86
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
87
-0 0 0  0 0 0
88
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
89
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
90
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
91
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
92
-0 0 0  0 0 0  0 65535 65535  0 0 0  0 0 0  0 65535 65535
93
-0 0 0  0 0 0
94
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
95
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
96
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
97
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
98
-0 0 0  0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
99
-0 0 0  0 0 0

+ 0
- 27
contrib/ppmtoansi/demo/etherboot.xpm 查看文件

@@ -1,27 +0,0 @@
1
-/* XPM */
2
-static char *noname[] = {
3
-/* width height ncolors chars_per_pixel */
4
-"32 16 4 1",
5
-/* colors */
6
-"` c #000000",
7
-"a c #00FFFF",
8
-"b c #00FF00",
9
-"c c #FF0000",
10
-/* pixels */
11
-"``a``a``a``a``a``a``a``a``a``a``",
12
-"``a``a``a``a``a``a``a``a``a``a``",
13
-"cccccccccccccccccccccccccccccccc",
14
-"c``bbbb`bbbb`bbbb`bbbbb`bbbb```c",
15
-"c``bbbb`b``b`b``b```b```bbbb```c",
16
-"c``b``b`b``b`b``b```b```b``````c",
17
-"`c`bbbb`bbbb`bbbb```b```b``````c",
18
-"``c````````````````````````````c",
19
-"`c`bbbbb`bbbb`bbbbb`bbbb```````c",
20
-"c````b```b``````b```bbbb```````c",
21
-"c````b```bbb````b```b``````````c",
22
-"c````b```b``````b```b``````````c",
23
-"cccccccccccccccccccccccccccccccc",
24
-"``a``a``a``a``a``a``a``a``a``a``",
25
-"``a``a``a``a``a``a``a``a``a``a``",
26
-"````````````````````````````````"
27
-};

+ 0
- 1
contrib/ppmtoansi/demo/flash.ansi 查看文件

@@ -1 +0,0 @@
1
-[11;;2-l[11;1;2-l[17;1;1-`[11;2;2-l[16;2;2-l[11;3;2-l[15;3;3-m€[11;4;2-l[14;4;4-m°[11;5;2-l[14;5;4-m°[11;6;4-m°[16;6;2-l[11;7;4-m°[16;7;2-l[11;8;3-m€[16;8;2-l[11;9;2-l[16;9;2-l[11;10;1-`[16;10;2-l[16;11;2-l[13;12;2-l[16;12;2-l[19;12;2-l[14;13;6-m¶À[15;14;4-m°[16;15;2-l

+ 0
- 0
contrib/ppmtoansi/demo/flash.ppm 查看文件


部分文件因文件數量過多而無法顯示

Loading…
取消
儲存