netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* NFS and Network Driver Question
@ 2004-10-15 21:31 Bob Wirka
  2004-10-19 18:03 ` Bob Wirka
  2004-10-20  0:19 ` Bob Wirka
  0 siblings, 2 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-15 21:31 UTC (permalink / raw)
  To: netdev

Hello,

I'm trying to build a kernel that mounts a NFS root file system. This is 
an embedded system; it uses an SMSC LAN91C111 network chip that is 
hardwired to I/O addres 0x300 and IRQ 5. I've been using the driver (as 
supplied by SMSC) as a module, and it works fine. Now I'm trying to 
incorporate it into the kernel build so that I can mount an NFS file 
system when the system boots.

I've added the source code to the kernel tree, and modified the 
Makefile(s) and Config.in files so that the driver <<appears>> to be 
compiled into the kernel. The kernel will load, but the chip is not 
initialized and the NFS fails.

Since I don't know how to pass the io address and irq number to the 
kernel, I've hard-coded them into the driver's init function (which I 
don't see being called).

If someone could point me in the right direction, I'd appreciate it.

Thank you,

Bob Wirka
Realtime Control Works

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-15 21:31 NFS and Network Driver Question Bob Wirka
@ 2004-10-19 18:03 ` Bob Wirka
  2004-10-20  0:19 ` Bob Wirka
  1 sibling, 0 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-19 18:03 UTC (permalink / raw)
  Cc: netdev, linux-net

Please disregard my last post, I believe the problem is solved. Thanks 
again to all, especially Thomas Graf.

The essential things to learn from this exercise are:

1. A network driver compiled into the kernel must have an initialization 
function that allocates the 'net_device' structure and passes this to 
the kernel through the 'register_netdev()' call. You can reuse the 
module-version initialization function; rename it and prefix it's 
declaration with 'static __init'.

2. Add the 'module_init( init_fcn )' macro after the initialization 
function. This will cause the kernel to execute that code when booting.

Onward and upward.

Bob Wirka
Realtime Control Works

Bob Wirka wrote:

> Hello,
>
> I'm trying to build a kernel that mounts a NFS root file system. This 
> is an embedded system; it uses an SMSC LAN91C111 network chip that is 
> hardwired to I/O addres 0x300 and IRQ 5. I've been using the driver 
> (as supplied by SMSC) as a module, and it works fine. Now I'm trying 
> to incorporate it into the kernel build so that I can mount an NFS 
> file system when the system boots.
>
> I've added the source code to the kernel tree, and modified the 
> Makefile(s) and Config.in files so that the driver <<appears>> to be 
> compiled into the kernel. The kernel will load, but the chip is not 
> initialized and the NFS fails.
>
> Since I don't know how to pass the io address and irq number to the 
> kernel, I've hard-coded them into the driver's init function (which I 
> don't see being called).
>
> If someone could point me in the right direction, I'd appreciate it.
>
> Thank you,
>
> Bob Wirka
> Realtime Control Works
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-15 21:31 NFS and Network Driver Question Bob Wirka
  2004-10-19 18:03 ` Bob Wirka
@ 2004-10-20  0:19 ` Bob Wirka
  2004-10-20  0:54   ` Michael Richardson
  2004-10-20 15:58   ` Stephen Hemminger
  1 sibling, 2 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-20  0:19 UTC (permalink / raw)
  Cc: netdev, linux-net

Ok, now I feel like I'm taking crazy pills...

The embedded system boots up and mounts the root file system on my host 
laptop. The 'rc.sysinit' startup script executes the command 'mount -a' 
which should mount /proc, /dev/pts, and /dev/shm, as listed in 
/etc/fstab. When executed, that command returns  "mount: only root can 
do that".

When I get to the bash prompt, 'whoami' reports that I am, indeed, root. 
A 'mount -a' from the command prompt gives the same result; it doesn't 
think I'm root for the mount command.

I can chown a file owned by root to some other user, and I can create a 
file or directory in a directory owned by root; so it doesn't always 
think I'm not root.

Any ideas???

Thanks,

Bob Wirka
Realtime Control Works

Bob Wirka wrote:

> Hello,
>
> I'm trying to build a kernel that mounts a NFS root file system. This 
> is an embedded system; it uses an SMSC LAN91C111 network chip that is 
> hardwired to I/O addres 0x300 and IRQ 5. I've been using the driver 
> (as supplied by SMSC) as a module, and it works fine. Now I'm trying 
> to incorporate it into the kernel build so that I can mount an NFS 
> file system when the system boots.
>
> I've added the source code to the kernel tree, and modified the 
> Makefile(s) and Config.in files so that the driver <<appears>> to be 
> compiled into the kernel. The kernel will load, but the chip is not 
> initialized and the NFS fails.
>
> Since I don't know how to pass the io address and irq number to the 
> kernel, I've hard-coded them into the driver's init function (which I 
> don't see being called).
>
> If someone could point me in the right direction, I'd appreciate it.
>
> Thank you,
>
> Bob Wirka
> Realtime Control Works
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-20  0:19 ` Bob Wirka
@ 2004-10-20  0:54   ` Michael Richardson
  2004-10-20 15:47     ` Bob Wirka
  2004-10-20 15:58   ` Stephen Hemminger
  1 sibling, 1 reply; 10+ messages in thread
From: Michael Richardson @ 2004-10-20  0:54 UTC (permalink / raw)
  To: Bob Wirka; +Cc: netdev, linux-net

-----BEGIN PGP SIGNED MESSAGE-----


>>>>> "Bob" == Bob Wirka <bobwirka@rtcworks.com> writes:
    Bob> Ok, now I feel like I'm taking crazy pills...

    Bob> The embedded system boots up and mounts the root file system on
    Bob> my host laptop. The 'rc.sysinit' startup script executes the
    Bob> command 'mount -a' which should mount /proc, /dev/pts, and
    Bob> /dev/shm, as listed in /etc/fstab. When executed, that command
    Bob> returns "mount: only root can do that".

    Bob> When I get to the bash prompt, 'whoami' reports that I am,
    Bob> indeed, root. A 'mount -a' from the command prompt gives the
    Bob> same result; it doesn't think I'm root for the mount command.

  The mount command is perhaps setuid root, but you aren't mounting the
root file system in a way that permits it to be identified as such.
  Or, the file is in fact not owned by root, and is in fact setuid not-root.

- --
]     "Elmo went to the wrong fundraiser" - The Simpson         |  firewalls  [
]   Michael Richardson,    Xelerance Corporation, Ottawa, ON    |net architect[
] mcr@xelerance.com      http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys

iQCVAwUBQXW3KIqHRg3pndX9AQFERwQAhUpzaFDzVch+W2TEU2SFDtSJZObQ5yZ3
7hhVtiDI5igzO/MHkipXm89LrNnfwSg+6jfMIo8MlWU+nuqHFWiHkrPeWj8jaFmd
QQ+aHhryTn06fyU4UQg1OjEpcHHvo4pLr8lqPwebMjL2JKgk8CM/X2d1N6m9xT+2
Nx8H0Rq84sM=
=Dso2
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-20  0:54   ` Michael Richardson
@ 2004-10-20 15:47     ` Bob Wirka
  0 siblings, 0 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-20 15:47 UTC (permalink / raw)
  To: Michael Richardson; +Cc: netdev, linux-net

[-- Attachment #1: Type: text/plain, Size: 2200 bytes --]

Yes, you are correct; thank you.

So now I've got an embedded x86 system that boots from a (detachable) 
floppy drive to the root file system on my laptop host. Syslinux works 
very well for the boot disk function.

This system is very cool; it will be used to initialize new units in 
production, and for providing a platform for easy debugging of applications.

The lessons learned here will also be used on the embedded ARM projects.

Thanks again to all who have helped.

Best regards,

Bob Wirka
Realtime Control Works

Michael Richardson wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>
>
>  
>
>>>>>>"Bob" == Bob Wirka <bobwirka@rtcworks.com> writes:
>>>>>>            
>>>>>>
>    Bob> Ok, now I feel like I'm taking crazy pills...
>
>    Bob> The embedded system boots up and mounts the root file system on
>    Bob> my host laptop. The 'rc.sysinit' startup script executes the
>    Bob> command 'mount -a' which should mount /proc, /dev/pts, and
>    Bob> /dev/shm, as listed in /etc/fstab. When executed, that command
>    Bob> returns "mount: only root can do that".
>
>    Bob> When I get to the bash prompt, 'whoami' reports that I am,
>    Bob> indeed, root. A 'mount -a' from the command prompt gives the
>    Bob> same result; it doesn't think I'm root for the mount command.
>
>  The mount command is perhaps setuid root, but you aren't mounting the
>root file system in a way that permits it to be identified as such.
>  Or, the file is in fact not owned by root, and is in fact setuid not-root.
>
>- --
>]     "Elmo went to the wrong fundraiser" - The Simpson         |  firewalls  [
>]   Michael Richardson,    Xelerance Corporation, Ottawa, ON    |net architect[
>] mcr@xelerance.com      http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
>] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.2 (GNU/Linux)
>Comment: Finger me for keys
>
>iQCVAwUBQXW3KIqHRg3pndX9AQFERwQAhUpzaFDzVch+W2TEU2SFDtSJZObQ5yZ3
>7hhVtiDI5igzO/MHkipXm89LrNnfwSg+6jfMIo8MlWU+nuqHFWiHkrPeWj8jaFmd
>QQ+aHhryTn06fyU4UQg1OjEpcHHvo4pLr8lqPwebMjL2JKgk8CM/X2d1N6m9xT+2
>Nx8H0Rq84sM=
>=Dso2
>-----END PGP SIGNATURE-----
>
>
>  
>


[-- Attachment #2: Type: text/html, Size: 3131 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-20  0:19 ` Bob Wirka
  2004-10-20  0:54   ` Michael Richardson
@ 2004-10-20 15:58   ` Stephen Hemminger
  2004-10-20 16:03     ` Bob Wirka
  2004-10-21 15:09     ` Bob Wirka
  1 sibling, 2 replies; 10+ messages in thread
From: Stephen Hemminger @ 2004-10-20 15:58 UTC (permalink / raw)
  To: Bob Wirka; +Cc: no To-header on input <unlisted-recipients

Bob Wirka wrote:

> Ok, now I feel like I'm taking crazy pills...
>
> The embedded system boots up and mounts the root file system on my 
> host laptop. The 'rc.sysinit' startup script executes the command 
> 'mount -a' which should mount /proc, /dev/pts, and /dev/shm, as listed 
> in /etc/fstab. When executed, that command returns  "mount: only root 
> can do that".
>
> When I get to the bash prompt, 'whoami' reports that I am, indeed, 
> root. A 'mount -a' from the command prompt gives the same result; it 
> doesn't think I'm root for the mount command.
>
> I can chown a file owned by root to some other user, and I can create 
> a file or directory in a directory owned by root; so it doesn't always 
> think I'm not root.
>
Are you getting bit by the nfs uid mapping on the server. Is it mapping 
your local "root" to "nobody"
on the server?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-20 15:58   ` Stephen Hemminger
@ 2004-10-20 16:03     ` Bob Wirka
  2004-10-21 15:09     ` Bob Wirka
  1 sibling, 0 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-20 16:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, linux-net

No, I was actually taking stupid pills. I had the setuid bit set on 
'mount', and it was owned by 'admin'. I had a number of files and 
directories owned by 'admin' so that I could ftp files in and out of the 
original target system (as admin). It bit me.

Everything seems to be working well now.

Best regards,

Bob Wirka
Realtime Control Works

Stephen Hemminger wrote:

> Bob Wirka wrote:
>
>> Ok, now I feel like I'm taking crazy pills...
>>
>> The embedded system boots up and mounts the root file system on my 
>> host laptop. The 'rc.sysinit' startup script executes the command 
>> 'mount -a' which should mount /proc, /dev/pts, and /dev/shm, as 
>> listed in /etc/fstab. When executed, that command returns  "mount: 
>> only root can do that".
>>
>> When I get to the bash prompt, 'whoami' reports that I am, indeed, 
>> root. A 'mount -a' from the command prompt gives the same result; it 
>> doesn't think I'm root for the mount command.
>>
>> I can chown a file owned by root to some other user, and I can create 
>> a file or directory in a directory owned by root; so it doesn't 
>> always think I'm not root.
>>
> Are you getting bit by the nfs uid mapping on the server. Is it 
> mapping your local "root" to "nobody"
> on the server?
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-20 15:58   ` Stephen Hemminger
  2004-10-20 16:03     ` Bob Wirka
@ 2004-10-21 15:09     ` Bob Wirka
  2004-10-21 15:50       ` Bob Wirka
  2004-10-21 16:17       ` Henrik Nordstrom
  1 sibling, 2 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-21 15:09 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, linux-net

Here is another wrinkle: The program on my embedded system cannot send 
UDP broadcast messages when NFS mounted. When the system is booted 
without NFS (using the DiskOnChip for root file system) I can send UDP 
broadcasts. When the system is booted with NFS (using my laptop for root 
file system) UDP broadcasts result in "Network unreachable" errors, 
though it CAN send directed UDP messages and TCP messages.

The kernel configuration is identical, except for kernel IP 
autoconfiguration, root over nfs, and compiled-in network driver. The 
NFS configuration on the host has 'no_root_squash', and <<now>> all the 
files on the host root file system are owned by root.

Any ideas?

Thanks,

Bob Wirka
Realtime Control Works

Stephen Hemminger wrote:

> Bob Wirka wrote:
>
>> Ok, now I feel like I'm taking crazy pills...
>>
>> The embedded system boots up and mounts the root file system on my 
>> host laptop. The 'rc.sysinit' startup script executes the command 
>> 'mount -a' which should mount /proc, /dev/pts, and /dev/shm, as 
>> listed in /etc/fstab. When executed, that command returns  "mount: 
>> only root can do that".
>>
>> When I get to the bash prompt, 'whoami' reports that I am, indeed, 
>> root. A 'mount -a' from the command prompt gives the same result; it 
>> doesn't think I'm root for the mount command.
>>
>> I can chown a file owned by root to some other user, and I can create 
>> a file or directory in a directory owned by root; so it doesn't 
>> always think I'm not root.
>>
> Are you getting bit by the nfs uid mapping on the server. Is it 
> mapping your local "root" to "nobody"
> on the server?
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-21 15:09     ` Bob Wirka
@ 2004-10-21 15:50       ` Bob Wirka
  2004-10-21 16:17       ` Henrik Nordstrom
  1 sibling, 0 replies; 10+ messages in thread
From: Bob Wirka @ 2004-10-21 15:50 UTC (permalink / raw)
  Cc: Stephen Hemminger, netdev, linux-net

Once again I beg forgiveness for mailing list clutter...

My problem was that I hadn't added a default route. My bad.

Thanks anyway.

Bob Wirka
Realtime Control Works

Bob Wirka wrote:

> Here is another wrinkle: The program on my embedded system cannot send 
> UDP broadcast messages when NFS mounted. When the system is booted 
> without NFS (using the DiskOnChip for root file system) I can send UDP 
> broadcasts. When the system is booted with NFS (using my laptop for 
> root file system) UDP broadcasts result in "Network unreachable" 
> errors, though it CAN send directed UDP messages and TCP messages.
>
> The kernel configuration is identical, except for kernel IP 
> autoconfiguration, root over nfs, and compiled-in network driver. The 
> NFS configuration on the host has 'no_root_squash', and <<now>> all 
> the files on the host root file system are owned by root.
>
> Any ideas?
>
> Thanks,
>
> Bob Wirka
> Realtime Control Works
>
> Stephen Hemminger wrote:
>
>> Bob Wirka wrote:
>>
>>> Ok, now I feel like I'm taking crazy pills...
>>>
>>> The embedded system boots up and mounts the root file system on my 
>>> host laptop. The 'rc.sysinit' startup script executes the command 
>>> 'mount -a' which should mount /proc, /dev/pts, and /dev/shm, as 
>>> listed in /etc/fstab. When executed, that command returns  "mount: 
>>> only root can do that".
>>>
>>> When I get to the bash prompt, 'whoami' reports that I am, indeed, 
>>> root. A 'mount -a' from the command prompt gives the same result; it 
>>> doesn't think I'm root for the mount command.
>>>
>>> I can chown a file owned by root to some other user, and I can 
>>> create a file or directory in a directory owned by root; so it 
>>> doesn't always think I'm not root.
>>>
>> Are you getting bit by the nfs uid mapping on the server. Is it 
>> mapping your local "root" to "nobody"
>> on the server?
>>
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: NFS and Network Driver Question
  2004-10-21 15:09     ` Bob Wirka
  2004-10-21 15:50       ` Bob Wirka
@ 2004-10-21 16:17       ` Henrik Nordstrom
  1 sibling, 0 replies; 10+ messages in thread
From: Henrik Nordstrom @ 2004-10-21 16:17 UTC (permalink / raw)
  To: Bob Wirka; +Cc: Stephen Hemminger, netdev, linux-net

On Thu, 21 Oct 2004, Bob Wirka wrote:

> The kernel configuration is identical, except for kernel IP 
> autoconfiguration, root over nfs, and compiled-in network driver. The NFS 
> configuration on the host has 'no_root_squash', and <<now>> all the files on 
> the host root file system are owned by root.

Double check the routing tables

   ip ro ls table 0

give you all of them...

Regards
Henrik

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-10-21 16:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-15 21:31 NFS and Network Driver Question Bob Wirka
2004-10-19 18:03 ` Bob Wirka
2004-10-20  0:19 ` Bob Wirka
2004-10-20  0:54   ` Michael Richardson
2004-10-20 15:47     ` Bob Wirka
2004-10-20 15:58   ` Stephen Hemminger
2004-10-20 16:03     ` Bob Wirka
2004-10-21 15:09     ` Bob Wirka
2004-10-21 15:50       ` Bob Wirka
2004-10-21 16:17       ` Henrik Nordstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).