[oe] Finding out the IMAGE_BASENAME of the image beeing built

Ulf Samuelsson openembedded at emagii.com
Sat Mar 30 21:01:24 UTC 2013


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







More information about the Openembedded-devel mailing list