Reflash v1.1.0

From iagent
Jump to: navigation, search

Reflash header.png

Reflash is a Linux image for downloading and installing Rebuild and Refactor images on Recore. You can also create an image from the contents of the eMMC.

The latest image is: Reflash v1.1.0

For the previous release, see Reflash v1.0.1.

Note on v1.1.0

v1.1.0 is a maintenance release: the instructions below are unchanged from v1.0.1, and a USB drive written with v1.0.x can simply be rewritten with the new image. The changes are in what happens once the board is running - the screen, the WiFi setup, the USB console and the error reporting. See What is new in v1.1.0.

The kernel has moved from 5.15 to 6.18.33, the same kernel Rebuild ships. Reflash and Rebuild previously ran different kernel versions from different Armbian branches, which meant a kernel fix landed in one image but not the other.

Entering FEL mode

The first time you use Reflash 1.0.0 and above, you need to boot to Reflash using FEL-mode. Hold the FEL button on the board down and press the RST (reset) button. You need to have a USB C cable connected between the USB C connector on Recore and a host computer.

You should see the board show up as a USB device:

lsusb

Download the Recore git repository. On the command line write:

wget https://github.com/intelligent-agent/Recore/raw/master/binaries/Recore-fel.zip
unzip Recore-fel.zip

Install the sunxi-tools package on the host computer:

sudo apt install sunxi-tools

Now you can run the whole command on a shell.

sudo sunxi-fel -v -p spl fel/sunxi-spl.bin write 0x44000 fel/bl31.bin write 0x4a000000 fel/u-boot.bin reset64 0x44000

On the host computer, you should see the binary files being uploaded like the following:

  1. Open Device Manager and check that the device shows up. It might not have a known vendor and product description.
  2. Download the Recore repository and extract the contents.
  3. Download sunxi-fel binary for windows and extract the contents so it is the the Recore-master folder.
  4. Download and install Zadig https://linux-sunxi.org/FEL/USBBoot#Using_sunxi-fel_on_Windows
  5. Open the CMD prompt and navigate to the extracted Recore folder.
  6. Insert the USB drive with Reflash (See instructions further down)
  7. Run the following command from the Recore folder:
(prefix) sunxi-fel.exe -v -p spl binaries\new\sunxi-spl.bin write 0x44000 binaries\new\bl31.bin write 0x4a000000 binaries\new\u-boot.bin reset64 0x44000

After running that command, you should see the SPL and u-boot being transferred and the board should start to boot from the USB drive.

Instructions

This page has step-by-step instructions for using the image. Here is what you should do:

  1. Use Balena Etcher to download and flash the Reflash image. Here is the URL to the image:
    https://github.com/intelligent-agent/Reflash/releases/download/v1.1.0/reflash-v1.1.0.img.xz

    You can also download it from here: https://github.com/intelligent-agent/Reflash/releases/tag/v1.1.0

  2. After flashing the image to a USB drive with at least 4 GB of storage, eject the USB drive properly and insert it in a USB port on the Recore board.
  3. If you want to get back to Reflash from Rebuild or Refactor, you can do so by having the USB drive inserted during boot. A reboot can be done from Mainsail, Fluidd or OctoPrint.
  4. Once the board has booted from USB, you should be able to access the web interface using the address http://recore.local
  5. From the web interface, choose which version of Refactor/Rebuild you want to download. There are two types of images, either with OctoPrint as the web interface, with Mainsail or with Fluidd. You can also choose to upload a custom image using the "Upload file" option.
  6. Once the image has been downloaded (to the USB drive) you can install/flash the image to the eMMC. This will take 3-4 minutes.
  7. Once the image has been flashed on the eMMC drive, you can reboot the board, and it will boot using the image that you chose.

You can keep the Reflash USB drive in a safe place and reuse it the next time you want to upgrade the software. If you want to upgrade to a later version of Rebuild, the same image can be used again.

A note on USB drives

The USB drive matters more than it looks like it should. Reflash runs entirely from it, downloads the image onto it and reads the image back off it while flashing, so a slow or worn drive shows up as a slow first boot and a slow upload - the difference between a good and a bad drive has been measured at 22 seconds against nearly four minutes to reach the web interface. If Reflash is unusually slow, try a different drive before looking for anything else.

What is new in v1.1.0

The screen

  • Reflash now draws its own status screen on the attached panel: the version, what it is doing, and a progress bar, ending in "Flash complete, remove USB drive". Previously the panel showed the boot console.
  • A splash is shown from the boot partition while U-Boot runs, and U-Boot no longer prints over it.
  • The panel is handed to simpledrm by the shipped DTB, so the screen comes up the same way it does in Rebuild.
  • Removing the USB drive is acknowledged on the panel instead of being silently ignored.

WiFi

  • WiFi is managed by iwd, and whether a dongle is present is decided from sysfs rather than from iwd's transient view - a failed status request no longer claims the dongle was removed.
  • The info panel shows how the board is connected and how strong the signal is. A wired link is preferred over WiFi, so the two interfaces cannot confuse each other.
  • Setting WiFi up on a board that then fails to connect no longer leaves the board unreachable, and every WiFi request has a timeout so a slow scan cannot freeze the dialog.
  • The passphrase is kept out of the log and is no longer served back to the browser.
  • A board with no WiFi adapter at all now skips WiFi gracefully instead of erroring.

USB console and the control protocol

  • The USB gadget exposes two ACM functions. /dev/ttyACM0 on the host is a login prompt (user debian, password temppwd), and /dev/ttyACM1 is a line-based control protocol for listing, starting and polling a flash without the web UI.
  • This matters on a board with no network - a failed WiFi setup used to leave the UART header inside the case as the only console.
  • The same protocol is available on the board itself through reflash-ctl.

Flashing and uploads

  • An image that fails its integrity check can no longer be installed.
  • A large upload is sent as raw binary with client-side retry, and the destination file is held open across chunks, which fixed uploads timing out part way through.
  • Closing the browser tab cancels the upload instead of leaving the server waiting.
  • Transfer throughput is charted in a popup on the progress bar, with peak and average.
  • If the eMMC stops responding during the final cleanup, Reflash now says so and asks for a power cycle, rather than sitting at 100% forever.
  • A failed image load no longer results in the board booting anyway.

Board information

  • Board metrics - temperature, DRAM rail, throughput - are plotted behind a button in the Info dropdown.
  • The over-temperature warning now triggers at the temperature the SoC actually throttles at.
  • If the board revision cannot be read, Reflash says so loudly and keeps the log, instead of guessing.
  • Each board gets its own persistent SSH host key, and identifies itself to DHCP by MAC address, so two boards cannot end up sharing one lease.

A5 and A6 boards

  • The DRAM rail is raised at boot and DRAM frequency scaling is disabled on A5 and A6, from the same universal image - no separate build for older boards.

Reflash image

Reflash is an initRamFS Linux image. That is in order to completely remove the boot medium before a reboot occurs. Because of that, Reflash needs to be very small. The application is built in Go which makes it stand alone with very little dependencies. The network management is handled by systemd-networkd and systemd-resolved, and WiFi by iwd. Very few extra programs are installed, and any additional programs that get installed will be lost after a reboot.

The root filesystem is Debian trixie, built with debootstrap --variant=minbase. The kernel is 6.18.33, the same one Rebuild ships.

SSH is enabled for user debian with password temppwd. The same password is set for root.

Known issues

Flash progress not showing any progress

Sometimes the flashing process does not work as expected. There is no progress on the progress indicator and the flashing never completes. A workaround is to go back to step 1 and install Reflash again.

A USB drive that is not detected

On some boards the USB drive is not enumerated at boot. Reflash waits for the drive and counts the wait on screen, and names a drive that never appears as broken. If it never appears, power the board off completely - a reset is not always enough - and try again, or try a different drive. This is tracked as Reflash issue #88.

Contributing

Bug reports and pull requests are welcome at Reflash on GitHub. If you use an AI assistant to write the patch, see AI-assisted contributions.