Cubie Truck 測試 – Arch Linux 開機執行的檔案

在 Fedora / CentOS Linux 可以在 /etc/rc.d/rc.local,在 Debian / Ubuntu Linux 可以在 /etc/rc.local 中設定開機要執行的一些功能,如:防火牆的設定之類的功能,不過在 Arch Linux 中似乎沒有這一個檔案的存在,但可以用替代的方式,達到這種功能。
參考網頁:
ArchLinux Systemd 增加rc-local自运行 – 羽毛の家
arch linux – systemd does not run /etc/rc.local? – Super User
Install Arch Linux on Cubietruck (Cubieboard 3) | Tom’s blog

方法一:
# vim /usr/lib/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target[@more@]開機時啟動 rc.local 此項功能
# systemctl enable rc-local.service
ln -s ‘/usr/lib/systemd/system/rc-local.service’ ‘/etc/systemd/system/multi-user.target.wants/rc-local.service’

建立 /etc/rc.local
關閉 Cubie Truck 上的 LED 燈號
# vim /etc/rc.local
#!/bin/sh
echo 0 > /sys/class/leds/blue:ph21:led1/brightness
echo 0 > /sys/class/leds/orange:ph20:led2/brightness
echo 0 > /sys/class/leds/white:ph11:led3/brightness
echo 0 > /sys/class/leds/green:ph07:led4/brightness

更改檔案執行權限
# chmod +x /etc/rc.local

方法二:
# vim /usr/bin/cubietruck_leds_off.sh
#!/bin/sh
echo 0 > /sys/class/leds/blue:ph21:led1/brightness
echo 0 > /sys/class/leds/orange:ph20:led2/brightness
echo 0 > /sys/class/leds/white:ph11:led3/brightness
echo 0 > /sys/class/leds/green:ph07:led4/brightness

更改檔案執行權限
# chmod +x /usr/bin/cubietruck_leds_off.sh

# vim /etc/systemd/system/cubietruck_leds_off.service
[Unit]
Description=Disable the LEDs of Cubietruck
[Service]
ExecStart=/usr/bin/cubietruck_leds_off.sh
[Install]
WantedBy=multi-user.target

啟動 cubietruck_leds_off 功能
# systemctl start cubietruck_leds_off

設定開機時啟動
# systemctl enable cubietruck_leds_off
ln -s ‘/etc/systemd/system/cubietruck_leds_off.service’ ‘/etc/systemd/system/multi-user.target.wants/cubietruck_leds_off.service’

Cubie Truck 測試 – 安裝 Arch Linux

下載網址
http://dl.cubieboard.org/software/a20-cubietruck/archlinux/ct-arch-v2/

參考網站:
Install Arch Linux on Cubietruck (Cubieboard 3) | Tom’s blog
http://www.fanninger.at/thomas/blog/2014/05/install-arch-linux-on-cubietruck-cubieboard-3/

預設登入的帳號及密碼:root / root[@more@]更改 root 密碼
# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Nand Flash 分割狀態
# nand-part
check partition table copy 0: mbr: version 0x00000200, magic softw411
magic softw411 is not softw311
check partition table copy 1: mbr: version 0x00000000, magic
magic          is not softw311
check partition table copy 2: mbr: version 0x00000000, magic
magic          is not softw311
check partition table copy 3: mbr: version 0x00000000, magic
magic          is not softw311
all partition tables are bad!
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size =  8388608 user_type=0
partition  3: class =         DISK, name =        UDISK, partition start =  8552448, partition size = 22380544 user_type=0
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size =  8388608 user_type=0
partition  3: class =         DISK, name =        UDISK, partition start =  8552448, partition size = 22380544 user_type=0

擴展 root 分割區
# nand-part -f a20 /dev/nand 32768 ‘boot 131072’ ‘rootfs 30769152’

完成之後,重新啟動電腦
# reboot

原本分割區
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       4.0G  1.1G  2.8G  28% /
devtmpfs        888M     0  888M   0% /dev
tmpfs           985M     0  985M   0% /dev/shm
tmpfs           985M  368K  984M   1% /run
tmpfs           985M     0  985M   0% /sys/fs/cgroup
tmpfs           985M     0  985M   0% /tmp

重新設定 /dev/nandb 分割區大小
# resize2fs /dev/nandb
resize2fs 1.42.8 (20-Jun-2013)
Filesystem at /dev/nandb is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/nandb is now 3870720 blocks long.

擴展之後的分割區
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  1.1G   13G   8% /
devtmpfs        888M     0  888M   0% /dev
tmpfs           985M     0  985M   0% /dev/shm
tmpfs           985M  368K  984M   1% /run
tmpfs           985M     0  985M   0% /sys/fs/cgroup
tmpfs           985M     0  985M   0% /tmp

更改時區設定
# date
Sun Oct 12 08:52:43 MDT 2014

刪除舊有設定
# rm -rf /etc/localtime

設定成 Asis/Taipei
# timedatectl set-timezone Asia/Taipei

# date
Sun Oct 12 22:53:21 CST 2014

更換成台灣的 Server
# sed -i ‘s/^Server/#Server/’ /etc/pacman.d/mirrorlist
# sed -i ’54s/# Server/Server/g’ /etc/pacman.d/mirrorlist

進行套件庫更新
# pacman -Syy
:: Synchronizing package databases…
 core                     205.1 KiB  2.95M/s 00:00 [#####################] 100%
 extra                      2.2 MiB  5.12M/s 00:00 [#####################] 100%
 community                  2.4 MiB  4.51M/s 00:01 [#####################] 100%
 alarm                     66.6 KiB  2.50M/s 00:00 [#####################] 100%
 aur                       60.5 KiB  4.22M/s 00:00 [#####################] 100%
 
 設定中文化環境,加入 en_US.UTF-8 和 zh-TW.UTF-8
# sed -i ‘s/#en_US.UTF-8/en_US.UTF-8/’ /etc/locale.gen
# sed -i ‘s/#zh_TW.UTF-8/zh_TW.UTF-8/’ /etc/locale.gen

產生 locale.gen 內指定的語系
locale-gen
Generating locales…
  en_US.UTF-8… done
  zh_TW.UTF-8… done
Generation complete.

設定預設語系
# echo ‘LANG=”en_US.UTF-8″‘ > /etc/locale.conf

檢視設定
# grep -v ^# /etc/locale.gen
en_US.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8

更新已安裝的套件
# pacman -Syu

安裝所須套件(視須求)
# pacman -S vim mlocate dnsutils

(2/2) installing wget                                                                                                                          [#######################################################################################] 100%
warning: directory permissions differ on /usr/
filesystem: 775  package: 755

Cubie Truck 測試 – 放棄使用 Ubuntu 14.04

原本看到在 Cubie Truck 下載區有 Ubuntu 14.04 非常高興,馬上下載下來使用!
下載網址:http://dl.cubieboard.org/software/a20-cubietruck/ubuntu-14.04/

預設登入的帳號及密碼:root / cubie
不過開機完成後,發現進入的是文字介面,這也還好,反正可以透過網路加裝其它套件,然後發現竟然連 eth0 也沒抓到,這真的是給 Cubie Truck 用的版本嗎?

Adobe Flash Player 15.0.0.239

Adobe Flash Player 15.0.0.239
[@more@]Windows 平台
Internet Explorer:
http://fpdownload.adobe.com/get/flashplayer/pdc/15.0.0.239/install_flash_player_ax.exe
Windows 8/8.1 版則要從 Windows Update 中更新

All Other Browsers(Firefox,Safari & Opera):
http://fpdownload.adobe.com/get/flashplayer/pdc/15.0.0.239/install_flash_player.exe

Mac
http://fpdownload.adobe.com/get/flashplayer/pdc/15.0.0.239/install_flash_player_osx.dmg

Cubie Truck 測試 – Ubuntu Desktop 中文化

預設的 Ubuntu Desktop 是英文版的介面

底下是中文化的過程
[@more@]$ sudo locale-gen zh_TW.UTF-8
Generating locales…
  zh_TW.UTF-8… done
Generation complete.
$ sudo update-locale LANG=zh_TW.UTF-8
$ sudo update-locale LANGUAGE=zh_TW.UTF-8

安裝中文語系及中文字形
$ sudo apt-get install fonts-arphic-uming ttf-arphic-ukai language-pack-zh-hant firefox-locale-zh-hant poppler-data language-pack-gnome-zh-hant cmap-adobe-cns1

安裝中文輸入法 gcin
$ sudo apt-get install gcin

重新登出登入後,介面就中文的了!

但 gcin 的圖示無法出現在工作列上,參考下面的連結
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=217464#forumpost217464

在上面的狀態列上按著「Win」+「Alt」再加上「滑鼠右鍵」,
接著按下「加入面板」就會跳出加入面板的視窗,
這時向下找到「程式狀態通知區」後選擇它並加入,
這樣就會看到 gcin 狀態列了!

但出現圖示之後,發現並不是所有的程式都能使用,試了幾個程式,發現 firefox / leafpad 可以,但 terminal / gedit 則不行,這是…..

所以決定先放棄這一個版本。

Bananian Linux 更新到 14.11

除了可以下載新的 Image 來安裝 Bananian Linux  14.11 外,也可以從已安裝的系統來做升級
1. 登入系統,執行 bananian-update
# bananian-update
[@more@]2. 輸入 yes 進行更新

3. 更新中

4. 更新完成,執行 shutdown -r now 重新啟動
# shutdown -r now

Cubie Truck 測試 – 擴展 Ubuntu root 分割區

因為 Ubuntu root 分割區的大小實在有些小,稍微安裝一下套件就快滿了!
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.8G  1.5G  199M  89% /
devtmpfs        889M  4.0K  889M   1% /dev
none            197M  552K  197M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            985M  172K  985M   1% /run/shm

但在 Ubuntu Desktop 似乎沒有提供 nand-part 這一個指令
$ sudo nand-part
sudo: nand-part: command not found
[@more@]安裝編譯 nand-part 所需的套件
$ sudo apt-get install libusb-1.0-0-dev

下載 sunxi-tools
$ git clone https://github.com/linux-sunxi/sunxi-tools
Cloning into ‘sunxi-tools’…
remote: Counting objects: 1075, done.
remote: Total 1075 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1075/1075), 368.20 KiB | 156 KiB/s, done.
Resolving deltas: 100% (577/577), done.

切換目錄
$ cd sunxi-tools

進行編譯
$ make

將 nand-part 複製到 /sbin 目錄
$ sudo cp nand-part /sbin

列出 Nand Flash 的分割區狀態
$ sudo nand-part -f a20 /dev/nand
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size =  6291456 user_type=0
partition  3: class =         DISK, name =        UDISK, partition start =  6455296, partition size = 24477696 user_type=0

綠色是分割區的名字,粉紅色是分割區的起始位置,橘色是分割區的大小

UDISK 是還未用到的區域,也就是 root 分割區要擴展的區域
擴展之後 /dev/nandb 的大小 6291456+24477696 = 30769152

進行重新分割
$ sudo nand-part -f a20 /dev/nand 32768 ‘boot 131072’ ‘rootfs 30769152’
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size =  6291456 user_type=0
partition  3: class =         DISK, name =        UDISK, partition start =  6455296, partition size = 24477696 user_type=0
check partition table copy 0: mbr: version 0x00000200, magic softw411
check partition table copy 1: mbr: version 0x00000200, magic softw411
check partition table copy 2: mbr: version 0x00000200, magic softw411
check partition table copy 3: mbr: version 0x00000200, magic softw411

ready to write new partition tables:
mbr: version 0x00000200, magic softw411
2 partitions
partition  1: class =         DISK, name =         boot, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size = 30769152 user_type=0

write new partition tables? (Y/N)
y
Failed rereading partition table: Device or resource busy

verifying new partition tables:
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
2 partitions
partition  1: class =         DISK, name =         boot, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size = 30769152 user_type=0
rereading partition table… returned -1

完成之後,重新啟動電腦
$ sudo reboot

原本的分割區大小
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.8G  1.5G  199M  89% /
devtmpfs        889M  4.0K  889M   1% /dev
none            197M  552K  197M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            985M  172K  985M   1% /run/shm

重新設定 /dev/nandb 分割區大小
$ sudo resize2fs /dev/nandb
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/nandb is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/nandb is now 3870720 blocks long.

之後的大小
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  1.6G   13G  12% /
devtmpfs        889M  4.0K  889M   1% /dev
none            197M  536K  197M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            985M   76K  985M   1% /run/shm

列出 Nand Flash 目前的分割區狀態
$ sudo nand-part -f a20 /dev/nand
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
2 partitions
partition  1: class =         DISK, name =         boot, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size = 30769152 user_type=0

不過重新分割的過程中,出現 resize2fs: Permission denied to resize filesystem 的錯誤訊息,重試了很多次還是無法解決,後來重新燒錄 Nash Flash Image,再做一次就正常了!
$ sudo resize2fs /dev/nandb
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/nandb is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
resize2fs: Permission denied to resize filesystem

Banana Pi 測試 – LeMedia 1.1

LeMedia 1.1 已於 11/17 Release
下載網頁:http://www.lemaker.org/resources/9-191/lemedia.html

[@more@]
更新事項:
LeMedia (XBMC) v1.1 Realeased – News – Banana Pro | Banana Pi Forum

Features:
1. Based on minimal Debian wheezy.
2. XBMC build from xbmc_Gotham_A10: https://github.com/warped-rudi/xbmc.git .
3. Enable sunxi_cedar_mod, mali_drm, drm, mali, ump driver module;
4. Pre-install UMP library;
5. Pre-install xorg and fbturbo_driver driver;
6. Pre-install libvdpau;
7. Pre-install libhybris wrapped Android libraries;
8. Pre-install LIRC, you can configure your own IR sender;
9. Auto mount usb storage;
10. Auto start XBMC when system boot;
11. Auto log in using root user;
12. Password is root/bananapi ;
13. Kernel version is 3.4.103;
14. Default display  resolution is 1080p ;
15. Audio ouput from audio HDMI by default.
16. Solved other bugs.

Cubie Truck 測試 – 改用 Ubuntu Desktop

因為 Lubuntu 的版本比較舊所以改用比較新的版本 Ubuntu Desktop
下載位置:
http://dl.cubieboard.org/software/a20-cubietruck/ubuntu-desktop/

預設登入的帳號及密碼:linaro / linaro
登入預設採用的是 Unity 介面
[@more@]Ubuntu Desktop 所採用的是 12.04 的版本,因為 Precise 屬於 LTS 的版本,所以還可以接受
CubieTruck 版本是 12.11 版本

$ sudo lsb_release -a
No LSB modules are available.
Distributor ID:    Linaro
Description:    Linaro 12.11
Release:    12.11
Codename:    precise

出現可以升級的訊息,但這裡先不升級,因為升級可能會面臨空間不足,或是其它的問題

先刪除一些個人比較不常用的套件,移除的套件純屬個人習慣
移除 ibus 輸入法架構
$ sudo apt-get remove –purge ibus ibus-gtk ibus-gtk3 ibus-pinyin ibus-pinyin-db-android ibus-pinyin-db-open-phrase libibus-1.0-0 python-ibus pinyin-database ibus-table libibus-1.0-0

移除 brasero 燒錄軟體
$ sudo apt-get remove –purge brasero brasero-cdrkit brasero-common libbrasero-media3-1

移除 empathy
$ sudo apt-get remove –purge empathy empathy-common nautilus-sendto-empathy

移除 gwibber
$ sudo apt-get remove –purge gwibber gwibber-service gwibber-service-facebook gwibber-service-identica gwibber-service-twitter libgwibber-gtk2 libgwibber2

移除 thunderbird
$ sudo apt-get remove –purge thunderbird thunderbird-globalmenu thunderbird-gnome-support

移除 transmission
$ sudo apt-get remove –purge transmission-gtk transmission-common

移除 simple-scan
$ sudo apt-get remove –purge simple-scan

移除遊戲
$ sudo apt-get remove –purge aisleriot gnome-games-data gnome-sudoku gnomine mahjongg

把用不到的套件一併清除
$ sudo apt-get autoremove

安裝 Ubuntu Desktop 傳統介面,因為不習慣使用新的介面,並不是 Unity 新的介面有什麼不好,就像 Windows 8 / 8.1 把開始功能表移除一樣
$ sudo apt-get install gnome-session-fallback

改成傳統介面