md
Upgrading U-Boot and Installing Linux on a Headless La Frite (AML-S805X-AC)
December 12, 2019
<-First Taste of La Frite (AML-S805X-AC) from Libre Computer --

The HOWTO: update/flash/re-flash La Frite firmware from another Linux computer on the loverpi forum indicates that the boot loader, U-Boot, can be upgraded relatively easily. In addition, a reader's comment says that it can be done without a monitor. Why not do the same to flash an operating system directly to the eMMC memory module without copying to a USB thumb drive as suggested in another message on the forum: HOWTO: flash image to eMMC from a computer? Here's how I did it.

Table of Contents

  1. Parts List
  2. Open a Serial Connection
  3. Upgrading U-Boot
  4. Flashing an Operating System
  5. Network Manager and Wi-Fi
  6. Now What?

Parts List toc

(*) The power supply is not used during these procedures, but obviously La Frite has to be powered afterwards.

An operating system must be chosen. Select one among the many images offered by the manufacturer. I chose to install the smallest Debian Buster image. Neophytes could opt for Raspbian available on the same site or Armbian, because these distributions have a configuration utility that simplifies many things. This is not a recommendation, I have not tried these images on this board.

The schematic shows how La Frite and the Linux computer will be connected using the two USB cables. Please note that the connections must be done in a specific order depending on whether you want to upgrade U-Boot or flash the operating system. Again, the power supply is not connected to La Frite. The USB ports on the Linux computer provide sufficient current for the procedures.

Open a Serial Connection toc

Instead of connecting an HDMI monitor and USB keyboard to La Frite, a serial connection over USB will be established. The text output usually displayed on a monitor will be visible in a Linux console on the desktop computer and when the console has the focus, the desktop keyboard codes will be transmitted to La Frite. I have found this type of connection quite useful before (Serial Connection with the Orange Pi Zero). This time around, I used minicom instead of screen or kermit.

Using the above figure as a guide, proceed as follows to establish the connection.

  1. Disconnect the power supply and all USB devices from La Frite.
  2. Connect the USB/UART adapter to La Frite and to the computer in the following manner:
    • Connect the UART portion of the adapter to the appropriate pins on the La Frite GPIO connector.
    • Check which USB devices are already connected to the Linux computer:
      michel@hp:~$ ls /dev/ttyUSB* /dev/ttyUSB1
    • Connect the USB connector of the adapter to the desktop computer.
    • Get the name of the new USB device now connected to the Linux computer.
    • Launch a communication software like Minicom, Screen or Kermit by specifying the name of the new device and the baud.
      michel@hp:~$ ls /dev/ttyUSB* /dev/ttyUSB0 /dev/ttyUSB1 michel@hp:~$ minicom -D /dev/ttyUSB0 -b 115200

Of course, the name of the device following the -D switch on the command line must be the name of the new device. Apply power to La Frite and U-boot messages should start appearing in the minicom window. If a valid operating system is on the eMMC module, then it will be possible to perform a login.

Upgrade U-Boot toc

Uploading a new boot loader is done with a Python script found on the Libre Computer GitHub site. To use it, Python 3, PyUSB and wget must be installed on the desktop computer, which is probably the case for Python 3 and wget.

michel@hp:~$ sudo apt install wget python3 python3-usb ...

In the next step, the archive containing the script is downloaded and its content is then extracted.

michel@hp:~$ wget https://github.com/libre-computer-project/pyamlboot/archive/gxl.zip ... 2019-12-11 19:17:56 (1,50 MB/s) - «gxl.zip» enregistré [2031996] michel@hp:~$ unzip gxl.zip Archive: gxl.zip ... inflating: pyamlboot-gxl/socid.py

