Container Engine and Compose Spec tool of your choose:
- Podman (prefferable, Installation), Podman Compose (Installation)
or - Docker (Installation), Docker Compose V1 (Installation) or Docker Compose V2 (Installation)
git clone https://invent.kde.org/butirsky/plasma-mobile-sdk.git && cd openwrt-kroks
podman-compose run --no-deps --rm openwrt
This will run interactive script to build firmware. Press a key when asked.
The built firmware will be placed in bin/targets/ramips/mt76x8/
-
If you prefer Docker, replace
podman
in the commands above withdocker
. For Docker Compose V2, usedocker compose
instead ofdocker-compose
. -
Workaround for snapped Firefox's firmware image access problem:
sudo chown bam bin/targets/ramips/mt76x8 bin/targets/ramips/mt76x8/openwrt-ramips-mt76x8-kroks_*-squashfs-sysupgrade.bin chmod g+w bin/targets/ramips/mt76x8 bin/targets/ramips/mt76x8/openwrt-ramips-mt76x8-kroks_*-squashfs-sysupgrade.bin
-
Find your router's IPv6 Link-Local Address:
ip -6 neigh # fe80::eef:afff:fecf:6fdf dev wlx060c0009f5ea lladdr 0c:ef:af:cf:6f:df router STALE # to parse: # lladdr=$(ip -6 neigh | cut -f 1,3 -d\ --output-delimiter=%)
You can also use
rdisc6 <interface>
andping ip6-allnodes
It's recommended to save it in
/etc/hosts
under some name.
-
Get the router's full IPv6 Link-Local Address postfixed with
%
and the interface name and save it to a variable:lladdr=$(ping -c 1 modem | grep -oP '(?<=\().*(?=\):)') ; echo $lladdr # fe80::eef:afff:fecf:6fdf%wlx060c0009f5ea
If it gives IPv4 address, that's OK, too.
To check a name of the host currently in
$lladdr
:nslookup ${lladdr%\%*} # f.d.f.6.f.c.e.f.f.f.f.a.f.e.e.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa name = modem.
-
Put image to the router:
ssh root@$lladdr 'cat > /tmp/fw.bin' < ~/Downloads/openwrt-*kroks_*-squashfs-sysupgrade.bin
-
(optional) Put configuration archive to the router:
- If you have no LAN connection and there is no locally saved configuration yet, you might need to enable WiFi on the first boot before flashing firmware:
https://openwrt.org/docs/guide-user/installation/flashing_openwrt_with_wifi_enabled_on_first_boottar -C files/ -czv etc/uci-defaults/97-enable_wifi | ssh root@$lladdr 'cat > /tmp/cf.tgz'
- Alternatively, if you have locally saved configuration but the router is not configured yet:
ssh root@$lladdr 'cat > /tmp/cf.tgz' < ~/Downloads/backup-OpenWrt-*
- If you have no LAN connection and there is no locally saved configuration yet, you might need to enable WiFi on the first boot before flashing firmware:
-
Flashing the image:
- If you passed configuration above, flash it along with the image:
ssh root@$lladdr sysupgrade -n -f /tmp/cf.tgz /tmp/fw.bin
- In other cases, just pass firmware image to the command, it will restore current configuration unless
-n
option is present:ssh root@$lladdr sysupgrade /tmp/fw.bin
You might need forcing option first time:
-F | --force Flash image even if image checks fail, this is dangerous! --ignore-minor-compat-version Flash image even if the minor compat version is incompatible.
- If you passed configuration above, flash it along with the image:
-
(optional) Hard factory reset:
https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset#jffs2_resetssh -t root@$lladdr 'umount /overlay && jffs2reset -y && reboot'
-
(optional) Configuration restore:
ssh -o StrictHostKeyChecking=no root@$lladdr 'sysupgrade -r - && (ifup lan &)' < ~/Downloads/backup-OpenWrt* && sleep 1 && ssh root@$lladdr ifconfig
Now you can access LuCI in browser using stable
fd00::/8
Global address again. -
(optional) If you have no SIM card in local SIM1 reader slot, there is not enough packages installed yet to switch the SIM so you might need to do it manually:
-
ssh root@$lladdr << "EOF" tail /sys/class/gpio/modem1*/value set -x echo 0 | tee /sys/class/gpio/modem1power/value sleep 1 echo 0 | tee /sys/class/gpio/modem1*sim*/value set +x tail /sys/class/gpio/modem1*/value set -x echo 1 | tee /sys/class/gpio/modem1$(cat /etc/sim)/value sleep 1 echo 1 | tee /sys/class/gpio/modem1power/value ifup wan set +x tail /sys/class/gpio/modem1*/value EOF
- Alternatively, you might want to set up a temporal managed connection to your existing WiFi hotspot (e.g. on mobile) to download missing packages:
https://openwrt.org/docs/guide-user/network/wifi/connect_client_wifi#command-line_instructionsYou can also access the router by hostname now.ssh root@$lladdr 'sh && service system reload && (ifup lan &)' < files/etc/uci-defaults/98-client_wifi-dhcp_client && sleep 1 && ssh root@$lladdr ifconfig
- Alternatively, hybrid WiFi AP+STA mode can be used:
https://openwrt.org/docs/guide-user/network/wifi/ap_stassh root@$lladdr 'sh; ifup wan' < files/etc/uci-defaults/99-ap_sta
-
-
Packages to install:
ssh root@$lladdr << "EOF" grep -q IceG_repo /etc/opkg/customfeeds.conf || echo 'src/gz IceG_repo https://github.com/4IceG/Modem-extras/raw/main/myrepo' >> /etc/opkg/customfeeds.conf wget https://github.com/4IceG/Modem-extras/raw/main/myrepo/IceG-repo.pub -O /tmp/IceG-repo.pub opkg-key add /tmp/IceG-repo.pub wget http://openwrt.132lan.ru/packages/21.02/packages/add.sh -O - | sh opkg update opkg install \ kmod-usb-serial-option \ chat \ luci-proto-qmi \ luci-app-atinout \ luci-app-modeminfo \ modeminfo-serial-quectel \ modeminfo-qmi \ qmi-utils \ hostapd-utils \ luci-app-commands \ bash \ luci-app-sms-tool-js \ luci-app-attendedsysupgrade \ # luci-app-smstools3 EOF
Many thanks to:
- Kroks for publishing OpenWrt sources for their routers and being responsive on Helpdesk
- MrFuture for creating a topic on 4PDA and publishing SIM switching method via GPIO
- GlshchnkLx and linaro for GPIO fix and overall support
- other members of the Kroks topic on 4PDA