OpenWrt Forum Archive

Topic: OpenWRT on vmware

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I would like to run OpenWRT in vmware so that I can test my configuration before applying it to a real device.
I also saw a screenshot of it running in vmware:
http://ak.glaven.org/v/Glaven-org_pictu … t.jpg.html

So far I tried the x86 branch image at
http://downloads.openwrt.org/people/nic … g/x86-2.4/

However, I have no idea how to set up vmware so that it can run a JFF2 image.

I fetched the newest SYSLINUX and created a bootable iso image.
When booting the image in vmware, isolinux is loaded.
It then tries to boot the x86 openwrt image, however, after starting to load the kernel is gets stuck.

I also tried compiling my own x86 kamikaze image.
Same issue here.

I even tried to write the image on a CF and then use it as physical vmware disk.
Unfortunately, CF disks attached to USB CF readers do not seem to work with vmware.

I heard of running openwrt with Qemu or using a user mode linux (UML) openwrt image.
While this might work, I still would prefer to run it in vmware.

I would appreciate any help on creating an OpenWRT vmware image, please help.

(Last edited by knossos on 26 Oct 2006, 21:22)

openwrt, even on x86, outputs to com1 IMHO

(Last edited by kvborg on 27 Oct 2006, 15:57)

you're right, that could be the problem.

I had a look at the kamikaze image configuration, but couldn't find a way to enable console support and disable the serial console.
(All I could find was the baudrate setting.)

Since OpenWRT uses a Linux kernel (which of course has console support) there should be a way.

There is also support for serial ports in vmware, which can either use the hardware serial port of the host system or a named pipe.
I'll try to use a named pipe, let's see how far I get with that ..


Edit:
OK, looks good for now, i set up a virtual serial port in vmware.
I created a bootable iso9660 image containing isolinux, a x86 kernel and a rootfs.
I set up vmware so that it used a named pipe "serial0" (actually this is a UNIX socket) to interface with the virtual serial port.

There is an excellent tool called "socat" which is able to connect/proxy all kinds of different streams.
The following command gives interactive access to the virtual serial console:

I still have the problem that the kernel doesn't find it's root device.
adding "root=/dev/hdc", "root=/dev/ide/host0/bus1/target0", "root=openwrt.ext2" doesn't work for me ;(

# socat - UNIX:serial0

For now, it looks promising:

Linux version 2.6.17 (mne@phyrex) (gcc version 4.1.1) #1 Thu Oct 26 18:10:41 CEST 2006
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
 BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000dc000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 000000000fef0000 (usable)
 BIOS-e820: 000000000fef0000 - 000000000feff000 (ACPI data)
 BIOS-e820: 000000000feff000 - 000000000ff00000 (ACPI NVS)
 BIOS-e820: 000000000ff00000 - 0000000010000000 (usable)
 BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
 BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
 BIOS-e820: 00000000fffe0000 - 0000000100000000 (reserved)
256MB LOWMEM available.
DMI present.
Allocating PCI resources starting at 20000000 (gap: 10000000:eec00000)
Built 1 zonelists
Kernel command line: BOOT_IMAGE=vmlinuz initrd=openwrt.img
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 8192 bytes)
scx200hr: timer not yet accessible; will probe later.
Detected 2172.474 MHz processor.
Using tsc for high-res timesource
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 237028k/262144k available (1141k kernel code, 24424k reserved, 278k data, 108k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 4361.93 BogoMIPS (lpj=21809692)
Mount-cache hash table entries: 512
CPU: CLK_CTL MSR was 0. Reprogramming to 20000000
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU: AMD Athlon(tm) XP 3000+ stepping 00
Checking 'hlt' instruction... OK.
SMP alternatives: switching to UP code
Freeing SMP alternatives: 0k freed
Unpacking initramfs... done
Freeing initrd memory: 20480k freed
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xfd9a0, last bus=1
Setting up standard PCI resources
Linux Plug and Play Support v0.97 (c) Adam Belay
PCI: Probing PCI hardware
PCI quirk: region 1000-103f claimed by PIIX4 ACPI
PCI quirk: region 1040-104f claimed by PIIX4 SMB
PCI: Using IRQ router PIIX/ICH [8086/7110] at 0000:00:07.0
PCI: Bridge: 0000:00:01.0
  IO window: disabled.
  MEM window: disabled.
  PREFETCH window: disabled.
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 8192 bind 4096)
TCP reno registered
scx200: NatSemi SCx200 Driver
squashfs: version 3.0 (2006/03/15) Phillip Lougher
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
Initializing Cryptographic API
io scheduler noop registered
io scheduler deadline registered (default)
Limiting direct PCI/PCI transfers.
isapnp: Scanning for PnP cards...
isapnp: No Plug & Play device found
Real Time Clock Driver v1.12ac
Non-volatile memory driver v1.2
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
hda: VMware Virtual IDE Hard Drive, ATA DISK drive
hdc: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 128KiB
hda: 209715 sectors (107 MB) w/32KiB Cache, CHS=208/16/63
 /dev/ide/host0/bus0/target0/lun0: unknown partition table
block2mtd: version $Revision: 1.30 $
ip_conntrack version 2.4 (2048 buckets, 16384 max) - 236 bytes per conntrack
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP vegas registered
NET: Registered protocol family 1
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
Using IPI Shortcut mode
VFS: Cannot open root device "<NULL>" or unknown-block(3,66)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(3,66)

(Last edited by knossos on 27 Oct 2006, 21:19)

I build the svn Version and do it so:

cd bin
qemu -kernel openwrt-x86-2.6-vmlinuz -initrd openwrt-x86-2.6-ext2.image -serial stdio -nographic -append root=/dev/hda rootfstype=squashfs,jffs2 init=/etc/preinit -hda openwrt-x86-2.6-ext2.fs

works like a charm, thanks for the tip with qemu.

(Last edited by knossos on 3 Nov 2006, 16:54)

I managed to run a self compiled openwrt image on qemu, though I still couldn't get any virtual network interfaces running.
Qemu is able to emulate ne2000 or rtl8139 (supported in the openwrt kernel) NICs. unfortunately although I compile the kernel with support for the rtl8139 chipset, the module doesn't seem to be available inside the generated image.

With vmware I got stuck: The kernel boots but it doesn't find the rootfs, although the cdrom drive is found by the kernel and the rootfs is on the cdrom.
Until there is a working vmware image, there still is some work to be done.

Since qemu also has MIPS support, it might be possible to run other WRT images (dd-wrt and such) as well.
Would be cool for testing purposes wink

edit:
I tried out the dd-wrt_full_vga BETA image .
Although there are (of course) a lot of errors, the image perfectly boots in qemu smile

(Last edited by knossos on 4 Nov 2006, 15:41)

I want to run openwrt on qemu but I'm new in here. I don't know what I must do.
Can you guide me how to do it plz.

Thank you.

jabavoc wrote:

I want to run openwrt on qemu but I'm new in here. I don't know what I must do.
Can you guide me how to do it plz.

Thank you.

I have the same Problem. Can anybody give me help?

I downloaded your image and started it using VMWare Server 1.0.1.
But I can't connect with putty using the serial option (\\.\pipe\com_1) :-(
Message: Unable to open serial port.
The VM gets it's own IP via DHCP (I can see it in the syslog of my OpenWrt router), but I can't connect via ssh or telnet either. Blocked by the firewall, or no dropbear or telnetd running inside the image?

Any clue what wrong?

Can I connect to the pipe via network too (\\server\pipe\com_1)?
That would be fine, because VMWare Server is running on a different machine, so I had to use RDP to start Putty there.

Edit: There no output after "Uncompressing Linux... Ok, booting the kernel." on the VMWare console screen.

(Last edited by MMCM on 30 Jan 2007, 18:05)

MMCM wrote:

But I can't connect with putty using the serial option (\\.\pipe\com_1) :-(
Message: Unable to open serial port.

First start the VM then shortly after this connect via PuTTY and it will work.

MMCM wrote:

Can I connect to the pipe via network too (\\server\pipe\com_1)?
That would be fine, because VMWare Server is running on a different machine, so I had to use RDP to start Putty there.

Probably if you modify the serial options in the VMX file.

MMCM wrote:

Edit: There no output after "Uncompressing Linux... Ok, booting the kernel." on the VMWare console screen.

OpenWrt redirects all output to the serial console at your VM (\\.\pipe\com_1).

forum2006: thanks for the vmware image, seems to work fine for me. now it's easy to test out kamikaze smile

keitsi wrote:

forum2006: thanks for the vmware image, seems to work fine for me. now it's easy to test out kamikaze smile

No problem smile

Soon I'll submit a ticket with a patch so the vmdk image gets build automatically out of the buildsystem. Then you can always build your own vmdk image from the newest Kamikaze revision.

(Last edited by forum2006 on 30 Jan 2007, 18:34)

Oh, the connection with Putty is working!

My fault, I did not do, what you are supposed to, when running Windows:
Working logged in as an Administrator :-( ;-)

Running Putty with an admin account solved the problem.

[s]Way to confuse a person!
It's PuTTYtel you need to use for serial, not PuTTY wink[/s]

EDIT:  I bite my tounge!  The latest PuTTY includes serial.

@forum2006, this is pretty sweet.  Thanks for the download!

(Last edited by KillaB on 31 Jan 2007, 07:27)

I managed to enable VT and Keyboard support in the kernel config (no more need for PuTTY). See the screenshot.

I'll soon update the image.

New VMware image with Kamikaze uploaded to openwrt-x86-2.6-ext2 (VMware image).zip (2MB) with full set of packages.

Kamikaze r6261
webif^2 r2444

Virtual disk is 128MB with EXT2 filesystem. The virtual RAM size is 128MB.

Enabled console and keyboard support. For serial connection use \\.\pipe\com_1 with 115200 8n1.

Default IP is 192.168.1.1 to change it and set a default gateway and DNS server do:
uci set network.lan.ipaddr="<ip_address>"
uci set network.lan.gateway="<ip_address>"
uci set network.lan.dns="<ip_address>"
uci commit && reboot

(Last edited by forum2006 on 5 Feb 2007, 17:15)

This worked like a champ.  I'm also looking at the patches you've posted here

Quick question, how did you enable VGA output in the kernel?  For a few reasons, I need to re-create what you've done.  Do you have a few quick steps that enable the VGA output and any other tweaks you made?

Thanks in advance.

escape164 wrote:

Quick question, how did you enable VGA output in the kernel?  For a few reasons, I need to re-create what you've done.  Do you have a few quick steps that enable the VGA output and any other tweaks you made?

As written in ticket #1317 the patch was not ready. Someone else wrote a patch in ticket #1342 which enables VGA (VT) output in the kernel config.

forum2006 wrote:

As written in ticket #1317 the patch was not ready. Someone else wrote a patch in ticket #1342 which enables VGA (VT) output in the kernel config.

Ahh, I didn't see the link to that new patch.  Very cool.  I'm recompiling now ... :-)

I successfully compiled OpenWRT with the VMWare Patch and VGA patch listed above.  The trick was to use r6261.  The newest version (r6280) didn't work.  I don't know why.

The discussion might have continued from here.