How to assign static IP?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to assign static IP?

5,621 Views
cengizhanyapici
Contributor I

In my project I use T1024rdb-64b and QorIQ SDK 2.0.I want to assign a static ip to ethaddr0.For this purpose in /home/VIDTM/QorIQ-SDK-V2.0-20160527-yocto/sources/meta-freescale/recipes-core/init-ifupdown directory,I changed  the content of init-ifupdown_%.bbappend file as the following:

FILESEXTRAPATHS_prepend := "${THISDIR}/init-ifupdown:"

In this path I have this:

[lkarakaya@glcentos7 init-ifupdown]$ ls
init-ifupdown  init-ifupdown_%.bbappend
[lkarakaya@glcentos7 init-ifupdown]$ cd init-ifupdown
[lkarakaya@glcentos7 init-ifupdown]$ ls
qoriq
[lkarakaya@glcentos7 init-ifupdown]$ cd qoriq/
[lkarakaya@glcentos7 qoriq]$ ls
interfaces

and in this path I changed the content of interfaces that is in the following:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface

auto lo

iface lo inet loopback

# Wireless interfaces

iface wlan0 inet dhcp

  wireless_mode managed

  wireless_essid any

  wpa-driver wext

  wpa-conf /etc/wpa_supplicant.conf

   

iface atml0 inet dhcp

# Wired or wireless interfaces

auto eth0

iface eth0 inet static

  address 10.254.253.1

  netmask 255.255.255.0

     

iface eth1 inet dhcp

# Ethernet/RNDIS gadget (g_ether)

# ... or on host side, usbnet and random hwaddr

iface usb0 inet static

  address 192.168.7.2

  netmask 255.255.255.0

  network 192.168.7.0

  gateway 192.168.7.1

# Bluetooth networking

iface bnep0 inet dhcp

Then I call the "bitbake fsl-image-core" and then I followed the "Ramdisk Deployment From TFTP" on QorIQ SDK 2.0 REC.Although image was successfully inserted the board.I can not change the ip address and it preserve it's value not assigned a static.

In addition to these,I found another path that includes recipes core that is:

/home/VIDTM/QorIQ-SDK-V2.0-20160527-yocto/sources/poky/meta/recipes-core/init-ifupdown

 

Which one is the true path for T1024 rdb and Why I can not change ip as I wanted?or I have some problems about my image?

After loading the core image,system works truly as in the figure:

Starting OpenBSD Secure Shell server: sshd
  generating ssh RSA key...
  generating ssh ECDSA key...
  generating ssh DSA key...
  generating ssh ED25519 key...
done.
Starting network benchmark server: netserver.
Starting system log daemon...0
Starting kernel log daemon...0
Starting internet superserver: xinetd.

QorIQ SDK (FSL Reference Distro) 2.0 t1024rdb /dev/ttyS0

t1024rdb login: root
root@t1024rdb:~# ifconfig
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Labels (1)
0 Kudos
2 Replies

2,182 Views
Pavel
NXP Employee
NXP Employee

Look at the following page about assigning a static IP in Yocto:

https://community.nxp.com/thread/341117

 

See also the following page about creation a new layer in Yocto:

https://community.nxp.com/docs/DOC-331917

 

There is the second method.

Change file /etc/network/interfaces in your T1024 file system.

Use the following command sequence for file changing in file system:

Add files to rootfs

 

Use the following command sequence for adding file to RAM disk image.

  1. rename your RAM disk image to rootfs.ext2.gz.uboot
  2. sudo apt-get install u-boot-tools

Following are the steps for adding files into rootfilesystem:

 

  1. dd if=rootfs.ext2.gz.uboot of=rootfs.ext2.gz bs=64 skip=1

 

  1. gunzip rootfs.ext2.gz

 

  1. mkdir /mnt/iso_1

 

  1. sudo mount -oloop rootfs.ext2 /mnt/iso_1

 

  1. Now, one can copy files into appropriate location under “./mnt/iso_1” directory.

 

  1. sudo umount /mnt/iso_1

 

  1. gzip -9 rootfs.ext2

 

  1. mkimage -A ppc -O linux -T ramdisk -C gzip -n 'rootfs.ext2.gz.uboot' -d rootfs.ext2.gz rootfs.ext2.gz.uboot

 

+++++++++++++++++++++++

Here are the steps for re-tailoring jffs2 based rootfs

 

  1. Follow steps 1-4 as mentioned above
  2. Execute the following command

   mkfs.jffs2 -b -n -e 0x20000 --pad=0x800 -r mount1/ -o rfs.jffs2

 

rfs.jffs2 will be the jffs2 based file system containing the custom changes made through steps 1-4

As of now, we don't have any plans to switch to ubifs based file system

 

Please note that mkfs.jffs2 binary should be present on the host machine (x86, etc)


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,182 Views
cengizhanyapici
Contributor I

I did the first method and create a new layer.Inside this layer,I followed https://community.nxp.com/thread/341117 as you referenced.For these,I create a new folder called recipes-core like answered in the link.And then I added an init-ifupdown folder. Inside that folder I also insert an init-ifupdown_1.0.bbappend file that contains only;

FILESEXTRAPATHS_prepend := "${THISDIR}/init-ifupdown-1.0:"

 

Then I put a init-ifupdown-1.0 folder that contains my updated interfaces file for yocto to include.This interface is similar to following links:https://community.nxp.com/thread/341117.

And this is the content of my new layer:

[lkarakaya@glcentos7 meta-eru]$ ls
conf  COPYING.MIT  README  recipes-core  recipes-example
[lkarakaya@glcentos7 meta-eru]$ cd recipes-core/
[lkarakaya@glcentos7 recipes-core]$ ls
init-ifupdown
[lkarakaya@glcentos7 recipes-core]$ cd init-ifupdown/
[lkarakaya@glcentos7 init-ifupdown]$ ls
init-ifupdown-1.0  init-ifupdown_1.0.bbappend
[lkarakaya@glcentos7 init-ifupdown]$ cd init-ifupdown-1.0/
[lkarakaya@glcentos7 init-ifupdown-1.0]$ ls
interfaces
[lkarakaya@glcentos7 init-ifupdown-1.0]$

Ater I competed this operation,I call bitbake fsl-image-core again and with my new image,I did "Ramdisk Deployment from TFTP" as stated "SDK 2.0".Then after the "bootm 1000000 5000000 2000000" command board is correctly started.However,when I use "ifconfig" command I see that there is no changing on the ip address.Can I do something missing in this steps.I also looked carefully to creating a new layer new layer's path is :

QorIQ-SDK-V2.0-20160527-yocto/sources/poky/scripts as stated in the previous link that you shared.

I added new layer to configuration file but Is there some configuration file for adding this recipes core?

 
In my default files,I already have QorIQ-SDK-V2.0-20160527-yocto/sources/meta-freescale/recipes-core/init-ifupdown in this path?Is it necessary to create a new layer?Before I asking I change the content of this .bbappend like this:

FILESEXTRAPATHS_prepend := "${THISDIR}/init-ifupdown:"

Other thing is,

$ ls
init-ifupdown  init-ifupdown_%.bbappend

my folder's default name is  init-ifupdown_%.bbappend  and when I want to change it like init-ifupdown_1.0.bbappend and use bitbake fsl-core-image I gave some error.I think this means that recipes core is already inserted the configuration.

What can be the problem about my work?

Thanks for your answer...

0 Kudos