Ubuntu18.04 installation configuration Bochs2.6.9 and compile and run GeekOS
Installation Bochs2.6.9
Download Bochs2.6.9
Enter the download address
find bochs-2.6.9.tar.gz download and save
Decompression bochs-2.6.9.tar.gz
Can use the command to extract,
sudo tar zxvf bochs-2.6.9.tar.gz
Right mouse button can also directly select the "extract to here"
Installation Bochs
Bochs-2.6.9 directory enter
the following command input terminal
sudo ./configure --enable-debugger --enable-disasm
sudo make
sudo make install
After entering the first line, it may be error:
ERROR: the GUI WAS the Selected the X-Windows, the X-Windows But the Libraries were not found.
So this time you need to enter in a terminal:
sudo apt-get install libx11-dev xserver-xorg-dev xorg-dev
Input after the completion of the second row and the third row
More wonderful error and solutions you can refer to these two blog:
https://blog.csdn.net/geeker_12/article/details/11409009
https://blog.csdn.net/aurorayqz/article/details/ 80,310,954
Start Bochs
Bochs start input terminal directly
and the following error may occur:
the Bochs with IS exiting The Message The following:
[] .bochsrc: 187: CPU set to Malformed Directive.
Description is cpu configuration issue
then enter in a terminal:
bochs -help cpu
会出现:
Supported CPU models:
bx_generic
pentium
pentium_mmx
amd_k6_2_chomper
p2_klamath
p3_katmai
p4_willamette
core_duo_t2400_yonah
atom_n270
Then the input terminal sudo gedit .bochsrc
You will probably be found in the 187 line cpu: model =
The cpu: model = a modified rear section for more support in the cpu models
(rather than the original recommendation comments delete the original)
For example:
CPU: Model = bx_generic
Save and exit
rerun bochs
And error may occur:
Bochs IS not Compiled with lowlevel Sound Support
An input terminal
sudo gedit .bochsrc
Probably in the 915 line, comment out the file sound:. Driver = default, waveout = / dev / dsp wavein =, midiout =
Again rerun bochs
success! ! !
Bochs Configuration
When we entered the terminal bochs,
Bochs will find themselves following file as the default configuration files in the current directory order:
.bochsrc
bochsrc
bochsrc.txt
bochsrc.bxrc (valid only for Windows)
We can create a file named bochsrc of their own, we want to specify Bochs virtual machine configuration
An input terminal
sudo gedit bochsrc
Paste the following (modified according to their own needs, pay attention here to ensure romimage and vgaromimage these two paths is correct, otherwise you will be prompted when the virtual machine starts could not open ROM image file errors):
#################################################################
# Bochs的配置文件
# Configuration file for Bochs
#################################################################
# how much memory the emulated machine will have
megs: 32
# filenameof ROM images
romimage:file=/usr/local/share/bochs/BIOS-bochs-latest
vgaromimage:file=/usr/local/share/bochs/VGABIOS-lgpl-latest
# which disk image will be used 这个是启动软盘
floppya:1_44=a.img, status=inserted
#后面我们会在运行GeekOS时将它改成fd.img
# choose the boot disk 确定启动方式
boot: floppy
# where do we send log messages?
log: bochsout.txt
# disable the mouse
mouse: enabled=0
# enable key mapping ,using US layout as default
keyboard:keymap=/usr/local/share/bochs/keymaps/x11-pc-us.map
Save and exit
Bochs compiled using the installation and operation GeekOS
The following are generating their own floppy disk, if only for running GeekOS this step can be skipped:
(enter in a terminal: sudo bximage
sequentially input:
1
fd
then press the Enter key has been generated floppy disk a.img)
Download and install nasm GeekOS
Installation should pay special attention nasm installed a little older version, such as 2.08.02 version, the latest in a subsequent operation will generate an error,
first of all to download, select nasm-2.08.02.tar.gz , download and save
into the nasm-2.08 after decompression .02 directory
turn enter the following command:
./configure
sudo make
sudo make install
In yet nasm -version input terminal
can be found to 2.08.02
Download GeekOS
directly to GeekOS download
Once downloaded unzip
Compile GeekOS
Enter the directory cd geekos-0.3.0/src/project0/build
terminal input
sudo make depend
sudo make
Being given, there is a line appears: cc1: All warnings being Treated AS errors
Makefile when viewed as a whole make the warnings errors
So we open the Makefile in the current directory,
sudo gedit Makefile
Find -Werror 149 line:
CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror
change into:
CC_GENERAL_OPTS := $(GENERAL_OPTS)
Save and exit, sudo make again
[When I first attempt to forget to install nasm, leading to appear here Makefile: 177: recipe for target ' geekos / lowlevel.o' failed
can quickly install nasm, remember to install version 2.08.02, seemingly all the latest not support】
Sudo make again
appeared
on '__stack_chk_fail' undefined reference
The solution is on line 148 Makefile file GENERAL_OPTS: = -O -Wall $ (EXTRA_C_OPTS ) add compiler option behind
-fno-stack-protector
Then the Makefile 100 lines to 109 lines for the following modifications
100 TARGET_CC := $(TARGET_CC_PREFIX)gcc -m32
101
102 # Host C compiler. This is used to compile programs to execute on
103 # the host platform, not the target (x86) platform. On x86/ELF
104 # systems, such as Linux and FreeBSD, it can generally be the same
105 # as the target C compiler.
106 HOST_CC := gcc -m32
107
108 # Target linker. GNU ld is probably to only one that will work.
109 TARGET_LD := $(TARGET_CC_PREFIX)ld -m elf_i386
then
sudo make clean
sudo make depend
sudo make
There will be
cat geekos / fd_boot.bin geekos / setup.bin geekos
/ kernel.bin> fd.img shall compile successfully
In the input terminal ls -a
checks
found fd.img and .bochsrc
Profiles created before this time to modify our bochsrc the floppy is fd.img
re-enter bochs run
will still be an error
because the default .bochsrc, and .bochsrc here is quite old, basically no value.
So we re-enter the terminal
bochs -f /home/shane/bochs-2.6.9/bochsrc
That is behind bochs plus -f 刚刚创建和修改的配置文件bochsrc的绝对路径
input 6 to start the virtual machine debugging
you will find that there is a black screen, this time back to the input terminal c, then Enter
will appear the following interface:
Run a success! ! !
[Again, if there
Failed assertion in Init_IDT: g_handlerSizeNoErr == g_handlerSizeErr
because nasm version is too new problems can only reinstall 2.08.02 again begin to work more]
Because she was busy at the time of this task to solve the problem as soon as possible, so this blog with pictures little, leaving only the final result of successful chart, but if you follow the above steps, it should be no problem.
Part reference to the following blog:
https://111qqz.com/2016/06/geekok-project0/ (this blog helpful!)
Https://blog.csdn.net/ByChen623/article/details/53619084# commentBox