Raspberry Pi 2 kernel セルフコンパイル
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
]
開始行:
[[Raspberry Pi]]~
[[Raspbian]]~
#contents
*Raspberry Pi 2 kernel セルフコンパイル [#bfa8e24c]
Raspbian で起動している Raspberry Pi 2 上で kernel をコン...
~
arm アーキテクチャーの Linux 環境を作成する場合にはコンパ...
Raspberry Pi 2 のように比較的速いマシンであればセルフコン...
USB Wifi のドライバーなどビルド済みの kernel source が必...
Raspberry Pi 2 だけで作業を完結できます。~
~
以下の手順は Raspbian Wheezy でも Jessie でも共通です。
**必要パッケージ [#w058ea9f]
まず kernel のビルドに必要なパッケージをインストールしま...
$ sudo apt-get install bc ncurses-dev
gcc、make、git は最初から入っています。~
~
Wheezy の場合は gcc が 4.6.3、Jessie の場合は gcc が 4.9....
~
この version の違いが kernel source のビルドに影響するこ...
kernel source の外部のドライバーをビルドする際には gcc の...
ドライバーの source の修正が必要になる場合があります。
**kernel source 取得 [#h7837d7f]
/usr/src に移動し、git で kernel source を取得します。~
beat@raspberrypi ~ $ cd /usr/src/
beat@raspberrypi /usr/src $ sudo -s
kernel 本体
root@raspberrypi:/usr/src# git clone --depth 1 https://g...
Cloning into 'linux'...
remote: Counting objects: 52876, done.
remote: Compressing objects: 100% (50356/50356), done.
remote: Total 52876 (delta 4012), reused 17583 (delta 18...
Receiving objects: 100% (52876/52876), 142.62 MiB | 1.96...
Resolving deltas: 100% (4012/4012), done.
Checking connectivity... done.
Checking out files: 100% (49946/49946), done.
firmware
root@raspberrypi:/usr/src# git clone --depth 1 https://g...
rmware.git
Cloning into 'firmware'...
remote: Counting objects: 4077, done.
remote: Compressing objects: 100% (2200/2200), done.
remote: Total 4077 (delta 1702), reused 2305 (delta 1576...
Receiving objects: 100% (4077/4077), 75.59 MiB | 1.21 Mi...
Resolving deltas: 100% (1702/1702), done.
Checking connectivity... done.
Checking out files: 100% (3777/3777), done.
2015年10月15日現在 rpi-4.1.y branch は 4.1.10 kernel にな...
**ビルド準備 [#zec354eb]
checkout した kernel source のディレクトリに移動し、~
configs モジュールをロードして現在起動中の kernel の conf...
ビルドの準備をします。
root@raspberrypi:/usr/src/linux# cd linux
root@raspberrypi:/usr/src/linux# modprobe configs
root@raspberrypi:/usr/src/linux# zcat /proc/config.gz > ...
root@raspberrypi:/usr/src/linux# cp ../firmware/extra/Mo...
config の反映
root@raspberrypi:/usr/src/linux# make oldconfig
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
現在起動しているのと同じ version なので、make oldconfig ...
**ビルド [#t0d498bb]
ビルドします。~
Raspberry Pi 2 の CPU は 4 core あるので -j4 で4並列実行...
メモリの使用量が多くなりすぎて swap を設定しないと途中で ...
並列実行せず1つずつ順番に実行しました。~
また、time でビルド時間を計測しています。
zImge
root@raspberrypi:/usr/src/linux# time make zImage 2>&1 |...
〜〜 中略 〜〜
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
real 76m45.564s
user 76m33.100s
sys 3m42.070s
modules
root@raspberrypi:/usr/src/linux# time make modules 2>&1 ...
〜〜 中略 〜〜
IHEX firmware/yam/1200.bin
IHEX firmware/yam/9600.bin
real 214m43.233s
user 204m52.790s
sys 10m32.480s
dtbs
root@raspberrypi:/usr/src/linux# time make dtbs 2>&1 | t...
〜〜 中略 〜〜
DTC arch/arm/boot/dts/overlays/w1-gpio-pullup-over...
DTC arch/arm/boot/dts/bcm2709-rpi-2-b.dtb
real 0m10.528s
user 0m3.110s
sys 0m1.650s
**インストール [#s514cfa2]
セルフコンパイルしているのでそのままインストールできます。
modules
root@raspberrypi:/usr/src/linux# make modules_install
〜〜 中略 〜〜
INSTALL /lib/firmware/yam/9600.bin
DEPMOD 4.1.10-v7+
dtb
root@raspberrypi:/usr/src/linux# ls arch/arm/boot/dts/*....
arch/arm/boot/dts/bcm2709-rpi-2-b.dtb
root@raspberrypi:/usr/src/linux# cp arch/arm/boot/dts/*....
root@raspberrypi:/usr/src/linux# cp arch/arm/boot/dts/ov...
root@raspberrypi:/usr/src/linux# cp arch/arm/boot/dts/ov...
zImage~
Raspbian は /boot/ に Raspberry Pi 用の zImage(kernel.img...
Raspberry Pi 2 用をビルドしたものに置き換えます。
root@raspberrypi:/usr/src/linux# cp /boot/kernel7.img /b...
root@raspberrypi:/usr/src/linux# scripts/mkknlimg arch/a...
root@raspberrypi:/usr/src/linux# ./scripts/mkknlimg arch...
Version: Linux version 4.1.10-v7+ (root@raspberrypi) (gc...
DT: y
283x: n
**再起動 [#if5abe5f]
ビルドした kernel で動作させるため再起動します。
# reboot
ビルドした kernel で起動している状態では以下のようになっ...
pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.1.10-v7+ #1 SMP PREEMPT Fri Oct 16 2...
以前の kernel の uname -a とビルド時刻やビルド時のロケー...
pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.1.10-v7+ #821 SMP PREEMPT Sat Oct 10...
* 更新履歴 [#mbac8fc2]
2015/10/29 初稿掲載 ~
RIGHT:Satoshi OTSUKA
終了行:
[[Raspberry Pi]]~
[[Raspbian]]~
#contents
*Raspberry Pi 2 kernel セルフコンパイル [#bfa8e24c]
Raspbian で起動している Raspberry Pi 2 上で kernel をコン...
~
arm アーキテクチャーの Linux 環境を作成する場合にはコンパ...
Raspberry Pi 2 のように比較的速いマシンであればセルフコン...
USB Wifi のドライバーなどビルド済みの kernel source が必...
Raspberry Pi 2 だけで作業を完結できます。~
~
以下の手順は Raspbian Wheezy でも Jessie でも共通です。
**必要パッケージ [#w058ea9f]
まず kernel のビルドに必要なパッケージをインストールしま...
$ sudo apt-get install bc ncurses-dev
gcc、make、git は最初から入っています。~
~
Wheezy の場合は gcc が 4.6.3、Jessie の場合は gcc が 4.9....
~
この version の違いが kernel source のビルドに影響するこ...
kernel source の外部のドライバーをビルドする際には gcc の...
ドライバーの source の修正が必要になる場合があります。
**kernel source 取得 [#h7837d7f]
/usr/src に移動し、git で kernel source を取得します。~
beat@raspberrypi ~ $ cd /usr/src/
beat@raspberrypi /usr/src $ sudo -s
kernel 本体
root@raspberrypi:/usr/src# git clone --depth 1 https://g...
Cloning into 'linux'...
remote: Counting objects: 52876, done.
remote: Compressing objects: 100% (50356/50356), done.
remote: Total 52876 (delta 4012), reused 17583 (delta 18...
Receiving objects: 100% (52876/52876), 142.62 MiB | 1.96...
Resolving deltas: 100% (4012/4012), done.
Checking connectivity... done.
Checking out files: 100% (49946/49946), done.
firmware
root@raspberrypi:/usr/src# git clone --depth 1 https://g...
rmware.git
Cloning into 'firmware'...
remote: Counting objects: 4077, done.
remote: Compressing objects: 100% (2200/2200), done.
remote: Total 4077 (delta 1702), reused 2305 (delta 1576...
Receiving objects: 100% (4077/4077), 75.59 MiB | 1.21 Mi...
Resolving deltas: 100% (1702/1702), done.
Checking connectivity... done.
Checking out files: 100% (3777/3777), done.
2015年10月15日現在 rpi-4.1.y branch は 4.1.10 kernel にな...
**ビルド準備 [#zec354eb]
checkout した kernel source のディレクトリに移動し、~
configs モジュールをロードして現在起動中の kernel の conf...
ビルドの準備をします。
root@raspberrypi:/usr/src/linux# cd linux
root@raspberrypi:/usr/src/linux# modprobe configs
root@raspberrypi:/usr/src/linux# zcat /proc/config.gz > ...
root@raspberrypi:/usr/src/linux# cp ../firmware/extra/Mo...
config の反映
root@raspberrypi:/usr/src/linux# make oldconfig
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
現在起動しているのと同じ version なので、make oldconfig ...
**ビルド [#t0d498bb]
ビルドします。~
Raspberry Pi 2 の CPU は 4 core あるので -j4 で4並列実行...
メモリの使用量が多くなりすぎて swap を設定しないと途中で ...
並列実行せず1つずつ順番に実行しました。~
また、time でビルド時間を計測しています。
zImge
root@raspberrypi:/usr/src/linux# time make zImage 2>&1 |...
〜〜 中略 〜〜
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
real 76m45.564s
user 76m33.100s
sys 3m42.070s
modules
root@raspberrypi:/usr/src/linux# time make modules 2>&1 ...
〜〜 中略 〜〜
IHEX firmware/yam/1200.bin
IHEX firmware/yam/9600.bin
real 214m43.233s
user 204m52.790s
sys 10m32.480s
dtbs
root@raspberrypi:/usr/src/linux# time make dtbs 2>&1 | t...
〜〜 中略 〜〜
DTC arch/arm/boot/dts/overlays/w1-gpio-pullup-over...
DTC arch/arm/boot/dts/bcm2709-rpi-2-b.dtb
real 0m10.528s
user 0m3.110s
sys 0m1.650s
**インストール [#s514cfa2]
セルフコンパイルしているのでそのままインストールできます。
modules
root@raspberrypi:/usr/src/linux# make modules_install
〜〜 中略 〜〜
INSTALL /lib/firmware/yam/9600.bin
DEPMOD 4.1.10-v7+
dtb
root@raspberrypi:/usr/src/linux# ls arch/arm/boot/dts/*....
arch/arm/boot/dts/bcm2709-rpi-2-b.dtb
root@raspberrypi:/usr/src/linux# cp arch/arm/boot/dts/*....
root@raspberrypi:/usr/src/linux# cp arch/arm/boot/dts/ov...
root@raspberrypi:/usr/src/linux# cp arch/arm/boot/dts/ov...
zImage~
Raspbian は /boot/ に Raspberry Pi 用の zImage(kernel.img...
Raspberry Pi 2 用をビルドしたものに置き換えます。
root@raspberrypi:/usr/src/linux# cp /boot/kernel7.img /b...
root@raspberrypi:/usr/src/linux# scripts/mkknlimg arch/a...
root@raspberrypi:/usr/src/linux# ./scripts/mkknlimg arch...
Version: Linux version 4.1.10-v7+ (root@raspberrypi) (gc...
DT: y
283x: n
**再起動 [#if5abe5f]
ビルドした kernel で動作させるため再起動します。
# reboot
ビルドした kernel で起動している状態では以下のようになっ...
pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.1.10-v7+ #1 SMP PREEMPT Fri Oct 16 2...
以前の kernel の uname -a とビルド時刻やビルド時のロケー...
pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.1.10-v7+ #821 SMP PREEMPT Sat Oct 10...
* 更新履歴 [#mbac8fc2]
2015/10/29 初稿掲載 ~
RIGHT:Satoshi OTSUKA
ページ名:
BC::labsへの質問は、bc9-dev @ googlegroups.com までお願い致します。