how to bring network up at boot time in linux
Solution 1:
Yes, the Linux kernel can activate eth0 interface without resorting to user space scripts.
You can use the ip=
kernel boot parameter to initialize the network interface with a static IP address, for example:
ip=192.168.1.100:::255.255.255.0:myboard:eth0:on
Of course, the eth0 interface cannot be enabled until drivers have been initialized/installed (as indicated by the freeing of the __init
section of memory).
Here's the system log to show when the network interface becomes active:
eth0: link down
IP-Config: Complete:
device=eth0, addr=192.168.1.100, mask=255.255.255.0, gw=255.255.255.255,
host=myboard, domain=, nis-domain=(none),
bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
Freeing init memory: 564K
remounting / read-write... done.
mounting /proc... done.
mounting /sys... done.
Creating device nodes manually, running /sbin/makenodes-2.6
eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
Done.
mounting /home... MTDSB: dev_name "/dev/mtdblock3"
Complete details on the syntax of the ip=
boot parameter are in Documentation/filesystems/nfs/nfsroot.txt. Ignore the fact that the original purpose of this capability was to facilitate a networked root filesystem.
I passed ip= and eth= u-boot environment variables to the linux kernel as bootargs
eth=
is not a valid boot parameter, and is probably ignored by the kernel.
BTW If you're using Atmel's macb.c
driver, then ensure that U-Boot installs the MAC address for the PHY for this to work.