~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A post off jj_0 on the Thec64community forum : https://thec64community.online/thread/1490/thea500-fel-mode-rescue-boot
This tool allows you to boot THEA500 Mini in so-called ‘FEL’ mode and will provide a command-line shell on the internal UART serial port, on a USB OTG virtual serial port and on a USB2Serial adapter serial port. Most common USB2Serial adapters are supported.
The required files can be found in this A500-FEL-rescue-boot-v3.7z file. If you extract the contents of the file to a directory on your PC you will have the following folders:
- boot: This contains the required uboot, kernel, dtb etc files
- linux: sunxi-fel tool for linux (x86_64) and boot.sh to upload the kernel etc to the Maxi. If the tools don’t work you might need to install them yourself (apt-get install sunxi-tools) or compile them from source.
- windows: sunxi-fel tool Windows (64-bit) and boot.sh to upload the kernel etc to the Maxi.
The main reason for publishing this is so you can:
- Make a backup of the entire nand chip (including the part ‘before’ nanda and nandb that includes the uboot bootloader)
- Make backups of nanda and nandb and restore them from your PC with your favourite disk imaging tool
- Execute Linux commands on the Maxi, explore stuff, change things etc.
- Explore the nandb root filesystem from your PC if your OS supports the ext4 filesystem.
This is easy in Linux, for Windows you need to search for an ext4 driver, Ext2Fsd has been reported to work or maybe use the ‘Windows Subsystem for Linux’ v1 or v2.
USE THIS AT YOUR OWN RISK:
- I’ve tested in on my THEA500 Mini without issues but your results might vary
- Take care to ensure your THEA500 Mini has enough power, preferably don’t just run it from your PC’s USB port but power it via its USB-C power connector
To run the FEL-mode resuce boot:
- Extract the zipfile to a directory on your PC
- Connect THEA500 Mini from the USB A port next to the HDMI connector to a USB (also A) port on your PC
- Switch on the THEA500 and verify that it works and receives enough power from your PC and via the USB-C power port
- Power it off again and make it boot in FEL mode by opening up your THEA500, keeping the FEL-mode button pressed and the powering THEA500 on. The FEL-mode button is the tiny button on the top right hand side of THEA500 PCB in the picture below:
Once you’ve done one of these your PC should have a new USB device (1f3a:efe8, on my Ubuntu PC it’s called an ‘1f3a:efe8 Allwinner Technology sunxi SoC OTG connector in FEL/flashing mode).
Next:
- If you’re using Linux, cd to the linux folder and run ./boot.sh
- If you’re using Windows 7 or 10 (64 bit) cd to the windows folder and run boot.cmd. You might need to install a USB driver. But if you have hackchi2 installed the USB driver might already be installed. It might call your THEA500 differently though, e.g. SNES.
If all works well you will see that the various files are being uploaded, this takes about a minute:
USB device 001:012 Allwinner H6 82c00007:8c004708:01421d58:206f20d1
found DT name in SPL header: sun50i-h6-orangepi-3
Stack pointers: sp_irq=0x00022000, sp=0x00025E08
MMU is not enabled by BROM
=> Executing the SPL... done.
loading image "ARM Trusted Firmware" (41073 bytes) to 0x104000
loading image "SCP firmware" (1024 bytes) to 0x114000
loading image "U-Boot (64-bit)" (671216 bytes) to 0x4a000000
loading DTB "sun50i-h6-orangepi-3" (32960 bytes)
100% [================================================] 15440 kB, 256.0 kB/s
100% [================================================] 254 kB, 255.9 kB/s
100% [================================================] 0 kB, 155.0 kB/s
Passing boot info via sunxi SPL: script address = 0x43100000, uEnv length = 240
Starting U-Boot (0x00104000).
Store entry point 0x00104000 to RVBAR 0x09010040, and request warm reset with RMR mode 3... done.
- Once finished you will be able to access a command-line shell on the UART, USB2Serial converter (if you have connected one to THEA500 of course) and on the OTG virtual serial port – your PC should have a new (virtual) serial port. On Linux this will be /dev/ttyACM0, on Windows a COMx port. On THEA500 itself it is /dev/ttyGS0. Note you might need to install the USB CDC driver if you’re not on Windows 10. You can connect to this serial port with e.g. screen or tio in Linux, or Putty in Windows with parameters 115200,N,8,1. Once you connect you can start using the shell straight away without having to log in.
To quit the OTG mode you can just switch off THEA500.
To backup the entire nand (assuming you have a USB drive mounted at /mnt), first check if the nand chip is the one that is expected:
/ # cd /mnt
/mnt # h6-nand_rw 50 2176 read_id
Raw ID data: 0x98 0xDA 0x90 0x15 0x76
If your Raw ID data is different then let me know in this thread.
Then, to back it up:
/mnt # h6-nand_rw 50 2176 read_full 0 131072 THEA500-50-2176-0-131072-nand-full.bin
This will go on for quite some time, the page n° will go up from 0 to 131071.
Raw ID data: 0x98 0xDA 0x90 0x15 0x76
if this ID is incorrect, press Ctrl-C NOW to abort (3s timeout)
Start reading...
Reading page n° 131071 in block n° 2047 (page 131072 of 131072), 100%
Reading done in 2619.266357 seconds
Note: I do not recommend writing this back to the nand, I’m not sure if this will result in a working THEA500 or not.
To backup nanda and nandb you first have to load the nand driver:
/ # insmod /lib/modules/3.10.65/nand.ko
After it is loaded do not try to back up the entire nand anymore in this session as the direct access by h6_nand_rw will confuse the nand driver.
Then to do the nanda/nandb backup:
/ # cd /mnt
/ # dd of=nanda if=/dev/nanda
/ # dd of=nandb if=/dev/nandb
/ # sync
Writing back e.g. nandb:/ # cd /mnt
/ # dd if=nandb of=/dev/nandb
To run this from an Ubuntu Live USB disk (to prevent possible Windows issues) do something like:
- Boot from the Ubuntu Live USB Disk, and set up networking
- Insert an USB stick that contains the C64/VIC-20 fel mode stuff.
- Start a terminal with CTRL-AT-T
In the terminal type:sudo su
Start another terminal with CTRL-ALT-T, and type:
snap install tio --classic
tio /dev/ttyUSB0 # This only if you have a serial2usb adapter connected to the Maxi's UARTsudo su
tio /dev/ttyACM0 - Start another terminal with CTRL-ALT-T, and type:
sudo su
cd <wherever the FEL mode stuff is>
cd linux
# Manual check whether FEL-mode is activated:
sunxi-fel -l
# If you get something like: USB device 001:012 Allwinner H6 82c00007:8c004708:01421d58:206f20d1 or similar your THEA500 is in FEL mode
./boot.sh
Now it should load the FEL-mod uboot and kernel into THEA500
Switch to the terminal window where you started ‘tio /dev/ttyACM0’ and you should get a command line terminal there.
Enjoy and please let me know how it works for you.