Bpir2wrt Openwrt-Fork for BPI-R2

I made some effort to create a Openwrt fork for BPI-R2. I appreciate some help by changing luci configuration to match wmt wifi device. And switch config. I do this in my spare time. You are welcome to contribute issues and patches over github.

  • Trunk branch is develop :thinking:, could be broken
  • Master is Master :wink:, should be last compiling version
  • Initial Release is release_001 Just clone and compile the usual openwrt way and you are good to go. Overlayfs is working didnt tested sata yet. For
4 Likes

Goals:

  1. Make luci configuration work (new feed repository?)
  2. Make GPIO work
  3. Make BPIR2-GPIO-luci-app (new feed repository?)
  4. Make sunovoip to help us
  5. Best would be to shrink this crazy wifi driver some day

###UPDATE###

  1. I removed unneeded files from branch R1 which is the initial branch for people who just want to download the sources for BPI-R2 and build a image for it.
  2. Changed image generation, changed file ending, removed zipping and metadata from sd and emmc images to remove unzip fault and ease use of win32imager for windows :face_vomiting: users :kissing_heart:

And make it work without this wmt-tools :slight_smile:

Hello. Can you provide me instruction how to flash image to sdcard and emmc?

Regards

you can refer to this link, thanks.

Unfortunately file mtk-bpi-r2-SD.img and mtk-bpi-r2-EMMC.img are not exist in whole bpir2wrt directory.
May I doing something wrong?
My ‘make menuconfig’ configuration is:

Target System: MediaTek Ralink ARM
Subtarget: MT7623
Target Profile: MTK7623n BananaPi R2
Target Images: ramdisk, squashfs

Is this correct?

Regards

Sry, i am very busy right now will reply in on thursday with instructions and updates ive done, repositorie will change probably as well… sry guys for the late reply…

you have done the compile-process (imho only make) and this is done without errrors?

Yes, I have no errors.

I am working on it at the moment will post a working and highly updated new version today!

Ok, done! I renewed the Branches and compiled a working version succesfull! MTK-WTD wifi driver is not configured for compilation on default. You need to checkout the repository again i removed R1 and introduced release_001 instead. Branches master develop and release_001 equal atm. INITIAL is very old dont use it! Uboot-Script will use your entire sdcard for userdata partition which is not mounted on boot use extroot for that! So you will have a always working rootfs configuration. on my sd card(32GB) Kernel command line generated by Uboot-Script is earlyprintk console=ttyS0,115200 block2mtd.block2mtd=/dev/mmcblk1,65536,RootFs,5 mtdparts=RootFs:512k(mbr)ro,512k(uboot)ro,512k(config)ro,512k(factory)ro,32M(kernel),32M(recovery),256M(rootfs),31232M(usrdata) rootfstype=squashfs,jffs2 I’ve not configured script for 64gb cards !

1 Like

I have configured mtk wifi to be compiled into image! Wifi can’t be configured via luci so stick to command line configuration if you like to use that dirt. Sad sinovoip, so sad!

It’s because wifi-driver needs wmt-tools for showing the wifi-interface,i’ve tried to drop them,but without any help i cannot do this

What i think could be the easiest, is to change the parsing of config files so it is compatible with openwrt.

Ok i will put some links here dont now why Datasheet : https://www.datasheetspdf.com/pdf-down/M/T/6/MT6625L-MediaTek.pdf

Some hints about chip familiy: https://forum.xda-developers.com/android/software-hacking/mediatek-wifi-bt-fm-gps-combo-chips-t3591182

Amazon EchoDot2 uses MT6625: https://www.amazon.com/gp/help/customer/display.html?nodeId=201626480

Mediatek: https://github.com/MediaTek-Connectivity/mt6620

Many Android Phones out there using this Chip drivers are diffrent to ours i think!

1 Like

Can you help me kick this wmt-tools?

Current problem is: if i call init on boot,some dts-nodes seem not available. See my boot.log in wifi-patching branch

first step should be change first 2 steps (wmtloader and stp uart launcher) to automatic call so we only set mode between client and ap

In /drivers/misc/mediatek/connectivity/common/conn_soc/core/include/wmt_conf.h #define CUST_CFG_WMT "WMT_SOC.cfg" WMT_SOC.cfg is defined

in /drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_conf.c it is created and parsed

looks like these are the variables we need

+	CHAR(coex_wmt_ant_mode),
+	CHAR(coex_wmt_ext_component),
+	CHAR(coex_wmt_wifi_time_ctl),
+	CHAR(coex_wmt_ext_pta_dev_on),
+	CHAR(coex_wmt_filter_mode),
+	CHAR(coex_bt_rssi_upper_limit),
+	CHAR(coex_bt_rssi_mid_limit),
+	CHAR(coex_bt_rssi_lower_limit),
+	CHAR(coex_bt_pwr_high),
+	CHAR(coex_bt_pwr_mid),
+	CHAR(coex_bt_pwr_low),
+	CHAR(coex_wifi_rssi_upper_limit),
+	CHAR(coex_wifi_rssi_mid_limit),
+	CHAR(coex_wifi_rssi_lower_limit),
+	CHAR(coex_wifi_pwr_high),
+	CHAR(coex_wifi_pwr_mid),
+	CHAR(coex_wifi_pwr_low),
+	CHAR(coex_ext_pta_hi_tx_tag),
+	CHAR(coex_ext_pta_hi_rx_tag),
+	CHAR(coex_ext_pta_lo_tx_tag),
+	CHAR(coex_ext_pta_lo_rx_tag),
+	SHORT(coex_ext_pta_sample_t1),
+	SHORT(coex_ext_pta_sample_t2),
+	CHAR(coex_ext_pta_wifi_bt_con_trx),
+	INT(coex_misc_ext_pta_on),
+	INT(coex_misc_ext_feature_set),
+	CHAR(wmt_gps_lna_pin),
+	CHAR(wmt_gps_lna_enable),
+	CHAR(pwr_on_rtc_slot),
+	CHAR(pwr_on_ldo_slot),
+	CHAR(pwr_on_rst_slot),
+	CHAR(pwr_on_off_slot),
+	CHAR(pwr_on_on_slot),
+	CHAR(co_clock_flag),
+	INT(sdio_driving_cfg),

