diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-05-03 09:59:42 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-05-09 11:03:20 +0000 |
commit | a93a71565b806f7331c37c458ec4f6ca9a6f3541 (patch) | |
tree | 30dc2f0c214d49948675410ab324ea69292768e9 /morphlib | |
parent | 07f0770ff2149aade385b4301212e1788ec4a472 (diff) | |
download | morph-a93a71565b806f7331c37c458ec4f6ca9a6f3541.tar.gz |
system image use systemd on vda1 and build in tmp
Use the tempdir of the staging area instead of the chroot directory
as the basedir for building system images.
It would be better to create it directly in the cache, then rename it
when finished, but commands need a filename and the cache provides an
open file handle.
Change the generated fstab and extlinux.conf to use systemd as the init
and expect the root filesystem to be on vda1 instead of sda1.
vda1 is slightly more efficient and is the default storage device for
libvirt.
This is safe to add before systemd is fully integrated, as if the
kernel can't find that file it run /sbin/init, which is busybox
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/builder2.py | 10 | ||||
-rw-r--r-- | morphlib/fsutils.py | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index 3ff4e811..68ba1ee3 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -349,10 +349,10 @@ class SystemBuilder(BuilderBase): # pragma: no cover def build_and_cache(self): with self.build_watch('overall-build'): logging.debug('SystemBuilder.do_build called') - self.ex = morphlib.execute.Execute(self.staging_area.dirname, + self.ex = morphlib.execute.Execute(self.staging_area.tempdir, logging.debug) - image_name = os.path.join(self.staging_area.dirname, + image_name = os.path.join(self.staging_area.tempdir, '%s.img' % self.artifact.name) self._create_image(image_name) self._partition_image(image_name) @@ -449,7 +449,7 @@ class SystemBuilder(BuilderBase): # pragma: no cover with open(fstab, 'w') as f: f.write('proc /proc proc defaults 0 0\n') f.write('sysfs /sys sysfs defaults 0 0\n') - f.write('/dev/sda1 / btrfs errors=remount-ro 0 1\n') + f.write('/dev/vda1 / btrfs errors=remount-ro 0 1\n') def _create_extlinux_config(self, path): logging.debug('Creating extlinux.conf in %s' % path) @@ -460,8 +460,8 @@ class SystemBuilder(BuilderBase): # pragma: no cover f.write('timeout 1\n') f.write('label linux\n') f.write('kernel /boot/vmlinuz\n') - f.write('append root=/dev/sda1 rootflags=subvol=factory-run ' - 'init=/sbin/init quiet rw\n') + f.write('append root=/dev/vda1 rootflags=subvol=factory-run ' + 'init=/lib/systemd/systemd rw\n') def _create_subvolume_snapshot(self, path, source, target): logging.debug('Creating subvolume snapshot %s to %s' % diff --git a/morphlib/fsutils.py b/morphlib/fsutils.py index 0a773ed5..15ad7ebf 100644 --- a/morphlib/fsutils.py +++ b/morphlib/fsutils.py @@ -55,7 +55,7 @@ def setup_device_mapping(ex, image_name): def create_fs(ex, partition): # FIXME: the hardcoded size of 4GB is icky but the default broke # when we used mkfs -t ext4 - ex.runv(['mkfs', '-t', 'btrfs', '-L', 'baserock', + ex.runv(['mkfs.btrfs', '-L', 'baserock', '-b', '4294967296', partition]) def mount(ex, partition, mount_point): |