|
按照网上的教程,这样操作
【
1.查看 firmware 分区所对应的 mtd 设备
cat /proc/mtd
显示:
dev: size erasesize name
mtd0: 00020000 00010000 "u-boot"
mtd1: 0011f61c 00010000 "kernel"
mtd2: 006b09e4 00010000 "rootfs"
mtd3: 00480000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 007d0000 00010000 "firmware"
2.得到固件备份文件 ******_backup.bin,在 /dev/sda3 目录下
dd if=/dev/mtd0 of=/mnt/sda3/u-boot_backup.bin
dd if=/dev/mtd1 of=/mnt/sda3/kernel_backup.bin
dd if=/dev/mtd2 of=/mnt/sda3/rootfs_backup.bin
dd if=/dev/mtd3 of=/mnt/sda3/rootfs_data_backup.bin
dd if=/dev/mtd4 of=/mnt/sda3/art_backup.bin
dd if=/dev/mtd5 of=/mnt/sda3/firmware_backup.bin
自己写了下面这条,想备份U盘第一分区(openwrtU盘的启动分区)
dd if=/dev/sda1 of=/mnt/sda3/upan_openwrt_backup.bin
3.恢复该固件:
将 firmware_backup.bin 上传至 /tmp,使用命令
mtd -r write /mnt/sda3/u-boot_backup.bin u-boot
mtd -r write /mnt/sda3/kernel_backup.bin kernel
mtd -r write /mnt/sda3/rootfs_backup.bin rootfs
mtd -r write /mnt/sda3/rootfs_data_backup.bin rootfs_data
mtd -r write /mnt/sda3/art_backup.bin art
mtd -r write /mnt/sda3/firmware_backup.bin firmware
下面恢复的时候就出问题了,
即可恢复,恢复完成路由器会自行重启】
mtd -r write /mnt/sda3/upan_openwrt_backup.bin firmware
上面不管是插上U盘启动或拔掉U盘启动恢复都会恢复到路由器flash,
这样操作后,恢复时出现下面这样的错误
root@OpenWrt:~# mtd -r write /mnt/sda3/upan_openwrt_backup.bin rootfs
Could not open mtd device: rootfs
Can't open device for writing!
root@OpenWrt:~# mtd -r write /mnt/sda3/upan_openwrt_backup.bin /overlay
Could not open mtd device: /overlay
Can't open device for writing!
root@OpenWrt:~# mtd -r write /mnt/sda3/upan_openwrt_backup.bin /
Could not open mtd device: /
Can't open device for writing!
想实现U盘第一分区的备份和恢复,求大神指导!!!
|
|