[yocto] how to set static ip in linux

Constantin, Costin C costin.c.constantin at intel.com
Tue Dec 16 02:08:49 PST 2014


Hello Sachin

The easiest way to do this is by modifying the install script. Here is how:
Suppose you cloned poky into a local dir. on your HDD drive. I use Ubuntu for this but you can use whatever certified OS (Fedora, Centos, OpenSuse) just:

$ cd your_local_poky_dir
$ gedit meta/recipes-core/initrdscripts/files/init-install.sh
...
#before the line containing "umount /tgt_root"   add the following
# interface=$(ls /sys/class/net | grep eth)
# echo "ifconfig $interface your_desired_ip netmask 255.255.255.0 up" >> /tgt_root/etc/profile
#eg.:
interface=$(ls /sys/class/net | grep eth)
echo "ifconfig $interface 10.10.10.10 netmask 255.255.255.0 up" >> /tgt_root/etc/profile
#after this comes
umount /tgt_root
...

Regards,

Costin Constantin
Yocto QA team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20141216/21f30cfa/attachment.html>


More information about the yocto mailing list