Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-15 Thread Eric Grunt
> squashfs-xz (by poky) works,
> squashfs_xz_ubi (custom type) also works

To clarify, squashfs_xz_ubi was named squashfs-xz-ubi before,
I renamed it in order to try to avoid using "-".
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-15 Thread Eric Grunt
> I think there is some translation code somewhere which probably
> confuses things more as some bits have - and some have _. Does the
> squashfs_xz image type actually work?

There is no squashfs_xz image type.
squashfs-xz (by poky) works,
squashfs_xz_ubi (custom type) also works,
but needs to occasionally call IMAGE_CMD_squashfs-xz itself.
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-15 Thread Richard Purdie
On Mon, 2019-04-15 at 21:43 +0700, Eric Grunt wrote:
> > Notice how the function names for squashfs are:
> > 
> > do_image_squashfs_xz
> > 
> > not
> > 
> > do_image_squashfs-xz
> > 
> > This is because shell functions/variables can't have "-" in their
> > name.
> > You need to change to us IMAGE_CMD_squashfs_xz_ubi.
> 
> I tried to basically change all "-" in the fs and variable names into
> "_",
> but this didn't change the behaviour.
> What I do not understand:
> The filesystem type squashfs-xz (included in poky) uses "-",
> among others also for the IMAGE_CMD name ("IMAGE_CMD_squashfs-xz").
> Only the dependencies to squashfs tools are using "_":
> do_image_squashfs_xz[depends] += "squashfs-tools-
> native:do_populate_sysroot"
> 
> In the case of squashfs_xz_ubi the IMAGE_TYPEDEP_ dependency
> to sqashfs-xz is ignored.
> (experimentally trying to change that dependency to squashfs
> (a name without "-")  does not help)

I think there is some translation code somewhere which probably
confuses things more as some bits have - and some have _. Does the
squashfs_xz image type actually work? 

Cheers,

Richard


-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-15 Thread Eric Grunt
> Notice how the function names for squashfs are:
>
> do_image_squashfs_xz
>
> not
>
> do_image_squashfs-xz
>
> This is because shell functions/variables can't have "-" in their name.
> You need to change to us IMAGE_CMD_squashfs_xz_ubi.

I tried to basically change all "-" in the fs and variable names into "_",
but this didn't change the behaviour.
What I do not understand:
The filesystem type squashfs-xz (included in poky) uses "-",
among others also for the IMAGE_CMD name ("IMAGE_CMD_squashfs-xz").
Only the dependencies to squashfs tools are using "_":
do_image_squashfs_xz[depends] += "squashfs-tools-native:do_populate_sysroot"

In the case of squashfs_xz_ubi the IMAGE_TYPEDEP_ dependency
to sqashfs-xz is ignored.
(experimentally trying to change that dependency to squashfs
(a name without "-")  does not help)
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-12 Thread richard . purdie
On Fri, 2019-04-12 at 20:50 +0700, Eric Grunt wrote:
> > The dependency code is only triggered if the image type is in
> > IMAGE_FSTYPES. Did you add it there?
> 
> Yes, in the distro conf file.
> Guess, otherwise it wouldn't be built at all (since it isn't
> dependency of another fs)

Notice how the function names for squashfs are:

do_image_squashfs_xz

not

do_image_squashfs-xz

This is because shell functions/variables can't have "-" in their name.
You need to change to us IMAGE_CMD_squashfs_xz_ubi.

Cheers,

Richard



-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-12 Thread Eric Grunt
> The dependency code is only triggered if the image type is in
> IMAGE_FSTYPES. Did you add it there?

Yes, in the distro conf file.
Guess, otherwise it wouldn't be built at all (since it isn't
dependency of another fs)
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-12 Thread Richard Purdie
On Fri, 2019-04-12 at 20:19 +0700, Eric Grunt wrote:
> Dependencies on other file system types for custom file system type
> 
> I'd like to add a custom fs type - a squashfs-xz on an ubi (instead
> of ubifs).
> For this purpose I created a new class, inherited image_types and
> added
> a dependency on squashfs-xz and also on squashfs-tools-native and
> mtd-utils-native:
> 
> inherit image_types
> 
> IMAGE_TYPEDEP_squashfs-xz-ubi = "squashfs-xz"
> 
> do_image_squashfs-xz-ubi[depends] += "mtd-utils-
> native:do_populate_sysroot"
> do_image_squashfs-xz-ubi[depends] += "squashfs-tools-
> native:do_populate_sysroot"
> 
> (full class file is attached to this mail)
> 
> But the dependency handling is not working corrently in my solution:

