Skip to contentSkip to conversation

Adding test files to an image

DISCUSSION jfabernathy 7 participants 14 messages Mar 8, 2012 – Mar 9, 2012

lore
Share & tools
lore
#0 lore raw

Suppose I want to build the meta-intel/meta-sugarbay image and also include some video and audio files into the /home/root directory to facilitate testing of the video and audio players.

Can I include these files in a recipe somewhere?

Also, I know that I can increase the spare image size so these files can be copied in later with the IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE. But where do these statements go?

conf/local.conf???

Jim A

#1 lore raw
Quoted 5 lines

Suppose I want to build the meta-intel/meta-sugarbay image and also include some video and audio files into the /home/root directory to facilitate testing of the video and audio players.

Can I include these files in a recipe somewhere?

I use the recipe at the end of this message to include whatever I want. This recipe has to be added to the image - I have a custom image, so it goes in there. I am sure a recipe can be added to something in local.conf - I just do not know that variable. My guess it is IMAGE_IMSTALL += "mypics".

Regardless ...

mypics-1.0.tar.gz contains a file called COPYING and its mds5um on the 2nd line. It can be replaced with a license from common licenses directory - but at the time when I wrote this recipe, I did not know how to do that. Anything that goes in there ends up in /home/root/mypics.

It can probably be tweaked to look better - I am sure SRC_URI line is not perfect. But it seems to work between Edison to master

For larger files - like video worth 200MB or so, I just store them on a hard disk and mount manually on /media/hdd or where-ever. Not that it wont work in this recipe, just that it would take longer to build the image etc.

All the best. Hopefully, this will get you started in the right direction.

LICENSE = "MyLic"
LIC_FILES_CHKSUM = "file://COPYING;md5=697172b05e4bff0a2421579697ba5653"

MY_DESTINATION = "/home/root/mypics"

SRC_URI = "file://mypics-1.0/mypics-1.0.tar.gz"

