Changes

Jump to: navigation, search

XUELK-AN-002: Running Debian distribution

13,557 bytes added, 16:36, 12 February 2021
no edit summary
{{InfoBoxTop}}
{{AppliesToSBCLynx}}
{{AppliesToDWM AN}}
{{AppliesTo AXEL ULite AN}}
{{AppliesTo SBC Lynx AN}}
{{InfoBoxBottom}}
{{WarningMessage|text=This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the ''History'' section.}}
{{ImportantMessage|text=Regarding the Molex antenna used in this AN. It is valid only for '''No EU''' countries - see [https://www.lairdconnect.com/documentation/regulatory-information-tiwi-ble link]}}
== History ==
{| class="wikitable" border="1"
!Version
!XUELK version
!Date
!Notes
|-
|1.0.0
|1.1.3
|February 2017
|First public release
|-
|2.0.0
|1.1.3
|April 2017
|
|-
|2.1.0
|1.1.3
|April 2017
|*Added section ''Using the raw image''*Added notes about <code>ssh</code> server configuration*Added notes about <code>MySQL</code> server installation and configuration
|-
|}
The procedure was tested on an SBC Lynx with ConfigID=0x0000000C (PCB revision CS214515A), starting from XUELK 1.1.3 binaries.
 
[2] The provided root file system is derived from this one: https://rcn-ee.com/rootfs/eewiki/barefs/debian-8.7-bare-armhf-2017-01-14.tar.xz.
===Using the raw image===
For convenience, the raw image of the microSD card is provided as well. This image is the result of the procedure described in the previous section, applied to a 16 GB card. The image can be downloaded [https://mirror.dave.eu/lynx/debian/20170403/20170403-sbclynx-debian-8-usd.img.zip here].
Once decompressed, it can be written directly to the card.
====Bluetooth====
The following script can be run to enable the Bluetooth controller:
<preclass="board-terminal">
root@arm:~# ./test/dwm_bt_init.sh
Found a Texas Instruments' chip!
</pre>
Once the <code>hci</code> interface is enabled, <code>hcitool</code> or other tools can be used to access it:
<preclass="board-terminal">
root@arm:~# hcitool scan
Scanning ...
zz:zz:zz:zz:zz:zz device2
</pre>
 
====WiFi (client mode)====
The procedure here described can be used to connect to an Access Point, using the WPA2/PSK security protocolwith network address given by the AP via DHCP. User can also follow [https://wiki.debian.org/WiFi/HowToUse#Command_Line this guide from Debian Wiki] for a generic approach.
As the WiFi driver is not statically linked to the kernel image, it is necessary to load the module first. This operation is done automatically upon boot, as the module is listed in <code>/etc/modules</code>:
</pre>
 To bring Once the WiFi module is loaded, it's time to configure the interface up: first of all we need to fix interface renaming with the following command:
<pre class="board-terminal">
root@arm:~# iw ln -s /devphy#0 Interface wlan0 ifindex 4 wdev 0x1 addr 88:33:14:5e:30:61 type managedroot@arm:~# ip link show wlan04: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000 link/ether 88:33:14:5e:30:61 brd ff:ff:ff:ff:ff:ffroot@arm:~# ip link set wlan0 up[ 276null /etc/systemd/network/99-default.076847] wlcore: firmware booted (Rev 6.3.10.0.133)[ 276.097912] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not readyroot@arm:~# ip link show wlan04: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000 link/ether 88:33:14:5e:30:61 brd ff:ff:ff:ff:ff:ff
</pre>
 The connection will be established with Generate the SSID named PSK from the ESSID and the clear text passphrase using <code>SSID_ZyXEL_WPA2wpa_passphrase</code>tool:
<pre class="board-terminal">
root@arm:~# iw wlan0 linkwpa_passphrase SSID_ZyXEL_WPA2Not connected.root@arm:~# iw wlan0 scan...BSS fe:f0:28:cc:03:90(on wlan0) TSF: 42646261 usec (0d, 00:00:42) freq: 2437 beacon interval: 100 TUs capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431) signal: -53.00 dBm last seen: 0 ms ago SSID: SSID_ZyXEL_WPA2 Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 DS Parameter set: channel 6 RSN: * Version: 1 * Group cipher: TKIP * Pairwise ciphers: TKIP * Authentication suites: PSK * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000) ERP: <no flags> Extended supported rates: 24.0 36.0 48.0 54.0 WMM: * Parameter version 1 * BE: CW 15-1023, AIFSN 3 * BK: CW 15-1023, AIFSN 7 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec * VO: CW 3-7, AIFSN 2, TXOP 1504 usec...</pre>  Add the reading passphrase key to the <code>wpa_supplicant</code> configuration file and make it readable by <code>root</code> only:<pre class="board-terminal">root@arm:~# wpa_passphrase SSID_ZyXEL_WPA2 >> /etc/wpa_supplicant.conffrom stdin
ZyXEL-WPA2-PSK
root@arm:~# chmod 0600 /etc/wpa_supplicant.conf
root@arm:~# cat /etc/wpa_supplicant.conf
# reading passphrase from stdin
network={
ssid="SSID_ZyXEL_WPA2"
</pre>
Edit <code>/etc/network/interfaces</code> and change the <code>wlan0</code> configuration as follows, by entering the <code>ssid</code> and <code>psk</code> generated above:
<pre class="board-terminal">
auto wlan0
iface wlan0 inet dhcp
wpa-ssid SSID_ZyXEL_WPA2
wpa-psk
ec41b79ebdf10022908aa10189b0341f095fd62eeb719a67c5c920e0cde28564
</pre>
Start User can now restart <code>wpa_supplicantsystemd</code>networking service with:
<pre class="board-terminal">
root@arm:~# wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.confSuccessfully initialized wpa_supplicantrfkill: Cannot open RFKILL control deviceioctl[SIOCSIWENCODEEXT]: Invalid argumentioctl[SIOCSIWENCODEEXT]: Invalid argument[ 3527.234018] wlan0: authenticate with fe:f0:28:cc:03:90[ 3527.269591] wlan0: send auth to fe:f0:28:cc:03:90 (try 1/3)[ 3527.277879] wlan0: authenticated[ 3527.282841] wl12xx_driver wl12xx.0.auto wlan0: disabling HT/VHT due to WEP/TKIP use[ 3527.298407] wlan0: associate with fe:f0:28:cc:03:90 (try 1/3)[ 3527.307655] wlan0: RX AssocResp from fe:f0:28:cc:03:90 (capab=0x431 status=0 aid=1)[ 3527.326148] wlcore: Association completed.[ 3527.349780] wlan0: associated[ 3527.352824] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes readysystemctl restart networking
</pre>
 Once Now you can check the connection process completed successfullysystem configuration using standard tools (<code>route</code>, <code>ifconfig</code>, <code>iw</code> reports ). E.g. to check the WiFi link status as followsuse:
<pre class="board-terminal">
root@arm:~# iw wlan0 link
dtim period: 1
beacon int: 100
</pre>All of the above configuration are persistent at reboots and automatically started by <code>systemd</code> at boot time. ==Miscellaneous configurations=====<code>ssh</code> server===The configuration file <code>/etc/ssh/sshd_config</code> is set to permit <code>root</code> user to log in.===Installing MySQL server with remote access===This section shows how to install MySQL server and how to enable remote access for <code>root</code> user.{{ImportantMessage|text=From a security standpoint, giving <code>root</code> user logon permission from any host may be dangerous.}}
After assigning a (static) IP address to Firstly, install the <code>wlan0mysql-server</code> interfacepackage. During the installation process, it is possible to ping you will set the Access Pointpassword for the <code>root</code> user:
<pre class="board-terminal">
root@arm:~# ifconfig wlan0 192sudo apt-get updateGet:1 http://security.168debian.11org jessie/updates InRelease [63.811 kB]...Reading package lists... Doneroot@arm:~# ifconfigeth0 Link encap:Ethernet HWaddr 00:50:C2:1E:AF:E9sudo apt-get install mysql-server inet addr:192Reading package lists.168.0.81 Bcast:192DoneBuilding dependency tree.168.0.255 Mask:255After this operation, 85.2551 MB of additional disk space will be used.255.0 inet6 addr: fe80::250:c2ff:fe1e:afe9Do you want to continue? [Y/64 Scope:Linkn] UP BROADCAST RUNNING MULTICAST MTU:1500 MetricGet:1 RX packets:35226 errors:0 dropped:0 overruns:0 framehttp://security.debian.org/ jessie/updates/main mysql-common all 5.5.54-0+deb8u1 [81.2 kB]...Configuring mysql-server-5.5---------------------------- TX packets:28 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000While not mandatory, it is highly recommended that you set a password for the RX bytes:3555583 (3MySQL administrative "root" user.3 MiB) TX bytes:1906 (1 If this field is left blank, the password will not be changed.8 KiB) lo Link encapNew password for the MySQL "root" user:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr Repeat password for the MySQL "root" user: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packetsSelecting previously unselected package libaio1:0 errors:0 dropped:0 overruns:0 carrier:0armhf. collisions:0 txqueuelen:0... RX bytes:0 Processing triggers for systemd (0230-7~bpo8+2) ...0 B) TX bytesroot@arm:0 (0.0 B)~#</pre>
wlan0 Link encap:Ethernet HWaddr 88:33:14:5E:30:61
inet addr:192.168.11.81 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::8a33:14ff:fe5e:3061/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24970 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2448625 (2.3 MiB) TX bytes:1291 (1.2 KiB)
Verify the server is up and running:<pre class="board-terminal">root@arm:~# ping 192mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.168Your MySQL connection id is 43Server version: 5.115.24354-0+deb8u1 (Debian) PING 192Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.168 Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates.11Other names may be trademarks of their respectiveowners.243 (192 Type 'help;' or '\h' for help.168Type '\c' to clear the current input statement.11 mysql> exitByeroot@arm:~#</pre>  Edit the <code>/etc/mysql/my.243)cnf</code> file in order to comment out the following lines: 56 data bytes64 bytes from 192<pre class="board-terminal">#bind-address = 127.1680.110.2431#skip-networking</pre>  Restart the server to make the changes take effect:<pre class="board-terminal">root@arm:~# service mysql restart</pre>  Access MySQL server locally and issue the commands shown below: seq<pre class="board-terminal">root@arm:~# mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 37Server version: 5.5.54-0+deb8u1 (Debian) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;Query OK, 0 rows affected (0 ttl=64 time=20.155 ms01 sec)64 bytes mysql> SELECT * from 192information_schema.user_privileges where grantee like "'root'%";+--------------------+---------------+-------------------------+--------------+| GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE |+--------------------+---------------+-------------------------+--------------+| 'root'@'localhost' | def | SELECT | YES || 'root'@'localhost' | def | INSERT | YES || 'root'@'localhost' | def | UPDATE | YES || 'root'@'localhost' | def | DELETE | YES || 'root'@'localhost' | def | CREATE | YES || 'root'@'localhost' | def | DROP | YES || 'root'@'localhost' | def | RELOAD | YES || 'root'@'localhost' | def | SHUTDOWN | YES || 'root'@'localhost' | def | PROCESS | YES || 'root'@'localhost' | def | FILE | YES || 'root'@'localhost' | def | REFERENCES | YES || 'root'@'localhost' | def | INDEX | YES || 'root'@'localhost' | def | ALTER | YES || 'root'@'localhost' | def | SHOW DATABASES | YES || 'root'@'localhost' | def | SUPER | YES || 'root'@'localhost' | def | CREATE TEMPORARY TABLES | YES || 'root'@'localhost' | def | LOCK TABLES | YES || 'root'@'localhost' | def | EXECUTE | YES || 'root'@'localhost' | def | REPLICATION SLAVE | YES || 'root'@'localhost' | def | REPLICATION CLIENT | YES || 'root'@'localhost' | def | CREATE VIEW | YES || 'root'@'localhost' | def | SHOW VIEW | YES || 'root'@'localhost' | def | CREATE ROUTINE | YES || 'root'@'localhost' | def | ALTER ROUTINE | YES || 'root'@'localhost' | def | CREATE USER | YES || 'root'@'localhost' | def | EVENT | YES || 'root'@'localhost' | def | TRIGGER | YES || 'root'@'localhost' | def | CREATE TABLESPACE | YES || 'root'@'arm' | def | SELECT | YES || 'root'@'arm' | def | INSERT | YES || 'root'@'arm' | def | UPDATE | YES || 'root'@'arm' | def | DELETE | YES || 'root'@'arm' | def | CREATE | YES || 'root'@'arm' | def | DROP | YES || 'root'@'arm' | def | RELOAD | YES || 'root'@'arm' | def | SHUTDOWN | YES || 'root'@'arm' | def | PROCESS | YES || 'root'@'arm' | def | FILE | YES || 'root'@'arm' | def | REFERENCES | YES || 'root'@'arm' | def | INDEX | YES || 'root'@'arm' | def | ALTER | YES || 'root'@'arm' | def | SHOW DATABASES | YES || 'root'@'arm' | def | SUPER | YES || 'root'@'arm' | def | CREATE TEMPORARY TABLES | YES || 'root'@'arm' | def | LOCK TABLES | YES || 'root'@'arm' | def | EXECUTE | YES || 'root'@'arm' | def | REPLICATION SLAVE | YES || 'root'@'arm' | def | REPLICATION CLIENT | YES || 'root'@'arm' | def | CREATE VIEW | YES || 'root'@'arm' | def | SHOW VIEW | YES || 'root'@'arm' | def | CREATE ROUTINE | YES || 'root'@'arm' | def | ALTER ROUTINE | YES || 'root'@'arm' | def | CREATE USER | YES || 'root'@'arm' | def | EVENT | YES || 'root'@'arm' | def | TRIGGER | YES || 'root'@'arm' | def | CREATE TABLESPACE | YES || 'root'@'127.0.0.1' | def | SELECT | YES || 'root'@'127.0.0.1' | def | INSERT | YES || 'root'@'127.0.0.1' | def | UPDATE | YES || 'root'@'127.0.0.1' | def | DELETE | YES || 'root'@'127.0.0.1' | def | CREATE | YES || 'root'@'127.0.0.1' | def | DROP | YES || 'root'@'127.0.0.1' | def | RELOAD | YES || 'root'@'127.1680.110.243: seq=1 ttl=64 time=11' | def | SHUTDOWN | YES || 'root'@'127.0.0.253 ms1' | def | PROCESS | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | FILE | YES || 'root'@'127.110.243: seq=2 ttl=64 time=110.259 ms1' | def | REFERENCES | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | INDEX | YES || 'root'@'127.110.243: seq=3 ttl=64 time=30.726 ms1' | def | ALTER | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | SHOW DATABASES | YES || 'root'@'127.110.243: seq=4 ttl=64 time=110.582 ms1' | def | SUPER | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | CREATE TEMPORARY TABLES | YES || 'root'@'127.110.243: seq=5 ttl=64 time=30.138 ms1' | def | LOCK TABLES | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | EXECUTE | YES || 'root'@'127.110.243: seq=6 ttl=64 time=110.221 ms1' | def | REPLICATION SLAVE | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | REPLICATION CLIENT | YES || 'root'@'127.110.243: seq=7 ttl=64 time=110.652 ms1' | def | CREATE VIEW | YES |64 bytes from 192| 'root'@'127.0.1680.111' | def | SHOW VIEW | YES || 'root'@'127.243: seq=8 ttl=64 time=110.0.294 ms1' | def | CREATE ROUTINE | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | ALTER ROUTINE | YES || 'root'@'127.110.243: seq=9 ttl=64 time=110.268 ms1' | def | CREATE USER | YES |64 bytes from 192| 'root'@'127.0.0.1681' | def | EVENT | YES || 'root'@'127.110.243: seq=10 ttl=64 time=110.598 ms1' | def | TRIGGER | YES |64 bytes from 192| 'root'@'127.1680.110.2431' | def | CREATE TABLESPACE | YES || 'root'@'::1' | def | SELECT | YES || 'root'@'::1' | def | INSERT | YES || 'root'@'::1' | def | UPDATE | YES || 'root'@'::1' | def | DELETE | YES || 'root'@'::1' | def | CREATE | YES || 'root'@'::1' | def | DROP | YES || 'root'@'::1' | def | RELOAD | YES || 'root'@'::1' | def | SHUTDOWN | YES || 'root'@'::1' | def | PROCESS | YES || 'root'@'::1' | def | FILE | YES || 'root'@'::1' | def | REFERENCES | YES || 'root'@'::1' | def | INDEX | YES || 'root'@': seq=11 ttl=64 time=11:1' | def | ALTER | YES || 'root'@'::1' | def | SHOW DATABASES | YES || 'root'@'::1' | def | SUPER | YES || 'root'@'::1' | def | CREATE TEMPORARY TABLES | YES || 'root'@'::1' | def | LOCK TABLES | YES || 'root'@'::1' | def | EXECUTE | YES || 'root'@'::1' | def | REPLICATION SLAVE | YES || 'root'@'::1' | def | REPLICATION CLIENT | YES || 'root'@'::1' | def | CREATE VIEW | YES || 'root'@'::1' | def | SHOW VIEW | YES || 'root'@'::1' | def | CREATE ROUTINE | YES || 'root'@'::1' | def | ALTER ROUTINE | YES || 'root'@'::1' | def | CREATE USER | YES || 'root'@'::1' | def | EVENT | YES || 'root'@'::1' | def | TRIGGER | YES || 'root'@'::1' | def | CREATE TABLESPACE | YES || 'root'@'%' | def | SELECT | YES || 'root'@'%' | def | INSERT | YES || 'root'@'%' | def | UPDATE | YES || 'root'@'%' | def | DELETE | YES || 'root'@'%' | def | CREATE | YES || 'root'@'%' | def | DROP | YES || 'root'@'%' | def | RELOAD | YES || 'root'@'%' | def | SHUTDOWN | YES || 'root'@'%' | def | PROCESS | YES || 'root'@'%' | def | FILE | YES || 'root'@'%' | def | REFERENCES | YES || 'root'@'%' | def | INDEX | YES || 'root'@'%' | def | ALTER | YES || 'root'@'%' | def | SHOW DATABASES | YES || 'root'@'%' | def | SUPER | YES || 'root'@'%' | def | CREATE TEMPORARY TABLES | YES || 'root'@'%' | def | LOCK TABLES | YES || 'root'@'%' | def | EXECUTE | YES || 'root'@'%' | def | REPLICATION SLAVE | YES || 'root'@'%' | def | REPLICATION CLIENT | YES || 'root'@'%' | def | CREATE VIEW | YES || 'root'@'%' | def | SHOW VIEW | YES || 'root'@'%' | def | CREATE ROUTINE | YES || 'root'@'%' | def | ALTER ROUTINE | YES || 'root'@'%' | def | CREATE USER | YES || 'root'@'%' | def | EVENT | YES || 'root'@'%' | def | TRIGGER | YES || 'root'@'%' | def | CREATE TABLESPACE | YES |+--------------------+---------------+-------------------------+--------------+140 rows in set (0.02 sec) mysql> FLUSH PRIVILEGES;Query OK, 0 rows affected (0.690 ms00 sec) mysql>^C</pre>  You should be able to access from remote host:<pre class="board-terminal">dvdk@osboxes:~$ mysql -u root -ppassword - h 192.168.110.81 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 37 Server version: 5.243 ping statistics --5.54-0+deb8u1 (Debian) 12 packets transmittedCopyright (c) 2000, 12 packets received2016, 0% packet lossOracle and/or its affiliates. All rights reserved. round-trip minOracle is a registered trademark of Oracle Corporation and/avg/max = 3or its affiliates. Other names may be trademarks of their respective owners.138/10 Type 'help;' or '\h' for help.819/20Type '\c' to clear the current input statement.155 ms mysql>
</pre>
a000298_approval, dave_user
299
edits

Navigation menu