aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
AgeCommit message (Collapse)Author
2017-12-18wic: Introduce --fsuuid and have --use-uuid make use of UUID tooTom Rini
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. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-12-18wic: partition.py: Update comments slightlyTom Rini
First, we support squashfs as root, so mention that. Second, the btrfs rootfs creation function had a copy/paste of the previous function comment, remove the irrelevant line. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-12-18wic: kparser.py: Check for SquashFS and use-uuidTom Rini
The SquashFS filesystem does not support UUIDs so make this combination be an error. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-12-09wic: support filesystem label for rawcopyMartin Hundebøll
The '--label' argument should work for '--source rawcopy' as it does for '--source rootfs', so add a method in RawCopyPlugin to update the label on the temporary filesystem images. Signed-off-by: Martin Hundebøll <mnhu@prevas.dk> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-11-08wic: Update canned-wks for systemd to use UUID everywhereTom Rini
With systemd, the mounting of the swap partition is handled via systemd and will mount it, regardless of if PARTUUID is parsed or not. systemd has a runtime dependency on util-linux-mount so PARTUUID for regular mount points will be handled correctly. Make all partitions that we add to the image make use of UUIDs for maximum portability. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-11-08wic: When using --use-uuid make sure that we update the fstab with PARTUUIDTom Rini
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. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-11-05wic: add 'part-name' argument for naming GPT partitionsArtur Mądrzak
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. 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>
2017-11-05wic: misc.py: Use mmd from mtools instead of syslinuxSaul Wold
mtools already provides a suite of msdos utilities, switch to this one also. This could allow for future changes to reduce wic's dependecies. Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-11-05wic: misc.py: Added more mtools binariesSaul Wold
This fixes the issue that if you don't have mtools installed on the host thus causing host contamination, that the correct binaries would be selected from the native sysroot. [YOCTO #12173] Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-25wic: Add option to not change fstabFabio Berton
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 Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-22wic: allow multiple /boot partitions with different contentEnrico Scholz
It can be useful to have multiple partitions with '--source bootimg-partition' but different content. E.g. for TI AM335x, one boot partition can contain an first stage bootloader ("MLO"), while the real bootloader and kernel plus devicetree are in another one. Patch allows to specify multiple IMAGE_BOOT_FILES with optional "_label-XXX" or "_uuid-XXX" overrides. E.g. with this patch, a .wks file with | part --source bootimg-partition ... --label=mlo --active | part --source bootimg-partition ... --label=boot0 | part --source bootimg-partition ... --label=boot1 and a recipe with | IMAGE_BOOT_FILES_label-mlo = "\ | MLO-${MACHINE}.img;MLO \ | " | | IMAGE_BOOT_FILES_label-boot0 = "\ | u-boot-${MACHINE}.img;u-boot.img \ | zImage \ | " | | IMAGE_BOOT_FILES_label-boot1 = "${IMAGE_BOOT_FILES_label-boot0}" | | WICVARS += " \ | IMAGE_BOOT_FILES_label-mlo \ | IMAGE_BOOT_FILES_label-boot0 \ | IMAGE_BOOT_FILES_label-boot1 \ | " is possible. It will create one partition with the MLO and two redundant ones with the uboot + kernel. Signed-off-by: Enrico Scholz <enrico.scholz@ensc.de> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-17wic: accept '-' in bitbake variablesEnrico Scholz
'-' is valid and common in bitbake variables (e.g. 'FOO_pn-bar'). Accept it and other characters when reading the .env file. Also, allow variables to be empty. (From OE-Core rev: e688ac8e92d2bc451d8b2d437596f630bedccd2c) Signed-off-by: Enrico Scholz <enrico.scholz@ensc.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11wic: run bmaptool with native Python3Ed Bartosh
Modified wic code to run bmaptool using native Python3 from wic-tools native sysroot. [YOCTO #11891] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-11wic: update help contentEd Bartosh
Added ext* partitions to the description of 'wic ls', 'wic cp' and 'wic rm' commands. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-11wic: implement ext fs support for 'wic rm'Ed Bartosh
Implemented removing files or directories from the ext partition using debugfs tool. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-11wic: implement ext fs support for 'wic cp'Ed Bartosh
Implemented copying files to the ext partition using debugfs tool. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-11wic: implement ext fs support for 'wic ls'Ed Bartosh
Implemented listing directory contents for ext file system using debugfs tool. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-08-27wic: always read image partitionsEd Bartosh
Got rid of lazy evaluation of self.partitions property. It's not needed because partitions of the source image should be always read. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27wic: implement 'wic write' commandEd Bartosh
This command writes image to the media or another file with the possibility to expand partitions to fill free target space. [YOCTO #11278] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27wic: extend list of used toolsEd Bartosh
Added sfdisk, e2fsck, mkswap, resize2fs, mkdosfs to the list of used tools in Disk class. They're going to be used in 'wic write' implementation. Added dependency to util-linux to wic-tools to ensure that sfdisk and mkswap are available from wic-tools native sysroot. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27wic: added 'fstypes' parameter to Disk.__init__Ed Bartosh
This parameter specifies list of supported filesystems. So far only 'fat' is supported, but 'wic write' is going to support at least 'fat', 'ext' and 'swap'. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27wic: convert partition number to intEd Bartosh
Converted partition number to int in order to use it as an index in the list of partitions. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27wic: get more info from the 'parted print' outputEd Bartosh
Got partition type and sector sizes from the output of 'parted print'. This info may be used in the implementation of 'wic write' command. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27wic: reimplement getting paths of used toolsEd Bartosh
So far every used tool have to have separate property and private attribute in the Disk class. This is too verbose, considering that there will be much more tools used. Reimplemented getting tools paths using custom __getattr__ method. This is much more compact and readable. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-03wic: improve generating disk system identifierJonathan Liu
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>
2017-07-30wic: Switch to using --use-uuid by defaultTom Rini
The most portable way to specifiy a root device in a disk image that we create is to use PARTUUID rather than /dev/sda2. As background, both GPT and MBR tables provide valid UUID values for each partition and the Linux Kernel contains the logic to parse this value. With this change we can now boot the default disk images when used as any valid block device that the included kernel uses. This for example means that VirtualBox can be used to run vmdk without changes as it uses IDE for the virtual disk controller. Cc: Matt Porter <mporter@konsulko.com> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30wic: ensure generated disk system identifier is non-zeroJonathan Liu
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>
2017-07-30wic: add /boot mount point to fstab by defaultEd Bartosh
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>
2017-07-30wic: rootfs: make copied rootfs uniqueEd Bartosh
Used unique suffix (line number from .wks file) for the copied rootfs directory to avoid possible conflicts. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30wic: rootfs: fix rootfs path reportingEd Bartosh
wic gets rootfs paths from partition object property 'rootfs_dir' and shows them in final report. rootfs plugin sets this property to the temporary path, which causes temporary paths appearing in the report. Changed the code to prevent storing temporary rootfs path in part.rootfs_dir. This should fix the report. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30wic: use absolute paths in rootfs pluginEd Bartosh
Using relative paths can cause copyhardlinktree API to fail as it changes current directory when working. Converted all paths to absolute paths using os.path.realpath. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30wic: copy rootfs directory before changing fstabEd Bartosh
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>
2017-07-21wic: add description of --mkfs-extraoptsEd Bartosh
Updated help contents with the description of new wks option --mkfs-extraopts Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-21wic: implement wks option --mkfs-extraoptsEd Bartosh
This option specifies extra options to pass to mkfs.<fstype> utilities. [YOCTO #11709] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-21wic: fix calculation of partition numberEd Bartosh
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>
2017-07-17wic: isoimage-isohybrid: use grub-efi from deploy dirEd Bartosh
isoimage-isohybrid plugin tries to build grub-efi in its working directory if it can't find efi binary. Wic should avoid doing anything in working directories of other recipes. It should use artifacts from the image deployment directory instead. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-17wic: isoimage-isohybrid: check result of glob()Ed Bartosh
isoimage-isohybrid plugin uses result of glob call to get path to initrd image. When glob returns empty list the plugin crashes with IndexError. Checking if result of glob call is not empty should fix the breakage. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-17wic: isoimage: do not remove temp directoryEd Bartosh
Removed isodir subrdirectory instead of removing temporary working directory as working directory can contain copy of rootfs partition and shouldn't be removed by any plugin. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-17wic: get rid of using wic-toolsEd Bartosh
At the moment, when building images with IMAGE_FSTYPES=wic one ends up depending on wic-tools and thus syslinux and grub-efi even when not using those at all. Ideally, building an image with wic should only build the tools and components really needed. The problem is that "wic-tools" is needed also for the manual invocations of wic, in which case everything that might be needed has to be built in advance. Replaced dependency on wic-tools with dependency to a much shorter set of tools that wic uses almost for any image: 'parted', 'gptfdisk', 'dosfstools' and 'mtools'. [YOCTO #11552] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23wic: remove extra double-quote on documentation stringJean-Francois Dagenais
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23wic/runner.py: move runtool API to misc.pyEd Bartosh
Moved remaining API to misc.py. Removed runner.py. Now misc.py is ready to be moved to the scripts/lib/wic and utils directory can be removed. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23wic: fix restoring of original fstabEd Bartosh
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>
2017-06-23wic: code cleanupEd Bartosh
Split long lines. Removed unused imports. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23wic: flatten directory structureEd Bartosh
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>
2017-06-14wic: implement removing directoriesEd Bartosh
Added support for removing directories using mdeltree utility to Disk.del method [YOCTO #11283] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14wic: implement removing filesEd Bartosh
Added implementation of Disk.del method and wic_r function that removes files from the vfat partition using mdel utility. [YOCTO #11283] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14wic: add 'wic rm' commandEd Bartosh
Added empty 'wic rm' command that does nothing. The functionality will be added by the next commits. [YOCTO #11283] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14wic: add help and usage content for 'wic rm'Ed Bartosh
Added wic_rm_help and wic_rm_usage variables to help.py. These variables contain help content that will be used in 'wic rm help' and 'wic rm --help' output. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14wic: fully implement 'wic cp'Ed Bartosh
Added implementation of Disk.copy method and wic_cp function that copies files/directories to the vfat partition of the partitioned image. [YOCTO #11283] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14wic: add Disk._put_part_image methodEd Bartosh
This method copies partition image into the wic image. It will be used in 'wic cp' and 'wic rm' subcommands to copy changed partition back into wic image. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>