「LS-XLでセルフコンパイル」の編集履歴(バックアップ)一覧に戻る

LS-XLでセルフコンパイル - (2015/04/03 (金) 09:08:13) のソース

※以下のカーネル再構築の各種設定はクロスコンパイルしたときの[[ページ>LS-XL Debian化]]に添付したlsxl.configは設定済みでそのまま使えます。
ここは試行錯誤の段階のログです。

**セルフコンパイル
fail2banを入れてセキュリティ対策しようとしたがiptablesが使えないのでカーネルを再構築することにします
■ビルド
> # cd /opt
> # mkdir nasbuild
> # cd nasbuild
> # wget http://buffalo.jp/php/los.php?to=gpl/storage/ls-x/165/linux-3.3.4.tar.gz -O linux-3.3.4.tar.gz
> # tar xzf linux-3.3.4.tar.gz
> # cd linux-3.3.4
> # vi Makefile
> 
> CROSS_COMPILE   ?= arm-none-linux-gnueabi-
> ↓
> CROSS_COMPILE   ?=
> 
> # cp ~/lsxl.config .config
> # apt-get install kernel-package libncurses5-dev fakeroot uboot-mkimage
> # make menuconfig
> 
> Networking support  --->
>   Networking options  --->
>     [*] Network packet filtering framework (Netfilter)  --->
>       Core Netfilter Configuration  --->
>         以下すべて<M>
>       IP: Netfilter Configuration  --->
>         以下すべて<M>
> 
> # vi .config
> 
> CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/ram0 panic=5 lowmem=1"
> ↓
> CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/sda2 panic=5 lowmem=1"
> 
> # nohup make uImage modules modules_install &
> # tail -f nohup.out
■ビルド完了後
> # cp -rv binaries/lib /
> # mv /boot/uImage.buffalo /boot/uImage.buffalo.old
> # cp -rv arch/arm/boot/uImage /boot/uImage.buffalo
> # reboot

うーん
ログ見てると起動するまでのブート中が1970年なってる
> # hwclock
> hwclock: Cannot access the Hardware Clock via any known method.
> hwclock: Use the --debug option to see the details of our search for an access method.
> # hwclock --debug
> hwclock from util-linux 2.20.1
> hwclock: Open of /dev/rtc failed: No such file or directory
> No usable clock interface found.
> hwclock: Cannot access the Hardware Clock via any known method.
RTCがカーネルに組み込まれていないみたい
またカーネル再構築か
linux-3.3.4/buffalo/configs/buffalo_nas_fw_88f6281.configをベースにiptables用の追加とCMD_LINEを設定する。
> # cp buffalo/configs/buffalo_nas_fw_88f6281.config .config
> # make menuconfig
> Boot options  --->
>   (console=ttyS0,115200 root=/dev/sda2 panic=5 lowmem=1) Default kernel command string
>         Kernel command line type (Always use the default kernel command string)  --->
>           (X) Always use the default kernel command string
> Networking support  --->
>   Networking options  --->
>     [*] Network packet filtering framework (Netfilter)  --->
>       Core Netfilter Configuration  --->
>         以下すべて<M>
>       IP: Netfilter Configuration  --->
>         以下すべて<M>
> 
> # nohup make INSTALL_MOD_PATH=/ uImage modules modules_install &
> # cp arch/arm/boot/uImage /boot/uImage.buffalo
> # reboot
> # hwclock
> Wed 01 Apr 2015 11:33:09 AM JST  -0.223251 seconds
> # date
> Wed Apr  1 11:38:26 JST 2015
> 
動いた。
けど時間がずれてますね。修正しましょう。
> # hwclock --systohc
> # hwclock
> Wed 01 Apr 2015 11:43:03 AM JST  -0.517071 seconds
> # date
> Wed Apr  1 11:43:06 JST 2015

**カーネルを作り損じて起動しなくなった場合の復旧方法
HDD取り出して、別のPCで以下のコマンドを実行する。
> # mount -t ext3 /dev/sdb1 /mnt/usbdisk1
> # cd /mnt/usbdisk1
> # rm -fr uImage.buffalo
> # mv uImage.buffalo.old uImage.buffalo
こういう時のためにカーネル帰るときはoldとして残しておくといいですね。
HDD取り出さずに復旧したかったのですが、Panic、再起動、Panic、再起動を繰り返していて、
TFTPにもつなぎに来てくれない状態だったので、仕方なく電源落としてHDD取り出して作業しました。