From now on, I'll start the jos labs to improve my operating system knowledge.
The lab0( actually it does not exist in 6.828 ) is a preparation for the whole lab. To those who do not use the MIT system, this step is not so easy. Here I will write down the problems I met in my procedure. Well, Let's start.
1.check out the src code from svn
I've created a project named myjos in google code to put my src code and it's convienient to manage the src code and share with others. It can be checked out by:
svn checkout https://myjos.googlecode.com/svn/trunk/ myjos --username xuczhang
2. install the bochs
Bochs2.2.6 is recommented, as there will be less and common problem met in the furture lab when you use the same bochs version with the lab requirement.
In svn, I put a directory called "bochs" in the myjos/. There are 2 files in this directory: bochs-2.2.6-6.828r2.tar.gz , bochs-install.sh
these two files are provided by the lab, but I changed a little in bochs-install.sh script. Let it use the bochs-2.2.6-6.828r2.tar.gz instead of download it from MIT server. Just ignore what I changed, and use it.
If you are very very lucky, there will be no error found in the whole make procedure. I met 2 problems listed in the below:
(1) when in the configure , a X windows library not found error, I fixed it by install all the X11 lib-devel, eg: libICE-devel, libSM-devel
(2) in make, a wx compilation error was found. I fixed it by "remove" all the wx library installed: wxGTK,wxGTK-devel,wxGTK-gl,wxGlade, and then reconfigured and make again, that's ok.
(3) This a big problem, I install the Fedora 10 in virtual box. And the gcc used in Fedora 10 is 4.3, there will be a lot of compliation error when make the bochs, the solution I solve the problem is to install gcc3.4 on it. The concrete way to install an alternative gcc in Fedora you can refer the passage: jos-installing-alternate-gcc-compiler-on-fedora. and add a CC/CXX tags in the configure, like:
./configure --enable-disasm \
--enable-smp \
--enable-debugger \
--enable-new-pit \
--enable-all-optimizations \
--enable-4meg-pages \
--enable-global-pages \
--enable-pae \
--enable-all-optimizations \
--disable-reset-on-triple-fault \
--with-all-libs \
--with-x \
--with-x11 \
--with-nogui \
CC=gcc34 \
CXX=g++34
Attention: do NOT run the bochs-install.sh by sudo, it will not pass the configure.
Another way to make bochs instead of installing gcc3.4:
三、make
在运行make之前需要修改两个文件
第一个文件是/home/Ubuntu/Desktop/bochs-2.3.7/bx_debug/symbols.cc
在97行之后加入代码如下,
using namespace std;
#ifdef __GNUC__ //修改
using namespace __gnu_cxx; //修改
#endif //修改
struct symbol_entry_t
附symbols修改.cc
第二个文件是/home/Ubuntu/Desktop/bochs-2.3.7/Makefile
将其中有关docbook的部分删除或注释掉,
附Makefile修改
文件修改完毕,在目录/home/Ubuntu/Desktop/bochs-2.3.7/下执行
sudo make
3. test the bochs works or not
After install the bochs, cd to lab1 directory and make it first, then type "bochs" in the lab1 directory.
Bochs Debug Instruction
The tutorial page is : http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.html