居然能找到这里来嘛,这里只是用来放笔记的图书馆哦~
460 字
2 分钟
【笔记】记一次小米路由器固件解包
工具准备:
幻梦是在Debian13上完成的解包操作,以下的笔记仅针对Debian系统环境。
这次解包的为 miwifi_rc01_firmware_5a1e1_1.1.56.bin
安装 SquashFS 和 Python3
sudo apt install squashfs-toolssudo apt install python3 python3-pip pipx git安装 ubi_reader
pipx install git+https://github.com/jrspruitt/ubi_reader.git下载ROM:
可以下载到最新的 rom 文件。
解包流程:
1.查看 UBI 信息
ubireader_display_info miwifi_rc01_firmware_5a1e1_1.1.56.binUBI_File Warning: end_offset - start_offset length is not block aligned, could mean missing data.UBI File--------------------- Min I/O: 2048 LEB Size: 126976 PEB Size: 131072 Total Block Count: 294 Data Block Count: 292 Layout Block Count: 2 Internal Volume Block Count: 0 Unknown Block Count: 0 First UBI PEB Number: 1
Image: 1955263782 --------------------- Image Sequence Num: 1955263782 Volume Name:kernel Volume Name:ubi_rootfs PEB Range: 2 - 293
Volume: kernel --------------------- Vol ID: 0 Name: kernel Block Count: 42
Volume Record --------------------- alignment: 1 crc: '0xceb18f81' data_pad: 0 errors: '' flags: 0 name: 'kernel' name_len: 6 padding: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' rec_index: 0 reserved_pebs: 83 upd_marker: 0 vol_type: 'static'
Volume: ubi_rootfs --------------------- Vol ID: 1 Name: ubi_rootfs Block Count: 250
Volume Record --------------------- alignment: 1 crc: '0xc84aa00d' data_pad: 0 errors: '' flags: 0 name: 'ubi_rootfs' name_len: 10 padding: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' rec_index: 1 reserved_pebs: 250 upd_marker: 0 vol_type: 'dynamic'可以看到有Volume Name: kernel与Volume Name: ubi_rootfs确认是标准UBI
2.提取 UBI Volume
ubireader_extract_images miwifi_rc01_firmware_5a1e1_1.1.56.binUBI_File Warning: end_offset - start_offset length is not block aligned, could mean missing data.可能会输出这样的警告,但是先不管他,ls看一下是不是生成了ubifs-root目录
一般目录的路径是这样的。
ubifs-root/└── miwifi_rc01_firmware_5a1e1_1.1.56.bin/ ├── img-1955263782_vol-kernel.ubifs └── img-1955263782_vol-ubi_rootfs.ubifs他这个.bin结尾的真的是一个文件夹,是可以打开的。
3.确认 RootFS 类型
file ubifs-root/miwifi_rc01_firmware_5a1e1_1.1.56.bin/img-1955263782_vol-ubi_rootfs.ubifsubifs-root/miwifi_rc01_firmware_5a1e1_1.1.56.bin/img-1955263782_vol-ubi_rootfs.ubifs:Squashfs filesystem, little endian,version 4.0,xz compressed,31643602 bytes,5765 inodes,blocksize: 262144 bytes,created: Wed May 14 07:57:33 2025说明这个 Volume 是一个完整的 SquashFS
4.解包 RootFS
unsquashfs \-d rootfs \ubifs-root/miwifi_rc01_firmware_5a1e1_1.1.56.bin/img-1955263782_vol-ubi_rootfs.ubifsParallel unsquashfs: Using 4 processors5433 inodes (5062 blocks) to write
create_inode: could not create character device rootfs/dev/console, because you're not superuser![==================================================================================| ] 10494/10495 99%
created 4877 filescreated 332 directoriescreated 555 symlinkscreated 0 devicescreated 0 fifoscreated 0 socketscreated 0 hardlinks当运行命令后输出以上内容,并且生成一个rootfs目录,目录里就是我们提取到的文件了。
【笔记】记一次小米路由器固件解包
https://www.yumehinata.com/posts/笔记记一次小米路由器固件解包/
