Age | Commit message (Collapse) | Author |
|
This should reduce the chance of generating 0xffffffff as the disk
system identifier.
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Zero may be interpreted as no MBR signature present and another
partitioning program might install a new MBR signature.
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
wic avoided adding /boot to fstab for no reason.
This exception was hardcoded in the wic code.
There is no need for this as mountpoint in .wks file is an optional
field. It can be used only if user wants to have partitions
automatically mounted on system boot.
[YOCTO #11662]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
wic updates /etc/fstab on root partition if there are
valid mount points in .wks
When wic runs from bitbake this can cause incorrect results
or even breakage of other tasks working with the same rootfs
directory in parallel with do_image_wic.
Implemented copying rootfs directory to a temporary location
using copyhardlinktree before updating fstab to avoid conflicts with
other tasks working with the same rootfs directory.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Total number of partitions should be taken into account when calculating
real partition number for msdos partition table. The number can be
different for the 4th partition: it can be 4 if there are 4 partitions in
the table and 5 if there are more than 4 partitions in the table. In the
latter case number 4 is occupied by extended partition.
[YOCTO #11790]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Wic updates fstab if mount points are specified in .wks.
After partition images are created the original fstab is restored.
However, if exception is raised when partition image being prepared
wic doesn't restore original fstab. This can cause duplication of
added lines in fstab when 'wic create' runs next time.
Wrapping call of 'prepare' method and restoring original fstab
even if exception occurs should fix this.
[YOCTO #11633]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Moved misc.py from wic/utils/ to wic/
Removed wic/utils directory
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Renamed parameter offset->skip to match names of dd
parameters.
Changed affected sparse_copy calls.
Added explanation of the parameters to docstring.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Explicitly set system id 0x6(FAT16) for msdos partitions.
Removed old code that attempts to achieve the same result
using 'parted ... lba off'.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Restricted possible values of --fstype to the list of
supported types. This should catch incorrect values
when .wks file is being parsed.
Removed checks for empty fstype and mentioning of
unsupported fstype 'ontrackdm6aux3'.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Partition UUID for msdos partitioning is based on a 4 bytes long
system identifier. Wic uses random number to generate system
identifier. For the numbers starting with 0 partition uuid is
shorter, which makes wic images non-bootable as kernel expects
8 charactest in PARTUUID parameter.
Padded system identifier with '0' when generating partition UUID
to make it always 8 characters long. This should fix the boot
issue.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
We don't need the gap that the extended partition occupies if we
already know that we have less than five partitions. Saves up to one
full alignment of space.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
If we are both having a bootloader and a U-Boot environment file, we
can end up with two entries using "--source rawcopy" and "--no-table",
and since they reuse the same file [1], their cleanup handlers will
try to delete the same file twice. So make sure we only do it once.
[1] Although they reuse the same file, the resulting output is
correct, so it appears the file is accessed in properly sequential
order.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
As PluginMgr class contains only one method it's
better to move it to pluginbase to have all plugin
related APIs in one module.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Call methods directly instead of getting them with
get_plugin_methods and then calling.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Simplified the implementation of get_plugin_methods:
- get rid of looping over the dicrtionary, used access by key instead
- get rid of filling a dictionary that passed as a parameter
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Instead of making a singleton object of PluginMgr class
it's simpler to use PluginMgr class directly as any class
is a singleton.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Removed unused exceptions from error.py
Moved definition of WicError to lib/wic/__init__.py
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
There is no need to raise special exceptions. Raising
WicError should be enough.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Replaced sys.exit with raising WicError in wic plugins.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Moved from lib/wic/utils/ to lib/wic as this is a core module.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Replaced msger with wic logger in the direct plugin.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Moved creation of PartitionedImage object from DirectPlugin.create
method to init. It makes the code a bit more readable and logical.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Moved the code that generates real partition numbers from DirectPlugin
to PartitionedImage.
The idea is to have all code that works with partitions
in PartitionedImage class.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Moved code that calls prepare method of Partition objects
from DirectPlugin to PartitionedImage.prepare.
The idea is to have all code that works with partitions
in PartitionedImage class.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Moved setting of bootloader source from do_create method
to __init__ as it doesn't have anything to do with image
creation.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Moved code that generates partition UUIDs from DirectPlugin to
PartitionedImage class as it's more logical to have it there.
This allows the code to be reused by other imager plugins.
Got rid of having yet another list of partitions in PartitionedImage.
Reused the list passed from DirectPlugin.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Replaced call of _get_part_num method with an attribute.
This eliminates the need to call the method and loop over
partitions every time we need to know realnum for partition.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Removed catching CreatorError and raising it again.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Don't transform ImagerError exception into warning.
Let wic to catch it on the upper level.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Removed java-like setter set_bootimg_dir. It's more pythonic
to access public attributes directly.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
As PartitionedImage is only used in direct.py it makes sense
to move it there. It's easier to maintain (and refactor) it
this way.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Disk operations were spread over DirectPlugin, DiskImage and Image
code making the code hard to understand.
Renamed Image class to PartitionedImage.
Removed DiskImage class.
Moved disk operations to PartitionedImage.
There was an implicit support for multiple disks: if different devices
were specified in .wks file (e.g. --ondisk sda and --ondisk sdb), wic
would theoretically generate multiple images. This is quite confusing
option and the code supporting it was broken for a long time. The same
effect (multiple output images) can be achieved in obvious and clear
way - by using multiple .wks files.
This functionality was removed. PartitionedImage works only with
one image. This makes the code less complex and easier to maintain.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
There is no need to pass scripts_path from main wic module
down the stack as it's not used there.
Removed scripts_path argument from DirectPlugin class
and wic_create function.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Removed unused import of wic.errors module.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Removed unused _disks, _disk_format and _disk_names
attributes from DirectPlugin class.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Partition attributes were copied to the dictionary in partitionedfs
code, which makes the code hard to follow.
Used partition object passed from direct.py module as is in
partitionedfs.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Replaced _get_parts getter with direct attribute
access to self.parts
Removed code that implicitly created partition
if there are no partitions mentioned in .wks file
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
wic code is hard to follow due to deep and twiggy class
inheritance tree.
Flatten imager tree:
wic -> wic_create -> Creator -> DirectPlugin -> DirectImageCreator
to
wic -> wic_create -> DirectPlugin
by
removing Creator class and creator module
merging DirectImageCreator into DirectPlugin
Changed APIs to use the same parameters names.
Passed parsed command line options as an object down the stack.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
It was a typo in current code: mktemp was used instead of
mkdtemp to create work directory. This is fixed by using
mkdtemp.
Create work directory as a subdirectory of output directory
to make sure both are on the same partition to make moving
of result image faster.
This also fixes possible disk space issues as mkdtemp uses
TMPDIR, TEMP or TMP environment variables to get default value
of its 'dir' parameter. Those variables are usually pointing
to /tmp, which is not the best location to create huge images.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Fixed indentation, unused imports, trailing lines etc.
[YOCTO #10619]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
Flattened directory structure:
moved wic/utils/oe/misc.py -> wic/utils/misc.py
[YOCTO #10619]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|
|
As this files is located in plugins/imager subdirectory it's
obvious that it's an imager plugin. Renamed to direct.py to
be consistent with plugin naming scheme.
[YOCTO #10619]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
|