This project creates a fully customized embedded Linux image from the source (like Linux From Scratch). You can use this project to fully customize your embedded Linux image, like changing kernel configuration, creating new Linux distros, customizing images for other board variants, etc. For using the project, there is no need to meet or set up any special environment as it uses Docker. I've used BeagleBone Black as the target system with Ubuntu 18.04 and Ti's Linux Kernel 4.19.94.
- Based on Docker so can be run on any machine without any requirements
- Build Kernel, DTS, modules, and headers from the source
- Build Bootloader (u-boot) from the source
- Can be combined with any Linux distribution
- Create image file (.img) as output file for easy writing to SD card
- High-speed build with the help of Linaro toolchain and Docker engine
- Can be customized for any Embedded Linux system with the least configuration change
- Docker and Docker Compose
- If you are using Windows, make sure to use the latest WSL 2 backend as the device-mapper kernel driver is missing in older WSL versions. Otherwise, you need to build the SD Card manually.
- Download resource files and put them in the
resources
directory:- Linaro cross-compile toolchain.
- You can get the binaries from here.
- Linux Kernel source for your board.
- For BeagleBone Black, you can use the official kernel
- u-boot source code.
- A base rootfs Linux distro.
- You can grab Ubuntu or Debian distro from here.
- Ubuntu 18.04.3 used in this project.
- As the compile process may take longer, you need to increase the Docker engine resources:
- Linaro cross-compile toolchain.
-
Make sure that you've met the requirements and have put the necessary files in the
resources
directory:-
For example:
project └───resources │ │ armhf-rootfs-ubuntu-bionic.tar │ │ gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar │ │ linux-4.19.94-ti-rt-r41.tar.gz │ │ u-boot-2020.04-rc3.tar.gz
-
-
Make sure to decompress the Linux rootfs to get the right compressed file. The files contain all the Linux rootfs inside its root directory (e.g.,
armhf-rootfs-ubuntu-bionic.tar
). -
Set the Dockerfile parameters in
docker-compose.yml
:kernel_version
: kernel version in X.Y.Z formatkernel_filename
: kernel source file pathkernel_defconfig
: kernel configuration fileuboot_filename
: u-boot source file pathuboot_defconfig
: u-boot configuration filerootfs_filename
: Linux Root file system pathlinaro_filename
: Linaro toolchain file path
-
Bring up the console and navigate to the project root directory, and execute
docker-compose up --build
-
If the process is complete successfully, you should get the image file
sd_image.img
androotfs.tar.gz
in theoutput
directory. -
You can write
sd_image.sd
directly to the SD Card or manually partition your SD and copy the contents ofrootfs.tar.gz
into the SD partitions.
- Masoud Rahimi: masoudrahimi.com