OpenWRT: Membuat VM Image

From OnnoWiki
Jump to navigation Jump to search

OpenWrt di VirtualBox

Ada beberapa cara untuk memperoleh OpenWRT x86 porting untuk VirtualBox.

  • Download vdi image (ex. attitude_adjustment/12.09/x86/)
  • Download + convert raw image (ex. attitude_adjustment/12.09/x86/)
  • Compile image anda sendiri, pastikan
Target System (x86)  --->
     x86
Target Images  --->
     Build VirtualBox image files (VDI)
     Build VMware image files (VMDK) 
Kernel modules  --->
     Filesystems  --->
           kmod-fs-ext4

Convert OpenWrt raw image

Langkah ini dibutuhkan untuk release & snapshot lama. Release 10.03.1 ke atas sudah memberikan image VirtualBox.

Uncompress image jika di perlukan:

gunzip openwrt.img.gz

Convert openwrt.img menjadi native VirtualBox format:

VBoxManage convertfromraw --format VDI openwrt.img openwrt.vdi 


OpenWrt and Kernel version

   Choose a Name for your virtual machine
   Choose Linux for your Operating System
   Choose Linux 2.6 for your Version
   Click Next
   Optionally decrease RAM size from 256 MB to something smaller
   Click Next
   Choose Use existing hard disk
   Click the file icon to open Virtual Media Manager
   Click Add and your .vdi or .vmdk file using the dialog
   Select your drive from the list and click Select
   Click Next and Finish
   Right click your machine's entry on the machine list and choose Settings
   add a disconnected, serial port to the machine (default is none available)

Troubleshooting

   If your virtual machine won't boot, make sure your hard disk is connected using IDE (not SATA)
       Right click your machine's entry on the machine list and choose Settings then select Storage
       If you see that your hard disk image is connected to a SATA controller; under Storage Tree select the SATA Controller entry and then click Remove Controller
       Click Add Controller and then select IDE Controller
       Select the IDE Controller you just added and then click Add Attachment and choose Add Hard Disk
       Add your OpenWRT image as before
   If your virtual machine still won't boot, make sure you have a Serial Port enabled.
       Enable a serial port under Settings then Serial Ports
   If your virtual machine boots but doesn't activate the console
       Press Enter
   If you rebuild the disk image, and VirtualBox complains about invalid UUIDs for the disk
       You need to remove the disk from the VM, and _also_ from the Virtual Media Manager, the add the disk image to the VM again

Set up networking with clients

   In the VirtualBox Settings for Network configure:
       Adapter 1 to internal network with name OpenWrt-lan
       Adapter 2 to Bridged adapter or NAT
   Boot up OpenWrt and add to /etc/config/network
   config 'interface' 'wan'
           option 'proto' 'dhcp'
           option 'ifname' 'eth1'
   Start the wan with ifup wan
   Create a new Virtual machine with your client operating system of choice
   On the client set Adapter 1 to internal network with name OpenWrt-lan
   Boot client

Referensi