Difference between revisions of "Debian Jessie"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
Line 1: Line 1:
[[Debian Jessie/zh|查看中文]]
 
  
==Download debian image file==
 
===S5P4418 Boards===
 
Get the following files from:[http://dl.friendlyarm.com/s5p4418release201711 download link],Image filename:<br />
 
{| class="wikitable"
 
|-
 
|s5p4418-debian-sd8g-20171017.img.zip|| Debian8-Desktop
 
|-
 
|}
 
===S5P6818 Boards===
 
Get the following files from:[http://dl.friendlyarm.com/s5p6818release201711 download link],Image filename:<br />
 
{| class="wikitable"
 
|-
 
|s5p6818-debian-sd8g-20171102.img.zip|| Debian8-Desktop
 
|-
 
|}
 
 
==Working with Debian==
 
===Ethernet Connection===
 
* If the board is connected to a network via Ethernet before it is powered on, it will automatically obtain an IP after it is powered up.
 
 
===Wireless Connection===
 
Under Debian you can manage your network with [[Use NetworkManager to configure network settings|NetworkManager]].<br />
 
After Debian boots click on the network icon on the bottom right of the task bar a NetworkManger menu will pop up and all the available networks will be listed. If there is an active wireless network you will see something similar to the following screenshot:<br />
 
[[File:NetworkManagerIcon.png|frameless|400px|NetworkManagerIcon]]<br />
 
You can click on a WiFI AP and connect your board to it.<br />
 
For more details refer to:[[Use NetworkManager to configure network settings|NetworkManager]].<br />
 
 
===Setup Wi-Fi AP===
 
Follow the steps below. Since our OS image by default already has the NetworkManager utility you will be prompted to uninstall it first:<br />
 
<syntaxhighlight lang="bash">
 
sudo turn-wifi-into-apmode yes
 
</syntaxhighlight>
 
After you uninstall the NetworkManager reboot your board.<br />
 
After your board is rebooted run the above commands again and you will be prompted to type in a WIFI's name and password. Type in your wanted name and password<br />
 
<br />
 
If this is successful you will be able to find and connect your board to a WIFI. Login to your board at 192.168.8.1:
 
<syntaxhighlight lang="bash">
 
ssh root@192.168.8.1
 
</syntaxhighlight>
 
Type in a password. In our system the password is "fa".<br />
 
<br />
 
To login smoothly via SSH we recommend you turning off WIFI's power save mode by running the following commands:
 
<syntaxhighlight lang="bash">
 
sudo iwconfig wlan0 power off
 
</syntaxhighlight>
 
You can check your WiFi's mode by running the following command:<br />
 
<syntaxhighlight lang="bash">
 
sudo cat /sys/module/bcmdhd/parameters/op_mode
 
</syntaxhighlight>
 
Number 2 means your WiFi is in AP mode. You can switch to the Station mode by running the following command:<br />
 
<syntaxhighlight lang="bash">
 
sudo turn-wifi-into-apmode no
 
</syntaxhighlight>
 
 
===Bluetooth===
 
Here are the steps to transfer a file from T2 to a mobile phone. Run the following command to search a surrounding Bluetooth device:<br />
 
<syntaxhighlight lang="bash">
 
hcitool scan
 
</syntaxhighlight>
 
<br />
 
In our example a mobile phone was detected and the following messages were listed:<br />
 
Scanning ...<br />
 
38:BC:1A:B1:7E:DD      MEIZU MX4<br />
 
<br />
 
These messages indicated that a MEIZU MX4 mobile phone was detected. We then checked the Bluetooth services this phone supported with its MAC address presented in front of its device name<br />
 
<syntaxhighlight lang="bash">
 
sdptool browse 38:BC:1A:B1:7E:DD
 
</syntaxhighlight>
 
Note: you need to use your device's name and its MAC address when you run these commands.<br /><br />
 
The command listed all the services the phone supported. We needed the "OBEX Object Push" service which is for file transfers.<br />
 
Service Name: OBEX Object Push<br />
 
Service RecHandle: 0x1000b<br />
 
Service Class ID List:<br />
 
"OBEX Object Push" (0x1105)<br />
 
Protocol Descriptor List:<br />
 
"L2CAP" (0x0100)<br />
 
"RFCOMM" (0x0003)<br />
 
Channel: 25<br />
 
"OBEX" (0x0008)<br />
 
Profile Descriptor List:<br />
 
"OBEX Object Push" (0x1105)<br />
 
Version: 0x0100<br />
 
<br />
 
From the above messages we could get the channel number 25 for the "OBEX Object Push" service. We input this number to the "ussp-push" by running the following command:
 
<syntaxhighlight lang="bash">
 
ussp-push 38:BC:1A:B1:7E:DD@25 example.jpg example.jpg
 
</syntaxhighlight>
 
Note: you need to use your device's name, its MAC address and channel number when you run these commands.<br /><br />
 
Usually after the above commands are run a popup window will show on the phone that communicates with T2 and you can start file transfers.<br />
 
<br />
 
Common Issues:<br />
 
1) If T2 cannot find a Bluetooth device you can try this command to restart its Bluetooth:<br />
 
<syntaxhighlight lang="bash">
 
rfkill unblock 0
 
</syntaxhighlight>
 
2) If any of these commands is not installed you can try this command to install it:<br />
 
<syntaxhighlight lang="bash">
 
apt-get install bluetooth bluez obexftp openobex-apps python-gobject ussp-push
 
</syntaxhighlight>
 
 
===Install Debian Packages===
 
We provide a Debian Jessie image. You can install Jessie's packages by commanding "apt-get". If this is your first installation you need to update the package list by running the following command
 
<syntaxhighlight lang="bash">
 
apt-get update
 
</syntaxhighlight>
 
You can install your preferred packages. For example if you want to install an FTP server you can do this:
 
<syntaxhighlight lang="bash">
 
apt-get install vsftpd
 
</syntaxhighlight>
 
Note: you can change your download server by editting "/etc/apt/sources.list". You can get a complete server list from [http://www.debian.org/mirror/list]. You need to select the one with "armhf".
 
 
===Audio Output from HDMI or 3.5mm Jack under Debian===
 
Our default Debian image doesn't support audio output. If you want to enable this function you need to install the alsa package.
 
* Make sure your Debian OS is our latest version and your board has access to the internet;
 
* Power up your board and run the following commands on your board's commandline utility to install the alsa package:
 
<syntaxhighlight lang="bash">
 
apt-get update
 
apt-get install libasound2
 
apt-get install alsa-base
 
apt-get install alsa-utils
 
</syntaxhighlight>
 
* After the installation is done copy a ".wav" audio file to your board, connect your board to a earphone or speaker and try playing this audio file(By default Debian's audio output is from the 3.5mm audio jack):
 
<syntaxhighlight lang="bash">
 
aplay music.wav
 
</syntaxhighlight>
 
* By default Debian's audio output is from the 3.5mm audio jack. If you want audio output from the HDMI you need to change the setting by editing the "/etc/asound.conf" file:
 
<syntaxhighlight lang="bash">
 
pcm.!default {
 
    type hw
 
    card 1
 
    device 0}
 
 
ctl.!default {
 
    type hw
 
    card 1}
 
</syntaxhighlight>
 
card 0 stands for the 3.5mm audio jack and card 1 stands for the HDMI audio. After you make your change reboot your board to make it effective.
 
 
 
===Login via VNC and SSH===
 
If your board is not connected to a display device you can login to your board from a mobile phone. You need to download and install a "VNC Viewer" from [http://www.realvnc.com/download/ here] on a mobile phone and login to the board via VNC at port 1. Its default password is "fa123456".<br />
 
Here is a screenshot which shows how it looks like when users login to the board from an iPhone via VNC:<br />
 
[[File:iphone6-vnc-nanopi2.png|frameless|400px|VNC to NanoPi2]]
 
<br />
 
In our case our M1's IP address is 192.168.1.230. You can login via SSH by running the following commands:<br />
 
<syntaxhighlight lang="bash">
 
$ ssh root@192.168.1.230
 
</syntaxhighlight>
 
The password is fa.
 
 
===Test USB WiFi===
 
Our OS system has support for popular USB WiFi drivers. Many USB WiFi modules are plug and play with our system. Here is a list of models we tested;
 
::{| class="wikitable"
 
|-
 
|Number||Model     
 
|-
 
|1  ||  RTL8188CUS 802.11n WLAN Adapter   
 
|-
 
|2  ||  RT2070 Wireless Adapter   
 
|-
 
|3  ||  RT2870/RT3070 Wireless Adapter
 
|-
 
|4  ||  RTL8192CU Wireless Adapter
 
|-
 
|5  ||  mi WiFi mt7601
 
|}
 
* Check device list
 
<syntaxhighlight lang="bash">
 
$ nmcli dev
 
DEVICE  TYPE      STATE        CONNECTION       
 
eth0    ethernet  connected    Wired connection 1
 
wlan0  wifi      disconnected  --                                 
 
lo      loopback  unmanaged    --
 
</syntaxhighlight>
 
Note: if the status of a device is "unmanaged" it means that device cannot be accessed by NetworkManager. To make is accessed you need to clear the settings under "/etc/network/interfaces" and reboot your system.
 
 
* Start WiFi
 
<syntaxhighlight lang="bash">
 
$ nmcli r wifi on
 
</syntaxhighlight>
 
 
* Scan Surrounding WiFi Sources
 
<syntaxhighlight lang="bash">
 
$ nmcli dev wifi
 
</syntaxhighlight>
 
 
* Connect to a WiFi Source
 
<syntaxhighlight lang="bash">
 
$ nmcli dev wifi connect "SSID" password "PASSWORD"
 
</syntaxhighlight>
 
The "SSID" and "PASSWORD" need to be replaced with your actual SSID and password.<br />
 
If a connection succeeds it will be automatically setup on next system reboot.<br />
 
<br />
 
For more details about NetworkManager refer to this link:[[Use NetworkManager to configure network settings]]<br />
 
 
===Connect to DVP Camera CAM500B===
 
Note: this function is only supported in Linux-3.4.y<br>
 
The CAM500B camera module is a 5M-pixel camera with DVP interface. For more tech details about it you can refer to [[Matrix - CAM500B]].<br>
 
[[File:NanoPi-M1-cam500a.jpg|frameless|500px|NanoPi-M1-cam500a]] <br>
 
Follow the hardware setup presented in the above picture to connect your H3 board to a CAM500B. Then boot OS, connect your board to a network, log into the board as root and run "mjpg-streamer":
 
<syntaxhighlight lang="bash">
 
$ cd /root/mjpg-streamer
 
$ make
 
$ ./start.sh
 
</syntaxhighlight>
 
The mjpg-streamer application is an open source video steam server. After it is successfully started the following messages will be popped up:
 
<syntaxhighlight lang="bash">
 
i: Using V4L2 device.: /dev/video0
 
i: Desired Resolution: 1280 x 720
 
i: Frames Per Second.: 30
 
i: Format............: YUV
 
i: JPEG Quality......: 90
 
o: www-folder-path...: ./www/
 
o: HTTP TCP port.....: 8080
 
o: username:password.: disabled
 
o: commands..........: enabled
 
</syntaxhighlight>
 
 
In our case the board's IP address was 192.168.1.230. We typed 192.168.1.230:8080 in a browser and were able to view the images taken from the camera's. Here is what you would expect to observe:<br>
 
[[File:mjpg-streamer-cam500a.png|frameless|600px|mjpg-streamer-cam500a]] <br>
 
The mjpg-streamer soft-encodes data with libjpeg and you can hard-encode its data with ffmpeg which will greatly increase CPU's efficiency and speed up data encoding:
 
<syntaxhighlight lang="bash">
 
$ ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
 
        -b:v 64k -c:v cedrus264 test.mp4
 
</syntaxhighlight>
 
By default it records a 30-second video. Typing "q" stops video recording. After recording is stopped a test.mp4 file will be generated.
 
 
===Connect to USB Camera(FA-CAM202)===
 
The FA-CAM202 is a 200M USB camera.<br>
 
Refer to this link for more details on how to connect to a FA-CAM202:
 
[[NanoPi_M1#Connect_NanoPi_M1_to_DVP_Camera_CAM500B|Connect NanoPi M1 to DVP Camera CAM500B]] <br>
 
 
===Use OpenCV to Access Camera===
 
* The full name of "OpenCV" is Open Source Computer Vision Library and it is a cross platform vision library.
 
* Make sure your board is connected to the internet and an HDMI monitor, Boot Debian and login.
 
* Install OpenCV libraries:
 
<syntaxhighlight lang="bash">
 
$ apt-get update
 
$ apt-get install libcv-dev libopencv-dev
 
</syntaxhighlight>
 
* Refer to the instructions in the previous sections to make sure the camera works
 
* Compile and run a code sample(Official Code Sample in C++ provided by the OpenCV organization):
 
<syntaxhighlight lang="bash">
 
$ cd /home/fa/Documents/opencv-demo
 
$ make
 
$ ./demo
 
</syntaxhighlight>
 
Here is what you expect to observe:<br>
 
[[File:OpenCV-M1.png|frameless|600px|OpenCV-M1]]
 
 
===Check CPU's Working Temperature (Only Support H3 Platform)===
 
You can use the following command to read H3's temperature and frequency
 
<syntaxhighlight lang="bash">
 
cpu_freq
 
</syntaxhighlight>
 
 
===Check System Information with Rpi-Monitor(Only Support H3 Platform)===
 
Our OS contains the Rpi-Monitor utility with which users can check system information and status.<br>
 
In our case our board's IP was 192.168.1.230 and we typed the following IP in a browser:
 
<syntaxhighlight lang="bash">
 
192.168.1.230:8888
 
</syntaxhighlight>
 
We were directed to the following page:<br>
 
[[File:rpi-monitor.png|frameless|700px|rpi-monitor]] <br>
 
Users can easily check these system information and status.
 
 
===Test GPU (Only Support H3 Platform)===
 
Note: this function is only supported in Allwinner Linux-3.4.y.<br>
 
After OS loads please login from a terminal and run the following command:
 
<syntaxhighlight lang="bash">
 
glmark2-es2
 
</syntaxhighlight>
 
[[File:m1-gpu-glmark2.png|frameless|500px|m1-gpu-glmark2]]
 
 
===Test VPU (Only Support H3 Platform)===
 
Note: this function is only supported in Allwinner Linux-3.4.y<br>
 
Visit this link [http://pan.baidu.com/s/1eRefpT4 download link] to download files<br>
 
After OS is loaded login from a terminal and run the following commands:
 
<syntaxhighlight lang="bash">
 
$ sudo apt-get install mpv
 
$ video_play mpv ./big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4
 
</syntaxhighlight>
 
In our test it could do hard coding and play 1080P video fluently.
 

Revision as of 06:35, 21 December 2017