Skip to content

[Experience]小米盒子4C(MDZ-20-AA)成功运行Armbian并配网记录/A Guide to Successfully Running Armbian on the Xiaomi Mi Box 4C (MDZ-20-AA) and Connecting to the Network #3551

@shiboyuan918

Description

@shiboyuan918

小米盒子 4C Armbian 安装与 WiFi MAC 修复记录

设备信息

· 型号:小米盒子 4C (MDZ-20-AA)
· 芯片:Amlogic S905L

使用的固件与方式

· 固件:Armbian_26.05.0_amlogic_s905l_noble_6.12.87_server_2026.05.15.img.gz
· 方式:U盘 + 有线键盘 + USB分线器(主动供电)

遇到的问题与解决方法

参考了 issue #3520 中 Youjar 大佬的办法,修改设备树为 /dtb/amlogic/meson-gxl-s905l-venz-v10.dtb。U盘启动后遇到无法联网的问题,MAC地址全为 ff:ff:ff:ff:ff:ff。折腾了几天,后来通过以下流程连上了网:

sudo ip link set wlan0 address 02:11:22:33:44:55
sudo ip link set wlan0 up
sudo systemctl restart NetworkManager
sleep 3
sudo nmcli device set wlan0 managed yes
sudo nmcli radio wifi on
sudo nmcli device wifi rescan
sudo nmcli device wifi list
sudo nmcli device wifi connect "网络名称" password "网络密码"
ip -4 addr show wlan0 | grep inet

接着用以下命令做了永久化(本以为 U盘运行重启不会掉网):

sudo sh -c 'echo "W1VuaXRdCkRlc2NyaXB0aW9uPUZpeCBSVEwxODhGRSBicm9rZW4gRUVQUk9NIE1BQwpCZWZvcmU9TmV0d29ya01hbmFnZXIuc2VydmljZQoKW1NlcnZpY2VdClR5cGU9b25lc2hvdApFeGVjU3RhcnQ9L3NiaW4vaXAgbGluayBzZXQgd2xhbjAgYWRkcmVzcyAwMjoxMToyMjozMzo0NDo1NQpSZW1haW5BZnRlckV4aXQ9eWVzCgpbSW5zdGFsbF0KV2FudGVkQnk9bXVsdGktdXNlci50YXJnZXQK" | base64 -d > /etc/systemd/system/wifi-mac-fix.service'

cat /etc/systemd/system/wifi-mac-fix.service
sudo systemd-analyze verify /etc/systemd/system/wifi-mac-fix.service
sudo systemctl daemon-reload
sudo systemctl enable wifi-mac-fix.service

但是刷入 emmc 后(我用的 116 版本)却掉网,通过以上办法执行无果。后来在 minimax m3 的指导下,进行了如下操作:

sudo tee /usr/local/bin/wifi-mac-fix.sh > /dev/null <<'EOF'
#!/bin/bash
for i in $(seq 1 30); do
if [ -e /sys/class/net/wlan0 ]; then
# 再次确认 driver 加载完(operstate 不为 unknown)
if [ "$(cat /sys/class/net/wlan0/operstate 2>/dev/null)" != "" ]
|| [ -d /sys/class/net/wlan0/phy80211 ]; then
/sbin/ip link set wlan0 down 2>/dev/null
/sbin/ip link set wlan0 address 02:11:22:33:44:55
/sbin/ip link set wlan0 up
logger "wifi-mac-fix: MAC set to $(ip link show wlan0 | awk '/ether/ {print $2}')"
exit 0
fi
fi
sleep 1
done
logger "wifi-mac-fix: wlan0 not ready, giving up"
exit 1
EOF

sudo chmod +x /usr/local/bin/wifi-mac-fix.sh

sudo tee /etc/systemd/system/wifi-mac-fix.service > /dev/null <<'EOF'
[Unit]
Description=Fix WiFi MAC for Xiaomi Box 4C
After=systemd-udevd.service systemd-modules-load.service
Before=NetworkManager.service
Wants=systemd-udevd.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/wifi-mac-fix.sh
RemainAfterExit=yes
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl disable wifi-mac-fix.service 2>/dev/null
sudo systemctl daemon-reload
sudo systemctl enable wifi-mac-fix.service

通过调整时序,重启后成功解决问题。

当前状态

· 系统启动成功
· SSH 连接正常
· WiFi 连接正常

致谢

感谢 ophub 大佬的辛勤维护,让这些电视盒子得以重生!

感谢 Youjar 大神撰写的运行记录,为我的工作提供了莫大帮助与参考价值。为了表示敬意,我把我的 issue 用了和他一样的格式。再次致谢!

附:本人纯小白,第一次折腾这么复杂的项目,一步步问着 AI 来的,特别推荐 Minimax M3。先后问了 DeepSeek 和 Qwen 都没解决问题……


