Build internals

To build a package with, you will only need the command. Optionally with  to build even if the package was already built, and with   to build for another architecture, replace   accordingly. This wiki page lists some more information about what is going on in the background.

initramfs
The initramfs shows the boot splash images, and allows the root partition to be unlocked (currently via telnet). You can add a hook to inspect the initramfs running on the device, as described in Inspecting the initramfs.

To rebuild the initramfs, run  inside the chroot with the right parameters (or - much easier -  ). This gets done automatically, whenever a new kernel gets installed, or when the  package gets installed the first time.

pmbootstrap vs. abuild
wraps around (Alpine's official program to build apks), but it does a few things different than   (which internally often calls  ):


 * can cross-compile out of the box, utilizing different chroots as needed (see below for details)
 * does dependency parsing on its own (so it works across the  folder and the binary repository and can detect across chroots when a package is outdated and explicitly install them).
 * does not honor operators in dependencies, such as:,  ,  ,  . These simply get ignored (  packages don't count as dependencies). This may lead to errors, if it does please report them. However, since we're calling   to install the packages, it does the real dependency checking and so far it's working well enough.
 * parses  and   files on its own.
 * parsing is considered to be pretty good (because the format is dead simple!)
 * parsing would require a shell to be done perfectly (which would in turn kill performance). The way it is implemented right now, is that the variables we care about are hardcoded inside the  or if not possible otherwise directly in  . That is really fast and works for all packages we care about. If it breaks somewhere, it should be easy to patch.
 * does not remove build dependencies after a build is done (except when using ). This is for performance reasons - if you want a clean start, run.
 * has a hack right now, that  always uses weak compression (also for speed)

Cross-compile types
These are the cross-compile types supported. figures out, which one is the right one for each build.


 * : The target architecture is the same as the "native" architecture (e.g. compiling  for   on an   system).
 * : the build system of the package understands cross-compiling, like all kernel packages. We can use the native chroot with the cross-compiler inside that chroot for maximum speed.
 * : the native chroot gets mounted in the foreign arch chroot, and with some magic we can redirect everything to the cross compilers . This is the default method, however some packages fail with this method, you can revert to the slower but more reliable QEMU emulation with.

Performance related issues

 * Use "native" for (almost) all packages?

Caches
uses various caches. They can all be found inside the  folder, and start with. All cache folders get mounted to the appropriate chroots, depending on $ARCH. They are shared among the chroots, when it makes sense (e.g. ).


 * : APK files from binary repositories (see also: Local APK cache)
 * : ccache: Whenever you compile something with, the output gets cached in this folder (depending on the architecture). When you compile the same code for the second time, the cached output gets used, thus saving you a lot of time (think of re-compiling kernels, because you want to test another kernel config option etc.)
 * : Whenever you build a package,  (which pmbootstrap wraps) will download the source files to the   cache (and skip these downloads, when they already exist). The exact file name can be controlled inside the APKBUILD (more info).
 * :  can download git repositories. This gets used in , which copies a package (aka. aport) from Alpine Linux and customizes it (for example:  ), so we inherit all patches and changes automatically, without much maintenance work. The git repos get stored inside this folder.
 * : This stores files, that get downloaded with, so they don't need to be downloaded again every time. Currently, this gets used for the initial download of Alpine Linux' main repositories  and apk-tools-static (which is a static build of the   package manager, used to set up the chroot).

Why noarch packages are built for each architecture
For a  package, we could in theory compile it once and then create symlinks to all arches pointing to the package where we have created it. And previous versions of pmbootstrap used to do that. But that makes dependency parsing hard.

For example: device packages are always, so in theory you could compile the device package for your   device in  , and then symlink it to the   package folder. But it would still depend on the kernel, which is  only for that device (assuming it is not mainlined, like most devices are right now). So it would not make sense to install it in  anyway, and if you would want to build it, you could only really do it in   anyway, because that's where the kernel is available.

So to simplify it, it is handled like in Alpine now; noarch packages just get built for each arch independently.

pmbootstrap specific APKBUILD options
For various reasons, we have added support for the following pmbootstrap specific values in APKBUILD options.


 * : do not use the crossdirect method . pmbootstrap will just build completely in qemu (slow).
 * : for linux-* packages only. When set, the given linux package does not fail "pmbootstrap kconfig check".
 * : build the package using the "native" cross compilation method
 * : used for UI specific packages to define GPU acceleration requirement
 * : always build the package in strict mode, even if --strict is not passed to "pmbootstrap build".