~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A post off jj_0 on the thec64community forum https://thec64community.online/thread/708/the64-maxi-mode-rescue-boot
Update v12: Switched to fes1 initialisation and u-boot.fex (2011.09) to fix issues with FEL-mode via hardware button – apparently modern u-boot spl initialisation is missing something. Tested on my Maxi and on Orange Pi PC both with ‘hardware button’ FEL-mode and ‘Press 2 on UART at boot’ FEL-mode and it works (for me anyway) in both modes.
Update v11: Changed from a ‘recent’ u-boot (2017) to (almost) the same one as the Maxi uses for it’s normal boot. This is version 2011.09 which I’ve compiled from a nanopi m1 SDK. This 2011.09 u-boot allows the kernel to boot without any af the previous crashes and also enables the normal USB ports. So you are now able to mount USB drives and copy stuff to/from it. Note, this changes some of the output of the boot.sh / boot.cmd compared to what is shown below, but not significantly so. I will update the post when some more people have tested this. Also, there is no longer output on the HDMI TV screen.
Update v10: Changed the u-boot for one that also displays on the TV screen. So now you can at least see whether u-boot loads OK and whether it boots the kernel. Once it starts the kernel you’ll see lot’s of colourful changing garbage on the screen – if you don’t then something is wrong. I’ve also removed the earlyprintk console as it looks like the kernel hangs at the early console phase.
Update v9: I tested this in a Windows 10 virtual machine now as well. Just like in Linux it works (for me) though it occasionally hangs while booting. So you might have to try a couple of times. Also combining this with an USB2Serial converter connecte to the UART is still my advice as you can see what’s happening from boot time.
Update: @spannernick tested this on Windows 10 and it doesn’t work on Windows. So for now this is restricted to Linux. If you don’t have Linux you can try to boot from e.g. an Ubuntu Live USB image. In the meantime I will look into the Windows issue.
Following on from the C64 Maxi and VIC-20 OTG access the attached file makes this possible via FEL booting as well. When you use this you will be able to access the command line of the Maxi/VIC-20 (henceforth both referred to as Maxi) via a virtual serial port (and also still via the UART) and nanda and nandb will be shared via USB as Mass Storage devices.
The required files can be found in this C64Maxi-VIC-20-FEL-rescue-boot-v12.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 kernel, script.bin 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 sunxi-tools) or compile them from source.
- windows: sunxi-fel tool + dll’s for Windows (64-bit) and boot.sh to upload the kernel etc to the Maxi. If the tools don’t work then googling is your best friend, I don’t know too much about compiling this on Windows.
The main reason for publishing this is so you can:
- Make backups of nanda and nandb and restore them from your PC with your favourite disk imaging tool. For example ‘dd’ from the command line or the Disks utility from the GUI on Linux, or W32 Disk Imager on Windows.
- 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 Maxi and my VIC-20 without issues but your results might vary.
- Take care to ensure your Maxi has enough power, don’t just run it from your PC’s USB port as then it might have enough power to boot and present the nanda/nadb Mass Storage devices and the virtual serial port but it might not have enough power for actual consistend and dependable reading and writing to nanda/nandb. I’ve had different results imaging the nanda/nandb with different power deliveries to the Maxi, the only consistent one was when I ensured I had enough power by using a powered USB hub in addition to the power from my laptops USB3 port. But instead of a powered HUB powering the Maxi via the included USB power supply might be enough as well. When in doubt use a USB power supply with more rated Watts
- Ensure that the first thing you do is to make a backup of your nanda and nandb. With a disk imaging tool you can do this directly from the Mass Storage devices on your PC. But you can also do this from the command line (on the virtual serial port) to a USB drive (that you know works on the Maxi, so MBR + FAT32 formatted) inserted in the Maxi:
mount /dev/sda1 /mnt
The last command (md5sum) should output the same number for both /dev/nandb and nandb
cd /mnt
dd of=nandb if=/dev/nandb
sync
md5sum /dev/nandb nandb - Writing back nanda (this should almost never be needed) or nandb can be done with a disk imaging tool as well, or:
mount /dev/sda1 /mnt
The last command (md5sum) should again output the same number for both /dev/nandb and nandb
cd /mnt
dd if=nandb of=/dev/nandb
sync
md5sum /dev/nandb nandb
To run the FEL-mode resuce boot:
- Extract the zipfile to a directory on your PC
- Connect the Maxi from it’s back USB A port (normal size, not the micro USB port you usually power it from) to a USB (also A) port on your PC
- Switch on the Maxi and verify that it works and receives enough power from your PC and other PSU’s
- Power it off again and make it boot in FEL mode, either by:
- From an UART connection keep 2 pressed and then powering it on
- Opening up your Maxi, keeping the FEL-mode button pressed and the powering the Maxi on. The FEL-mode button is the tiny button on the other side of the PCB from the unoccupied white connector:
The easiest way to do this is with a powered hub with individual on/off switched per port, as then you can keep the FEL button pressed and then switch on power to the USB port on the HUB that it is connected to.
You can of course also keep the FEL button pressed, then add power to the Maxi either from USB first and then add the PSU or from the PSU first and then add the USB. You can even start with powering on the Maxi normally, then shut it down with its power button, then press the FEL button and the power button again and then connect the USB to your PC.
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 ‘Onda (unverified) V972 tablet in 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 Maxi differently though, e.g. SNES.
If all works well you will see that the kernel etc files are being uploaded:
USB device 001:062 Allwinner H3 02c00081:25c04620:78a28014:542c0793
100% [================================================] 13 kB, 184.4 kB/s
100% [================================================] 934 kB, 259.6 kB/s
100% [================================================] 15626 kB, 260.1 kB/s
- After quite a bit of time (~30-60 seconds) your PC should announce two new Mass Storage devices. One will be 17MB which is nanda and one will be ~197MB which is nandb. For example, this is what I see using the Disks utility in Linux (ignore the 2.0TB disk and the 64GB Drive):
nanda, this is not a filesystem but an Android bootimage so it’s shown as ‘Unknown’:
nandb, this contains an ext4 filesystem. Note that nandb is 197MB but in fact the actual size of the ext4 partition is only 69MB. The rest is probably left empty in case of errors on the nand.
- Your PC should also have a new (virtual) serial port. On Linux this will be /dev/ttyACM0, on Windows a COMx port. On the Maxi 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 will see some information on your nand etc and you can start using the shell straight away without having to log in.
Note that the actual size of the rootfs is 68.9MB whereas the size of nandb is 197MB
To quit the OTG mode you have to (safely) eject each Mass Storage device and then switch the Maxi off.Some notes on filesystem integrity/safety and other stuff:
- FEL-mode is running from a ramdisk, neither nanda nor nandb are used or mounted. So you can safely copy them or modify them as you see fit AS LONG AS YOU SAFELY UNMOUNT THEM!
- The FEL-mode uses the C64 Maxis kernel – this might be different from the VIC-20’s kernel but the VIC-20’s (1.4.2) nand driver loads OK and most likely the Maxi’s nand driver recognises the VIC-20’s nand anyway as basically they are the same machines.
- If RGL updates the Maxi/VIC-20 a new nand driver might be needed for the nand of that machine. In that case there will only be a command shell with a message that no nand driver could be loaded and the ID of the nand. Please post that in this thread for further investigation..
- The kernel loads without errors and the other USB ports are supported for e.g. USB sticks. They will not mount automatically though.
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 64/VIC-20 FEL mode stuff is>
cd linux
# Manual check whether FEL-mode is activated:
sunxi-fel -l
# If you get something like: USB device 002:047 Allwinner H3 02c00181:14004620:7895c11c:241b0ad3 or similar your Maxi is in FEL mode
./boot.sh
Now it should load the FEL-mod uboot and kernel into the Maxi
Switch to the terminal window where you started ‘tio /dev/ttyACM0’ and you should get a command line terminal there. You should also get the 2 new Mass Storage devices as explained above.
Enjoy and please let me know how it works for you.