1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-16 03:47:03 +00:00

wic: Add OpenEmbedded-specific implementation

Reuses the mic/livecd infrastructure but heavily subclasses and
modifies it to adapt to the special needs of building images from
existing OpenEmbedded build artifacts.

In addition to the OE-specific mic objects and modifications to the
underlying infrastructure, this adds a mechanism to allow OE kickstart
files to be 'canned' and made available to users via the 'wic list
images' command.

Two initial OE kickstart files have been added as canned .wks files:
directdisk, which implements the same thing as the images created by
directdisk.bbclass, and mkefidisk, which can essentially be used as a
replacement for mkefidisk.sh.  Of course, since creation of these
images are now driven by .wks files rather than being hard-coded into
class files or scripts, they can be easily modified to generate
different variations on those images.  They also don't require root
priveleges, since they don't use mount to create the images.  They
don't however write to media like mkefidisk.sh does, but rather create
images that can be written onto media.

(From OE-Core rev: f87acc5e59d3c2c39ff171b5557977dab4c8f4a6)

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tom Zanussi
2013-09-19 04:32:19 +00:00
committed by Richard Purdie
parent 9fc88f96d4
commit 75c143a7ae
20 changed files with 1253 additions and 260 deletions
+8 -46
View File
@@ -23,29 +23,24 @@ from mic import kickstart
from mic.utils import misc, runner, proxy, errors
DEFAULT_GSITECONF = '/etc/mic/mic.conf'
def get_siteconf():
mic_path = os.path.dirname(__file__)
eos = mic_path.find('scripts') + len('scripts')
scripts_path = mic_path[:eos]
m = re.match(r"(?P<prefix>.*)\/lib(64)?\/.*", mic_path)
if m and m.group('prefix') != "/usr":
return os.path.join(m.group('prefix'), "etc/mic/mic.conf")
return DEFAULT_GSITECONF
return scripts_path + "/lib/image/config/wic.conf"
class ConfigMgr(object):
prefer_backends = ["zypp", "yum"]
DEFAULTS = {'common': {
"distro_name": "Default Distribution",
"plugin_dir": "/usr/lib/mic/plugins", # TODO use prefix also?
"plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
},
'create': {
"tmpdir": '/var/tmp/mic',
"cachedir": '/var/tmp/mic/cache',
"outdir": './mic-output',
"tmpdir": '/var/tmp/wic',
"cachedir": '/var/tmp/wic/cache',
"outdir": './wic-output',
"arch": None, # None means auto-detect
"pkgmgr": "auto",
@@ -75,7 +70,7 @@ class ConfigMgr(object):
"shell": False,
},
'bootstrap': {
"rootdir": '/var/tmp/mic-bootstrap',
"rootdir": '/var/tmp/wic-bootstrap',
"packages": [],
},
}
@@ -191,39 +186,6 @@ class ConfigMgr(object):
self.create['name_prefix'],
self.create['name_suffix'])
msger.info("Retrieving repo metadata:")
ksrepos = misc.get_repostrs_from_ks(ks)
if not ksrepos:
raise errors.KsError('no valid repos found in ks file')
for repo in ksrepos:
if 'baseurl' in repo and repo['baseurl'].startswith("file:"):
repourl = repo['baseurl'].replace('file:', '')
repourl = "/%s" % repourl.lstrip('/')
self.create['localrepos'].append(repourl)
self.create['repomd'] = misc.get_metadata_from_repos(
ksrepos,
self.create['cachedir'])
msger.raw(" DONE")
target_archlist, archlist = misc.get_arch(self.create['repomd'])
if self.create['arch']:
if self.create['arch'] not in archlist:
raise errors.ConfigError("Invalid arch %s for repository. "
"Valid arches: %s" \
% (self.create['arch'], ', '.join(archlist)))
else:
if len(target_archlist) == 1:
self.create['arch'] = str(target_archlist[0])
msger.info("\nUse detected arch %s." % target_archlist[0])
else:
raise errors.ConfigError("Please specify a valid arch, "
"the choice can be: %s" \
% ', '.join(archlist))
kickstart.resolve_groups(self.create, self.create['repomd'])
# check selinux, it will block arm and btrfs image creation
misc.selinux_check(self.create['arch'],
[p.fstype for p in ks.handler.partition.partitions])