Xiaomi Box 4C Armbian Installation & WiFi MAC Fix Record

Device Information

· Model: Xiaomi Box 4C (MDZ-20-AA)
· Chipset: Amlogic S905L

Firmware and Method

· Firmware: Armbian_26.05.0_amlogic_s905l_noble_6.12.87_server_2026.05.15.img.gz
· Method: USB drive + wired keyboard + USB hub (externally powered)

Issues Encountered and Solutions

Referring to issue #3520, I followed the method by user Youjar to change the device tree to /dtb/amlogic/meson-gxl-s905l-venz-v10.dtb. After booting from the USB drive, I encountered a network issue: the MAC address was all ff:ff:ff:ff:ff:ff. After several days of troubleshooting, I managed to connect using the following steps:

sudo ip link set wlan0 address 02:11:22:33:44:55
sudo ip link set wlan0 up
sudo systemctl restart NetworkManager
sleep 3
sudo nmcli device set wlan0 managed yes
sudo nmcli radio wifi on
sudo nmcli device wifi rescan
sudo nmcli device wifi list
sudo nmcli device wifi connect "SSID" password "PASSWORD"
ip -4 addr show wlan0 | grep inet

Then I made the fix permanent with (I thought WiFi would persist after rebooting from the USB drive):

sudo sh -c 'echo "W1VuaXRdCkRlc2NyaXB0aW9uPUZpeCBSVEwxODhGRSBicm9rZW4gRUVQUk9NIE1BQwpCZWZvcmU9TmV0d29ya01hbmFnZXIuc2VydmljZQoKW1NlcnZpY2VdClR5cGU9b25lc2hvdApFeGVjU3RhcnQ9L3NiaW4vaXAgbGluayBzZXQgd2xhbjAgYWRkcmVzcyAwMjoxMToyMjozMzo0NDo1NQpSZW1haW5BZnRlckV4aXQ9eWVzCgpbSW5zdGFsbF0KV2FudGVkQnk9bXVsdGktdXNlci50YXJnZXQK" | base64 -d > /etc/systemd/system/wifi-mac-fix.service'

cat /etc/systemd/system/wifi-mac-fix.service
sudo systemd-analyze verify /etc/systemd/system/wifi-mac-fix.service
sudo systemctl daemon-reload
sudo systemctl enable wifi-mac-fix.service

However, after flashing to eMMC (I used version 116), the network dropped again, and the above method didn't work. Later, under the guidance of minimax m3, I performed the following operations:

sudo tee /usr/local/bin/wifi-mac-fix.sh > /dev/null <<'EOF'
#!/bin/bash
# Wait for wlan0 device file to appear, up to 30 seconds
for i in $(seq 1 30); do
    if [ -e /sys/class/net/wlan0 ]; then
        # Double-check that the driver has finished loading (operstate not unknown)
        if [ "$(cat /sys/class/net/wlan0/operstate 2>/dev/null)" != "" ] \
           || [ -d /sys/class/net/wlan0/phy80211 ]; then
            /sbin/ip link set wlan0 down 2>/dev/null
            /sbin/ip link set wlan0 address 02:11:22:33:44:55
            /sbin/ip link set wlan0 up
            logger "wifi-mac-fix: MAC set to $(ip link show wlan0 | awk '/ether/ {print $2}')"
            exit 0
        fi
    fi
    sleep 1
done
logger "wifi-mac-fix: wlan0 not ready, giving up"
exit 1
EOF

sudo chmod +x /usr/local/bin/wifi-mac-fix.sh

sudo tee /etc/systemd/system/wifi-mac-fix.service > /dev/null <<'EOF'
[Unit]
Description=Fix WiFi MAC for Xiaomi Box 4C
After=systemd-udevd.service systemd-modules-load.service
Before=NetworkManager.service
Wants=systemd-udevd.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/wifi-mac-fix.sh
RemainAfterExit=yes
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
EOF

# Reset the service
sudo systemctl disable wifi-mac-fix.service 2>/dev/null
sudo systemctl daemon-reload
sudo systemctl enable wifi-mac-fix.service

By adjusting the timing sequence, rebooting successfully resolved the issue.

Current Status

· System boots successfully
· SSH connection is normal
· WiFi connection is normal

Thanks

Thanks to ophub for the great work, giving these TV boxes a second life!

Thanks to Youjar for writing the operation log, which provided tremendous help and reference value for my work. As a token of respect, I formatted my issue in the same style as his/hers. Thanks again!

I'm a complete beginner, and this is my first time tackling such a complex project. I've been asking the AI for help step by step. I highly recommend Minimax M3 — I tried DeepSeek and Qwen first, but neither of them solved the problem...

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions