Skip to contentSkip to conversation

A patch for dhcp and nfsroot.

PATCH hugang 2 participants 2 messages Aug 29, 2001 – Sep 13, 2001

Subsystems (4)
lore
Share & tools
lore

hugang

author
#0 lore raw

Alan Cox:
Hello.

This is my first kernel patch . It change the kernel dhcp auto config to module. So we can dynamic insmod the net card before insmod dhcp .This is useful to disaster recover linux.

Signature · 11 lines
Best Regard!
礼!
----------------------------------------------------
hugang : 胡刚 	GNU/Linux User
email  : [email protected] [email protected]
Tel    : +861068425741/2/3/4
Web    : http://www.soul.com.cn

	Beijing Soul technology Co.Ltd.
	   北京众志和达科技有限公司
----------------------------------------------------
fs/Config.in +1 -1
diff -u -r linux-kernel/fs/Config.in linux-nfsrot/fs/Config.in
@@ -80,7 +80,7 @@
    dep_tristate 'Coda file system support (advanced network fs)' CONFIG_CODA_FS $CONFIG_INET
    dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
    dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
-   dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
+   dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS
 
    dep_tristate 'NFS server support' CONFIG_NFSD $CONFIG_INET
    dep_mbool '  Provide NFSv3 server support' CONFIG_NFSD_V3 $CONFIG_NFSD
fs/nfs/nfsroot.c +5 -0
diff -u -r linux-kernel/fs/nfs/nfsroot.c linux-nfsrot/fs/nfs/nfsroot.c
@@ -82,6 +82,7 @@
 #include <linux/major.h>
 #include <linux/utsname.h>
 #include <net/ipconfig.h>
+#include <linux/module.h>
 
 /* Define this to allow debugging output */
 #undef NFSROOT_DEBUG
@@ -104,6 +105,8 @@
 static int nfs_port __initdata = 0;		/* Port to connect to for NFS */
 static int mount_port __initdata = 0;		/* Mount daemon port number */
 
+u32 root_server_addr __initdata  = INADDR_NONE;     /* Address of NFS server */
+u8 root_server_path[256] __initdata = { 0, } ;      /* Path to mount as root */
 
 /***************************************************************************
 
@@ -464,3 +467,5 @@
 	set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port);
 	return (void*)&nfs_data;
 }
+EXPORT_SYMBOL(root_server_addr);
+EXPORT_SYMBOL(root_server_path);
include/net/ipconfig.h +2 -1
diff -u -r linux-kernel/include/net/ipconfig.h linux-nfsrot/include/net/ipconfig.h
@@ -21,7 +21,7 @@
 extern u32 ic_servaddr;		/* Boot server IP address */
 
 extern u32 root_server_addr;	/* Address of NFS server */
-extern u8 root_server_path[];	/* Path to mount as root */
+extern u8 root_server_path[256];	/* Path to mount as root */
 
 
 
@@ -36,3 +36,4 @@
 #define IC_BOOTP	0x01	/*   BOOTP (or DHCP, see below) */
 #define IC_RARP		0x02	/*   RARP */
 #define IC_USE_DHCP    0x100	/* If on, use DHCP instead of BOOTP */
+
net/core/dev.c +2 -0
diff -u -r linux-kernel/net/core/dev.c linux-nfsrot/net/core/dev.c
@@ -2818,3 +2818,5 @@
 	return call_usermodehelper(argv [0], argv, envp);
 }
 #endif
+
+EXPORT_SYMBOL(dev_change_flags);
net/ipv4/Config.in +2 -2
diff -u -r linux-kernel/net/ipv4/Config.in linux-nfsrot/net/ipv4/Config.in
@@ -18,8 +18,8 @@
    bool '    IP: verbose route monitoring' CONFIG_IP_ROUTE_VERBOSE
    bool '    IP: large routing tables' CONFIG_IP_ROUTE_LARGE_TABLES
 fi
-bool '  IP: kernel level autoconfiguration' CONFIG_IP_PNP
-if [ "$CONFIG_IP_PNP" = "y" ]; then
+tristate '  IP: kernel level autoconfiguration' CONFIG_IP_PNP
+if [ "$CONFIG_IP_PNP" != "n"  ]; then
    bool '    IP: DHCP support' CONFIG_IP_PNP_DHCP
    bool '    IP: BOOTP support' CONFIG_IP_PNP_BOOTP
    bool '    IP: RARP support' CONFIG_IP_PNP_RARP
net/ipv4/ipconfig.c +11 -3
diff -u -r linux-kernel/net/ipv4/ipconfig.c linux-nfsrot/net/ipv4/ipconfig.c
@@ -123,8 +123,8 @@
 
 u32 ic_servaddr __initdata = INADDR_NONE;	/* Boot server IP address */
 
-u32 root_server_addr __initdata = INADDR_NONE;	/* Address of NFS server */
-u8 root_server_path[256] __initdata = { 0, };	/* Path to mount as root */
+//u32 root_server_addr __initdata = INADDR_NONE;	/* Address of NFS server */
+//u8 root_server_path[256] __initdata = { 0, };	/* Path to mount as root */
 
 /* Persistent data: */
 
@@ -1212,7 +1212,7 @@
 	return 0;
 }
 
-module_init(ip_auto_config);
+//module_init(ip_auto_config);
 
 
 /*
@@ -1340,5 +1340,13 @@
 	return ip_auto_config_setup(addrs);
 }
 
+int init_module(void)
+{
+#ifdef MODULE
+  ic_enable = 1;
+#endif
+  ip_auto_config();
+  return 0;
+}
 __setup("ip=", ip_auto_config_setup);
 __setup("nfsaddrs=", nfsaddrs_config_setup);
#1 lore raw

Anyone tried this yet? I've tried it on 2.4.9-ac8, but the module complains of not being able find the kernel it was built for.

Quoted 18 lines · hugang

Alan Cox:
Hello.

This is my first kernel patch . It change the kernel dhcp auto config to module. So we can dynamic insmod the net card before insmod dhcp .This is useful to disaster recover linux.

--
Best Regard!
��
----------------------------------------------------
hugang : ���� GNU/Linux User
email : [email protected] [email protected]
Tel : +861068425741/2/3/4
Web : http://www.soul.com.cn

Beijing Soul technology Co.Ltd.
������־�ʹ�Ƽ����޹�˾
----------------------------------------------------