[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: klibc-dhcp-client and D-I



On Fri, May 19, 2006 at 10:23:34AM +1000, Andrew Pollock wrote:
> On Wed, May 17, 2006 at 02:55:02PM +0200, Geert Stappers wrote:
> > 
> > Is the source of the ipconfig udeb public available?  If yes: Where?
> 
> I made a privately hacked up udeb, here's the diff:
> 
> diff -urN klibc-1.3.19/debian/control klibc-udeb/debian/control
> --- klibc-1.3.19/debian/control 2006-05-18 17:19:59.019824009 -0700
> +++ klibc-udeb/debian/control   2006-05-14 16:04:36.159174709 -0700
> @@ -37,3 +37,9 @@
>   full-function counterparts.  They are intended for inclusion in
>   initramfs images and embedded systems.
> 
> +Package: klibc-ipconfig
> +XC-Package-Type: udeb
> +Architecture: any
  <snip/>

The patch applied cleanly, I got a working udeb from it.

To make klibc-ipconfig transmit the DHCP vendor class "d-i"
and get the DHCP preseeding filename in a text file, it needs the
attached patch.


Cheers
Geert Stappers



Thanks
Geert Stappers
diff -ruN -x debian klibc-1.3.19/usr/kinit/ipconfig/dhcp_proto.c klibc-1.3.19-gst/usr/kinit/ipconfig/dhcp_proto.c
--- klibc-1.3.19/usr/kinit/ipconfig/dhcp_proto.c	2006-05-07 21:53:45.000000000 +0200
+++ klibc-1.3.19-gst/usr/kinit/ipconfig/dhcp_proto.c	2006-05-20 21:45:11.000000000 +0200
@@ -47,6 +47,7 @@
 };
 
 static __u8 dhcp_end[] = {
+	60, 3, 100, 45, 105, /* Vendor class "d-i" */
 	255,
 };
 
diff -ruN -x debian klibc-1.3.19/usr/kinit/ipconfig/netdev.h klibc-1.3.19-gst/usr/kinit/ipconfig/netdev.h
--- klibc-1.3.19/usr/kinit/ipconfig/netdev.h	2006-05-07 21:53:45.000000000 +0200
+++ klibc-1.3.19-gst/usr/kinit/ipconfig/netdev.h	2006-05-21 01:26:53.000000000 +0200
@@ -5,6 +5,7 @@
 #include <net/if.h>
 
 #define BPLEN		40
+#define FNLEN		128			/* from RFC 2131, DHCP  */
 
 struct netdev {
 	const char 	*name;			/* Device name		*/
@@ -38,6 +39,7 @@
 	char		dnsdomainname[SYS_NMLN];/* dns domain name	*/
 	char		nisdomainname[SYS_NMLN];/* nis domain name	*/
 	char		bootpath[BPLEN];	/* boot path		*/
+	char		filename[FNLEN];	/* filename		*/
 	struct netdev	*next;			/* next configured i/f	*/
 };
 
diff -ruN -x debian klibc-1.3.19/usr/kinit/ipconfig/bootp_proto.c klibc-1.3.19-gst/usr/kinit/ipconfig/bootp_proto.c
--- klibc-1.3.19/usr/kinit/ipconfig/bootp_proto.c	2006-05-07 21:53:45.000000000 +0200
+++ klibc-1.3.19-gst/usr/kinit/ipconfig/bootp_proto.c	2006-05-21 01:03:07.000000000 +0200
@@ -76,6 +76,7 @@
 	dev->hostname[0]      = '\0';
 	dev->nisdomainname[0] = '\0';
 	dev->bootpath[0]      = '\0';
+	memcpy(&dev->filename, &hdr->boot_file, FNLEN);
 
 	if (extlen >= 4 && exts[0] == 99 && exts[1] == 130 &&
 	    exts[2] == 83 && exts[3] == 99) {
diff -ruN -x debian klibc-1.3.19/usr/kinit/ipconfig/main.c klibc-1.3.19-gst/usr/kinit/ipconfig/main.c
--- klibc-1.3.19/usr/kinit/ipconfig/main.c	2006-05-07 21:53:45.000000000 +0200
+++ klibc-1.3.19-gst/usr/kinit/ipconfig/main.c	2006-05-21 01:28:23.000000000 +0200
@@ -71,6 +71,7 @@
 		printf(" nisdomain: %-64s\n", dev->nisdomainname);
 	printf(" rootserver: %s ", my_inet_ntoa(dev->ip_server));
 	printf("rootpath: %s\n", dev->bootpath);
+	printf(" filename  : %s\n", dev->filename);
 }
 
 static void configure_device(struct netdev *dev)
@@ -108,6 +109,7 @@
 		fprintf(f, "NISDOMAIN=%s\n", dev->nisdomainname);
 		fprintf(f, "ROOTSERVER=%s\n", my_inet_ntoa(dev->ip_server));
 		fprintf(f, "ROOTPATH=%s\n", dev->bootpath);
+		fprintf(f, "FILENAME=%s\n", dev->filename);
 		fclose(f);
 	}
 }

Reply to: