proxmox or kvm - openwrt / xwrt install

peril

Renowned Member
Oct 6, 2009
50
2
73
Newark, DE USA
Figured I'd share this - it took about 10 seconds to do but it's a neat setup - (not as stable as I would like it seems to wedge after 1 day - but need to watch it closer...)

1) d/l the images file from http://downloads.x-wrt.org/xwrt/kamikaze/8.09/x86/default/openwrt-x86-ext2.image

2) fire up a new kvm container in proxmox

3) copy the file to the destination of the kvm container file (i.e. ide0: local:108/vm-108-disk-1.raw)

4) If you feel like editing the grub bootup args - mount up the image with mount -o loop,offset=32256 vm-108-disk-1.raw /tmp/a, I added a clock=pit, not sure if it helps cause I didn't try it without it for a long time - (can tell you watching the windows clock is MADDENING in kvm on AMD x64)

Add some interfaces - and there you go - insta migratable routing platform.

--Adrian
 
I tried to boot openwrt-x86-generic-combined-ext2.img (latest) but I got a kernel panic, have you tested a current image ?

I was futzing around - haven't updated my openwrt since 2009 :-\ - and now the xwrt project got abandoned... updating instructions for 12.09, but still working
[snip]
from - https://forum.openwrt.org/viewtopic.php?id=41604
(This reply comes rather late - but for what its worth...)
Actually the problem stems from the GRUB "root=" parameter settings.
This can be fixed in a number of ways. Two are presented below:
If "Method 1" is rather painstaking, by all means use "Method 2".


Method 1 (Pro-style)
=====================
$ sudo losetup /dev/loop0 openwrt-x86-kvm_guest-combined-ext4.img
$ sudo fdisk -u -l /dev/loop0
Disk /dev/loop0: 55 MB, 55008768 bytes
16 heads, 63 sectors/track, 106 cylinders, total 107439 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/loop0p1 * 63 9071 4504+ 83 Linux
/dev/loop0p2 9135 107855 49360+ 83 Linux

$ sudo losetup -o 32256 /dev/loop1 /dev/loop0
(where: 32256 = 512 * 63)

$ mkdir temp
$ sudo mount /dev/loop1 temp

Edit the GRUB "root" parameter in "temp/boot/grub/menu.lst" such that:
$ cat temp/boot/grub/menu.lst
(...)
title OpenWrt
(...)
kernel /boot/vmlinuz root=/dev/sda2 (...)
(...)
title OpenWrt (failsafe)
(...)
kernel /boot/vmlinuz failsafe=true root=/dev/sda2 (...)
(...)

$ sudo umount temp/
$ sudo losetup -d /dev/loop1
$ sudo losetup -d /dev/loop0

Boot with, say:
$ sudo kvm openwrt-x86-kvm_guest-combined-ext4.img

You should now get past the "Waiting for root device /dev/vda2..." and
reach "Please press Enter to activate this console." message.

Method 2 (Ad-hoc style)
=================

1. Quickly download "http://downloads.openwrt.org/attitude_a … st-vmlinuz"
2. Boot with:

$ sudo kvm -kernel openwrt-x86-kvm_guest-vmlinuz -hda openwrt-x86-kvm_guest-combined-ext4.img -append "root=/dev/sda2 rw"
3. You should succeed in getting to the prompt. Now (in the Qemu VM console),
# mkdir some
# mount /dev/sda1 some
# vim /some/boot/grub/menu.lst

To edit GRUB "root=" param settings to change "vda2" to "sda2" (as shown in "Method 1").
# umount some
# rm -r some
# halt

4. Now boot without the "openwrt-x86-kvm_guest-vmlinuz" image e.g.
$ sudo kvm openwrt-x86-kvm_guest-combined-ext4.img
--
Mugabi.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!