Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] rootfs hooks okay to use?
@ 2012-09-19  1:44 Danomi Manchego
  2012-09-19  5:14 ` Thomas Petazzoni
  2012-09-19  6:19 ` Arnout Vandecappelle
  0 siblings, 2 replies; 6+ messages in thread
From: Danomi Manchego @ 2012-09-19  1:44 UTC (permalink / raw)
  To: buildroot

Hi all,

I tried adding something like this to one of our proprietary packages:

+define TEST_PRE_GEN_HOOK_FIXUP
+ echo "This is a test hook"
+endef
+
+ROOTFS_CRAMFS_PRE_GEN_HOOKS    += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_CLOOP_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_EXT2_PRE_GEN_HOOKS      += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_JFFS2_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_UBIFS_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_SQUASHFS_PRE_GEN_HOOKS  += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_TAR_PRE_GEN_HOOKS       += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_CPIO_PRE_GEN_HOOKS      += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_ISO9660_PRE_GEN_HOOKS   += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_INITRAMFS_PRE_GEN_HOOKS += TEST_PRE_GEN_HOOK_FIXUP
+ROOTFS_ROMFS_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP

But when I run make, I get:

fs/cpio/cpio.mk:32: *** missing separator (did you mean TAB instead of 8
spaces?).  Stop.
make: *** [all] Error 2

So - are the rootfs hooks okay for general use, or are they reserved
strictly for fs/*/*.mk use?

Thanks again,
Danomi -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120918/62815c5c/attachment.html>

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

* [Buildroot] rootfs hooks okay to use?
  2012-09-19  1:44 [Buildroot] rootfs hooks okay to use? Danomi Manchego
@ 2012-09-19  5:14 ` Thomas Petazzoni
  2012-09-20  1:58   ` Danomi Manchego
  2012-09-19  6:19 ` Arnout Vandecappelle
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2012-09-19  5:14 UTC (permalink / raw)
  To: buildroot

Dear Danomi Manchego,

On Tue, 18 Sep 2012 21:44:14 -0400, Danomi Manchego wrote:

> So - are the rootfs hooks okay for general use, or are they reserved
> strictly for fs/*/*.mk use?

Depends on what you want them to do. What are you trying to do, in the
end?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] rootfs hooks okay to use?
  2012-09-19  1:44 [Buildroot] rootfs hooks okay to use? Danomi Manchego
  2012-09-19  5:14 ` Thomas Petazzoni
@ 2012-09-19  6:19 ` Arnout Vandecappelle
  2012-09-20  2:38   ` Danomi Manchego
  1 sibling, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2012-09-19  6:19 UTC (permalink / raw)
  To: buildroot

On 09/19/12 03:44, Danomi Manchego wrote:
> Hi all,
>
> I tried adding something like this to one of our proprietary packages:
>
> +define TEST_PRE_GEN_HOOK_FIXUP
> + echo "This is a test hook"
> +endef
> +
> +ROOTFS_CRAMFS_PRE_GEN_HOOKS    += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_CLOOP_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_EXT2_PRE_GEN_HOOKS      += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_JFFS2_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_UBIFS_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_SQUASHFS_PRE_GEN_HOOKS  += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_TAR_PRE_GEN_HOOKS       += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_CPIO_PRE_GEN_HOOKS      += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_ISO9660_PRE_GEN_HOOKS   += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_INITRAMFS_PRE_GEN_HOOKS += TEST_PRE_GEN_HOOK_FIXUP
> +ROOTFS_ROMFS_PRE_GEN_HOOKS     += TEST_PRE_GEN_HOOK_FIXUP
>
> But when I run make, I get:
>
> fs/cpio/cpio.mk:32 <http://cpio.mk:32>: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.
> make: *** [all] Error 2

  Any commands to be executed by make should start with a TAB character,
so make recognizes them as commands.  That is also true for the hooks.
So you should define

define TEST_PRE_GEN_HOOK_FIXUP
	echo "This is a test hook"
endef

where there is a single tab before echo.

  Regards,
  Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
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] 6+ messages in thread

* [Buildroot] rootfs hooks okay to use?
  2012-09-19  5:14 ` Thomas Petazzoni
@ 2012-09-20  1:58   ` Danomi Manchego
  0 siblings, 0 replies; 6+ messages in thread
From: Danomi Manchego @ 2012-09-20  1:58 UTC (permalink / raw)
  To: buildroot

Thomas,

On Wed, Sep 19, 2012 at 1:14 AM, Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:
>> So - are the rootfs hooks okay for general use, or are they reserved
>> strictly for fs/*/*.mk use?
>
>Depends on what you want them to do. What are you trying to do, in the
>end?

WRT if multiple hooks can be used, does it matter?

I have a single setup that is supporting two different hardware
configurations, one with the serial port on ttyO2, and the other on ttyO0.
 I'm already using a custom skeleton, but since the only difference and a
rootfs custom script.  Since the difference in getty setup is so small, I
don't want to maintain a completely separate skeleton, when a simple sed
line would do.  Using the rootfs custom script is possible, but then I have
to call "make" again, since the script doesn't know any of the variables,
other than the target directory.  So adding a simple hook seems like a good
way to go, and I'd like to make it as late in the process as possible.  The
rootfs hooks seemed like a suitable fit.

Since the package hooks let me add multiple hooks, I expected the rootfs
hooks to do so too ...

Danomi -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120919/02042aa5/attachment.html>

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

* [Buildroot] rootfs hooks okay to use?
  2012-09-19  6:19 ` Arnout Vandecappelle
@ 2012-09-20  2:38   ` Danomi Manchego
  2012-09-20  3:56     ` Danomi Manchego
  0 siblings, 1 reply; 6+ messages in thread
From: Danomi Manchego @ 2012-09-20  2:38 UTC (permalink / raw)
  To: buildroot

Arnout.

On Wed, Sep 19, 2012 at 2:19 AM, Arnout Vandecappelle <arnout@mind.be>wrote:
> Any commands to be executed by make should start with a TAB character,
> so make recognizes them as commands.

I don't think so.  If I change the beginning of my both
my TEST_PRE_GEN_HOOK_FIXUP and the ROOTFS_CPIO_ADD_INIT to start with tabs,
the error changes to:

fs/cpio/cpio.mk:35: *** missing separator.  Stop.
make: *** [all] Error 2

On the other hand, the package hooks have no problem with multiple hooks
and no tabs.  For example, this works without any errors:

+define TEST_HOOK_FIXUP1
+ echo "This is a test hook1"
+endef
+
+define TEST_HOOK_FIXUP2
+ echo "This is a test hook2"
+endef
+
+ZLIB_POST_INSTALL_TARGET_HOOKS += TEST_HOOK_FIXUP1
+ZLIB_POST_INSTALL_TARGET_HOOKS += TEST_HOOK_FIXUP2

However, I think I've figured it out the difference.  The rootfs hooks are
iterated by a foreach statement in fs/common.mk in ROOTFS_TARGET_INTERNAL.
 But ROOTFS_TARGET_INTERNAL is actually a template, so the single $ are
evaluated by the $(eval $(call ROOTFS_TARGET,xxxx)).  But if the single $
are replaced by double $, then the foreach evaluation is deferred to later.
 Then, the multiple hooks seem to work.

The specific change is:

 $(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES)
        @$(call MESSAGE,"Generating root filesystem image rootfs.$(1)")
-       $(foreach hook,$(ROOTFS_$(2)_PRE_GEN_HOOKS),$(call $(hook))$(sep))
+       $$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),$$(call
$$(hook))$$(sep))
        rm -f $(FAKEROOT_SCRIPT)

So if the hooks are supposed to be generally available for tacking on more
actions, then I think we need the double $'s ...

Danomi -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120919/0b36ccc8/attachment-0001.html>

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

* [Buildroot] rootfs hooks okay to use?
  2012-09-20  2:38   ` Danomi Manchego
@ 2012-09-20  3:56     ` Danomi Manchego
  0 siblings, 0 replies; 6+ messages in thread
From: Danomi Manchego @ 2012-09-20  3:56 UTC (permalink / raw)
  To: buildroot

Arnout, Thomas,

Please disregard this thread.  After some reconsideration, i've decided to
abandon this approach.  There are certainly plenty of alternatives ways to
do what I need to do.  It is probably best for me not to stir up trouble.

Apologies, apologies, apologies.
Danomi -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120919/80d5efa8/attachment.html>

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

end of thread, other threads:[~2012-09-20  3:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19  1:44 [Buildroot] rootfs hooks okay to use? Danomi Manchego
2012-09-19  5:14 ` Thomas Petazzoni
2012-09-20  1:58   ` Danomi Manchego
2012-09-19  6:19 ` Arnout Vandecappelle
2012-09-20  2:38   ` Danomi Manchego
2012-09-20  3:56     ` Danomi Manchego

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