mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Enrico Jörns" <ejo@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Cc: rhi@pengutronix.de, uol@pengutronix.de, renaud.barbier@abaco.com,
	ejo <ejo@pengutronix.de>
Subject: Re: [PATCH 4/4] scripts: allow building USB loader tools for target as well
Date: Wed, 15 Sep 2021 10:44:39 +0200	[thread overview]
Message-ID: <8f991b4ccb9a28dc56279e2ca023bc54663f645c.camel@pengutronix.de> (raw)
In-Reply-To: <20210914132016.22572-4-a.fatoum@pengutronix.de>

Hi Ahmad,

Am Dienstag, dem 14.09.2021 um 15:20 +0200 schrieb Ahmad Fatoum:
> We currently build the USB loader tools only for the host (build) system,
> but it can be useful to cross compile them as well for the target.

many thanks for this great enhancement first of all!

> +CLEAN_FILES +=	\
> +		scripts/bareboxenv-target scripts/kernel-install-target \
> +		scripts/bareboxcrc32-target scripts/bareboximd-target \
> +		scripts/omap3-usb-loader-target scripts/omap4_usbboot-target \
> +		scripts/imx-usb-loader-target
> +
>  # Directories & files removed with 'make mrproper'
>  MRPROPER_DIRS  += include/config usr/include include/generated Documentation/commands
>  MRPROPER_FILES += .config .config.old .version .old_version \
> diff --git a/arch/sandbox/configs/targettools_defconfig b/arch/sandbox/configs/targettools_defconfig
> new file mode 100644
> index 000000000000..cba0de4a2aaa
> --- /dev/null
> +++ b/arch/sandbox/configs/targettools_defconfig
> @@ -0,0 +1,9 @@
> +CONFIG_IMD=y
> +CONFIG_IMD_TARGET=y
> +CONFIG_KERNEL_INSTALL_TARGET=y
> +CONFIG_BAREBOXENV_TARGET=y
> +CONFIG_BAREBOXCRC32_TARGET=y
> +CONFIG_COMPILE_HOST_TOOLS=y
> +CONFIG_ARCH_IMX_USBLOADER_TARGET=y
> +CONFIG_CONFIG_OMAP3_USB_LOADER_TARGET=y

A single CONFIG_ should be sufficient here when renaming the kconfig symbol ;)

(see below)

> +CONFIG_OMAP4_HOSTTOOL_USBBOOT_TARGET=y
> diff --git a/scripts/.gitignore b/scripts/.gitignore
> index 9577d568edd0..0b461ea7ff8a 100644
> --- a/scripts/.gitignore
> +++ b/scripts/.gitignore
> @@ -27,7 +27,9 @@ mxsboot
>  mxs-usb-loader
>  /omap3-usb-loader
>  omap4_usbboot
> +omap4_usbboot-target
>  omap3-usb-loader
> +omap3-usb-loader-target
>  mips-relocs
>  rsatoc
>  stm32image
> diff --git a/scripts/Kconfig b/scripts/Kconfig
> index f7ed775fbc66..e0adb5c4a311 100644
> --- a/scripts/Kconfig
> +++ b/scripts/Kconfig
> @@ -69,4 +69,33 @@ config BAREBOXCRC32_TARGET
>  	  'bareboxcrc32' is a userspacetool to generate the crc32 checksums the same way
>  	  barebox does. Say yes here to build it for the target.
>  
> +config HAS_TARGET_LIBUSB_1_0
> +	def_bool $(success,$(CROSS_PKG_CONFIG) --exists libusb-1.0)
> +	help
> +	  Ensure $(CROSS_PKG_CONFIG) is set to a valid pkg-config
> +	  binary that knows about libusb-1.0 compiled for the
> +	  target architecture.
> +
> +config ARCH_IMX_USBLOADER_TARGET
> +	depends on HAS_TARGET_LIBUSB_1_0
> +	bool "imx-usb-loader for target"
> +	help
> +	  Say Y here to build the imx-usb-loader tool for the target.
> +	  The cross toolchain needs libusb-1.0 to compile this tool.
> +
> +config CONFIG_OMAP3_USB_LOADER_TARGET
> +	bool "omap3 USB loader for target"
> +	depends on HAS_TARGET_LIBUSB_1_0
> +	help
> +	  Say Y here to build the omap3 usb loader tool for the target.
> +	  The cross toolchain needs libusb-1.0 to compile this tool.
> 

CONFIG_ should be omitted here.


About 'kwboot' I was not sure if that should be available as target tool, too.
What do you think? I have never used it but it appears to me that it is useful
for booting mvebu devices and thus might be used on TACs, too.


Regards

Enrico


> +
> +config OMAP4_HOSTTOOL_USBBOOT_TARGET
> +	bool "omap4 usbboot for target"
> +	depends on HAS_TARGET_LIBUSB_1_0
> +	help
> +	  Say Y here to build the omap4 usb loader tool for the target.
> +	  The cross toolchain needs libusb-1.0 to compile this tool.
> +
>  endmenu
> diff --git a/scripts/Makefile b/scripts/Makefile
> index eb0f5c5805bb..d97f00d9a792 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -41,8 +41,15 @@ userprogs-always-$(CONFIG_BAREBOXENV_TARGET)		+= bareboxenv-target
>  userprogs-always-$(CONFIG_KERNEL_INSTALL_TARGET)	+= kernel-install-target
>  userprogs-always-$(CONFIG_BAREBOXCRC32_TARGET)		+= bareboxcrc32-target
>  userprogs-always-$(CONFIG_IMD_TARGET)			+= bareboximd-target
> +userprogs-always-$(CONFIG_OMAP3_USB_LOADER_TARGET)	+= omap3-usb-loader-target
> +userprogs-always-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT)	+= omap4_usbboot-target
>  
> 
> 
> 
> 
> 
> 
> 
> -userccflags += -I $(srctree)/$(src)/include
> +omap3-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
> +omap3-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
> +omap4_usbboot-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
> +omap4_usbboot-target-userldlibs += -lpthread `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
> +
> +userccflags += -I $(srctree)/$(src)/include -isystem $(srctree)/scripts/include
>  
> 
> 
> 
> 
> 
> 
> 
>  subdir-y			+= mod
>  subdir-y			+= imx
> diff --git a/scripts/imx/.gitignore b/scripts/imx/.gitignore
> index 84e6f2b40617..341aec9ee435 100644
> --- a/scripts/imx/.gitignore
> +++ b/scripts/imx/.gitignore
> @@ -1,2 +1,3 @@
>  imx-usb-loader
> +imx-usb-loader-target
>  imx-image
> diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
> index 029f9ca9f8af..a7f487a0452c 100644
> --- a/scripts/imx/Makefile
> +++ b/scripts/imx/Makefile
> @@ -4,13 +4,23 @@ hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
>  HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0`
>  HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
>  
> 
> 
> 
> 
> 
> 
> 
> +imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
> +imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
> +
>  HOSTCFLAGS_imx.o = -I$(srctree)/arch/arm/mach-imx/include
> +imx-target-userccflags += -I$(srctree)/arch/arm/mach-imx/include
>  HOSTCFLAGS_imx-image.o = -I$(srctree) -I$(srctree)/arch/arm/mach-imx/include
>  HOSTCFLAGS_imx-usb-loader.o += -I$(srctree) -I$(srctree)/arch/arm/mach-imx/include
> +imx-usb-loader-target-userccflags += -I$(srctree) -I$(srctree)/arch/arm/mach-imx/include
>  ifdef CONFIG_ARCH_IMX_IMXIMAGE_SSL_SUPPORT
>  HOSTCFLAGS_imx-image.o += -DIMXIMAGE_SSL_SUPPORT
>  HOSTLDLIBS_imx-image  = `pkg-config --libs openssl`
>  endif
>  
> 
> 
> 
> 
> 
> 
> 
>  imx-usb-loader-objs := imx-usb-loader.o imx.o
> +imx-usb-loader-target-objs := imx-usb-loader-target.o imx-target.o
>  imx-image-objs := imx-image.o imx.o
> +
> +userprogs-always-$(CONFIG_ARCH_IMX_USBLOADER_TARGET)	+= imx-usb-loader-target
> +
> +userccflags += -I $(srctree)/$(src)/include -isystem $(srctree)/scripts/include
> diff --git a/scripts/imx/imx-target.c b/scripts/imx/imx-target.c
> new file mode 100644
> index 000000000000..4062eed6f60f
> --- /dev/null
> +++ b/scripts/imx/imx-target.c
> @@ -0,0 +1 @@
> +#include "imx.c"
> diff --git a/scripts/imx/imx-usb-loader-target.c b/scripts/imx/imx-usb-loader-target.c
> new file mode 100644
> index 000000000000..f2050aec1791
> --- /dev/null
> +++ b/scripts/imx/imx-usb-loader-target.c
> @@ -0,0 +1 @@
> +#include "imx-usb-loader.c"
> diff --git a/scripts/omap3-usb-loader-target.c b/scripts/omap3-usb-loader-target.c
> new file mode 100644
> index 000000000000..c99c261a0253
> --- /dev/null
> +++ b/scripts/omap3-usb-loader-target.c
> @@ -0,0 +1 @@
> +#include "omap3-usb-loader.c"
> diff --git a/scripts/omap4_usbboot-target.c b/scripts/omap4_usbboot-target.c
> new file mode 100644
> index 000000000000..3dd606533749
> --- /dev/null
> +++ b/scripts/omap4_usbboot-target.c
> @@ -0,0 +1 @@
> +#include "omap4_usbboot.c"

-- 
Pengutronix e.K.                           | Enrico Jörns                |
Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2021-09-15  8:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 13:20 [PATCH 1/4] common: remove !SANDBOX dependency for target tools Ahmad Fatoum
2021-09-14 13:20 ` [PATCH 2/4] common: add new menu " Ahmad Fatoum
2021-09-14 16:00   ` Roland Hieber
2021-09-14 13:20 ` [PATCH 3/4] scripts: unify libusb.h inclusion Ahmad Fatoum
2021-09-14 19:22   ` Trent Piepho
2021-09-15  8:55     ` Ahmad Fatoum
2021-09-14 13:20 ` [PATCH 4/4] scripts: allow building USB loader tools for target as well Ahmad Fatoum
2021-09-14 19:11   ` Trent Piepho
2021-09-15  8:50     ` Ahmad Fatoum
2021-09-15  9:38       ` Trent Piepho
2021-09-15 10:23         ` Ahmad Fatoum
2021-09-15  8:44   ` Enrico Jörns [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f991b4ccb9a28dc56279e2ca023bc54663f645c.camel@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=renaud.barbier@abaco.com \
    --cc=rhi@pengutronix.de \
    --cc=uol@pengutronix.de \
    --subject='Re: [PATCH 4/4] scripts: allow building USB loader tools for target as well' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox