Support external build directory

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.
This commit is contained in:
2023-03-03 12:22:20 -06:00
parent 8e556ca5a9
commit 4900085a1c
10 changed files with 101 additions and 79 deletions

View File

@@ -5,12 +5,14 @@ set -e
. ./config
O="${1}"
./patch-uboot.sh
cd u-boot
cat configs/rpi_4_defconfig ../u-boot.config > configs/yellow_defconfig
make yellow_defconfig
CROSS_COMPILE=${target}- make
make O="${O}"/u-boot yellow_defconfig
CROSS_COMPILE=${target}- make O="${O}"/u-boot -j$(nproc)
cd ..
mkdir -p output/efi-part
cp -au u-boot/u-boot.bin output/efi-part
mkdir -p "${O}"/efi-part
cp -u "${O}"/u-boot/u-boot.bin "${O}"/efi-part