2016/09/07

UP board:播放mp3音檔與mp4影片檔

安裝好Linux系統(Ubilinux),讓我們來嘗試播放mp3音檔與mp4影片檔吧。

首先把一些mp3與mp4檔傳輸到UP board裡。Ubilinux預設已安裝SSH相關套件,所以可使用WinSCP來傳輸檔案。

然後開啟預設已安裝的VLC,

然後拖拉想撥放的檔案,咦,奇怪,我的螢幕變黑了,收不到訊號,哇哩咧。

不過系統仍活著,所以可使用SSH遠端登入,找出VLC的PID,然後kill殺掉。

但是為什麼呢?上論壇一問,原來播放媒體檔案時,會改變成Full HD顯示模式,因為我的螢幕太舊不支援,所以就會變黑。

好吧,換台螢幕,耶,成功囉。
另外,如果你想使用SMPlayer(影片)與LXMusic(音樂)來播放的話,請安裝相關套件:
$ sudo apt-get install lxmusic xmms2 xmms2-plugin-all mplayer smplayer

SMPlayer。
LXMusic。

2016/09/06

UP board:查詢系統狀態的Linux指令

安裝好Linux系統(Ubilinux)之後,簡單試用一些查詢系統狀態的Linux指令吧。

首先,看看Linux核心版本吧。
$ uname -a
Linux ubilinux 4.4.0-ubi3-amd64 #1 SMP Debian 4.4.13-1 (2016-06-17) x86_64 GNU/Linux
$ cat /proc/version
Linux version 4.4.0-ubi3-amd64 (ubilinux@emutex.com) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP Debian 4.4.13-1 (2016-06-17)

哦,4.4啊,跟官方說的一樣

接著,查詢UP board的BIOS版本,
$ cat /sys/devices/virtual/dmi/id/bios_version
UPC1BM0S


看來是目前最新的,以後有機會的話,再嘗試更新囉。順帶一提,若要重置BIOS設定值,可拔掉RTC電池,等待10~15分鐘後再裝回去。

然後,查詢UP board板子本身的版本,
$ cat /sys/devices/virtual/dmi/id/board_version
V0.4

嗯,不知道代表什麼意義。

看看有多少記憶體:
$ free -h
             total       used       free     shared    buffers     cached
Mem:          3.3G       516M       2.8G        44M        21M       284M
-/+ buffers/cache:       209M       3.1G
Swap:           0B         0B         0B


嗯,總共應該有4 G才對,其他的,應該是分給GPU繪圖處理器了,可到BIOS調整;除此之外,也有些許部分被BIOS保留作為其他用途。

查詢儲存媒體eMMC的用量:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             10M     0   10M   0% /dev
tmpfs           673M  8.9M  664M   2% /run
/dev/mmcblk0p3   29G  2.5G   25G   9% /
tmpfs           1.7G     0  1.7G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.7G     0  1.7G   0% /sys/fs/cgroup
/dev/mmcblk0p2   48M  119K   48M   1% /boot/efi
tmpfs           337M  4.0K  337M   1% /run/user/110
tmpfs           337M  4.0K  337M   1% /run/user/1000


嗯, 看來我手上這塊板子內建32 GB地eMMC。

查看網路卡取得的IP。我的UP board位於路由器之後,會從DHCP自動取得IP位址。
$ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:32:3d:2d:7d
          inet addr:192.168.1.71  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::207:32ff:fe3d:2d7d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1019 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1094 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:206884 (202.0 KiB)  TX bytes:138338 (135.0 KiB)


Ubilinux源自Debian,通樣採用DEB/APT套件管理系統,讓我們更新套件清單,並且升級原已安裝的套件吧,指令如下:
$ sudo apt-get update
$ sudo apt-get dist-upgrade
...省略輸出...

試試安裝新套件吧,例如可查詢CPU狀態的cpufrequtils:
$ sudo apt-get install cpufrequtils

然後執行指令cpufreq-info:
$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 940 MHz.
analyzing CPU 1:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz.
analyzing CPU 2:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.68 GHz.
analyzing CPU 3:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.68 GHz.


