Difference between revisions of "User:Fxc/Draft:PineTab2 SPI"
(Added text) |
(Linked to the repo) |
||
Line 46: | Line 46: | ||
The following bootloader releases are currently available for the SPI flash memory: | The following bootloader releases are currently available for the SPI flash memory: | ||
* [https://github.com/Kwiboo/u-boot-build | * [https://github.com/Kwiboo/u-boot-build Kwiboo's U-Boot artifacts build for the PineTab2] (testing release for development purposes, not intended for productive usage) | ||
== Flashing == | == Flashing == |
Revision as of 16:24, 22 June 2023
This article explains what the SPI flash memory in the PineTab2 is and how it is used and recovered.
TODO
- Getting started
- What it is and what it is used for (explanation OSes without bootloader)
- That it is empty (and why)
- Explanation boot order
- Available SPI releases
- How to flash the SPI + lock out risk and incompatibilities
- How to recover the SPI
- Outlook
- Discussion
- Plans
Warning template
Getting started
The PineTab2 includes an SPI flash memory. An SPI flash memory is a non-volatile memory that uses Serial Peripheral Interface (SPI) protocol for communication. The memory can be used to store a bootloader on it. This is an important hardware functionality, because it can be used to modify the boot order (see the section #Boot order) and to store the bootloader away and independent from any operating system (on the SPI flash memory as dedicated memory, instead on the same disk as the operating system).
The SPI on the currently shipped PineTab2 batch is shipped and will likely contain a bootloader in future batches to simplify the booting procedure for users in the future.
Boot order
The RK3566 SoC searches for the U-Boot SPL in a fixed order:
- SPI flash memory
- eMMC
- MicroSD card
The subsequent boot order in the U-Boot SPL can then be changed in software. Example: There is the U-Boot bootloader installed on the eMMC (the internal memory of the PineTab2), which tries to boot from a microSD card if it finds a bootable medium and it will otherwise load the installation from the eMMC. Another example: There is the U-Boot bootloader installed to the eMMC, which tries to first boot from microSD card and then from the eMMC.
In practice, this has several implications for the user that need to be considered:
- The bootloader might break and prevent the device from booting
- If the bootloader on the eMMC or SPI breaks and stops, you must disable the SPI and the eMMC to make the device boot from a microSD card to recover your installation (see section #Recovery)
- Bypassing the eMMC and SPI requires an UART adapter with a bypass switch (it is included in the current batch, )
Releases
The following bootloader releases are currently available for the SPI flash memory:
- Kwiboo's U-Boot artifacts build for the PineTab2 (testing release for development purposes, not intended for productive usage)
Flashing
A word of warning: Flashing the SPI is not recommended by the author(s) of the article. Instead it is recommended to do any development and testing solely using microSD cards and to keep the SPI in the condition at delivery. The flashing procedure has the risk of locking you out from your device because the SPI has the highest boot priority. If the bootloader on the SPI stops booting it will prevent the device from booting any further. In this state it can be only recovered by using the UART adapter with the bypass switch as explained in the section #Recovery. Additionally, bootloaders such as U-Boot flashed on the SPI will introduce incompatibilities in some operating systems, for example if they are based on AOSP.
Checklist of things you require for flashing the SPI on the PineTab2
- A fully charged PineTab2 connected to a charger
- A confirmed to work UART adapter with a bypass switch, in case anything goes wrong
- A fully working and stable operating system
- Experience with the command line
- A full understanding of the involved procedure and the risks
Steps to flash the SPI:
- Read and understand the explanation about the boot order, the procedure to recover a faulty flash and the involved risks
- Test that your UART adapter with a bypass switch is fully working and the bypass switch successfully bypasses the SPI and the eMMC
- Power on your device without the UART adapter
- Install
flashcp
if it is not installed already - Download a listed release. Verify multiple times that the correct file is downloaded and that it is compatible with your device. Other devices might have a similar name or the filename might be similar to incompatible files.
- Verify that the download was complete and successful using the provided checksum of the corresponding release
- Understand and then run the command
flashcp -v -p u-boot-rockchip-spi.bin /dev/mtd0
, with u-boot-rockchip-spi.bin being an example for a U-Boot release. It has to be stored in the directory you're running the command in. NOTE: This command does not verify if the SPI was flashed successful. The step is down AT OWN RISK! - Wait for the command to successfully flash your SPI
If there is any question regarding a step or if one step is not clear enough please ask in the PineTab channel on the bridged community chat before doing the step. If the procedure was not successful please read the #Recovery section.