How to boot and run Ubuntu inside bochs emulator and make a virtual machine

I suggest simple steps for running ubuntu inside bochs emulator and my processor is Pentium(R) Dual-Core CPU T4500 @ 2.30GHz running debian distro.

Installation is simple,

[code language=”css”]$ sudo apt-get install bochs[/code]

This package contains an X11 GUI plugin for Bochs,

[code language=”css”]$ sudo apt-get install bochs-x[/code]

Another way of installation…

In order, to boot up a Operating system inside bochs we need

1) iso image of respective OS

2) disk image

3) bochsrc file

Hence,

For downloading iso image of ubuntu click here

For creating disk image

[code language=”css”]$ mkdir test

$ cd test/

$ bximage[/code]

It will drop to

========================================================================
bximage
Disk Image Creation Tool for Bochs
$Id: bximage.c,v 1.34 2009/04/14 09:45:22 sshwarts Exp $
========================================================================

Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd]<press ENTER>

What kind of image should I create?
Please type flat, sparse or growing. [flat]<press ENTER>

Enter the hard disk size in megabytes, between 1 and 129023
[10] <How much MB of disk image>10240<press ENTER>

I will create a ‘flat’ hard disk image with

cyl=20805
heads=16
sectors per track=63
total sectors=20971440
total size=10239.96 megabytes

What should I name the image?
[c.img]<give any name>dummy.img<press ENTER>

Writing: [] Done.

I wrote 10737377280 bytes to dummy.img.

The following line should appear in your bochsrc:
ata0-master: type=disk, path=”dummy.img”, mode=flat, cylinders=20805, heads=16, spt=63

As a result you created a hard disk image dummy.img of size 10G inside present working directory. Be aware of including last line of previous output inside bochsrc file.

Next,

Creation of bochsrc file

[code language=”css”]$ vim bochsrc[/code]

My simple bochsrc file is

# bochsrc
#
megs: 1024
#
mouse: enabled=1
#
ata0-master: type=disk, path=”ubuntu.img”, mode=flat, cylinders=20805, heads=16, spt=63
ata1-master: type=cdrom, path=./ubuntu-12.10-desktop-i386.iso, status=inserted
#
log: ubuntuop.txt
#
boot: cdrom

Description,

megs: 1024 — I allocated 1024MB of RAM for my emulator

mouse: enabled=1 — I enabled mouse inside my emulator

ata0-master: type=disk, path=”ubuntu.img”, mode=flat, cylinders=20805, heads=16, spt=63 — Inclusion of hard disk image specification

ata1-master: type=cdrom, path=./ubuntu-12.10-desktop-i386.iso, status=inserted — Inclusion of OS iso image

log: ubuntuop.txt — It is normally a log file, which keeps tracking of emulator execution, can be referred at anytime for debugging purpose

boot: cdrom — boot my OS from cdrom(iso image of ubuntu) inside emulator

Be sure, that iso image file(ubuntu) + hard disk image file + bochsrc all at same directory.

To run ubuntu inside bochs,

[code language=”css”]$ bochs [/code]

A new window will pop up and ubuntu will start booting inside of it.

Since it is Emulator, process of booting ubuntu may be slow, be patience to see how it is booting.

Enjoy…!

reference

--

--