summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
AgeCommit message (Collapse)Author
2017-03-31wic: allow only supported fstypesEd Bartosh
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>
2017-03-31wic: remove fsimage pluginEd Bartosh
Removed fsimage plugin and prepare_rootfs_from_fs_image API as they duplicate functionality of rawcopy plugin. Fsimage plugin makes wic to remove the image artifact from deployment directory, which can cause problems too. [YOCTO #10618] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-03-21wic: partition.py: Add fsck to avoid corrupt EXT file systemsDaniel Schultz
This patch avoids the creation of a corrupt EXT file system. Since there are no checks if a EXT file system was successfully created, this should add to prevent possible system failures. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-04wic: move PluginMgr class to pluginbaseEd Bartosh
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>
2017-03-04wic: remove PluginMgr.get_plugin_methodsEd Bartosh
Call methods directly instead of getting them with get_plugin_methods and then calling. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-03-04wic: reimplement PluginMgr.get_plugin_methodsEd Bartosh
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>
2017-03-04wic: remove PluginMgr.get_source_pluginsEd Bartosh
Used get_plugins('source') instead of get_source_plugins to unify and simplify API to get plugins. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-03-04wic: use PluginMgr directlyEd Bartosh
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>
2017-03-04wic: move WicError to lib/wic/__init__.pyEd Bartosh
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>
2017-03-04wic: raise WicError in core modulesEd Bartosh
Replaced sys.exit with raising WicError in the core wic modules. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-03-04wic: use wic logger in core modulesEd Bartosh
Replaced msger with wic logger in the core wic modules. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-15wic: Add --exclude-path option to rootfs source plugin.Kristian Amlie
It will omit the given path from the resulting partition, and if the given path ends in a slash, it will only delete the content, and keep the directory. Since mkfs only accepts whole directories as input, we need to copy the rootfs directory to the workdir so that we can selectively delete files from it. Since we want to use the copyhardlinktree() function, we need to put the generic oe lib in the module search path. Signed-off-by: Kristian Amlie <kristian.amlie@mender.io> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-15wic: use the same partition object in direct and partitionedfsEd Bartosh
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>
2017-02-02wic: code cleanupEd Bartosh
Fixed indentation, unused imports, trailing lines etc. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: move oe/misc.py one level upEd Bartosh
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>
2017-02-02wic: partition: simlify calling plugin methodsEd Bartosh
Replaced parse_sourceparams function with list comprehension. Used local variables instead of attributes. Moved global variable to the local scope. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-23partition.py: use FAKEROOTCMD variable to get path to pseudoEd Bartosh
wic used native sysroot to get path to pseudo utility. This approach doesn't work with recipe specific sysroots. Using FAKEROOTCMD should fix the issue. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2016-12-22wic: add --fixed-size wks optionMaciej Borzecki
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-17wic: obey the rootfs size from the metadataChristopher Larson
When no --size is specified for the rootfs in the .wks, we want to obey the rootfs size from the metadata, otherwise the defined IMAGE_ROOTFS_EXTRA_SPACE and IMAGE_OVERHEAD_FACTOR will not be obeyed. In some cases, this can result in image construction failure, if the size determined by du was insufficient to hold the files without the aforementioned extra space. This fallback from --size to ROOTFS_SIZE was already implemented when --rootfs-dir is specified in the .wks, but it did not occur otherwise, neither when --rootfs-dir= was passed to `wic create` nor when IMAGE_ROOTFS was used. This made a certain amount of sense, as this fallback logic happened at such a level that it wasn't able to identify which partitions were rootfs partitions otherwise. Rather than doing it at that level, we can do it in prepare_rootfs(), which is run by the rootfs source plugins. Note that IMAGE_OVERHEAD_FACTOR and a --overhead-factor in the .wks will now both be applied when --size isn't specified in the .wks. A warning is added about this, though a user won't see it unless wic fails or they examine the do_image_wic log. Fixes [YOCTO #10815] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-15wic: check that filesystem is specified for a rootfs partitionMaciej Borzecki
We explicitly check for --fstype if no source was provided for a partition. However, this was not the case for rootfs partitions. Make sure to raise an error if filesystem was left unspecified when preparing a rootfs partition image. Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-15wic: use partition size when creating empty partition filesMaciej Borzecki
It seems that prepare_empty_partition_ext() and prepare_empty_partition_btrfs() got broken in commit c8669749e37fe865c197c98d5671d9de176ff4dd, thus one could observe the following backtrace: Backtrace: File "<snip>/poky/scripts/lib/wic/plugins/imager/direct_plugin.py", line 93, in do_create creator.create() File "<snip>/poky/scripts/lib/wic/imager/baseimager.py", line 159, in create self._create() File "<snip>/poky/scripts/lib/wic/imager/direct.py", line 290, in _create self.bootimg_dir, self.kernel_dir, self.native_sysroot) File "<snip>/poky/scripts/lib/wic/partition.py", line 146, in prepare method(rootfs, oe_builddir, native_sysroot) File "<snip>/poky/scripts/lib/wic/partition.py", line 325, in prepare_empty_partition_ext os.ftruncate(sparse.fileno(), rootfs_size * 1024) NameError: name 'rootfs_size' is not defined Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-15wic: make sure that partition size is always an integer in internal processingMaciej Borzecki
The size field of Partition class is expected to be an integer and ought to be set inside prepare_*() method. Make sure that this is always the case. Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-06wic: call os.ftruncate instead of running truncateEd Bartosh
Replaced running of truncate utility with the standard library call os.ftruncate Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-10-07wic: generate PARTUUID for MDOS partitionsEd Bartosh
Added generation of partition UUIDs for MSDOS partitions. UUID for MSDOS partitions is <disk identifier>-<partition number>, where disk identifier is a random 4 bytes long number. It's usually generated when MBR/partition table is initialized. As UUID is used to point to the root partition in bootloader config we need to generate it before the MBR is initialized. After MBR is created we need to rewrite system identifier to match it with what is used in bootloader config. This will be implemented in the next commit. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-03image-live, image-vm, wic: Remove fs size workaroundJussi Kukkonen
Since mtools has been patched to live with filesystems with sizes not divisible by sectors-per-track, we no longer need to try to set the size based on our guess of the sectors-per-track dosfstools is going to use. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: don't inherit classes from objectEd Bartosh
All classes in Python3 are new style classes and don't need to be inherited from object. Wic code works fine without this inheritance even with Python2, so it's harmless to remove it. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: use truncate utility to create sparse filesEd Bartosh
Used truncate instead of dd to create wic images for the following reasons: - dd doesn't preserve sparseness - truncate syntax is much more clear - dd requires additional calculations of the image size in blocks - the way dd was used in the code is not always correct. In some cases it was writing one block to the file which makes it not 100% sparse. [YOCTO #9099] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-29wic: add system_id attribute to PartitionEd Bartosh
Added Partition.system_id attribute and initialized it from parse result of wks option --system-id. It will be used by the wic code below the call stack to set partition system id. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-02-28wic: don't throw away our created swap partitionChristopher Larson
We were creating the partition, mkswap'ing it, and then not dd'ing it into place in the final image, as source_file wasn't being set for swap partitions. This would result in a swap partition that couldn't be enabled on target until mkswap was run. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-02-15wic: fix processing of --use-uuidEd Bartosh
Processing of this option was lost during recent change of wks parsting. It was discovered during the work on booting wic images under qemu. Now, when -use-uuid is fixed it's possible to specify root partition by partition uuid. This will be done in the following commit. (From OE-Core rev: b4882e0b84d7fd4c85ee95386e94722485eafc2b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-17wic: add partition moduleEd Bartosh
Copied partition-related API from kickstart/custom_commands/partition.py to separate module in preparation for removal of all pykickstart related code. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>