侧边栏壁纸
博主头像
iColak's Blog

人生来来往往,来日并不方长

  • 累计撰写 106 篇文章
  • 累计创建 31 个标签
  • 累计收到 380 条评论

目 录CONTENT

文章目录

AX3600刷Openwrt

苏维歌
2022-06-06 / 0 评论 / 0 点赞 / 15 阅读 / 0 字 / 正在检测是否收录...
温馨提示:
本文最后更新于2024-07-08,若内容或图片失效,请留言反馈。 部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

刷机有风险,操作需谨慎,本文仅用于学习交流,请勿用于任何非法用途

本文适合将openwrt安装到mtd12中,原厂固件在mtd13中

刷机步骤

  1. 准备ubi固件

  2. 准备原厂固件1.0.17版本 并登录路由器回滚 下载地址

  3. 在路由器后台页面,打开浏览器F12,在console输入一下命令获取ssh,并设置ssh密码

    function getSTOK() {
     let match = location.href.match(/;stok=(.*?)\//);
     if (!match) {
         return null;
     }
     return match[1];
    }
    
    function execute(stok, command) {
     command = encodeURIComponent(command);
     let path = `/cgi-bin/luci/;stok=${stok}/api/misystem/set_config_iotdev?bssid=SteelyWing&user_id=SteelyWing&ssid=-h%0A${command}%0A`;
     console.log(path);
     return fetch(new Request(location.origin + path));
    }
    
    function enableSSH() {
     stok = getSTOK();
     if (!stok) {
         console.error('stok not found in URL');
         return;
     }
     console.log(`stok = "${stok}"`);
    
     password = prompt('Input new SSH password');
     if (!password) {
         console.error('You must input password');
         return;
     }
    
     execute(stok, 
    `
    nvram set ssh_en=1
    nvram commit
    sed -i 's/channel=.*/channel=\\"debug\\"/g' /etc/init.d/dropbear
    /etc/init.d/dropbear start
    `
     )
         .then((response) => response.text())
         .then((text) => console.log(text));
     console.log('New SSH password: ' + password);
     execute(stok, `echo -e "${password}\\n${password}" | passwd root`)
         .then((response) => response.text())
         .then((text) => console.log(text));
    }
    
    enableSSH();        
  4. 终端输入以下代码测试

    nc -v 192.168.31.1 22
  5. 终端输入登录ssh

    ssh root@192.168.31.1
  6. 在ssh中输入

    nvram set uart_en=1
    nvram set boot_wait=on
    nvram commit
  7. 查看分区

    cat /proc/mtd
  8. ssh中输入 nvram get flag_boot_rootfs 查看官方固件所在分区 0 是在mtd12 / 1 是在mtd13

  9. ssh中上传ubi固件到路由器tmp目录

    scp Desktop/openwrt......ubi root@192.168.31.1:/tmp
  10. 刷写固件

    ubiformat /dev/mtd12 -y -f /tmp/openwrt....ubi
  11. 设置启动分区

    nvram set flag_last_success=0

备注

切换固件 原厂固件>>>>>>Openwrt,登录原厂固件的ssh,输入以下命令

nvram set flag_last_success=0
nvram set flag_boot_rootfs=0
nvram commit
reboot

切换固件 Openwrt>>>>>>原厂固件,登录openwrt的ssh,输入以下命令

fw_setenv flag_last_success 1
fw_setenv flag_boot_rootfs 1
reboot

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin
  3. QQ打赏

    qrcode qq

评论区