cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lim.junhyoung
Adventurer
Adventurer
1,731 Views
Registered: ‎03-27-2019

how to change network interface file.

Jump to solution

i use petalinux 2019.2

when i change network interface file, i modify "project-spec/meta-user/recipes-core/init-ifupdown/init-ifupdown/interfaces" file in petalinux 2018.3.
but in petalinux 2019.2, recipes-core file is not included in meta-user directory. so, I can't modify network interfaces file. because if it is not included in the meta-user directory, it is deleted as build.

how can I modify network interface file?

i have one more question.

if i modify kernel config used "petalinux-config -c kernel", modified kernel file is located "project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_xxx.cfg" in petalinux 2018.3.
but in 2019.2, if i modify kernel config, modified kernel config file is located "project/2019.2_BSP/components/ext_sources/linux-xlnx_2019.1/oe-local-files/devtool-fragment_tmp001.cfg". is this normal?

i both petalinux 2019.2 and 2018.3 used external kernel source.

 

0 Kudos
1 Solution

Accepted Solutions
shirilt
Xilinx Employee
Xilinx Employee
1,681 Views
Registered: ‎05-15-2018

Hi @lim.junhyoung 

In petalinux 2019.2, you can include your custom interfaces file into the rootfs using the following procedure (this is also applicable for 2018.3 petalinux):

1. Create a init-ifupdown directory in meta-user layer as

$ mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-core/init-ifupdown/files

 

2. Create your own network interface file as shown below

$ vim <plnx-proj-root>/project-spec/meta-user/recipes-core/init-ifupdown/files/myinterfaces
  
# myinterfaces content
  
# /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 dhcp
  
# Add auto config for eth1
auto eth1
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
 

3. Create a init_ifupdown_%.bbappend file and add below content

$ vim <plnx-proj-root>/project-spec/meta-user/recipes-core/init-ifupdown/init-ifupdown_%.bbappend
  
# init-ifupdown_%.bbappend content
  
SRC_URI += " \
        file://myinterfaces \
        "
  
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
  
# Overwrite interface file with myinterface file in rootfs
do_install_append() {
     install -m 0644 ${WORKDIR}/myinterfaces ${D}${sysconfdir}/network/interfaces
}
 

4. Rebuild rootfs

$ petalinux-build
 
I've tested the above with 2019.2 petalinux, and found that after booting new images on the board, the /etc/network/interfaces file is updated to reflect the content above.
 
Regarding your second question about petalinux-config -c kernel when using external local source:
 
For 2018.3 petalinux: Any modifications to the kernel config are saved in a separate file (<plnx_proj>/projec-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_%.cfg), and petalinux is instructed to use this file via addition of a line in <plnx_proj>/projec-spec/meta-user/recipes-kernel/linux/linux-xlnx/linux-xlnx_%.bbappend.
 
For 2019.2 petalinux: Unlike 2018.3, modifications to the kernel config are saved directly to a file contained within the external local source directory for the kernel, i.e. <path-to-linux-xlnx>/oe-local-files/devtool-fragment.cfg. This is as expected.
 
Best,
Shiril
---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
shirilt
Xilinx Employee
Xilinx Employee
1,682 Views
Registered: ‎05-15-2018

Hi @lim.junhyoung 

In petalinux 2019.2, you can include your custom interfaces file into the rootfs using the following procedure (this is also applicable for 2018.3 petalinux):

1. Create a init-ifupdown directory in meta-user layer as

$ mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-core/init-ifupdown/files

 

2. Create your own network interface file as shown below

$ vim <plnx-proj-root>/project-spec/meta-user/recipes-core/init-ifupdown/files/myinterfaces
  
# myinterfaces content
  
# /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 dhcp
  
# Add auto config for eth1
auto eth1
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
 

3. Create a init_ifupdown_%.bbappend file and add below content

$ vim <plnx-proj-root>/project-spec/meta-user/recipes-core/init-ifupdown/init-ifupdown_%.bbappend
  
# init-ifupdown_%.bbappend content
  
SRC_URI += " \
        file://myinterfaces \
        "
  
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
  
# Overwrite interface file with myinterface file in rootfs
do_install_append() {
     install -m 0644 ${WORKDIR}/myinterfaces ${D}${sysconfdir}/network/interfaces
}
 

4. Rebuild rootfs

$ petalinux-build
 
I've tested the above with 2019.2 petalinux, and found that after booting new images on the board, the /etc/network/interfaces file is updated to reflect the content above.
 
Regarding your second question about petalinux-config -c kernel when using external local source:
 
For 2018.3 petalinux: Any modifications to the kernel config are saved in a separate file (<plnx_proj>/projec-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_%.cfg), and petalinux is instructed to use this file via addition of a line in <plnx_proj>/projec-spec/meta-user/recipes-kernel/linux/linux-xlnx/linux-xlnx_%.bbappend.
 
For 2019.2 petalinux: Unlike 2018.3, modifications to the kernel config are saved directly to a file contained within the external local source directory for the kernel, i.e. <path-to-linux-xlnx>/oe-local-files/devtool-fragment.cfg. This is as expected.
 
Best,
Shiril
---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------

View solution in original post

0 Kudos
lim.junhyoung
Adventurer
Adventurer
1,661 Views
Registered: ‎03-27-2019

Hi @shirilt 
thank you for reply.

 

 

0 Kudos