ucore_lab0

一直想好好學習一下操做系統課程,去一個Mooc網站上找了一門操做系統的課程。這即是裏面的配套實驗。
實驗指導:點這裏html

lab0主要是準備相關的操做環境。課程推薦使用qemu做爲硬件模擬器,推薦運行環境爲linux操做系統。
由於我使用的是Windows系統,因此須要解決運行環境的問題。開始想了幾種解決方案:一個是直接裝一個Linux的操做系統,可是以爲這樣子系統切換太麻煩了;一個是租一臺雲服務器,在網上看了一下感受國內都略貴的樣子;還有就是本身裝一個虛擬機了,雖然這樣子可能有時候性能會有點慢。
另外,在網上看到有個叫作"實驗樓"的網站,上面有這門課的配套實驗。網站會給你分配和佈置實驗設備。在上面用過幾回,以爲每次都會從新分配機器,不是很方便。還有就是畢竟是別人佈置的環境,總有種不自由的感受。對於我這種新手若是碰到莫名其妙的問題,而解決方案要改權限什麼的話,就懵逼了。
因此,我最終仍是選擇了在虛擬機上裝一個Ubuntu。linux

安裝Ubuntu虛擬機

虛擬機通常有兩種選擇:一個是VMWare Workstation,另外一個是Virtual Box。我選擇了VBox,由於這個是免費的。git

Virtaul Box的安裝過程按照默認的選項就行了,沒有什麼特別之處。ubuntu

安裝好之後,在VBox裏面新建一個Ubuntu的設備就行了。我使用的虛擬設備配置以下:windows

內存: 1GB
硬盤:10GB (原本Vbox建議的是8GB,可是後來安裝系統的時候至少要8G空間來訪系統配置,而後我就給了10G)服務器

而後點擊"運行"的時候,說須要讀啓動盤。到網上搜了一下,說要下一個鏡像放進去。
因而,我去下了一個鏡像,用虛擬光驅讀出來。
接下來的過程,就是像給正常機器裝系統同樣,在虛擬設備上裝了一個Ubuntu系統,裝好之後就再也不須要啓動盤了。工具

爲了方便和虛擬機之間傳輸數據,在虛擬設備裏面掛載了一個共享盤。具體細節能夠參考這裏性能

Virtaul Box下載地址:https://www.virtualbox.org/wiki/Downloads
Ubuntu下載地址(選Desktop就行了):https://www.ubuntu.com/download學習

安裝qemu

去官網上下了一個壓縮包。打開發現是源碼。因而上網搜了一下,安裝的過程大約是下面這樣子。測試

cd /qemu-xxxx

./configure

sudo make

sudo make install

在make 時出現瞭如下錯誤:

GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     aarch64-softmmu/config-devices.mak
  GEN     alpha-softmmu/config-devices.mak.tmp
  GEN     alpha-softmmu/config-devices.mak
  GEN     arm-softmmu/config-devices.mak.tmp
  GEN     arm-softmmu/config-devices.mak
  GEN     cris-softmmu/config-devices.mak.tmp
  GEN     cris-softmmu/config-devices.mak
  GEN     i386-softmmu/config-devices.mak.tmp
  GEN     i386-softmmu/config-devices.mak
  GEN     lm32-softmmu/config-devices.mak.tmp
  GEN     lm32-softmmu/config-devices.mak
  GEN     m68k-softmmu/config-devices.mak.tmp
  GEN     m68k-softmmu/config-devices.mak
  GEN     microblaze-softmmu/config-devices.mak.tmp
  GEN     microblaze-softmmu/config-devices.mak
  GEN     microblazeel-softmmu/config-devices.mak.tmp
  GEN     microblazeel-softmmu/config-devices.mak
  GEN     mips-softmmu/config-devices.mak.tmp
  GEN     mips-softmmu/config-devices.mak
  GEN     mips64-softmmu/config-devices.mak.tmp
  GEN     mips64-softmmu/config-devices.mak
  GEN     mips64el-softmmu/config-devices.mak.tmp
  GEN     mips64el-softmmu/config-devices.mak
  GEN     mipsel-softmmu/config-devices.mak.tmp
  GEN     mipsel-softmmu/config-devices.mak
  GEN     moxie-softmmu/config-devices.mak.tmp
  GEN     moxie-softmmu/config-devices.mak
  GEN     or32-softmmu/config-devices.mak.tmp
  GEN     or32-softmmu/config-devices.mak
  GEN     ppc-softmmu/config-devices.mak.tmp
  GEN     ppc-softmmu/config-devices.mak
  GEN     ppc64-softmmu/config-devices.mak.tmp
  GEN     ppc64-softmmu/config-devices.mak
  GEN     ppcemb-softmmu/config-devices.mak.tmp
  GEN     ppcemb-softmmu/config-devices.mak
  GEN     s390x-softmmu/config-devices.mak.tmp
  GEN     s390x-softmmu/config-devices.mak
  GEN     sh4-softmmu/config-devices.mak.tmp
  GEN     sh4-softmmu/config-devices.mak
  GEN     sh4eb-softmmu/config-devices.mak.tmp
  GEN     sh4eb-softmmu/config-devices.mak
  GEN     sparc-softmmu/config-devices.mak.tmp
  GEN     sparc-softmmu/config-devices.mak
  GEN     sparc64-softmmu/config-devices.mak.tmp
  GEN     sparc64-softmmu/config-devices.mak
  GEN     tricore-softmmu/config-devices.mak.tmp
  GEN     tricore-softmmu/config-devices.mak
  GEN     unicore32-softmmu/config-devices.mak.tmp
  GEN     unicore32-softmmu/config-devices.mak
  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     x86_64-softmmu/config-devices.mak
  GEN     xtensa-softmmu/config-devices.mak.tmp
  GEN     xtensa-softmmu/config-devices.mak
  GEN     xtensaeb-softmmu/config-devices.mak.tmp
  GEN     xtensaeb-softmmu/config-devices.mak
  GEN     aarch64-linux-user/config-devices.mak.tmp
  GEN     aarch64-linux-user/config-devices.mak
  GEN     alpha-linux-user/config-devices.mak.tmp
  GEN     alpha-linux-user/config-devices.mak
  GEN     arm-linux-user/config-devices.mak.tmp
  GEN     arm-linux-user/config-devices.mak
  GEN     armeb-linux-user/config-devices.mak.tmp
  GEN     armeb-linux-user/config-devices.mak
  GEN     cris-linux-user/config-devices.mak.tmp
  GEN     cris-linux-user/config-devices.mak
  GEN     i386-linux-user/config-devices.mak.tmp
  GEN     i386-linux-user/config-devices.mak
  GEN     m68k-linux-user/config-devices.mak.tmp
  GEN     m68k-linux-user/config-devices.mak
  GEN     microblaze-linux-user/config-devices.mak.tmp
  GEN     microblaze-linux-user/config-devices.mak
  GEN     microblazeel-linux-user/config-devices.mak.tmp
  GEN     microblazeel-linux-user/config-devices.mak
  GEN     mips-linux-user/config-devices.mak.tmp
  GEN     mips-linux-user/config-devices.mak
  GEN     mips64-linux-user/config-devices.mak.tmp
  GEN     mips64-linux-user/config-devices.mak
  GEN     mips64el-linux-user/config-devices.mak.tmp
  GEN     mips64el-linux-user/config-devices.mak
  GEN     mipsel-linux-user/config-devices.mak.tmp
  GEN     mipsel-linux-user/config-devices.mak
  GEN     mipsn32-linux-user/config-devices.mak.tmp
  GEN     mipsn32-linux-user/config-devices.mak
  GEN     mipsn32el-linux-user/config-devices.mak.tmp
  GEN     mipsn32el-linux-user/config-devices.mak
  GEN     or32-linux-user/config-devices.mak.tmp
  GEN     or32-linux-user/config-devices.mak
  GEN     ppc-linux-user/config-devices.mak.tmp
  GEN     ppc-linux-user/config-devices.mak
  GEN     ppc64-linux-user/config-devices.mak.tmp
  GEN     ppc64-linux-user/config-devices.mak
  GEN     ppc64abi32-linux-user/config-devices.mak.tmp
  GEN     ppc64abi32-linux-user/config-devices.mak
  GEN     ppc64le-linux-user/config-devices.mak.tmp
  GEN     ppc64le-linux-user/config-devices.mak
  GEN     s390x-linux-user/config-devices.mak.tmp
  GEN     s390x-linux-user/config-devices.mak
  GEN     sh4-linux-user/config-devices.mak.tmp
  GEN     sh4-linux-user/config-devices.mak
  GEN     sh4eb-linux-user/config-devices.mak.tmp
  GEN     sh4eb-linux-user/config-devices.mak
  GEN     sparc-linux-user/config-devices.mak.tmp
  GEN     sparc-linux-user/config-devices.mak
  GEN     sparc32plus-linux-user/config-devices.mak.tmp
  GEN     sparc32plus-linux-user/config-devices.mak
  GEN     sparc64-linux-user/config-devices.mak.tmp
  GEN     sparc64-linux-user/config-devices.mak
  GEN     tilegx-linux-user/config-devices.mak.tmp
  GEN     tilegx-linux-user/config-devices.mak
  GEN     x86_64-linux-user/config-devices.mak.tmp
  GEN     x86_64-linux-user/config-devices.mak
  GEN     config-all-devices.mak
  GEN     config-host.h