可看到有4個CPU核心,時脈為480 MHz到1.92 GH,動態調整。

嗯,那麼CPU溫度呢,先安裝套件Linux Monitoring Sensors:
$ sudo apt-get install lm-sensors

然後,執行指令sensors-detect設定該載入那些模組,如果不知道的話,最好通通使用預設值,直接按Enter就對了:
$ sudo sensors-detect
# sensors-detect revision 6209 (2014-01-14 22:51:58 +0100)
# System: AAEON UP-CHT01 [V1.0]

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no):
Module cpuid loaded successfully.
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no):
...省略...

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `coretemp':
  * Chip `Intel digital thermal sensor' (confidence: 9)

Driver `to-be-written':
  * ISA bus, address 0xca0
    Chip `IPMI BMC KCS' (confidence: 4)
  * ISA bus, address 0xca8
    Chip `IPMI BMC SMIC' (confidence: 4)

Note: there is no driver for IPMI BMC KCS yet.
Check http://www.lm-sensors.org/wiki/Devices for updates.

To load everything that is needed, add this to /etc/modules:
#----cut here----
# Chip drivers
coretemp
#----cut here----
If you have some drivers built into your kernel, the list above will
contain too many modules. Skip the appropriate ones!

Do you want to add these lines automatically to /etc/modules? (yes/NO)

Unloading cpuid... OK

然後執行指令sensors觀看:
$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:         +0.0°C  (crit = +90.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +37.0°C  (high = +90.0°C, crit = +90.0°C)
Core 1:       +36.0°C  (high = +90.0°C, crit = +90.0°C)
Core 2:       +40.0°C  (high = +90.0°C, crit = +90.0°C)
Core 3:       +36.0°C  (high = +90.0°C, crit = +90.0°C)

哎呀,好煩,上批踢踢跟網友鄉民大戰吧,咦,怎麼出現亂碼?
$ telnet ptt.cc

安裝中文字型:
$ sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy scim scim-tables-zh scim-chewing scim-pinyin fonts-inconsolata ttf-anonymous-pro ttf-dejavu ttf-bitstream-vera 

也安裝PCMan這套圖形化BBS客戶端軟體:
$ sudo apt-get install pcmanx-gtk2    

啊哈,OK囉。

2016/09/04

UP board:安裝Linux系統

承蒙研揚科技公司好意,贈送一塊UP board。上一篇開箱拍拍照,介紹硬體規格,這一篇要開始安裝軟體囉。

概略步驟如下:

  1. 準備好所需硬體。
  2. 下載想安裝的軟體系統,此處以Linux系統(Ubilinux)為例。
  3. 燒錄安裝用的Linux系統到USB隨身碟(或記憶卡加讀卡機)。
  4. 使用上一步的USB裝置開機,進行安裝程序,把Linux系統安裝到UP board內建的eMMC儲存空間。
  5. 拔除USB裝置,讓UP board自己開機,開始使用Linux系統。
看完介紹若有興趣的話,可UP board線上商店購買,或聯絡研揚公司

除了電源供應器、螢幕、鍵盤、滑鼠,還需要準備USB隨身碟,或者如下圖的記憶卡加讀卡機,容量大小至少要有1 GB。等一下要把可開機的安裝程式、燒錄進這台USB裝置,以之開機,進行安裝程序,把Linux系統安裝到UP board板子內建的eMMC儲存空間。
因為我想插入UP board的USB 3.0 Micro埠,所以要再準備一條USB A母轉Micro B公的轉接線。
下圖是連接後的樣子。其實,也可插入UP board側邊的USB 2.0埠。總之就是要讓UP board使用這台USB裝置來開機,進行Linux系統的安裝程序。
插上鍵盤、滑鼠、網路線、HDMI、電源供應器。我用的螢幕只有DVI介面,所以加上DVI轉HDMI的轉接頭。呃,糟糕,插座靠太近,插頭大太,插不進去啦。
只好拿出刀子,削減HDMI轉接頭的兩側。
呼,終於可以了。嗯,UP board研發工程師都沒有碰到這個問題嗎?
若想把USB裝置插入UP board側邊的USB 2.0埠,也會遇到卡住的問題,此時可使用USB A母轉A公的延長線。
接下來要把安裝用的Linux系統、燒錄到之前準備好的USB裝置。

首先下載想安裝的軟體系統,到UP community網站的下載區,可看到Ubilinux、Windows 10、Ubuntu等,此處以Ubilinux為例,我下載的檔案是ubilinux-3.0.iso,約700 MB。

燒錄工具,若你的主機電腦是Linux或Mac OS X,可使用指令dd,此處不介紹。若主機電腦是Windows的話,可使用Rufus燒錄工具。下載後執行,看到如下畫面,紅色箭頭處可更改介面語言,我改為英文,因為UP board官方提供的安裝文件,也是英文。
請確認最上面的選項Device,應是你的USB裝置。然後點選「1」的光碟圖示,選擇剛剛下載的Ubilinux映像檔ubilinux-3.0.iso。然後點選「2」,改成「MBR partition scheme for UEFI」,注意,非常重要。
設定完成後的樣子,然後點按「Start」。
嗯,跳出一個對話盒,大意是說Rufus還需要下載一些檔案,選Yes。
然後出現底下畫面,注意,必須選擇「Write in DD Image mode」,非常重要。
然後Rufus警告你,目標裝置裡的東西,都會被摧毀,所以請確認是否選對磁碟機,可不要洗掉你自己電腦的硬碟啊。
進行燒錄中。
燒錄完畢。
插入UP board吧,開啟電源,開機!可看到藍色電源燈亮起,風扇也開始轉動,音量相當低,耳朵必須靠很近,才聽得見。
螢幕應會先出現UP的標示圖誌,但可能跳太快而沒看到。
咦?這是什麼?應該是UP board內建eMMC預設含有的UEFI。
那並不是我要的,請在開機時按著F7,便會進入挑選開機裝置的選單,如下圖。呃,怎麼沒有出現我的USB裝置呢?
如果點按「Enter Setup」,將會進入類似BIOS的設定畫面,這也不是我要的。
原因在於應使用「具備UEFI開機能力的USB裝置」,我之前準備的讀卡機太舊啦,換個新的吧,如下圖,然後重新燒錄。
插入UP board,再試一次。
開機時按著F7,嘿,出現囉,選擇該裝置開機。
啊哈,看到囉。
右下角標示著ubilinux。
選擇左上角的「Install」,進入Ubilinux的安裝程序。
接下來便是Ubilinux安裝程序,跟一般Linux系統的安裝程序差不多,此處僅概略介紹;但其中有一步非常重要,還請注意。

首先選擇安裝時想使用的語言。
選擇所在地。
選擇地區設置。
選擇鍵盤對應。
載入其他元件。
輸入主機名稱。
網域名稱,不知道就別填。
建立使用者帳號與密碼,之後以之登入系統。
注意,此處非常重要,「Force UEFI」必須選擇「Yes」。
開始安裝。
我有插上網路線,途中詢問要到哪裡抓取最新的軟體套件。
也不知道哪個比較快,就選第一個吧。
按照你的網路設置,填入適當的HTTP Proxy。
下載中,去喝杯茶吧。
詢問要把GRUB安裝到哪裡,選擇UP board板子內建的eMMC,也就是/dev/mmcblk0。
終於完成囉。
接下來,便是要用安裝到UP board內建的eMMC的Ubilinux系統來開機。若開機時按著F7,你會看見如下畫面,請選ubilinux;若不按著F7,則會直接進入下個畫面。
選擇第一項,以安裝好的Ubilinux來開機。
預設會直接進入圖形視窗介面,輸入之前建立的使用者帳號與密碼,登入系統。
哇,成功囉,進入Ubilinux囉。
四處玩玩吧,開啟瀏覽器、計算機、終端機,耶!
Ubilinux源自Debian,其實就跟一般的Linux系統沒兩樣。

看完介紹若有興趣的話,可UP board線上商店購買,或聯絡研揚公司

參考資料: