Open macpijan opened 3 months ago
Hello,
There has been an effort on our side to add Rockchip support to Snagrecover, but it has been postponed for various reasons related to time constraints.
I still haven't given up on implementing this but it won't happen in the near future, as currently my time is taken up with other features which have higher priority.
Here is my assessment of what it would take to add Rockchip support, in case you'd like to tackle the challenge yourself:
The goal of Snagrecover is to get U-Boot up and running in external RAM without touching any non-volatile memory devices. To achieve this, you must leverage the features of the ROM code USB recovery mode and various other bootloader stages to design a "recovery flow". This is essentially a list of USB commands and firmware executions that will eventually lead to U-Boot running in external RAM.
The various Rockchip boot options are described here: https://opensource.rock-chips.com/wiki_Boot_option
The general idea here would be to emulate the rkdeveloptool "db" command to copy a first bootloader stage to SRAM. This first stage should be capable of initializing the external RAM, then loading U-Boot Proper over the USB connection and launching it. I haven't yet settled on what that first stage should be. I've managed to get a U-Boot SPL banner to print using this method, but haven't gotten further than this.
There will be additional complications with arm64 SoCs, as you'll also have to run ATF and co.
Regarding the actual code to write in Snagrecover, you'll have to add a recovery flow for Rockchip SoCs in snagrecover/recoveries, a firmware parsing and running module in snagrecover/firmware, and low-level USB protocols in snagrecover/protocols. The best way to see how it's done is to look at existing code for other SoC families.
The important thing to keep in mind is that the recovery flow you design should not interact with any non-volatile memory device.
If you do decide to tackle this, feel free to ask me any relevant questions you might have. I'll do my best to answer them.
Hi,
What it takes to add a new board to this project?
Has adding Rockchip been evaluated so far, if so, what's the outcome?
AFAIK, flashing Rockchips can be done via an open-source tool: https://github.com/rockchip-linux/rkdeveloptool which can make things a bit easier.