Before ending the chapter, let's review each board in order to verify that our newly created operating systems have whatever we need to proceed further in the book.
BeagleBone Black - USB, networking, and overlays
As soon as we log in to our new system, we see that the prompt looks like this:
root@arm:~#
Maybe, we can customize it a bit by changing the hostname from the generic string arm into a more appropriate bbb (which stands for BeagleBone Black). The commands to do the job are shown here:
root@arm:~# echo bbb > /etc/hostnameroot@arm:~# sed -i -e's/\<arm\>/bbb/g' /etc/hosts
Now, we have to reboot the system using the classic reboot command, and at the next login, we should get a welcome message:
Debian GNU/Linux 8 bbb ttyS0default username:password is [debian:temppwd]bbb login:
After the login, we will get the new prompt:
root@bbb:~#
Then, we will update the distribution repositories and install the aptitude tool as done for the host machine:
OK, now it is time to add a useful feature, that is, the possibility to establish a virtual Ethernet connection between our BeagleBone Black and the host PC over the USB cable connected with BeagleBone Black's USB device port and the host. To do this, we have first to install the udhcpd package using the following command:
root@bbb:~# aptitude install udhcpd
Then, we must add the following lines to the /etc/network/interfaces file:
OK, now, we have to configure the new Ethernet device on the host and then we can try an ssh connection as shown here:
$ ssh root@192.168.7.2
Note
On my host PC, which is Ubuntu based, before executing the ssh command, we had to properly configure the new Ethernet device by adding a new network connection in the entry Edit Connections... in the system settings menu.
The authenticity of host '192.168.7.2 (192.168.7.2)' can't be established.ECDSA key fingerprint is SHA256:Iu23gb49VFKsFs+HMwjza1OzcpzRL/zxFxjFpFEiDsg.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.7.2' (ECDSA) to the list of known hosts.root@192.168.7.2's password:
Now we have to enter the root's password that is root and the trick is done:
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the inpidual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.Last login: Sat Apr 2 18:28:44 2016root@bbb:~#
Tip
We may need to modify the ssh daemon configuration if we cannot successfully log in to our system. In fact, the login by the root user may be disabled for security reasons. To enable the login, we have to modify the /etc/ssh/sshd_config file as follows:
Now, we have to install the overlay system, that is, the mechanism that allow us to load at run time a part of a new device tree binaries and then change our kernel settings to get access to the board's peripherals (this mechanism will be used in the upcoming chapters, and it'll be more clear to you when we'll start using it).
To install the overlay mechanism, we must clone its repository into our BeagleBone Black as follows:
Now, everything should be in place. However, as the last step, we can decide to copy our new system from the microSD card to eMMC in order to boot directly from the on-board eMMC device, thus avoiding pressing the user button each time we power up the board.
To do this, we have to install three new packages (initramfs-tools, dosfstools, and rsync) and then use a script form the Robert C. Nelson archive:
OK, now, we can try to replicate BeagleBone Black's configuration, allowing an ssh connection via the USB device port. However, this time, we'll do more. In fact, we will install two kinds of different virtual connections over the USB cable: an Ethernet and a serial connection.
Note
This configuration can be done on the BeagleBone Black too.
To do this, we need the USB gadget driver named CDC Composite Device (Ethernet and ACM) (see the kernel configuration settings done earlier for the SAMA5D3 Xplained):
The host_addr parameter is needed to allow the host PC to recognize our device and then correctly configure it by forcing a well-known MAC address each time we start the board.
Then, we can reboot the board, and the kernel module should be already present:
In order to avoid conflicts with the BeagleBone Black setting, we used the 192.168.8.X subnetwork for this board instead of 192.168.7.X used for the BeagleBone Black.
Then, we've to restart the networking system as follows:
root@a5d3:~# /etc/init.d/networking restart
Tip
As we did earlier, we may need to enable the root login via ssh by modifying the PermitRootLogin setting in the /etc/ssh/sshd_config file and then restarting the daemon.
Then, we have to install the udhcpd daemon as we did earlier and then replace its current configuration in the /etc/udhcpd.conf file with the following settings:
Then, we must enable it by setting the DHCPD_ENABLED variable to yes in the /etc/default/udhcpd file. Then, restart the daemon:
root@a5d3:~# /etc/init.d/udhcpd restart
Now, regarding the serial connection, we can add the ability to do a serial login by adding a new getty service on it with the following commands:
root@a5d3:~# systemctl enable getty@ttyGS0.serviceCreated symlink from /etc/systemd/system/getty.target.wants/getty@ttyG S0.service to /lib/systemd/system/getty@.service.root@a5d3:~# systemctl start getty@ttyGS0.service
Now, we only need to add the following lines to the /etc/securetty file in order to allow the root user to login using this new communication channel:
# USB gadget
ttyGS0
OK, now, if we take a look at the host PC's kernel messages, we should see something as like this:
usb 1-1: new high-speed USB device number 3 using ehci-pciusb 1-1: New USB device found, idVendor=0525, idProduct=a4aausb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0usb 1-1: Product: CDC Composite Gadgetusb 1-1: Manufacturer: Linux 4.4.6-sama5-armv7-r5 with atmel_usba_udccdc_ether 1-1:1.0 eth0: register 'cdc_ether' at usb-0000:00:0b.0-1, CDC Ethernet Device, 78:a5:04:ca:cb:01cdc_acm 1-1:1.2: ttyACM0: USB ACM device
Then, we can test the networking connection with the ssh command with the following command line on the host PC:
$ ssh root@192.168.8.2The authenticity of host '192.168.8.2 (192.168.8.2)' can't be established.ECDSA key fingerprint is SHA256:OduXLAPIYgNR7Xxh8XbhSum+zOKHBbgv/tnbeDj2O30.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.8.2' (ECDSA) to the list of known hosts.root@192.168.8.2's password:
Now, enter the root's password that is the root string and the job is done:
The programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theinpidual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.Last login: Sat Apr 2 18:02:23 2016root@a5d3:~#
Then, the serial connection can be tested using the minicom command as shown here:
OK, now, we can try to replicate BeagleBone Black's configuration by allowing an ssh connection via the USB device port. So, let's install the udhcpd package using the usual aptitude command:
root@wb:~# aptitude install udhcpd
Then, add the following lines to the /etc/network/interfaces file:
In order to avoid conflicts with the BeagleBone Black and SAMA5D3 Xplained settings, we used the subnetwork 192.168.9.X for this board instead of 192.168.7.X used for the BeagleBone Black or the 192.168.8.X used for the SAMA5D3 Xplained.
Then, restart the networking system as follows:
root@wb:~# /etc/init.d/networking restart
Note
As we did earlier, we may need to enable the root login via ssh by modifying the PermitRootLogin setting in the /etc/ssh/sshd_config file and then restarting the daemon.
Then, we have to install the udhcpd daemon as we did earlier and then replace its current configuration in /etc/udhcpd.conf file with the following settings:
OK, now, we have to configure the new Ethernet device on the host, and then, we can try an ssh connection as shown here:
$ ssh root@192.168.9.2
Tip
On my host PC that is Ubuntu based, before executing the ssh command earlier, we had to properly configure the new Ethernet device by adding a new network connection in the entry Edit Connections... in the system settings menu.
The authenticity of host '192.168.9.2 (192.168.9.2)' can't be established.ECDSA key fingerprint is SHA256:Xp2Bf+YOWL0kDSm00GxXw9CY5wH+ECnPzp0EHp3+GM8.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.9.2' (ECDSA) to the list of known hosts.root@192.168.9.2's password:
Now, enter the root's password that is the root string and the job is done:
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the inpidual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.Last login: Sat Apr 2 17:45:31 2016root@wb:~#
Ok now, as last step, we have to set up the on-board Wi-Fi chip. To do this, we need to download the firmware. Here are the commands:
Then, we have to reboot the system with the usual reboot command. After reboot, if everything works well, we should see a new interface named wlan0 as shown here:
We may need to connect the external antenna in order to correctly detect all wireless networks around. The external antenna connector is labeled as ANT near the Wi-Fi chip.
For the moment, we can stop the Wi-Fi setup here since it will be restarted later in this book in a proper chapter.
Common settings
Before ending this chapter, let me suggest that you install some basic and common tools we're going to use in this book. We can decide to install these tools now or, when needed, later during the reading of the book.
If we decide to perform this last step and then install these tools right now, we have to connect our boards to the Internet using, for example, an Ethernet cable, and then setting a suitable network configuration for it.
Let me remember that if our embedded kit doesn't automatically take a network configuration and we have a DHCP server in our LAN, we can force this behavior using the dhclient command:
# dhclient eth0
If we don't have a running DHCP service, we can manually set up a network configuration using the ifconfig and route commands as shown here: