←↑→↓↖↙↗↘↕
unicode=Geometric Shapes
▶◆◉
Miscellaneous Symbols
☞
Dingbats
✍✎✎
⟱
章节号 | 内容 |
---|---|
1图片格式(png) | 宽度大于620px,保持高宽比减低为620px |
1-1 | 应用 |
1-1-1 | 方法 |
第1章节 VisualBox安装Ubuntu后,源码安装bochs
-
1-1 VisualBox安装Ubuntu后,源码安装bochs—VisualBox全屏显示ubuntu
稍等片刻,虚拟机内部出现安装提示:
点击run后,输入系统密码:
开始安装:
提示安装完毕之后,重启虚拟机:
重启后,可以正常全屏显示:
-
1-2 VisualBox安装Ubuntu后,源码安装bochs—源码安装bochs过程
搜索下载源码:
首先是第一个报错问题,只要安装xorg-dev即可解决:
其次是第二个报错问题:ld returned 1 exit status (bochs)。如果在网上搜索过这个问题,可以发现并不是只有安装bochs会出现这个报错,而且解决方式也各不相同,我这里使用的是如下的方式:
使用文本编辑器编辑Makefile文件:在LIBS行处,添加 -lz -lrt -lm -lpthread
修改完毕后,再次sudo make,还是报错???这是为什么??
这里有一个要特别注意的点,网上很多教程均未提及:
修改完Makefile,一定要再次sudo ./cofigure –enable-debugger –enable-disasm !
make不报错后,执行make install
-
1-3 VisualBox安装Ubuntu后,源码安装bochs—更多配置选项的安装bochs
上述的安装bochs方式,configure部分只有2个选项开启的,这个步骤网上各家众说纷纭,这里再次使用更加丰富的配置选项再次安装一次。
首先确定源码包的下载地址:
sudo wget https://sourceforge.net/projects/bochs/files/bochs/2.6.9/bochs-2.6.9.tar.gz
直接使用sudo wget 命令下载:
sudo tar zxvf bochs-2.6.9.tar.gz
建议首先安装如下包:
sudo apt install gcc
sudo apt-get install libc6-dev
sudo apt-get install build-essential
sudo apt-get install xorg-dev
configure的时候,使用如下选项:
./configure \
--prefix=/home/bochs \
--enable-debugger \
--enable-disasm \
--enable-iodebug \
--enable-x86-debugger \
--with-x \
--with-x11
上述选项的\前均有空格,如果复制粘贴存在问题八成是各种看不见的空格造成的。
说明如下:
| ./configure |
| --prefix= /home/bochs | 设置安装目录为/home/bochs
| --enable-debugger | 打开bochs调试器
| --enable-disasm | 支持反汇编
| --enable-iodebug | 启用IO接口调试
| --enable-x86-debugger | 支持x86调试
| --with-x | 使用x windows
| --with-x11 | 使用xll图形用户接口
出现如下错误,安装GCC:
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
再次报错,安装 sudo apt-get install libc6-dev
:
configure: error: C compiler cannot create executables
再次报错,安装sudo apt-get install build-essential
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
再次报错,安装sudo apt-get install xorg-dev
(耗时较久)
ERROR: X windows gui was selected, but X windows libraries were not found.
!上述各命令执行完毕后,请仔细查看提示信息,防止部分命令执行不完全。如果出现同一问题反复出现,则把相应命令反复执行多次,确保执行完全!
一直configure到没有错误后,先make
,再make install
。如果直接输入bochs无法运行,则找到按照路径,使用./bochs执行。
make install 后的显示:
qwd@qwd-VirtualBox ~/Desktop/bochs-2.6.9 $ sudo make install
cd iodev && \
make libiodev.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/iodev'
make[1]: 'libiodev.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/iodev'
echo done
done
cd iodev/display && \
make libdisplay.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/iodev/display'
make[1]: 'libdisplay.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/iodev/display'
echo done
done
cd iodev/hdimage && \
make libhdimage.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/iodev/hdimage'
make[1]: 'libhdimage.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/iodev/hdimage'
echo done
done
cd bx_debug && \
make libdebug.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/bx_debug'
make[1]: 'libdebug.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/bx_debug'
echo done
done
cd cpu && \
make libcpu.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/cpu'
make[1]: 'libcpu.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/cpu'
echo done
done
cd cpu/cpudb && \
make libcpudb.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/cpu/cpudb'
make[1]: 'libcpudb.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/cpu/cpudb'
echo done
done
cd memory && \
make libmemory.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/memory'
make[1]: 'libmemory.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/memory'
echo done
done
cd gui && \
make libgui.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/gui'
make[1]: 'libgui.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/gui'
echo done
done
cd disasm && \
make libdisasm.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/disasm'
make[1]: 'libdisasm.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/disasm'
echo done
done
cd cpu/fpu && \
make libfpu.a
make[1]: Entering directory '/home/qwd/Desktop/bochs-2.6.9/cpu/fpu'
make[1]: 'libfpu.a' is up to date.
make[1]: Leaving directory '/home/qwd/Desktop/bochs-2.6.9/cpu/fpu'
echo done
done
for i in /home/bochs/bin; do mkdir -p $i && test -d $i && test -w $i; done
for i in bochs bximage; do if test -f $i; then install $i /home/bochs/bin; else install ./$i /home/bochs/bin; fi; done
for i in bochsdbg ; do if test -f $i; then install $i /home/bochs/bin; else install ./$i /home/bochs/bin; fi; done
install: cannot stat './bochsdbg': No such file or directory
Makefile:429: recipe for target 'install_bin' failed
make: [install_bin] Error 1 (ignored)
mkdir -p /home/bochs/share/man/man1
mkdir -p /home/bochs/share/man/man5
for i in bochs bximage bochs-dlx; do cat ./doc/man/$i.1 | sed 's/@version@/2.6.9/g' | gzip -9 -c > /home/bochs/share/man/man1/$i.1.gz; chmod 644 /home/bochs/share/man/man1/$i.1.gz; done
for i in bochsrc; do cat ./doc/man/$i.5 | gzip -9 -c > /home/bochs/share/man/man5/$i.5.gz; chmod 644 /home/bochs/share/man/man5/$i.5.gz; done
for i in /home/bochs/share/bochs; do mkdir -p $i && test -d $i && test -w $i; done
for i in bios/BIOS-bochs-* bios/VGABIOS* bios/SeaBIOS* bios/bios.bin-* ; do if test -f $i; then install -m 644 $i /home/bochs/share/bochs; else install -m 644 ./$i /home/bochs/share/bochs; fi; done
mkdir /home/bochs/share/bochs/keymaps
for i in ./gui/keymaps/*.map; do install -m 644 $i /home/bochs/share/bochs/keymaps/; done
for i in /home/bochs/share/doc/bochs; do mkdir -p $i && test -d $i && test -w $i; done
for i in CHANGES COPYING LICENSE README TODO misc/slirp.conf; do if test -f $i; then install -m 644 $i /home/bochs/share/doc/bochs; else install -m 644 ./$i /home/bochs/share/doc/bochs; fi; done
rm -f /home/bochs/share/doc/bochs/README
cat ./build/linux/README.linux-binary ./README > /home/bochs/share/doc/bochs/README
install -m 644 ./.bochsrc /home/bochs/share/doc/bochs/bochsrc-sample.txt
-
如果对上面的configure设置选项不满意,可以修改--prefix路径,再按照同样方式再编译安装一个bochs即可,切换使用。
-
1-4 VisualBox安装Ubuntu后,源码安装bochs—配置bochs(bochsrc)
安装完成bochs只是万里长征第一步,后续还有配置工作要做。
bochs的配置文件叫做bochsrc,首先要找到这个文件,并做相应设置。
使用find命令,在/(根目录)下,搜索以bochsrc开头的名字有哪些:
qwd@qwd-VirtualBox ~/Desktop $ sudo find / -name bochsrc*
[sudo] password for qwd:
Sorry, try again.
[sudo] password for qwd:
/home/bochs/share/man/man5/bochsrc.5.gz
/home/bochs/share/doc/bochs/bochsrc-sample.txt
/home/qwd/Desktop/bochs-2.6.9/doc/man/bochsrc.5
/home/bochsrc
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/123/1/bochsrc.disk
/usr/share/doc/bochs/examples/bochsrc
/etc/bochs-init/bochsrc
根据目录分析,etc下的应该是安装bochs时候的初始的配置文件,不能随意动。需要的是examples文件夹下的那个,从名字能看出来这是一个样例。
使用sudo gzip -d 解压文件:
qwd@qwd-VirtualBox /usr/share/doc/bochs $ cd /usr/share/doc/bochs/examples/
qwd@qwd-VirtualBox /usr/share/doc/bochs/examples $ ls
bochsrc.gz
qwd@qwd-VirtualBox /usr/share/doc/bochs/examples $ sudo gzip -d bochsrc.gz
qwd@qwd-VirtualBox /usr/share/doc/bochs/examples $ ls
bochsrc
或者:直接复制/home/bochs/share/doc/bochs/bochsrc-sample.txt进行编辑:
qwd@qwd-VirtualBox ~/Desktop $ sudo cp /home/bochs/share/doc/bochs/bochsrc-sample.txt ./
qwd@qwd-VirtualBox ~/Desktop $ ls
bochs-2.6.9 bochs-2.6.9.tar.gz bochsrc-sample.txt
使用vim编辑文档
这里指定了系统的默认启动顺序,可以看见现在是cdrom启动。
下面简要叙述5个关键步骤:
◆ 1、设置内存。这里保持默认不动。关键字:memory。
◆ 2、设置bios路径。关键字:romimage。
◆ 3、设置vga bios路径。关键字:vgaromimage。
◆ 4、设置软盘路径。关键字:floppya。
◆ 5、设置启动盘符。关键字:boot。
◆ 6、设置日志输出。关键字:log。
◆ 7、设置启动鼠标、键盘。关键字:mouse、keyboard。
◆ 8、设置硬盘。关键字:ata0。
#=======================================================================
# ATA0, ATA1, ATA2, ATA3
# ATA controller for hard disks and cdroms
#
# ata[0-3]: enabled=[0|1], ioaddr1=addr, ioaddr2=addr, irq=number
#
# These options enables up to 4 ata channels. For each channel
# the two base io addresses and the irq must be specified.
#
# ata0 and ata1 are enabled by default with the values shown below
#
# Examples:
# ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
# ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
# ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
# ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x360, irq=9
#=======================================================================
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
#=======================================================================
# ATA[0-3]-MASTER, ATA[0-3]-SLAVE
#
# This defines the type and characteristics of all attached ata devices:
# type= type of attached device [disk|cdrom]
# mode= only valid for disks [flat|concat|external|dll|sparse|vmware3]
# [vmware4|undoable|growing|volatile|vpc|vvfat]
# path= path of the image / directory
# cylinders= only valid for disks
# heads= only valid for disks
# spt= only valid for disks
# status= only valid for cdroms [inserted|ejected]
# biosdetect= type of biosdetection [none|auto], only for disks on ata0 [cmos]
# translation=type of translation of the bios, only for disks [none|lba|large|rechs|auto]
# model= string returned by identify device command
# journal= optional filename of the redolog for undoable, volatile and vvfat disks
#
# Point this at a hard disk image file, cdrom iso file, or physical cdrom
# device. To create a hard disk image, try running bximage. It will help you
# choose the size and then suggest a line that works with it.
#
# In UNIX it may be possible to use a raw device as a Bochs hard disk,
# but WE DON'T RECOMMEND IT. In Windows there is no easy way.
#
# In windows, the drive letter + colon notation should be used for cdroms.
# Depending on versions of windows and drivers, you may only be able to
# access the "first" cdrom in the system. On MacOSX, use path="drive"
# to access the physical drive.
#
# The path is mandatory for hard disks. Disk geometry autodetection works with
# images created by bximage if CHS is set to 0/0/0 (cylinders are calculated
# using heads=16 and spt=63). For other hard disk images and modes the
# cylinders, heads, and spt are mandatory. In all cases the disk size reported
# from the image must be exactly C*H*S*512.
#
# Default values are:
# mode=flat, biosdetect=auto, translation=auto, model="Generic 1234"
#
# The biosdetect option has currently no effect on the bios
#
# Examples:
# ata0-master: type=disk, mode=flat, path=10M.sample, cylinders=306, heads=4, spt=17
# ata0-slave: type=disk, mode=flat, path=20M.sample, cylinders=615, heads=4, spt=17
# ata1-master: type=disk, mode=flat, path=30M.sample, cylinders=615, heads=6, spt=17
# ata1-slave: type=disk, mode=flat, path=46M.sample, cylinders=940, heads=6, spt=17
# ata2-master: type=disk, mode=flat, path=62M.sample, cylinders=940, heads=8, spt=17
# ata2-slave: type=disk, mode=flat, path=112M.sample, cylinders=900, heads=15, spt=17
# ata3-master: type=disk, mode=flat, path=483M.sample, cylinders=1024, heads=15, spt=63
# ata3-slave: type=cdrom, path=iso.sample, status=inserted
#=======================================================================
#ata0-master: type=disk, mode=flat, path="d.sample"
#ata0-master: type=disk, mode=flat, path="$HOME/.bochs/guest.hd0", cylinders=#cylinders#, heads=16, spt=63
#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=/dev/cdrom, status=inserted
◆ 9、设置启动鼠标、键盘。关键字:mouse、keyboard。
◆ 10、设置启动鼠标、键盘。关键字:mouse、keyboard。
◆ 11、设置启动鼠标、键盘。关键字:mouse、keyboard。
00000000000e[ ] change of the config interface to wx not implemented yet
00000000000e[ ] wxWidgets was not used as the configuration interface, so it cannot be used as the display library
00000000000e[ ] changing display library to 'x' instead
00000000000i[ ] lt_dlhandle is (nil)
00000000000p[ ] >>PANIC<< dlopen failed for module 'x': file not found
========================================================================
Event type: PANIC
Device: [ ]
Message: dlopen failed for module 'x': file not found
A PANIC has occurred. Do you want to:
cont - continue execution
alwayscont - continue execution, and don't ask again.
This affects only PANIC events from device [ ]
die - stop execution now
abort - dump core
debug - continue and return to bochs debugger
Choose one of the actions above: [die]
qwd@qwd-VirtualBox ~/Desktop $ sudo apt-get install xorg-dev
[sudo] password for qwd:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
-
1-1 类的初步—定义一个类并创建对象实例
1-1-1. 导言—用户管理—用户的分类及介绍
-
1-2 类的初步—定义一个类并创建对象实例
1-2-1. 导言—用户管理—用户的分类及介绍
第2章节
-
2-1 类的初步—定义一个类并创建对象实例
sudo yum install glibc-headers gcc-c++
sudo yum install libX11-devel.x86_64
2-1-1. 导言—用户管理—用户的分类及介绍
-
2-2 类的初步—定义一个类并创建对象实例
2-2-1. 导言—用户管理—用户的分类及介绍
第3章节
-
3-1 类的初步—定义一个类并创建对象实例
3-1-1. 导言—用户管理—用户的分类及介绍
-
3-2 类的初步—定义一个类并创建对象实例
3-2-1. 导言—用户管理—用户的分类及介绍
命令集合:
sudo apt install gcc
sudo apt-get install libc6-dev
sudo apt-get install build-essential
sudo apt-get install xorg-dev