LinkIt Smart 7688を使ってみる

OpenWrt Linux

OpenWrtは今回初めて使いました。
ボードコンピュータでよく使われるDebianやUbuntuとはずいぶん趣が違います。
まず、DebianやUbuntuでは、基本rootユーザではなく、一般ユーザでログインしますが、OpenWrtでは常にrootユーザでロ グインします。
以下の様に、そもそもユーザ追加に関するコマンドが有りません。


また、ほとんどのコマンドはbusyboxに対するリンクとして実装されています。
root@mylinkit:~# ls -l /bin
lrwxrwxrwx    1 root     root             7 Sep 27  2016 ash -> busybox
-rwxr-xr-x    1 root     root           265 Apr 11  2016 board_detect
-rwxr-xr-x    1 root     root        419903 Sep 27  2016 busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 cat -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 chgrp -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 chmod -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 chown -> busybox
-rwxr-xr-x    1 root     root          3311 Apr 11  2016 config_generate
lrwxrwxrwx    1 root     root             7 Sep 27  2016 cp -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 date -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 dd -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 df -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 dmesg -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 echo -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 egrep -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 false -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 fgrep -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 fsync -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 grep -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 gunzip -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 gzip -> busybox
-rwxr-xr-x    1 root     root          1550 Apr 11  2016 ipcalc.sh
lrwxrwxrwx    1 root     root             7 Sep 27  2016 kill -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 ln -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 lock -> busybox
-rwxr-xr-x    1 root     root           424 Apr 11  2016 login.sh
lrwxrwxrwx    1 root     root             7 Sep 27  2016 ls -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 mkdir -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 mknod -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 mktemp -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 mount -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 mv -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 netmsg -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 netstat -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 nice -> busybox
-rwxr-xr-x    1 root     root        130247 Sep 27  2016 opkg
lrwxrwxrwx    1 root     root             7 Sep 27  2016 pidof -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 ping -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 ping6 -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 ps -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 pwd -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 rm -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 rmdir -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 sed -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 sh -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 sleep -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 sync -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 tar -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 touch -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 true -> busybox
-rwxr-xr-x    1 root     root          8439 Sep 27  2016 ubus
lrwxrwxrwx    1 root     root             7 Sep 27  2016 umount -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 uname -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 vi -> busybox
lrwxrwxrwx    1 root     root             7 Sep 27  2016 zcat -> busybox
root@mylinkit:~#

例えばunameコマンドは、以下のどちらでも同じ結果となります。
root@mylinkit:~# uname -a
Linux mylinkit 3.18.23 #5 Tue Sep 27 11:48:57 CEST 2016 mips GNU/Linux

root@mylinkit:~# busybox uname -a
Linux mylinkit 3.18.23 #5 Tue Sep 27 11:48:57 CEST 2016 mips GNU/Linux

