美文网首页路由联盟
用vmware启动openwrt

用vmware启动openwrt

作者: 61c9b7f45cc6 | 来源:发表于2017-05-20 18:03 被阅读178次

最近研究小米路由器,发现小米路由器用的是定制的openwrt系统,简直难用无法用语言形容。想在路由器上重刷openwrt系统,但是没有对应的刷机包,而且以小米的尿性,是不太希望用户脱离它的控制。既然路由器安装不上,那就在虚拟机里试试吧。
首先在官方网站上下载img文件。下载之后解压拷贝到Linux的机器上,然后把img文件转换为vmdk文件

gunzip openwrt-x86-generic-combined-ext4.img.gz
qemu-img convert -f raw -O vmdk openwrt-x86-generic-combined-ext4.img openwrt-x86-generic-combined-ext4.vmdk

然后新建虚拟机,大部分是默认配置即可。关于硬盘这里有一个地方需要注意,一定要选IDE接口。开机应该可以进入openwrt系统了。
另外一个问题就是硬盘默认只有50M左右,安装不了多少东西,所以需要把磁盘扩容。
首先在VMware里把磁盘扩大到你想要的大小,然后把这块磁盘挂载Linux机器上。这里sdb需要替换为你的磁盘设备文件名。

Command (m for help): p
Disk /dev/sdb: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd7531446

Device     Boot Start    End Sectors Size Id Type
/dev/sdb1  *      512   8703    8192   4M 83 Linux
/dev/sdb2        9216 107519   98304  48M 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 
First sector (8704-2097151, default 10240): 9216
Last sector, +sectors or +size{K,M,G,T,P} (9216-2097151, default 2097151): 

Created a new partition 2 of type 'Linux' and of size 1019.5 MiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

接下来动态扩展一下sdb2即可

e2fsck -f /dev/sdb2
e2fsck 1.43.4 (31-Jan-2017)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb2: 666/6000 files (0.0% non-contiguous), 1863/12288 blocks
root@:~# resize2fs /dev/sdb2
resize2fs 1.43.4 (31-Jan-2017)
Resizing the filesystem on /dev/sdb2 to 260992 (4k) blocks.
The filesystem on /dev/sdb2 is now 260992 (4k) blocks long.

然后回到openwrt系统里面就可以看到磁盘大小变了。

相关文章

网友评论

    本文标题:用vmware启动openwrt

    本文链接:https://www.haomeiwen.com/subject/ouupxxtx.html