Build error: RAMIPS MT76x8 build fails on MT7603 driver

I'm working on getting OpenWRT to support a chinese device (COMFAST) and the chipset is a MT7628. I am working on the master (development) branch of OpenWRT (mostlly because it has support for the flash chip on the device without me having to hack it in). GIT was updated today, and this isn't the first time I've had this issue.

I've enabled the MT7603 kernel driver, and I get the following compile error:

6734/mt76x02-lib.o
  CC [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt76x02_usb_mcu.o
  CC [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt76x02_usb_core.o
  LD [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt76x02-usb.o
  CC [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/usb.o
  CC [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/usb_trace.o
  LD [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt76-usb.o
  CC [M]  /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603/pci.o
<command-line>:0:37: error: redeclaration of enumerator 'IEEE80211_HW_REPORTS_TX_ACK_STATUS'
<command-line>:0:37: note: in definition of macro 'IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN'
In file included from /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603/../mt76.h:27:0,
                 from /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603/mt7603.h:8,
                 from /home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603/pci.c:7:
/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include/mac80211/net/mac80211.h:2167:2: note: previous definition of 'IEEE80211_HW_REPORTS_TX_ACK_STATUS' was here
  IEEE80211_HW_REPORTS_TX_ACK_STATUS,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.build:326: recipe for target '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603/pci.o' failed
make[6]: *** [/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603/pci.o] Error 1
scripts/Makefile.build:585: recipe for target '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603' failed
make[5]: *** [/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/mt7603] Error 2
Makefile:1533: recipe for target '_module_/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734' failed
make[4]: *** [_module_/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734] Error 2
make[4]: Leaving directory '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.113'
Makefile:236: recipe for target '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/.built' failed
make[3]: *** [/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/mt76-2019-03-27-a11b6734/.built] Error 2
make[3]: Leaving directory '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/package/kernel/mt76'
time: package/kernel/mt76/compile#9.57#1.39#10.63
package/Makefile:107: recipe for target 'package/kernel/mt76/compile' failed
make[2]: *** [package/kernel/mt76/compile] Error 2
make[2]: Leaving directory '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt'
package/Makefile:103: recipe for target '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile' failed
make[1]: *** [/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt'
/home/mbuckaway/src/kidswifi/openwrt-imagebuilder/builds/cf-wr754ac/openwrt/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2

If would appear that the driver is re-defining a define already in the WIFI code.

The quick fix is to disable the MT7603 driver, and everything builds.

What's the process of submitting a "bug" report? Or is there a patch already? I have a work-around, but the issue should be corrected. If this is in a FAQ somewhere, pls point me to it.

git branch | git pull && ./scripts/feeds update etc.....
make clean/distclean
ignore errors

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem

Thanks for the response.

Yes, I've done all that several times. Ignoring errors might work around the problem, but that does not mean the mt7603 driver module compiles...it just ignores the errors in the build. What I am looking to do is get it fixed and/or report the issue to the maintainer (assuming I don't manage to fix it myself).

ok, your OP was a tad ambiguous..... if you've used git branch... the source works, then stops working.... to my understanding, we are missing a step in your chain here....

  1. I read your initial post to mean that your "buildroot" source is working then breaks.... when updates occur...

  2. It seems that "GIT was updated today" needs to be elaborated on.

  3. Also confirm that this error occurs when using the buildroot with supported target in unmodified form.

  4. "this isn't the first time I've had this issue"

What fixed it for you last time?

This is not really a bug. One of the patches seems to have caused the issue. However, I can't be the only one. It's a simple redefinition of a define....

I read your initial post to mean that your "buildroot" source is working then breaks.... when updates occur...

I can do a make distclean or a few checkout, and the same issue happens.

It seems that "GIT was updated today" needs to be elaborated on.

I did a 'get pull" yesterday to get the latest code, ran feeds update -a, feeds update -u, etc.

Also confirm that this error occurs when using the buildroot with supported target in unmodified form.

I've made no modifications. The issue happens if and only if I enable the MT7603 driver.

"this isn't the first time I've had this issue"
Back to 1. If I disable the MT7603 driver, the build will work and compile cleanly. I've used disabled the mt7603 driver to be able to test the build on the device. However, it now appears I actually need that driver.

1 Like

ok, now i'm catching on.

COMFAST ? ( all chipset numbers or similar )
SUBTARGET you've been using?

COMFAST WR754AC. It's not currently supported, but uses a MT7628 SOC and a MT7612 chip on the PCI bus. It is running OpenWRT 15. For our project, I'm using OpenWRT 18.

I've added a subtarget to mt76x8.mk and create a DTS (based on what COMFAST sent me - I'm working with them).

Thus:
TARGET=CF-WR754AC
PLATFORM=ramips
CHIP=mt76x8

The only changes to the source tree is the two files. The rest is stock from the master branch.

Currently, the image I've generated flashes and boots....however, I'm missing a driver for the WIFI part of the MT7628. Thus, I'm attempting to include the entire MT76 driver package....and the MT7603 driver will not build.

Hello @mbuckaway. Did you manage to build OpneWRT for that device? I have that repeater and would like o install OpenWRT. Thanks.

Can I see .dts for CF-WR754AC? I want to buy this device and assemble a normal OpenWRT

Hey @klazarev, I was having troubles with the stock firmware, so I decided to install the OpenWRT build that was design for Wavlink wl-wn575a3 (It has the same components). ¡It worked! After a mild heart attack (thought device was bricked) it worked like a charm.

I downloaded this realese:
wavlink_wl-wn575a3-squashfs-sysupgrade.bin

They differ slightly in hardware (LEDs, buttons ...) Here is his .dts, with which the working firmware is going

/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>

#include "mt7628an.dtsi"

/ {
        compatible = "comfast,cf-wr754ac", "mediatek,mt7628an-soc";
        model = "Comfast CF-WR754AC";

        aliases {
                led-boot = &led_wifi0;
                led-failsafe = &led_wifi1;
                led-upgrade = &led_wifi2;
        };

        chosen {
                bootargs = "console=ttyS0,57600";
        };

        memory@0 {
                device_type = "memory";
                reg = <0x0 0x4000000>;
        };

        keys {
                compatible = "gpio-keys-polled";
                poll-interval = <20>;

                reset {
                        label = "reset";
                        gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_RESTART>;
                };

                wps {
                        label = "wps";
                        gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WPS_BUTTON>;
                };

                change_mode0 {
                        label = "change_mode0";
                        gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
                        linux,code = <BTN_0>;
                };

                change_mode1 {
                        label = "change_mode1";
                        gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
                        linux,code = <BTN_1>;
                };
        };

        leds {
                compatible = "gpio-leds";

                led_wifi2: wifi-high {
                        label = "comfast:blue:wifi-high";
                        gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
                };

                led_wifi1: wifi-med {
                        label = "comfast:blue:wifi-med";
                        gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
                };

                led_wifi0: wifi-low {
                        label = "comfast:blue:wifi-low";
                        gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                };
        };
};

&pinctrl {
        state_default: pinctrl0 {
                gpio {
                        ralink,group = "i2c", "wled_an", "gpio", "refclk", "wdt", "p0led_an";
                        ralink,function = "gpio";
                };
        };
};

&pcie {
        status = "okay";
};

&pcie0 {
        mt76@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                ieee80211-freq-limit = <5000000 6000000>;
        };
};

&spi0 {
        status = "okay";

        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x30000>;
                                read-only;
                        };

                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
                                read-only;
                        };

                        factory: partition@40000 {
                                label = "factory";
                                reg = <0x40000 0x10000>;
                                read-only;
                        };

                        partition@50000 {
                                compatible = "denx,uimage";
                                label = "firmware";
                                reg = <0x50000 0x7b0000>;
                        };
                };
        };
};

&wmac {
        status = "okay";
};

&ethernet {
        mtd-mac-address = <&factory 0x28>;
        mediatek,portmap = "llllw";
};

Hi mbuckaway,

did you manage to build Openwrt the device Comfast CF-WR754AC?
I would like to install Openwrt on it.

Thanks.

If you want to discuss adding OpenWrt support for CF-WR754AC, please open a new topic "Adding OpenWrt support for CF-WR754AC" in the developers section of the forum.

Thanks!

Hello, with CF-WR754AC works firmware from WAVLINK WL-WN575A3

Good day!
I have added the thread in the forum. Maybe you want to look there!
https://forum.openwrt.org/t/ramips-adding-openwrt-support-for-comfast-cf-wr754ac/99233/2

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.