All of lore.kernel.org
 help / color / mirror / Atom feed
* Finding out the IMAGE_BASENAME of the image beeing built
@ 2013-03-30 12:32 Ulf Samuelsson
  2013-03-30 13:04 ` Takeshi Hamasaki
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ulf Samuelsson @ 2013-03-30 12:32 UTC (permalink / raw)
  To: openembedded-devel@lists.openembedded.org

Trying create a programming script recipe and need to find out the 
IMAGE_BASENAME of the bitbake target
so I can get the filename of the image

${MACHINE}-${IMAGE_BASENAME}.ubi

I.E: if I do

$ MACHINE=beagleboard  bitbake some-image

and "some-image_1.0.bb" contains

IMAGE_BASENAME = "renamed-image"

Then the resulting image will be

     "beagleboard-renamed-image.ubi"

How get this info from another recipe?

BR
Ulf Samuelsson




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

* Re: Finding out the IMAGE_BASENAME of the image beeing built
  2013-03-30 12:32 Finding out the IMAGE_BASENAME of the image beeing built Ulf Samuelsson
@ 2013-03-30 13:04 ` Takeshi Hamasaki
  2013-03-30 14:36   ` Ulf Samuelsson
  2013-03-30 14:13 ` Paul Eggleton
  2013-04-01 13:09 ` Takeshi Hamasaki
  2 siblings, 1 reply; 6+ messages in thread
From: Takeshi Hamasaki @ 2013-03-30 13:04 UTC (permalink / raw)
  To: openembedded-devel

Hi Ulf,

$ MACHINE=beagleboard  bitbake -e some-image

shows all variables including $IMAGE_BASENAME without actually
building the image.
Using grep you can take the value of IMAGE_BASENAME, like as:

$ MACHINE=beagleboard  bitbake -e some-image | grep ^IMAGE_BASENAME

Does it help you?

If possible, consider to use hooks, for example, IMAGE_POSTPROCESS_COMMAND .
Refer image.bbclass for details. It might make things straiter.

Regards,
-- 
Takeshi Hamasaki

2013/3/30 Ulf Samuelsson <openembedded@emagii.com>:
> Trying create a programming script recipe and need to find out the
> IMAGE_BASENAME of the bitbake target
> so I can get the filename of the image
>
> ${MACHINE}-${IMAGE_BASENAME}.ubi
>
> I.E: if I do
>
> $ MACHINE=beagleboard  bitbake some-image
>
> and "some-image_1.0.bb" contains
>
> IMAGE_BASENAME = "renamed-image"
>
> Then the resulting image will be
>
>     "beagleboard-renamed-image.ubi"
>
> How get this info from another recipe?
>
> BR
> Ulf Samuelsson
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel



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

* Re: Finding out the IMAGE_BASENAME of the image beeing built
  2013-03-30 12:32 Finding out the IMAGE_BASENAME of the image beeing built Ulf Samuelsson
  2013-03-30 13:04 ` Takeshi Hamasaki
@ 2013-03-30 14:13 ` Paul Eggleton
  2013-03-30 21:01   ` Ulf Samuelsson
  2013-04-01 13:09 ` Takeshi Hamasaki
  2 siblings, 1 reply; 6+ messages in thread
From: Paul Eggleton @ 2013-03-30 14:13 UTC (permalink / raw)
  To: Ulf Samuelsson; +Cc: openembedded-devel

On Saturday 30 March 2013 13:32:51 Ulf Samuelsson wrote:
> Trying create a programming script recipe and need to find out the
> IMAGE_BASENAME of the bitbake target
> so I can get the filename of the image
> 
> ${MACHINE}-${IMAGE_BASENAME}.ubi
> 
> I.E: if I do
> 
> $ MACHINE=beagleboard  bitbake some-image
> 
> and "some-image_1.0.bb" contains
> 
> IMAGE_BASENAME = "renamed-image"
> 
> Then the resulting image will be
> 
>      "beagleboard-renamed-image.ubi"
> 
> How get this info from another recipe?

You can't. The way to handle this is as part of do_rootfs itself (e.g. from a 
script called from ROOTFS_POSTPROCESS_COMMAND or IMAGE_POSTPROCESS_COMMAND).

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



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

* Re: Finding out the IMAGE_BASENAME of the image beeing built
  2013-03-30 13:04 ` Takeshi Hamasaki
