[PATCH 5/5] scripts: Add rk-usb-loader tool
Michael Riesch
michael.riesch at wolfvision.net
Mon Oct 11 02:46:12 PDT 2021
Hello Sascha,
On 10/11/21 9:18 AM, Sascha Hauer wrote:
> On Fri, Oct 08, 2021 at 04:25:58PM +0200, Michael Riesch wrote:
>> Hello Sascha,
>>
>> On 10/6/21 4:22 PM, Sascha Hauer wrote:
>>> This adds a tool suitable for bootstrapping barebox on Rockchip RK3568
>>> SoCs. It has been tested on this SoC only. It might or might not work
>>> with minor adjustments on other SoCs.
>>>
>>> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
>>> ---
>>> scripts/Kconfig | 8 +
>>> scripts/Makefile | 3 +
>>> scripts/rk-usb-loader.c | 324 ++++++++++++++++++++++++++++++++++++++++
>>> scripts/rkimage.c | 32 +---
>>> scripts/rockchip.h | 35 +++++
>>> 5 files changed, 371 insertions(+), 31 deletions(-)
>>> create mode 100644 scripts/rk-usb-loader.c
>>> create mode 100644 scripts/rockchip.h
>>>
>>> diff --git a/scripts/Kconfig b/scripts/Kconfig
>>> index 5cba520f4b..5118269c2d 100644
>>> --- a/scripts/Kconfig
>>> +++ b/scripts/Kconfig
>>> @@ -102,4 +102,12 @@ config OMAP4_HOSTTOOL_USBBOOT
>>>
>>> You need libusb-1.0 to compile this tool.
>>>
>>> +config RK_USB_LOADER
>>> + bool "Rockchip USB loader"
>>> + depends on ARCH_ROCKCHIP || COMPILE_HOST_TOOLS
>>> + help
>>> + Say Y here to build the rockchip usb loader tool.
>>> +
>>> + You need libusb-1.0 to compile this tool.
>>> +
>>> endmenu
>>> diff --git a/scripts/Makefile b/scripts/Makefile
>>> index 53568573a3..db2168bfab 100644
>>> --- a/scripts/Makefile
>>> +++ b/scripts/Makefile
>>> @@ -36,6 +36,9 @@ hostprogs-always-$(CONFIG_OMAP3_USB_LOADER) += omap3-usb-loader
>>> HOSTCFLAGS_omap4_usbboot.o = `pkg-config --cflags libusb-1.0`
>>> HOSTLDLIBS_omap4_usbboot = -lpthread `pkg-config --libs libusb-1.0`
>>> hostprogs-always-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT) += omap4_usbboot
>>> +HOSTCFLAGS_rk-usb-loader.o = `pkg-config --cflags libusb-1.0`
>>> +HOSTLDLIBS_rk-usb-loader = `pkg-config --libs libusb-1.0`
>>> +hostprogs-always-$(CONFIG_RK_USB_LOADER) += rk-usb-loader
>>>
>>> userprogs-always-$(CONFIG_BAREBOXENV_TARGET) += bareboxenv-target
>>> userprogs-always-$(CONFIG_KERNEL_INSTALL_TARGET) += kernel-install-target
>>> diff --git a/scripts/rk-usb-loader.c b/scripts/rk-usb-loader.c
>>> new file mode 100644
>>> index 0000000000..87bc7b94a9
>>> --- /dev/null
>>> +++ b/scripts/rk-usb-loader.c
>>> @@ -0,0 +1,324 @@
>>> +// SPDX-License-Identifier: GPL-2.0-or-later
>>> +
>>> +/*
>>> + * rk-usb-loader: A tool to USB Bootstrap RK3568 SoCs
>>> + *
>>> + * This tool bootstraps Rockchip RK3568 SoCs via USB. It currently
>>> + * works for this SoC only. It takes the barebox images the barebox
>>> + * build process generates as input. The upload protocol has been
>>> + * taken from the rkdevelop tool, but it's not a full replacement
>>> + * of that tool.
>>> + */
>>
>> very nice! I was able to load barebox images into the RAM of the RK3568
>> EVB1 as well as of the Pine64 Quartz64A boards. So it works for the
>> RK3566 as well, maybe this should be reflected in the comments and the
>> commit message.
>>
>> Also, if it is not too much to ask, a short hint to this tool in the
>> documentation would be nice.
>
> I added a text to the documentation and also a note about the RK3566 to
> the top of the tool's sourcecode.
>
>>> + dev = rk_usb_open(ctx, 0x2207, 0x350a);
>
> I hardcoded the vid/pid of the RK3568 here. Is it the same for the
> RK3566 or did you have to change it?
The RK3566 has the same VID/PID:
ID 2207:350a Fuzhou Rockchip Electronics Company
and I guess the IDs can remain hardcoded for now.
Best regards,
Michael
More information about the barebox
mailing list