summaryrefslogtreecommitdiffstats
path: root/target/imagebuilder
Commit message (Collapse)AuthorAgeFilesLines
* imagebuilder: fix addition of local packagesKuan-Yi Li2025-02-212-1/+1
| | | | | | | | | | | | | Since alpinelinux/apk-tools@460d62ee743c, relative paths are no longer accepted in repositories file. Add local repository in APK command instead to fix this issue. Fixes: 83d2d21904e0 ("apk: update to Git HEAD (2025-02-08)") Fixes: https://github.com/openwrt/openwrt/issues/18032 Signed-off-by: Kuan-Yi Li <kyli@abysm.org> Link: https://github.com/openwrt/openwrt/pull/18048 Signed-off-by: Robert Marko <robimarko@gmail.com>
* build: lock versions for special APK packagesPaul Spooren2025-02-042-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The three packages base-files, libc and kernel are special, the former can't be upgraded in place since it's content are modified on startup, the latter two are virtual packages only used as constraints for the package manager. Historically base-files was "locked" via a special OPKG function, the latter two were hidden from the package index and thereby never picked as possible upgrade. Time moved forward and we now have APK and tools like OWUT. The latter compares available packages with installed packages and generates user readable output, requiring versions for libc and kernel, too. At the same time, APK uses a different looking mechanism, which is set during installation instead of part of the package metadata. In short, this patch adds version constraints to the three packages, allowing them to be part of the package index. Fixes: #17774 Fixes: #17775 Fixes: efahl/owut#31 Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: fix OPKG package_whatdepends supportRobert Marko2024-11-201-1/+1
| | | | | | | | | | | | | Trying to use 'package_whatdepends' feature of the ImageBuilder with OPKG will currently fail as OPKG does not support "list --depends" call at all, it seems that this is a mixup from the original APK support commit. So, lets restore 'package_whatdepends' support for OPKG by calling "whatdepends -A" instead as we used to before APK support. Fixes: d788ab376f85 ("build: add APK package build capabilities") Link: https://github.com/openwrt/openwrt/pull/17022 Signed-off-by: Robert Marko <robimarko@gmail.com>
* imagebuilder: fix APK package_depends supportRobert Marko2024-11-201-1/+1
| | | | | | | | | | | | | | | | | Currently trying to use the 'package_depends' feature of ImageBuilder will result in it trying to call OPKG: make package_depends PACKAGE="usbutils" OK: 26 MiB in 142 packages bash: line 1: openwrt-imagebuilder-qualcommax-ipq807x.Linux-x86_64/staging_dir/host/bin/opkg: No such file or directory make: *** [Makefile:363: package_depends] Error 127 It looks like a copy/paste error when APK support was being added, so lets fix it by calling APK and its "info --depends" command. Fixes: #16996 Fixes: d788ab376f85 ("build: add APK package build capabilities") Link: https://github.com/openwrt/openwrt/pull/17022 Signed-off-by: Robert Marko <robimarko@gmail.com>
* imagebuilder: fix APK architecture settingRobert Marko2024-11-191-2/+2
| | | | | | | | | | | | | | | | | Currently, when "apk add --initdb" is called it will populate the /etc/apk/arch file with the architecture of the host instead of the target package architecture and this will then make it impossible for new packages to be installed on the device as the target architecture will not match after APK is updated to include [1]. So, lets use override the architecture by passing the target package one by using the "--arch" argument to "apk add". [1] https://gitlab.alpinelinux.org/alpine/apk-tools/-/commit/c1a3e69f24e235fc78f4dddb1f85fdf281464446 Fixes: #16953 Link: https://github.com/openwrt/openwrt/pull/17015 Signed-off-by: Robert Marko <robimarko@gmail.com>
* imagebuilder: fix DEFAULT_PACKAGES handlingPetr Štetiar2024-11-171-6/+1
| | | | | | | | | | | | | | DEFAULT_PACKAGES handling was moved in commit 40be892a020e ("imagebuilder: move handling of DEFAULT_PACKAGES into shareable place") to `include/default-packages.mk`, but they weren't removed from ImageBuilder's Makefile, so lets remove it now. Once removed, I've noticed, that it stopped working as there is target.mk included later in that file, overriding the DEFAULT_PACKAGES again, so moved it after this target.mk include. Fixes: 40be892a020e ("imagebuilder: move handling of DEFAULT_PACKAGES into shareable place") Signed-off-by: Petr Štetiar <ynezz@true.cz>
* imagebuilder: move handling of DEFAULT_PACKAGES into shareable placePetr Štetiar2024-11-171-0/+1
| | | | | | | | | It seems, that handling of DEFAULT_PACKAGES is needed in more places, so lets move it into dedicated include file so it can be easily shared. Signed-off-by: Petr Štetiar <ynezz@true.cz> Link: https://github.com/openwrt/openwrt/pull/16986 Signed-off-by: Robert Marko <robimarko@gmail.com>
* imagebuilder: fix APK keys dir creationKuan-Yi Li2024-11-131-1/+1
| | | | | | | | Make keys directory for APK instead of OPKG while adding local key. Signed-off-by: Kuan-Yi Li <kyli@abysm.org> Link: https://github.com/openwrt/openwrt/pull/16942 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: fix including busybox, procd and apk/opkg in imagebuilderFelix Fietkau2024-11-131-0/+5
| | | | | | | | | | Since the image builder pulls package lists from metadata directly, add procd and busybox as depdendencies to base-files. As for the package manager itself, since it can be disabled it needs to be added directly in the image builder makefile Fixes: 44598c233dd9 ("build: remove broken dependency of metadata on toplevel .config variables") Signed-off-by: Felix Fietkau <nbd@nbd.name>
* imagebuilder: fix OPKG package inclusionPaul Spooren2024-11-101-3/+4
| | | | | | | | | | | | In 451e2ce006 the code would only move packages separated by dashes, however OPKG uses underscores to split between package name and version. Result was the lack of such packages in the packed ImageBuilder. Use dashes or underscores depending on the select package manger. Fixes: 451e2ce006 "imagebuilder: fix package inclusion and APK index" Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: init APK dirs every timePaul Spooren2024-11-091-1/+1
| | | | | | | | | | | The `--initdb` command creates basic folders required by APK, previoiusly it would only run a single time when package_index is actually called. Since the function isn't called if nothing changes, `--initdb` doesn't initialize the rootfs again. This commit moves it to package_reload, which runs every time. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: cleanup package inclusionPaul Spooren2024-11-092-13/+4
| | | | | | | | | | | | | | | | | | | Previously three different ways to include packages in an ImageBuilder existed: * buildbot: include libc, kernel (and base-files) in $(IB_LDIR) * not buildbot, standalone: include all packages in ./packages/ * not buildbot, not standalone: include libc, kernel (and base-files) in ./packages/ First of, the separation between *buildbot* and *not buildbot, not standalone* is not required, we can just always copy packages to ./packages instead of ever using the special place $(IB_LDIR). Doing so drops the need to handle the extra case and also allows to clean up the OPKG package installation, which no longer requries the `firstword` logic, things are now always at ./packages. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: fix package inclusion and APK indexPaul Spooren2024-11-091-6/+6
| | | | | | | | | | | | We need to exclude packages from the APK index which must not be upgraded. To do so, the packages `libc`, `kernel` and `base-files` are excluded to APK never suggestes them as upgradable. The previous logic would however match packages like `libcomerr0`, causing build failures. Make the copying and excluding logic more precise by adding a single dash. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: fix APK for packages dir and cachePaul Spooren2024-11-092-7/+9
| | | | | | | | | | | | | | | | | This commit solves multiple issues. First of just install the three special packages base-files, libc and kernel directly from the index. In upstream indexes, those will never appear to prevent accidental upgrades may breaking the system. Next, enable caching for the ImageBuilder, which speeds up consecutive builds from ~33 seconds to ~5 seconds. Using cache however makes APK create the folder `/var/cache/apk/` which conflicts with the base-files installation, which ships a symlink from `/var` to `/tmp`, so specify `--no-cache` for the rootfs initialization. Lastly, drop the use of `apk update` since APK automatically does that. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: fix copying of missing kernel/libcPaul Spooren2024-10-302-4/+4
| | | | | | | Those packages were not copied due to OPKG using an underscore while APK uses dashes. Remove that char to copy kernel/libc for either APK/OPKG. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: always add local packages.adbPaul Spooren2024-10-291-0/+1
| | | | | | | It doesn't matter if `IB_STANDALONE` is enabled or not, local packages must always be considered. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: complete support for local signing keysChristian Marangi2024-10-291-3/+20
| | | | | | | | | | | | | Complete support for local signing keys for APK. A local key will be always generated, mkndx is always called with --allow-untrusted as it needs to replace the sign key with the new local one. With CONFIG_SIGNATURE_CHECK the local index is signed with the local key. Local public key is added with the ADD_LOCAL_KEY option. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: actually support IB from buildbotChristian Marangi2024-10-291-4/+8
| | | | | | | | | | | | | | | | | ImageBuilder compiled by buildbot doesn't have any package in the packages directory. Package needs to be downloaded instead. This works by calling update to the package manage to download the remove index and download the file. Fix missing support for this with APK, by configuring the --repositories-file option and calling the APK update. Also move the apk add --initdb to package_index. If CONFIG_SIGNATURE_CHECK is not enabled, the signature is not checked. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: correctly export PACKAGE_DIR and PACKAGE_DIR_ALLChristian Marangi2024-10-291-2/+2
| | | | | | | Correctly export PACKAGE_DIR and PACKAGE_DIR_ALL so that they won't be reset on internal call of rules.mk Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: copy apk keys with CONFIG_SIGNATURE_CHECKChristian Marangi2024-10-291-1/+4
| | | | | | With CONFIG_SIGNATURE_CHECK enabled, copy keys following OPKG pattern. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: also remove vmlinuz initramfs image filesChristian Marangi2024-10-221-0/+1
| | | | | | | | Also remove vmlinuz-initramfs files from final imagebuilder image as these file are not needed. Fixes: c85348d9abf4 ("imagebuilder: remove initramfs image files") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: remove initramfs image filesChristian Marangi2024-07-161-0/+3
| | | | | | | | | | | | Initramfs images are not supported by imagebuilder. With recent changes to support Per Device Rootfs, we now generate an image and a vmlinux for each Rootfs and these additional files are all shipped in the imagebuilder tar. Drop these new file and any vmlinux-initramfs as they are not used and increase the final size of the imagebuilder archive. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: fix broken IB_STANDALONE optionChristian Marangi2024-05-313-3/+18
| | | | | | | | | | | | | | | Fix broken IB_STANDALONE option for OPKG due to an error in ifdef logic where we weren't adding the required entry to reference the local files in repositories.conf Rework the ifdef to more explicit and restore original functionality of this option. While at it also provide different README for APK or OPKG. Fixes: d788ab376f85 ("build: add APK package build capabilities") Link: https://github.com/openwrt/openwrt/pull/15599 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* imagebuilder: fix multiple issue with manifest and sign keys handlingChristian Marangi2024-05-191-2/+10
| | | | | | | | | Fix multiple issue with manifest handling where APK was hardcoded and fix a logic error where (TODO) APK _check_keys was called for the OPKG codepath instead of correctly calling for the APK codepath. Fixes: d788ab376f85 ("build: add APK package build capabilities") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: add APK package build capabilitiesPaul Spooren2024-05-172-11/+62
| | | | | | | | | A new option called `USE_APK` is added which generated APK packages (.apk) instead of OPKG packages (.ipk). Some features like fstools `snapshot` command are not yet ported Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: use zstd for IB, toolchain, SDK and LLVM compressionPaul Spooren2024-04-131-4/+5
| | | | | | Use similar efficient but faster compression algorithm. Signed-off-by: Paul Spooren <mail@aparcar.org>
* treewide: remove implicit SUBTARGETPaul Spooren2024-04-082-2/+2
| | | | | | | | | | | | | | | | | | Historically it's possible to leave the `SUBTARGETS` undefined and automatically fallback to a "generic" subtarget. This however breaks various downstream scripts which may have expectations around filenames: While some targets with an explicit generic subtarget contain `generic` in the filenames of artifacts, implicit "subtargets" don't. Right now this breaks the CI[1], possibly also scripts using the ImageBuilders. This commit removes all code that support implicit handling of subtargets and instead requires every target to define "SUBTARGETS". [1]: https://github.com/openwrt/openwrt/actions/runs/8592821105/job/23548273630 Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: add check if target is sourced from feedFlorian Eckert2024-03-291-2/+7
| | | | | | | | The image generation would fail, if the target is included from a feed. To fix this, check if targets is found in the feed directory. Signed-off-by: Florian Eckert <fe@dev.tdt.de> Tested-by: Thomas Richard <thomas.richard@bootlin.com>
* imagebuilder: check if BOARD is located in the feeds sub directoryFlorian Eckert2024-03-291-1/+7
| | | | | | | | | Fixes the regression so that targets that were installed via a feed can also be build again with the Image Builder. Fixes: 84ec8c4 ("imagebuilder: copy from buildroot only target/linux") Signed-off-by: Florian Eckert <fe@dev.tdt.de> Tested-by: Thomas Richard <thomas.richard@bootlin.com>
* Revert "build: align SOURCE path for build system and SDK"Daniel Golle2024-02-121-2/+1
| | | | | | | | | This reverts commit 131e41614dcfae1f995e55330ada6573ca244ba3. Sadly it makes menuconfig fail with tmp/.config-package.in:171: glob failed: No files found "feeds/base/utils/busybox/Config.in" make: *** [/usr/src/openwrt/include/toplevel.mk:136: menuconfig] Error 1 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* build: align SOURCE path for build system and SDKPaul Spooren2024-02-121-1/+2
| | | | | | | | | | | | | | | Building a package in the build system or the SDK results in different values for the `SOURCE` property, it's either `packages/<package name>` or `feeds/base/<package name>`. The reason is that the SDK handles `openwrt.git` as an external feed called while the build system contains the *base* packages directly. Since packages created with either method are (ideally) the same (bit for bit), align the content of SOURCE. To do so this commit creates a symlink from `feeds/base` to `$(TOPDIR)/package` and adopts the SOURCE when building from inside the build system. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: copy from buildroot only target/linux/generic and ↵a-gave2024-01-151-2/+4
| | | | | | | | | | | | target/linux/<target> to reduce the size This reduces the size of a single imagebuilder by about 40MB In example for the target ath79 it would be the sum of generic and <target> directories, so about 16MB, instead of the whole size of the target directory, about 53MB: 11M target/linux/generic/ 3.9M target/linux/ath79/ Signed-off-by: a-gave <agave@dracaena.it>
* ib: split out processing user provided packagesTomasz Maciej Nowak2023-07-151-1/+3
| | | | | | | | | Some device recipes remove default target packages. If user tries to add them back they will be ignored, since packages list is processed in one go. Process the device recipe packages first and do user ones later, so additions won't get filtered out. Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
* treewide: add ORIG_PATH variableMichael Pratt2023-06-051-0/+1
| | | | | | | | | | | | | Add a variable that stores the original value of $PATH in the host system's shell, before Make alters it. This can be useful for when it is necessary to ignore symlinks and programs made by the build system. Define this new variable before all instances of 'export PATH:=' or similar. Signed-off-by: Michael Pratt <mcpratt@pm.me>
* imagebuilder: allow to specific ROOTFS_PARTSIZEPaul Spooren2023-03-141-1/+3
| | | | | | | | | | | Setting this options modifies the rootfs size of created images. When installing a large number of packages it may become necessary to increase the size to have enough storage. This option is only useful for supported devices, i.e. with an attached SD Card or installed on a hard drive. Signed-off-by: Paul Spooren <mail@aparcar.org>
* target/imagebuilder: add help text and rename whatdepends to package_whatdepensFlorian Eckert2023-01-061-2/+10
| | | | | | | Add the command `package_whatdepends` to show all package that have a dependency to this packages. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* target/imagebuilder: update help text for manifest targetFlorian Eckert2023-01-061-1/+2
| | | | | | | - Add a help text for the manifest command. - Unify command detail help text to use `manifest`. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* target/imagebuilder: change help text for image buildFlorian Eckert2023-01-061-1/+1
| | | | | | Using command `image` to unify help text. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* target/imagebuilder: add depends target to show all package that gets installedFlorian Eckert2023-01-061-1/+17
| | | | | | | | This commits adds the makefile targets `depends` this wrapper is a call to `opkg depends`. This command shows which runtime dependencies exist if this package is installed into the image. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* imagebuilder: export SOURCE_DATE_EPOCH to environmentDaniel Golle2022-04-101-0/+1
| | | | | | | | Export SOURCE_DATE_EPOCH to environment so filesystem and image creation tools will make use of it. Fixes reproducibility of images generated with the ImageBuilder. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* imagebuilder: fix broken image generation with external targetsPetr Štetiar2022-03-251-1/+1
| | | | | | | | | | When using external targets there is a symlink being created for the target under target/linux which then becomes dangling under Image Builder. Fix it by dereferencing the possible symlink. Tested on IB with external target, ipq40xx and mvebu. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* imagebuilder: fix local packages/ folderPaul Spooren2021-11-052-1/+16
| | | | | | | | | | | | | | | This commit fixes commit "2999f810ff: build,IB: include kmods only in local builds" which cause the local packages/ folder only to be added for local builds but no longer for ImageBuilder created by the Buildbot. The commits intention was to use remote kmods repositories rather than storing them locally. Accidentally the entire handling of the local `packages/` was removed. Re-add the folder and include a README describing what it can be used for. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: show architecture in `make info` outputPaul Spooren2021-09-231-0/+1
| | | | | | | Using `make info` show the current target, revision, default packages and available profiles. This commits adds the used architecture. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archiveSven Roederer2021-05-081-0/+2
| | | | | | | | | | | | | | | | | | | | | Using these config-options to customize the folders used at build-time makes these folder settings appear in generated archive. This causes the imagebuilder to be not portable, as it's going to use the build-time folders on the new systems. Errors look like: mkdir: cannot create directory '/mnt/build': Permission denied Makefile:116: recipe for target '_call_image' failed make[2]: *** [_call_image] Error 1 Makefile:241: recipe for target 'image' failed make[1]: *** [image] Error 2 The build-time settings of these folders are passed into the archives via .config file. The expected behavior is that after unpacking the imagebuilder acts like these settings have their defaults, using intree folders. So unset the build-time settings. Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
* build,ib: add STRIP_ABI option for manifestPaul Spooren2021-03-161-1/+2
| | | | | | | | | | | | The ImageBuilder `make manifest` prints all installed packages. This function can be used to create a list of package and corresponding package versions before attempting image creation. When called with `--strip-abi` OPKG can automatically strip attached ABIVersions from package names. Make this function accessible for the ImageBuilder by adding a `STRIP_ABI` variable. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: invoke bundle-libraries.sh w/o buildroot dirs in $PATHJo-Philipp Wich2020-12-291-1/+4
| | | | | | | | | | Invoke bundle-libraries.sh with any buildroot related directory entries removed from $PATH to avoid picking up cross versions of utilities like ldd which will not properly work when used against host executables. This should fix executable bundling for glibc-target imagebuilders. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* imagebuilder: fix partition signatureMatthew Gyurgyik2020-11-241-0/+2
| | | | | | | | | When building images with the imagebuilder, the partition signature never changes. The signature is generated by hashing SOURCE_DATE_EPOCH and LINUX_VERMAGIC which are undefined. Prepopulate these variables, as done by the SDK. Signed-off-by: Matthew Gyurgyik <matthew@gyurgyik.io>
* imagebuilder: fix main entry makefilePaulo Machado2020-11-231-1/+1
| | | | | | | Remove a syntax error from ImageBuider Makefile Acked-by: Paul Spooren <mail@aparcar.org> Signed-off-by: Paulo Machado <pffmachado@yahoo.com>
* imagebuilder: add package signature verificationPaul Spooren2020-11-192-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ImageBuilder downloads pre-built packages and adds them to images. This process uses `opkg` which has the capability to verify package list signatures via `usign`, as enabled per default on running OpenWrt devices. Until now this was disabled for ImageBuilders because neither the `opkg` keys nor the `opkg-add` script was present during first packagelist update. To harden the ImageBuilder against *drive-by-download-attacks* both keys and verification script are added to the ImageBuilder allowing `opkg` to verify downloaded package indices. This commit adds `opkg-add` to the ImageBuilder scripts folder. The keys folder is added to ImageBuilder $TOPDIR to have an obvious place for users to store their own keys. The `option check_signature` is appended to the repositories.conf file. All of the above only happens if the Buildbot runs with the SIGNATURE_CHECK option. The keys stored in the ImageBuilder keys/ are the same as included in the openwrt-keyring package. To avoid the chicken-egg problem of downloading and verifying a package, containing signing keys, the keys are added during the ImageBuilder generation. They are same as in shipped images (stored at `/etc/opkg/keys/`). To allow a local package feed in which the user can add additional packages, a local set of `usign` and `ucert` keys is generated, same as building OpenWrt from source. The private key signs the local repository inside the packages/ folder. The local public key is added to the keys/ folder to be considered by `opkg` when updating repositories. This way a local package feed can be modified while requiring `opkg` to check signatures for remote feed, making HTTPS optional. The new option `ADD_LOCAL_KEY` allows to add the local key inside the created images, adding the advantage that sysupgrades can validate the ImageBuilders local key. Signed-off-by: Paul Spooren <mail@aparcar.org>
* imagebuilder: fix sstripPaul Spooren2020-11-091-1/+1
| | | | | | | | Without an absolute path to staging_dir/host/bin/sstrip the Makefile tries to run a host installed version of sstrip, which is likely not available. Signed-off-by: Paul Spooren <mail@aparcar.org>