mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-04 02:15:24 +01:00
Disk creation improvements
* Support specifying the size of the target disk image for qemu * For bare metal, only pad the image to the next megabyte * Use truncate() to extend images, instead of writing zeros (faster) * Return None from get_disk() with nonexistent name * Leave 1MiB on non-boot disks, or 1GiB on boot disks, unpartitioned (for proper 4K alignment and to help preserve the srcfs or boot partition creation) * Fix qemu invocation when an external.img is not used * Make -qr work with kernel bootstrap (will need kexec-fiwix fix)
This commit is contained in:
parent
dc62d8242c
commit
b4d9c5e7cb
4 changed files with 61 additions and 27 deletions
|
|
@ -60,10 +60,21 @@ class Tmpdir:
|
|||
self._type = TmpType.TMPFS
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def add_disk(self, name, size="16G", filesystem="ext4", tabletype="msdos", mkfs_args=None):
|
||||
def add_disk(self,
|
||||
name,
|
||||
size="16G",
|
||||
filesystem="ext4",
|
||||
tabletype="msdos",
|
||||
bootable=False,
|
||||
mkfs_args=None):
|
||||
"""Add a disk"""
|
||||
disk_path = os.path.join(self.path, f"{name}.img")
|
||||
self._disks[name] = create_disk(disk_path, tabletype, filesystem, size, mkfs_args=mkfs_args)
|
||||
self._disks[name] = create_disk(disk_path,
|
||||
tabletype,
|
||||
filesystem,
|
||||
size,
|
||||
bootable,
|
||||
mkfs_args)
|
||||
self._disk_filesystems[name] = filesystem
|
||||
# Allow executing user to access it
|
||||
run_as_root("chown", getpass.getuser(), self._disks[name])
|
||||
|
|
@ -87,4 +98,4 @@ class Tmpdir:
|
|||
|
||||
def get_disk(self, name):
|
||||
"""Get the path to a device of a disk"""
|
||||
return self._disks[name]
|
||||
return self._disks.get(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue