Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Anand Gadiyar <gadiyar@ti.com>, Xuanhao Shi <x-shi@ti.com>,
	Suniel Mahesh <sunil@amarulasolutions.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 2/4] boot/ti-k3-r5-loader: add new package
Date: Sun, 31 Jul 2022 10:27:37 +0200	[thread overview]
Message-ID: <20220731102737.3eb2525d@windsurf> (raw)
In-Reply-To: <f8d347ce-9c81-6ffd-a44e-ccfd72af7739@benettiengineering.com>

Hello,

On Sun, 31 Jul 2022 02:54:09 +0200
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:


> > +config BR2_TARGET_TI_K3_R5_LOADER_BOARD
> > +	string "Board to configure for"
> > +	depends on BR2_TARGET_TI_K3_R5_LOADER
> > +	help
> > +	  Specify the board to configure the bootloader for.
> > +	  This should be the name of a board under board/ti
> > +	  For example, "am64x_evm".  
> 
> Here ^^^ I would substitute "config" with "choice", this way everything
> is easier from the user point of view. On patch 4/4 you're adding 2
> boards, so I think it makes sense to add every possible choice(2 for the
> moment).

I am afraid I will disagree here. For this type of option, we
definitely prefer to have a free-form string rather than an exhaustive
list of possible options. See U-Boot/Linux/Barebox and other packages
that have configurable defconfigs.

So please keep the string option.


> > +TI_K3_R5_LOADER_VERSION = 2022.10-rc1  
> 
> -rc1 version is the possibly buggiest version you can pick. There are
> other 2 possible solutions:
> 1. use 2022.07 and backport all needed patches on a dedicated
> repository instead of using official u-boot repository
> 2. wait a bit for at least rc2/3(soon) and later when 2022.10 is
> released, bump it

I'd say it's fine for the time being to have -rc1, with the assumption
that as soon as 2022.10 is out, we bump to it. After all, this package
is very specific to TI boards, so if this -rc1 has been tested as
working in this particular context, that's fine.

> > +TI_K3_R5_LOADER_SITE = https://ftp.denx.de/pub/u-boot
> > +TI_K3_R5_LOADER_SOURCE = u-boot-$(TI_K3_R5_LOADER_VERSION).tar.bz2
> > +TI_K3_R5_LOADER_LICENSE = GPL-2.0+
> > +TI_K3_R5_LOADER_LICENSE_FILES = Licenses/gpl-2.0.txt
> > +TI_K3_R5_LOADER_CPE_ID_VENDOR = denx
> > +TI_K3_R5_LOADER_CPE_ID_PRODUCT = u-boot
> > +TI_K3_R5_LOADER_INSTALL_IMAGES = YES
> > +TI_K3_R5_LOADER_DEPENDENCIES = \
> > +	host-pkgconf \
> > +	$(BR2_MAKE_HOST_DEPENDENCY) \  
> 
> What is this ^^^ needed for?

I guess this is mainly because it's copy/pasted from uboot.mk, and the
explanation is:

# u-boot 2020.01+ needs make 4.0+

> > +	host-arm-gnu-toolchain
> > +
> > +TI_K3_R5_LOADER_MAKE = $(BR2_MAKE)  
> 
> This ^^^ looks superflous, you can directly use $(BR2_MAKE) below

This is also modeled after uboot.mk, though I would agree with you.

> > +TI_K3_R5_LOADER_KCONFIG_DEPENDENCIES = \
> > +	toolchain \
> > +	$(BR2_MAKE_HOST_DEPENDENCY) \
> > +	$(BR2_BISON_HOST_DEPENDENCY) \
> > +	$(BR2_FLEX_HOST_DEPENDENCY)  
> 
> "toolchain" should imply all above _HOST_DEPENDENCY. But here you're
> using host-arm-gnu-toolchain, so toolchain shouldn't be needed, or yes?

Again, this is modeled after uboot.mk. But indeed, here the toolchain
dependency does not make sense, since CROSS_COMPILE points to the
toolchain installed by host-arm-gnu-toolchain. So here, we should
replace "toolchain" by "host-arm-gnu-toolchain".

