Commit Graph

237 Commits

Author SHA1 Message Date
Ed Bartosh d6cb46cafd image.bbclass: run wicenv task only for wic images
Currently do_wicenv task is run for all images. However, its
result is used only to produce wic image. It's better to
run this task only for wic images. If another rootfs is
required to produce wic image, dependency to its do_wicenv
must be added to the wic image recipy.

Stopped running do_wicenv for all images. Added explicit
dependency to this task in wic-image-minimal recipe.

[YOCTO #9095]

(From OE-Core rev: b81c176fb2f1ee818b6049c39ef353a7d7d5e078)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-28 15:55:49 +01:00
Robert Yang 1b1de89304 grub-efi.bbclass: make it can build vm and live together
* Make it can build vm and live (e.g., iso + vmdk) together as we did
  for syslinux.
* GRUBCFG -> GRUB_CFG as other GRUB_FOO vars

(From OE-Core rev: e38039e43f22d55a443064efa91752e2943fda79)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-25 10:29:16 +00:00
Robert Yang 4ebaeb281b bootimg.bbclass: fix settings for grub-efi.bbclass
Fixed:
- Found potential conflicted var LABELS ...
  Set LABELS to "boot install" would build out broken images when build
  vm + live together, use set_live_vm_vars() to fix the problem.

- Use ROOT and LABEL in boot-directdisk.bbclass and image-foo.bbclass,
  they are not only used by syslinux.bbclass, but also grub-efi.bbclass,
  add "SYSLINUX_" prefix would mislead users.

(From OE-Core rev: d7d1e0193c94abb1cd2daf1c298c8c1788f3616d)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-25 10:29:16 +00:00
Patrick Ohly 5d06f00471 image.bbclass: track ROOTFS_POSTUNINSTALL_COMMAND in do_rootfs vardeps
The list of variables influencing do_rootfs was not updated when
introducing ROOTFS_POSTUNINSTALL_COMMAND. As a result, making changes
in commands listed there or the variables they depend on did not trigger
a re-run of do_rootfs.

(From OE-Core rev: 66b461ce9df7ed06d7651b9b54a49a950b97a1d4)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-20 23:12:26 +00:00
Patrick Ohly ba57ba1942 image.bbclass: support chaining compression (aka conversion) commands
It makes sense to use the compression mechanism also for conversion,
for example of a whole-disk image into .vdi (VirtualBox). That part
already works, like this:

   COMPRESSIONTYPES_append = " vdi"
   COMPRESS_CMD_vdi = "qemu-img convert -O vdi ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi"
   IMAGE_DEPENDS_vdi = "qemu-native"

But then it also makes sense to allow compressing the resulting image,
which only works after enhancing the image.bbclass.

For example, suppose a custom image command produces "dsk" images. Then
it becomes possible to set
   IMAGE_FSTYPES = " dsk.xz dsk.vdi.xz"
and do_image_dsk will automatically produce the intermediate images,
convert to dsk.xz resp. dsk.vdi -> dsk.vdi.xz and delete all
intermediate images. Symlinks are also set correctly.

(From OE-Core rev: 588f14370372a66329b54606071175519ce88f1e)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09 16:58:10 +00:00
Patrick Ohly 5ac3dc76a5 image.bbclass: fix incomplete .rootfs customization
The patch for making the .rootfs configurable was incomplete: in the
python create_symlinks() method the new variable must be expanded
explicitly.

Not doing so broke the symlink creation and that led to hard build
failures in image types depending on the boot-directdisk.bbclass (like
qcow2) because the build_boot_dd() method relied on the symlink.

(From OE-Core rev: 0d02159c8d66bb136f7da2c10fda7d1a57f40cec)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-07 22:10:54 +00:00
Patrick Ohly 26ee4ddc65 image creation: allow overriding .rootfs suffix
By default, the image file name contains ".rootfs" to distinguish the
image file from other files created during image building. However,
for certain image types (for example, .hddimg) the ".rootfs" suffix is
redundant because the type suffix alone already uniquely identifies
the main image file (core-image-minimal-intel-corei7-64.hddimg instead
of core-image-minimal-intel-corei7-64.rootfs.hddimg).

With this change, distros that prefer the shorter image name can
override the .rootfs suffix unconditionally with
   IMAGE_NAME_SUFFIX ?= '' in their distro configuration
or with some condition check like this:
   python () {
       if <whole-disk image format active>:
           d.setVar('IMAGE_NAME_SUFFIX', '')
   }

The exact logic when to remove the extra suffix depends on the distro
and how it enables its own image type.

(From OE-Core rev: 380ee36811939d947024bf78de907e3c071b834f)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-07 17:17:43 +00:00
Richard Purdie 25871016e0 image: Run do_rootfs_wicenv after do_image
do_image can modify the content of the rootfs directory so we need to run
do_rootfs_wicenv after do_image compeltes or the command can fail.

(From OE-Core rev: 8f5429b5e543e122072a51b518cc137dfc8ec442)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28 11:27:46 +00:00
Chen Qi eb6d14e64c image/populate_sdk: seprate variables to fix dependency
Previously, do_rootfs depends on variables like SDK_OS, SDK_OUTPUT, etc.
And changing variables like POPULATE_SDK_POST_HOST_COMMAND doesn't cause
do_populate_sdk to rerun.

This patch separates variables so that do_rootfs and do_populate_sdk could
correctly depend on their related variables.

[YOCTO #8670]

(From OE-Core rev: 590cf4be70f1355622d3a94d76b4cc6d525d4a34)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-18 07:39:30 +00:00
Robert Yang 8a2dfa1691 image.bbclass: check INITRAMFS_MAXSIZE
Usually, the initramfs' maxsize can be 1/2 of ram size since modern
kernel uses tmpfs as initramfs by dafault, and tmpfs allocates 1/2 of
ram by default at boot time, which will be used to locate the initramfs.

Set INITRAMFS_MAXSIZE to 131072K (128M) by default (ram 256M), the
initramfs is small usually, for example, core-image-minimal-initramfs is
about 21M (uncompressed, 17M * 1.3) by default, but if the user add a
lot pkgs to initramfs, we can error and stop to let the user know ealier
rather than fail to boot (e.g., OOM-killer) at boot time.

Please see the bug for more info:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=5963

[YOCTO #5963]

(From OE-Core rev: 155ba626b46bf71acde6c24402fce1682da53b90)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-26 22:31:59 +00:00
Richard Purdie 6720bdac23 image: Don't create tasks with '.' in the name
Similarly to "-", "." doesn't work well in task names but is used in
some real world image classes. Work around this with some replacements
for now to unbreak layers.

(Issues don't show themselves until runtime, e.g. with --dry-run)

Tested-By: Otavio Salvador <otavio.salvador@ossystems.com.br>
(From OE-Core rev: f94d9be17d727b37dc655e7be272db2f290436aa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-26 18:05:13 +00:00
Richard Purdie 2e9f092c97 image: Handle image types containing '-' correctly
Shell function names can't contain '-' characters, which means our image
task names also can't. Add some mapping to use '_' instead of the '-' so
images like "rpi-sdimg" work again.

(From OE-Core rev: e609a4dea2f6d9744e7d2a6650bebf2c02398907)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:24:53 +00:00
Richard Purdie 0910bc65f5 image: Always run do_rootfs_wicenv
The wic command can be used externally but for this to work, the wic
environment file needs to be present. Therefore write this out
universally, it runs in parallel with other image construction so
any performance implications are negligible.

(From OE-Core rev: b2576f2eab10e4c5dd86449312b417a269cc578e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:24:47 +00:00
Richard Purdie 05716dd7ee bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE
Currently, iso and hddimg links don't respect RM_OLD_IMAGE. This
updates them to use the common symlinks code so that they behave
like the rest of the system.

(From OE-Core rev: 6a05cb64dfafd531d50454ef7141ff0290d01ca9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:24:47 +00:00
Richard Purdie d27491b694 image: Ensure we don't expand TMPDIR in image commands
Similarly to DATETIME, don't expand TMPDIR in image commands.
This ensures some of the stamp comparisons we make in the
QA tests work correctly.

(From OE-Core rev: a8c377beadb85b0ff503ec8ddd1a2cd05e363c19)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:24:47 +00:00
Richard Purdie ce8a2068d4 image: Fix instability of do_image_* checksums
The do_image_* tasks contained the expanded version of DATETIME. Due
to the expansion, we couldn't exclude the value from the task checksum
which meant the task would rerun.

We fix this by deleting the DATETIME value during expansion so we don't
expand any references to at that time. This means the task's hash can be
stable rather than having hardcoded date/time values. It will get expanded
at execution time.

This also fixes errors shown by -S:

NOTE: Reparsing files to collect dependency data
Writing locked sigs to /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/build/locked-sigs.inc
ERROR: Bitbake's cached basehash does not match the one we just generated (/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/recipes-sato/images/core-image-sato.bb.do_image_tar)!
ERROR: The mismatched hashes were 77872792556367f1dde49a1425caf1a0 and 9bb0aca6286ab7dd22d3c69964beb665

(From OE-Core rev: ecbc1db7ed1f9848dee69507de8eb289b8ddeba0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:24:47 +00:00
Richard Purdie fb1654fee4 image: Fix wic environment issues
The wic environment function needs to run after the rootfs size is
setup. We move this code to a specific task, and depend on that task
from the wic images and other places its needed.
This fixes:

======================================================================
FAIL: test_image_env (oeqa.selftest.wic.Wic)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/utils/decorators.py", line 106, in wrapped_f
    return func(*args, **kwargs)
  File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/wic.py", line 218, in test_image_env
    self.assertTrue(var in content, "%s is not in .env file" % var)
AssertionError: False is not true : ROOTFS_SIZE is not in .env file

(From OE-Core rev: 606f9e2d7d8d389c8d4f5c3090139d3bb780e09c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:24:46 +00:00
Richard Purdie b567235c0c image/image-live: Add back IMAGE_TYPES_MASKED support
IMAGE_TYPES_MASKED support was accidentally removed. The original
idea behind it was to remove some of the hardcoding in the core
image code, so do that for image-live and ensure the dependency
and masked variables correctly reflect the needs of the class.
This means we can remove all the hardcoded special cases since
image-vm already has the needed markup.

(From OE-Core rev: 9a2d4a3b8d7bb1cf7f1fb7fe47d5c002d9941c89)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-15 11:59:42 +00:00
Otavio Salvador e914e2ac15 image.bbclass: Handle image base type dependency properly
When a base image type has an implicit dependency (from IMAGE_TYPEDEP)
this has to be taken into account. This is a regression introduced by
OE-Core:c2dab18 (image: Create separate tasks for rootfs construction).

The issue has been found when building meta-fsl-arm based images which
does not include the rootfs image type explicitly in IMAGE_FSTYPES but
instead is added, using IMAGE_TYPEDEP, for the 'sdcard.gz' image.

Reported-by: Fabio Berton <fabio.berton@ossystems.com.br>
(From OE-Core rev: 191c7be3a6cc52911f244323072433f6a1172bf1)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-15 11:59:42 +00:00
Mark Hatle ea05e05826 image.bbclass: Unconditional includes of populate_sdk_ext fails
populate_sdk_ext requires uninative support, which is only available on
glibc based SDKMACHINES.  For instance, when using mingw32 a dependency
error will occur:

NOTE: Runtime target 'nativesdk-glibc' is unbuildable, removing...
ERROR: Required build target 'core-image-minimal' has no buildable providers.
Missing or unbuildable dependency chain was: ['core-image-minimal', 'uninative-tarball', 'nativesdk-glibc']

This is dues to populate_sdk_ext.bbclass having:
do_populate_sdk_ext[depends] += "buildtools-tarball:do_populate_sdk uninative-tarball:do_populate_sdk"
addtask populate_sdk_ext

Since bitbake can't determine for dependency resolution if the task is going
to be run yet, it blows up and says it simply can't be resolved.

Workaround this problem by making the inherit conditional on the SDK_OS
containing 'linux'.

(From OE-Core rev: e471ce3464d5ae024315d4839cccd4c651f9ba83)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-15 11:54:48 +00:00
Richard Purdie 3341f3fbee classes: Fix do_rootfs references
After the separation of do_rootfs, some rootfs references need changing
to image_complete.

(From OE-Core rev: 59a5f596ca29b1eb8283706e3c60fbb39f9c2c23)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-11 23:26:29 +00:00
Richard Purdie 0a4e1f968a image: Create separate tasks for rootfs construction
This patch splits the code in lib/oe/image into separate tasks, one per
image type. This removes the need for the simple task graph code and defers
to the bitbake task management code to handle this instead.

This is a good step forward in splitting up the monolithic code and starting
to make it more accessible to people.

It should also make it easier for people to hook in other tasks and processes
into the rootfs code.

Incidentally, the reason this code was all combined originally was due to
limitations of fakeroot where if you exited the session, you lost permissions
data. With pseudo this constraint was removed.

We did start to rework the rootfs/image code previously and got so far with
untangling it however we did prioritise some performance tweaks over splitting
into separate tasks and in hindsight, this was a mistake and should have been done
the other way around. That work was suspended due to changes in the people working
on the project but this split has always been intended, now is the time to finish
it IMO.

There were some side effects of doing this:

* The symlink for the manifest moves to the rootfs-postcommands class and into
  the manifest function.
* There is no seperate "symlink removal" and "symlink creation", they are merged
* The date/time stamps of the manifest and the built images can now be different since
  the tasks can be run separately and the datetime stamp will then be different
  between do_rootfs and the do_image_* tasks.

(From OE-Core rev: c2dab181c1cdabac3be6197f4b9ea4235cbbc140)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-11 23:26:29 +00:00
Richard Purdie fdced52387 image: Move pre/post process commands to bbclass
As the next step in splitting up do_image, move the pre and post processing
commands to separate tasks. This also creates the do_image_complete task
which acts as the end marker task for image generation.

(From OE-Core rev: 800528eaa421d451b596545125cb218e08989151)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-11 23:26:29 +00:00
Richard Purdie cdc0aeed9b image.bbclass: Separate out image generation into a new task, do_image
I've heard complaints from people trying to create more interesting image
types about how hard it is to understand the rootfs/image generation code
and that its a pain to develop/test/debug.

Having looked at it myself, the internal construction of shell functions which
then gets passed into a multiprocessing pool is rather convoluted and it places
rather odd constraints on when variables are expanded. Its therefore no wonder
people find it confusing/complex.

This patch starts the process of splitting this up by separating out image
generation from the do_rootfs task into a new do_image task.

(From OE-Core rev: 57578d0ca6c3aaf6edf0af2c4862d43c97415156)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-11 23:26:29 +00:00
Richard Purdie 2c5e7e04f1 image: Really remove lockfiles flag
This was supposed to be removed by a previous patch but was readded.
Really remove it.

(From OE-Core rev: 5661d8cb7849df62358368743134c0aaf523965e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-07 13:42:12 +00:00
Richard Purdie 401c632508 image: Condense do_rootfs function/flags
Various prefuncs and flags and addtask statements make sense to belong together
in one clearer function now, this patch cleans things up a bit.

(From OE-Core rev: eae0cf7875197f9520be54370bc670e27338aad3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-06 15:27:33 +00:00
Richard Purdie 0051510ae3 image/rootfs-postcommands: Separate out post rootfs commands to separate class
Reading image.bbclass is a little difficult as it has many post rootfs
helper functions and its hard to separate those from the core contents
of the rootfs/image code.

Moving it to a separate class would be one way of making it clearer
what these functions are. There are some comment layout improvements
but no code changes.

(From OE-Core rev: df4cb51c8e60fa46d4d15be8da3d84287ff08ae7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-06 15:27:33 +00:00
Richard Purdie 3428eddcd1 image: Remove pointless rootfs lock
It was added in aa3141e979 back in 2008
but I don't see why multiple images would need this now.

(From OE-Core rev: 2eaeac6d98c310cb2602ba194d934c5b7bed253d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-06 15:27:33 +00:00
Alexander Kanavin d592abd255 image.bbclass: tweak the key location for dropbear when rootfs is readonly
In the same way it's done for openssh.

(From OE-Core rev: a4b91f5199dd4d1302484cbd972a484d36f7886f)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-01 07:43:37 +01:00
Alexander Kanavin 006497e36a image.bbclass: when building a readonly rootfs, tweak ssh settings regardless of init system in use
Previously it was done only if sysvinit was in DISTRO_FEATURES.

(From OE-Core rev: 8aa5c66a29c1394e0418e94bdd49e5b268ffc790)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-01 07:43:36 +01:00
Patrick Ohly 5f371e5a0b image types: add hdddirect
When image-vm.bbclass was introduced, it indirectly also introduced a
".hdddirect" image type based on boot-directdisk.bbclass. However, one
could only get that image when also enabling at least one of the
virtual machine images.

The .hdddirect images are useful by themselves. By registering
image-vm.bbclass as implementation of it, it becomes possible to
select them with:
  IMAGE_FSTYPES = "hdddirect"

(From OE-Core rev: e3ff509091cbbfdef851f8a3c9e31c7b76d37e89)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-28 12:00:21 +01:00
Christopher Larson 6c05e6a71a image.bbclass: add do_rootfs vardeps for {COMPRESS, IMAGE}_CMD_*
We want do_rootfs to rerun if the fstype or compression commands or
dependencies change for any of our configured fstypes (IMAGE_FSTYPES).
IMAGE_TYPEDEP isn't explicitly handled, as it's traversed already, so the end
result will change if it does, and we only really care about the results, not
how we got there. This uses oe.image.Image()._get_image_types() to get the
info about the image and compression types in use.

(From OE-Core rev: a3473d1ee30f8ec688d57dddb6e3c2b887194384)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-18 09:05:26 +01:00
Christopher Larson 635d38594c image.bbclass: add rootfs_check_host_user_contaminated
This function is intended to be used in ROOTFS_POSTPROCESS_COMMAND, and checks
for any paths outside of /home which are owned by the user running bitbake.

(From OE-Core rev: 72903f7534cccad35886f2cad8aac98a59392ec7)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-04 16:23:48 +01:00
Christopher Larson b3d8b37428 image.bbclass: re-run do_rootfs when feature packages change
Currently, FEATURE_PACKAGE_<feature> isn't in any vardeps, so changing the
packages for a feature won't change the checksum for do_rootfs. Rather than
explicitly adding those to vardeps, just use the expanded form of
FEATURE_INSTALL and FEATURE_INSTALL_OPTIONAL, so the actual list of packages
from the features goes into the checksum.

(From OE-Core rev: fdd1669e04bd8219344b1896b9d9c6a187e4f84e)

(From OE-Core rev: 9697d13e48633515b80b2ab9bab84ca54ce3ed48)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-30 12:35:58 +01:00
Christian Ziethén 2963cc25af image: Support for qcow2
Add support for qcow2 image format. Implemented in the same way as
the previously existing vmdk and vdi solutions.

(From OE-Core rev: c1f9ed400e4b5fe5be4fac86021dea11a7546035)

Signed-off-by: Christian Ziethén <christian.ziethen@linaro.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-25 14:41:43 +01:00
Gary Thomas 6e78cc4fad *image.bbclass: Consolidate ROOTFS_POSTPROCESS_COMMANDs
Move ROOTFS_POSTPROCESS_COMMANDs from core-image.bbclass to
image.bbclass so that images built using just image.bbclass
will benefit from them.  Without this change, an image built
using image.bbclass did not honor read-only-rootfs image feature.

(From OE-Core rev: 2d310470d95f7b387dcde605e4691ee505fc3b4d)

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-23 08:48:39 +01:00
Richard Purdie 86d30d756a meta: Add explict getVar param for (non) expansion
Rather than just use d.getVar(X), use the more explict d.getVar(X, False)
since at some point in the future, having the default of expansion would
be nice. This is the first step towards that.

This patch was mostly made using the command:

sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *`

(From OE-Core rev: ab7c1d239b122c8e549e8112c88fd46c9e2b061b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:57:25 +01:00
Juro Bystricky a13c51e751 image: Support for VDI
Added support for VirtualBox VDI format. The support was
implemented by merging with the already existing VMDK support
for VM player by creating a new class image-vm.bbclass.
This class replaces the previous VMDK only image-vmdk.class.

(From OE-Core rev: 0a3e8eb9f592c3f1edd2c7521855f7406541651a)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-11 23:59:13 +01:00
Mark Hatle 7a7c6b021f image.bbclass: Add a method for creating a companion debug filesystem
The companion debug filesystem contains only the package database and the
complementary *-dbg packages for the main filesystem component.  This is
useful in a production environment to produce a companion filesystem capable
of remote system debugging, without requiring corresponding debug symbols or
source code on the device.

(From OE-Core rev: 1a6ed48c65f922c66b005aa966d7ee4878ee95e3)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>

If dbg pkgs have already been installed to the rootfs image,
the installation to companion debug filesystem will fail,
because both of image creation make use of the same pm
database.

In this situation, try to copy installed dbg files from rootfs
image to companion debug filesystem.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Acked-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-24 07:19:21 +01:00
tprrt 376b6b7068 image: zap_empty_root_password doesn't handle passwd file in shadow case
/etc/passwd isn't editted if /etc/shadow exists and should be else
it can cause problems with some login providers such as toybox.

(From OE-Core rev: 09ac2664fba223111c20c3000af6b8d5cdaabeb1)

Signed-off-by: tprrt <tprrt@tupi.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-24 11:06:55 +01:00
Martin Jansa 50c2ef0a5d image.bbclass: Allow to remove do_rootfs -> virtual/kernel:do_packagedata dependency
* this is causing dependency loops in some cases
  e.g. linux-hp-tenderloin depends on initramfs-android-image, but
    commit 41f0f86ec0a3e0b6f6c9bb4ef71a4215c00bf66c
    Author: Richard Purdie <richard.purdie@linuxfoundation.org>
    Date:   Tue Jan 27 15:24:52 2015 +0000
    Subject: image: Add missing depends on virtual/kernel for depmod data
  adds also dependency between <image>.do_rootfs and virtual/kernel:do_packagedata
  causing this dependency loop:

Dependency loop #1 found:
  Task 78 (meta-smartphone/meta-hp/recipes-kernel/linux/linux-hp-tenderloin_git.bb, do_install)
    (dependent Tasks ['linux-hp-tenderloin, do_compile',
                      'pseudo, do_populate_sysroot'])
  Task 88 (meta-smartphone/meta-hp/recipes-kernel/linux/linux-hp-tenderloin_git.bb, do_package)
    (dependent Tasks ['rpm, do_populate_sysroot',
                      'pseudo, do_populate_sysroot',
                      'linux-hp-tenderloin, do_install',
                      'initramfs-android-image.bb, do_packagedata',
                      'glibc, do_packagedata',
                      'file, do_populate_sysroot',
                      'gcc-runtime, do_packagedata'])
  Task 89 (meta-smartphone/meta-hp/recipes-kernel/linux/linux-hp-tenderloin_git.bb, do_package_write_ipk)
    (dependent Tasks ['linux-hp-tenderloin, do_package',
                      'opkg-utils, do_populate_sysroot',
                      'linux-hp-tenderloin, do_packagedata',
                      'pseudo, do_populate_sysroot'])
  Task 560 (meta-smartphone/meta-android/recipes-core/images/initramfs-android-image.bb, do_rootfs)
    (dependent Tasks ['bash, do_package_write_ipk',
                      'run-postinsts, do_package_write_ipk',
                      'db, do_package_write_ipk',
                      'update-rc.d, do_populate_sysroot',
                      'android-tools-conf, do_package_write_ipk',
		      'base-passwd, do_package_write_ipk',
                      'initramfs-boot-android, do_package_write_ipk',
		      'expat, do_package_write_ipk',
                      'bzip2, do_packagedata',
		      'glibc-initial, do_packagedata',
                      'openssl, do_package_write_ipk',
                      'bzip2, do_package_write_ipk',
		      'busybox, do_packagedata',
                      'zlib, do_packagedata',
		      'qemuwrapper-cross, do_packagedata',
                      'base-passwd, do_packagedata',
		      'busybox, do_package_write_ipk',
                      'zlib, do_package_write_ipk',
		      'qemuwrapper-cross, do_package_write_ipk',
		      'gcc-runtime, do_package_write_ipk',
		      'gettext, do_packagedata',
		      'initramfs-boot-android, do_packagedata',
		      'gettext, do_package_write_ipk',
		      'libgcc-initial, do_packagedata',
                      'expat, do_packagedata',
                      'gdbm, do_packagedata',
		      'depmodwrapper-cross, do_package_write_ipk',
                      'libgcc-initial, do_package_write_ipk',
                      'glibc-initial, do_package_write_ipk',
                      'linux-libc-headers, do_packagedata',
                      'glibc, do_packagedata',
                      'initramfs-android-image.bb, do_packagedata',
                      'glibc, do_package_write_ipk',
                      'sqlite3, do_packagedata',
                      'initramfs-android-image.bb, do_package_write_ipk',
                      'sqlite3, do_package_write_ipk',
                      'android-tools-conf, do_packagedata',
                      'ncurses, do_packagedata',
                      'openssl, do_packagedata',
                      'android-tools, do_packagedata',
                      'ncurses, do_package_write_ipk',
                      'cryptodev-linux, do_packagedata',
                      'android-tools, do_package_write_ipk',
                      'pseudo, do_populate_sysroot',
                      'cryptodev-linux, do_package_write_ipk',
                      'linux-libc-headers, do_package_write_ipk',
                      'depmodwrapper-cross, do_packagedata',
                      'linux-hp-tenderloin, do_packagedata',
                      'readline, do_package_write_ipk',
                      'opkg-utils, do_packagedata',
                      'linux-hp-tenderloin, do_package_write_ipk',
                      'python, do_packagedata',
                      'gdbm, do_package_write_ipk',
                      'opkg, do_populate_sysroot',
                      'python, do_package_write_ipk',
                      'libtool-cross, do_packagedata',
                      'db, do_packagedata',
                      'libgcc, do_packagedata',
                      'libtool-cross, do_package_write_ipk',
                      'update-rc.d, do_packagedata',
                      'update-rc.d, do_package_write_ipk',
                      'libgcc, do_package_write_ipk',
                      'opkg-utils, do_populate_sysroot',
                      'makedevs, do_populate_sysroot',
                      'readline, do_packagedata',
                      'base-files, do_packagedata',
                      'gcc-runtime, do_packagedata',
                      'opkg-utils, do_package_write_ipk',
                      'base-files, do_package_write_ipk',
                      'ldconfig-native, do_populate_sysroot',
                      'bash, do_packagedata',
                      'run-postinsts, do_packagedata'])
  Task 82 (meta-smartphone/meta-hp/recipes-kernel/linux/linux-hp-tenderloin_git.bb, do_compile)
    (dependent Tasks ['initramfs-android-image.bb, do_rootfs',
                      'linux-hp-tenderloin, do_configure'])

(From OE-Core rev: 2e3c8fd70694dcf9553b5e4c50a57b617a9130b6)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-20 15:29:11 +01:00
Randy Witt d2690754fe image.bbclass: Empty /var/volatile if it is a mount point
If /var/volatile is a mount point it shouldn't contain any files before
mount time. If files are there, they will no longer be able to be accessed
once the tmpfs gets mounted at /var/volatile.

This problem can be seen for instance when systemd creates
/var/volatile/log/journal as part of its package installation. It then
assumes the journal is persistent even though /var/volatile/log/journal
goes away shortly thereafter.

This change makes sure that there are no files in /var/volatile if it is
to be used as a mount point.

[Yocto #7388]

(From OE-Core rev: b574ac6f3c9e07f0054ed4261bc1f83583c29c53)

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-25 12:39:45 +00:00
Richard Purdie 96104b825f image: Ensure manifests end with a newline
Manifests should end with a newline character but don't currently. This
is the easiest fix for now, the alternative would be a rewrite of the
internal code which is something to consider in due course.

[YOCTO #7427]

(From OE-Core rev: 98230d2d049c742c349f35b256b13afbc3d26235)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-25 12:39:44 +00:00
Randy Witt 54567379ac populate_sdk_ext: add extensible SDK
This bbclass will create an SDK with a copy of bitbake and the metadata
and sstate for the target specified for the task. The idea is to let
"system" developers both work on applications and then test adding them
to an image without having to switch between workspaces or having to
download separate items.

Rather than running bitbake directly however, the primary way of running
builds within the extensible SDK is to use the "devtool" command. The
rest of the build system is fixed via locked shared state signatures,
and thus only the recipes you have added get built.

(From OE-Core rev: bf81d6bb7f6df5405b8f2148e2a22e0030c12757)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 17:41:43 +00:00
Saul Wold b7153be8ca image: add new items to IMAGE_FEATURES[validitems] list
Add the new items to the validitems list, this is fully tested, initial testing
had been done with a local change that did not make the original commit request

[YOCTO #7308]

(From OE-Core rev: 6e48bc5fbd834f19bdcac17007d27a750cc5f331)

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:02 +00:00
Chen Qi 1f292659c0 image.bbclass: don't let do_rootfs depend on BUILDNAME
BUILDNAME is set by cooker as a string of current time. Letting do_rootfs
task depend on this variable gets us no benefit. Besides, letting do_rootfs
task depend on this variable will cause us trouble when executing
`bitbake -S none core-image-minimal'. With current code, this command
gives us error complaining about the different bashhash of do_rootfs task.

(From OE-Core rev: eb6305d03723527830976c3a4ce2342a0e09eefc)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-08 08:00:26 +00:00
Saul Wold d42963a3fe core-image: split debug-tweaks into individual features
Split the debug-tweaks into a more fine tunable set of IMAGE_FEATURES
which activate the component functions.

Clean-up image-core and image bbclass by having the ROOTFS_POSTPROCESS_COMMANDs
in in one place for the debug-tweaks related functions

[YOCTO #5344]

(From OE-Core rev: e52d8281eb98dbade2d82451fa9788285121437e)

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-08 08:00:25 +00:00
Dan McGregor 491d1db8d1 image.bbclass: make kernel depmod data optional
This allows an image to skip the creation of kernel depmod
data. It is useful for creating an image that will run as a
container image inside a host with no knowledge of the parent's
kernel.

(From OE-Core rev: ca641aedff5f6bd155796ead02cb2eb871f8c17a)

Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-03 14:53:53 +00:00
Paul Eggleton 26e5b0f7b9 classes/image: ensure uninstalled packages do not appear in manifests
Since the rewrite of the image construction code in python a few
releases ago, we remove a couple of packages from the image as one of
the final steps when constructing the image (notably update-rc.d and
run-postinsts).  However, because of the order of operations, these
packages are still listed both in the buildhistory
installed_package*.txt files and in the manifest file created next to
the image, which is wrong.

There were two possible solutions to this: (1) change the order such
that the uninstallation occurs before calling ROOTFS_POSTPROCESS_COMMAND
or (2) add another hook variable in such that we can have the
package list collection code run at the right time. Because it's
currently possible (but very much not recommended) to install additional
packages within ROOTFS_POSTPROCESS_COMMAND, which may have postinstall
scripts and thus require the packages we would otherwise uninstall if we
were to take option 1, option 2 is really the least likely to cause
problems. Therefore, add ROOTFS_POSTUNINSTALL_COMMAND and make the image
and buildhistory classes use it.

Fixes [YOCTO #6479].

(From OE-Core rev: b198a189228648057c3be7d068598f50841b3bf9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-03 14:53:50 +00:00
Paul Eggleton 69c588b66d classes/image: skip recipe on invalid IMAGE_FEATURES item
If you add an item to EXTRA_IMAGE_FEATURES in your local.conf that is
not supported by image.bbclass itself (such as "tools-sdk" which is
implemented in core-image.bbclass), it can be somewhat annoying to have
the parse fall over if you have a recipe that inherits image.bbclass
only. Change the error from bb.fatal to skip the recipe instead so that
you only see the error when attempting to build the recipe, plus add a
bit of logic to report if the feature is coming in via
EXTRA_IMAGE_FEATURES.

Fixes [YOCTO #5023].

(From OE-Core rev: cbe9d2f748125aa2dffc829570d46f8dbc1781a4)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-03 14:53:50 +00:00