2017年12月13日水曜日

Yocto04-Camera

カメラモジュール旧式(OV5647)が購入

Yoctoの手順をおさらい。これからカメラを組み込む。
1. /home1/poky で source oe-init-build-env build_20171213
  /home1/poky/build_20171213 ができる
    build_20171213/conf ができる
    confの中にbblayers.conf,local.conf,templateconf.cfg ができる
2. local.conf 編集
  MACHINE ??= "qemux86"をコメントアウト
  以下を追加
  MACHINE = "raspberrypi0-wifi"
  DISTRO_FEATURES_append = " bluez5"
  COMBINED_FEATURES_append = " ext2 usbgadget usbhost wifi bluetooth"
  IMAGE_INSTALL_append = " linux-firmware-bcm43430 connman connman-client usbutils sudo local "
  IMAGE_FEATURES_append = " ssh-server-dropbear"
  # host setup
  hostname_pn-base-files = "yoctopi"
  INHERIT_append = " extrausers"
  EXTRA_USERS_PARAMS = "useradd -P XXXX pi;usermod -P XXXX root;"
  BB_NUMBER_THREADS = "8"
  PARALLEL_MAKE = "-j 8"
  DL_DIR ?= "/home1/work/poky/poky-downloads"
3. bblayers.conf 編集
  以下を追加
  /home1/poky/meta-openembedded/meta-oe \
  /home1/poky/meta-openembedded/meta-networking \
  /home1/poky/meta-openembedded/meta-perl \
  /home1/poky/meta-openembedded/meta-python \
  /home1/poky/meta-raspberrypi \
  /home1/poky/meta-local \
4. meta-local はすでにあるのでそのまま
5. build_20171213 でビルド bitbake rpi-hwup-image

Yocto03

connmanctlの設定を追加

local_1.0.bbの中身

変更追加分のみ
SRC_URI = "file://test1.txt file://test2.txt file://0024A5xxxxxx.config file://settings"

do_install(){
  ...
  install -d ${D}/var/lib/connman
  install -m 0644 ${THISDIR}/files/0024A5D90CDF_psk.config ${D}/var/lib/connman
  install -m 0644 ${THISDIR}/files/settings ${D}/var/lib/connman
}
...
FILES_${PN} += "/var/lib/connman/0024A5D90CDF_psk.config"
FILES_${PN} += "/var/lib/connman/settings"

2017年12月2日土曜日

Yocto02

あるファイルをrootfsに組み込む実験

11/19から始めて、2週間。やっと動いた。
テキストファイルtest1を/tmp、test2.txtを/home/rootに置くレシピの作成。

localのレシピを作る

meta-local(D)
+---------conf(D)
| +---------------layer.conf
+---------recipes-local(D)
| +---------------local(D)
| +-------files(D)
| | +-------test1.txt
| | +-------test2.txt
| +-------COPYING.MIT
| +-------local_1.0.bb
+---------README

layer.confの中身

BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "local"
BBFILE_PATTERN_local = "^${LAYERDIR}/"
BBFILE_PRIORITY_local = "7"

local_1.0.bbの中身

DESCRIPTION = "Test 2017-11-xx"
SECTION = "unknown"
PRIORITY = "optional"
MAINTAINER = "xxx "
HOMEPAGE = "http://"
LICENSE = "MIT"
LIC_FILES_CHKSUM="file://${THISDIR}/COPYING.MIT;md5=91203d58fb77b02fc55a900c6263f1ba"
SRC_URI = "file://test.txt file://test2.txt"
do_install(){
  install -d ${D}/tmp
  install -m 0644 ${THISDIR}/files/test1.txt ${D}/tmp
  install -d ${D}/home/root
  install -m 0644 ${THISDIR}/files/test2.txt ${D}/home/root
}
FILES_${PN} += "/tmp/test.txt"
FILES_${PN} += "/home/root/test2.txt"

COPYING.MITの中身

Copyright 2017 H.T

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

test1.txtの中身

This is test1

test2.txtの中身

This is test2

READMEの中身

2017-11-26 new

Buildの変更

build-xxxのconfのlocal.conf

IMAGE_INSTALL_append = " 略 local "





2017年11月18日土曜日

Yocto01

Yoctoに着手

パッケージの取得
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm

パッケージリストの更新
sudo apt-get update
インストールパッケージ更新
sudo apt-get upgrade

git clone git://git.yoctoproject.org/poky
StableなブランチはPyro
cd poky
git checkout pyro
git clone -b pyro git://git.openembedded.org/openembedded-core
git clone -b pyro git://git.openembedded.org/meta-openembedded
git clone -b pyro git://git.yoctoproject.org/meta-raspberrypi

./oe-init-build-env build_raspi  # build_raspiは任意
cd build_raspi

../bitbake/bin/bitbake-layers add-layer ../meta-yocto
../bitbake/bin/bitbake-layers add-layer ../meta-raspberrypi

local.confのMACHINEの変更
MACHINE ??= "raspberrypi0-wifi"
B_NUMBER_THREADS = "4"
PARALLEL_MAKE = "-j 4"
DL_DIR ?= "/home1/work/poky/poky-downloads"

bitbake実行
export PATH=/home1/poky/bitbake/bin:$PATH
bitbake rpi-basic-image

SDカード書き込み
cd tmp/deploy/images/raspberrypi0-wifi
sudo dd if=./rpi-basic-image-raspberrypi0-wifi.rpi-sdimg of=/dev/sdc bs=40M

実行


参考サイト:https://www.usagi1975.com/24mar172100/

2017年10月24日火曜日

PC購入

PCを購入した。
セットアップするので、しばらくRaspberry Piはお休み。

2017年10月23日月曜日

yocto

yoctoに取り組む。
まずは「yoctoとは」から。
実機さわれず。

2017年10月19日木曜日

カーネルをビルドする05

menuconfig続き
・Networking support
  WiMAX Wireless Broadband supportをはずす
  RF switch subsysytem supportをはずす
・Device Drivers
  Multiple devices driver support (RAID and LVM)をはずす
  Multimedia support
    Analog TV supportをはずす
    Digital TV supportをはずす
    AM/FM radio receivers/transmitters supportをはずす
    Remote Controller supportをはずす

ところで、menuconfigを行ったら下記はしなくてよい。
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

makeを行う。
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

少しちいさくなった。
-rwxr-xr-x  1 xxx xxx 4270576 10月 19 22:37 zImage*

2017年10月18日水曜日

カーネルをビルドする04

menuconfigの続き
# cd linux
# KERNEL=kernel
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

menuconfig
・Networking support
  Networking options
     Appletalk protocol supportをはずす
  Amateur Radio supportをはずす
  CAN bus subsystem supportをはずす
  IrDA (infrared) subsystem supportをはずす
  Bluetooth subsystem supportをはずす
  NFC subsystem supportをはずす
・Device Drivers
  SCSI device support
    SCSI deviceをはずす

makeした
-rwxr-xr-x 1 xxx xxx 4270704 10月 18 21:35 zImage*
少し小さくなった。

Raspberry Piで動かしてみた。
動いた。
BluetoothはDisableになっていた。


2017年10月17日火曜日

カーネルをビルドする03

カーネルのビルド(続き)

 [Raspberry Pi Zero W環境]

時間がかかりすぎる(数時間)ため停止。

[クロス環境]

SDカードをPCに挿入する。
配置はこんな感じ。
 サイトに書かれている通りに入力。
# mkdir mnt
# mkdir mnt/fat32
# mkdir mnt/ext4
# sudo mount /dev/mmcblk0p6 mnt/fat32
# sudo mount /dev/mmcblk0p7 mnt/ext4

# sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install

# sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
# sudo cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
# sudo cp arch/arm/boot/dts/*.dtb mnt/fat32
# sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
# sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
# sudo umount mnt/fat32
# sudo umount mnt/ext4

SDカードをRaspberry Piに入れ、電源ON......動いた。

# uname -a
オリジナル
Linux raspberrypi 4.9.41+ #1023 Tue Aug 8 15:47:12 BST 2017 armv6l GNU/Linux
今回
Linux raspberrypi 4.9.56+ #1 Mon Oct 16 00:42:37 JST 2017 armv6l GNU/Linux

サイズ比較
-rw-r--r-- 1 xxx xxx 4381216 10月 17 21:47 kernel-backup.img
-rw-r--r-- 1 xxx xxx 4378632 10月 17 21:47 kernel.img

カーネルをconfigしてみる[クロス環境]
別のディレクトリにソースをダウンロード
# cd linux
# KERNEL=kernel
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
# sudo apt-get install libncurses5-dev

menuconfigを起動
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

とりあえず眺める。
今日はここまで。

2017年10月16日月曜日

カーネルをビルドする02

[Raspberry Pi環境] (続き)

  make -j2 zImage modules dtbs を行う。
そのまま放置。
今日はここまで。

2017年10月15日日曜日

カーネルをビルドする01

カーネルのビルドを試みる
参考:公式サイトの
https://www.raspberrypi.org/documentation/linux/kernel/building.md
Menuでは、DOCUMENTATION>LINUX>KERNEL>BUILDING

現在のバージョン
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.41+ #1023 Tue Aug 8 15:47:12 BST 2017 armv6l GNU/Linux


[クロス環境]

使用PCは、Linux Mint 18.1 Serena。
sudo apt-get install git bcをやる。
# パッケージリストを読み込んでいます... 完了
# 依存関係ツリーを作成しています               
# 状態情報を読み取っています... 完了
# bc はすでに最新バージョン (1.06.95-9build1) です。
# git はすでに最新バージョン (1:2.7.4-0ubuntu1.3) です。
# アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 34 個。

