-
Notifications
You must be signed in to change notification settings - Fork 217
driver: add RKUSBMaskromDriver bootstrap driver #1721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1721 +/- ##
========================================
+ Coverage 45.4% 45.8% +0.3%
========================================
Files 172 173 +1
Lines 13500 13670 +170
========================================
+ Hits 6130 6261 +131
- Misses 7370 7409 +39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
d011ad1
to
c096575
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: use snagboot
instead?
bootlin/snagboot#56 brings Rockchip support to snagboot.
The benefit is that other SoC vendors are supported by snagboot so we could have a snagboot driver to support multiple SoC vendors at once in labgrid.
This would also stop reimplementing the rockusb protocol in yet another project (hello rkdeveloptool, rockusb from rockchiprs, rkflashtool, snagboot, ...).
This was briefly discussed with @a3f @jluebbe at OSSEU/ELCE this year. Talking with snagboot's maintainer, there are plans to merge the Rockchip support for snagboot very soon and do a release soon after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: use
snagboot
instead?
I will be using this agent/driver and not snagboot
in my personal lab ;-)
bootlin/snagboot#56 brings Rockchip support to snagboot.
I will take a closer look little bit later and add some review comments, I can already see some issues in that implementation.
This would also stop reimplementing the rockusb protocol in yet another project (hello rkdeveloptool, rockusb from rockchiprs, rkflashtool, snagboot, ...).
All of those seem to have their own special issues, are not fully featured or can get stuck etc.
This driver works and only requires pyusb installed on the exporter, for my personal lab I do not want to deal with lots of third party tools ;-)
RKUSBMaskromDriver: | ||
initial: 'rkmaskrom471' | ||
image: 'rkmaskrom472' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: is this compatible with Barebox?
Barebox seems to be generating only one binary which contains both "files". I think it'd make sense to support Barebox file format as well, which likely differs from U-Boot's (currently two separate files IIRC) or the binary generated by Rockchip's boot_merger?
@a3f any opinion on that maybe?
EDIT: I see that the next patch adds the implementation for reading the file from boot_merger
, so I guess if we have a unique way of identifying Barebox's implementation that would work too. Still, wondering if we shouldn't simply use snagboot and implement stuff there if necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Barebox seems to be generating only one binary which contains both "files". I think it'd make sense to support Barebox file format as well, which likely differs from U-Boot's (currently two separate files IIRC)
Barebox uses the IDBlock v2 format, i.e. same format that mkimage
produce for TPL
and SPL
in U-Boot for RK35xx.
Will add an implementation for extracting images from the IDBlock v1 and v2 formats, thanks!
or the binary generated by Rockchip's boot_merger?
This format is supported with the second commit, one special thing that boot_merger
does differently for RK35xx
is that it adds an IDBlock v2 header for the 471 and 472 files referenced in the rkboot .ini-files.
However, this extra header does not seem to be required on all RK35xx SoCs I have tested.
Also the BootROM seem to use a much slower crc16 implementation, so validating a huge blob for i.e. U-Boot RAM boot can take several seconds.
Will send an updated Rockchip U-Boot RAM-boot series that take advantage of FIT compression along with relocation the FIT to the 2 MiB offset to help speed up RAM-boot.
Still, wondering if we shouldn't simply use snagboot and implement stuff there if necessary?
Feel free to implement and use a snagboot
driver, I will be using this for my personal lab ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now added a new commit with support for decoding the IDBlock v2 image format (both unsigned and signed) in addition to the loader image format.
With that added we should be able to use the Barebox output image or u-boot-rockchip.bin
to at least boot into SPL on newer Rockchip SoCs.
Will run some more tests and add one more commit to support for the legacy IDBlock image format to make this fully featured.
This will need to be tested some more on e.g. RK3576 where more than two idblock images is typically used to e.g. fixup booting from SD-card.
Add a RKUSBMaskromDriver bootstrap driver with an accompanying rkusbmaskrom agent to support bootstrapping targets with Rockchip SoCs. The rkusbmaskrom agent expects the target to be in MASKROM mode and send images to BootROM using vendor specific 0x471 and 0x472 control transfers, in 4 KiB chunks. The first image is loaded to SRAM using 0x471 and is expected to initialize DRAM and then return back to BootROM. A second image can then be loaded to start of DRAM using 0x472. Signed-off-by: Jonas Karlman <[email protected]>
9fd159a
to
87c520d
Compare
Add support for using vendor loader image files, typically created using the vendor boot_merger tool in the rkbin repo. Signed-off-by: Jonas Karlman <[email protected]>
191a6cd
to
2d0a61a
Compare
Add support for using vendor idblock v2 image files, typically created using the U-Boot mkimage tool. Signed-off-by: Jonas Karlman <[email protected]>
2d0a61a
to
5af8184
Compare
Description
Add a
RKUSBMaskromDriver
bootstrap driver with an accompanyingrkusbmaskrom
agent to support bootstrapping targets with Rockchip SoCs.The
rkusbmaskrom
agent expects the target to be in MASKROM mode and send images to BootROM using vendor specific0x471
and0x472
control transfers, in 4 KiB chunks.The first image is loaded to SRAM using
0x471
and is expected to initialize DRAM and then return back to BootROM.A second image can then be loaded to start of DRAM using
0x472
.Related
Checklist
Example usage