summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2015-10-02 10:25:21 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-07 00:11:16 +0100
commita0d9d2d727d646d7847ca9824ae535f9e369d485 (patch)
tree730bfe5e3db23caab9aa7ee155ed1a45ab9c7e35
parent8ee9a933a5bfc8c1de95aa1770bfd64add12f927 (diff)
downloadpoky-a0d9d2d727d646d7847ca9824ae535f9e369d485.tar.gz
lib/oe/image.py: Add image generation for companion debug filesystem
The companion debug filesystem, enabled with IMAGE_GEN_DEBUGFS, was creating the companion filesystem but was missing the code to actually package it into a usable filesystem. The code (and associated documentation) will allow the debugfs to generate a companion tarball or other image. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta-yocto/conf/local.conf.sample.extended9
-rw-r--r--meta/conf/documentation.conf2
-rw-r--r--meta/lib/oe/image.py46
3 files changed, 48 insertions, 9 deletions
diff --git a/meta-yocto/conf/local.conf.sample.extended b/meta-yocto/conf/local.conf.sample.extended
index ccdd326827..bc765a100f 100644
--- a/meta-yocto/conf/local.conf.sample.extended
+++ b/meta-yocto/conf/local.conf.sample.extended
@@ -165,6 +165,15 @@
165# currently an example class is image_types_uboot 165# currently an example class is image_types_uboot
166# IMAGE_CLASSES = " image_types_uboot" 166# IMAGE_CLASSES = " image_types_uboot"
167 167
168# The following options will build a companion 'debug filesystem' in addition
169# to the normal deployable filesystem. This companion system allows a
170# debugger to know the symbols and related sources. It can be used to
171# debug a remote 'production' system without having to add the debug symbols
172# and sources to remote system. If IMAGE_FSTYPES_DEBUGFS is not defined, it
173# defaults to IMAGE_FSTYPES.
174#IMAGE_GEN_DEBUGFS = "1"
175#IMAGE_FSTYPES_DEBUGFS = "tar.gz"
176
168# Incremental rpm image generation, the rootfs would be totally removed 177# Incremental rpm image generation, the rootfs would be totally removed
169# and re-created in the second generation by default, but with 178# and re-created in the second generation by default, but with
170# INC_RPM_IMAGE_GEN = "1", the rpm based rootfs would be kept, and will 179# INC_RPM_IMAGE_GEN = "1", the rpm based rootfs would be kept, and will
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 075ab6a332..845559a5e7 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -212,6 +212,8 @@ IMAGE_BOOT_FILES[doc] = "Whitespace separated list of files from ${DEPLOY_DIR_IM
212IMAGE_CLASSES[doc] = "A list of classes that all images should inherit." 212IMAGE_CLASSES[doc] = "A list of classes that all images should inherit."
213IMAGE_FEATURES[doc] = "The primary list of features to include in an image. Configure this variable in an image recipe." 213IMAGE_FEATURES[doc] = "The primary list of features to include in an image. Configure this variable in an image recipe."
214IMAGE_FSTYPES[doc] = "Formats of root filesystem images that you want to have created." 214IMAGE_FSTYPES[doc] = "Formats of root filesystem images that you want to have created."
215IMAGE_FSTYPES_DEBUGFS[doc] = "Formats of the debug root filesystem images that you want to have created."
216IMAGE_GEN_DEBUGFS[doc] = "When set to '1', generate a companion debug object/source filesystem image."
215IMAGE_INSTALL[doc] = "Specifies the packages to install into an image. Image recipes set IMAGE_INSTALL to specify the packages to install into an image through image.bbclass." 217IMAGE_INSTALL[doc] = "Specifies the packages to install into an image. Image recipes set IMAGE_INSTALL to specify the packages to install into an image through image.bbclass."
216IMAGE_LINGUAS[doc] = "Specifies the list of locales to install into the image during the root filesystem construction process." 218IMAGE_LINGUAS[doc] = "Specifies the list of locales to install into the image during the root filesystem construction process."
217IMAGE_NAME[doc] = "The name of the output image files minus the extension." 219IMAGE_NAME[doc] = "The name of the output image files minus the extension."
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index f9e9bfd587..b0d81a6b22 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -5,7 +5,7 @@ import multiprocessing
5 5
6 6
7def generate_image(arg): 7def generate_image(arg):
8 (type, subimages, create_img_cmd) = arg 8 (type, subimages, create_img_cmd, sprefix) = arg
9 9
10 bb.note("Running image creation script for %s: %s ..." % 10 bb.note("Running image creation script for %s: %s ..." %
11 (type, create_img_cmd)) 11 (type, create_img_cmd))
@@ -264,9 +264,9 @@ class Image(ImageDepGraph):
264 264
265 return (alltypes, filtered_groups, cimages) 265 return (alltypes, filtered_groups, cimages)
266 266
267 def _write_script(self, type, cmds): 267 def _write_script(self, type, cmds, sprefix=""):
268 tempdir = self.d.getVar('T', True) 268 tempdir = self.d.getVar('T', True)
269 script_name = os.path.join(tempdir, "create_image." + type) 269 script_name = os.path.join(tempdir, sprefix + "create_image." + type)
270 rootfs_size = self._get_rootfs_size() 270 rootfs_size = self._get_rootfs_size()
271 271
272 self.d.setVar('img_creation_func', '\n'.join(cmds)) 272 self.d.setVar('img_creation_func', '\n'.join(cmds))
@@ -284,7 +284,7 @@ class Image(ImageDepGraph):
284 284
285 return script_name 285 return script_name
286 286
287 def _get_imagecmds(self): 287 def _get_imagecmds(self, sprefix=""):
288 old_overrides = self.d.getVar('OVERRIDES', 0) 288 old_overrides = self.d.getVar('OVERRIDES', 0)
289 289
290 alltypes, fstype_groups, cimages = self._get_image_types() 290 alltypes, fstype_groups, cimages = self._get_image_types()
@@ -320,9 +320,9 @@ class Image(ImageDepGraph):
320 else: 320 else:
321 subimages.append(type) 321 subimages.append(type)
322 322
323 script_name = self._write_script(type, cmds) 323 script_name = self._write_script(type, cmds, sprefix)
324 324
325 image_cmds.append((type, subimages, script_name)) 325 image_cmds.append((type, subimages, script_name, sprefix))
326 326
327 image_cmd_groups.append(image_cmds) 327 image_cmd_groups.append(image_cmds)
328 328
@@ -355,6 +355,27 @@ class Image(ImageDepGraph):
355 355
356 image_cmd_groups = self._get_imagecmds() 356 image_cmd_groups = self._get_imagecmds()
357 357
358 # Process the debug filesystem...
359 debugfs_d = bb.data.createCopy(self.d)
360 if self.d.getVar('IMAGE_GEN_DEBUGFS', True) == "1":
361 bb.note("Processing debugfs image(s) ...")
362 orig_d = self.d
363 self.d = debugfs_d
364
365 self.d.setVar('IMAGE_ROOTFS', orig_d.getVar('IMAGE_ROOTFS', True) + '-dbg')
366 self.d.setVar('IMAGE_NAME', orig_d.getVar('IMAGE_NAME', True) + '-dbg')
367 self.d.setVar('IMAGE_LINK_NAME', orig_d.getVar('IMAGE_LINK_NAME', True) + '-dbg')
368
369 debugfs_image_fstypes = orig_d.getVar('IMAGE_FSTYPES_DEBUGFS', True)
370 if debugfs_image_fstypes:
371 self.d.setVar('IMAGE_FSTYPES', orig_d.getVar('IMAGE_FSTYPES_DEBUGFS', True))
372
373 self._remove_old_symlinks()
374
375 image_cmd_groups += self._get_imagecmds("debugfs.")
376
377 self.d = orig_d
378
358 self._write_wic_env() 379 self._write_wic_env()
359 380
360 for image_cmds in image_cmd_groups: 381 for image_cmds in image_cmd_groups:
@@ -369,9 +390,16 @@ class Image(ImageDepGraph):
369 if result is not None: 390 if result is not None:
370 bb.fatal(result) 391 bb.fatal(result)
371 392
372 for image_type, subimages, script in image_cmds: 393 for image_type, subimages, script, sprefix in image_cmds:
373 bb.note("Creating symlinks for %s image ..." % image_type) 394 if sprefix == 'debugfs.':
374 self._create_symlinks(subimages) 395 bb.note("Creating symlinks for %s debugfs image ..." % image_type)
396 orig_d = self.d
397 self.d = debugfs_d
398 self._create_symlinks(subimages)
399 self.d = orig_d
400 else:
401 bb.note("Creating symlinks for %s image ..." % image_type)
402 self._create_symlinks(subimages)
375 403
376 execute_pre_post_process(self.d, post_process_cmds) 404 execute_pre_post_process(self.d, post_process_cmds)
377 405