bugfix:fix the build kvm oom issue caused by too large image size.
This commit is contained in:
@@ -245,6 +245,33 @@ append_kernel_args()
|
|||||||
kernel_args="${kernel_args} ${kernel_args_device_9000}"
|
kernel_args="${kernel_args} ${kernel_args_device_9000}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_onie_swap()
|
||||||
|
{
|
||||||
|
data_part_mount_path="/tmp/data_mount_path"
|
||||||
|
if cat /proc/swaps | grep -q "/dev/loop0"; then
|
||||||
|
swapoff /dev/loop0
|
||||||
|
losetup -d /dev/loop0
|
||||||
|
rm -rf ${data_part_mount_path}/.onie_swapfile
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_onie_swap()
|
||||||
|
{
|
||||||
|
data_part_mount_path="/tmp/data_mount_path"
|
||||||
|
mkdir -p ${data_part_mount_path}
|
||||||
|
|
||||||
|
mount ${dev_part_tsg_os_data} ${data_part_mount_path}
|
||||||
|
|
||||||
|
remove_onie_swap ${data_part_mount_path}
|
||||||
|
|
||||||
|
dd if=/dev/zero of=${data_part_mount_path}/.onie_swapfile bs=32M count=1024
|
||||||
|
losetup /dev/loop0 ${data_part_mount_path}/.onie_swapfile
|
||||||
|
|
||||||
|
mkswap /dev/loop0
|
||||||
|
swapon /dev/loop0
|
||||||
|
}
|
||||||
|
|
||||||
############################### START AT HERE #########################################
|
############################### START AT HERE #########################################
|
||||||
lib_dir="/lib/onie"
|
lib_dir="/lib/onie"
|
||||||
. $lib_dir/onie-blkdev-common
|
. $lib_dir/onie-blkdev-common
|
||||||
@@ -299,6 +326,7 @@ mount -t ext4 -o defaults,rw $distro_dev $distro_mnt || {
|
|||||||
# bonk out on errors
|
# bonk out on errors
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
install_onie_swap
|
||||||
cp -f distro-setup.sh ${distro_mnt}
|
cp -f distro-setup.sh ${distro_mnt}
|
||||||
echo "Extract chroot environment ..."
|
echo "Extract chroot environment ..."
|
||||||
tar -xf ${CHROOT_PKG} -C ${distro_mnt}
|
tar -xf ${CHROOT_PKG} -C ${distro_mnt}
|
||||||
@@ -409,7 +437,7 @@ cp -f ${grub_cfg} ${distro_mnt}/boot/grub/grub.cfg
|
|||||||
cat ${grub_cfg} >> ${distro_mnt}/etc/grub.d/40_onie_grub
|
cat ${grub_cfg} >> ${distro_mnt}/etc/grub.d/40_onie_grub
|
||||||
|
|
||||||
umount ${distro_mnt}
|
umount ${distro_mnt}
|
||||||
|
remove_onie_swap
|
||||||
cd /
|
cd /
|
||||||
|
|
||||||
echo "TSG-OS install successfully, need to reboot."
|
echo "TSG-OS install successfully, need to reboot."
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
MEM=16384
|
MEM=28672
|
||||||
DISK=$1
|
DISK=$1
|
||||||
|
|
||||||
# Path to ONIE installer .iso image
|
# Path to ONIE installer .iso image
|
||||||
|
|||||||
Reference in New Issue
Block a user