installation and boot the boot program bochs

bochs installation

First, enter the command to install depend on a few of bochs
sudo yum install gcc
sudo yum install gtk2 gtk2-devel
sudo yum install libXt libXt-devel
sudo yum install libXpm libXpm-devel

Then perform su rootpassword to enter into the root administrator

The next step is to download and unzip bochs the
wget https://nchc.dl.sourceforge.net/project/bochs/bochs/2.6.9/bochs-2.6.9.tar.gz
tar -zxvf bochs-2.6.9.tar.gz
cd bochs2.6.9
reader can find the latest version of their own Quguan network download, the less strange because the wrong version of the more emerging

Then you can compile installed
./configure --with-x11 --with-wx --enable-debugger --enable-disasm --enable-all-optimizations --enable-readline --enable-long-phy-address --enable-ltdl-install --enable-idle-hack --enable-plugins --enable-a20-pin --enable-x86-64 --enable-smp --enable-cpu-level=6 --enable-large-ramfile --enable-repeat-speedups --enable-fast-function-calls --enable-handlers-chaining --enable-trace-linking --enable-configurable-msrs --enable-show-ips --enable-cpp --enable-debugger-gui --enable-iodebug --enable-logging --enable-assert-checks --enable-fpu --enable-vmx=2 --enable-svm --enable-3dnow --enable-alignment-check --enable-monitor-mwait --enable-avx --enable-evex --enable-x86-debugger --enable-pci --enable-usb --enable-voodoo
in the file does not exist here error may occur, as long as the suffix of .cpp file cloned copy of a .cc on it, a few common
cp misc/bximage.cpp misc/bximage.cc
cp iodev/hdimage/hdimage.cpp iodev/hdimage/hdimage.cc
cp iodev/hdimage/vmware3.cpp iodev/hdimage/vmware3.cc
cp iodev/hdimage/vmware4.cpp iodev/hdimage//vmware4.cc
cp iodev/hdimage/vpc-img.cpp iodev/hdimage/vpc-img.cc
cp iodev/hdimage/vbox.cpp iodev/hdimage/vbox.cc
make
make install

Then we also need to configure to run bochs environment that is configured through the file, that .bochsrcfile inside the configuration is as follows, if the file is not found were hidden
Here Insert Picture Description

plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, iodebug=1
config_interface: textconfig
display_library: x
#memory: host=2048, guest=2048
romimage: file="/usr/local/share/bochs/BIOS-bochs-latest"
vgaromimage: file="/usr/local/share/bochs/VGABIOS-lgpl-latest"
boot: floppy
floppy_bootsig_check: disabled=0
floppya: type=1_44, 1_44="boot.img", status=inserted, write_protected=0
#no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=none
ata0-slave: type=none
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=none
ata1-slave: type=none
ata2: enabled=0
ata3: enabled=0
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=5
 
cpu: count=1:1:1, ips=4000000, quantum=16, model=corei7_haswell_4770, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0, msrs="msrs.def"
 
cpuid: x86_64=1,level=6, mmx=1, sep=1, simd=avx512, aes=1, movbe=1, xsave=1,apic=x2apic,sha=1,movbe=1,adx=1,xsaveopt=1,avx_f16c=1,avx_fma=1,bmi=bmi2,1g_pages=1,pcid=1,fsgsbase=1,smep=1,smap=1,mwait=1,vmx=1
cpuid: family=6, model=0x1a, stepping=5, vendor_string="GenuineIntel", brand_string="Intel(R) Core(TM) i7-4770 CPU (Haswell)"
 
print_timestamps: enabled=0
debugger_log: -
magic_break: enabled=0
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local, rtc_sync=0
#no cmosimage
#no loader
log: -
logprefix: %t%e%d
debug: action=ignore
info: action=report
error: action=report
panic: action=ask
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
speaker: enabled=1, mode=system
parport1: enabled=1, file=none
parport2: enabled=0
com1: enabled=1, mode=null
com2: enabled=0
com3: enabled=0
com4: enabled=0

megs: 2048

Boot boot program

In the first section, we have a good bochs download the virtual machine and configured, the next step is to implement a simple boot boot program.

First vim boot.asmcreate and open a boot.asm file, enter the following code

And with the following code:

 
BaseOfStack	equ	0x7c00
 
Label_Start:
 
	mov	ax,	cs
	mov	ds,	ax
	mov	es,	ax
	mov	ss,	ax
	mov	sp,	BaseOfStack
 
;=======	clear screen
 
	mov	ax,	0600h
	mov	bx,	0700h
	mov	cx,	0
	mov	dx,	0184fh
	int	10h
 
;=======	set focus
 
	mov	ax,	0200h
	mov	bx,	0000h
	mov	dx,	0000h
	int	10h
 
;=======	display on screen : Start Booting......
 
	mov	ax,	1301h
	mov	bx,	000fh
	mov	dx,	0000h
	mov	cx,	10
	push	ax
	mov	ax,	ds
	mov	es,	ax
	pop	ax
	mov	bp,	StartBootMessage
	int	10h
 
;=======	reset floppy
 
	xor	ah,	ah
	xor	dl,	dl
	int	13h
 
	jmp	$
 
StartBootMessage:	db	"Start Boot"
 
;=======	fill zero until whole sector
 
	times	510 - ($ - $$)	db	0
	dw	0xaa55

The next step is to use nasm compiled .bin file
nasm boot.asm -o boot.bin

Then written to the bin img
dd if=boot.bin of=/home/wujian/bochs-2.6.9/boot.img bs=512 count=1 conv=notrunc
Here Insert Picture Description

Then the floppy disk is made
Here Insert Picture Description
to select 1 to create a floppy disk
Here Insert Picture Description
input fd create a floppy disk image, hd hard disk
Here Insert Picture Description
by default 1.44M directly enter
Here Insert Picture Description
the input image name, we choose boot.img
Here Insert Picture Description
create success

Then that is running the bochs
bochs
Here Insert Picture Description
directly enter start running virtual machines
Here Insert Picture Description
last input c
Here Insert Picture Description
run successfully, then they can shut down
if not close properly can be performed
ps auxto find the corresponding pid
Here Insert Picture Description
then executed sudo kill -9 (对应pid)25898to shut down

Released six original articles · won praise 8 · views 1645

Guess you like

Origin blog.csdn.net/miswujian/article/details/104461729