All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Seiderer <ps.report@gmx.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v1] boot/barebox: fix target bareboxenv command compile
Date: Thu, 1 Oct 2020 23:42:07 +0200	[thread overview]
Message-ID: <20201001234207.53cba558@gmx.net> (raw)
In-Reply-To: <20201001210838.GJ11621@scaer>

Hello Yann,

On Thu, 1 Oct 2020 23:08:38 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Peter, All,
>
> On 2020-10-01 23:02 +0200, Peter Seiderer spake thusly:
> > On Thu, 1 Oct 2020 22:03:40 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > > On 2020-01-07 20:50 +0100, Peter Seiderer spake thusly:
> > > > The buildroot custom bareboxenv compile command
> > > > needs the additional include path 'scripts/include'
> > > > to gain access to the local copy of the kernel header
> > > > files.
> > > >
> > > > Fixes (with BR2_TARGET_BAREBOX_BAREBOXENV enabled):
> > > >
> > > >   build/barebox-2019.12.0/scripts/bareboxenv.c:100:10: fatal error: linux/list.h: No such file or directory
> [--SNIP--]
> > > Although this is techniocally,  correct, I wonder why we do not use
> > > BAREBOX_KONFIG_FIXUP_CMDS to enabler CONFIG_BAREBOXENV_TARGET in the
> > > barebox configuration, for example:
> > >
> > >     diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
> > >     index 422f27312d..5eaeb7db4c 100644
> > >     --- a/boot/barebox/barebox.mk
> > >     +++ b/boot/barebox/barebox.mk
> > >     @@ -112,6 +112,9 @@ ifneq ($$($(1)_CUSTOM_EMBEDDED_ENV_PATH),)
> > Seems the wrong place as BR2_TARGET_BAREBOX_BAREBOXENV is/should be independent
> > of BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH
>
> Yes, but it was just to give the overall idea. Of course, that part will
> have to be refactored.
>
> > >      define $(1)_KCONFIG_FIXUP_CMDS
> > >      	$$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_ENVIRONMENT)
> > >      	$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$($(1)_CUSTOM_EMBEDDED_ENV_PATH)")
> > >     +	$$(if $$(BAREBOX_KONFIG_FIXUP_CMDS),\
> > Did you mean '$$(if $$(BR2_TARGET_BAREBOX_BAREBOXENV),' ???
>
> Arg, almost, yes. I really meant $$(BR2_TARGET_$(1)_BAREBOXENV) ;-)
>

The following patch seems to work:

diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 422f27312d..d47a47966c 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -88,13 +88,6 @@ $(1)_KCONFIG_DEPENDENCIES = \
 	$(BR2_BISON_HOST_DEPENDENCY) \
 	$(BR2_FLEX_HOST_DEPENDENCY)

-ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
-define $(1)_BUILD_BAREBOXENV_CMDS
-	$$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
-		$$(@D)/scripts/bareboxenv.c
-endef
-endif
-
 ifeq ($$(BR2_TARGET_$(1)_CUSTOM_ENV),y)
 $(1)_ENV_NAME = $$(notdir $$(call qstrip,\
 	$$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)))
@@ -109,12 +102,23 @@ endef
 endif

 ifneq ($$($(1)_CUSTOM_EMBEDDED_ENV_PATH),)
-define $(1)_KCONFIG_FIXUP_CMDS
+define $(1)_KCONFIG_FIXUP_CUSTOM_EMBEDDED_ENV_PATH
 	$$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_ENVIRONMENT)
 	$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$($(1)_CUSTOM_EMBEDDED_ENV_PATH)")
 endef
 endif

+ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+define $(1)_KCONFIG_FIXUP_BAREBOXENV
+	$$(call KCONFIG_ENABLE_OPT,CONFIG_BAREBOXENV_TARGET)
+endef
+endif
+
+define $(1)_KCONFIG_FIXUP_CMDS
+	$$($(1)_KCONFIG_FIXUP_CUSTOM_EMBEDDED_ENV_PATH)
+	$$($(1)_KCONFIG_FIXUP_BAREBOXENV)
+endef
+
 define $(1)_BUILD_CMDS
 	$$($(1)_BUILD_BAREBOXENV_CMDS)
 	$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
@@ -136,7 +140,7 @@ endef

 ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
 define $(1)_INSTALL_TARGET_CMDS
-	cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
+	cp $$(@D)/scripts/bareboxenv-target $$(TARGET_DIR)/usr/bin/bareboxenv
 endef
 endif



	$ file target/usr/bin/bareboxenv
target/usr/bin/bareboxenv: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 5.4.0, not stripped


Regards,
Peter


> Regards,
> Yann E. MORIN.
>
> > Regards,
> > Peter
> >
> > >     +		$$(call KCONFIG_ENABLE_OPT,CONFIG_BAREBOXENV_TARGET),\
> > >     +		$$(call KCONFIG_DISABLE_OPT,CONFIG_BAREBOXENV_TARGET))
> > >      endef
> > >      endif
> > >
> > >
> > > And then we candrop our custom build command for it...
> > >
> > > CONFIG_BAREBOXENV_TARGET has existed since commit afb03d7a55, in April
> > > 2012, so virtually all barebox versions that are recent have it.
> > >
> > > Regards,
> > > Yann E. MORIN.
> > >
> > > >  		$$(@D)/scripts/bareboxenv.c
> > > >  endef
> > > >  endif
> > > > --
> > > > 2.24.1
> > > >
> > > > _______________________________________________
> > > > buildroot mailing list
> > > > buildroot at busybox.net
> > > > http://lists.busybox.net/mailman/listinfo/buildroot
> > >
> >
>

      reply	other threads:[~2020-10-01 21:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 19:50 [Buildroot] [PATCH v1] boot/barebox: fix target bareboxenv command compile Peter Seiderer
2020-10-01 20:03 ` Yann E. MORIN
2020-10-01 21:02   ` Peter Seiderer
2020-10-01 21:08     ` Yann E. MORIN
2020-10-01 21:42       ` Peter Seiderer [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=20201001234207.53cba558@gmx.net \
    --to=ps.report@gmx.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.