Skip to content

miraclelinux/meta-emlinux

Repository files navigation

Quick Start

Supported build host

EMLinux supported build host OS is Debian 11 or greater.

Build environment setup

Build by docker

Install the docker engine and docker-compose command

You can build and image by docker. If you want to build image, you need docker engine and docker-compose. Please refer to official web site to install the docker engine (https://docs.docker.com/engine/install/) and the docker-compose command (https://docs.docker.com/compose/install/other/).

Install the qemu-user-static

You need to install the qemu-user-static package on the host PC to enable cross-building on docker.

$ sudo apt install qemu-user-static

Build a docker image

The docker/ directory contains build script and docker-compose.yml file.

  1. Goto docker/ directory
$ cd docker

Then, build docker image and logged into docker container.

$ ./run.sh

Build directly on your host

Setup host os development environment

If you want to set up directly on your build host, please refer to following steps.

Run following command to install required packages.

$ sudo apt install \
  binfmt-support \
  debootstrap \
  dosfstools \
  dpkg-dev \
  gettext-base \
  git \
  mtools \
  parted \
  python3 \
  quilt \
  qemu-user-static \
  reprepro \
  git-buildpackage \
  pristine-tar \
  sbuild \
  schroot \
  zstd \
  python3-distutils

Setup user

  1. Add user to the sbuild group
$ sudo gpasswd -a <username> sbuild
  1. Setup sudo

Building EMLinux, user need to be able to run sudo command as root.

Please follow "Setup Sudo" section in ISAR user manual.

https://github.com/ilbers/isar/blob/master/doc/user_manual.md#setup-sudo

Setup repositories

Download laysers to your build environment.

  1. Create a directory
$ mkdir repos
  1. Checkout meta-emlinux
$ git clone -b bookworm https://github.com/miraclelinux/meta-emlinux.git repos/meta-emlinux
  1. Setup build directory
$ source repos/meta-emlinux/scripts/setup-emlinux build

Build image

  1. Edit conf/local.conf

If you want to add package/change machine/etc edit conf/local.conf. For example, if you want build qemu-arm64 image that includes iproute2 package, add folloinwg lines in conf/local.conf.

MACHINE = "qemu-arm64"
IMAGE_PREINSTALL = "iproute2"
  1. Build image

Specify an image as either emlinux-image-base or emlinux-image-weston, then run bitbake.

$ bitbake <image>

Run image by qemu

Run emlinux-image-base

On qemu-amd64

qemu-system-x86_64 \
 -drive file=./tmp/deploy/images/qemu-amd64/emlinux-image-base-emlinux-bookworm-qemu-amd64.ext4,discard=unmap,if=none,id=disk,format=raw \
 -kernel ./tmp/deploy/images/qemu-amd64/emlinux-image-base-emlinux-bookworm-qemu-amd64-vmlinuz \
 -initrd ./tmp/deploy/images/qemu-amd64/emlinux-image-base-emlinux-bookworm-qemu-amd64-initrd.img \
 -m 1G \
 -serial mon:stdio \
 -netdev user,id=net,hostfwd=tcp:127.0.0.1:22222-:22 \
 -cpu qemu64 \
 -smp 4 \
 -machine q35,accel=kvm:tcg \
 -global ICH9-LPC.noreboot=off \
 -device virtio-net-pci,netdev=net \
 -device ide-hd,drive=disk \
 -nographic \
 -append "root=/dev/sda rw console=ttyS0 ip=dhcp"

On qemu-arm64

qemu-system-aarch64 \
 -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 \
 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,tftp=./tmp/deploy/images/qemu-arm64 \
 -drive id=disk0,file=./tmp/deploy/images/qemu-arm64/emlinux-image-base-emlinux-bookworm-qemu-arm64.ext4,if=none,format=raw \
 -device virtio-blk-device,drive=disk0 -device VGA,edid=on \
 -device qemu-xhci \
 -device usb-tablet \
 -device usb-kbd \
 -object rng-random,filename=/dev/urandom,id=rng0 \
 -device virtio-rng-pci,rng=rng0  \
 -nographic \
 -machine virt \
 -cpu cortex-a57 \
 -m 512 \
 -serial mon:stdio \
 -serial null \
 -kernel ./tmp/deploy/images/qemu-arm64/emlinux-image-base-emlinux-bookworm-qemu-arm64-vmlinux \
 -initrd ./tmp/deploy/images/qemu-arm64/emlinux-image-base-emlinux-bookworm-qemu-arm64-initrd.img \
 -append 'root=/dev/vda rw highres=off  console=ttyS0 mem=512M ip=dhcp console=ttyAMA0 '

On qemu-arm

qemu-system-arm \
 -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 \
 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,tftp=./tmp/deploy/images/qemuarm \
 -drive id=disk0,file=./tmp/deploy/images/qemu-arm/emlinux-image-base-emlinux-bookworm-qemu-arm.ext4,if=none,format=raw \
 -device virtio-blk-device,drive=disk0 -device VGA,edid=on \
 -device qemu-xhci \
 -device usb-tablet \
 -device usb-kbd \
 -object rng-random,filename=/dev/urandom,id=rng0 \
 -device virtio-rng-pci,rng=rng0  \
 -nographic \
 -machine virt \
 -cpu cortex-a15 \
 -m 512 \
 -serial mon:stdio \
 -serial null \
 -kernel ./tmp/deploy/images/qemu-arm/emlinux-image-base-emlinux-bookworm-qemu-arm-vmlinuz \
 -initrd ./tmp/deploy/images/qemu-arm/emlinux-image-base-emlinux-bookworm-qemu-arm-initrd.img \
 -append 'root=/dev/vda rw highres=off  console=ttyS0 mem=512M ip=dhcp console=ttyAMA0 '

Run emlinux-image-weston

On qemu-amd64

qemu-system-x86_64 \
 -drive file=./tmp/deploy/images/qemu-amd64/emlinux-image-weston-emlinux-bookworm-qemu-amd64.ext4,discard=unmap,if=none,id=disk,format=raw \
 -kernel ./tmp/deploy/images/qemu-amd64/emlinux-image-weston-emlinux-bookworm-qemu-amd64-vmlinuz \
 -initrd ./tmp/deploy/images/qemu-amd64/emlinux-image-weston-emlinux-bookworm-qemu-amd64-initrd.img \
 -m 1G \
 -serial mon:stdio \
 -netdev user,id=net,hostfwd=tcp:127.0.0.1:22222-:22 \
 -cpu qemu64 \
 -smp 4 \
 -machine q35,accel=kvm:tcg \
 -global ICH9-LPC.noreboot=off \
 -device virtio-net-pci,netdev=net \
 -device ide-hd,drive=disk \
 -device usb-ehci,id=ehci \
 -device usb-tablet \
 -device usb-kbd \
 -device VGA \
 -append "root=/dev/sda rw console=ttyS0 ip=dhcp"

On qemu-arm64

qemu-system-aarch64 \
 -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 \
 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,tftp=./tmp/deploy/images/qemuarm64 \
 -drive id=disk0,file=./tmp/deploy/images/qemu-arm64/emlinux-image-weston-emlinux-bookworm-qemu-arm64.ext4,if=none,format=raw \
 -device virtio-blk-device,drive=disk0 -device VGA,edid=on \
 -device usb-ehci,id=ehci \
 -device usb-tablet \
 -device usb-kbd \
 -object rng-random,filename=/dev/urandom,id=rng0 \
 -device virtio-rng-pci,rng=rng0 \
 -machine virt \
 -cpu cortex-a57 \
 -m 512 \
 -serial mon:stdio \
 -serial null \
 -kernel ./tmp/deploy/images/qemu-arm64/emlinux-image-weston-emlinux-bookworm-qemu-arm64-vmlinux \
 -initrd ./tmp/deploy/images/qemu-arm64/emlinux-image-weston-emlinux-bookworm-qemu-arm64-initrd.img \
 -append 'root=/dev/vda rw highres=off  console=ttyS0 mem=512M ip=dhcp console=ttyAMA0 '

On qemu-arm

qemu-system-arm \
 -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 \
 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,tftp=./tmp/deploy/images/qemuarm \
 -drive id=disk0,file=./tmp/deploy/images/qemu-arm/emlinux-image-weston-emlinux-bookworm-qemu-arm.ext4,if=none,format=raw \
 -device virtio-blk-device,drive=disk0 -device VGA,edid=on \
 -device usb-ehci,id=ehci \
 -device usb-tablet \
 -device usb-kbd \
 -object rng-random,filename=/dev/urandom,id=rng0 \
 -device virtio-rng-pci,rng=rng0  \
 -M virt-2.12 \
 -cpu cortex-a15 \
 -m 512 \
 -serial mon:stdio \
 -serial null \
 -kernel ./tmp/deploy/images/qemu-arm/emlinux-image-weston-emlinux-bookworm-qemu-arm-vmlinuz \
 -initrd ./tmp/deploy/images/qemu-arm/emlinux-image-weston-emlinux-bookworm-qemu-arm-initrd.img \
 -append 'root=/dev/vda rw highres=off  console=ttyS0 mem=512M ip=dhcp console=ttyAMA0 '

Supported machine

EMLinux currently supports following machines.

  • qemu-amd64
  • qemu-arm64
  • qemu-arm
  • generic-x86-64
  • raspberrypi3bplus-64
  • raspberrypi4b-64
  • raspberrypi400-64

Sample Recipe

There are some sample recipes under doc/samples/recipes-sample/ directory. Currently you can see following sample recipes.

  • openssl-apt
    This recipe downloads openssl source package using apt://. This recipe shows how to change build option and how to add new patch for source code.
  • openssl-http
    This recipe downloads openssl source package using http://. This recipe shows how to change build option and how to add new patch for source code.
  • openssl-git
    This recipe downloads openssl source package using git://. This recipe shows how to change build option.

License

All metadata is MIT licensed unless otherwise stated. Source code included in tree for individual recipes is under the LICENSE stated in the associated recipe (.bb file) unless otherwise stated.

See COPYING.MIT for more details about MIT license.

Community Resources

Project home