Hi. I have a Xiaomi Mi Router 4A which had support in the master branch starting from last year. I've successfully compiled from source and flashed a build from master. While it works, performance on 2.4 is wonky hence I want to build using stable and the Linux Version it comes with (4.14). I've added lines in images > mt7621.mk for my device and yet it does not show as a target in menuconfig. I've seen posts here in the forum that someone was able to build a firmware for the device using OpenWrt 19.07.3 r11063-85e04e9f46. While I could use that image, I'd prefer to compile things by myself (and learn in the process). Can anyone point me to the right direction?
Sorry to break this to you...but if you're having issues with wifi performance on master, having a build from stable branch is not likely to improve anything...
If wifi is really that bad for you, file a bug report:
I had to do a similar thing for WDR3500, which is merged into master for the new target ath79, but that commit was merged after version 19 was released, therefore they do not backport it into version 19 releases.
You can see my post and my solution here for WDR3500:
I actually forgot to mention the last step which is kind of a hack. After doing those steps, it still doesn't show up in make menuconfig
so one has to edit .config manually...
I'm assuming that you're building from linux and that this is the commit for your router:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=522d5ff42835f7ad01c090b9ea1863f5d56b91d3
# clone from master if you haven't already
git clone https://github.com/openwrt/openwrt.git
# step into the build tree
cd openwrt
# switch to a new branch for this
git checkout -b 4a-stable
# force that branch to roll back to the stable release
# BTW this is a tag, you can see all tags with "git tag"
git reset --hard v19.07.3
# merge that specific commit
git cherry-pick 522d5ff42835f7ad01c090b9ea1863f5d56b91d3
# see the files that have conflicts
git status
Now there will be a merge conflict...
use git status
to see the files that didn't merge (in red)
you have to correct the conflict manually in your favorite editor...
For the script 02_network:
at line 690 (or search for "mir3g-v2")
copy everything between
=======
and
>>>>>>>
and put it before
zyxel,keenetic-start)
wan_mac=$(mtd_get_mac_binary factory 40)
;;
*)
Then you delete all 3 of the conflict markers
the other one you have to scroll up to see
<<<<<<< HEAD
If you're in doubt just make it look like the commit:
xiaomi,mir3g)
lan_mac=$(mtd_get_mac_binary factory 0xe006)
;;
xiaomi,mir3g-v2)
wan_mac=$(mtd_get_mac_binary factory 0xe006)
label_mac=$wan_mac
;;
xiaomi,mir3p)
lan_mac=$(mtd_get_mac_binary factory 0xe006)
label_mac=$lan_mac
;;
For the mt7621.mk:
you can just delete the following
<<<<<<< HEAD
define Device/mqmaker_witi-256m
DTS := WITI-256M
IMAGE_SIZE := $(ralink_default_fw_size_16M)
DEVICE_TITLE := MQmaker WiTi (256MB RAM)
=======
define Device/xiaomi_mir3p
MTK_SOC := mt7621
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_SIZE:= 4096k
UBINIZE_OPTS := -E 5
IMAGE_SIZE := 255488k
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Mi Router 3 Pro
IMAGES += factory.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
>>>>>>> 522d5ff428... ramips: add support for Xiaomi Mi Wi-Fi Router 3G v2
DEVICE_PACKAGES := \
kmod-ata-core kmod-ata-ahci kmod-mt76x2 kmod-sdhci-mt7620 kmod-usb3 \
kmod-usb-ledtrig-usbport wpad-basic
SUPPORTED_DEVICES += witi
endef
TARGET_DEVICES += mqmaker_witi-256m
After correcting the conflicts:
# add all files to continue the commit
git add -A
# finish the commit
git cherry-pick --continue
# close the editor
# update package repositories and merge
scripts/feeds update -a
scripts/feeds install -a
# prepare the build system
make clean
# pick a similar target
make menuconfig
# (choose Target Mediatek MIPS, Subtarget MT7621, Profile: Xiaomi Mi Router 3G
# exit and save
if you mess it up you can git reset
and git cherry-pick
as much as you want
or
you can just download the dts and copy whatever other lines you need
Final step, edit .config
# edit build config manually
nano .config
search for "mir3g"
replace all instance of "mir3g" with "mir3g-v2"
this
CONFIG_TARGET_ramips_mt7621_DEVICE_xiaomi_mir3g=y
becomes
CONFIG_TARGET_ramips_mt7621_DEVICE_xiaomi_mir3g-v2=y
and
CONFIG_TARGET_PROFILE="DEVICE_xiaomi_mir3g"
becomes
CONFIG_TARGET_PROFILE="DEVICE_xiaomi_mir3g-v2"
finally....
run make
it will give a warning that configuration is "out of sync" but it continues anyway
Good luck
Thank you very much for this and taking time to help a total noob.
I've successfully compiled the image using your directions but the initial compile was not able to boot probably due to the naming changes (DTS file structure and the like) on master. Hence, to make my build work, I added
DTS := mt7621_xiaomi_mir3g-v2
To the /target/linux/ramips/image/mt7621.mk of the cherry picked line. I also changed
DEVICE_MODEL := Mi Router 3G
to
DEVICE_TITLE := Mi Router 3G V2
then ran
touch target/linux/*/Makefile
to make the new config appear in make menuconfig.
Again, thank you very much for this. May this also help other newbs kinda backport the stable release to their devices supported in master.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.