mirror of
https://git.yoctoproject.org/poky
synced 2026-09-13 09:49:32 +02:00
wic: Extend --rootfs-dir to connect rootfs-dirs
The wic command-line param --rootfs-dir gets generalized to support
multiple directories. Each '--rootfs-dir' could be connected using a
special string, that should be present in .wks. I.e:
wic create ... --rootfs-dir rootfs1=/some/rootfs/dir \
--rootfs-dir rootfs2=/some/other/rootfs/dir
part / --source rootfs --rootfs-dir="rootfs1" --ondisk sda --fstype=ext3 \
--label primary --align 1024
part /standby --source rootfs --rootfs-dir="rootfs2" \
--ondisk sda --fstype=ext3 --label secondary --align 1024
The user could use harded-code directory instead of connectors. Like this:
wic create ... hard-coded-path.wks -r /some/rootfs/dir
part / --source rootfs --ondisk sda --fstype=ext3 --label primary --align 1024
part /standby --source rootfs --rootfs-dir=/some/rootfs/dir \
--ondisk sda --fstype=ext3 --label secondary --align 1024
(From OE-Core rev: 719d093c40e4c259a4c97d6c8a5efb5aeef5fd38)
Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
3c00384884
commit
ba65fe654a
@@ -84,16 +84,18 @@ class DirectImageCreator(BaseImageCreator):
|
||||
self.hdddir = hdddir
|
||||
self.staging_data_dir = staging_data_dir
|
||||
|
||||
def __write_fstab(self):
|
||||
def __write_fstab(self, image_rootfs):
|
||||
"""overriden to generate fstab (temporarily) in rootfs. This
|
||||
is called from mount_instroot, make sure it doesn't get called
|
||||
from BaseImage.mount()"""
|
||||
|
||||
image_rootfs = self.rootfs_dir
|
||||
|
||||
parts = self._get_parts()
|
||||
if image_rootfs is None:
|
||||
return None
|
||||
|
||||
fstab = image_rootfs + "/etc/fstab"
|
||||
if not os.path.isfile(fstab):
|
||||
return None
|
||||
|
||||
parts = self._get_parts()
|
||||
|
||||
self._save_fstab(fstab)
|
||||
fstab_lines = self._get_fstab(fstab, parts)
|
||||
@@ -126,6 +128,8 @@ class DirectImageCreator(BaseImageCreator):
|
||||
|
||||
def _restore_fstab(self, fstab):
|
||||
"""Restore the saved fstab in rootfs"""
|
||||
if fstab is None:
|
||||
return
|
||||
shutil.move(fstab + ".orig", fstab)
|
||||
|
||||
def _get_fstab(self, fstab, parts):
|
||||
@@ -235,8 +239,6 @@ class DirectImageCreator(BaseImageCreator):
|
||||
|
||||
self.__instimage = PartitionedMount(self._instroot)
|
||||
|
||||
fstab = self.__write_fstab()
|
||||
|
||||
for p in parts:
|
||||
# as a convenience, set source to the boot partition source
|
||||
# instead of forcing it to be set via bootloader --source
|
||||
@@ -263,6 +265,9 @@ class DirectImageCreator(BaseImageCreator):
|
||||
p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
|
||||
self.bootimg_dir, self.kernel_dir, self.native_sysroot)
|
||||
|
||||
fstab = self.__write_fstab(p.get_rootfs())
|
||||
self._restore_fstab(fstab)
|
||||
|
||||
self.__instimage.add_partition(int(p.size),
|
||||
p.disk,
|
||||
p.mountpoint,
|
||||
@@ -273,7 +278,6 @@ class DirectImageCreator(BaseImageCreator):
|
||||
boot = p.active,
|
||||
align = p.align,
|
||||
part_type = p.part_type)
|
||||
self._restore_fstab(fstab)
|
||||
self.__instimage.layout_partitions(self._ptable_format)
|
||||
|
||||
self.__imgdir = self.workdir
|
||||
|
||||
Reference in New Issue
Block a user