# Common Properties And Functions * [Properties](#properties) * [Functions](#functions) --- The shell script file [common.sh](https://github.com/ivandavidov/minimal/blob/master/src/common.sh) is sourced in all MLL scripts. It provides common properties and functions. ## Properties #### SRC_DIR ``SRC_DIR=src/`` This is the main source directory, i.e. the property references the main project directory ``src/``. #### CONFIG ``CONFIG=src/.config`` This is the main configuration file. The configuration properties are described [here](TODO...). #### SOURCE_DIR ``SOURCE_DIR=src/source/`` This is the directory where all source archives are downloaded. #### WORK_DIR ``WORK_DIR=src/work/`` This is the directory where all MLL artifacts are processed. All build actions happen in this directory. #### KERNEL_INSTALLED ``KERNEL_INSTALLED=src/work/kernel/kernel_installed/`` This is the directory where the kernel and its corresponding header files are placed after the kernel build phase has been completed. #### GLIBC_OBJECTS ``GLIBC_OBJECTS=src/work/glibc/glibc_objects/`` This is the directory where the GNU C Library is going to be built. #### GLIBC_INSTALLED ``GLIBC_INSTALLED=src/work/glibc/glibc_installed/`` This is the directory where the GNU C Library shared objects (.so files) are placed after the build phase has been completed. #### BUSYBOX_INSTALLED ``BUSYBOX_INSTALLED=src/work/busybox/busybox_installed/`` This is the directory where Busybox is placed after the build phase has been completed. #### SYSROOT ``SYSROOT=src/work/sysroot/`` The system root folder for MLL. This folder contains GLIBC, and kernel header files. MLL uses the sysroot folder in order to properly link Busybox with the custom built kernel and GLIBC. #### ROOTFS ``ROOTFS=src/work/rootfs/`` This folder contains the rootfs/initramfs structure which is generated by the core MLL build process. #### OVERLAY_ROOTFS ``OVERLAY_ROOTFS=src/work/overlay_rootfs/`` This folder contains the rootfs/initramfs structure which is generated by the overlay subsystem build process. #### ISOIMAGE ``OVERLAY_ROOTFS=src/work/isoimage/`` This folder contains the final ISO image structure. #### ISOIMAGE_OVERLAY ``OVERLAY_ROOTFS=src/work/isoimage_overlay/`` This folder contains the final overlay subsystem ISO structure. ## Functions #### read_property(prop_name) This function reads properties from the main ``.config`` file. ```bash # Example JOB_FACTOR=`read_property JOB_FACTOR` ``` #### download_source(url, file_to_save) This function downloads the ``url`` resource and saves it as ``$file_to_save``. ```bash # Example # # This is the filesystem structure before the execution # of the function. # # src/ # └── source/ # └── (no files/folders) download_source \ 'https://busybox.net/downloads/busybox-1.32.0.tar.bz2' \ $SOURCE_DIR/busybox-1.32.0.tar.bz2 # This is the filesystem structure after the execution # of the function. # # src/ # └── source/ # └── busybox-1.32.0.tar.bz2 ``` #### extract_source(archive_file, dest_dir) This function extracts the archive ``archive_file`` in the directory ``src/work/$dest_dir/``. ```bash # Example # # This is the filesystem structure before the execution # of the function. # # src/ # ├── source/ # │ └── busybox-1.32.0.tar.bz2 # └── work/ # └── (no files/folders) extract_source \ $SOURCE_DIR/busybox-1.32.0.tar.bz2 \ busybox # This is the filesystem structure after the execution # of the function. # # src/ # ├── source/ # │ └── busybox-1.32.0.tar.bz2 # └── work/ # └── busybox # └── busybox-1.32.0/ ```