@ 2013-03-30 14:36   ` Ulf Samuelsson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Samuelsson @ 2013-03-30 14:36 UTC (permalink / raw)
  To: openembedded-devel

On 2013-03-30 14:04, Takeshi Hamasaki wrote:
> Hi Ulf,
>
> $ MACHINE=beagleboard  bitbake -e some-image
>
> shows all variables including $IMAGE_BASENAME without actually
> building the image.
> Using grep you can take the value of IMAGE_BASENAME, like as:

Thanks,

bitbake is already running to build my recipe.
Not sure that running "bitbake -e" is OK while bitbake is already running.

IMAGE_BASENAME is set to my recipe, so I cannot use this directly.

> $ MACHINE=beagleboard  bitbake -e some-image | grep ^IMAGE_BASENAME
>
> Does it help you?
>
> If possible, consider to use hooks, for example, IMAGE_POSTPROCESS_COMMAND .
> Refer image.bbclass for details. It might make things straiter.
>
> Regards,

I know I can do it inside the "some-image.bb" recipe, but I would like
to do it inside my recipe. Otherwise all images must be customized
for my recipe, which is not a good idea.

If I could do an IMAGE_POSTPROCESS_COMMAND in my recipe, then
that would be OK, but I then still need to find out what the image name is.

BR
Ulf Samuelsson




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

* Re: Finding out the IMAGE_BASENAME of the image beeing built
  2013-03-30 14:13 ` Paul Eggleton
