When running inside a QEMU microvm with the source directory shared via 9pfs, the kernel build process fails > Error: Could not mmap file: vmlinux Thus, we need to run the build in a path on a local filesystem. To support this, the Makefile now supports an `O` option, and all the build scripts have been adjusted to make use of it as needed. Since building in a local filesystem would ultimately discard the final artifacts when the VM terminates, we need yet a different location for the files we want to keep. The `IMAGESDIR` option can be used to specify this path. This path can be on a shared filesystem, thus saving the artifacts outside the microvm.
32 lines
535 B
Bash
Executable File
32 lines
535 B
Bash
Executable File
#!/bin/sh
|
|
# vim: set sw=4 ts=4 sts=4 et :
|
|
|
|
set -e
|
|
|
|
cleanup() {
|
|
if [ -n "${tmproot}" ]; then
|
|
if [ "${tmproot}" != / ]; then
|
|
rm -rf "${tmproot}"
|
|
fi
|
|
unset tmproot
|
|
fi
|
|
}
|
|
|
|
. ./config
|
|
|
|
O="${1}"
|
|
IMAGESDIR="${2}"
|
|
|
|
trap cleanup INT TERM QUIT EXIT
|
|
tmproot=$(mktemp -d)
|
|
tmppath=$(mktemp -d)
|
|
|
|
cd "${O}"
|
|
genimage \
|
|
--rootpath "${tmproot}" \
|
|
--tmppath "${tmppath}" \
|
|
--inputpath "${IMAGESDIR}" \
|
|
--outputpath "${IMAGESDIR}" \
|
|
--mkdosfs mkfs.vfat \
|
|
--config "${OLDPWD}"/genimage.cfg
|