操作系统⮱⮱001【实验环境搭建】2019-11-10

←↑→↓↖↙↗↘↕
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到没有错误后,makemake 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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,088评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,715评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,361评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,099评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 60,987评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,063评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,486评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,175评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,440评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,518评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,305评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,190评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,550评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,880评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,152评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,451评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,637评论 2 335

推荐阅读更多精彩内容