Here are the steps to upgrade U-Boot.

  1. Disconnect the power supply and all USB devices from La Frite.
  2. Remove the eMMC memory module from the front side of the card. This step is not in the procedure described in the forum message, but it is on the home page of the GitHub site and it was necessary in my case.
  3. Connect the USB/UART adapter as described above: Open a Serial Connection.
  4. Connect one of the male connectors from the USB Type-A to Type-A cable to a USB port on the desktop computer.
  5. Press and hold the U-Boot button down while plugging the other male connector of the cable into La Frite's USB OTG port. It is the one closest to the 40-pin GPIO connector.
  6. Release the push button and verify that La Frite is recognized as a USB device by the desktop computer.
    michel@hp:~$ lsusb ... Bus 003 Device 012: ID 1b8e:c003 Amlogic, Inc. ...
  7. Launch the upload script on the desktop computer.
    michel@hp:~$ cd pyamlboot-gxl michel@hp:~/pyamlboot-gxl$ /flash-firmware.sh aml-s805x-ac --2019-12-10 17:59:15-- http://share.loverpi.com/board/libre-computer-project/libre-computer-board/aml-s805x-ac/firmware/latest.bin ... Running at 0xd9000000... [DONE] Firmware updater push to board. Check board for flashing status.

    Examining everything the script displays, we can guess that it downloads the most recent version of U-Boot, uploads some files from the archive and, finally, it uploads the new version of U-Boot itself towards La Frite. After that, execution is transferred to an uploaded script, flash-firmware.scr which displays the following on the minicom:

    ## Executing script at 08000000 Detecting firmware storage. SF: Detected gd25lq128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB Read new firmware. Reading existing firmware. ... Finished writing new firmware. The board can be safely powered off.
  8. Wait for the last message that can be seen above before disconnecting the USB cables from La Frite.
  9. Replace the eMMC memory module.

This was easy: download an archive, extract its content and execute a Python script. The script is responsible for obtaining the most recent version of U-Boot, so it may not be necessary to download the archive each time U-Boot is upgraded.

An operating system can be flashed directly on the eMMC module in a similar way.

Flashing an Operating System toc

If you know how to flash an operating system to a (micro) SD card for a Raspberry Pi or another single board computer, then you can do the same to directly to the eMMC memory module on La Frite. Here's how.

  1. Connect the USB/UART adapter as described above: Open a Serial Connection.
  2. Connect the USB Type-A to Type-A cable between the Linux computer and La Frite using the OTG port which is the USB port closest to the 40-pin GPIO connector. La Frite turns on when this second USB cable is connected. Many messages from the U-Boot boot loader will scroll by quickly in the communication software window.
  3. Press the Esc key when a message prompts do do so in order to display the U-Boot menu.
    ... USB XHCI 1.00 USB1: scanning bus 0 for devices... 1 USB Device(s) found scanning bus 1 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Press ESC for menu. 0 Interrupt Key: 27 *** U-Boot Boot Menu *** Boot Boot USB Boot PXE Boot DHCP EtherealOS eMMC USB Drive Mode fastboot USB Mode Reboot U-Boot console Press UP/DOWN to move, ENTER to select
  4. Select the eMMC USB Drive Mode option and press the ENTER key.

In practice, U-Boot messages are displayed too quickly. As soon as La Frite starts up, I repeatedly press the escape key repeatedly to interrupt U-Boot before it loads the operating system. This is the equivalent of what one does when trying to access the BIOS of a personal computer that has just started or restarted.

Minicom routes the character ESCwhen the keyboard key is pressed. If other communication software does not do that, a USB keyboard can be connected to the other USB port on La Frite. The boot menu can be obtained by pressing the escape key on that keyboard during the U-Boot startup.

If the U-Boot console prompt " => " is displayed rather than the menu, enter the command bootmenu to view the menu.

Use the keyboard cursor arrows to navigate the menu. Please note, if nothing is done, Boot (the OS) will be executed after 25 seconds of waiting. If eMMC USB Drive Mode is not an option in the menu, a newer version of the boot loader must be installed according to the procedure described above.

When you select eMMC USB Drive Mode in the U-Boot menu, the latter is replaced by the following messages.

mmc@74000: 0 (eMMC) switch to partitions #0, OK mmc0(part 0) is current device Press Control-C to end USB Drive mode. USM: LUN 0, dev 0, hwpart 0, sector 0x0, count 0xe90000

The alternating slashes "\" "/" mimic a rotating icon indicating that nothing is happening on this screen.

We can now check on the Linux computer that the USB connection with La Frite is working.

michel@hp:~$ lsusb ... Bus 003 Device 012: ID 1b8e:c003 Amlogic, Inc. ...

On my Ubuntu system a notification appeared saying that a new drive named SYSTEM had been mounted. It is a partition on the La Frite eMMC memory module which is displayed exactly like an SD card.

michel@hp:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT ... sdh 8:112 1 7,3G 0 disk ├─sdh1 8:113 1 255M 0 part ├─sdh2 8:114 1 6,3G 0 part /media/michel/SYSTEM └─sdh3 8:115 1 800M 0 part

