一男翰,MIT6.828課程實驗環(huán)境搭建

1.步驟

  1. 安裝VMware15并安裝虛擬機 Ubuntu18.04.3
  2. 安裝git 和python
  3. 按照tools安裝編譯器工具鏈
  4. 編譯jos系統(tǒng)并加載

輸入命令: % objdump -i
第二行結(jié)果為elf32-i386
輸入: % gcc -m32 -print-libgcc-file-name
結(jié)果為Command 'gcc' not found, but can be installed with:
安裝gcc % sudo apt-get install -y build-essential gdb

輸入
 @ubuntu:~$ gcc -m32 -print-libgcc-file-name
結(jié)果成功
/usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a 

下載qemu
git clone https://github.com/mit-pdos/6.828-qemu.git qemu
還可需要安裝libsdl1.2-dev快耿、libtool-bin囊陡、libglib2.0-dev、libz-dev 和 libpixman-1-dev润努。
再輸入:

1 % cd qemu/
2 % ./configure
3.%  make
報錯
  CC    qga/commands-posix.o
qga/commands-posix.c: In function ‘dev_major_minor’:
qga/commands-posix.c:633:13: error: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>. [-Werror]
         *devmajor = major(st.st_rdev);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                              
qga/commands-posix.c:634:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
         *devminor = minor(st.st_rdev);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                              
cc1: all warnings being treated as errors


解決方法:
在 qga/commands-posix.c文件中加 #include <sys/sysmacros.h>


再報錯:
block/blkdebug.c: In function ‘blkdebug_refresh_filename’:
block/blkdebug.c:749:31: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4086 [-Werror=format-truncation=]
                  "blkdebug:%s:%s",
                               ^~
In file included from /usr/include/stdio.h:862:0,
                 from /home/wzd/qemu/include/qemu-common.h:27,
                 from block/blkdebug.c:25:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 11 or more bytes (assuming 4106) into a destination of size 4096
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
/home/wzd/qemu/rules.mak:57: recipe for target 'block/blkdebug.o' failed

解決方法:config-host.mak文件中的-Werror去掉 
4. % sudo make install

下載jos源碼
git clone https://pdos.csail.mit.edu/6.828/2018/jos.git lab

% cd lab 
% sudo make
報錯:
ld: warning: section `.bss' type changed to PROGBITS
obj/kern/printfmt.o: In function `printnum':
lib/printfmt.c:41: undefined reference to `__udivdi3'
lib/printfmt.c:49: undefined reference to `__umoddi3'
kern/Makefrag:70: recipe for target 'obj/kern/kernel' failed
make: *** [obj/kern/kernel] Error 1
解決方法:
% sudo apt-get install gcc-4.8-multilib
再編譯:
% sudo make
% sudo make qemu

終于成功


image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市示括,隨后出現(xiàn)的幾起案子铺浇,更是在濱河造成了極大的恐慌,老刑警劉巖垛膝,帶你破解...
    沈念sama閱讀 216,843評論 6 502
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件鳍侣,死亡現(xiàn)場離奇詭異丁稀,居然都是意外死亡,警方通過查閱死者的電腦和手機倚聚,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,538評論 3 392
  • 文/潘曉璐 我一進店門线衫,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人惑折,你說我怎么就攤上這事授账。” “怎么了惨驶?”我有些...
    開封第一講書人閱讀 163,187評論 0 353
  • 文/不壞的土叔 我叫張陵白热,是天一觀的道長。 經(jīng)常有香客問我粗卜,道長屋确,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,264評論 1 292
  • 正文 為了忘掉前任续扔,我火速辦了婚禮攻臀,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘纱昧。我一直安慰自己刨啸,他們只是感情好,可當我...
    茶點故事閱讀 67,289評論 6 390
  • 文/花漫 我一把揭開白布砌些。 她就那樣靜靜地躺著呜投,像睡著了一般。 火紅的嫁衣襯著肌膚如雪存璃。 梳的紋絲不亂的頭發(fā)上仑荐,一...
    開封第一講書人閱讀 51,231評論 1 299
  • 那天,我揣著相機與錄音纵东,去河邊找鬼粘招。 笑死,一個胖子當著我的面吹牛偎球,可吹牛的內(nèi)容都是我干的洒扎。 我是一名探鬼主播,決...
    沈念sama閱讀 40,116評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼衰絮,長吁一口氣:“原來是場噩夢啊……” “哼袍冷!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起猫牡,我...
    開封第一講書人閱讀 38,945評論 0 275
  • 序言:老撾萬榮一對情侶失蹤胡诗,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體煌恢,經(jīng)...
    沈念sama閱讀 45,367評論 1 313
  • 正文 獨居荒郊野嶺守林人離奇死亡骇陈,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,581評論 2 333
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了瑰抵。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片你雌。...
    茶點故事閱讀 39,754評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖二汛,靈堂內(nèi)的尸體忽然破棺而出婿崭,到底是詐尸還是另有隱情,我是刑警寧澤习贫,帶...
    沈念sama閱讀 35,458評論 5 344
  • 正文 年R本政府宣布逛球,位于F島的核電站,受9級特大地震影響苫昌,放射性物質(zhì)發(fā)生泄漏颤绕。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,068評論 3 327
  • 文/蒙蒙 一祟身、第九天 我趴在偏房一處隱蔽的房頂上張望奥务。 院中可真熱鬧,春花似錦袜硫、人聲如沸氯葬。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,692評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽帚称。三九已至,卻和暖如春秽澳,著一層夾襖步出監(jiān)牢的瞬間闯睹,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,842評論 1 269
  • 我被黑心中介騙來泰國打工担神, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留楼吃,地道東北人。 一個月前我還...
    沈念sama閱讀 47,797評論 2 369
  • 正文 我出身青樓妄讯,卻偏偏與公主長得像孩锡,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子亥贸,可洞房花燭夜當晚...
    茶點故事閱讀 44,654評論 2 354

推薦閱讀更多精彩內(nèi)容