Virtualization

Monday March 19th, 2012By: CyrIng

Virtual Machine Manager

1- Setup

2- Create

3- Start

4- Power Off

5- Operating

1- Setup

Libvirt and virt-manager are both used to manage the virtual machine (VM)

Their setup is explained into the ArchLinux Wiki ↔ wiki.archlinux.org/index.php/Libvirt

The Bridge Networking setup is helped by the Netcfg daemon ↔ wiki.archlinux.org/index.php/Netcfg

A net-profile file is built this way.

where x and y have to be changed according to your network architecture.

192.x.y.101 is the IP address of the Linux workstation

192.x.y.1 is the IP address of your gateway

192.x.y.1 is the IP address of your DNS server

192.x.y.199 is the IP address of the bridge network device

 

 # nano /etc/network.d/cyring-network

 

CONNECTION='ethernet'
DESCRIPTION='Ethernet'
INTERFACE='eth0'
IP='static'
ADDR='192.x.y.101'
GATEWAY='192.x.y.1'
DNS=('192.x.y.1')
IP6=''
# KVM bridge
INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="Bridge"
BRIDGE_INTERFACES="eth0"
IP="static"
ADDR='192.x.y.199'
GATEWAY='192.x.y.1'
DNS=('192.x.y.1')
IP6=''

The net-profile file, the kernel modules, and the daemon, are added into the configuration of ArchLinux.

 # nano /etc/rc.conf

 

MODULES=(msr coretemp kvm kvm-intel vboxdrv vboxnetflt vboxnetadp drm dmi-sysfs)
NETWORKS=(cyring-network)
DAEMONS=(hwclock syslog-ng acpid dbus rpcbind @net-profiles @netfs @nfs-common @crond avahi-daemon avahi-dnsconfd @libvirtd ...)

Now, reboot the Linux system …

2- Create a new virtual machine

Download the FreeDOS ISO image which will be installed as a guest into the VM.

The fd11src.iso image will be used during the next steps. Download latest ↔ www.freedos.org/freedos/files

Start the manager

 

 $ virt-manager

 

Create the new VM

Click the left side button : a wizard will start.

Enter your machine name.

Select Local install media from an ISO image or CDROM.

Click [Forward] to pursue with the wizard.

Select ″ Use ISO image ″ then click [Browse...]

Click [Browse Local] to browse files.

Find the folder where the FreeDOS ISO image has been downloaded.

Select the ISO file then click [Open]

Click [Forward] to go to the next step.

Enter the memory size and the number of CPU assigned to the VM.

Click [Forward] to go on.

Enter the virtual hard disk size in gigabytes.

Click [Forward] to go on.

In the ″ Advanced options ″, drop down the list to ″ Specify shared device name ″.

Enter ‘ br0 ‘ as the bridge name adapter.

Check the VM configuration once again, then submit with the [Finish] button.

3- Start the virtual machine

Double click the machine name.

At  Virtual Machine’s menu, press ″ Run ″ or click button ″ Power on ″.

The VM bootstraps the ISO image : you can now proceed with the FreeDOS setup onto the virtual hard disk.

4- Power the VM off

Be aware that a virtual machine should be considered as a physical one !

Thus, to shut it down, the guest operating system must be stopped properly to avoid file system corruption.

Using FreeDOS, enter the halt command.

c:> halt

 

5- Operating the VM

To show the virtual hardware details, press the exclamation point button.

You may change, add or remove hardware components.

Submit all by clicking [Apply]

How to copy the debugger program files from the Linux host into the FreeDOS guest ?

(¡) In the ″ IDE Disk ″ part, you should have previously selected ″ raw ″ as the ″ storage format ″.

Attach the virtual FreeDOS partition at the Linux directory ″ /tmp/vhd ″.

 $ cd /tmp $ mkdir vhd $ sudo mount -t vfat -o loop,offset=32256,rw,uid=`id -u`,gid=`id -g` /vm/KVM/freedos.img /tmp/vhd
Password:

Check attachment.

 $ df -h /tmp/vhd
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      126M   68M   59M  54% /mnt

Copy the 386SWAT’s files and check result.

 $ cp -R 386SWAT/ vhd/ $ du -hs vhd/*

 

1.1M    vhd/386SWAT
1.5K    vhd/AUTOEXEC.BAT
512     vhd/BOOTSECT.BIN
67K     vhd/COMMAND.COM
1.0K    vhd/FDCONFIG.SYS
68M     vhd/FDOS
45K     vhd/KERNEL.SYS

Detach the virtual partition.

 $ sudo umount /tmp/vhd

 

Password:

Start the FreeDOS virtual machine …

Edit its configuration file.

c:> edit fdconfig.sys

Insert one line just below the extended memory manager to load the 386SWAT.LOD debugger device.

Save file and quit the editor.

Ctrl + s
Alt + x

Restart the the FreeDOS virtual machine.

c:> reboot

Once the VM restarted, you may activate the debugger by tripple pressing Ctrl + Alt + 5 ( using the 5 numpad )