Support swap files in qemu or bare-metal mode

This can help alleviate memory pressure when bootstrapping
with high core counts.
This commit is contained in:
Gábor Stefanik 2024-01-01 22:51:33 +01:00
parent 9384a5d432
commit d5008f93a5
3 changed files with 32 additions and 1 deletions

19
steps/improve/swap.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
#
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Set up swap
. /steps/bootstrap.cfg
. /steps/env
if ! test -f /swapfile
then
echo "Making swap..."
dd if=/dev/zero of=/swapfile bs=1M count=${SWAP_SIZE}
mkswap /swapfile
fi
swapon /swapfile