Set of scripts used to create the RPiBuntu (custom Ubuntu for RPi) OS used in the building plan. The script are speerated, as they are called by the new root of chroot and need to be separated from the jenkins userspace
The masterBuilder is the main script that creates the basic system, it is quite complex, but consist of the following parts:
- Qemu-deboostrap -> A wrapper for the base debootstrap, that allows to 'hide' the CPU of the computer and use a differnt one instead (ARMv7 in this case)
- Qemu-user-static -> A binary of Qemu that allows to emulate only the processor and the the whole system.
- Debootstrap -> A tool that downloads the entire, basic catalog strocture of a debian based distro (together with the most basic binaries and programs like cat, nano, bash). This structure will be called a skeleton.
- Chroot -> The most used tool. Chroot allows to change a chosen folder as the root folder for a new user (so that the chosen folder is seen as the /, and all that is in it, as a the system parts)
The very operation of this script can be shown as a sequential list of operations:
- Create a folder structure to work with (BASEDIR/BUILDIR/CHROOT)
- Run Qemu-debootstrap to download the system skeleton (the --arch armfh flag will trigger the download for the armhf platform)
- Copy the Qemu-user-static binary form armhf to the skeleton (This will enable the use of chroot within the system with a different CPU)
- Mount additional, empty drives to the skeleton (/proc and /sys)
- Commands bellow are done in the new system with the help of chroot !
- Set /etc/apt/souces.list (! Setting is files is only possible with scipts or wrappers as the chroot will take 1 argument for the command)
- Update/Upgrade the skeleton to download missing base packages
- Set PPa for Raspberry Drivers
- Install standard packages (ubuntu-minimal/standard, ssh, no-kernel-bootloader, etc)
- Install basic Xserver packages (Optional)
- Install the kernel (flash-kernel is used, as it is non-platform dependent)
- Set FStab (!Important as the Raspberry Pi requires only 2 partitions: one acting as / and the second for /boot/firmware which has the boot drivers and settings)
- Set Host (hostname and /etc/hosts)
- Create basic user (hybris)
- Perform initial system cleanup (packages)
- Set initial interfaces (using /etc/network/interface as no network-manages is present yet)
- Set Firmware (!Important, this file has the config of CPU clock, voltage settings for the machine, and has to be tinkered with correctly)
- Enable sound drivers
- Disable modules that would broke the Pi (!Important, do not change)
- Unmount filesystem and cleanup (unmount /sys /proc /run/cgmanager/fs/ and then destroy all temporary files and saves)
- Use DD, mkfs, losetup and rsync to create the system image (RAW format as .img, but could use qemu-img to create Virtualbox readable format) and sync created files to it
- Zip and send to server (Optional)
Altough this method is used to create a system for the Raspberry Pi, with only a few adjustments it can be used to create system for the standart x64_86 processor. With that it is possible to ommit the system creation used by packer (downloading an iso with system instalation software, and installing it onto a blank virtual drive), but instead create ready-to-go virtual drives.
- Fully automatised with the use of scripts
- Base system is created, allowing full control of desired software
- Relativly fast
- Ready to go, rewritteable discs (Live-CD's)
- Can be changed to vagrant boxes
- More difficult to program than packer
- No debugging or verification modules, as it works on the system level
- Requires more system knowledge