Friday 16 February 2018

Tinkering OpenWRT (1) : Getting Started

I don't have an actual board in my hand yet but I just couldn't wait to start play around with OpenWRT! So no bullshit here is how I got started in VirtualBox.

Step 1: Get it
Option 1 :
http://downloads.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-combined-ext2.vdi
As can be seen, the file is already a .vdi so it can be used directly.

Option 2 :
http://downloads.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-combined-ext2.img.gz
If you want to go with this option, you need to convert the image file to vdi file:

VBoxManager convertfromraw --format VDI openwrt-18.06.0-x86-generic-combined-ext4.img.gz openwrt-1806-x86.vdi

##################################################################

Troubleshooting:

Problem (1)
Command 'VBoxManager' not found, did you mean:

  command 'VBoxManage' from deb virtualbox


Try: sudo apt install <deb name>

Solution:
$ which VBoxManage
/usr/bin/VBoxManage

and then
/usr/bin/VBoxManage convertfromraw --format VDI openwrt-18.06.0-x86-generic-combined-ext4.img.gz openwrt-1806-x86.vdi


Problem (2)
$ /usr/bin/VBoxManage convertfromraw --format VDI openwrt-18.06.0-x86-generic-combined-ext4.img.gz openwrt-1806-x86.vdi
Converting from raw image file="openwrt-18.06.0-x86-generic-combined-ext4.img.gz" to file="openwrt-1806-x86.vdi"...
Creating dynamic image with size 7896443 bytes (8MB)...
VBoxManage: error: VD: The given disk size 7896443 is not aligned on a sector boundary (512 bytes)
VBoxManage: error: Error code VERR_VD_INVALID_SIZE at /home/vbox/vbox-5.2.16/src/VBox/Storage/VD.cpp(6219) in function int VDCreateBase(PVDISK, const char*, const char*, uint64_t, unsigned int, const char*, PCVDGEOMETRY, PCVDGEOMETRY, PCRTUUID, unsigned int, PVDINTERFACE, PVDINTERFACE)

VBoxManage: error: Cannot create the disk image "openwrt-1806-x86.vdi": VERR_VD_INVALID_SIZE


Solution:
$ dd if=openwrt-18.06.0-x86-generic-combined-ext4.img.gz of=openwrt.img bs=128000 conv=sync
61+1 records in
62+0 records out

7936000 bytes (7.9 MB, 7.6 MiB) copied, 0.138767 s, 57.2 MB/s


$ /usr/bin/VBoxManage convertfromraw --format VDI openwrt.img openwrt-1806-x86.vdi
Converting from raw image file="openwrt.img" to file="openwrt-1806-x86.vdi"...

Creating dynamic image with size 7936000 bytes (8MB)...

##################################################################

Step 2: Vbox configuration
Settings are as shown in following pictures. Some of the areas are grey because my openwrt is running.

settings 0:

Settings 1: You must choose IDE controller. It won't boot if you go with SATA.

Settings 2: We need at least two NIC.


Settings 3:

Step 3: Run!
 Press ENTER here!


Voila!!


ref:
http://www.cnblogs.com/hdk1993/p/4769141.html
http://blog.tshine.me/virtualbox%E5%AE%89%E8%A3%85openwrt.html
https://vsxen.github.io/2017/05/15/openwrt-install-virtualbox/
http://blog.csdn.net/js93105/article/details/44704283
https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm





No comments:

Post a Comment