From b2aac7c74e61015587201f2e8170da4a0eb8ec98 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 3 Mar 2023 12:34:12 -0600 Subject: [PATCH] vm-build: Add script to build in a microvm This script uses the `ocivm` tool to launch a QEMU micro VM to build the operating system. This is necessary to produce an SELinux-enabled system, since container runtimes interfere with the SELinux policy build and filesystem labeling processes. --- ocivm.sh | 23 +++++++++++++++++++++++ vm-build.sh | 4 ++++ 2 files changed, 27 insertions(+) create mode 100755 ocivm.sh create mode 100755 vm-build.sh diff --git a/ocivm.sh b/ocivm.sh new file mode 100755 index 0000000..34fd644 --- /dev/null +++ b/ocivm.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +. ./config + +name=build_yellow +if ! ocivm list | grep -q localhost/cross-${target}; then + ocivm import localhost/cross-${target} +fi +ocivm \ + --log-level DEBUG \ + run \ + -n ${name} \ + -w /tmp/src \ + -v "${PWD}":/tmp/src \ + -v distfiles:/var/cache/distfiles:size=4G \ + -v packages:/var/cache/binpkgs \ + -v portage:/var/db/repos/gentoo:size=4G \ + --tmpfs /usr/aarch64-unknown-linux-gnu/tmp \ + --tmpfs /var/tmp \ + localhost/cross-aarch64-unknown-linux-gnu \ + "$@" diff --git a/vm-build.sh b/vm-build.sh new file mode 100755 index 0000000..d8a9816 --- /dev/null +++ b/vm-build.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# vim: set sw=4 ts=4 sts=4 et : + +exec ./ocivm.sh make O=/tmp/build 'IMAGESDIR=${PWD}/images'