Bug 6704 - wic: bootimg_dir lost to source plugins when auto detecting
Summary: wic: bootimg_dir lost to source plugins when auto detecting
Status: RESOLVED OBSOLETE
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: deployment (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.8 M2
Assignee: Tom Zanussi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-09-10 15:04 UTC by Ola Nilsson
Modified: 2014-12-11 23:23 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ola Nilsson 2014-09-10 15:04:39 UTC
WIC autodetects the bootimg_dir as the value of HDDDIR.  On the way to the source plugin this value is lost. 

lib/wic/engine.py - find_artefacts detects hdddir as the value of the HDDDIR variable.  There is no autodetect for bootimg_dir. It can be defined on the command line but only if -e is not used.

Both values are passed to wic_create.

wic_create passes both values to Creator.main

Via some convoluted cmdln and plugin handling all of Creator.mains arguments end up in DirectPlugin.do_create, which passes them to DirectImageCreator.

DirectImageCreator's destructor stores them in member variables bootimg_dir and hdddir. 

The DirectImageCreator._create function seems to be the culprit as it passes self.bootimg_dir to Wic_PartData.prepare.  This seems logical as that is the name of the parameter.  But when the -e flag is used on the commandline the bootimg_dir variable is empty at this point, which is why the bootimg_efi source plugin has to look up the HDDDIR from a bitbake variable. 

It is hard for me to say what is 'right' in this situation.  The HDDDIR variable seems very specific to a certain type of system while the bootimg_dir is more general.  On the other hand there is no way to autodetect the bootimg_dir at the moment. And if HDDDIR is the correct variable then its value has to be passed along all the way to the source plugin.
Comment 1 Tom Zanussi 2014-12-11 23:23:52 UTC
I believe the following patch changes things so that this should no longer be a concern.  Basically bootimg_dir now only refers to the bootimg_dir defined on the command line, if specified, otherwise plugins are responsible for finding the bootimg_dir they need otherwise e.g HDDDIR or whatever.

commit 42d0334aa8bf59937262f957f2ea04abc271138b
Author: Tom Zanussi <tom.zanussi@linux.intel.com>
Date:   Wed Oct 29 17:04:23 2014 -0500

    wic: Remove special-case bootimg_dir

    The first iterations of wic very shortsightedly catered to two
    specific use-cases and added special-purpose params for those cases so
    that they could be directly given their corresponding boot artifacts.
    (hdddir and staging_data_dir).
    
    As more use-cases are added, it becomes rather obvious that such a
    scheme doens't scale, and additionally causes confusion for plugin
    writers.
    
    This removes those special cases and states explicitly in the help
    text that plugins are responsible for locating their own boot
    artifacts.