バックグラウンドで動いてるタスクの状況も随分と違います。
root@mylinkit:~# ps
  PID USER       VSZ STAT COMMAND
    1 root      1436 S    /sbin/procd
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    5 root         0 SW<  [kworker/0:0H]
    6 root         0 SW   [kworker/u2:0]
    7 root         0 SW<  [khelper]
    8 root         0 SW   [kworker/u2:1]
   11 root         0 SW<  [writeback]
   21 root         0 SW<  [bioset]
   22 root         0 SW<  [kblockd]
   24 root         0 SW   [kswapd0]
   25 root         0 SW   [kworker/0:1]
  109 root         0 SW   [fsnotify_mark]
  129 root         0 SW   [spi32766]
  258 root         0 SW<  [deferwq]
  319 root         0 SW   [mmcqd/0]
  389 root         0 SW   [jbd2/mmcblk0p1-]
  390 root         0 SW<  [ext4-rsv-conver]
  461 root       904 S    /sbin/ubusd
  537 root       768 S    /sbin/askfirst /bin/ash --login
 1079 root         0 SW<  [ipv6_addrconf]
 1319 root      1056 S    /sbin/logd -S 16
 1328 root      1820 S    /sbin/rpcd
 1362 root      1600 S    /sbin/netifd
 1398 root      1192 S    /usr/sbin/odhcpd
 1434 root      1148 S    /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p
 1494 root         0 SW   [RtmpCmdQTask]
 1495 root         0 SW   [RtmpWscTask]
 1496 root         0 SW   [RtmpMlmeTask]
 1498 root         0 SW   [kworker/0:2]
 1513 root      1624 S    /usr/sbin/uhttpd -f -h /www -r mylinkit -x /cgi-bin
 1541 root      3112 S    /usr/sbin/smbd -F
 1542 root      3180 S    /usr/sbin/nmbd -F
 1549 nobody    1772 S    avahi-daemon: running [mylinkit.local]
 1579 root      1016 S    /sbin/mountd -f
 1616 root       784 S    /sbin/ap_client ra0 apcli0 aterm-e625c0-g 05ecd1dcd3
 1643 root      1488 S    /usr/sbin/ntpd -n -S /usr/sbin/ntpd-hotplug -p 0.ope
 1748 root      1484 S    udhcpc -p /var/run/udhcpc-apcli0.pid -s /lib/netifd/
 1816 nobody     992 S    /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf -k -x /va
 1836 root      1216 R    /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p
 1837 root      1488 S    -ash
 1853 root      1484 R    ps

/etcも随分とあっさりしています。
root@mylinkit:~# ls /etc
TZ                    firewall.user         ppp
Wireless              fstab                 preinit
arduino               fw_env.config         profile
avahi                 group                 protocols
avrdude.conf          hosts                 rc.button
banner                hotplug-preinit.json  rc.common
banner.failsafe       hotplug.d             rc.d
blkid.tab             hotplug.json          rc.local
board.d               init.d                resolv.conf
board.json            inittab               samba
config                modules-boot.d        services
crontabs              modules.d             shadow
device_info           mtab                  shadow-
diag.sh               openwrt_release       shells
dnsmasq.conf          openwrt_version       ssl
dnsmasq.time          opkg                  sysctl.conf
dropbear              opkg.conf             sysupgrade.conf
e2fsck.conf           passwd                uci-defaults
ethers                passwd-               uhttpd
root@mylinkit:~#

DebianやUbuntuではshutdownコマンドでシステムを停止しますが、OpenWrtではこのコマンドが有りません
こ ちらにファイルシステムが壊れた時の対象方法が記載されています。

* there is no shutdown command in OpenWrt and the poweroff command takes the same effect as the reboot command.
When the system finishes all clean up tasks and begins to reboot, you can see the orange LED blinks once.

* OpenWrtにシャットダウンコマンドがなく、poweroffコマンドはrebootコマンドと同じに効果を生じる。
システムがすべてのclean up taskを終えて、再起動しはじめる時には、あなたはオレンジ色のLED点滅を1回見ることができる。

お勧めの停止方法はこのように記載されています。

A recommended process is to issue a reboot or poweroff command* in the system console (via SSH or UART) to force all unsynchronized data to be flushed to the file system.
After this is done and when you see the orange LED blinks once and lights up, then it is safe to cut the power to this board.

推奨されたプロセスは、すべてのシンクロしていないデータをファイルシステムに書き込むために
システムコンソール(SSHまたはUARTを経た)でのrebootまたはpoweroff command*を出すことである。
これが終わると、オレンジ色の1回のLED点滅と、点灯を見た後は、このボードから電源を切ることは安全である。

マジかぁ〜 って感じです。
オレンジ色のLEDが点灯→点滅→消灯すると、再起動完了となります。
再起動完了までに大体1分30秒ぐらいかかります。

OpenWrtのサポートボード一覧がこち らにありました。
RaspberryPiやOrangePiでも動くようです。

続く....