# Build Process

The MLL build process can be divided in several major phases. Refer to the common properties for more details on the folders that are referenced below.

- Preparations
- Kernel
- GNU C Library
- Busybox
- Overlay bundles
- Initramfs
- Boot loader
- ISO image

## Preparations

- 00_clean.sh

Everything from `WORK_DIR` is removed. All previous MLL build artifacts are lost and the MLL build process can start from scratch. The previously downloaded sources are preserved in order to speed up the process.

## Kernel

- 01_get_kernel.sh
- 02_build_kernel.sh

Linux kernel source code is downloaded. OverlayFS and EFI stub are configured. Kernel is built and the kernel binary, along with the kernel header files are placed in `KERNEL_INSTALLED`.

## GNU C Library

- 03_get_glibc.sh
- 04_build_glibc.sh
- 05_prepare_sysroot.sh

GNU C Library source code is downloaded. Build preparations are made in the `GLIBC_OBJECTS`. GLIBC is built and the final artifacts are placed in `GLIBC_INSTALLED`. The `.so` files, along with all GLIBC headers and all kernel headers are placed in `SYSROOT`.

## Busybox

- 06_get_busybox.sh
- 07_build_busybox.sh

Busybox source code is downloaded. The build configuration is tweaked to reference `SYSROOT`. The final build artifacts are placed in `BUSYBOX_INSTALLED`.

## Overlay bundles

- 08_prepare_bundles.sh

All overlay bundles that have been enabled in `.config` are built. The final overlay structure is generated in `OVERLAY_ROOTFS`.

## Initramfs

- 09_generate_rootfs.sh
- 10_pack_rootfs.sh
- 11_generate_overlay.sh

The installed Busybox artifacts and `src/minimal_rootfs/` are merged in `ROOTFS`. The initramfs file `WORK_DIR/rootfs.cpio.xz` is generated from `ROOTFS`. The final initramfs ISO image structure for the overlay bundles is generated in `ISOIMAGE_OVERLAY`.

## Boot loader

- 12_get_syslinux.sh
- 12_get_systemd-boot.sh

Syslinux and/or systemd-boot are downloaded.

## ISO image

- 13_prepare_iso.sh
- 14_generate_iso.sh
- 15_generate_image.sh
- 16_cleanup.sh

The boot loader for BIOS/UEFI is prepared and the boot configuration artifacts from `src/minimal_boot/` are properly placed. The final ISO image layout structure is prepared in `ISOIMAGE`. This directory contains the BIOS/UEFI boot loader, Linux kernel and initramfs, along with all MLL overlay bundles (i.e. additional software and/or configurations) that have been enabled. The ISO image file `src/minimal_linux_live.iso` is generated. The MLL filesystem image (e.g. use in Docker) `src/mll_image.tgz` is generated. Final cleanup is performed.