You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
9.5 KiB

  1. # Readme
  2. This repository is developed to cover the embedded systems lecture at summer school in Jade University.
  3. ## Issues to solve
  4. - [ ] TODO which version of beagles to buy
  5. - [ ] I prefer to use the beaglebone black wi-fi, if it is possible to connect them to Jade's internet
  6. - [ ] Otherwise the ethernet version is preferred to use with usb-internet sharing
  7. - [ ] Install in computer the PuTTY software and some bash option to use.
  8. - [ ] TODO Adding to day 1: https://linuxpropaganda.wordpress.com/2018/06/26/create-new-user-in-ubuntu-on-beaglebone-black/
  9. # day-1: Introduction to IoT systems and single-board computers (SBC)
  10. ## Accessing to SBCs by USB
  11. To connect into the SBC, attach the USB cable into the PC. Then, open the terminal and type:
  12. ```
  13. $ ip addr
  14. ...
  15. ...
  16. en10: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  17. ether f4:5e:ab:50:44:89
  18. inet6 fe80::10a6:8287:252f:1a43/64 secured scopeid 0x16
  19. inet 192.168.6.1/24 brd 192.168.6.255 en10
  20. ...
  21. ```
  22. you will obtain a lot of `enX` or `awdlx` devices, try to search for the new detected devices and specially the one with the ip 192.168.6.1 or 192.168.7.1 that belongs to the BeagleBone devices, and XXX for the Raspberry Pi.
  23. Then, use the `SSH` protocol, from now ssh, to access the board computer (please change the ip address by your ip device)
  24. ```
  25. $ ssh debian@192.168.6.2
  26. Debian GNU/Linux 10
  27. BeagleBoard.org Debian Buster IoT Image 2022-07-01
  28. Support: https://bbb.io/debian
  29. default username:password is [debian:temppwd]
  30. The programs included with the Debian GNU/Linux system are free software;
  31. the exact distribution terms for each program are described in the
  32. individual files in /usr/share/doc/*/copyright.
  33. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
  34. permitted by applicable law.
  35. Last login: Thu Jul 7 07:08:40 2022 from 2806:2f0:5040:8572:7d51:e754:675:cd2a
  36. ```
  37. ## Accessing the RPi4 by ssh
  38. The SBCs can be accessed by ssh protocol if it is enable (disable by default at raspberry). Thus, we only need to know the SBC's ip or hostname. By default the raspberry Pi 4 is `raspberry`, but username and password is defined by the user ([raspberry Pi imager](link)). Then, to make `ssh` use:
  39. ```
  40. $ ssh username@hostname.local
  41. ```
  42. or
  43. ```
  44. $ ssh username@ip
  45. ```
  46. ## Error connection
  47. When getting the error:
  48. ```
  49. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  50. @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
  51. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  52. The ECDSA host key for beaglebone.local has changed,
  53. and the key for the corresponding IP address 2806:103e:5:50f4:3ad2:69ff:fef9:46b4
  54. ```
  55. you have to edit the '.ssh/known_hosts' file, and delete the lien that contains the offending key and the corresponding IP address given the warning.
  56. ## Basic configuration
  57. ### Updating the system and installing VIM
  58. Before any further change, please update the system and packages by:
  59. ```
  60. $ sudo apt update
  61. [sudo] password for debian:
  62. Hit:1 http://deb.debian.org/debian buster InRelease
  63. Hit:2 http://deb.debian.org/debian buster-updates InRelease
  64. Hit:3 http://security.debian.org/debian-security buster/updates InRelease
  65. Hit:4 http://repos.rcn-ee.com/debian buster InRelease
  66. Reading package lists... Done
  67. Building dependency tree
  68. Reading state information... Done
  69. 17 packages can be upgraded. Run 'apt list --upgradable' to see them.
  70. $ sudo apt list --upgradable
  71. Listing... Done
  72. bb-customizations/unknown 1.20220705.6-0~buster+20220705 all [upgradable from: 1.20220513.0-0~buster+20220513]
  73. bbb.io-kernel-4.19-ti/unknown 1.20220705.0-0~buster+20220705 all [upgradable from: 1.20220628.0-0~buster+20220628]
  74. bbb.io-kernel-tasks/unknown 1.20220705.0-0~buster+20220705 all [upgradable from: 1.20220628.0-0~buster+20220628]
  75. dirmngr/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  76. gnupg-l10n/oldstable 2.2.12-1+deb10u2 all [upgradable from: 2.2.12-1+deb10u1]
  77. gnupg-utils/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  78. gnupg/oldstable 2.2.12-1+deb10u2 all [upgradable from: 2.2.12-1+deb10u1]
  79. gpg-agent/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  80. gpg-wks-client/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  81. gpg-wks-server/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  82. gpg/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  83. gpgconf/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  84. gpgsm/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  85. gpgv/oldstable 2.2.12-1+deb10u2 armhf [upgradable from: 2.2.12-1+deb10u1]
  86. libcpupower1/oldstable 4.19.249-2 armhf [upgradable from: 4.19.235-1]
  87. linux-cpupower/oldstable 4.19.249-2 armhf [upgradable from: 4.19.235-1]
  88. linux-libc-dev/oldstable 4.19.249-2 armhf [upgradable from: 4.19.235-1]
  89. ```
  90. and then, make the upgrade of all required packages
  91. ```
  92. $ sudo apt upgrade
  93. Reading package lists... Done
  94. Building dependency tree
  95. Reading state information... Done
  96. Calculating upgrade... Done
  97. The following packages will be upgraded:
  98. bb-customizations bbb.io-kernel-4.19-ti bbb.io-kernel-tasks dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent
  99. gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv libcpupower1 linux-cpupower linux-libc-dev
  100. 17 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  101. Need to get 9908 kB of archives.
  102. After this operation, 69.6 kB of additional disk space will be used.
  103. Do you want to continue? [Y/n] Y
  104. ...
  105. ...
  106. ...
  107. ```
  108. now we can start to install updated packages, lets try to install the `VIM` package to use as our main source and text editor:
  109. ```
  110. $ sudo apt install vim
  111. Reading package lists... Done
  112. Building dependency tree... Done
  113. Reading state information... Done
  114. The following additional packages will be installed:
  115. libgpm2 vim-runtime
  116. Suggested packages:
  117. gpm ctags vim-doc vim-scripts
  118. The following NEW packages will be installed:
  119. libgpm2 vim vim-runtime
  120. 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
  121. Need to get 7650 kB of archives.
  122. After this operation, 36.4 MB of additional disk space will be used.
  123. Do you want to continue? [Y/n] y
  124. Get:1 http://deb.debian.org/debian bullseye/main arm64 libgpm2 arm64 1.20.7-8 [35.9 kB]
  125. Get:2 http://deb.debian.org/debian bullseye/main arm64 vim-runtime all 2:8.2.2434-3+deb11u1 [6226 kB]
  126. Get:3 http://deb.debian.org/debian bullseye/main arm64 vim arm64 2:8.2.2434-3+deb11u1 [1388 kB]
  127. Fetched 7650 kB in 0s (17.0 MB/s)
  128. perl: warning: Setting locale failed.
  129. perl: warning: Please check that your locale settings:
  130. LANGUAGE = (unset),
  131. LC_ALL = (unset),
  132. LC_CTYPE = "UTF-8",
  133. LANG = "en_GB.UTF-8"
  134. are supported and installed on your system.
  135. perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
  136. .
  137. .
  138. .
  139. ```
  140. ### Changing the bb's or rpi4's hostname
  141. First edit the `/etc/hostname` file by:
  142. ```
  143. $ sudo vim /etc/hostname
  144. ```
  145. change the first and only line in this file to reflect your new hostname.
  146. Then, edit the `/etc/hosts` file:
  147. ```
  148. 127.0.0.1 localhost
  149. 127.0.1.1 hostname.localdomain hostname
  150. # The following lines are desirable for IPv6 capable hosts
  151. ::1 localhost ip6-localhost ip6-loopback
  152. ff02::1 ip6-allnodes
  153. ff02::2 ip6-allrouters
  154. ```
  155. change the second line in both `hostname` (127.0.1.1) instances for your new hostanme (must be the same previously defined).
  156. Finally, reboot your beagle or raspberry device.
  157. ### Changing the user's password
  158. To change the default user's password use:
  159. ```
  160. $ passwd
  161. Changing password for debian.
  162. Current password: temppwd
  163. New password: xxxxxxx
  164. ...
  165. ```
  166. ### Time and internet access
  167. We previously have checked the internet access to our SBC-devices, now, let us use the internet to sync our time zone and locales for the further sync of commits in the git system. Thus, let us check the time at the device by:
  168. ```
  169. $ systemctl status time-sync.target
  170. time-sync.target - System Time Synchronized
  171. Loaded: loaded (/lib/systemd/system/time-sync.target; static; vendor preset: enabled)
  172. Active: active since Wed 2022-07-06 22:06:43 CDT; 14min ago
  173. Docs: man:systemd.special(7)
  174. ```
  175. if time is wrong use the next command and follow the instructions:
  176. ```
  177. $ sudo dpkg-reconfigure tzdata
  178. ```
  179. the, the system will have the correct time now.
  180. If locale settings fail use:
  181. ```
  182. $ sudo dpkg-reconfigure locales
  183. ```
  184. and choose your desired locales, it is recommended to use international english with UTF-8 compatibility.
  185. ### Oh My Bash
  186. Next, to make easier work with the bash system let us install the oh-my-bash tool:
  187. ```
  188. $ bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
  189. ```
  190. you can go deeper and customize the themes and plugins at [oh-my-bash](https://ohmybash.nntoan.com/)
  191. ## SSH Key pairs
  192. To create key pairs use:
  193. ```
  194. $ ssh-keygen -t ed25519 -C "your_email@example.com"
  195. ...
  196. ...
  197. ...
  198. ```
  199. then copy the `*.pub` file generated:
  200. ```
  201. $ ssh-copy-id -i ~/.ssh/id_ed25519.pub debian@bbb-marx.local
  202. /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/gmarx/.ssh/id_ed25519.pub"
  203. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
  204. /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
  205. Debian GNU/Linux 10
  206. BeagleBoard.org Debian Buster IoT Image 2022-07-01
  207. Support: https://bbb.io/debian
  208. default username:password is [debian:temppwd]
  209. debian@bbb-marx.local's password:
  210. Number of key(s) added: 1
  211. Now try logging into the machine, with: "ssh 'debian@bbb-marx.local'"
  212. and check to make sure that only the key(s) you wanted were added.
  213. ```