[Etherboot-developers] Re: [Etherboot-users] ip=dhcp in 2.2.18 kernels
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Ken Y. <ke...@nl...> - 2000-12-20 12:09:50
|
>Just a hint for people who wants to use this second dhcp request
>with kernel 2.2.18:
>Don't add the --ipaddrs, --rootdir options from mknbi, use instead:
> mknbi-linux --output=/tmp/vmlinuz.tulip bzImage
>Then add some kernel parameters to the dhcpd.conf:
> option option-129 "ip=dhcp root=/dev/nfs"
>
>2.2.18 doesn't start a dhcp request by itself, so you need ip=dhcp.
Ah, I found what the problem was. In 2.2.18, they turned off the default
of doing a IP autoconfig, you need to explicitly specify using ip=X
where X is one of the options off, none, on, all, bootp, dhcp, rarp, or
both (bootp and rarp, not bootp and dhcp). See the kernel source file
net/ipv4/ipconfig.c for the list.
So I have enhanced mknbi-1.1 to accept ip= (or ipaddrs=) followed by one
of those options. You can also use the tag 129 method of course but
since the tagged image is meant to be netbooted you might as well bundle
the option into the image instead of having to put it in the DHCP/BOOTP
config file. At the same time, this exposed a bug in first32.linux so
this was a useful exercise.
Here are the patches, until 4.7.15 is released:
diff -ur etherboot-4.7.14/mknbi-1.1/first32.c etherboot-4.7.15/mknbi-1.1/first32.c
--- etherboot-4.7.14/mknbi-1.1/first32.c Mon Dec 18 12:59:14 2000
+++ etherboot-4.7.15/mknbi-1.1/first32.c Wed Dec 20 22:38:33 2000
@@ -33,7 +33,6 @@
*/
-#define DEBUG 1
#define PARAMSIZE 512
extern void printf(const char *, ...);
@@ -323,7 +322,8 @@
*op++ = ':';
outtag(p);
discard_arg();
- }
+ } else
+ copy_nonws();
}
static inline int skipws(void)
@@ -352,6 +352,11 @@
static inline void process_params(void)
{
int i;
+ unsigned char *p;
+ union {
+ unsigned long l;
+ unsigned char c[4];
+ } u;
while (skipws() != '\0') {
if ((i = copy_and_match()) >= 0)
@@ -360,7 +365,9 @@
copy_nonws();
*op++ = ' ';
}
- outtag(gettag(BOOTP_RFC_CMDAD)); /* Append T129 */
+ p = gettag(BOOTP_RFC_VID); /* check T128 present and correct */
+ if (*p == 6 && (memcpy(u.c, p + 1, 4), u.l == VEND_EB))
+ outtag(gettag(BOOTP_RFC_CMDAD)); /* Append T129 */
/* There may be a space after the last arg, probably does not matter
but this is a reminder */
*op = '\0';
diff -ur etherboot-4.7.14/mknbi-1.1/first32.h etherboot-4.7.15/mknbi-1.1/first32.h
--- etherboot-4.7.14/mknbi-1.1/first32.h Sun Dec 17 17:29:44 2000
+++ etherboot-4.7.15/mknbi-1.1/first32.h Tue Dec 19 22:59:15 2000
@@ -10,6 +10,7 @@
#define RFC_1048 0x63538263
#define VEND_CMU 0x00554D43
#define VEND_STAN 0x4E415453
+#define VEND_EB 0x687445E4 /* äEth */
#define BOOTP_RFC_NOP 0 /* RFC vendor tag for NO-OP */
#define BOOTP_RFC_MSK 1 /* RFC vendor tag for netmask */
diff -ur etherboot-4.7.14/mknbi-1.1/mknbi.pl etherboot-4.7.15/mknbi-1.1/mknbi.pl
--- etherboot-4.7.14/mknbi-1.1/mknbi.pl Mon Dec 18 10:56:04 2000
+++ etherboot-4.7.15/mknbi-1.1/mknbi.pl Wed Dec 20 22:49:35 2000
@@ -94,7 +94,7 @@
if (defined($ipaddrs)) {
if ($ipaddrs eq 'kernel') {
undef($ipaddrs);
- } elsif ($ipaddrs ne 'rom') {
+ } elsif ($ipaddrs !~ /^(rom|off|none|on|any|dhcp|bootp|rarp|both)$/) {
$ipaddrs = &resolve_names($ipaddrs);
}
}
@@ -373,6 +373,7 @@
'param=s' => \$param,
'append=s' => \$append,
'rootdir=s' => \$rootdir,
+ 'ip=s' => \$ipaddrs,
'ipaddrs=s' => \$ipaddrs,
'rdmode=s' => \$rdmode,
'harddisk!' => \$simhd,
@@ -472,13 +473,22 @@
If the name given to the option starts with C</dev/>, the corresponding
device is used as the root device, and no NFS directory will be mounted.
-B<--ipaddrs=>I<string> Define client and server IP addresses.
+B<--ip=>I<string> Define client and server IP addresses.
+B<--ipaddrs=>I<string> is a synonym for the same thing.
In the absence of this option no IP addresses are defined, and the
kernel should determine the IP addresses by itself, usually by using
RARP, BOOTP or DHCP. Note that the kernel's query is I<in addition to>
the query made by the bootrom, and requires the IP: kernel level
autoconfiguration (CONFIG_IP_PNP) feature to be included in the kernel.
+Note: In Linux kernels 2.2.x where x >= 18, it is B<necessary> to
+specify one of the enabling options in the next paragraph to cause the
+IP autoconfiguration to be activated. Unlike previous kernels in the 2.2
+series, IP autoconfiguration does not happen by default.
+
+If one of the following: C<off, none, on, any, dhcp, bootp, rarp, both>,
+is given, then the option will be passed unmodified to the kernel and
+cause that autoconfig option to be chosen.
If C<rom> is given as the argument to this option, all necessary IP
addresses for NFS root mounting will be inherited from the BOOTP/DHCP
@@ -488,7 +498,7 @@
image. Then, all addresses must be seperated by a colon, and ordered in
the following way:
-C<--ipaddrs=>I<client:server:gateway:netmask:hostname[:dev]>
+C<--ip=>I<client:server:gateway:netmask:hostname[:dev]>
Using this option B<mknbi-linux> will automatically convert system names
into decimal IP addresses for the first three entries in this string. The
@@ -535,7 +545,7 @@
B<130> With this tag it is possible to the select the network adapter
used for mounting root via NFS on a multihomed diskless client. The
syntax for the I<string> value is the same as for the C<dev> entry used
-with the B<--ipaddrs=> option as described above. However note that the
+with the B<--ip=> option as described above. However note that the
B<mknbi-linux> runtime loader does not check the syntax of the string.
The same tags will work in DHCP with the appropriate syntax for your
|