Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Post build script issue
@ 2014-01-23  8:23 Waldemar Rymarkiewicz
  2014-01-23  8:30 ` Jeremy Rosen
  2014-01-27  6:53 ` Arnout Vandecappelle
  0 siblings, 2 replies; 4+ messages in thread
From: Waldemar Rymarkiewicz @ 2014-01-23  8:23 UTC (permalink / raw)
  To: buildroot

Hi,

Recently, I've tried to use post-script feature and found an issue,

I created foo.sh with 755 mode and configured buildroot to use this
post-script. However, make failed with the message:

>>>   Executing post-image script foo.sh
/bin/bash: foo.sh: command not found

It's because post-script is called in Makefile just by the name assuming
that the . directory is in your PATH.

 target-post-image:
 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
 $(call MESSAGE,"Executing post-image script $(s)"); \
---->>> $(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call
qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))


Therefore, I added '.' dir to my PATH and ran make again. Again I got an
error.

"You seem to have the current working directory in your PATH environment
variable. This doesn't work.
make: *** [core-dependencies] Error 1"

 How does it work for you?

Don't you think the Makefile should call the script this way:

-               $(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call
qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+               $(USER_HOOKS_EXTRA_ENV) ./$(s) $(TARGET_DIR) $(call
qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))


Let me know I will prepare a patch.

Thanks,
/Waldek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140123/9750fd68/attachment.html>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Post build script issue
  2014-01-23  8:23 [Buildroot] Post build script issue Waldemar Rymarkiewicz
@ 2014-01-23  8:30 ` Jeremy Rosen
  2014-01-27  6:53 ` Arnout Vandecappelle
  1 sibling, 0 replies; 4+ messages in thread
From: Jeremy Rosen @ 2014-01-23  8:30 UTC (permalink / raw)
  To: buildroot

I always set my script setup in buildroot to absolute paths using
global variables.

depending on where you put your script, you probably want to set it 
to $(TOPDIR)/foo.sh (TOPDIR is the buildroot directory or
$(BR2_EXTERNAL)/foo.sh if you use BR2_EXTERNAL. There are a couple 
more variables like that, but I don't know them. Just check the 
documentation.

Having a relative path to CWD seems like a bad idea when you can
use these variables to have a dinamically expanded absolute path...

Cordialement 

J?r?my Rosen 
+33 (0)1 42 68 28 04

fight key loggers : write some perl using vim 


Open Wide Ingenierie

23, rue Daviel
75012 Paris - France
www.openwide.fr





----- Mail original -----
> 
> 
> Hi,
> 
> 
> Recently, I've tried to use post-script feature and found an issue,
> 
> 
> I created foo.sh with 755 mode and configured buildroot to use this
> post-script. However, make failed with the message:
> 
> 
> >>> Executing post-image script foo.sh
> 
> 
> /bin/bash: foo.sh: command not found
> 
> 
> It's because post-script is called in Makefile just by the name
> assuming that the . directory is in your PATH.
> 
> 
> 
> target-post-image:
> @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_ IMAGE _SCRIPT)), \
> $(call MESSAGE,"Executing post-image script $(s)"); \
> ---->>> $(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call
> qstrip,$(BR2_ROOTFS_POST_ SCRIP T_ARGS))$(sep))
> 
> 
> 
> 
> Therefore, I added '.' dir to my PATH and ran make again. Again I got
> an error.
> 
> 
> "You seem to have the current working directory in your PATH
> environment variable. This doesn't work.
> 
> 
> make: *** [core-dependencies] Error 1"
> 
> 
> How does it work for you?
> 
> 
> Don't you think the Makefile should call the script this way:
> 
> 
> 
> - $(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call
> qstrip,$(BR2_ROOTFS_POST_ SCRIP T_ARGS))$(sep))
> + $(USER_HOOKS_EXTRA_ENV) ./$(s) $(TARGET_DIR) $(call
> qstrip,$(BR2_ROOTFS_POST_ SCRIP T_ARGS))$(sep))
> 
> 
> 
> 
> Let me know I will prepare a patch.
> 
> 
> Thanks,
> /Waldek
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Post build script issue
  2014-01-23  8:23 [Buildroot] Post build script issue Waldemar Rymarkiewicz
  2014-01-23  8:30 ` Jeremy Rosen
@ 2014-01-27  6:53 ` Arnout Vandecappelle
  2014-01-28 10:18   ` Waldemar Rymarkiewicz
  1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2014-01-27  6:53 UTC (permalink / raw)
  To: buildroot

On 23/01/14 09:23, Waldemar Rymarkiewicz wrote:
> Hi,
>
> Recently, I've tried to use post-script feature and found an issue,
>
> I created foo.sh with 755 mode and configured buildroot to use this
> post-script. However, make failed with the message:
>
>  >>>   Executing post-image script foo.sh
> /bin/bash: foo.sh: command not found
>
> It's because post-script is called in Makefile just by the name assuming
> that the . directory is in your PATH.
>
> target-post-image:
> @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
> $(call MESSAGE,"Executing post-image script $(s)"); \
> ---->>> $(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call
> qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
>
>
> Therefore, I added '.' dir to my PATH and ran make again. Again I got an
> error.
>
> "You seem to have the current working directory in your PATH environment
> variable. This doesn't work.
> make: *** [core-dependencies] Error 1"
>
> How does it work for you?
>
> Don't you think the Makefile should call the script this way:
>
> -               $(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call
> qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
> +               $(USER_HOOKS_EXTRA_ENV) ./$(s) $(TARGET_DIR) $(call
> qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))

  ./$(s) is a bad idea since it will break the case when the script is an 
absolute path. But maybe $(abspath $(s)) works?

  Regards,
  Arnout


>
>
> Let me know I will prepare a patch.
>
> Thanks,
> /Waldek
>
>
>
>
>
>
>
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Post build script issue
  2014-01-27  6:53 ` Arnout Vandecappelle
@ 2014-01-28 10:18   ` Waldemar Rymarkiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Waldemar Rymarkiewicz @ 2014-01-28 10:18 UTC (permalink / raw)
  To: buildroot

Hi,

On 27 January 2014 07:53, Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
>  ./$(s) is a bad idea since it will break the case when the script is an absolute path. But maybe $(abspath $(s)) works?
>

Right it will brake full path case. Anyway abspath works seamlessly
with full and relative paths, so sending a patch.

Thanks,
/Waldek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-28 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23  8:23 [Buildroot] Post build script issue Waldemar Rymarkiewicz
2014-01-23  8:30 ` Jeremy Rosen
2014-01-27  6:53 ` Arnout Vandecappelle
2014-01-28 10:18   ` Waldemar Rymarkiewicz

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