(cd /home/phantom01/work/qemu/pixman; autoreconf -v --install)
/bin/sh: 1: autoreconf: not found
Makefile:211: recipe for target '/home/phantom01/work/qemu/pixman/configure' failed
make: *** [/home/phantom01/work/qemu/pixman/configure] Error 127

./pixman/目錄下看了一下,確實沒有configure文件,可是有一個configure.ac。因此須要autoreconf工具,將這個configure.ac生成對應的configure文件。
因此,接下來我安裝了autoreconf

apt-get install autoconf automake libtool

而後切換到pixman目錄下面執行

autoreconf -v --install

來生成configure文件。
而後在切到qemu目錄下執行make。而後在 sudo make install成功。

爲方便操做,創建軟鏈接:

sudo ln -s /usr/local/bin/qemu-system-i386 /usr/local/bin/qemu

注意點: make失敗是不要clean再從新make。由於在make過程當中會改變一些make文件,因此clean掉可能會出一些問題。

qemu下載地址:http://wiki.qemu.org/Download

附1: VirtualBox建立內Linux系統與Windows的共享文件夾

來源: http://jingyan.baidu.com/article/2fb0ba40541a5900f2ec5f07.html

在平常工做或學習中咱們常常須要在一臺電腦上同時使用Windows和Linux(這裏以Ubuntu爲例)兩個系統,咱們一般的作法有兩種:

一種安裝雙系統(雙系統的安裝方法經驗裏已經有不少,你們能夠去參照)

另外一種更爲廣泛的是在Windows本機用虛擬機安裝Linux系統,然而Windows本機與虛擬機內Linux系統的文件該如何交換呢,其實也有好多方法,如USB接口設備共享、Ftp服務器共享等,這裏主告訴告訴你們一種更爲方便辦法「共享文件夾」(這個方法在windows虛擬系統上設置比較簡單),下面咱們看看如何讓Windows本機和Linux虛擬系統之間共享文件夾。


工具/原料

  • Oracle VM VirtualBox
  • Windows XP 以上操做系統

    方法/步驟

  1. 首先,必需要有已經在VirtualBox中安裝好的Ubuntu系統,才能按照如下步驟操做,具體怎樣在VirtualBox中安裝Ubuntu系統百度經驗裏已經有不少,你們能夠本身查詢參照。
  2. 打開虛擬機進入Ubuntu系統,首先要安裝VirtualBox加強功能包(VBoxGuestAdditions),參照下圖,若是確認已經安裝就直接跳過至第4步。 (設備 - 安裝加強功能)
  3. 點擊運行後,系統會自動安裝,安裝完成後要求重啓系統。
  4. 在本機系統設置一個共享文件夾,用於與Ubuntu交互的區域空間。
  5. 右擊狀態欄上共享文件夾圖標或菜單欄「設備-共享文件夾」,打開共享文件夾設置。
  6. 點擊共享文件夾設置框,右上角的添加按鈕
  7. 選擇以前本機設置的共享文件夾,此時必定不能夠勾選自動掛載
  8. 設置好共享名後,進入Ubuntu系統,打開終端,先執行命令,在掛載點目錄添加bdshare目錄,接着執行mount -t vboxsf BaiduShare /mnt/bdshare/,就能完成共享文件夾的設置。
  9. 設置完成,能夠建立幾個文件,測試一下。
  10. 設置自動掛載,重啓虛擬機系統共享仍在。能夠在/etc/fstab中添加一項BaiduShare /mnt/share vboxsf rw,gid=110,uid=1100,auto 0 0
  11. 卸載掛載點命令:umount -f /mnt/share

    注意事項

  • 其它linux系統設置方法基本相同
  • 共享文件夾的名稱不能和掛載點的名稱相同。

參考資料

  1. http://www.lofter.com/tag/ucore
本站公眾號
   歡迎關注本站公眾號,獲取更多信息