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:
@@ -5,6 +5,8 @@ set -e
|
||||
|
||||
. ./config
|
||||
|
||||
O="${1}"
|
||||
|
||||
GRUB_MODULES='
|
||||
boot
|
||||
echo
|
||||
@@ -26,17 +28,17 @@ zstd
|
||||
'
|
||||
|
||||
echo 'Creating GRUB image ...'
|
||||
mkdir -p output/efi-part/EFI/BOOT
|
||||
mkdir -p "${O}"/efi-part/EFI/BOOT
|
||||
grub-mkimage \
|
||||
-O arm64-efi \
|
||||
-o output/efi-part/EFI/BOOT/BOOTAA64.efi \
|
||||
-o "${O}"/efi-part/EFI/BOOT/BOOTAA64.efi \
|
||||
-d /usr/${target}/usr/lib/grub/arm64-efi \
|
||||
-p /EFI/gentoo \
|
||||
${GRUB_MODULES}
|
||||
|
||||
echo 'Generating GRUB configuration file ...'
|
||||
mkdir -p output/efi-part/EFI/gentoo
|
||||
cp -uv grub.cfg output/efi-part/EFI/gentoo
|
||||
grub-editenv output/efi-part/EFI/gentoo/grubenv set rootflags='ro'
|
||||
grub-editenv output/efi-part/EFI/gentoo/grubenv set default=0
|
||||
grub-editenv output/efi-part/EFI/gentoo/grubenv set timeout=5
|
||||
mkdir -p "${O}"/efi-part/EFI/gentoo
|
||||
cp -uv grub.cfg "${O}"/efi-part/EFI/gentoo
|
||||
grub-editenv "${O}"/efi-part/EFI/gentoo/grubenv set rootflags='ro'
|
||||
grub-editenv "${O}"/efi-part/EFI/gentoo/grubenv set default=0
|
||||
grub-editenv "${O}"/efi-part/EFI/gentoo/grubenv set timeout=5
|
||||
|
||||
Reference in New Issue
Block a user