/ebcl_testing

Primary LanguageShellMIT LicenseMIT

EB corbos Linux workspace template

This repository contains a VS Code workspace template for EB corbos Linux application and image development.

Content

The workspace is structured in the following way:

  • .devcontainer: VS Code devcontainer configuration files
  • .vscode: VS Code configuration files
  • apps: applications and config packages
    • my-config: config package example
    • my-json-app: user app packaging example
  • apt: workspace specific apt repository
  • bin: workspace specific scripts and binaries
  • gpg-keys: workspace keys for repository signing
    • env.sh: user identity for Debian packaging
  • images: example image descriptions
    • qemu-crinit-aarch64: QEMU example image for Arm aarch64 CPU architecture using crinit init manager
    • qemu-crinit-x86_64: QEMU example image for Intel x86_64 CPU architecture using crinit init manager
    • qemu-systemd-aarch64: QEMU example image for Arm aarch64 CPU architecture using systemd init manager
    • qemu-systemd-x86_64: QEMU example image for Intel x86_64 CPU architecture using systemd init manager
    • raspberry-pi-crinit: Raspberry Pi 4 image using crinit init manager
    • raspberry-pi-systemd: Raspberry Pi 4 image using systemd init manager
    • rdb2-crinit: RDB2 image using crinit init manager
    • rdb2_systemd: RDB2 image using systemd init manager
  • result: build results
    • app: app build and packaging results
    • image: image build results
  • sysroot_aarch64: sysroot for cross-compiling for Arm aarch64 CPU architecture
  • sysroot_x86_64: sysroot for cross-compiling for Intel x86_64 CPU architecture

Usage

The workspace can be used with a VS Code setup with dev containers support. For details how to setup this environment, please take a look at https://code.visualstudio.com/docs/devcontainers/containers.

To prepare the sysroots, build the app, and build the images, you can make use of the provided tasks in .vscode/tasks.json. These tasks are considered as a template for your own use case specific tasks. To run a task, press "CTRL" + "SHIFT" + "B". This will bring up a menu showing all the available tasks.

This workspace provides the following example tasks:

  • EBcL: Image Raspberry Pi crinit: Build the Rasperry Pi crinit image.
  • EBcL: Image Raspberry Pi systemd: Build the Rasperry Pi systemd image.
  • EBcL: Image qemu-crinit (aarch64): Build the aarch64 QEMU crinit image.
  • EBcL: Image qemu-crinit (x86_64): Build the x86_64 QEMU crinit image.
  • EBcL: Image qemu-systemd (aarch64): Build the aarch64 QEMU systemd image.
  • EBcL: Image qemu-systemd (x86_64): Build the x86_64 QEMU systemd image.
  • EBcL: Image rdb2-systemd: Prepare sysroot RDB2 systemd image.
  • EBcL: Image rdb2-crinit: Prepare sysroot RDB2 crinit image.
  • EBcL: Run QEMU crinit (aarch64): Run the QEMU crinit aarch64 image.
  • EBcL: Run QEMU crinit (x86_64): Run the QEMU crinit x86_64 image.
  • EBcL: Run QEMU systemd (aarch64): Run the QEMU systemd aarch64 image.
  • EBcL: Run QEMU systemd (x86_64): Run the QEMU systemd x86_64 image.
  • EBcL: Sysroot Raspberry Pi crinit: Prepare sysroot aarch64 for the Rasperry Pi crinit image.
  • EBcL: Sysroot Raspberry Pi systemd: Prepare sysroot aarch64 for the Rasperry Pi systemd image.
  • EBcL: Sysroot qemu-crinit (aarch64): Prepare sysroot aarch64 QEMU crinit image.
  • EBcL: Sysroot qemu-crinit (x86_64): Prepare sysroot x86_64 QEMU crinit image.
  • EBcL: Sysroot qemu-systemd (aarch64): Prepare sysroot aarch64 QEMU systemd image.
  • EBcL: Sysroot qemu-systemd (x86_64): Prepare sysroot x86_64 QEMU systemd image.
  • EBcL: Sysroot rdb2-systemd: Prepare sysroot RDB2 systemd image.
  • EBcL: Sysroot rdb2-crinit: Prepare sysroot RDB2 crinit image.
  • EBcL: App (aarch64): Build CMake App for aarch64.
  • EBcL: App (x86_64): Build CMake App for x86_64.
  • EBcL: Generate signing key: Generate a signing key for Debian packageing. Please update gpg-keys/env.sh before running this task!
  • EBcL: Generate Debian metadata for app: Generate the Debian metadata for the app. Please update gpg-keys/env.sh before running this task!
  • EBcL: Generate Debian metadata for config: Generate the Debian metadata for the app. Please update gpg-keys/env.sh before running this task!
  • EBcL: Package app (x86_64): Generate the x86_64 Debian package of the app. Debian metadata and the sysroot must be avaiable!
  • EBcL: Package app (aarch64): Generate the aarch64 Debian package of the app. Debian metadata and the sysroot must be avaiable!
  • EBcL: Prepare local repository: Generate apt repositry metadata and Berrymill config for generated Debian packages.
  • EBcL: Serve app packages: Serve the apt repository containg the generated Debian packages.
  • EBcL: Serve workspace apt folder: Serve the apt repository containg the generated Debian packages.
  • EBcL: Build config package: Build a platform indepent Makefile package.

The used EB corbos Linux SDK container provides the following commands:

Commands for image building:

  • cross_build_image.sh "path to image description folder": build an aarch64 image description
  • box_build_image.sh "path to image description folder": build an x86_64 image description
  • kvm_build_image.sh "path to image description folder": build an x86_64 image description using KVM acceleration. To use this command, the host must support KVM virtualization, and the container must be executed in privileged mode (see .devcontainer/devcontainer.json).

Commands for image testing:

  • qemu_efi_aarch64.sh "path to disk image": runs a QEMU VM using the given Arm aarch64 disk image This command expects that the image supports EFI boot.
  • qemu_efi_x86_64.sh "path to disk image": runs a QEMU VM using the given Intel x86_64 disk image This command expects that the image supports EFI boot.

Commands for sysroot preparation:

  • cross_build_sysroot.sh "path to image description folder": prepares an aarch64 sysroot for the given image description Please clear the Arm aarch64 sysroot folder sysroot_aarch64 before running this command.
  • box_build_sysroot.sh "path to image description folder": prepares an x86_64 sysroot for the given image description Please clear the Intel x86_64 sysroot folder sysroot_x86_64 before running this command.

Commands for app compilation:

  • cmake_aarch64.sh "path to app source folder": cross-compile the given cmake app for the image used to prepare the sysroot_aarch64
  • cmake_x86_64.sh "path to app source folder": compile the given cmake app for the image used to prepare the sysroot_x86_64

Commands for Debian packaging:

  • prepare_deb_metadata.sh "path to app source folder" "package name" "package version": initally generate the Debian package metadata for the given app or config package Please update gpg-keys/env.sh before running this task! The generated metadata should be manually completed, and versioned in parallel to the app source code.
  • cross_build_package.sh "path to app source folder": cross-build an aarch64/arm64 Debian package of the given app Before using this command, the Debian metadata must be available and updated.
  • build_package.sh "path to app source folder": build an x86_64/amd64 Debian package of the given app Before using this command, the Debian metadata must be available and updated.
  • build_config_package.sh "path to config source folder": build a Debian package containing the config files for aarch64/arm64 and x86_64/amd64. Before using this command, the Debian metadata must be available and updated.

Commands for local apt repository:

  • gen_sign_key.sh: generate a GPG key later used for Debian repository metadata signing. Please update your data in gpg-keys/env.sh before running this command. This script updates environment variables. Please run it as source gen_sign_key.sh to apply the changes to the current shell.
  • prepare_repo_config.sh: generate apt repository metadata, signed with the available primary GPG key This command generates valid apt repository metadata for all Debian packages found in the result/app workspace folder. It also generates a Berrymill config template and config file containing the current contianer IP address and the local repository. This allows to use these local packages in local image builds when the repository server was started.
  • serve_packages.sh "path to apt repository": run a server for a local apt repository
    • use path result/app to use locally created packages form this folder
    • use path apt to serve a workspace specific apt repository contained in the apt folder