summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
AgeCommit message (Collapse)Author
2023-12-21wic: use E2FSPROGS_FAKE_TIME and hash_seed to generate reproducible ext4 imagesvenkata pyla
E2FSPROGS_FAKE_TIME: sets fixed times for the inodes in the file system. hash_seed: creates reproducible directory indexes in the file system. Reference commit in e2fsprogs: e1f7100643a46456be107b33098f6034b0835e6d (From OE-Core rev: bb822ab75de0020572058090439b93cc56bbf7e0) Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-02wic: Add gpt-hybrid partition layoutJoshua Watt
Add support for formatting a disk with a hybrid MBR & GPT partition scheme. In this scheme, the primary partitioning method is GPT, but a valid MBR header is also written than can point to a subset of the GPT partitions on the disk (any partitions marked with the `--mbr` flag will be included in this MBR). The primary purpose of this method is to allow for SoCs that can only find a bootloader in an MBR partition to use GPT once the bootloader is running. As an example, older versions of the Raspberry Pi firmware can only parse MBR partitions to find a kernel (or other bootloader like u-boot), but once those have booted GPT partitions can be used. In addition to the partitions annotated with the `--mbr`, a "protective" GPT partition of type 0xEE is added, as the existence of such a partition is the indication to tooling that this a hybrid MBR and that the GPT partition table should be parsed instead. (From OE-Core rev: e50e4c2a5ada6947b3503ca4d8e9c30d359e8a5d) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-21wic: fix wrong attempt to create file system in upartitioned regionsMarkus Niebel
The kickstart parser defaults fstype to "vfat". This leads to an attempt to create an empty file system even for regions configured with "--no-table" if used without fstype when no --sourceparams given. The fix tests for fstype "none" or no_table in Partition prepare method. This will omit the file system creation an the potential error for small region with --no-table option. (From OE-Core rev: db771a4cd36bf291a8b68edfd905e03243f2c8b3) Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-05-25wic: Add argument --hidden to default imagerLeon Anavi
Add argument --hidden to avoid MS Windows prompting to format partition after flashing to a USB stick, SD card on another media. Set Bit 0 (RequiredPartition) to mark that the partition is required for the platform to function on GUID Partition Table (GPT). The new argument simplifies setting RequiredPartition on GPT through a WKS file and the default imager plugin. Otherwise, without this feature, to achieve the same result a new imager plugin has to be implemented and set in WIC_CREATE_EXTRA_ARGS. (From OE-Core rev: 7a111ff58d7390b79e2e63c8059f6c25f40f8977) Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-02-15wic: Fix usage of fstype=none in wicPavel Zhukov
This allows to specify partition with fstype=none in the wks file to have partition created but without following mkfs. The none fstype is in the list already but the usage is not documented. Example; part /data --ondisk mmcblk0 --fstype=none --align 4096 --fixed-size 512 will create a partition, filesystem may be created manualy on the host or target and data will be preserved if the device is reflashed using same wks. Works with bmaptool and probably does not work with dd. Use case is persistent filesystem/data between reflashing of the image. (From OE-Core rev: 351cb64da37aa43113e5192605d04436652aa3b8) Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-11-07wic: make ext2/3/4 images reproducibleSergei Zhmylev
Ext2/3/4 FS contains not only mtime, but also ctime, atime and crtime. Currently, all the files are being added into the rootfs image using mkfs -d functionality which affects all the timestamps excluding mtime. This patch ensures these timestamps inside the FS image equal to the SOURCE_DATE_EPOCH if it is set. (From OE-Core rev: 75d2dd0ea7790db2e8ee921784ca373abff2df65) Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-10-26wic: honor the SOURCE_DATE_EPOCH in case of updated fstabSergei Zhmylev
In case user requested to build a binary repeatable package, it's required to honor the SOURCE_DATE_EPOCH environment variable. So forcefully set mtime inside all the routines which modify fstab in case it is updated. (From OE-Core rev: 99719a3712a88dce8450994d995803e126e49115) Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-16wic: added fspassno parameter to partitionClaudius Heine
The `fspassno` parameter allows to overwrite the value of the last column (`fs_passno`) in the /etc/fstab of the target root file system. This allows to have periodic file system checks. (From OE-Core rev: b9b9f71e6f37bfbf954ade518391b242669481e3) Signed-off-by: Claudius Heine <ch@denx.de> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-16wic: partition: Support valueless keys in sourceparamsStefan Herbrechtsmeier
Accept valueless keys in sourceparams without equals sign (=) to match the comment and support Boolean entries. (From OE-Core rev: 052a9b0f7d2ee5c284cf1b4f1f45caed0489221a) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-19wic: keep rootfs_size as integerAlexander Kanavin
The corrected line accidentally converted it to float, which causes problems later on with python 3.10: | File "/home/alex/development/poky/scripts/lib/wic/partition.py", line 278, in prepare_rootfs_ext | os.ftruncate(sparse.fileno(), rootfs_size * 1024) | TypeError: 'float' object cannot be interpreted as an integer (From OE-Core rev: d1d260dd2d196d10379ed9e238bcb34f39f3a3b7) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-20wic: Add --no-fstab-update part optionDaniel Gomez
When embedding a rootfs image (e.g. 'rootfs-dir') as a partition we might want to keep the stock fstab for that image. In such a case, use this option to not update the fstab and use the stock one instead. This option allows you to specify which partitions get the fstab updated and which get the stock fstab. The option matches the argument you can pass to wic itself where the same action is performed but for all the partitions. Example: part /export --source rootfs --rootfs-dir=hockeycam-image --fstype=ext4 --label export --align 1024 --no-fstab-update part / --source rootfs --fstype=ext4 --label rootfs --align 1024 (From OE-Core rev: ab4c95af8ecd15dc136194ab761afae756db5803) Signed-off-by: Daniel Gomez <daniel@qtec.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-31Add support for erofs filesystemsRichard Weinberger
Since Linux 5.4 a new read-only filesystem is available, erofs. Compared to squashfs it offers much better read performance with and without compression enabled. It suppports two optional compressors, lz4 and lz4hc. >From the mkfs.erofs man page: EROFS is a new enhanced lightweight linux read-only filesystem with modern designs (eg. no buffer head, reduced metadata, inline xattrs/data, etc.) for scenarios which need high-performance read-only requirements, e.g. Android OS for smartphones and LIVECDs. It also provides fixed-sized output compression support, which improves storage density, keeps relatively higher compression ratios, which is more useful to achieve high performance for embedded devices with limited memory since it has unnoticable memory overhead and page cache thrashing. This commit adds support for three new filesystem targets: erofs: erofs without compression erofs-lz4: erofs with lz4 compresssion enabled erofs-lz4hc: erofs with lz4hc compression enabled (From OE-Core rev: 41dead1ff8ccc49e6cd6e6f5d41a59d164693e0d) Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-02scripts/lib/wic/partition.py: do not set FAT sizeAlexander Kanavin
Modern dosfstools automatically determines the appropriate size and will error out if something that doesn't make sense is supplied on the command line. (From OE-Core rev: b85a09ea450a5e8f49418f4a930805fbb88dc83b) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-26wic: Warn if an ext filesystem affected by the Y2038 problem is usedFlorian Bezdeka
We are getting closer and closer to the year 2038 where the 32 bit time_t overflow will happen. While products (= embedded systems) with an expected life time of 15 years are still save the situation may change if your system has to survive the next 20 years. ext2 and ext3 filesystems are always affected by the time overflow, so let's warn the user if these filesystems are still being used. If ext4 is affected depends on the inode size chosen during filesystem creation. At least 256 bytes are necessary to be safe. As ext4 is used very often (and partitions may be created small first and extended later) this might be an issue for many users. Some filesystems created during CI runs were already affected by the Y2038 problem. By using `--mkfs-extraopts "-T default"` we tell mke2fs not to auto-detect the usage type based on the filesystem size. mke2fs will use the default values for tuning parameters instead. The inode size is one of these parameters. (From OE-Core rev: eecbe625558406680121d2a7e84917fea45ea9dc) Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-20wic: Optimise fstab modification for ext2/3/4 and msdos partitionsPaul Barker
The fix for [Yocto #13994] required the rootfs directory to be copied (using hardlinks if possible) when modifying the fstab file under wic. We can optimise this copy away for filesystems where we have the tools to modify the contents of the partition image after it is created. For ext2/3/4 filesystems we have the debugfs tool and for msdos/vfat filesystems we have the mcopy tool. So for any of these filesystems we skip the modification of the fstab file in the rootfs directory (and skip the associated copy unless it is otherwise necessary) and update the contents of fstab directly in the partition image. (From OE-Core rev: 5fb8ae0e9159597d7eaa9307a3a8543800bf9405) Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-20wic: Copy rootfs dir if fstab needs updatingPaul Barker
By default, wic updates the /etc/fstab in the rootfs to include details of additional partitions described in the selected wks file. If this modification is performed in place, other tasks which create an image file from the rootfs directory (e.g. do_image_tar and do_image_ext4) will pick up the modified fstab file which would not be appropriate for those images as they do not include the additional partitions described in the wks file. wic does undo modifications to the fstab file once it has finished creating the filesystem image, however this leaves open a race condition if one of the other tasks reads the contents of the fstab file from the rootfs directory between the point where wic modifies the fstab file and the point where wic restores the files original content. This could be solved by adding a lockfile for tasks which use the rootfs directory to ensure that no other such task is reading the rootfs directory while do_image_wic is running. This would serialize several do_image_* tasks and result in slower builds, especially for large images. Another drawback of this solution is that it is hard to selectively optimise - adding lockfiles to do_image_* tasks would result in these tasks always being serialized even if no fstab modification will take place. An alternative solution is to copy the rootfs directory when fstab needs to be modified. The code to do this in wic already exists as it is needed when including or excluding content in the rootfs. This still results in an impact on build times but the copy uses hardlinks if possible (so little data is actually copied) and we can make selective optimisations to improve things. The rootfs copy will only take place if fstab modification is required (or if it was already needed to include or exclude rootfs content). We can also follow up with further optimisations after this commit. So this second solution is chosen. Fixes [Yocto #13994] (From OE-Core rev: ce682a73b7447652f898ce1d1d0416a456df5416) Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-12-20wic: Pass canonicalized paths in PSEUDO_IGNORE_PATHSPeter Kjellerstedt
(From OE-Core rev: 55618cbd58d6784a82e773f323723be6f722232f) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-07wic: Handle new PSEUDO_IGNORE_PATHS variableRichard Purdie
Adjust wic to correctly handle the new PSEUDO_IGNORE_PATH variable and avoid inode corruption issues. (From OE-Core rev: 13500f5234361385c365c7c35e83f99435500481) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-04wic: Add --offset argument for partitionsJoshua Watt
Add support for an --offset argument when defining a partition. Many SoCs require that boot partitions be located at specific offsets. Prior to this argument, most WKS files were using the --align attribute to specify the location of these fixed partitions but this is not ideal because in the event that the partition couldn't be placed in the specified location, wic would move it to the next sector with that alignment, often preventing the device from booting. Unlike the --align argument, wic will fail if a partition cannot be placed at the exact offset specified with --offset. Changes in V2: * Fixed a small typo that prevented test_fixed_size_error from passing (From OE-Core rev: 467f84e12b96bc977d57575023517dd6f8ef7f29) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-26wic: Avoid creating invalid pseudo directoryRicardo Ribalda Delgado
If the source of the rootfs is not a bitbake cooked image, or it is not pointing to the root of one, we call pseudo again, which will produce a new pseudo folder at rootfs/../pseudo Eg: part /etc --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/home --fstype=ext4 Cc: Paul Barker <pbarker@konsulko.com> (From OE-Core rev: 799a24ae78655f7a3eda7456b1a0ffaf3e43ec16) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-26wic: Add --change-directory argumentRicardo Ribalda Delgado
This option allows to specify which part of a rootfs is going to be included, the same way the -C argument on tar. Thanks to this option we can make sure the permissions and usernames on the target partition are respected, and also simplify the creation of splitted partitons, not neeting to invoke external vars or using .wks.in files. Eg: part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/    part /etc --source rootfs --fstype=ext4 --change-directory=etc Cc: Paul Barker <pbarker@konsulko.com> (From OE-Core rev: 2265d089a58e1f78f26d623ee667c420cb1c3bd4) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-26wic: Fix multi images .wks with bitbakeRicardo Ribalda Delgado
In order to support .wks files with multiple images inside bitbake we need to explicitly set the pseudo database in use. Eg: If we try this .mks: part / --source rootfs --ondisk sda --fstype=ext4 part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4 The username for all the files under /export will be set to the runner of bitbake (usually UID 1000). Before we run wic, we need to make sure that the pseudo database will be flushed, and contains all the data needed. Cc: Paul Barker <pbarker@konsulko.com> (From OE-Core rev: dde90a5dd2b22a539095d1bac82acc15c6380ac8) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-26wic: Fix permissions when using exclude or include pathRicardo Ribalda Delgado
When parameters include_path or exclude_path are passed to the rootfs plugin, it will copy the partition content into a folder and make all the modifications there. This is done using copyhardlinktree(), which does not take into consideration the content of the pseudo folder, which contains the information about the right permissions and ownership of the folders. This results in a rootfs owned by the user that is running the wic command (usually UID 1000), which makes some rootfs unbootable. This bug can be easily triggerd with the following .wks part / --source rootfs --fstype=ext4 --exclude-path=home And this sequence: $ wic create test-permissions -e core-image-minimal -o test/ $ sudo mount test/test-permissions-202004080823-sda.direct.p1 /mnt $ ls -la /mnt/etc/shadow To fix this we copy the content of the pseudo folders to the new folder and modify the pseudo database using the "pseudo -B" command. If the rootfs is not a rootfs generated by bitbake a warning is shown making the user aware that the permissions on the target might not match what he expects. WARNING: /tmp/test/../pseudo folder does not exist. Usernames and permissions will be invalid Cc: Paul Barker <pbarker@konsulko.com> (From OE-Core rev: fd739c15cdba221d9d497d3402b7d929c0be2ca4) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-07Revert "wic: Add --embed-rootfs argument"Richard Purdie
This reverts commit efdcf94801f6abe8e4099e324d9a3deccd8d4384. After discussion on the mailing list it was felt these changes were not ready yet. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-06wic: Add --embed-rootfs argumentRicardo Ribalda Delgado
This option adds the content of a rootfs on a specific location on the rootfs. It is very useful for making a partition that contains the rootfs for a host and a target Eg: / -> Roofs for the host /export/ -> Rootfs for the target (which will netboot) Although today we support making a partition for "/export" this might not be compatible with some upgrade systems, or we might be limited by the number of partitions. With this patch we can use something like: part / --source rootfs --embed-rootfs target-image /export --embed-rootfs target-image2 /export2 on the .wks file. (From OE-Core rev: efdcf94801f6abe8e4099e324d9a3deccd8d4384) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-10wic: Add --include-path argumentPaul Barker
This option adds the contents of the given path to a partition built with the rootfs source plugin. The path is relative to the directory in which wic is running not the rootfs itself so use of an absolute path is recommended. This option is most useful when multiple copies of the rootfs are added to an image and it is required to add extra content to only one of these copies. This option only has an effect with the rootfs source plugin. (From OE-Core rev: d4cd27a9837426e809190548a83c6c7c76505114) Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-27wic: Using the right rootfs size during prepare_rootfsAlessio Igor Bogani
The commit 8e48b4d6c4 makes wic ignores IMAGE_ROOTFS_SIZE for rootfs size and makes it uses the computed one only. Re-add support for IMAGE_ROOTFS_SIZE variable and compute roots size only if the former is not defined. Moreover the size of a provided directory with --rootfs-dir="" in the .wks file should always be computed on the fly, else every partition will be constrained to be the same size as what ever value was in ROOTFS_SIZE. (From OE-Core rev: 0217a0392b8cc534fcc0d760b7663a1845b306f5) Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-12wic: Make disk partition size consistently computedJason Wessel
When using different root directories with a wks file wic is using the value from the original ROOTFS_SIZE which is not correct. Example: Number Start End Size File system Name Flags 1 20.5kB 318MB 318MB fat16 otaefi legacy_boot, msftdata 2 318MB 636MB 318MB ext4 otaboot 3 636MB 1709MB 1074MB ext4 otaroot 4 1709MB 2027MB 318MB ext4 otaboot_b 5 2027MB 3101MB 1074MB ext4 otaroot_b 6 3101MB 5249MB 2147MB ext4 fluxdata The partitions 1, 2, and 3 incorrectly inherit the size, instead of using a computed size. With the patch applied it is working properly: Number Start End Size File system Name Flags 1 20.5kB 14.5MB 14.5MB fat16 otaefi legacy_boot, msftdata 2 14.5MB 65.3MB 50.8MB ext4 otaboot 3 65.3MB 1139MB 1074MB ext4 otaroot 4 1139MB 1190MB 50.8MB ext4 otaboot_b 5 1190MB 2264MB 1074MB ext4 otaroot_b 6 2264MB 4411MB 2147MB ext4 fluxdata As for the removal of the bb.warn, if the size is not specified, it is not something to warn the end user about. Some of my default images make use of the head room + a computed directory size or while generating images. (From OE-Core rev: 8e48b4d6c4d0ed213089a7449fea63aa0656e786) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-12wic: Add partition type for msdos partition tablesJason Wessel
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>
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
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>
2019-04-26Revert "wic: Set a miniumum FAT16 volume size."Angus Lees
This reverts commit f7dfb4d43247d3c13a4e0a3853007d63b9512b83. FAT16 volumes do not have a minimum size of 8250 blocks (== slightly over 4MB). Exhibit A: floppy disks. The original commit message suggests this was a workaround for a bug in parted - in which case we should fix it there, or use the wic `--fixed-size` option to pass down an enforced minimum from a more context-aware point in the callstack. (From OE-Core rev: e0a1ae3863bc229512d43e4a5248551bf25950e5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-28wic: Ensure that sourceparams values can contain '='Jan Kiszka
This allows '--sourceparams key1=val1=val11,key2=val2'. (From OE-Core rev: e59bba5ee21e9065dce86b912996b893f8946535) Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-13wic: Introduce the --use-label partition parameterKevin Hao
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>
2018-08-15wic: Remove the unused variable Partition.sourceparams_dictKevin Hao
We choose to pass the source parameters to the source plugins' hooks via a local variable srcparams_dict. So the Partition.sourceparams_dict is not used by anyone and seems pretty confused. So drop it. (From OE-Core rev: d7130a7d0e61021f71fec1d7ae7d37ebb27f0e03) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-22wic: Fix partition files UIDs on multi rootfs imagesRicardo Ribalda Delgado
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>
2018-03-04wic: Set a miniumum FAT16 volume size.Paulo Neves
Set a miniumum FAT16 volume size because images are not valid to parted if this minimum value is not respected. The value set is determined experimentally forr a logical sector size of 512. This fixed my local problem but, there may be better solutions. (From OE-Core rev: f7dfb4d43247d3c13a4e0a3853007d63b9512b83) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04wic: partition plugin wrongly assumes it is rootfsPaulo Neves
The partition plugin is used as the base for other plugins. One of the methods the plugins use, is the prepare_rootfs method. The prepare_rootfs method wrongly assumes that the value ROOTFS_SIZE from bitbake datastore is relevant to every invocation of prepare_rootfs, which it clearly is not, for example in the bootimg-partition case. This commit adds an optional argument to prepare_rootfs where a caller can tell prepare_rootfs if it is an actual rootfs and whether related rootfs information retrieved from bitbake is valid. The default behavior of this optional argument is to assume that the invocation is an actual rootfs, to maintain compatibility with previous implementations. (From OE-Core rev: 654d72d55194ec41bc1aacfcc6b2c8c9a305b042) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04wic: Add post operation hook for SourcePluginParthiban Nallathambi
do_post_partition hook is needed if some operations like security signing the parition needs to be done. source plugins can make use of this to implement post operatiosn in do_post_partition. do_post_partition is called after do_prepare_partition if present. (From OE-Core rev: 5055489b9ab3fda32a285d0d165d080d11a4d432) Signed-off-by: Parthiban Nallathambi <pn@denx.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-02wic: Fix a path to a psuedo state directory (PSEUDO_LOCALSTATEDIR).Adrian Fiergolski
In case of 'new_rootfs' the psuedo directory is not copied. Thus PSEUDO_LOCALSTATEDIR should still point to the dsa 'native_sysroot'/../pseudo. Otherwise PSEUDO_LOCALSTATEDIR points to a not existing director ('new_rootfs'/../pseudo) and UID and GUID attributes are not applied to files of the image. (From OE-Core rev: 19642e2d6e015072e4a413f4f57aee65df757cb9) Signed-off-by: Adrian Fiergolski <adrian.fiergolski@cern.ch> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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. (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>
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. (From OE-Core rev: 7cdd4034b3e6ff4e13d491dfba24906afe495e2d) 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>
2017-11-07wic: 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. (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>
2017-07-21wic: implement wks option --mkfs-extraoptsEd Bartosh
This option specifies extra options to pass to mkfs.<fstype> utilities. [YOCTO #11709] (From OE-Core rev: 67b7c67edba305fbd31967baa10d27c2e603ec77) 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>
2017-06-23wic: code cleanupEd Bartosh
Split long lines. Removed unused imports. (From OE-Core rev: 49b704864c7db49e41a0b6bbdb8a2840e7fa232b) 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>
2017-06-23wic: flatten directory structureEd Bartosh
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>
2017-04-01wic: partition: Update fsck parametersDaniel Schultz
These parameters are copied from the ext image class. -D will let fsck perform further directory optimizations -v might be helpful for debugging purpose (From OE-Core rev: be93e378506a85772503005294503cfc348a552c) Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-01wic: remove prepare_empty_partition_squashfsEd Bartosh
There is not much sense in creation of empty squashfs partition. It's also not possible to create empty squashfs partition of specified size. Even more, prepare_empty_partition_squashfs method is absolutely broken. It raises exception when called and even its signature differs from the rest of of similar methods. It means that nobody uses it and it's safe to remove it. Removed prepare_empty_partition_squashfs method and testing of empty squashfs partition. (From OE-Core rev: 9152960f250cb4df1e559d747fb09005675a0d75) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-01wic: set FAT 16 for msdos partitionsEd Bartosh
Used '-F 16' parameter for mkdosfs to create FAT16 partitions for 'msdos' partition type. [YOCTO #11137] (From OE-Core rev: b6243a03ced9a719a5801afcee014b03313cc43c) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-01wic: support 'msdos' fstypeEd Bartosh
Added prepare_empty_partition_msdos and prepare_rootfs_msdos methods to support 'msdos' filesystem type. Created aliases prepare_empty_partition_vfat and prepare_rootfs_vfat to continue supporting creation of vfat patitiions. (From OE-Core rev: f06c507078da72f616f45effe5005cc01615a17c) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-01wic: don't silently skip unknown fstypesEd Bartosh
Fixed wic code that loops through hard-coded list of known fstypes to find prepare_rootfs_<fstype> or prepare_empty_partition_<fstype> methods and silently skipping unknown fstypes. (From OE-Core rev: ebb8fb5f81f473156c9aa4bf1965e538492a851b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>