summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/imager/direct.py
Commit message (Collapse)AuthorAgeFilesLines
* wic/direct: reserve 2 sector for extended partitionChee Yang Lee2020-03-301-3/+3
| | | | | | | | | | | | | | | | | | extended partition should reserve at least 2 unallocated sectors between the start of the extended partition and the start of a logical partition. [YOCTO #13658] (From OE-Core rev: 884c8a0e50a49bdca5e048197a9dc0ff37cc8d1a) (From OE-Core rev: 0743dcd0cd70dee87a49d3bcd017168352e60982) Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 590555e3b8ccbd94b628aa6778adea7f4538d966) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/direct: Partition numbering is broken for MBR primary partition #4Michael Cooper2019-10-081-1/+2
| | | | | | | | | | | | | When wks describes extra partitions that aren't in the partition table (e.g. boot loader) and exactly four primary MBR partitions, the last partition gets added to fstab as partition #5 instead of #4. [YOCTO #13560] (From OE-Core rev: 7537580b3dd21bd512fb26e56e92b6553c549fa8) Signed-off-by: Michael Cooper <michaelcooper81@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Add partition type for msdos partition tablesJason Wessel2019-08-121-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to create a msdos partition table disk image that can auto expand after the image is copied to an SD card, wic needs the ability to have a primary partition as the last entry. The desired use case is to be able to create an A/B update partition image scheme with a /var volume that can be auto expanded to the remainder of the SD card at run time. The typical .wks file will look similar to the following: bootloader --ptable msdos part / --source rawcopy --sourceparams="file=u-boot.imx" \ --ondisk mmcblk --no-table --align 1 --size 1 part /boot --source bootimg-partition \ --ondisk mmcblk --fstype=vfat --label boot --active --align 4 --size 16 part / --source rawcopy --sourceparams="file=imx6_boot.otaimg" \ --ondisk mmcblk --fstype=ext4 --label otaboot --align 4 --type logical part / --source rawcopy --sourceparams="file=imx6.otaimg" \ --ondisk mmcblk --fstype=ext4 --label otaroot --align 4 --type logical part / --source rawcopy --sourceparams="file=imx6_boot.otaimg" \ --ondisk mmcblk --fstype=ext4 --label otaboot_b --align 4 --type logical part / --source rawcopy --sourceparams="file=imx6.otaimg" \ --ondisk mmcblk --fstype=ext4 --label otaroot_b --align 4 --type logical part /var --source rawcopy --sourceparams="file=imx6_var.otaimg" \ --ondisk mmcblk --fstype=ext4 --label fluxdata --align 4 Without the patch applied, wic will generate an SD card image that looks like: Disk boot.img: 890940s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2056s 48001s 45946s primary fat16 lba 2 48008s 132467s 84460s primary ext4 3 132472s 454467s 321996s primary ext4 4 454471s 890939s 436469s extended lba 5 454472s 538931s 84460s logical ext4 6 538936s 860931s 321996s logical ext4 7 860936s 890939s 30004s logical ext4 boot With the patch applied a primary partition can be created at the end of the image which can be expanded to fill the free space on the media where the image has been copied, which looks like: Disk boot.img: 890940s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2056s 48001s 45946s primary fat16 lba 2 48007s 860931s 812925s extended lba 5 48008s 132467s 84460s logical ext4 6 132472s 454467s 321996s logical ext4 7 454472s 538931s 84460s logical ext4 8 538936s 860931s 321996s logical ext4 3 860936s 890939s 30004s primary ext4 boot (From OE-Core rev: 56add7cc547e0113cdf980579d1421b14cc233e5) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Fix (again) partition files UIDs on multi rootfs imagesRicardo Ribalda Delgado2019-07-191-25/+12
| | | | | | | | | | | | | | | | | | | | | Commit 450335ba5e73a375eb9932b4c4cf37979640dbfc copies the pseudo database to the working directory in order to have ownership information when the filesystem is generated. Unfortunately this does not work anymore. The filenames on the database are absolute and there is no information about the new directory. Instead of fixing the database, we could redo a bit the way we patch the fstab file. Now I am saving the old contents of fstab, modifying the file and then reverting the changes on exit. This is faster than the previous approach, although it can cause indeterminism if the application is killed before finishing. (From OE-Core rev: dcbf7b864dd1713b54a172d8714ce1508482f086) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta/lib+scripts: Convert to SPDX license headersRichard Purdie2019-05-091-15/+1
| | | | | | | | | | | | | | | | | | | | | | | This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. (From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Introduce the --use-label partition parameterKevin Hao2018-09-131-0/+2
| | | | | | | | | | | We can use this parameter to make the wic use the label to name a partition in /etc/fstab. (From OE-Core rev: 51638edaa00befaed58e2def255d46ae44d9234f) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Fix partition files UIDs on multi rootfs imagesRicardo Ribalda Delgado2018-05-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a wks makes reference to multiple rootfs, libspeudo data is not properly chossen. This results in filesystems with invalid UIDs for all the files. This can be tested with this .wks file: part / --source rootfs --fstype=ext4 --rootfs-dir=core-image-base part /mnt/data1/ --fstype=ext4 --source rootfs --rootfs-dir=core-image-minimal part /mnt/data2/ --fstype=ext4 --source rootfs --rootfs-dir=core-image-minimal And this script $bitbake core-image-minimal core-image-base syslinux $losetup --partscan --find --read-only --show test*direct $sudo mount /dev/loop0p1 /mnt $ls -lan /mnt otal 40 drwxr-xr-x 18    0    0  1024 May 11 16:11 . drwxr-xr-x 25    0    0  4096 May  6 06:31 .. drwxr-xr-x  2 1000 1000  3072 May 11 15:51 bin drwxr-xr-x  2 1000 1000  1024 May 11 13:59 boot drwxr-xr-x  2 1000 1000  1024 May 11 13:59 dev drwxr-xr-x 25 1000 1000  3072 May 11 15:51 etc drwxr-xr-x  3 1000 1000  1024 May 11 13:59 home drwxr-xr-x  6 1000 1000  3072 May 11 15:51 lib drwx------  2    0    0 12288 May 11 16:11 lost+found drwxr-xr-x  2 1000 1000  1024 May 11 13:59 media drwxr-xr-x  3 1000 1000  1024 May 11 15:50 mnt drwxr-xr-x  2 1000 1000  1024 May 11 13:59 proc drwxr-xr-x  2 1000 1000  1024 May 11 15:51 run drwxr-xr-x  2 1000 1000  3072 May 11 15:51 sbin drwxr-xr-x  2 1000 1000  1024 May 11 13:59 sys drwxr-xr-t  2 1000 1000  1024 May 11 13:59 tmp drwxr-xr-x 10 1000 1000  1024 May 11 14:54 usr drwxr-xr-x  8 1000 1000  1024 May 11 14:55 var $sudo losetup -d /dev/loop0 (From OE-Core rev: 450335ba5e73a375eb9932b4c4cf37979640dbfc) Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/imager/direct: Ensure correct ROOTFS_DIR is shownRichard Purdie2018-04-201-1/+6
| | | | | | | | | | | | | | | | | | | | This changes the output of "wic create mkefidisk -e core-image-sato" from: The following build artifacts were used to create the image(s): ROOTFS_DIR: /media/build1/poky/build/tmp.wic.ybraavmb/rootfs_copy to: The following build artifacts were used to create the image(s): ROOTFS_DIR: /media/build1/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs which s much less confusing for the user. [YOCTO #12564] (From OE-Core rev: a4941af2d3624aecc5dcd7ff54b7ea8c9e9dee8b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Introduce --fsuuid and have --use-uuid make use of UUID tooTom Rini2017-12-181-2/+15
| | | | | | | | | | | | | | First, allow for wic to be given a filesystem UUID to be used when creating a filesystem. When not provided, wic will generate the UUID to be used. Next, when --use-uuid is passed, we update the fstab to mount things via UUID (and if not found, then use PARTUUID) as UUID is more portable. (From OE-Core rev: 9256b8799495634ee8aee5d16ff71bd6e6e25ed4) Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: When using --use-uuid make sure that we update the fstab with PARTUUIDTom Rini2017-11-081-3/+6
| | | | | | | | | | | | When we have been told to use the UUID we should also update the fstab to make use of PARTUUID instead of hard-coding the device in question. This will make the resulting image much more portable. (From OE-Core rev: e7443e7cf876d9bbe326033ac5eee0b98ce5d37f) Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add 'part-name' argument for naming GPT partitionsArtur Mądrzak2017-11-071-0/+11
| | | | | | | | | | | | The WIC's 'part' can now give a name for GPT partition in WKS file. It's similar to '--label', but is naming partintions instead file systems. It's required by some bootloaders to partitions have specified names. (From OE-Core rev: 9b60e3466ed7cff0cea10815851eb1304002eb52) Signed-off-by: Artur Mądrzak <artur@madrzak.eu> Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Add option to not change fstabFabio Berton2017-09-261-1/+5
| | | | | | | | | | | | | | | | | Create an option to wic doesn't change fstab file, the final fstab file will be same that in rootfs and wic doesn't update file, e.g adding a new mount point. Users can control the fstab file content in base-files recipe. This is useful if you want to only create an partition but not add fstab mount point or add new mount point using label e.g: LABEL=recovery /recovery auto defaults 0 1 (From OE-Core rev: 00420ec42140c1b752132bda190dede85756d157) Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: run bmaptool with native Python3Ed Bartosh2017-09-111-2/+4
| | | | | | | | | | | | | Modified wic code to run bmaptool using native Python3 from wic-tools native sysroot. [YOCTO #11891] (From OE-Core rev: 7fca44e03130c0860cc5df2093902773f426c774) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: improve generating disk system identifierJonathan Liu2017-08-031-1/+2
| | | | | | | | | | This should reduce the chance of generating 0xffffffff as the disk system identifier. (From OE-Core rev: 5619e72facbc9228d3cf8f844f198e03b536ac8c) Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: ensure generated disk system identifier is non-zeroJonathan Liu2017-07-301-1/+1
| | | | | | | | | | Zero may be interpreted as no MBR signature present and another partitioning program might install a new MBR signature. (From OE-Core rev: f53b5555d6eaa171bc5882cfee807cf62576862d) Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add /boot mount point to fstab by defaultEd Bartosh2017-07-301-1/+1
| | | | | | | | | | | | | | | | 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] (From OE-Core rev: 2376b05512ddb8c4ec3aaf1df11071f536a76bd9) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: copy rootfs directory before changing fstabEd Bartosh2017-07-301-9/+15
| | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 92e1c7d47e695eb4ce1a863cd0f6c49dca1c2339) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix calculation of partition numberEd Bartosh2017-07-211-1/+1
| | | | | | | | | | | | | | | | 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] (From OE-Core rev: 5689139b3cd862e2df49f6b21171f513e8a46c60) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix restoring of original fstabEd Bartosh2017-06-231-4/+5
| | | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: 29f7735030d383f9614bdb148b52a47c79f05eea) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: flatten directory structureEd Bartosh2017-06-231-1/+1
| | | | | | | | | | | Moved misc.py from wic/utils/ to wic/ Removed wic/utils directory (From OE-Core rev: df906f3caa0721756f5ed48fa657e62e05ae2aa3) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* filemap: change signature of sparse_copy functionEd Bartosh2017-06-141-1/+1
| | | | | | | | | | | | | | Renamed parameter offset->skip to match names of dd parameters. Changed affected sparse_copy calls. Added explanation of the parameters to docstring. (From OE-Core rev: 08e2f4e59816c5757686255b267b08cbc46fbd95) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: set correct system id for msdos partitionsEd Bartosh2017-04-011-11/+2
| | | | | | | | | | | | Explicitly set system id 0x6(FAT16) for msdos partitions. Removed old code that attempts to achieve the same result using 'parted ... lba off'. (From OE-Core rev: 230452faf151e277bfb2b49526923f8097755b35) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: allow only supported fstypesEd Bartosh2017-04-011-2/+0
| | | | | | | | | | | | | | 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'. (From OE-Core rev: 21af89a6d44ccea6aef975ffd2483a8fad1231de) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix generation of partition UUIDEd Bartosh2017-03-271-1/+1
| | | | | | | | | | | | | | | | | 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. (From OE-Core rev: bdaba95af2b2c9174311374436f184d2a927f6f1) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/partionedfs: Avoid reserving space for non-existing ext. partitionKristian Amlie2017-03-221-2/+6
| | | | | | | | | | | | 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. (From OE-Core rev: 485315dc170e29962a8848db38db73abafd0586e) Signed-off-by: Kristian Amlie <kristian.amlie@mender.io> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/direct.py: Avoid exception if using multiple rawcopy/no-table entries.Kristian Amlie2017-03-111-1/+1
| | | | | | | | | | | | | | | | | 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. (From OE-Core rev: f1a3eac376c4600cdb128d870ad9b7e9d51ed9c0) Signed-off-by: Kristian Amlie <kristian.amlie@mender.io> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move PluginMgr class to pluginbaseEd Bartosh2017-03-041-2/+1
| | | | | | | | | | | As PluginMgr class contains only one method it's better to move it to pluginbase to have all plugin related APIs in one module. (From OE-Core rev: 244585b369ecc0019002ca51bf7f8fd506234462) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: remove PluginMgr.get_plugin_methodsEd Bartosh2017-03-041-6/+4
| | | | | | | | | | Call methods directly instead of getting them with get_plugin_methods and then calling. (From OE-Core rev: efcd07fe17bf55441059b00a5becc3952e0a4075) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: reimplement PluginMgr.get_plugin_methodsEd Bartosh2017-03-041-5/+5
| | | | | | | | | | | 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 (From OE-Core rev: 875d4eede61b548d64f426c2ef077cc17e50cd45) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use PluginMgr directlyEd Bartosh2017-03-041-2/+2
| | | | | | | | | | | Instead of making a singleton object of PluginMgr class it's simpler to use PluginMgr class directly as any class is a singleton. (From OE-Core rev: cbe7dbd31f2292416d8e801e142679c69d9a44bc) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move WicError to lib/wic/__init__.pyEd Bartosh2017-03-041-1/+1
| | | | | | | | | | Removed unused exceptions from error.py Moved definition of WicError to lib/wic/__init__.py (From OE-Core rev: 15442d072bb6d93bd9b941726f93262503053da5) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: raise WicError instead of ImageError and CreatorErrorEd Bartosh2017-03-041-3/+3
| | | | | | | | | | There is no need to raise special exceptions. Raising WicError should be enough. (From OE-Core rev: b952076cc9f458c3d5eb03e12dc3ec316a44804c) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: raise WicError in wic pluginsEd Bartosh2017-03-041-4/+2
| | | | | | | | | Replaced sys.exit with raising WicError in wic plugins. (From OE-Core rev: 92e8c81c941597eb2b4b61d5c28833e4826888f8) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move errors moduleEd Bartosh2017-03-041-1/+1
| | | | | | | | | Moved from lib/wic/utils/ to lib/wic as this is a core module. (From OE-Core rev: 808c70b81de5c3cfc3dcb01f08213e2ea33b7252) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use wic logger in imager direct pluginEd Bartosh2017-03-041-40/+43
| | | | | | | | | Replaced msger with wic logger in the direct plugin. (From OE-Core rev: adeacb4e600b8438bd9db7e83a5cb4a118d186f3) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: move creation of PartitionedImage to __init__Ed Bartosh2017-02-151-4/+4
| | | | | | | | | | Moved creation of PartitionedImage object from DirectPlugin.create method to init. It makes the code a bit more readable and logical. (From OE-Core rev: 9f225ef5620f2e47e762b2fd16fa5f8d6f1f60fd) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: move generation of part.realnum to PartitionedImageEd Bartosh2017-02-151-13/+13
| | | | | | | | | | | | | 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. (From OE-Core rev: dbd58b0b32288821d9dd5d1a3118cf7c6e8f098a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: add PartitionedImage.prepare methodEd Bartosh2017-02-151-13/+11
| | | | | | | | | | | | | 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. (From OE-Core rev: 700aa424f0aa239cf4149eed4bfb1dc7d9677431) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: set bootloader.source in the __init__Ed Bartosh2017-02-151-6/+7
| | | | | | | | | | | Moved setting of bootloader source from do_create method to __init__ as it doesn't have anything to do with image creation. (From OE-Core rev: 361b890da1c7b24de0a62516545e4c164830081d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: move UUID generation to PartitionedImageEd Bartosh2017-02-151-12/+11
| | | | | | | | | | | | | | 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. (From OE-Core rev: 20c70dd617d4abfff507e210610a58a9989f7c9b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: add 'realnum' attribute to partitionEd Bartosh2017-02-151-26/+20
| | | | | | | | | | | 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. (From OE-Core rev: 96a26b6ddf22346dafa06b00816579439e98445f) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: remove useless codeEd Bartosh2017-02-151-3/+1
| | | | | | | | | Removed catching CreatorError and raising it again. (From OE-Core rev: c17353c8ec9ecb52368e08dad999aafc9ac1b734) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: don't catch ImagerErrorEd Bartosh2017-02-151-4/+1
| | | | | | | | | | Don't transform ImagerError exception into warning. Let wic to catch it on the upper level. (From OE-Core rev: 0cc84c81dd4a776aa37c8d1bcdcc3fa3af78d1e4) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: remove set_bootimg_dir setterEd Bartosh2017-02-151-9/+0
| | | | | | | | | | Removed java-like setter set_bootimg_dir. It's more pythonic to access public attributes directly. (From OE-Core rev: c2a6ca4883ea59e6492ad3b4aa0e9bc358b87fed) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move PartitionedImage class to direct.pyEd Bartosh2017-02-151-2/+276
| | | | | | | | | | | 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. (From OE-Core rev: 2550622371f5c50857e5d58eabab01a1823c6fc3) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move disk operations to PartitionImage classEd Bartosh2017-02-151-67/+30
| | | | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 4dc9dbfc7fbc16d349a019e8973d50905cd28244) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: remove unused argument scripts_pathEd Bartosh2017-02-151-1/+1
| | | | | | | | | | | | | | 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. (From OE-Core rev: f9f72c506befdff13260f37ded0beaea3aa30fad) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: remove unused importEd Bartosh2017-02-151-2/+1
| | | | | | | | | | Removed unused import of wic.errors module. (From OE-Core rev: 318ba1edfcf0cacf6adae7e1af625dcb43ec3881) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: direct: remove unused plugin attributesEd Bartosh2017-02-151-4/+0
| | | | | | | | | | | Removed unused _disks, _disk_format and _disk_names attributes from DirectPlugin class. (From OE-Core rev: 178df49cf1674bfcf1cb7295d0494c3b23929d22) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use the same partition object in direct and partitionedfsEd Bartosh2017-02-151-8/+1
| | | | | | | | | | | | | | 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. (From OE-Core rev: 97db24d34847a641868f9ee83aae56f9dd5e0a8a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>