diff -u -r linux-kernel/fs/Config.in linux-nfsrot/fs/Config.in --- linux-kernel/fs/Config.in Tue Jul 3 05:03:04 2001 +++ linux-nfsrot/fs/Config.in Sat Aug 25 00:43:01 2001 @@ -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 diff -u -r linux-kernel/fs/nfs/nfsroot.c linux-nfsrot/fs/nfs/nfsroot.c --- linux-kernel/fs/nfs/nfsroot.c Fri Aug 17 00:55:52 2001 +++ linux-nfsrot/fs/nfs/nfsroot.c Sat Aug 25 00:40:32 2001 @@ -82,6 +82,7 @@ #include #include #include +#include /* 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); Only in linux-nfsrot/include/linux: nfsroot.h diff -u -r linux-kernel/include/net/ipconfig.h linux-nfsrot/include/net/ipconfig.h --- linux-kernel/include/net/ipconfig.h Wed May 2 11:59:24 2001 +++ linux-nfsrot/include/net/ipconfig.h Fri Aug 24 23:14:20 2001 @@ -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 */ + diff -u -r linux-kernel/net/core/dev.c linux-nfsrot/net/core/dev.c --- linux-kernel/net/core/dev.c Fri Aug 17 00:56:10 2001 +++ linux-nfsrot/net/core/dev.c Fri Aug 24 18:50:11 2001 @@ -2818,3 +2818,5 @@ return call_usermodehelper(argv [0], argv, envp); } #endif + +EXPORT_SYMBOL(dev_change_flags); diff -u -r linux-kernel/net/ipv4/Config.in linux-nfsrot/net/ipv4/Config.in --- linux-kernel/net/ipv4/Config.in Wed May 2 11:59:24 2001 +++ linux-nfsrot/net/ipv4/Config.in Fri Aug 24 18:11:09 2001 @@ -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 diff -u -r linux-kernel/net/ipv4/ipconfig.c linux-nfsrot/net/ipv4/ipconfig.c --- linux-kernel/net/ipv4/ipconfig.c Wed May 2 11:59:24 2001 +++ linux-nfsrot/net/ipv4/ipconfig.c Sat Aug 25 00:22:11 2001 @@ -54,6 +54,8 @@ #include #include +#include /* Specifically, a module */ + /* Define this to allow debugging output */ #undef IPCONFIG_DEBUG @@ -98,12 +100,12 @@ * variabled using firmware environment vars. If this is set, it will * ignore such firmware variables. */ -int ic_set_manually __initdata = 0; /* IPconfig parameters set manually */ +int ic_set_manually = 0; /* IPconfig parameters set manually */ -int ic_enable __initdata = 0; /* IP config enabled? */ +int ic_enable = 0; /* IP config enabled? */ /* Protocol choice */ -int ic_proto_enabled __initdata = 0 +int ic_proto_enabled = 0 #ifdef IPCONFIG_BOOTP | IC_BOOTP #endif @@ -115,16 +117,13 @@ #endif ; -int ic_host_name_set __initdata = 0; /* Host name set by us? */ - -u32 ic_myaddr __initdata = INADDR_NONE; /* My IP address */ -u32 ic_netmask __initdata = INADDR_NONE; /* Netmask for local subnet */ -u32 ic_gateway __initdata = INADDR_NONE; /* Gateway IP address */ +int ic_host_name_set = 0; /* Host name set by us? */ -u32 ic_servaddr __initdata = INADDR_NONE; /* Boot server IP address */ +u32 ic_myaddr = INADDR_NONE; /* My IP address */ +u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */ +u32 ic_gateway = INADDR_NONE; /* Gateway 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 ic_servaddr = INADDR_NONE; /* Boot server IP address */ /* Persistent data: */ @@ -137,17 +136,17 @@ */ /* Name of user-selected boot device */ -static char user_dev_name[IFNAMSIZ] __initdata = { 0, }; +static char user_dev_name[IFNAMSIZ] = { 0, }; /* Protocols supported by available interfaces */ -static int ic_proto_have_if __initdata = 0; +static int ic_proto_have_if = 0; #ifdef IPCONFIG_DYNAMIC static spinlock_t ic_recv_lock = SPIN_LOCK_UNLOCKED; -static volatile int ic_got_reply __initdata = 0; /* Proto(s) that replied */ +static volatile int ic_got_reply = 0; /* Proto(s) that replied */ #endif #ifdef IPCONFIG_DHCP -static int ic_dhcp_msgtype __initdata = 0; /* DHCP msg type received */ +static int ic_dhcp_msgtype = 0; /* DHCP msg type received */ #endif @@ -163,10 +162,10 @@ u32 xid; }; -static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ -static struct net_device *ic_dev __initdata = NULL; /* Selected device */ +static struct ic_device *ic_first_dev = NULL;/* List of open device */ +static struct net_device *ic_dev = NULL; /* Selected device */ -static int __init ic_open_devs(void) +static int ic_open_devs(void) { struct ic_device *d, **last; struct net_device *dev; @@ -224,7 +223,7 @@ return 0; } -static void __init ic_close_devs(void) +static void ic_close_devs(void) { struct ic_device *d, *next; struct net_device *dev; @@ -255,7 +254,7 @@ sin->sin_port = port; } -static int __init ic_dev_ioctl(unsigned int cmd, struct ifreq *arg) +static int ic_dev_ioctl(unsigned int cmd, struct ifreq *arg) { int res; @@ -266,7 +265,7 @@ return res; } -static int __init ic_route_ioctl(unsigned int cmd, struct rtentry *arg) +static int ic_route_ioctl(unsigned int cmd, struct rtentry *arg) { int res; @@ -281,7 +280,7 @@ * Set up interface addresses and routes. */ -static int __init ic_setup_if(void) +static int ic_setup_if(void) { struct ifreq ir; struct sockaddr_in *sin = (void *) &ir.ifr_ifru.ifru_addr; @@ -307,7 +306,7 @@ return 0; } -static int __init ic_setup_routes(void) +static int ic_setup_routes(void) { /* No need to setup device routes, only the default route... */ @@ -337,7 +336,7 @@ * Fill in default values for all missing parameters. */ -static int __init ic_defaults(void) +static int ic_defaults(void) { /* * At this point we have no userspace running so need not @@ -376,7 +375,7 @@ static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); -static struct packet_type rarp_packet_type __initdata = { +static struct packet_type rarp_packet_type = { type: __constant_htons(ETH_P_RARP), func: ic_rarp_recv, }; @@ -394,7 +393,7 @@ /* * Process received RARP packet. */ -static int __init +static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) { struct arphdr *rarp = (struct arphdr *)skb->h.raw; @@ -466,7 +465,7 @@ /* * Send RARP request packet over a signle interface. */ -static void __init ic_rarp_send_if(struct ic_device *d) +static void ic_rarp_send_if(struct ic_device *d) { struct net_device *dev = d->dev; arp_send(ARPOP_RREQUEST, ETH_P_RARP, 0, dev, 0, NULL, @@ -516,7 +515,7 @@ static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); -static struct packet_type bootp_packet_type __initdata = { +static struct packet_type bootp_packet_type = { type: __constant_htons(ETH_P_IP), func: ic_bootp_recv, }; @@ -530,7 +529,7 @@ #ifdef IPCONFIG_DHCP -static void __init +static void ic_dhcp_init_options(u8 *options) { u8 mt = ((ic_servaddr == INADDR_NONE) @@ -583,7 +582,7 @@ #endif /* IPCONFIG_DHCP */ -static void __init ic_bootp_init_ext(u8 *e) +static void ic_bootp_init_ext(u8 *e) { memcpy(e, ic_bootp_cookie, 4); /* RFC1048 Magic Cookie */ e += 4; @@ -630,7 +629,7 @@ /* * Send DHCP/BOOTP request to single interface. */ -static void __init ic_bootp_send_if(struct ic_device *d, u32 jiffies) +static void ic_bootp_send_if(struct ic_device *d, u32 jiffies) { struct net_device *dev = d->dev; struct sk_buff *skb; @@ -701,7 +700,7 @@ /* * Copy BOOTP-supplied string if not already set. */ -static int __init ic_bootp_string(char *dest, char *src, int len, int max) +static int ic_bootp_string(char *dest, char *src, int len, int max) { if (!len) return 0; @@ -716,7 +715,7 @@ /* * Process BOOTP extensions. */ -static void __init ic_do_bootp_ext(u8 *ext) +static void ic_do_bootp_ext(u8 *ext) { #ifdef IPCONFIG_DEBUG u8 *c; @@ -748,8 +747,8 @@ ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain)); break; case 17: /* Root path */ - if (!root_server_path[0]) - ic_bootp_string(root_server_path, ext+1, *ext, sizeof(root_server_path)); + if (!root_server_path[0]) + ic_bootp_string(root_server_path, ext+1, *ext, sizeof(u8) *256); break; case 40: /* NIS Domain name (_not_ DNS) */ ic_bootp_string(system_utsname.domainname, ext+1, *ext, __NEW_UTS_LEN); @@ -761,7 +760,7 @@ /* * Receive BOOTP reply. */ -static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) +static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) { struct bootp_pkt *b = (struct bootp_pkt *) skb->nh.iph; struct iphdr *h = &b->iph; @@ -915,7 +914,7 @@ #ifdef IPCONFIG_DYNAMIC -static int __init ic_dynamic(void) +static int ic_dynamic(void) { int retries; struct ic_device *d; @@ -1084,7 +1083,7 @@ * IP Autoconfig dispatcher. */ -static int __init ip_auto_config(void) +static int ip_auto_config(void) { int retries = CONF_OPEN_RETRIES; unsigned long jiff; @@ -1094,7 +1093,7 @@ #endif /* CONFIG_PROC_FS */ if (!ic_enable) - return 0; + return 0; DBG(("IP-Config: Entered.\n")); @@ -1182,9 +1181,9 @@ * autoconfigured and set up routes. */ ic_close_devs(); - if (ic_setup_if() < 0 || ic_setup_routes() < 0) - return -1; - + if (ic_setup_if() < 0 || ic_setup_routes() < 0) { + //return -1; + } /* * Record which protocol was actually used. */ @@ -1208,11 +1207,10 @@ printk(", rootpath=%s", root_server_path); printk("\n"); #endif /* !SILENT */ - return 0; } -module_init(ip_auto_config); +//module_init(ip_auto_config); /* @@ -1237,7 +1235,7 @@ * dhcp|bootp|rarp - use only the specified protocol * both - use both BOOTP and RARP (not DHCP) */ -static int __init ic_proto_name(char *name) +static int ic_proto_name(char *name) { if (!strcmp(name, "on") || !strcmp(name, "any")) { return 1; @@ -1269,7 +1267,7 @@ return 0; } -static int __init ip_auto_config_setup(char *addrs) +static int ip_auto_config_setup(char *addrs) { char *cp, *ip, *dp; int num = 0; @@ -1335,10 +1333,26 @@ return 1; } -static int __init nfsaddrs_config_setup(char *addrs) +static int nfsaddrs_config_setup(char *addrs) { return ip_auto_config_setup(addrs); } __setup("ip=", ip_auto_config_setup); __setup("nfsaddrs=", nfsaddrs_config_setup); + +int init_module(void) +{ +#ifdef MODULE + ic_enable = 1; +#endif + ip_auto_config(); + // nfsaddrs_config_setup("ip=dhcp"); + return 0; +} + +int cleanup_module(voi) +{ + proc_net_remove("pnp"); + return 0; +}