2013年12月25日 星期三

[IOS] HW3 Virtual address translation and COW in fork


這次的作業需求分成兩個 task:

Task 1
Implement a custom system call to translate a virtual address to physical
address.

Task 2
Verify that "fork" uses copy-on-write in the creation of child process address
space.




Step1 

在 Task 1 的地方想在 Virtualbox 上灌個 Fedora 20 做,然後每次都開圖形介面很麻煩而且又不必要,所以就在 Virtualbox 上的 Fedora enable ssh.

yum install openssh-server-sysvinit

然後修改 /etc/ssh/sshd_config 把 Port 22 前面的註解拿掉。
因為不會有外面的人連進來,所以安全性就不需要考慮,接下來就

service sshd start

然後就開好了。

接下來修改 Virtualbox 的設定,增加 port fowarding
然後就可以在本機開 terminal 直接連進去虛擬機寫了 :D


Reference:
http://forums.fedoraforum.org/showthread.php?p=1601924
http://superuser.com/questions/424083/virtualbox-host-ssh-to-guest


Step 2

接下來就開始下載 source code 然後 build kernel !(版本號可以自己選XD)

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.11.10.tar.xz

tar Jxvf linux-3.11.10.tar.xz

然後修改要改的地方,接下來就可以 build kernel 了



Step 3

make menuconfig

然後這裡可以修改個小地方,在 General Setup的地方點進去,然後修改

(joyqul-oshw) Local version - append to kernel release
[*] Automatically append version information to the version string


這樣之後他 install 完之後名稱就會自動變成 3.11.10-joyqul-oshw 囉





然後記得存成 .config


Step 4

make -j 16

這邊的數字就看機器性能去改變數字囉

接下就:

sudo make module_install install

然後看一下 /boot 目錄下有沒有出現該出現的東西,接下來重新開機選擇剛剛編出來的東西就可以囉 : D


Reference:
http://www.howopensource.com/2011/08/how-to-compile-and-install-linux-kernel-3-0-in-ubuntu-11-04-10-10-and-10-04/
http://linux.vbird.org/linux_basic/0540kernel.php#make_kernel


Step 5

接下來就呼叫剛剛寫的 system call,呼叫的方法是:

syscall(syscall_num, syscall_parameter1, syscall_parameter2);

然後就可以來看是不是有修改的時候他才會真的 copy 一份。



沒有留言:

張貼留言