Here in function

static INT32 wmt_conf_parse(P_DEV_WMT pWmtDev, const PINT8 pInBuf, UINT32 size)

we have the file read and the point where you can let the driver create the file itself if you like to

+INT32 wmt_conf_read_file(VOID)
+{
+	INT32 ret = -1;
+
+	osal_memset(&gDevWmt.rWmtGenConf, 0, osal_sizeof(gDevWmt.rWmtGenConf));
+	osal_memset(&gDevWmt.pWmtCfg, 0, osal_sizeof(gDevWmt.pWmtCfg));
+
+#if 1
+	osal_memset(&gDevWmt.cWmtcfgName[0], 0, osal_sizeof(gDevWmt.cWmtcfgName));
+
+	osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT_PREFIX, osal_sizeof(CUST_CFG_WMT_PREFIX));
+	osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT, osal_sizeof(CUST_CFG_WMT));
+#endif
+
+	if (!osal_strlen(&(gDevWmt.cWmtcfgName[0]))) {
+		WMT_ERR_FUNC("empty Wmtcfg name\n");
+		osal_assert(0);
+		return ret;
+	}
+	WMT_DBG_FUNC("WMT config file:%s\n", &(gDevWmt.cWmtcfgName[0]));
+	if (0 == wmt_dev_patch_get(&gDevWmt.cWmtcfgName[0], (osal_firmware **) &gDevWmt.pWmtCfg, 0)) {
+		/*get full name patch success */
+		WMT_DBG_FUNC("get full file name(%s) buf(0x%p) size(%d)\n",
+			      &gDevWmt.cWmtcfgName[0], gDevWmt.pWmtCfg->data, gDevWmt.pWmtCfg->size);
+
+		if (0 == wmt_conf_parse(&gDevWmt, (const PINT8)gDevWmt.pWmtCfg->data, gDevWmt.pWmtCfg->size)) {
+			/*config file exists */
+			gDevWmt.rWmtGenConf.cfgExist = 1;
+
+			WMT_DBG_FUNC("&gDevWmt.rWmtGenConf=%p\n", &gDevWmt.rWmtGenConf);
+			ret = 0;
+		} else {
+			WMT_ERR_FUNC("wmt conf parsing fail\n");
+			osal_assert(0);
+			ret = -1;
+		}
+		wmt_dev_patch_put((osal_firmware **) &gDevWmt.pWmtCfg);
+/*
+	if (gDevWmt.pWmtCfg)
+	{
+	    if (gDevWmt.pWmtCfg->data)
+	    {
+		osal_free(gDevWmt.pWmtCfg->data);
+	    }
+	    osal_free(gDevWmt.pWmtCfg);
+	    gDevWmt.pWmtCfg = 0;
+	}
+*/
+		return ret;
+	}
+	WMT_ERR_FUNC("read %s file fails\n", &(gDevWmt.cWmtcfgName[0]));
+	osal_assert(0);
+
+	gDevWmt.rWmtGenConf.cfgExist = 0;
+	return ret;
+}

No spare time left need to do different things sry I think we are working on diffrent kernel sources with diffrent patchset/ dts patches.

My problem was not the config…i get an oops after that (enable power afair)

I realy dont know how to see the difference comming from your return exclude //return -1; This cant be enough right? I think i miss some of your changes there. But i am not really into it because i am very bussy right now with diffrent things. Is there some readme or explanaition what you have done so far? On the driver side ? Difficult for me to reverse engeneer your changes and the driver itself. But :+1: to your efforts

EDIT: Ahh sry got your wifi patching branch i am kinda dump

I don’t have any docs…i tried only to move init-code from fd-trigger (wmt-loader sends a constant-value over a device-file to call init) to driver-init and skip read of config because filesystem is not mounted yet at this point

hi i looked through the echo dot 2 archive, but this seems kernel 3.18 and the wifi-driver looks like the one i used.

same function wmt_detect_unlocked_ioctl in connectivity/common_detect/wmt_detect.c which gets commands from wmt-tools over a char-device (/dev/wmtdetect)

this workflow i tried to remove so that the driver makes init on bootup (except echo because we need to select AP-Mode or Client-mode) so we can drop these wmt-tools

as for config-file…i did not read it because the options present in official (and mine) file are giving warnings so currently the file have to only exist (else kernel-crash) so i dropped the reading of it (filesystem is not ready at this point)

but i’m no driver expert, i need help for this