summaryrefslogtreecommitdiffstats
path: root/meta/classes/image_types_wic.bbclass
AgeCommit message (Collapse)Author
2022-08-12classes: Update classes to match new bitbake class scope functionalityRichard Purdie
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add SPDX license identifiersRichard Purdie
As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-04image_types_wic.bbclass: fix cross binutils dependencyChen Qi
Enable multilib and wic at the same time and we'll meet the following error. ERROR: Nothing PROVIDES 'virtual/i686-wrsmllib32-linux-binutils' Adjust the dependency to take multilib into consideration. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
2022-08-02wic: depend on cross-binutilsRoss Burton
Wic can build an unified kernel image, but this needs the cross-objcopy from binutils. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
2022-04-27wic: Add dependencies for erofs-utilsSean Anderson
In order to build erofs filesystems, wic must have the erofs-utils package installed into its sysroot. Fixes: 30375ce97 ("Add support for erofs filesystems") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-01wic/bootimg-efi: Add Unified Kernel Image optionKristian Klausen
"A unified kernel image is a single EFI PE executable combining an EFI stub loader, a kernel image, an initramfs image, and the kernel command line. [...] Images of this type have the advantage that all metadata and payload that makes up the boot entry is monopolized in a single PE file that can be signed cryptographically as one for the purpose of EFI SecureBoot."[1] This commit adds a create-unified-kernel-image=true option to the bootimg-efi plugin for creating a Unified Kernel Image[1] and installing it into $BOOT/EFI/Linux/ with a .efi extension per the the Boot Loader Specification[1][2]. This is useful for implementing Secure Boot. systemd-boot is the only mainstream bootloader implementing the specification, but GRUB should be able to boot the EFI binary, this commit however doesn't implement the necessary changes to the GRUB config generation logic to boot the Unified Kernel Image. [1] https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images [2] https://systemd.io/BOOT_LOADER_SPECIFICATION/ Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-07image_types_wic.bbclass: alphabetize list of WICVARSRobert P. J. Day
It's way easier to scan a list of variables if they're sorted one per line. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-30Convert to new override syntaxRichard Purdie
This is the result of automated script conversion: scripts/contrib/convert-overrides.py <oe-core directory> converting the metadata to use ":" as the override character instead of "_". Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-20image_types_wic: Move wic working directoryPaul Barker
By default the wic working directory is placed under the output directory. When invoking wic under bitbake, the wic output directory is added to PSEUDO_PATHS_IGNORE to avoid issues with files being removed from outside a pseudo environment (see oe-core commit ad8f5532ff). However, wic will copy the rootfs directory into its working directory if it needs to add or remove content before creating a filesystem image. This copy of the rootfs directory must be tracked by pseudo in order to keep the permissions correct in the resulting image. So we can't have the wic working directory under a path in PSEUDO_PATHS_IGNORE unless we like broken permissions. To fix this the new '-w' argument to wic is used to move the working directory away from the output directory. Note that wic deletes the temporary working directory automatically when it finishes creating an image so users won't normally see the 'tmp-wic' directory under WORKDIR. Fixes [Yocto #14129] Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-13wic: Allow exec_native_cmd to run HOSTTOOLSPaul Barker
This allows programs from HOSTTOOLS (e.g. 'install', 'rm', 'mv', etc) to be more easily executed by wic. Without this change only programs from an actual *-native recipe built by bitbake can be executed by wic. Signed-off-by: Paul Barker <pbarker@konsulko.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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-07base/bitbake.conf: Enable pseudo path filteringRichard Purdie
This is a pretty big change to the way pseudo operates when used in OpenEmbedded. Normally, pseudo monitors and logs (adds to its database) any file created or modified whilst in a fakeroot environment. There are large numbers of files we simply don't care about the permissions of whilst in that fakeroot context, for example ${S}, ${B}, ${T}, ${SSTATE_DIR}, the central sstate control directories, This change uses new functionality in pseudo to ignore these directory trees, resulting in a cleaner database with less chance of "stray" mismatches if files are modified outside pseudo context. It also should reduce some overhead from pseudo as the interprocess round trip to the server is avoided. There is a possible complication where some existing recipe may break, for example, we found a recipe which was writing to "${B}/install" for "make install" in do_install and since we listed ${B} as not to be tracked, there were errors trying to chown root for files in this location. This patch fixes a few corner cases in OE-Core when used with this new ignore list: * The archiver directory matched a "${WORKDIR}/deploy*" pattern so was renamed to something else since that directory does need its root permissions * The ${S} and ${B} ignoring is conditional on them being different to ${WORKDIR} * package_write_* task output (the debs/rpms/ipks) are now owned by the build user so we don't want the file ownership information in the hashequiv outhash calculation even if they are built under pseudo. * The fontcache postinstall intercept is run under qemu outside of pseudo context so delete files it may delete up front where pseudo can see this. * SSTATE_DIR is in PSEUDO_PATHS_IGNORE, which is in FAKEROOTENV which is cached by bitbake. We therefore need to trigger reparsing if this changes, which means SSTATE_DIR can be in BB_HASHBASE_WHITELIST but not BB_HASHCONFIG_WHITELIST. Rework the variables to handle this. This otherwise breaks some of our sstate tests in oe-selftest. * Ignore the temp directory wic uses for rebuilding rootfs. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-14wic/bootimg-efi: IMAGE_EFI_BOOT_FILES variable added to separate bootimg-efi ↵Khairul Rohaizzat Jamaluddin
and bootimg-partition Due to recent changes in bootimg-efi to include IMAGE_BOOT_FILES, when both bootimg-partition and bootimg-efi occur in a single .wks and IMAGE_BOOT_FILES are defined, files listed in IMAGE_BOOT_FILES will be duplicated in both partition. Since IMAGE_BOOT_FILES are crucial for bootimg-partition, but optional for bootimg-efi, hence allowing bootimg-efi to have the option to ignore it. The new variable, IMAGE_EFI_BOOT_FILES, was added to help handle this issue. Its basic usage is the same as IMAGE_BOOT_FILES. Usage example: ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img \ This commit is also squashed with the updated testcase to cover for this change. [YOCTO #14011] Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-27image_types_wic: Add ASSUME_PROVIDED to WICVARSVijai Kumar K
Add ASSUME_PROVIDED to WICVARS so that wic can use that when running on bitbake environment. This fixes the below build failure in do_image_wic when --include-path is used in wks file. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-05-19classes/image_types_wic: Reorder do_flush_pseudodbRicardo Ribalda
When IMAGE_FSTYPES contains more types than wic, it can happen than the pseudo database is not flushed properly. This can be solved by changing the order of when do_flush_pseudodb is launched. Yocto Bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13898 Fixes: dde90a5dd2b2 ("wic: Fix multi images .wks with bitbake") Signed-off-by: Ricardo Ribalda <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> Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-02-15wic: Honor APPENDKevin Hao
APPEND is used to add additional parameters to kernel by features, such as read-only-rootfs. So we should honor this variable when we compose the kernel parameter in wic. I know we also can resolve this kind of issue by using the .wks.in template introduced by commit 42e870c5ed4b ("image_types.bbclass: support template .wks.in files for wic"), but the APPEND is needed by all the wks, it would seems pretty ridiculous to me to change all the .wks to .wks.in and then foist the APPEND into them. So the APPEND is definitely deserved to export to the wic directly. [Yocto #12809] Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-10wic: Preserve intermediate filesPaul Barker
When debugging issues or trying to add new features in wic it's useful to examine the intermediate files created by the tool such as images of the individual partitions. Previously these files were created in a subdirectory of IMGDEPLOYDIR and, deleted by wic itself and then the working subdirectory completely removed at the end of IMAGE_CMD_wic. Instead we should work in a staging directory named build-wic and leave behind intermediate files for analysis if necessary. This has the added benefit of allowing individual partition images to be preserved by adding commands to IMAGE_CMD_wic_append() in an image recipe if needed. This is useful where an update system requires exact sized and pre-formatted partition images for deployment. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-31classes/image_types_wic: Depend on do_image_complete tasksJoshua Watt
do_image_wic now depends on the do_image_complete tasks from all it's dependencies. This allows images recipes specified in WKS_FILE_DEPENDS (for example, if a machine wants to put a initrd into a boot partition) to correctly trigger rebuilds for the wic image. Note that recrdeptask can't be used as was done for do_deploy because this would cause circular task dependency errors. This shouldn't be necessary anyway if the dependencies specified in WKS_FILE_DEPENDS are complete. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-08image_types_wic.bbclass: Copy the .wks and .env files to deploy image dirJason Wessel
When using a .wks.in file, the only place that the generated .wks file exists in the tmp/work area. A copy should be left behind in the deploy directory so that you can easily run the wic tool to re-generate or modify a new image without running bitbake. Custom .wks.in files can reference any number of bitbake variables, so it is important to save the result. below is an example of using the generated .wks file in the deploy area. The full name of my generated .wks file was core-image-minimal-ostree-uboot-ab.wks, but since you usually only have a single .wks file per image you can use a wild card like: cd tmp*/deploy/images/* wic create --vars . -e core-image-minimal -s -m core-image-minimal-*.wks Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-26image_types_wic: add syslinux-native dependency conditionalNaveen Saini
Add syslinux-native dependency only for IA host machines. Able to build wic image successfully for below template which uses legacy bios(syslinux): https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/scripts/lib/wic/canned-wks/directdisk-gpt.wks [YOCTO #13276] Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-17wic: add support for kernel with initramfs bundledChee Yang Lee
when INITRAMFS_IMAGE_BUNDLE and INITRAMFS_IMAGE are set, wic should look for kernel with initramfs image bundled. Include required variable MACHINE, INITRAMFS_IMAGE_BUNDLE, INITRAMFS_IMAGE, INITRAMFS_LINK_NAME and KERNEL_IMAGETYPE in WICVARS. No longer require default value for variable kernel as KERNEL_IMAGETYPE is not optional variable and included in WICVARS. image_types_wic to inherit kernel-artifact-names to obtain default INITRAMFS_LINK_NAME when INITRAMFS_IMAGE_BUNDLE are set. update wic.Wic2.test_image_env test case to filter optional variable INITRAMFS_LINK_NAME, INITRAMFS_IMAGE and INITRAMFS_IMAGE_BUNDLE. Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-04image_types_wic: add do_image_wic before do_image_completeMing Liu
We have some tasks depending on image's do_image_complete task, and we are also using WKS files to generate partitioned images, but now there is lacking a inter dependency between do_image_wic and do_image_complete, so we have to depend on both of them. Fixed by adding the dependency. Signed-off-by: Ming Liu <liu.ming50@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-12-21image_types_wic.bbclass: Ensure '-c image_wic' worksOtavio Salvador
The 'wic' image may use files which has been deployed (e.g in do_deploy) for some partitions that may need to be copied in a specific partition or filesystem (e.g a bootloader). When using 'bitbake <image> -c image_wic', from a clean build, the contents of do_deploy must also be available so we need to ensure all do_deploy of the image dependencies has been complete. Reported-by: Fabio Berton <fabio.berton@ossystems.com.br> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-26wic: remove systemd-boot for x32Saul Wold
Currently systemd-boot actually incorporates libgcc, since the systemd-boot needs to be built with 64bit instructions it can not use the x32 based libgcc. Use the new override to ensure it gets overriden, linux-gnux32 could not be used because x86-64 has higher priority. Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-25classes: drop image dependencies on TOPDIR variablePaul Eggleton
We don't need a dependency on this variable changing, and having one causes locked signature warnings during eSDK installation if you have INITRAMFS_IMAGE_* set (since TOPDIR will always be different between the eSDK and the environment in which it was built). Relates to [YOCTO #12102]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27image_types_wic: add dependency to e2fsprogs-nativeEd Bartosh
Added e2fsprogs-native to the list of default dependencies for wic (WKS_FILE_DEPENDS_DEFAULT) as all fs-related utilities have to be in this list. Thanks to Patrick Ohly for noticing this. [YOCTO #11817] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-17image_types_wic: set default WKS_FILE_DEPENDSEd Bartosh
The default set of dependencies used via wic-tools is not used anymore as wic images don't depend on wic-tools. Set of packages required to produce wic image depends on the content of the .wks file, so WKS_FILE_DEPENDS variable should be used to provide correct list of dependencies when WKS_FILE variable is set. As WKS_FILE_DEPENDS is not used in many existing recipes yet we need to provide default value for it to ensure that removal of wic-tool dependency doesn't cause image build failures. Initialized WKS_FILE_DEPENDS with the set of dependencies previously brought by wic-tool. This is done to provide compatibility and to avoid breakages of existing image recipes that rely on current set of dependencies. Note: This is a temporary solution for transition period. After some time the list will be either reduced or removed. Recommended solution is to use WKS_FILE_DEPENDS in image recipes together with WKS_FILE to specify dependencies. 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-03isoimage-isohybrid: don't use TRANSLATED_TARGET_ARCHEd Bartosh
isoimage-isohybrid plugin fails with this error when trying to find initrd image: initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, target_arch, image_type))[0] IndexError: list index out of range as it uses TRANSLATED_TARGET_ARCH value as part of the image. This approach stopped to work due to changes in oe core code. initrd file name is made using MACHINE variable. wic can't get value of this variable as it's not included into bitbake -e output. Used basename of deploy dir as MACHINE value to fix the breakage. (From OE-Core rev: cfbb3cc1279ea88ca3e2867f8a409c5120aa1f05) 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-03-21image_types_wic.bbclass: tighten dependency to help do_rm_work_allPatrick Ohly
Depending on wic-tools:do_build pulls a lot of additional, indirect dependencies into the image sysroot during do_image_wic as soon as rm_work.bbclass is active, because then we have do_build->do_rm_work_all->[all dependencies]. One of those dependencies is libgcc-initial, which clashes with libgcc itself, leading to errors in extend_recipe_sysroot like this: Exception: FileExistsError: [Errno 17] File exists: '.../tmp/sysroots-components/corei7-64/glibc-initial/usr/include/fstab.h' -> '.../tmp/work/intel_corei7_64-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/include/fstab.h' As the image recipe only needs the sysroot of wic-tools and does not need to wait for the build of wic-tools to finish, depending on do_populate_sysroot is the better choice and happens to avoid the problem above. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-04wic: add WKS_FILE_DEPENDS variableEd Bartosh
This variable should be used to specify dependencies that will be added to DEPENDS only if wic image build is 'active' i.e. when 'wic' is in IMAGE_FSTYPES. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-23image_types_wic: fix expansion errorEd Bartosh
Variable WKS_SEARCH_PATH was not fully expanded when used directly in this expression: WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or ''}" This caused expansion error: bb.data_smart.ExpansionError: Failure expanding variable WKS_FULL_PATH, .... which triggered exception SyntaxError: invalid syntax (WKS_FULL_PATH, line 1) Calling d.getVar instead of directly referencing variables should fix the issue. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-05image_types_wic: remove dependency to do_bootimgEd Bartosh
Removing task dependency do_wic -> do_bootimg as wic doesn't depend on hddimg/booimg anymore. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-05image: rename image-wic -> image_types_wicEd Bartosh
Make name of the wic image type class consistent with existing naming scheme for image types. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>