summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/imager/baseimager.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2013-09-19 04:32:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-01 22:53:52 +0100
commitf87acc5e59d3c2c39ff171b5557977dab4c8f4a6 (patch)
treeef0017d066a319e38aba507ef0ff85d1d863a17a /scripts/lib/mic/imager/baseimager.py
parent31f0360f1fd4ebc9dfcaed42d1c50d2448b4632e (diff)
downloadopenembedded-core-f87acc5e59d3c2c39ff171b5557977dab4c8f4a6.tar.gz
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. 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>
Diffstat (limited to 'scripts/lib/mic/imager/baseimager.py')
-rw-r--r--scripts/lib/mic/imager/baseimager.py82
1 files changed, 6 insertions, 76 deletions
diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index 6efc6c1294..4d6be29a0e 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/python -tt
#
# Copyright (c) 2007 Red Hat Inc.
@@ -69,9 +68,10 @@ class BaseImageCreator(object):
self.ks = None
self.name = "target"
- self.tmpdir = "/var/tmp/mic"
- self.cachedir = "/var/tmp/mic/cache"
- self.workdir = "/var/tmp/mic/build"
+ self.tmpdir = "/var/tmp/wic"
+ self.cachedir = "/var/tmp/wic/cache"
+ self.workdir = "/var/tmp/wic/build"
+
self.destdir = "."
self.installerfw_prefix = "INSTALLERFW_"
self.target_arch = "noarch"
@@ -463,7 +463,7 @@ class BaseImageCreator(object):
env[self.installerfw_prefix + "DISTRO_NAME"] = self.distro_name
# Name of the image creation tool
- env[self.installerfw_prefix + "INSTALLER_NAME"] = "mic"
+ env[self.installerfw_prefix + "INSTALLER_NAME"] = "wic"
# The real current location of the mounted file-systems
if in_chroot:
@@ -668,7 +668,7 @@ class BaseImageCreator(object):
if cachedir:
self.cachedir = cachedir
else:
- self.cachedir = self.__builddir + "/mic-cache"
+ self.cachedir = self.__builddir + "/wic-cache"
fs.makedirs(self.cachedir)
return self.cachedir
@@ -751,52 +751,8 @@ class BaseImageCreator(object):
self.__setup_tmpdir()
self.__ensure_builddir()
- # prevent popup dialog in Ubuntu(s)
- misc.hide_loopdev_presentation()
-
- fs.makedirs(self._instroot)
- fs.makedirs(self._outdir)
-
self._mount_instroot(base_on)
- for d in ("/dev/pts",
- "/etc",
- "/boot",
- "/var/log",
- "/sys",
- "/proc",
- "/usr/bin"):
- fs.makedirs(self._instroot + d)
-
- if self.target_arch and self.target_arch.startswith("arm"):
- self.qemu_emulator = misc.setup_qemu_emulator(self._instroot,
- self.target_arch)
-
-
- self.get_cachedir(cachedir)
-
- # bind mount system directories into _instroot
- for (f, dest) in [("/sys", None),
- ("/proc", None),
- ("/proc/sys/fs/binfmt_misc", None),
- ("/dev/pts", None)]:
- self.__bindmounts.append(
- fs.BindChrootMount(
- f, self._instroot, dest))
-
- self._do_bindmounts()
-
- self.__create_minimal_dev()
-
- if os.path.exists(self._instroot + "/etc/mtab"):
- os.unlink(self._instroot + "/etc/mtab")
- os.symlink("../proc/mounts", self._instroot + "/etc/mtab")
-
- self.__write_fstab()
-
- # get size of available space in 'instroot' fs
- self._root_fs_avail = misc.get_filesystem_avail(self._instroot)
-
def unmount(self):
"""Unmounts the target filesystem.
@@ -805,34 +761,8 @@ class BaseImageCreator(object):
from the install root.
"""
- try:
- mtab = self._instroot + "/etc/mtab"
- if not os.path.islink(mtab):
- os.unlink(self._instroot + "/etc/mtab")
-
- if self.qemu_emulator:
- os.unlink(self._instroot + self.qemu_emulator)
- except OSError:
- pass
-
- self._undo_bindmounts()
-
- """ Clean up yum garbage """
- try:
- instroot_pdir = os.path.dirname(self._instroot + self._instroot)
- if os.path.exists(instroot_pdir):
- shutil.rmtree(instroot_pdir, ignore_errors = True)
- yumlibdir = self._instroot + "/var/lib/yum"
- if os.path.exists(yumlibdir):
- shutil.rmtree(yumlibdir, ignore_errors = True)
- except OSError:
- pass
-
self._unmount_instroot()
- # reset settings of popup dialog in Ubuntu(s)
- misc.unhide_loopdev_presentation()
-
def cleanup(self):
"""Unmounts the target filesystem and deletes temporary files.