Experts or masochists can use dd to update the operating system, but it's much easier to use balenaEtcher to upload the image to the sdh (or whatever it is named on your system) device. The software identified the correct device as shown below. However, always check that you have the right target or you risk erasing the contents of one of the hard drives of the desktop computer. Etcher may be a bit safer in this regard than dd nicknamed disk destroyer, but do not count on that.

After two or three minutes, the image will have been flashed and verified. You should disconnect the USB OTG cable between La Frite and the Linux computer before connecting La Frite to its power supply.

If the USB-UART cable, both the U-Boot and then operating system startup messages will be displayed in the minicom window. In the end it will be possible to proceed with user login. It may be necessary to press the Enter key once or twice for the login prompt fails to appear.

The SSH server is started automatically in the uploaded version of Debian. So you can also open an SSH session from the Linux computer as long as La Frite is connected with an Ethernet connection to the local network.

The initial user name and password have not changed since July.

  1. user: libre
  2. password: computer

Network Manager and Wi-Fi toc

This section does not really belong here because it is about one specific distribution: Debian Buster. Other distributions will probably handle network interfaces differently.

As before, I installed Network Manager to support Wi-Fi. The previous instructions still apply with one exception; Network Manager could not activate the Wi-Fi connection.

I found the following error messages:

libre@la-frite:~$ dmeg ... [ 1526.489248] wlx08107746b1c3: authenticate with 00:fc:8d:4f:71:b8 [ 1526.504005] wlx08107746b1c3: send auth to 00:fc:8d:4f:71:b8 (try 1/3) [ 1526.507090] wlx08107746b1c3: authenticated [ 1531.510272] wlx08107746b1c3: aborting authentication with 00:fc:8d:4f:71:b8 by local choice (Reason: 3=DEAUTH_LEAVING) ...

It did not take long to find an explanation on the web. It has to do with the length of the "predictable name" assigned to the interface. While the reasoning behind this naming scheme is perfectly valid, but I did not want to tackle the task of defining a shorter predictable name even if it doesn't seem too difficult. It was more fun to suspend the scheme altogether by adding a kernel boot parameter: net.ifnames=0.

libre@la-frite:~$ sudo nano /etc/default/grub
... GRUB_CMDLINE_LINUX_DEFAULT="noquiet net.ifnames=0" ...

The Network Manager configuration file must be modified if it is to manage the Ethernet interface and not just the wireless interface.

libre@la-frite:~$ sudo nano /etc/NetworkManager/NetworkManager.conf

Change the value of managed from false to true.

[main] plugins=ifupdown,keyfile [ifupdown] managed=true

Source: netmui does not handle eth0 because it is defined in /etc/network/interfaces.

The problems with static IP addresses mentioned in the previous post did not appear. Is it because Network Manager is now handling both interfaces, or is it because improvements in the OS by Libre Computer?

Some USB Wi-Fi adapters did not work on a Raspberry Pi under Raspbian Buster Lite. They use the RTL8188EUS and RTL8188ETV chips from Realtek. There were no difficulties with the RTL8188CUS chip. Despite the following not very promising message

libre@la-frite:~$ dmesg | grep r8188 [ 6.305338] r8188eu: module is from the staging directory, the quality is unknown, you have been warned. [ 6.409206] usbcore: registered new interface driver r8188eu

all Wi-Fi dongles based on these three chips seemed to work correctly on La Frite with Debian Buster. There was no need to add drivers or do anything at all. Note that each time Wi-Fi adapter is changed, Wi-Fi needs to be activated again with Network Manager. Further checks on the performance of the r8188eu driver with the three chips will be done later.

Now What? toc

The documentation is slowly improving. We now have a description of the 40-pin GPIO connector.

Source: https://forum.loverpi.com/discussion/792/developer-guide-for-aml-s805x-ac-la-frite
Is it accurate? There is no Bluetooth on this device.

Obviously, the amount of information found about this relatively new board is in no way comparable to what can be found on the Web about the various Raspberry Pi. That said, it is nice to see that the manufacturer continues development and does not rely on the Armbian project as other companies seem to do. As I become more familiar with La Frite; I appreciate it more and more. I found it very encouraging that my Python script using the onboard IR receiver that is currently running on the Orange Pi Zero works with a single adjustment. I will continue to install software on La Frite and I anticipate using it instead of the Orange Pi Zero in my home automation system soon to better assess it as a working computer.

<-First Taste of La Frite (AML-S805X-AC) from Libre Computer --