@ 2013-03-30 21:01   ` Ulf Samuelsson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Samuelsson @ 2013-03-30 21:01 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: openembedded-devel

On 2013-03-30 15:13, Paul Eggleton wrote:
> On Saturday 30 March 2013 13:32:51 Ulf Samuelsson wrote:
>> Trying create a programming script recipe and need to find out the
>> IMAGE_BASENAME of the bitbake target
>> so I can get the filename of the image
>>
>> ${MACHINE}-${IMAGE_BASENAME}.ubi
>>
>> I.E: if I do
>>
>> $ MACHINE=beagleboard  bitbake some-image
>>
>> and "some-image_1.0.bb" contains
>>
>> IMAGE_BASENAME = "renamed-image"
>>
>> Then the resulting image will be
>>
>>       "beagleboard-renamed-image.ubi"
>>
>> How get this info from another recipe?
> You can't. The way to handle this is as part of do_rootfs itself (e.g. from a
> script called from ROOTFS_POSTPROCESS_COMMAND or IMAGE_POSTPROCESS_COMMAND).
>
> Cheers,
> Paul
>
OK, thanks

I tried to define  "configure-sam-ba.bbclass" which is inherited by my 
image.

configure-sam-ba.bbclass:
----------------------------------------------------------------------------------------------------------

SCRIPTFILE_TEMPLATE    = "${DEPLOY_DIR_IMAGE}/scripts/${MACHINE}.tcl"
SCRIPTFILE                      = 
"${DEPLOY_DIR_IMAGE}/scripts/${IMAGE_LINK_NAME}-${MACHINE}.tcl"
PROGFILE_TEMPLATE      = "${DEPLOY_DIR_IMAGE}/scripts/prog.sh"
PROGFILE                        = 
"${DEPLOY_DIR_IMAGE}/scripts/prog-${IMAGE_LINK_NAME}-${MACHINE}.sh"

sam-ba_setup () {

     if [ -e  ${PROGFILE_TEMPLATE} ] ; then
         sed    -i    s/#MACHINE#/${MACHINE}/ ${PROGFILE_TEMPLATE}
         sed    -i    s/#IMAGE#/${IMAGE_LINK_NAME}/ ${PROGFILE_TEMPLATE}
     fi
     cp    ${PROGFILE_TEMPLATE}    ${PROGFILE}

     if [ -e  ${SCRIPTFILE_TEMPLATE} ] ; then
         sed    -i    s/rootfs.ubi/${IMAGE_LINK_NAME}-${MACHINE}/ 
${SCRIPTFILE_TEMPLATE}
     fi
     cp    ${SCRIPTFILE_TEMPLATE}    ${SCRIPTFILE}
}

EXPORT_FUNCTIONS sam-ba_setup

EXTRA_IMAGEDEPENDS_append_mymachine = ' sam-ba'
IMAGE_POSTPROCESS_COMMAND_append_mymachine = " sam-ba_setup; "
----------------------------------------------------------------------------------------------------------
myimage.bb: contains.

inherit configure-sam-ba
----------------------------
It appears that the "configure-sam-ba.bbclass" file is found.
If I change the filename in the inherit statement I get an error message.

inherit configure-sam-ba-x
I get an error message.

Another indication is that the call to "sam-ba_setup;"  is inserted in 
the "run.do_rootfs.*" script,
but the script does not contain the "sam-ba_setup" subroutine.

In some places IMAGE_POSTPROCESS_COMMAND contains " 
rootfs_update_timestamp ",
from image.bbclass which *is* included in the "run.do_rootfs.*" script.

Should you not be able to use commands from a bbclass as 
PRE/POSTPROCESS_COMMAND?

A standard shell command will work, but since I need a number of 
commands, it seems
cleaner to implement it in a bbclass file.
This is my first bbclass file, so there may be things, I don't understand...


BR
Ulf Samuelsson






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

* Re: Finding out the IMAGE_BASENAME of the image beeing built
  2013-03-30 12:32 Finding out the IMAGE_BASENAME of the image beeing built Ulf Samuelsson
  2013-03-30 13:04 ` Takeshi Hamasaki
  2013-03-30 14:13 ` Paul Eggleton
@ 2013-04-01 13:09 ` Takeshi Hamasaki
  2 siblings, 0 replies; 6+ messages in thread
From: Takeshi Hamasaki @ 2013-04-01 13:09 UTC (permalink / raw)
  To: openembedded-devel

Hi Ulf,

I couldn't find the reason your recipe is stand alone,
because it doesn't generate image by itself. Does it?

My idea is written under the quote. How is it?


Let me go back to your question in first mail.

2013/3/30 Ulf Samuelsson <openembedded@emagii.com>:
> Trying create a programming script recipe and need to find out the
> IMAGE_BASENAME of the bitbake target
> so I can get the filename of the image
>
> ${MACHINE}-${IMAGE_BASENAME}.ubi
>
> I.E: if I do
>
> $ MACHINE=beagleboard  bitbake some-image
>
> and "some-image_1.0.bb" contains
>
> IMAGE_BASENAME = "renamed-image"
>
> Then the resulting image will be
>
>     "beagleboard-renamed-image.ubi"
>
> How get this info from another recipe?

----  your-image.bb ---- from here ----
include some-image.bb

 ((( use  ${IMAGE_BASENAME} and ${MACHINE} for your process )))

 ((( after that, redefine IMAGE_BASENAME and other variables if necessary. )))

---- your-image.bb ---- to here ----

-- 
Takeshi Hamasaki



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

end of thread, other threads:[~2013-04-01 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-30 12:32 Finding out the IMAGE_BASENAME of the image beeing built Ulf Samuelsson
2013-03-30 13:04 ` Takeshi Hamasaki
2013-03-30 14:36   ` Ulf Samuelsson
2013-03-30 14:13 ` Paul Eggleton
2013-03-30 21:01   ` Ulf Samuelsson
2013-04-01 13:09 ` Takeshi Hamasaki

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.