portable ubuntu的raid1支援 - Linux

Valerie avatar
By Valerie
at 2011-11-02T15:10

Table of Contents

本來,想說raid1可以用modules來載入,但是,沒有編進去,所以不得已,就只好
自己來了。感想是:如果有一個悠閒的暑假來編的話,事情會更完美。

http://colinux.wikia.com/wiki/Raid_solution
這一篇是參考的,主要是mdadm的使用,至於核心,看這一篇,絕對編不出來。
要看colinux的tar.gz,可以去網路上下載。這邊選用的stabl 0.7.9版本。
把它解開,可以在 colinux-0.7.9/doc/building裡面的第四段找到。還蠻清楚的,
這邊把它結錄下來,因為有不好處理的地方。
===========================================================================
4. Building a coLinux kernel
----------------------------

4.1 Kernel build dependencies

You can check the gcc version that was used to build your coLinux by typing
"dmesg | head -n1", this would print text like: "gcc version 3.4.5". In
that case you need a gcc version 3.4.x, check it by running "gcc --version".
If you do not have it try "apt-get install gcc" to install it. If you do not
have such packet to install, probably you need to build gcc yourself from
source. The script bin/build-cross.sh does it, if you have ran "./configure".

The default gcc version is defined in the file bin/build-common.sh. You can
only change it, if there exists a MinGW version of this gcc. After changing
it, you also need to rebuild the cross gcc and all daemons. We suggest you
not change the gcc version to an older version. Read the coLinux changelog
(inside Subversion) about the problems with older gcc versions and the
fixes. If you are up to it, then compile gcc-4.2.0 for MinGW and Linux.

Since coLinux version 0.7.2 the gcc dosn't longer depends on one major gcc
version. The ABI is runtime checked and inside the building now. This opens
more gcc versions for kernel builds (tested from 3.4.x up to gcc 4.3.0).
Usebility of installed gcc can check with "./configure --no-create".


4.2 Compiling the Cooperative Linux kernel (the vmlinux file)

Unpack the source tarball of coLinux. Locate the file series-2.6.22.18
in the directory patch/. This file give you the supported kernel versions.
(version 2.6.22.18 for instance, can be obtained from www.kernel.org)
Unpack the kernel tar in home directory. Make sure that the directory
of the Linux kernel is named 'linux-2.6.22.18'.

Apply the patches found in the series file to the Linux kernel
as exactly in this order. If conflicts arrise, then it is
possible that there is a mismatch between the version of the kernel
and the version that the patch is designed to apply to.

Series file was handled by quilt. You can create a single patch file
of all the pathes, than you can use this summary file for patching
the kernel source. Simply cat all files to one file.

Locate function "patch_kernel_source" from bin/build-kernel.sh, to find
more examples for patching kernel and the quilt handling.

For example:
~/# cd PathToColinux/patch
~/PathToColinux/patch# cat `cat series-2.6.22.18` > /tmp/sumary.patch
~/PathToColinux/patch# cd
~/# wget
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.18.tar.bz2
~/# bunzip2 -dc linux-2.6.22.18.tar.bz2 | tar x
~/# cd linux-2.6.22.18
~/linux-2.6.22.18# patch -p1 < /tmp/sumary.patch
~/linux-2.6.22.18# rm /tmp/sumary.patch

The coLinux package is supplied with a premaid Linux kernel
configuration file. Copy it to your kernel tree:

~/linux-2.6.22.18# cp PathToColinux/conf/linux-2.6.22.18-config .config

Append coLinux version information to kernel version name:
~/linux-2.6.22.18# echo "-co-private" > localversion-cooperative

Update config and build vmlinux:
~/linux-2.6.22.18# make oldconfig
~/linux-2.6.22.18# make vmlinux

Module build and install:
~/linux-2.6.22.18# make modules
~/linux-2.6.22.18# sudo make modules_install


4.3 Testing new kernel builds

Backup the current file "vmlinux" from coLinux install directory and copy
the new file from kernel build tree to the coLinux install directory.

Than test to run this unchanged kernel with your daemons.

Be sure to save all your work and the disk cache, before you run your new
kernel first time. On windows, only a reboot save the disk cache. I suggest
you, reboot windows _before_ you start the new kernel!

