Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit dd4f0ef

Browse files
committed
build_library: Add function get_vm_mem
ARM64 builds tend to run out of memory with only 1024 MiB, so replace the IMG_DEFAULT_MEM constant with a new function get_vm_mem that returns a default memory size based the board. Signed-off-by: Geoff Levand <[email protected]>
1 parent 1237669 commit dd4f0ef

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

build_library/vm_image_util.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ IMG_DEFAULT_CONF_FORMAT=
113113
# Bundle configs and disk image into some archive
114114
IMG_DEFAULT_BUNDLE_FORMAT=
115115

116-
# Memory size to use in any config files
117-
IMG_DEFAULT_MEM=1024
118-
119116
# Number of CPUs to use in any config files
120117
IMG_DEFAULT_CPUS=2
121118

@@ -325,6 +322,19 @@ set_vm_type() {
325322
return 1
326323
}
327324

325+
# Print memory size to use in any config files
326+
get_vm_mem() {
327+
local board="$1"
328+
local vm_mem="$(_get_vm_opt MEM)"
329+
if [[ -z ${vm_mem} ]]; then
330+
case "$board" in
331+
arm64-usr) vm_mem="2048";;
332+
*) vm_mem="1024";;
333+
esac
334+
fi
335+
echo "${vm_mem}"
336+
}
337+
328338
# Validate and set the oem package, colon delimited USE optional
329339
set_vm_oem_pkg() {
330340
local oem_pkg="${1%:*}" oem_use="${1##*:}"

image_to_vm.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ DEFINE_string from "" \
3434
"Directory containing coreos_developer_image.bin or coreos_production_image.bin."
3535
DEFINE_string disk_layout "" \
3636
"The disk layout type to use for this image."
37-
DEFINE_integer mem "${DEFAULT_MEM}" \
37+
DEFINE_integer mem "" \
3838
"Memory size for the vm config in MBs."
3939
DEFINE_boolean dev_image "${FLAGS_FALSE}" \
4040
"Use the development image instead of the default production image."
@@ -75,6 +75,10 @@ if [ -z "${FLAGS_board}" ] ; then
7575
die_notrace "--board is required."
7676
fi
7777

78+
if [[ -z "${FLAGS_mem}" ]]; then
79+
FLAGS_mem=$(get_vm_mem ${FLAGS_board})
80+
fi
81+
7882
# If downloading packages is enabled ensure the board is configured properly.
7983
if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then
8084
"${SRC_ROOT}/scripts/setup_board" --board="${FLAGS_board}" \

0 commit comments

Comments
 (0)