Raspbian(APC用)のコンパル
先日、入手しましたAPCですが、CIFS(Windows共有)に対応していないようですので、Kernelからコンパイルしなおしました。
環境としては、VM PlayerとDebian6.0 Squeezeを使いました。
これらの用意方法は、Webに多くありますので割愛。
コンパイルソースを取得するために、gitをインストールします。
hoge@debian:~$ sudo apt-get install git-core
ホームディレクトリでRaspbianのソースを取得します
hoge@debian:~$ git clone git://github.com/apc-io/apc-8750.git
ARM用のクロスコンパイルGCCは、emdebianにあるので、sources.listを編集します
hoge@debian:~$ sudo vi /etc/apt/sources.list
以下の内容を追加します
deb http://www.emdebian.org/debian/ unstable main deb-src http://www.emdebian.org/debian/ unstable main
emdebianのデジタル鍵のキーを取得し、aptを更新します
hoge@debian:~$ sudo apt-get install emdebian-archive-keyring hoge@debian:~$ sudo apt-get update
ARM用クロスGCCを取得します。
hoge@debian:~$ sudo apt-get install ncurses-dev gcc-4.4-arm-linux-gnueabi
http://www.raspbian.org/ApricotImagesからapc_apricot_r3_kernel.patchとapc_apricot_r2_kernel_config.txtを持ってきます。とりあえずホームディレクトにおいておきます。
その上で、コンパイルとカーネルイメージを取得します。
hoge@debian:~$ sudo apt-get update hoge@debian:~/apc-8750$ cat /home/hoge/apc_apricot_r3_kernel.patch | patch -p1 hoge@debian:~/apc-8750/kernel$ cp /home/hoge/apc_apricot_r3_kernel_config.txt ./.config hoge@debian:~/apc-8750/kernel$ ARCH=arm make oldconfig hoge@debian:~/apc-8750/kernel$ ARCH=arm make menuconfig hoge@debian:~/apc-8750/kernel$ sudo apt-get install uboot-mkimage hoge@debian:~/apc-8750/kernel$ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- make -j3 ubin
「~/apc-8750/kernel/」フォルダにuzImage.binができていますので、それをSDカードに上書きします。
そのSDカードをAPCに刺して起動すると、コンパイルしなおしたRaspbianが動きます。
使えるように、設定やインストールをします。まずはパーティションをSDカードの目一杯に拡張します。
apc@apricot:~$ sudo fdisk -u -c /dev/mmcblk0 Command (m for help): p Command (m for help): d Partition number (1-4): 2 Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): 2 First sector (34816-7744511, default 34816): 34816 Last sector, +sectors or +size{K,M,G} (34816-7744511, default 7744511): Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. apc@apricot:~$ sudo reboot apc@apricot:~$ sudo resize2fs /dev/mmcblk0p2 apc@apricot:~$ cd /var apc@apricot:/var$ sudo dd if=/dev/zero of=swapfile bs=1M count=128 apc@apricot:/var$ sudo mkswap /var/swapfile apc@apricot:/var$ sudo swapon /var/swapfile
最後にスワップ領域が起動時に割あたるようにfstabを編集します。
apc@apricot:/var$ sudo vi /etc/fstab
として、以下を追加します。
/var/swapfile none swap sw 0 0
apc@apricot:~$ sudo dpkg-reconfigure tzdata apc@apricot:~$ sudo apt-get install locales apc@apricot:~$ sudo dpkg-reconfigure locales
通常はtertermで接続するのでGUI(lightDM)は不要ですので、切っておきます。
apc@apricot:~$ sudo apt-get install sysv-rc-conf apc@apricot:~$ sudo sysv-rc-conf
ランレベル2のlightDMの「*」を消しておきます。
肝心のCIFSを設定します。その前にcifs-utilsをインストールします。
apc@apricot:~$ sudo aptitude install cifs-utils
起動時にマウントするように、以下の記述をfstabに追加します。
apc@apricot:~$ sudo vi /etc/fstab //192.168.11.5/camera-1 /mnt/camera-1 cifs username=hoge,password=hogehoge,rw,file_mode=0777,dir_mode=0777 0 0
最後にpythonのpipとrequestsモジュールを入れておしまい。
apc@apricot:~$ sudo python ez_setup.py apc@apricot:~$ sudo easy_install pip apc@apricot:~$ sudo pip install requests