OpenWrt support for Comfast CF-WR617AC

Hi all. I want to install openwrt in Router Comfast wr617AC. This device has the characteristics:

  • MT7628DAN + MT7612EN
  • 16 MB flash
  • 64 MB Ram
  • 4 ports 100Mb/s ethernet (1 WAN + 3 LAN)

but i do not know which firmware it could be? As I see on the openwrt website, it could be the TOTOLINK LR1200, but it has 5 ports and only 8 MB flash. Could i use this firmware?
attached images of the device

Hi, I connected via ssh and obtained the following information:

**root@COMFAST:/etc# cat /proc/cpuinfo** 
system type		: Ralink MT7628AN ver:1 eco:2
machine			: Comfast CF-WR617AC
processor		: 0
cpu model		: MIPS 24KEc V5.5
BogoMIPS		: 385.84
wait instruction	: yes
microsecond timers	: yes
tlb_entries		: 32
extra interrupt vector	: yes
hardware watchpoint	: yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa			: mips1 mips2 mips32r1 mips32r2
ASEs implemented	: mips16 dsp
shadow register sets	: 1
kscratch registers	: 0
package			: 0
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

**root@COMFAST:/etc# cat board.json** 
{
	"led": {
		"wifi_led": {
			"name": "wifi",
			"type": "netdev",
			"sysfs": "comfast:blue:wlan",
			"device": "ra0"
		}
	},
	"network": {
		"lan": {
			"ifname": "eth0",
			"create_vlan": true,
			"macaddr": "20:0d:b0:b1:a4:66",
			"def_lan_macaddr": "20:0d:b0:b1:a4:66",
			"def_wan_macaddr": "20:0d:b0:b1:a4:67",
			"def_wlan0_macaddr": "20:0d:b0:b1:a4:6a",
			"def_wlan1_macaddr": "20:0d:b0:b1:a4:69",
			"def_wlan2_macaddr": "20:0d:b8:b1:a4:6d",
			"def_wlan3_macaddr": "20:0d:b9:b1:a4:6e",
			"def_wlan4_macaddr": "20:0d:ba:b1:a4:6f",
			"def_wlan5_macaddr": "20:0d:bb:b1:a4:70",
			"def_wlan6_macaddr": "20:0d:bc:b1:a4:71",
			"def_wlan7_macaddr": "20:0d:bd:b1:a4:72",
			"def_sta_macaddr": "20:0d:bc:b1:a4:71",
			"def_wlan8_macaddr": "20:0d:be:b1:a4:73",
			"def_wlan9_macaddr": "",
			"def_wlan10_macaddr": "",
			"def_wlan11_macaddr": "",
			"def_wlan12_macaddr": "",
			"def_wlan13_macaddr": "",
			"def_wlan14_macaddr": "",
			"def_wlan15_macaddr": ""
		},
		"wan": {
			"ifname": "eth0",
			"create_vlan": true,
			"macaddr": "20:0d:b0:b1:a4:67"
		}
	},
	"switch": {
		"switch0": {
			"enable": true,
			"reset": true,
			"vlans": {
				"lan": [
					0,
					1,
					2,
					3
				],
				"wan": [
					4
				]
			},
			"cpu_port": 6
		}
	}
}

**cat board.d/01_leds** 

#!/bin/sh

. /lib/functions/uci-defaults-new.sh
. /lib/ramips.sh

set_usb_led() {
	ucidef_set_led_usbdev "usb" "USB" "$1" "1-1"
}

set_wifi_led() {
	ucidef_set_led_netdev "wifi_led" "wifi" "$1" "wlan0"
}

set_mtk_wifi_led() {
	ucidef_set_led_netdev "wifi_led" "wifi" "$1" "$2"
}


board=$(ramips_board_name)
board_config_update

case $board in
	cf-wr617ac)
		set_mtk_wifi_led "comfast:blue:wlan" "ra0"
		;;
esac

board_config_flush

exit 0

**root@COMFAST:/etc# cat board.d/02_network** 

#!/bin/sh

. /lib/functions.sh
. /lib/ramips.sh
. /lib/functions/uci-defaults-new.sh
. /lib/functions/system.sh

ramips_setup_rt3x5x_vlans()
{
	if [ ! -x /sbin/swconfig ]; then
		# legacy default
		ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1s"
		return
	fi
	local wanports=""
	local lanports=""
	for port in 5 4 3 2 1 0; do
		if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
			continue
		fi
		if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
			wanports="$port $wanports"
		else
			lanports="$port $lanports"
		fi
	done
	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
	ucidef_add_switch "rt305x" "1" "1"
	ucidef_add_switch_vlan "rt305x" "1" "$lanports 6t"
	ucidef_add_switch_vlan "rt305x" "2" "$wanports 6t"
}

ramips_setup_interfaces()
{
	local board="$1"

	ucidef_set_interface_loopback

	case $board in
	a5-v11)
		ucidef_set_interface_lan "eth0.1"
		ucidef_add_switch "switch0" "1" "1"
		ucidef_add_switch_vlan "switch0" "1" "0 6t"
		;;

	cf-wr617ac)
		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
		ucidef_add_switch "switch0" "1" "1"
		ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
		ucidef_add_switch_vlan "switch0" "2" "4 6t"
		;;
	esac
}

ramips_setup_macs()
{
	local board="$1"
	local lan_mac=""
	local wan_mac=""

	case $board in
	br-6475nd)
		lan_mac=$(cat /sys/class/net/eth0/address)
		wan_mac=$(mtd_get_mac_binary devdata 7)
		;;

	cf-wr617ac | \
	cf-wr618ac | \
	*)
		lan_mac=$(cat /sys/class/net/eth0/address)
		wan_mac=$(macaddr_add "$lan_mac" 1)
		;;

	esac

	[ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
	[ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
	[ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
	[ -n "$lan_mac" ] && [ -n "$wan_mac" ] && [ -n "$wlan_mac" ] && [ -n "$sta_mac" ] && \
	ucidef_set_interface_def_macaddr $lan_mac $wan_mac $wlan_mac $sta_mac
	[ -n "$lan_mac" ] && [ -n "$wan_mac" ] && [ -n "$wlan0_mac" ] && [ -n "$sta_mac" ] && \
	ucidef_set_interface_def_macaddr $lan_mac $wan_mac $wlan0_mac $sta_mac \
	$wlan1_mac $wlan2_mac $wlan3_mac $wlan4_mac $wlan5_mac $wlan6_mac $wlan7_mac \
	$wlan8_mac $wlan9_mac $wlan10_mac $wlan11_mac $wlan12_mac $wlan13_mac $wlan14_mac $wlan15_mac

	[ -n "$wlan0_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan0_mac $wlan1_mac $wlan2_mac $wlan3_mac $wlan4_mac $wlan5_mac $wlan6_mac $wlan7_mac
	[ -n "$wlan8_mac" ] && ucidef_set_wireless_macaddr radio1 $wlan8_mac $wlan9_mac $wlan10_mac $wlan11_mac $wlan12_mac $wlan13_mac $wlan14_mac $wlan15_mac
	[ -n "$lan_mac" ] && [ -n "$wan_mac" ] && [ -n "$wlan0_mac" ] && ucidef_set_interface_def_macaddr $lan_mac $wan_mac $wlan0_mac $sta_mac $wlan1_mac $wlan2_mac $wlan3_mac $wlan4_mac $wlan5_mac $wlan6_mac $wlan7_mac

}

board_config_update
board=$(ramips_board_name)
ramips_setup_interfaces $board
ramips_setup_macs $board
board_config_flush

exit 0

It looks like you're already running a vendor modified OpenWrt, so they should provide you with a GPL dump if you request it from them. Beyond that, you'll need to check actual hardware details to have support added. You cannot just try any image for models with the same SoC or amount of LAN ports.

See the OpenWrt wiki.

test with the firmware of router totolink lr1200, everything works fine but only detects 8MB in flash and device has 16MB. How cloud i change the DTS file for that 16MB is detected?

I would look at the *dts files for other mt7628 devices that have 16mb flash:
https://openwrt.org/tag/mt7628?do=showtag&tag=MT7628. The Netgear R6120 looks promising.

You may even be able to remove the usb code. Look at the difference between the two NetGear devices, the one with usb vs the one without usb.

I would also recommend working with a master git pull. It has actually been simplified and is the versions which accepts patches for new devices.

Question, should just I change it?

&spi0 {
status = "okay";

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

	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>;
		};
	};
};

};

What I did was to copy the closest dts, in master, and rename it for my device. Then edit the remaining files.
For the Totolink, these were the pertinent files

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=0ab9f283f75ad8314ad4be7c70d1397e9dbbfe15

I would also review master on git for the netgear 6120

Then build and use u-boot option 4 to test the initramfs image and check the leds and port numbering. Adjust your build if necessary. Once the image tests correctly, then install.

hi i have tried with dts file, but i cannot increase the memory flash /overlay for install more package. could anybody help me?

If possible, revert to the original firmware and review the kernel log (dmesg). It will contain the manufacturers partitioning. It is important to preserve u-boot, u-boot-env at the beginning and the firmware at the end.

If you cannot pull the factory partition, this looks pretty close:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ramips/dts/mt7628an_widora_neo-16m.dts;h=f17559f0eada5f2904faf90d825d9443c1000208;hb=HEAD

Hi shep, dmesg show next:

[ 0.670000] Creating 5 MTD partitions on "spi32766.0":
[ 0.680000] 0x000000000000-0x000000030000 : "u-boot"
[ 0.680000] 0x000000030000-0x000000040000 : "u-boot-env"
[ 0.690000] 0x000000040000-0x000000050000 : "factory"
[ 0.700000] 0x000000050000-0x0000007b0000 : "firmware"
[ 0.740000] 2 uimage-fw partitions found on MTD device firmware
[ 0.750000] 0x000000050000-0x00000016a472 : "kernel"
[ 0.750000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 0.770000] 0x00000016a472-0x0000007b0000 : "rootfs"
[ 0.770000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 0.780000] mtd: device 5 (rootfs) set to be root filesystem
[ 0.790000] 1 squashfs-split partitions found on MTD device rootfs
[ 0.800000] 0x000000750000-0x0000007b0000 : "rootfs_data"
[ 0.800000] 0x0000007b0000-0x0000007f0000 : "configs"

How could I change the dts file with this information?

You can extract the partition info in a more readable format with cat /proc/mtd
https://openwrt.org/docs/techref/bootloader/uboot.config#example_of_configuring_uboot-envtools

The first 4 partitions in the *dts and dmesg match:

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

[ 0.680000] 0x000000000000-0x000000030000 : "u-boot"

and

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

[ 0.680000] 0x000000030000-0x000000040000 : "u-boot-env" (0x30000 incremented by 0x10000
-> 0x40000)

Comfast's dmesg additionally has "kernel" "rootfs" and "config" partitions that I think are overlays and seem to match the link above. Note the size/erasesize are different in the link.

Edit: Just found this link
https://forum.openwrt.org/t/adding-support-for-comfast-cf-wr617ac/67040/2

Please head over to Adding support for Comfast cf-wr617ac

Closing this topic now, because one topic is enough.