SDU-nachos安裝及初步編譯
nachos:nachos-3.4-SDU.tar.gz
ubuntu:ubuntu-16.04.5-desktop-i386.iso
- 安裝ubuntu 32位
- 將nachos-3.4-SDU.tar.gz壓縮檔案複製到ubuntu,並解壓縮
- 在nachos-3.4-SDU目錄中開啟終端,進入root模式,使用命令“cp -r gcc-2.8.1-mips.tar.gz /usr/local”命令將gcc-2.8.1-mips.tar.gz複製到/usr/local目錄下
- 在/usr/local目錄下使用終端解壓縮gcc-2.8.1-mips.tar.gz檔案:tar -xvf gcc-2.8.1-mips.tar.gz
- 進入Nachos的目錄code/test(簡記為../test),
(1)刪除../test/arch/unknown-i386-linux/depends目錄下的所有檔案;
(2)刪除../test/arch/unknown-i386-linux/objects目錄下的所有檔案
(3)刪除../test目錄下的所有副檔名為.noff的檔案
(4)執行make,如果交叉編譯器安裝成功,../test目錄下幾個.c檔案都產生了一個對應的.noff檔案,同時螢幕應輸出下述資訊:
>>> Linking arch/unknown-i386-linux/objects/halt.coff <<<
/usr/local/mips/bin/decstation-ultrix-ld -T script -N arch/unknown-i386-linux/objects/start.o arch/unknown-i386-linux/objects/halt.o -o arch/unknown-i386-linux/objects/halt.coff
>>> Converting to noff file: arch/unknown-i386-linux/bin/halt <<<
../bin/arch/unknown-i386-linux/bin/coff2noff arch/unknown-i386-linux/objects/halt.coff arch/unknown-i386-linux/bin/halt
numsections 3
Loading 3 sections:
".text", filepos 0xd0, mempos 0x0, size 0x100
".data", filepos 0x1d0, mempos 0x100, size 0x0
".bss", filepos 0x0, mempos 0x100, size 0x0
ln -sf arch/unknown-i386-linux/bin/halt halt
>>> Linking arch/unknown-i386-linux/objects/shell.coff <<<
/usr/local/mips/bin/decstation-ultrix-ld -T script -N arch/unknown-i386-linux/objects/start.o arch/unknown-i386-linux/objects/shell.o -o arch/unknown-i386-linux/objects/shell.coff
>>> Converting to noff file: arch/unknown-i386-linux/bin/shell <<<
../bin/arch/unknown-i386-linux/bin/coff2noff arch/unknown-i386-linux/objects/shell.coff arch/unknown-i386-linux/bin/shell
numsections 3
Loading 3 sections:
".text", filepos 0xd0, mempos 0x0, size 0x200
".data", filepos 0x2d0, mempos 0x200, size 0x0
".bss", filepos 0x0, mempos 0x200, size 0x0
ln -sf arch/unknown-i386-linux/bin/shell shell
>>> Linking arch/unknown-i386-linux/objects/matmult.coff <<<
/usr/local/mips/bin/decstation-ultrix-ld -T script -N arch/unknown-i386-linux/objects/start.o arch/unknown-i386-linux/objects/matmult.o -o arch/unknown-i386-linux/objects/matmult.coff
>>> Converting to noff file: arch/unknown-i386-linux/bin/matmult <<<
../bin/arch/unknown-i386-linux/bin/coff2noff arch/unknown-i386-linux/objects/matmult.coff arch/unknown-i386-linux/bin/matmult
numsections 3
Loading 3 sections:
".text", filepos 0xd0, mempos 0x0, size 0x3c0
".data", filepos 0x490, mempos 0x3c0, size 0x0
".bss", filepos 0x0, mempos 0x3c0, size 0x12c0
ln -sf arch/unknown-i386-linux/bin/matmult matmult
>>> Linking arch/unknown-i386-linux/objects/sort.coff <<<
/usr/local/mips/bin/decstation-ultrix-ld -T script -N arch/unknown-i386-linux/objects/start.o arch/unknown-i386-linux/objects/sort.o -o arch/unknown-i386-linux/objects/sort.coff
>>> Converting to noff file: arch/unknown-i386-linux/bin/sort <<<
../bin/arch/unknown-i386-linux/bin/coff2noff arch/unknown-i386-linux/objects/sort.coff arch/unknown-i386-linux/bin/sort
numsections 3
Loading 3 sections:
".text", filepos 0xd0, mempos 0x0, size 0x2c0
".data", filepos 0x390, mempos 0x2c0, size 0x0
".bss", filepos 0x0, mempos 0x2c0, size 0x1000
ln -sf arch/unknown-i386-linux/bin/sort sort
6. 在終端視窗下進入目錄code/threads/,執行make命令,可編譯生成一個基本的Nachos核心(多執行緒)。編譯時如果螢幕輸出的最後幾行資訊如下:
....>>> Linking arch/unknown-i386-linux/bin/nachos <<<
g++ arch/unknown-i386-linux/objects/main.o ........................
..................................................................
..................................................................
ln -sf arch/unknown-i386-linux/bin/nachos nachos
表示已經成功編譯生成了一個最小的Nachos核心。目錄threads/下的檔案nachos是一連結到可執行程式arch/unknown-i386-linux/bin/nachos的連結檔案。