ツール用のディレクトリを作る。/home/xxx/RaspberryPiZeroW/tools
ツールをダウンロードする。
git clone https://github.com/raspberrypi/tools ~/RaspberryPiZeroW/tools
build用のディレクトリを作る。/home/xxx/RaspberryPiZeroW/Building
build用のディレクトリに移る。
ソースをダウンロードする。
git clone --depth=1 https://github.com/raspberrypi/linux
パス設定
# echo PATH=\$PATH:~/RaspberryPiZeroW/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin >> ~/.bashrc
# source ~/.bashrc

makeをする。
# cd linux
# KERNEL=kernel
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
今日はここまで。

[Raspberry Pi Zero W環境]

sudo apt-get install git bcをやる。
# pi@raspberrypi:~ $ sudo apt-get install git bc
# パッケージリストを読み込んでいます... 完了
# 依存関係ツリーを作成しています               
# 状態情報を読み取っています... 完了
# git はすでに最新バージョン (1:2.11.0-3+deb9u2) です。
# 以下のパッケージが新たにインストールされます:
#   bc
# アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 1 個。
# 96.3 kB のアーカイブを取得する必要があります。
# この操作後に追加で 195 kB のディスク容量が消費されます。
# 続行しますか? [Y/n] y
# 取得:1 http://mirrordirector.raspbian.org/raspbian stretch/main armhf bc armhf 1.06.95-9 [96.3 kB]
# 96.3 kB を 1秒 で取得しました (57.4 kB/s)
# 以前に未選択のパッケージ bc を選択しています。
# (データベースを読み込んでいます ... 現在 124478 個のファイルとディレクトリがインストールされています。)
# .../bc_1.06.95-9_armhf.deb を展開する準備をしています ...
# bc (1.06.95-9) を展開しています...
# install-info (6.3.0.dfsg.1-1+b1) のトリガを処理しています ...
# man-db (2.7.6.1-2) のトリガを処理しています ...
# bc (1.06.95-9) を設定しています ...

build用のbuildingディレクトリを作る。/home/pi/building
buildディレクトリに移り、git clone --depth=1 https://github.com/raspberrypi/linux
makeをする。
# cd linux
# KERNEL=kernel
# make bcmrpi_defconfig
今日はここまで。

セットアップ02・SSHまで

公式サイトのHELPのSOFTWARE GUIDEのGET Startedの続き。
"Learn how to update your SD card"の前に"Connect your Raspberry Pi to WiFi"

・Connect your Raspberry Pi to WiFi
WiFiは未接続。WiFiアイコンをクリック

自宅のWiFiを押下

キーを入れて、OKを押下
  つながった。

SSHはデフォルトでは無効

SSHを有効にして押下
  SSH有効にして再起動したら、パスワードを変えろ!とWarning。
  とりあえず変える。

"Learn how to update your SD card"
ターミナルから、"sudo apt-get update"、"sudo apt-get upgrade"。それだけ。

"Learn how to install more application"
とりあえずVIMを入れる。"sudo apt-get install vim"。

SOFTWARE GUIDEの"Get started"終了。
 

2017年10月14日土曜日

到着・セットアップ01

現物の写真
これにクッションシール4つ(ケース背面に貼り付け)付く。袋類除く。
説明書の類はなし。

公式サイト
https://www.raspberrypi.org/

公式サイトのHELPのSOFTWARE GUIDEのGET Startedを開始。

"Downloading and installing the Raspberry Pi software"
・PCでの作業 16GBのSD Cardを使う。
SDFormatter V4.0でフォーマット。

NOOBS(New Out Of Box Software) Offline and network install
Version: 2.4.4 Release date: 2017-09-08 をダウンロード。
解凍して、SD Cardにコピー、PCからとりはずし。

・Raspberry Piでの作業
電源とHDMI、キーボード、SD Cardを接続。電源は、携帯(ソフトバンク・京セラ)のACアダプタを使用。
HDMI接続先は、TV。
キーボードは手持ちのELECOMの日本語109USBフルキーボード。

ACアダプタをコンセントに差し込む

初期画面

日本語にする
  言語の選択は"l"、キーボードの選択は"9"。Raspbianを選択する。

"i"を押下して、インストール起動

"y"を押下して、開始

100%になった

インストール終了
  ここまで、インストール開始から25分くらい

linux起動し、ホーム画面が出る
  キーボードは受け付けないので、マウスにコネクタを繋ぎかえて、とりあえずShutdown。


明日は、"Learn how to update your SD card"。

2017年10月12日木曜日

購入

スイッチサイエンス(http://www.switch-science.com/)で購入
Raspberry Pi Zero W ケースキット
  • Raspberry Pi Zero W
  • Raspberry Pi Zero ケース
  • miniHDMI変換アダプタ
  • USB-microB OTGケーブル
  2808円 + 送料150円  支払いPayPal

KSY(https://raspberry-pi.ksyic.com/main/index)は、同構成で2700円。送料は756円。