Take the ubuntu operating system as an example
I. Command line installation
sudo apt-get install vgabios bochs bochs-x bximage
This The method is convenient, but it is said that the bochs installed by this method does not have the debugging function, so I did not try it. I have time to add verification.
Second, source installation
1. Source code download
https://sourceforge.net/projects/bochs/files/bochs/
Directly download the latest source code, ready to install on linux, so download Of bochs-2.6.9.tar.gz
2. Preparation before installation
sudo apt-get install build-essential xorg-dev libgtk2.0-dev bison
Save a lot of the config process and rely on compilation errors
3. Compile and install
sudo tar xvzf bochs-2.6.9.tar.gz
cd bochs -2.6.9
./configure –enable-debugger –enable-disasm –enable-readline -LIBS=’lx11′
make
sudo make install
make install will copy the bochs executable file to the /usr/local/bin/ directory
Restart linux or make the environment variable take effect again, you can directly in the current directory Call bochs
4. Modify the bochsrc configuration file
In the bochs-2.6.9 directory, there is a configuration file .bochsrc, we need to modify it to run our a. img
#cpu: model=core2_penryn_t9600, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1 , msrs="msrs.def" cpu: model=amd_k6_2_chomper, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def" cpu: cpuid_limit_winnt=0 memory: guest=512, host=256 romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest mouse: enabled=0 pci: enabled=1, chipset=i440fx private_colormap: enabled=0 #floppya: 1_44=/dev/fd0, status=inserted #floppya: image=../1.44, status=inserted #floppya: 1_44=/dev/fd0H1440, status=inserted #floppya: 1_2=../1_2, status=inserted #floppya: 1_44=a:, status=inserted floppya: 1_44=a.img, status=inserted, write_protected=1 #floppya: 1_44=/dev/rfd0a, status=inserted ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15 ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11 ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9 #ata0-master: type=disk, mode=flat, path="30M.sample" #ata0-master: type=disk, mode=flat, path="30M.sample", cylinders=615, heads=6, spt=17 #ata0-master: type=disk, mode=flat, path="c.img", cylinders=0 # autodetect #ata0-slave: type=disk, mode=vvfat, path=/bochs/images/vvfat, journal=vvfat.redolog #ata0-slave: type=cdrom, path=D:, status=inserted #ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted #ata0-slave: type=cdrom, path="drive", status=inserted #ata0-slave: type=cdrom, path=/dev/rcd0d, status=inserted boot: floppy #boot: disk floppy_bootsig_check: disabled=0 log: bochsout.txt panic: action=ask error: action=report info: action=report debug: action=ignore, pci=report # report BX_DEBUG from module ‘pci’ debugger_log:- parport1: enabled=1, file="parport.out" #sound: driver=default, waveout=/dev/dsp. wavein=, midiout= #speaker: enabled=1, mode=sound
The places with comments are basically changed, and several problems in the next startup process are solved.
5. Start and run the bochs virtual machine
5. p>
bochs -f .bochsrc
If you can get there, if there are any problems, most of them are caused by bochsrc configuration. You can check the error point and try to comment it out to ensure that the most basic configurations can basically run normally.
For example:
memory: guest=512, host=256
romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
floppya: 1_44=a.img, status=inserted, write_protected=1< br>boot: floppy
Problems that may be encountered during the boot process:
Question 1: .bochsrc:187: cpu directive malformed
< p>
Solution:
Linux terminal Bottom: bochs -help cpu
I My computer is an AMD processor, I Just choose amd_k6_2_chomper
You can modify the configuration file
#cpu: model=core2_penryn_t9600, count=1, ips=50000000, reset_on_triple_fault =1, ignore_bad_msrs=1, msrs="msrs.def" cpu: model=amd_k6_2_chomper, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
Question 2: .bochsrc:915: Bochs is not compiled with lowlevel sound support
Solution: modify the configuration File, comment out the following two lines
#sound: driver=default, waveout=/dev/dsp. wavein=, midiout=
#speaker: enabled=1, mode=sound
Question 3: syntax error at’dump_cpu’
p>
Solution: none
bochs version 2.3.5 and above does not have dump_cpu, you can use r, fp, mmx, sse, dreg, sreg, creg commands instead
Reference: https://blog.csdn.net/time4 /article/details/25079417
#cpu: model=core2_penryn_t9600, count=1, ips=50000000, reset_on_triple_faul t=1, ignore_bad_msrs=1, msrs="msrs.def" cpu: model=amd_k6_2_chomper, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def" cpu: cpuid_limit_winnt=0 memory: guest=512, host=256 romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest mouse: enabled=0 pci: enabled=1, chipset=i440fx private_colormap: enabled=0 #floppya: 1_44=/dev/fd0, status=inserted #floppya: image=../1.44, status=inserted #floppya: 1_44=/dev/fd0H1440, status=inserted #floppya: 1_2=../1_2, status=inserted #floppya: 1_44=a:, status=inserted floppya: 1_44=a.img, status=inserted, write_protected=1 #floppya: 1_44=/dev/rfd0a, status=inserted ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15 ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11 ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9 #ata0-master: type=disk, mode=flat, path="30M.sample" #ata0-master: type=disk, mode=flat, path="30M.sample", cylinders=615, heads=6, spt=17 #ata0-master: type=disk, mode=flat, path="c.img", cylinders=0 # autodetect #ata0-slave: type=disk, mode=vvfat, path=/bochs/images/vvfat, journal=vvfat.redolog #ata0-slave: type=cdrom, path=D:, status=inserted #ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted #ata0-slave: type=cdrom, path="drive", status=inserted #ata0-slave: type=cdrom, path=/dev/rcd0d, status=inserted boot: floppy #boot: disk floppy_bootsig_check: disabled=0 log: bochsout.txt panic: action=ask error: action=report info: action=report debug: action=ignore, pci=report # report BX_DEBUG from module ‘pci’ debugger_log:- parport1: enabled=1, file="parport.out" #sound: driver=default, waveout=/dev/dsp. wavein=, midiout= #speaker: enabled=1, mode=sound