The dependency code is only triggered if the image type is in
IMAGE_FSTYPES. Did you add it there?

Cheers,

Richard



-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-12 Thread Eric Grunt
better formatted class file:

inherit image_types

IMAGE_TYPEDEP_squashfs-xz-ubi = "squashfs-xz"

do_image_squashfs-xz-ubi[depends] += "mtd-utils-native:do_populate_sysroot"
do_image_squashfs-xz-ubi[depends] += "squashfs-tools-native:do_populate_sysroot"

IMAGE_CMD_squashfs-xz-ubi () {
squashfsubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}"
}

squashfsubi_mkfs() {
 local mkubifs_args="$1"
 local ubinize_args="$2"
 CFG_NAME=ubinize-${IMAGE_NAME}-squashfs-xz-ubi.cfg

 # Added prompt error message for ubi and ubifs image creation.
 if [ -z "$mkubifs_args"] || [ -z "$ubinize_args" ]; then
   bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set,\
   see http://www.linux-mtd.infradead.org/faq/ubifs.html for details"
 fi

 echo \[ubifs\] > ${CFG_NAME}
 echo mode=ubi >> ${CFG_NAME}
 echo \
 image=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz \
 >> ${CFG_NAME}

 echo vol_id=0 >> ${CFG_NAME}
 echo vol_type=dynamic >> ${CFG_NAME}
 echo vol_name=${UBI_VOLNAME} >> ${CFG_NAME}
 echo vol_flags=autoresize >> ${CFG_NAME}
 # normally we shouldn't need to create the squashfs image ourselves,
 # because we have a dependency declared (IMAGE_TYPEDEP)
 # But, if this file is modified, the dependency is _not_ rebuild,
 # so we have to do this ourselves.
 if [ ! -e ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz ]
 then
  bbwarn \
  "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz does
not exist. Creating."
  ${IMAGE_CMD_squashfs-xz}
 fi
 ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz-ubi \
 ${ubinize_args} ${CFG_NAME}

 # Cleanup cfg file
 mv ${CFG_NAME} ${IMGDEPLOYDIR}/
 }
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] Dependencies on other file system types for custom file system type

2019-04-12 Thread Eric Grunt
class file:

inherit image_types

IMAGE_TYPEDEP_squashfs-xz-ubi = "squashfs-xz"

do_image_squashfs-xz-ubi[depends] += "mtd-utils-native:do_populate_sysroot"
do_image_squashfs-xz-ubi[depends] += "squashfs-tools-native:do_populate_sysroot"

IMAGE_CMD_squashfs-xz-ubi () {
squashfsubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}"
}

squashfsubi_mkfs() {
local mkubifs_args="$1"
local ubinize_args="$2"
CFG_NAME=ubinize-${IMAGE_NAME}-squashfs-xz-ubi.cfg

# Added prompt error message for ubi and ubifs image creation.
if [ -z "$mkubifs_args"] || [ -z "$ubinize_args" ]; then
bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see
http://www.linux-mtd.infradead.org/faq/ubifs.html for details"
fi

echo \[ubifs\] > ${CFG_NAME}
echo mode=ubi >> ${CFG_NAME}
echo image=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz
>> ${CFG_NAME}
echo vol_id=0 >> ${CFG_NAME}
echo vol_type=dynamic >> ${CFG_NAME}
echo vol_name=${UBI_VOLNAME} >> ${CFG_NAME}
echo vol_flags=autoresize >> ${CFG_NAME}
# normally we shouldn't need to create the squashfs image ourselves,
# because we have a dependency declared (IMAGE_TYPEDEP)
# But, if this file is modified, the dependency is _not_ rebuild, so
we have to do this ourselves.
if [ ! -e ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz 
]
then
bbwarn 
"${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz
does not exist. Creating."
${IMAGE_CMD_squashfs-xz}
fi
ubinize -o 
${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz-ubi
${ubinize_args} ${CFG_NAME}

# Cleanup cfg file
mv ${CFG_NAME} ${IMGDEPLOYDIR}/
}
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto