# Yocto based on OpenWrt

**URL:** <https://forum.openwrt.org/t/yocto-based-on-openwrt/15073>\
**Category:** Installing and Using OpenWrt\
**Created:** [May 30, 2018, 3:29pm UTC](https://forum.openwrt.org/t/yocto-based-on-openwrt/15073 "2018-05-30T15:29:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joao.oliveira](https://forum.openwrt.org/letter_avatar/joao.oliveira/32/5_5575768a8748004e209b776fc1b2916d.png) [@joao.oliveira](https://forum.openwrt.org/u/joao.oliveira)\
**Post date:** [May 30, 2018, 3:29pm UTC](https://forum.openwrt.org/t/yocto-based-on-openwrt/15073/1 "2018-05-30T15:29:06Z")

</div>

Hi all,

I have been working on a project where we are using the Omega2+ with the power and ethernet addons.

Since this board is to be added to a Yocto based project, I can't use the mainline or Onion OpenWRT builds so I've been trying to create a meta to support the Omega2+. To do that, I extracted the Linux 4.14.43 kernel source and device tree from the latest OpenWRT.

I have successfully built an kernel, initramfs and rootfs and booted them using the web updater from the UBoot and a sd-card. The kernel configuration was extracted from the OpenWRT and modified to my requirements (mainly, systemd, ext2/4 filesystem support and removed wireless stuff). The defconfig can be found [here](https://pastebin.com/56F5qgqA).

The problem is with the ethernet port. I can't make it work, I always get the following messages:

```
[6186.097454] mtk_soc_eth 10100000.ethernet eth0: transmit timed out
[6186.103746] mtk_soc_eth 10100000.ethernet eth0: dma_cfg:00000057
[6186.109874] mtk_soc_eth 10100000.ethernet eth0: tx_ring=0, base=07f8c000, max=1024, ctx=3, dtx=0, fdx=0, next=3
[6186.120125] mtk_soc_eth 10100000.ethernet eth0: rx_ring=0, base=07220000, max=1024, calc=1023, drx=0

```

I saw some reports of this issue in the web ([here](https://bugs.openwrt.org/index.php?do=details&task_id=1333)) but without a clear resolution.

I confirmed the internal switch configuration with swconfig and I see no differences to the mainline or Onion OpenWRT builds.

Strange enough, I can see RX packets arriving to the board correctly (with tcpdump and by pinging) but no TX packets are leaving. ifconfig reports an high packet error:

```
eth0 Link encap:Ethernet HWaddr 40:A3:6B:C1:AD:1D  
          inet addr:192.168.8.8 Bcast:0.0.0.0 Mask:255.255.255.0
          inet6 addr: fe80::42a3:6bff:fec1:ad1d%2012397072/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59 errors:34 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6948 (6.7 KiB) TX bytes:10836 (10.5 KiB)
          Interrupt:5 

```

I'm using systemd-networkd to configure the interface:

```
[Match]
Name=eth0

[Network]
DHCP=ipv4

[DHCP]
UseDomains=true

[Link]
MACAddress=40:a3:6b:c1:ad:1d

```

Can someone help me out?

---

<div class="post-metadata">

**Author:** ![joao.oliveira](https://forum.openwrt.org/letter_avatar/joao.oliveira/32/5_5575768a8748004e209b776fc1b2916d.png) [@joao.oliveira](https://forum.openwrt.org/u/joao.oliveira)\
**Post date:** [June 6, 2018, 4:16pm UTC](https://forum.openwrt.org/t/yocto-based-on-openwrt/15073/2 "2018-06-06T16:16:50Z")

</div>

For anyone with this problem, the switch **must** be configured before bringing up eth0.

These commands are needed for everything to work:

```
swconfig dev switch0 set reset 1
swconfig dev switch0 set enable_vlan 0
swconfig dev switch0 set apply 1

```

Cheers!
