Static ip patch problems
"Ricardo Carrillo Cruz" <[email protected]> Wed, 8 Mar 2006 14:17:11 +0100
| Newsgroups | gmane.network.etherboot.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello to all
I've been able to run with success several diskless computers with
thinstation 2.1.3.The dhcp and tftp servers are different
machines.Theclients get their
thinstation.nbi image from the tftp server via the
DEFAULT_BOOTFILE=tftp://mytftpserver/thinstation.nbi, so i didn't need to
configure the dhcp server any tftp related stuff.
Now,i need to set my clients with static ips.After searching a lot,i found a
useful patch that David Aubin posted some years ago (thank you very much
David :P ),so i decided to modify it a little.
This is the Config patch:
--- Config.orig 2006-03-07 10:32:43.000000000 +0100
+++ Config 2006-03-07 13:37:42.000000000 +0100
@@ -60,6 +60,8 @@
# Use BOOTP instead of DHCP.
# -DRARP_NOT_BOOTP
# Use RARP instead of BOOTP/DHCP.
+# -DSTATIC_ADDRESS Use static ip insted of dynamic protocol
+# -DSTATIC_CLIENT_IP=\Â"1.2.3.4\"
# -DREQUIRE_VCI_ETHERBOOT
# Require an encapsulated Vendor Class Identifier
# of "Etherboot" in the DHCP reply
@@ -379,10 +381,16 @@
# Disable DHCP support
# CFLAGS+= -DNO_DHCP_SUPPORT
+# Enable static ip
+CFLAGS+= -DSTATIC_ADDRESS
+
+#Specify the client IP
+CFLAGS+= -DSTATIC_CLIENT_IP=\"10.205.99.74\"
+
# Specify a default bootfile to be used if the DHCP server does not
# provide the information. If you do not specify this option, then
# DHCP offers that do not contain bootfiles will be ignored.
-# CFLAGS+= -DDEFAULT_BOOTFILE=\"tftp:///tftpboot/kernel\"
+CFLAGS+= -DDEFAULT_BOOTFILE=\"tftp://10.205.99.73/thinstation.nbi\"
# Limit the delay on packet loss/congestion to a more bearable value. See
# description above. If unset, do not limit the delay between resend.
@@ -439,12 +447,12 @@
# CFLAGS+= -DNORELOCATE
# you should normally not need to change these
-HOST_CC= gcc
+HOST_CC= gcc-3.4
CPP= gcc -E -Wp,-Wall
RM= rm -f
TOUCH= touch
PERL= /usr/bin/perl
-CC= gcc
+CC= gcc-3.4
AS= as
LD= ld
SIZE= size
And this is the nic.c diff:
--- nic_orig.c 2006-03-07 10:38:52.000000000 +0100
+++ nic.c 2006-03-07 13:35:47.000000000 +0100
@@ -270,8 +270,12 @@
#ifdef RARP_NOT_BOOTP
static int rarp(void);
#else
+#ifdef STATIC_ADDRESS
+static void static_client_ip(void);
+#else
static int bootp(void);
#endif
+#endif
static unsigned short tcpudpchksum(struct iphdr *ip);
@@ -314,6 +318,9 @@
{
int server_found;
/* Find a server to get BOOTP reply from */
+#ifdef STATIC_ADDRESS
+ printf("Booting with static ip address...");
+#else
#ifdef RARP_NOT_BOOTP
printf("Searching for server (RARP)...");
#else
@@ -323,12 +330,17 @@
printf("Searching for server (BOOTP)...");
#endif
#endif
-
+#endif
+
+#ifdef STATIC_ADDRESS
+ static_client_ip();
+#else
#ifdef RARP_NOT_BOOTP
server_found = rarp();
#else
server_found = bootp();
#endif
+#endif
if (!server_found) {
printf("No Server found\n");
longjmp(restart_etherboot, -1);
@@ -788,7 +800,17 @@
}
#endif /* DOWNLOAD_PROTO_TFTP */
+#ifdef STATIC_ADDRESS
+void static_client_ip(void)
+{
+ in_addr client_addr;
+ inet_aton(STATIC_CLIENT_IP,&client_addr);
+ memcpy(&arptable[ARP_CLIENT].ipaddr,&client_addr.s_addr,sizeof(in_addr));
+}
+
+#else
#ifdef RARP_NOT_BOOTP
+
/**************************************************************************
RARP - Get my IP address and load information
**************************************************************************/
@@ -851,7 +873,6 @@
}
#else
-
/**************************************************************************
BOOTP - Get my IP address and load information
**************************************************************************/
@@ -1049,6 +1070,8 @@
}
#endif /* RARP_NOT_BOOTP */
+#endif
+
static uint16_t tcpudpchksum(struct iphdr *ip)
{
struct udp_pseudo_hdr pseudo;
Everything work well,it boots ok,it begins to download the image,but after
finishing the nbi image transfer,it gives me this error:
Issuing RESET:
mknbi-1.4.4/first32.c (ELF) (GPL)
Bad argument
Secondary program returned -1
<abort>
Can anybody help me?
Thx in advance