summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/kickstart/custom_commands/partition.py
AgeCommit message (Collapse)Author
2016-01-17wic: remove pykickstart codeEd Bartosh
Removed pykickstart-related code as it's replaced by new kickstart parser. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-01wic: exec_native_cmd: implement support for pseudoEd Bartosh
Wic runs some tools through pseudo, which makes exec_native_cmd to fail and throw cryptic error message when tool is not baked: For example: Error: exec_cmd: 'export PSEUDO_PREFIX=/media/ssd/poky-build/tmp/sysroots/x86_64-linux/usr;export PSEUDO_LOCALSTATEDIR=/media/ssd/poky-build/tmp/work/qemux86-poky-linux/ ... PSEUDO_PASSWD=/media/ssd/poky-build/tmp/work/qemux86-poky-linux/ ... PSEUDO_NOSYMLINKEXP=1;/media/ssd/poky-build/tmp/sysroots/ ... mkfs.ext4 -F -i 8192 /var/tmp/wic/build/rootfs_platform.7.ext4 -L platform -d /media/ssd/poky-build/tmp/work/qemux86-poky-linux/core-image-minimal/... returned '1' instead of 0 Made exec_native_cmd aware of pseudo and properly report errors when command is not found. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-02wic: fix short variable namesEd Bartosh
Made short variable names longer and more readable. Fixed pylint warnings "Invalid variable name" and "Invalid argument name". Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-02wic: get rid of wildcard importsEd Bartosh
Used explicit imports in partitions.py and wicboot.py Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-02wic: fix errors in partition.py moduleEd Bartosh
Fixed the followring errors found by pylint in partition.py: E: 42, 0: class already defined line 33 (function-redefined) E:429,63: Undefined variable 'fs' (undefined-variable) E:432,37: Undefined variable 'fs' (undefined-variable) E:481, 0: class already defined line 33 (function-redefined) E:488,22: Undefined variable 'OptionValueError' (undefined-variable) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-02wic: remove micpartition.pyEd Bartosh
Moved functionality of Mic_Partition and Mic_PartData classes from micpartition.py to Wic_Partition and Wic_PartData classes of partition.py module. Reduced level of inheritance. Removed confusing mic legacy names. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-02wic: Code cleanup: long lines, identation and whitespacesEd Bartosh
Fixed pylint warnings bad-continuation, bad-continuation and line-too-long. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-07-02wic: Add --uuid partition optionEd Bartosh
Added --uuid option to the configuration of wks parser. This option specifies partition UUID. The code to process it is already in place. It was implemented for --use-uuid option. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-07-02wic: Fix naming conflictEd Bartosh
Image file name is not unique for the partitions without label. This causes image being rewritten and used as a source for all partitions without label. Wic produces broken or incorrect result images because of that. Added wks line number to the image name to make it unique.
2015-07-02wic: Remove duplicated codeEd Bartosh
Moved duplicated code of geting rootfs size out of prepare_rootfs* methods.
2015-07-02wic: Refactor prepare_empty_partition APIEd Bartosh
Moved code out of prepare_empty_partition* methods to avoid code duplication. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-07-02wic: Call methods better wayEd Bartosh
Shortened code by using getattr to obtain a method to call for prepare_empty_partition_* and prepare_rootfs_* methods. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-07-02wic: Get rid of useless variable 'image_rootfs'Ed Bartosh
Removed useless variable 'image_rootfs' from 4 prepare_rootfs_* methods. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-07-02wic: Refactor prepare_rootfs APIEd Bartosh
Moved code out of prepare_roots* methods to avoid code duplication. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-06-23wic: code cleanup: superfluous-parensEd Bartosh
Removed unncecessary parents after 'if' 'del' and 'print' keywords. Fixed pyling warning: Unnecessary parens after 'xxx' keyword Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2015-06-11wic: Fix format stringEd Bartosh
wic crashes with "TypeError: %d format: a number is required, not str" Due to incorrect format used for Wic_PartData.extra_size attribute. Using %s instead of %d should fix the crash. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-06-11wic: Generate random uuid for partitionEd Bartosh
'uuid' attribute of partition object is set to generated uuid when --use-uuid option is used for partition in .wks file. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-06-11wic: Add --use-uuid partition optionEd Bartosh
Added --use-uuid option to the configuration of wks parser. Processing of this option will be implemented in the following commits. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-06-11wic: move checks to exec_native_cmdEd Bartosh
Checked for return code and output of native commands inside exec_native_cmd. Removed similar code from a lot of places where exec_native_cmd is called. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-05-23wic: Make sure file exists before removing itEd Bartosh
Bunch of os.remove calls were added to the partition.py lately. They're causing wic to fail with OSError: [Errno 2] No such file or directory if file doesn't exist. Added check for file existence to all recently added calls of os.remove. That should fix this regression. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-05-16wic: remove intermediate partitionsAlexandre Belloni
Remove intermediate partitions that may have been created by a previous wic invocation. Those partitions are causing issues on some systems. In particular vfat partition creation is hanging on mcopy execution on Fedora. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-08wic: code cleanup: unused importsEd Bartosh
Fixed pylint warning 'Unused import' Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-20wic: Consider PSEUDO_* environment variablesEd Bartosh
Used default values of PSEUDO_* environment variables only if variables are not set. This allows to set custom PSEUDO_PREFIX and other pseudo variables in order to use pseudo database from non-standard locations. Change-Id: I0bc1af5e521121d1f96d590cb6edb23cf0cb0b83 Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-14wic: properly label filesystemsAlexandre Belloni
Use the partition label option, when available, to label the filesystem. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-14wic: fix empty btrfs partitionsAlexandre Belloni
btrfs emtpy partition creation is currently not working because of the usage of the non existant variables rootfs ans extra_imagecmd. It also as an incorrect size. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-14wic: allow to configure overhead factor per partitionAlexandre Belloni
Introduce a new option --overhead-factor to replace IMAGE_OVERHEAD_FACTOR. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-14wic: allow to configure extra space per partitionAlexandre Belloni
Introduce a new option --extra-space instead of using IMAGE_EXTRA_SPACE. This is useful for boot partitions where the extra space is often useless or for huge partition where 10MiB may not be enough. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-14wic: allow creation of partitions not in tableAlexandre Belloni
For some architectures it is necessary to reserve space on disk without it being present in the partition table. For example, u-boot on i.mx is placed at an offset of 1kB on the sdcard. While it would be possible to create a partition at that offset and place u-boot there, it would then be necessary to update the default u-boot environment to use partition 2 on the mmc instead of partition 1. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-07wic: use kB for the partitions sizeAlexandre Belloni
Use kB instead of MB for the partition size to get a better granularity. This is needed on some SoC (i.mx, omap) where it is necessary to create partitions as small as 64kB. Keep the backward compatibility by assuming MB when no unit is provided. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Tested-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2014-10-30wic: Use overhead factor when creating partitions from rootfs directoriesTom Zanussi
When creating partitions sized to given rootfs directories, filesystem creation could fail in cases where the calculated target partition size was too small to contain the filesystem created using mkfs. This occurred in particular when creating partitions to contain very large filesystems such as those containing sdk image artifacts. This same limition is present in the oe-core image creation classes, which can be readily see by changing IMAGE_OVERHEAD_FACTOR from the default 1.3 to 1.0 and building a sato-sdk image. It should be possible to calculate required sizes exactly given the source rootfs and target filesystem types, but for now, to address the specific problem users are hitting in such situations, we'll just do exactly what oe-core does and define and use an IMAGE_OVERHEAD_FACTOR or 1.3 in those cases. Fixes [YOCTO #6863]. Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-10-30wic: Don't allow mkfs to fail silently in partition commandTom Zanussi
The return code from the mkfs command used by the partition creation command was being ignored, allowing it to silently fail and leaving users mystified as to why the resulting filesystem was corrupted. This became obvious when failures occurred when creating large e.g. sdk filesystems [YOCTO #6863]. Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-23wic: fix vfat partition sector count only if neededMaciej Borzecki
VFAT rootfs partitions sector count would get updated always even if there is no need. Since parition size in wic is expressed in MB, any sub MB change will cause the generated partition image to be larger than allocated space within the disk image. Fortunately, partitions sized in MB will most of the time have a proper sector count. Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-23wic: use IMAGE_EXTRA_SPACE for vfat rootfsMaciej Borzecki
Functions for generating rootfs use IMAGE_EXTRA_SPACE rather than BOOTDD_EXTRA_SPACE. The latter is used in boot image source plugins. Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-23wic: minor comment updateMaciej Borzecki
Update comment about types of generated partition images. Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-15wic: include partition label in fs image file nameMaciej Borzecki
Not including the label image but having multiple partitions of the same type, the image file of one partition would overwrite the other. Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-15wic: Parse and pass sourceparams to partition plugin methodsTom Zanussi
Add code to parse the sourceparams and pass them to the partition plugin methods. Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-15wic: Add sourceparam param to partition plugin methodsTom Zanussi
The sourceparam param allows source plugins to be parameterized generically (via --sourceparams="key=val[,key=val], implemented previously). Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-15wic: Add '--sourceparams' partition optionTom Zanussi
To go along with '--source' as a way to parameterize source plugins. Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-11wic: Rename /mic to /wicTom Zanussi
As well as any other stray instances of mic in the codebase that can be removed. We don't really need to carry around legacy naming, and the history is in git. Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>