一、基本操作
1、分区查看
查看openwrt分区
root@OpenWrt:/# dmesg
[ 0.394554] m25p80 spi0.0: w25q256 (32768 Kbytes)
[ 0.399584] 4 fixed-partitions partitions found on MTD device spi0.0
[ 0.406029] Creating 4 MTD partitions on "spi0.0":
[ 0.411013] 0x000000000000-0x000000030000 : "u-boot"
[ 0.417681] 0x000000030000-0x000000040000 : "u-boot-env"
[ 0.425217] 0x000000040000-0x000000050000 : "factory"
[ 0.432544] 0x000000050000-0x000002000000 : "firmware"
[ 0.440112] 2 uimage-fw partitions found on MTD device firmware
[ 0.446129] Creating 2 MTD partitions on "firmware":
[ 0.451734] 0x000000000000-0x00000018f368 : "kernel"
[ 0.458367] 0x00000018f368-0x000001fb0000 : "rootfs"
[ 0.465553] mtd: device 5 (rootfs) set to be root filesystem
[ 0.471945] 1 squashfs-split partitions found on MTD device rootfs
[ 0.478239] 0x0000005e0000-0x000001fb0000 : "rootfs_data"
[ 0.487804] libphy: Fixed MDIO Bus: probed
root@OpenWrt:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 01fb0000 00010000 "firmware"
mtd4: 0018f368 00010000 "kernel"
mtd5: 01e20c98 00010000 "rootfs"
mtd6: 019d0000 00010000 "rootfs_data"
查看磁盘空间上可使用的空间大小
root@OpenWrt:/# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 4.5M 4.5M 0 100% /rom
tmpfs 60.9M 31.7M 29.1M 52% /tmp
/dev/mtdblock6 25.8M 948.0K 24.9M 4% /overlay
overlayfs:/overlay 25.8M 948.0K 24.9M 4% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p1 28.8G 320.0K 28.8G 0% /root/sd
这里将kernel和rootfs 全盘拷贝到/tmp路径下生成fw.bin
root@OpenWrt:/# dd if=/dev/mtd3 of=/tmp/fw.bin
64896+0 records in
64896+0 records out
本文介绍了如何使用dd命令在OpenWRT系统中进行分区查看和固件生成。通过查看OpenWRT的分区情况,了解可用磁盘空间,然后详细阐述了将kernel和rootfs全盘拷贝至/tmp路径生成fw.bin固件文件的过程。
5384

被折叠的 条评论
为什么被折叠?



