Tommy 碎碎念

Tommy Wu's blog

« 上一篇 | 下一篇 »

自行編譯 Utilite 使用的 kernel
post by tommy @ 23 十一月, 2013 11:17

目前官方編譯的 kernel 少了許多的功能 (例如, 沒有把 netfilter 編進去, 要拿來當 router/firewall 就很困難), 所以有需的就就必須要自行編譯.

首先, Utilite 有把使用的 kernel 與 uboot 放在 gitorious 上頭 (看起來是每一次有 release 才會 push 上去), 所以... 要用的就自己 git clone 下來:

cd /usr/src
git clone git://gitorious.org/utilite/utilite.git

這樣在 /usr/src/utilite 下就有 utilite 使用的 kernel tree 了.

接著, 取得目前用的 kernel (在 utilite 的機器上) 的設定:

zcat /proc/config.gz > /usr/src/utilite/.config

如果你是在 utilite 或之前所說的自行建立的 armhf 的 chroot 環境, 就可以依據一般編譯 kernel 的方式:

make menuconfig
make uImage modules
make modules_install
make firmware_install

選擇自己要的 kernel 功能, 然後 build 成 uImage 的格式與相關的 module, 再安裝 module 與 firmware, 最後把 arch/arm/boot/uImage 複製到你的 /boot 下頭的 uImage-cm-fx6 (預設的 uboot 是載入這個檔案), 就可以用新的 kernel 了. (不支援 multi-boot, 不能在開機的時候去選要用的 kernel)

當然, 直接在 utilite 上頭編譯 kernel 會佔用很久的時間, 而在一般的 x86 機器上透過 qemu 的 chroot 方式來編譯, 似乎會比較快一些,  但是都比不上透過 cross compiler 來的方便與快速.

kernel 對於 cross compiler 的支援算是很好的, 基本上, 只要裝有 cross compiler 的機器上, 設定這兩個環境變數後, 就能在一般的主機上編譯出給 utilite 使用的 kernel 了:

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-

接著就可以用

make menuconfig
make uImage modules

來修改功能與編譯 kernel 與 module.

最後, 除了要自行複製 arch/arm/boot/uImage 的檔案外, 對於 module 與 firmware 可以用指定目錄的方式來安裝

INSTALL_MOD_PATH=./modules_install make modules_install
INSTALL_MOD_PATH=./modules_install make firmware_install

最後把 ./modules_install 這個目錄的東西, 複製到 utilite 上頭就可以了.

Del.icio.us Furl HEMiDEMi Technorati MyShare
迴響
暱稱:
標題:
個人網頁:
電子郵件:
authimage

迴響

  

Bad Behavior 已經阻擋了 48 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS