From: Jan Kiszka <[email protected]>

Replace the build-images.sh script with the new kconfig-based menu of
kas. For CI purposes, we can grab the full list of targets simply by
filtering the Kconfig file for "mc:..." strings.

Signed-off-by: Jan Kiszka <[email protected]>
---
 .gitignore      |   1 +
 .gitlab-ci.yml  |   6 +-
 Kconfig         | 154 ++++++++++++++++++++++++++++++++++++++++++++++++
 README.md       |   6 +-
 build-images.sh | 102 --------------------------------
 images.list     |  13 ----
 6 files changed, 161 insertions(+), 121 deletions(-)
 create mode 100644 Kconfig
 delete mode 100755 build-images.sh
 delete mode 100644 images.list

diff --git a/.gitignore b/.gitignore
index fe0ae1a..381f14e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 build/
 isar/
 recipes-core/customizations/local.inc
+.config.yaml*
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 354fd1f..08e9d19 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,9 +10,9 @@ all:
     - export https_proxy=$HTTPS_PROXY
     - export ftp_proxy=$FTP_PROXY
     - export no_proxy=$NO_PROXY
-    - while read MACHINE DESCRIPTION; do
-          KAS_TARGET="${KAS_TARGET} mc:${MACHINE}-jailhouse-demo:demo-image";
-      done < images.list
+    - for TARGET in $(grep "\"mc:" Kconfig | sed 's/.*"\([^"]\+\)"/\1/'); do
+          KAS_TARGET="${KAS_TARGET} ${TARGET}";
+      done
     - export KAS_TARGET
     - cd ..
     - kas build jailhouse-images/kas.yml
diff --git a/Kconfig b/Kconfig
new file mode 100644
index 0000000..0d0e65c
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,154 @@
+mainmenu "Jailhouse Reference Images"
+
+config KAS_INCLUDE_MAIN
+       string
+       default "kas.yml"
+
+config KAS_BUILD_SYSTEM
+       string
+       default "isar"
+
+comment "Targets to be built"
+
+config TARGET_QEMU_AMD64
+       bool "QEMU/KVM Intel-x86 virtual target"
+       default y
+
+config KAS_TARGET_QEMU_AMD64
+       string
+       depends on TARGET_QEMU_AMD64
+       default "mc:qemu-amd64-jailhouse-demo:demo-image"
+
+
+config TARGET_QEMU_ARM
+       bool "QEMU ARM virtual target"
+
+config KAS_TARGET_QEMU_ARM
+       string
+       depends on TARGET_QEMU_ARM
+       default "mc:qemu-arm-jailhouse-demo:demo-image"
+
+
+config TARGET_QEMU_ARM64
+       bool "QEMU ARM64 virtual target"
+
+config KAS_TARGET_QEMU_ARM64
+       string
+       depends on TARGET_QEMU_ARM64
+       default "mc:qemu-arm64-jailhouse-demo:demo-image"
+
+
+config TARGET_ORANGEPI_ZERO
+       bool "Orange Pi Zero (256 MB edition)"
+
+config KAS_TARGET_ORANGEPI_ZERO
+       string
+       depends on TARGET_ORANGEPI_ZERO
+       default "mc:orangepi-zero-jailhouse-demo:demo-image"
+
+
+config TARGET_NUC6CAY
+       bool "Intel NUC (NUC6CAY, 8 GB RAM)"
+
+config KAS_TARGET_NUC6CAY
+       string
+       depends on TARGET_NUC6CAY
+       default "mc:nuc6cay-jailhouse-demo:demo-image"
+
+
+config TARGET_Q7_AL_E3940
+       bool "MSC Q7-AL-E3940-24N0211I"
+
+config KAS_TARGET_Q7_AL_E3940
+       string
+       depends on TARGET_Q7_AL_E3940
+       default "mc:q7-al-e3940-jailhouse-demo:demo-image"
+
+
+config TARGET_ESPRESSOBIN
+       bool "Marvell ESPRESSObin (1 GB edition)"
+
+config KAS_TARGET_ESPRESSOBIN
+       string
+       depends on TARGET_ESPRESSOBIN
+       default "mc:espressobin-jailhouse-demo:demo-image"
+
+
+config TARGET_MACCHIATOBIN
+       bool "Marvell MACCHIATObin"
+
+config KAS_TARGET_MACCHIATOBIN
+       string
+       depends on TARGET_MACCHIATOBIN
+       default "mc:macchiatobin-jailhouse-demo:demo-image"
+
+
+config TARGET_HIKEY620
+       bool "LeMaker HiKey (Kirin 620 SoC, 2 GB edition)"
+
+config KAS_TARGET_HIKEY620
+       string
+       depends on TARGET_HIKEY620
+       default "mc:hikey620-jailhouse-demo:demo-image"
+
+
+config TARGET_ULTRA96_V1
+       bool "Avnet Ultra96 v1"
+
+config KAS_TARGET_ULTRA96_V1
+       string
+       depends on TARGET_ULTRA96_V1
+       default "mc:ultra96-v1-jailhouse-demo:demo-image"
+
+
+config TARGET_ULTRA96_V2
+       bool "Avnet Ultra96 v2"
+
+config KAS_TARGET_ULTRA96_V2
+       string
+       depends on TARGET_ULTRA96_V2
+       default "mc:ultra96-v2-jailhouse-demo:demo-image"
+
+
+config TARGET_RPI4
+       bool "Raspberry Pi 4 (1-8 GB editions)"
+
+config KAS_TARGET_RPI4
+       string
+       depends on TARGET_RPI4
+       default "mc:rpi4-jailhouse-demo:demo-image"
+
+
+config TARGET_PINE64_PLUS
+       bool "Pine64+ (Allwinner A64, 2 GB edition)"
+
+config KAS_TARGET_PINE64_PLUS
+       string
+       depends on TARGET_PINE64_PLUS
+       default "mc:pine64-plus-jailhouse-demo:demo-image"
+
+
+comment "Image options"
+
+config RT
+       bool "Use Preempt RT kernel"
+       help
+         Use Preempt RT kernel for root and non-root cell. Typical RT tests
+         are included in the image.
+
+config KAS_INCLUDE_RT
+       string
+       depends on RT
+       default "opt-rt.yml"
+
+
+config LATEST
+       bool "Build latest Jailhouse version"
+       help
+         Build Jailhouse from 'next' branch in git, rather than from the
+         last release.
+
+config KAS_INCLUDE_LATEST
+       string
+       depends on LATEST
+       default "opt-latest.yml"
diff --git a/README.md b/README.md
index 2fb7ebd..b5895e3 100644
--- a/README.md
+++ b/README.md
@@ -18,8 +18,8 @@ The host-side requirements are:
 - kvm_intel module loaded with parameter `nested=1` (for qemu-x86 image on
   kernel < 4.20)

-To build a target image, just run `build-images.sh` and select one (or
-both) of the QEMU targets. The generated image can then be executed using
+To build a target image, just run `./kas-container menu` and select one (or
+more) of the QEMU targets. The generated image can then be executed using
 `start-qemu.sh ARCHITECTURE`. Currently supported are `x86` (only works on
 Intel CPUs so far), `arm64` and `arm` as architectures. On x86, make sure the
 kvm-intel module was loaded with `nested=1` to enable nested VMX support.
@@ -28,7 +28,7 @@ kvm-intel module was loaded with `nested=1` to enable nested 
VMX support.
 Quickstart for Physical Targets
 -------------------------------

-Call `build-images.sh` and select the desired target. Afterwards, flash the
+Call `./kas-container menu` and select the desired target. Afterwards, flash 
the
 image on an empty SD card, e.g.:

     dd 
if=build/tmp/deploy/images/orangepi-zero/demo-image-jailhouse-demo-orangepi-zero.wic.img
 \
diff --git a/build-images.sh b/build-images.sh
deleted file mode 100755
index da24867..0000000
--- a/build-images.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-#
-# Jailhouse, a Linux-based partitioning hypervisor
-#
-# Copyright (c) Siemens AG, 2018-2019
-#
-# Authors:
-#  Jan Kiszka <[email protected]>
-#
-# SPDX-License-Identifier: MIT
-#
-
-usage()
-{
-       printf "%b" "Usage: $0 [OPTIONS]\n"
-       printf "%b" "\nOptions:\n"
-       printf "%b" "--latest\tBuild latest Jailhouse version from next" \
-                   "branch.\n"
-       printf "%b" "--rt\t\tBuild with PREEMPT-RT kernel.\n"
-       printf "%b" "--all\t\tBuild all available images (may take hours...).\n"
-       printf "%b" "--shell\t\tDrop into a shell to issue bitbake commands" \
-                   "manually.\n"
-       exit 1
-}
-
-JAILHOUSE_IMAGES=$(dirname "$0")
-KAS_CONTAINER=${KAS_CONTAINER:-${JAILHOUSE_IMAGES}/kas-container}
-KAS_FILES="${JAILHOUSE_IMAGES}/kas.yml"
-CMD="build"
-
-while [ $# -gt 0 ]; do
-       case "$1" in
-       --latest)
-               KAS_FILES="${KAS_FILES}:${JAILHOUSE_IMAGES}/opt-latest.yml"
-               shift 1
-               ;;
-       --rt)
-               KAS_FILES="${KAS_FILES}:${JAILHOUSE_IMAGES}/opt-rt.yml"
-               shift 1
-               ;;
-       --all)
-               KAS_TARGET=
-               while read -r MACHINE DESCRIPTION; do
-                       KAS_TARGET="${KAS_TARGET} 
mc:${MACHINE}-jailhouse-demo:demo-image"
-               done < "${JAILHOUSE_IMAGES}/images.list"
-               shift 1
-               ;;
-       --shell)
-               CMD="shell"
-               shift 1
-               ;;
-       *)
-               usage
-               ;;
-       esac
-done
-
-if [ -z "${KAS_TARGET}" ]; then
-       echo "Available images demo images:"
-       IFS="   "
-       MACHINES=
-       NUM_MACHINES=0
-       while read -r MACHINE DESCRIPTION; do
-               MACHINES="${MACHINES} ${MACHINE}"
-               NUM_MACHINES=$((NUM_MACHINES + 1))
-               echo " ${NUM_MACHINES}: ${DESCRIPTION}"
-       done < "${JAILHOUSE_IMAGES}/images.list"
-       echo " 0: all (may take hours...)"
-       echo ""
-
-       printf "Select images to build (space-separated index list): "
-       read -r SELECTION
-       [ -z "${SELECTION}" ] && exit 0
-
-       IFS=" "
-       KAS_TARGET=
-       for IDX in ${SELECTION}; do
-               if [ "${IDX}" -eq 0 ] 2>/dev/null; then
-                       KAS_TARGET=
-                       for MACHINE in ${MACHINES}; do
-                               KAS_TARGET="${KAS_TARGET} 
mc:${MACHINE}-jailhouse-demo:demo-image"
-                       done
-                       break
-               fi
-
-               N=1
-               for MACHINE in ${MACHINES}; do
-                       if [ ${N} -eq "${IDX}" ] 2>/dev/null; then
-                               KAS_TARGET="${KAS_TARGET} 
mc:${MACHINE}-jailhouse-demo:demo-image"
-                               break
-                       fi
-                       N=$((N + 1))
-               done
-               if [ ${N} -gt ${NUM_MACHINES} ]; then
-                       echo "Invalid index: ${IDX}"
-                       exit 1
-               fi
-       done
-fi
-export KAS_TARGET
-
-${KAS_CONTAINER} ${CMD} "${KAS_FILES}"
diff --git a/images.list b/images.list
deleted file mode 100644
index 4e500fd..0000000
--- a/images.list
+++ /dev/null
@@ -1,13 +0,0 @@
-qemu-amd64     QEMU/KVM Intel-x86 virtual target
-qemu-arm       QEMU ARM virtual target
-qemu-arm64     QEMU ARM64 virtual target
-orangepi-zero  Orange Pi Zero (256 MB edition)
-nuc6cay                Intel NUC (NUC6CAY, 8 GB RAM)
-ipc127e                SIMATIC IPC127E (2 cores / 2 GB edition)
-espressobin    Marvell ESPRESSObin (1 GB edition)
-macchiatobin   Marvell MACCHIATObin
-hikey620       LeMaker HiKey (Kirin 620 SoC, 2 GB edition)
-ultra96-v1     Avnet Ultra96 v1
-ultra96-v2     Avnet Ultra96 v2
-rpi4           Raspberry Pi 4 (1-8 GB editions)
-pine64-plus    Pine64+ (Allwinner A64, 2 GB edition)
--
2.31.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/0a01dd4ca08e9e2163c76bf043a06e8a2fa88bec.1637430993.git.jan.kiszka%40web.de.

Reply via email to