After these steps you can modify kernel config or add some special patches
and rebuild your special kernel.
==============================================================================

注意到文中有 cat `cat series-2.6.33.7`那個指令。就是把/patch 裡面關於2.6.33.7
核心的patch的diff檔,全部給集中在一塊。如果沒有作這個動作的話,包準patch到想
哭。

然後,就可以把產生的檔案給patch到2.6.33.7的核心源碼裡面了。這一步是可以成功的。
把/conf/linux-2.6.33.7-conf這個檔案給烤備到 /usr/src/linux-2.6.33.7/.config
就可以執行make menuconfig

make menuconfig
把raid0,1打開,順便把ext4給編入到核心中,不使用modules。
不過我在編的時候有出現問題,不外乎就是includes裡想的檔案有重覆定義的關係,
所以我就很手賤地把重覆定義的程式碼裡面的 include 的,都/* */掉了。

當然,邊出來的核心,還是有一點點那麼不讓人放心。不過是可以編過的。

make vmlinux,把 /usr/src/linux-2.6.33.7/vmlinux直接烤備到
portable_ubuntu/colinux/vmlinux下面。把vmlinux蓋掉就行了。不過要記得備分。

接下來就可以試試看能不能重新開機。不能重新開機的話,就把vmlinux給還原。然後,
想辦法解決問題。

如果有一整個暑假讓我玩的話,應該會是一個愉快的經驗。

好了,已經可以重新開機的話。
cd /usr/src/linux-2.6.33.7
把剩下的modules以及/boot下面的相關東西都給裝上去。如果有想到使用modules的話。
裡面的modules還蠻拉雜的,可裝可不裝,看個人需求,如果有需求的話,就把它給裝
上去,或者是直接編到核心裡面就好了。

經過試驗 ext4 以及 raid1 都支援了。

就可以參考網頁的作法了。還蠻簡單的。

--
Tags: Linux

All Comments

dialog顯示 和 putty

Ophelia avatar
By Ophelia
at 2011-11-02T02:13
請問一下用putty連上ubuntu後, 使用dialog來畫的視窗框架的部分會是亂碼。 這有辦法設定putty來解決嗎?(我有設成utf8) 還是只能用dialog配合--ascii-lines參數, 但是這樣的話,畫面就差多了。 - ...

ubuntu 11.04 磁碟分割與雙系統

Dora avatar
By Dora
at 2011-11-01T23:33
※ 引述《upp818 (Maxis)》之銘言: : 因為電腦是拿來當server : 所以先灌了ubuntu 11.04 : 直到最近要灌 wi7 時 : 才遇到磁區分割的問題 : 1. 要如何調整磁區大小 : 我已經把整顆硬碟全部分給 ubuntu : 如何縮小已經建立的磁區(不 format ...

請問有在賣SEVER的廠商

Lydia avatar
By Lydia
at 2011-11-01T20:04
請問各位知道有接洽過那些廠商不錯的嗎? 最近要替實驗室買SEVER 自己雖然用LINUX的系統一年多了 但是還是嫩嫩的 主要是要用來跑模擬運算 還煩請各位推薦一下 最好是可以根據我的需求配置的 例如我想要的CPU和機殼等等這樣 謝謝各位囉 -- 只有在被愛的時候 才會發現自己是多麼的重要 ...

ubuntu 11.04 磁碟分割與雙系統

Victoria avatar
By Victoria
at 2011-11-01T20:00
因為電腦是拿來當server 所以先灌了ubuntu 11.04 直到最近要灌 wi7 時 才遇到磁區分割的問題 1. 要如何調整磁區大小 我已經把整顆硬碟全部分給 ubuntu 如何縮小已經建立的磁區(不 format) 割一塊來灌 win 7 ? 2. GRUB 修復 ...

ubuntu上安裝nvidia驅動後進不到x-window

Olive avatar
By Olive
at 2011-11-01T19:35
各位前輩 小弟是Linux新手 小弟在自己的筆電上裝了nvidia的格外驅動 但之後重開機後,只能進入命令列模式,進不去x-woindow得介面 不知有沒有前輩碰過這問題,懇請幫忙解決,謝謝!! - ...