NFS and Network Driver Question
Subsystems (2)
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
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
Quoted 16 lines · Bob Wirka
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
0x300and 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
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
Quoted 16 lines · Bob Wirka
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
0x300and 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
-----BEGIN PGP SIGNED MESSAGE-----
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Bob" == Bob Wirka <[email protected]> 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[ ] [email protected] 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-----
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
Quoted 43 lines · Michael Richardson
-----BEGIN PGP SIGNED MESSAGE-----
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
"Bob" == Bob Wirka <[email protected]> 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[ ] [email protected] 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 keysiQCVAwUBQXW3KIqHRg3pndX9AQFERwQAhUpzaFDzVch+W2TEU2SFDtSJZObQ5yZ3 7hhVtiDI5igzO/MHkipXm89LrNnfwSg+6jfMIo8MlWU+nuqHFWiHkrPeWj8jaFmd QQ+aHhryTn06fyU4UQg1OjEpcHHvo4pLr8lqPwebMjL2JKgk8CM/X2d1N6m9xT+2 Nx8H0Rq84sM=
=Dso2
-----END PGP SIGNATURE-----
Quoted 8 lines · Bob Wirka
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?
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
Quoted 13 lines · Stephen Hemminger
Quoted 8 lines · Bob Wirka
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?
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
Quoted 13 lines · Stephen Hemminger
Quoted 8 lines · Bob Wirka
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?
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
Quoted 29 lines · Bob Wirka
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 WorksQuoted 13 lines · Stephen Hemminger
Quoted 8 lines · Bob Wirka
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?
Quoted 1 line · Bob Wirka
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