armbian

なんとなく、armbianをZynqに突っ込んでみた。

https://www.armbian.com/

ソースから展開する場合

ソースから展開する場合は次のような手順が書かれているが、出来上がったバイナリを見てもどうすればいいのか判別がつかなかった。

$ git clone git://github.com/igorpecovnik/lib --depth 1
$ cp lib/compile.sh .
$ ./compile.sh

そこで、各評価ボード向けに用意されているバイナリを使用して作ってみることにした。

バイナリのダウンロード

下記URLからZynqと同じCortex-A9のCPUが実装されているCubox-iのイメージをダウンロードする。

https://www.armbian.com/download/

Cubox-i

Cubox-iはNXPのi.MX6を使用しているコンパクトなサーバである。

http://wiki.solid-run.com/doku.php?id=products:imx6 http://www.nxp.com/jp/products/microcontrollers-and-processors/arm-processors/i.mx-applications-processors/i.mx-6-processors:IMX6X_SERIES

ダウンロードしてきたファイルは次のファイルである。

Armbian_5.25_Cubox-i_Ubuntu_xenial_next_4.9.7_desktop.7z

まずは展開する
$ mkdir temp
$ cd temp
$ 7z x ../Armbian_5.25_Cubox-i_Ubuntu_xenial_next_4.9.7_desktop.7z
rootfsだけ取り出す

imgファイルをfdiskで開いてrootfsが始まっている開始ブロックを記録する。

$ fdisk Armbian_5.25_Cubox-i_Ubuntu_xenial_next_4.9.7_desktop.img

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk Armbian_5.25_Cubox-i_Ubuntu_xenial_next_4.9.7_desktop.img: 2.7 GiB, 2924478464 bytes, 5711872 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x874cdaca

Device                                                     Boot Start     End Sectors  Size Id Type
Armbian_5.25_Cubox-i_Ubuntu_xenial_next_4.9.7_desktop.img1       2048 5711871 5709824  2.7G 83 Linux

Command (m for help):

開始ブロックを次のように指定してマウントして、rootfsだけ圧縮する。

$ mkdir mnt
$ sudo mount -o loop,offset=`expr 2048 \* 512` Armbian_5.25_Cubox-i_Ubuntu_xenial_next_4.9.7_desktop.img ./mnt
$ cd mnt
$ sudo tar cjvf ../rootfs.tar.bz2 ./

それからSDカードにコピーして起動する。

Linux Kernelやu-bootは従来のものを使用すれば良い。

ただ、ここでコンソールからrootでログインできない事象が発生したのでOrange Piのバイナリイメージで試してみることにした。

Orange Pi mini

CPUはA20(cortex-A7)である。

Cuboxと同じようにバイナリをダウンロードする。

Armbian_5.25_Bananapi_Ubuntu_xenial_next_4.9.7_desktop.7z

ダウンロードしたら展開する。

$ mkdir temp
$ cd temp
$ 7z x ../Armbian_5.25_Bananapi_Ubuntu_xenial_next_4.9.7_desktop.7z

展開したらimgファイルからrootfsの開始ブロックを記録する。

$ fdisk Armbian_5.25_Bananapi_Ubuntu_xenial_next_4.9.7_desktop.img

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk Armbian_5.25_Bananapi_Ubuntu_xenial_next_4.9.7_desktop.img: 2.8 GiB, 2943352832 bytes, 5748736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x21030000

Device                                                      Boot Start     End Sectors  Size Id Type
Armbian_5.25_Bananapi_Ubuntu_xenial_next_4.9.7_desktop.img1       2048 5748735 5746688  2.8G 83 Linux

Command (m for help):

そして、マウントして圧縮する。

$ mkdir mnt
$ sudo mount -o loop,offset=`expr 2048 \* 512` Armbian_5.25_Bananapi_Ubuntu_xenial_next_4.9.7_desktop.img ./mnt
$ cd mnt
$ sudo tar cjvf ../rootfs.tar.bz2 ./

最後にSDカードに書き込んで起動する。

そうすると、Cuboxと同じようにコンソールからrootでログインできない。

別の問題なんだなぁと思って調べてみたら/etc/securettyに設定漏れがあった。

/etc/securettyのファイルに下記ようにttyPS0を追加する。 このファイルは/dev/配下のデバイスからrootでログイン許可を設定しているファイルである。

ttyPS0

rootの初回ログイン時のパスワードは"1234"である。 初回ログインをすると新しいパスワードの入力が促される。

ログインしてしばらくすると"Banana Pi"って出てきました。

ログイン成功です。

ログインするとrootのパスワードの変更やユーザー作成などが始まるので適当に作成します。

Ubuntu 16.04.1 LTS bananapi ttyPS0

bananapi login: root
Password:
You are required to change your password immediately (root enforced)
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:

| __ )  __ _ _ __   __ _ _ __   __ _  |  _ \(_)
|  _ \ / _` | '_ \ / _` | '_ \ / _` | | |_) | |
| |_) | (_| | | | | (_| | | | | (_| | |  __/| |
|____/ \__,_|_| |_|\__,_|_| |_|\__,_| |_|   |_|


Welcome to ARMBIAN 5.25 stable Ubuntu 16.04.1 LTS 4.6.0-xilinx-apf-dirty
System load:   0.01             Up time:       4 min
Memory usage:  2 % of 499Mb     IP:
Usage of /:    68% of 3.3G

New to Armbian? Check the documentation first: docs.armbian.com


Thank you for choosing Armbian! Support: www.armbian.com

Creating a new user account. Press <Ctrl-C> to abort
Desktop environment will not be enabled if you abort the new user creation

Please provide a username (eg. your forename): hidemi
Adding user `hidemi' ...
Adding new group `hidemi' (1000) ...
Adding new user `hidemi' (1000) with group `hidemi' ...
Creating home directory `/home/hidemi' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for hidemi
Enter the new value, or press ENTER for the default
        Full Name []: Hidemi Ishihara
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

Dear Hidemi Ishihara, your account hidemi has been created and is sudo enabled.
Please use this account for your daily work from now on.


Now starting desktop environment...

root@bananapi:~#

ところで、armbianが動いたのはいいんだけど、Z-TurnのHDMI出力を有効にしていないのでUbuntuの起動までは残念ながら確認できていない。

そのうち、暇ができたらやってみよう。

/proc/cpuinfoは次の通り。

root@bananapi:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 0 (v7l)
BogoMIPS        : 433.33
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

processor       : 1
model name      : ARMv7 Processor rev 0 (v7l)
BogoMIPS        : 433.33
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

Hardware        : Xilinx Zynq Platform
Revision        : 0003
Serial          : 0000000000000000
write: 2017/04/05/ 00:31:31