do_install_append() {
        install -d ${D}${MY_DESTINATION}
        install -m 0644  ${S}/* ${D}${MY_DESTINATION}
}

PR = "r0"

FILES_${PN} += "${MY_DESTINATION}/*"

#2 lore raw
Quoted 36 lines · Autif Khan
Quoted 5 lines

Suppose I want to build the meta-intel/meta-sugarbay image and also include some video and audio files into the /home/root directory to facilitate testing of the video and audio players.

Can I include these files in a recipe somewhere?

I use the recipe at the end of this message to include whatever I want. This recipe has to be added to the image - I have a custom image, so it goes in there. I am sure a recipe can be added to something in local.conf - I just do not know that variable. My guess it is IMAGE_IMSTALL += "mypics".

Regardless ...

mypics-1.0.tar.gz contains a file called COPYING and its mds5um on the 2nd line. It can be replaced with a license from common licenses directory - but at the time when I wrote this recipe, I did not know how to do that. Anything that goes in there ends up in /home/root/mypics.

It can probably be tweaked to look better - I am sure SRC_URI line is not perfect. But it seems to work between Edison to master

For larger files - like video worth 200MB or so, I just store them on a hard disk and mount manually on /media/hdd or where-ever. Not that it wont work in this recipe, just that it would take longer to build the image etc.

All the best. Hopefully, this will get you started in the right direction.

LICENSE = "MyLic"
LIC_FILES_CHKSUM = "file://COPYING;md5=697172b05e4bff0a2421579697ba5653"

MY_DESTINATION = "/home/root/mypics"

SRC_URI = "file://mypics-1.0/mypics-1.0.tar.gz"

Quoted 8 lines
do_install_append() {
         install -d ${D}${MY_DESTINATION}
         install -m 0644  ${S}/* ${D}${MY_DESTINATION}
}

PR = "r0"

FILES_${PN} += "${MY_DESTINATION}/*"

I have some issues that seem to be related to where everything gets unpacked and where it thinks it needs to install from.

Below is my recipe file name "myvideos_1.0.bb"

DESCRIPTION = "my video test files"
SECTION = "examples"
LICENSE = "CLOSED"

MY_DESTINATION = "/home/root/myvideos"

SRC_URI = "file://myvideos_1.0/myvideos-1.0.tar.gz"

do_install_append() {
        install -d ${D}${MY_DESTINATION}
        install -m 0644  ${S}/* ${D}${MY_DESTINATION}
}

PR = "r0"

FILES_${PN} += "${MY_DESTINATION}/*"

I have the myvideo-1.0.tar.gz file in the myvideos_1.0 directory, same level as the recipe in a directory call myvideos.

The error I'm getting is :
Log data follows:
| ERROR: Function failed: do_install (see /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/temp/log.do_install.9051 for further information) | install: cannot stat `/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/*': No such file or directory
NOTE: package myvideos-1.0-r0: task do_install: Failed
ERROR: Task 2 (/home/jim/poky/meta-jfa/recipes-jfa/myvideos/myvideos_1.0.bb, do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 651 tasks of which 644 didn't need to be rerun and 1 failed.

The tar.gz is getting unpacked in the ..tmp/work/x86_64-poky-linux/myvideos-1.0-r0 directory per the unpack log file below:

NOTE: Unpacking /home/jim/poky/meta-jfa/recipes-jfa/myvideos/myvideos_1.0/myvideos-1.0.tar.gz to /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/

The critical parts of the run.do_install is below:

do_install() {
base_do_install
install -d
/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

        install -m 0644  

/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/* /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

}

base_do_install() {
    :

}

cd /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0 do_install

-------------------------
So it looks like it unpacks it one place, but is looking to install from somewhere else. I'm just not sure how all the S and D variables are set and what they do.

Jim A

#3 lore raw

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

SRC_URI = "file://myvideos-1.0/myvideos-**1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

#4 lore raw
Quoted 9 lines · Rudolf Streif

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

that didn't solve the problem. I still get file not found errors. The videos are unpack to WORKDIR, but the do_install is looking for them in S.

install -d
/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

        install -m 0644 

/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/* /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

I think I need to control where the do_unpack puts the files.

Jim A

#5 lore raw
Quoted 18 lines · jfabernathy
Quoted 5 lines · Rudolf Streif

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

Quoted 7 lines

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

that didn't solve the problem. I still get file not found errors.  The videos are unpack to WORKDIR, but the do_install is looking for them in S.

Quoted 8 lines

      install -d /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos install -m 0644 /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/* /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

I think I need to control where the do_unpack puts the files.

Just a dumb thought, but I have been bitten many times by it.

please try bitbake myvideos -c cleansstate

then bitbake myvideos to build the recipe.

Alternatively, you can of course rev up the PR everytime you change the recipe. But that is cumbersome.

And yes, I forgot to mention in my previous mail that the mypics-1.0.tar.gz is located in meta-autif/recipes-autif/mypics/mypics-1.0/mypics-1.0.tar.gz

As Rudolf suggested - bitbake is a bit finickey about '-' and '_'

#6 lore raw
Quoted 31 lines · Autif Khan
Quoted 16 lines · jfabernathy
Quoted 11 lines · Rudolf Streif

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

that didn't solve the problem. I still get file not found errors. The videos are unpack to WORKDIR, but the do_install is looking for them in S.

Quoted 8 lines

install -d
/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

        install -m 0644

/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/* /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

I think I need to control where the do_unpack puts the files.

Just a dumb thought, but I have been bitten many times by it.

please try bitbake myvideos -c cleansstate

then bitbake myvideos to build the recipe.

Quoted 8 lines

Alternatively, you can of course rev up the PR everytime you change the recipe. But that is cumbersome.

And yes, I forgot to mention in my previous mail that the mypics-1.0.tar.gz is located in meta-autif/recipes-autif/mypics/mypics-1.0/mypics-1.0.tar.gz

As Rudolf suggested - bitbake is a bit finickey about '-' and '_'

I was doing a "bitbake -c cleanall myvideos" before each run of bitbake myvideos, but I just now tried bitbake myvideos -c cleansstate with no change in behavior.

It seems clear to me that do_unpack unpacks the tar.gz file to the

${WORKDIR}

but install is looking for them in

${WORKDIR}/${PN}-${PV}

Since S is not defined, I think the default is ${WORKDIR}/${PN}-${PV}

Not sure how to fix that.

JIm A

#7 lore raw
Quoted 46 lines · jfabernathy
Quoted 31 lines · Autif Khan
Quoted 16 lines · jfabernathy
Quoted 11 lines · Rudolf Streif

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

that didn't solve the problem. I still get file not found errors. The videos are unpack to WORKDIR, but the do_install is looking for them in S.

Quoted 8 lines

install -d /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos install -m 0644 /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/* /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

I think I need to control where the do_unpack puts the files.

Just a dumb thought, but I have been bitten many times by it.

please try bitbake myvideos -c cleansstate

then bitbake myvideos to build the recipe.

Quoted 8 lines

Alternatively, you can of course rev up the PR everytime you change the recipe. But that is cumbersome.

And yes, I forgot to mention in my previous mail that the mypics-1.0.tar.gz is located in meta-autif/recipes-autif/mypics/mypics-1.0/mypics-1.0.tar.gz

As Rudolf suggested - bitbake is a bit finickey about '-' and '_'

I was doing a "bitbake -c cleanall myvideos" before each run of bitbake myvideos, but I just now tried bitbake myvideos -c cleansstate with no change in behavior.

It seems clear to me that do_unpack unpacks the tar.gz file to the

${WORKDIR}

Quoted 8 lines

but install is looking for them in

${WORKDIR}/${PN}-${PV}

Since S is not defined, I think the default is ${WORKDIR}/${PN}-${PV}

Not sure how to fix that.

Set S to be what you need in the recipe, e.g.
S = "${WORKDIR}/jfabernathy-${PV}"
or whatever it is you need

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#8 lore raw
Quoted 55 lines · Gary Thomas
Quoted 54 lines · jfabernathy
Quoted 34 lines · Autif Khan
Quoted 19 lines · jfabernathy
Quoted 11 lines · Rudolf Streif

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

that didn't solve the problem. I still get file not found errors. The videos are unpack to WORKDIR, but the do_install is looking for them in S.

install -d /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

Quoted 8 lines

install -m 0644 /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/*

/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

I think I need to control where the do_unpack puts the files.

Just a dumb thought, but I have been bitten many times by it.

please try bitbake myvideos -c cleansstate

then bitbake myvideos to build the recipe.

Quoted 8 lines

Alternatively, you can of course rev up the PR everytime you change the recipe. But that is cumbersome.

And yes, I forgot to mention in my previous mail that the mypics-1.0.tar.gz is located in meta-autif/recipes-autif/mypics/mypics-1.0/mypics-1.0.tar.gz

As Rudolf suggested - bitbake is a bit finickey about '-' and '_'

I was doing a "bitbake -c cleanall myvideos" before each run of bitbake myvideos, but I just now tried bitbake myvideos -c cleansstate with no change in behavior.

It seems clear to me that do_unpack unpacks the tar.gz file to the

${WORKDIR}

but install is looking for them in

${WORKDIR}/${PN}-${PV}

Quoted 8 lines
Quoted 3 lines

Since S is not defined, I think the default is ${WORKDIR}/${PN}-${PV}

Not sure how to fix that.

Set S to be what you need in the recipe, e.g.
S = "${WORKDIR}/jfabernathy-${PV}"
or whatever it is you need

Thanks, I know I can change S, but I need to change where do_unpack puts the files. with them in WORKDIR, I can't just say WORKDIR/* because there are a lot of other files and directories at that level.

I need do_unpack to put the files from tar.gz into S for example.

Jim A

#9 lore raw
Quoted 10 lines
Quoted 4 lines

Set S to be what you need in the recipe, e.g.
S = "${WORKDIR}/jfabernathy-${PV}"
or whatever it is you need

Thanks, I know I can change S, but I need to change where do_unpack puts the files. with them in WORKDIR, I can't just say WORKDIR/* because there are a lot of other files and directories at that level.

I need do_unpack to put the files from tar.gz into S for example.

you can do something like

do_unpack_append() {
        bb.build.exec_func('do_move_src', d)
}
do_move_src() {
        mv ${WORKDIR}/<yoursources> ${S}/
}

but if you can repackage that tar file to untar into some dir that would simplify things
and you just need to reset S

#10 lore raw
In reply to Gary Thomas
Quoted 55 lines · Gary Thomas
Quoted 54 lines · jfabernathy
Quoted 34 lines · Autif Khan
Quoted 19 lines · jfabernathy
Quoted 11 lines · Rudolf Streif

Jeff,

Use hyphen instead of underscore for the subdirectory SRC_URI:

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

and of course for the subdirectory in the subdirectory where the recipe is located. The file fetcher copies the entire path myvideos-1.0/myvideos-1.0.tar.gz to ${WORKDIR}.

Rudi

that didn't solve the problem. I still get file not found errors. The videos are unpack to WORKDIR, but the do_install is looking for them in S.

install -d /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

Quoted 8 lines

install -m 0644 /build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/myvideos-1.0/*

/build/sugarbay-master/tmp/work/x86_64-poky-linux/myvideos-1.0-r0/image/home/root/myvideos

I think I need to control where the do_unpack puts the files.

Just a dumb thought, but I have been bitten many times by it.

please try bitbake myvideos -c cleansstate

then bitbake myvideos to build the recipe.

Quoted 8 lines

Alternatively, you can of course rev up the PR everytime you change the recipe. But that is cumbersome.

And yes, I forgot to mention in my previous mail that the mypics-1.0.tar.gz is located in meta-autif/recipes-autif/mypics/mypics-1.0/mypics-1.0.tar.gz

As Rudolf suggested - bitbake is a bit finickey about '-' and '_'

I was doing a "bitbake -c cleanall myvideos" before each run of bitbake myvideos, but I just now tried bitbake myvideos -c cleansstate with no change in behavior.

It seems clear to me that do_unpack unpacks the tar.gz file to the

${WORKDIR}

but install is looking for them in

${WORKDIR}/${PN}-${PV}

Quoted 8 lines
Quoted 3 lines

Since S is not defined, I think the default is ${WORKDIR}/${PN}-${PV}

Not sure how to fix that.

Set S to be what you need in the recipe, e.g.
S = "${WORKDIR}/jfabernathy-${PV}"
or whatever it is you need

So what I can get to work is the following recipe, but what I want is not o have to specify the file extension:

DESCRIPTION = "my video test files"
SECTION = "examples"
LICENSE = "CLOSED"

MY_DESTINATION = "/home/root/myvideos"

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

do_install_append() {
        install -d ${D}${MY_DESTINATION}
#        install -m 0644 ${S}/* ${D}${MY_DESTINATION}
        install -m 0644 ${WORKDIR}/*.mp4 ${D}${MY_DESTINATION}
}

PR = "r0"

FILES_${PN} += "${MY_DESTINATION}/*"

#11 lore raw
Quoted 3 lines · jfabernathy

So what I can get to work is the following recipe, but what I want is not o have to specify the file extension:

you may be able to build your archive in a directory like :
myvideos-1.0/files.mp4, so that your files will be available in ${S} = ${WORKDIR}/myvideos-1.0/

Eric

Signature · 1 line
http://eukrea.com/en/news/104-2012
#12 lore raw
Quoted 10 lines · Eric Bénard
Quoted 3 lines · jfabernathy

So what I can get to work is the following recipe, but what I want is not o have to specify the file extension:

you may be able to build your archive in a directory like :
myvideos-1.0/files.mp4, so that your files will be available in ${S} = ${WORKDIR}/myvideos-1.0/

Eric

Duh! That was too easy. Not sure why it was not obvious to me. Thanks,

So I put all my videos into a directory called myvideos-1.0 and tar gz'ed the whole directory. now the following works:

DESCRIPTION = "my video test files"
SECTION = "examples"
LICENSE = "CLOSED"

MY_DESTINATION = "/home/root/myvideos"

SRC_URI = "file://myvideos-1.0/myvideos-1.0.tar.gz"

do_install_append() {
        install -d ${D}${MY_DESTINATION}
        install -m 0644 ${S}/* ${D}${MY_DESTINATION}
}

PR = "r0"

FILES_${PN} += "${MY_DESTINATION}/*"
------------------------------

You just have to put your newly created tarball of the myvideos-1.0 directory in the SRC_URI.

Thanks again,

JIm A

#13 lore raw
In reply to jfabernathy
Quoted 3 lines · jfabernathy

Suppose I want to build the meta-intel/meta-sugarbay image and also include some video and audio files into the /home/root directory to facilitate testing of the video and audio players.

I have used ROOTFS_POSTPROCESS_COMMAND variable to add some extra files to rootfs image for testing purposes. Following example is copying files from build/extra path to root filesystem image if the extra folder exists.

# copy files from extra folder to image
ROOTFS_POSTPROCESS_COMMAND += "[ -d ${TOPDIR}/extra ] && cp -r ${TOPDIR}/extra/* {IMAGE_ROOTFS};"

Regards,
Lauri