Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] boot/barebox: add renaming functionality to barebox image copy
Date: Mon, 18 Feb 2019 23:10:10 +0100	[thread overview]
Message-ID: <20190218231010.00e29a8d@windsurf.home> (raw)
In-Reply-To: <2748BB04F99E7E45A3203C831E8B20FE34D35B88@SERBE4I2.intra.erbe-med.de>

Hello Markus,

On Mon, 18 Feb 2019 13:59:42 +0000
"Steinhilber, Markus" <Markus.Steinhilber@erbe-med.com> wrote:

> Until now barebox images are copied to the output/images directory
> with their default name. This is a problem if the barebox and
> barebox-aux images have the same name.

Could you describe a specific case/situation where this would happen ?
The main reason we have barebox vs. barebox-aux is because you
sometimes need to build a full-blown Barebox, and a smaller Barebox
that serves a first stage bootloader. From what I remember the
generated images had different names, don't they ?

> Also, you need to rename the images in a post-build script if you need
> certain file names.

That is a pretty normal thing in Buildroot. We just install things as
they are installed by the upstream build system, and leave it up to
custom post-build script to further rename/move/adjust to match the
specific requirements of the project/user.

> +config BR2_TARGET_BAREBOX_AUX_IMAGE_FILE_TARGETS
> +       string "Image file copy target names"
> +       help
> +         Space-separated list of target file names used when copying
> +         the image files from BR2_TARGET_BAREBOX_IMAGE_FILE to the
> +         images directory.
> +
> +         The target names are applied in their order in the list. So the
> +         first file in BR2_TARGET_BAREBOX_IMAGE_FILE is named after the
> +         first entry in this list and so on.

I don't think there is any other option in Buildroot where we have two
space-separated lists where there is a mapping between each item in one
list with the corresponding item in the other list. It's a pretty weird
semantic.

Perhaps a less weird semantic (which would also simplify the
implementation I believe) would be to have:

	name1:target-name1 name2:target-name2

in the existing BR2_TARGET_BAREBOX_IMAGE_FILE option.

Then you can do:

	$(foreach f,$(BR2_TARGET_BAREBOX_IMAGE_FILE),
		$(if $(findstring,:,$(f),
			cp $(@D)/$(word 0,$(subst :,$(space),$(f)) $(BINARIES_DIR)/$(word 1,$(subst :,$(space),$(f),
			cp $(@D)/$(f) $(BINARIES_DIR)/$(f)
		)
	)

Well, it's not that simple and of course completely untested :) And
perhaps it doesn't fit well with the existing shell code in barebox.mk.

>  define $(1)_INSTALL_IMAGES_CMDS
> +       image_files_array=($$($(1)_IMAGE_FILES)); \
> +       image_targets_array=($$($(1)_IMAGE_FILES_TARGETS)); \

We don't use bash arrays anywhere else in the make code in Buildroot,
so this would also be a precedent.

Best regardsn

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2019-02-18 22:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 13:59 [Buildroot] [PATCH 1/1] boot/barebox: add renaming functionality to barebox image copy Steinhilber, Markus
2019-02-18 22:10 ` Thomas Petazzoni [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-02-19 11:03 Steinhilber, Markus
2019-02-22  8:40 ` Thomas Petazzoni
2019-02-22  8:53   ` Arnout Vandecappelle
2019-02-22 10:19     ` Thomas Petazzoni
2019-02-25 10:00       ` Steinhilber, Markus
2019-02-25 10:20         ` Thomas Petazzoni

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=20190218231010.00e29a8d@windsurf.home \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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