> > +TI_K3_R5_LOADER_BOARD = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_BOARD))  
> 
> This ^^^ can be avoided too since you use it one line below with a
> suffix only

I think it's fine, as it makes the following line more readable.

> > +TI_K3_R5_LOADER_KCONFIG_DEFCONFIG = $(TI_K3_R5_LOADER_BOARD)_r5_defconfig
> > +TI_K3_R5_LOADER_MAKE_OPTS += \
> > +	CROSS_COMPILE=$(HOST_ARM_GNU_TOOLCHAIN_INSTALL_DIR)/bin/arm-none-eabi- \
> > +	ARCH=arm  
> 
> What is the reason why you need to use arm-gnu-toolchain to build u-boot 
> SPL? Can you please explain it in commit log?

This has been explained already in previous iterations of the patch
series.

This package is about building a special U-Boot, which targets a
Cortex-R5 core, that acts as a kind of "co-processor". Since the main
processor is an ARM64 core, and an ARM64 toolchain can only be 64-bit
code, we need a separate toolchain to be able to build ARM 32-bit code
for the Cortex-R5 core.

> > +define TI_K3_R5_LOADER_BUILD_CMDS
> > +	$(TI_K3_R5_LOADER_MAKE) -C $(@D) $(TI_K3_R5_LOADER_MAKE_OPTS)
> > +endef
> > +
> > +define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
> > +	cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
> > +endef
> > +
> > +$(eval $(kconfig-package))  
> 
> Why do you use kconfig-package? You reimplement anyway BUILD_CMDS and
> INSTALL_IMAGES_CMDS, so generic-package should be fine.

kconfig-package is special, it does not implement BUILD_CMDS,
INSTALL_TARGET_CMDS or INSTALL_IMAGES_CMDS. Look at uboot.mk, linux.mk,
busybox.mk and others that use kconfig-package. kconfig-package only
provides logic for the configuration step, with xxx-menuconfig,
xxx-xconfig, xxx-savedefconfig targets and all, but implementing the
BUILD_CMDS and others CMDS variables is left to the package .mk file.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-07-31  8:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 16:40 [Buildroot] [PATCH v2 0/4] add support for TI's AM6X boards Xuanhao Shi via buildroot
2022-07-28 16:40 ` [Buildroot] [PATCH v2 1/4] package/arm-gnu-toolchain: revert to version 10 Xuanhao Shi via buildroot
2022-07-31  0:28   ` Giulio Benetti
2022-07-31  7:28     ` Thomas Petazzoni via buildroot
2022-08-01 17:56   ` Thomas Petazzoni via buildroot
2022-07-28 16:40 ` [Buildroot] [PATCH v2 2/4] boot/ti-k3-r5-loader: add new package Xuanhao Shi via buildroot
2022-07-31  0:54   ` Giulio Benetti
2022-07-31  8:27     ` Thomas Petazzoni via buildroot [this message]
2022-07-31 10:10       ` Giulio Benetti
2022-08-02 16:23   ` Giulio Benetti
2022-07-28 16:40 ` [Buildroot] [PATCH v2 3/4] boot/ti-k3-image-gen: " Xuanhao Shi via buildroot
2022-07-31  1:04   ` Giulio Benetti
2022-07-31  8:30     ` Thomas Petazzoni via buildroot
2022-07-28 16:40 ` [Buildroot] [PATCH v2 4/4] board/ti: add new boards Xuanhao Shi via buildroot
2022-07-31  1:15   ` Giulio Benetti
2022-07-31  8:32     ` Thomas Petazzoni via buildroot
2022-08-02 16:40   ` Giulio Benetti
2022-08-02 16:48     ` Giulio Benetti

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=20220731102737.3eb2525d@windsurf \
    --to=buildroot@buildroot.org \
    --cc=gadiyar@ti.com \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=sunil@amarulasolutions.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=x-shi@ti.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox