-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsonic_usb_install_slow.patch
117 lines (105 loc) · 3.25 KB
/
sonic_usb_install_slow.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh
index 2cd579e..34087c4 100755
--- a/installer/x86_64/install.sh
+++ b/installer/x86_64/install.sh
@@ -24,6 +24,11 @@ _trap_push true
set -e
cd $(dirname $0)
+START_TIME=`date +%s`
+echo 0 > /proc/sys/kernel/hung_task_timeout_secs
+sync
+echo 3 > /proc/sys/vm/drop_caches
+
if [ -d "/etc/sonic" ]; then
echo "Installing SONiC in SONiC"
install_env="sonic"
@@ -160,6 +165,8 @@ if [ "$install_env" = "onie" ]; then
exit 1
fi
fi
+sync
+echo 3 > /proc/sys/vm/drop_caches
# Creates a new partition for the DEMO OS.
#
@@ -253,6 +260,8 @@ create_demo_gpt_partition()
## probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now
## before making further changes.
partprobe || true
+sync
+echo 3 > /proc/sys/vm/drop_caches
}
create_demo_msdos_partition()
@@ -315,6 +324,8 @@ create_demo_uefi_partition()
# Install legacy BIOS GRUB for DEMO OS
demo_install_grub()
{
+sync
+echo 3 > /proc/sys/vm/drop_caches
local demo_mnt="$1"
local blk_dev="$2"
@@ -439,6 +450,8 @@ if [ "$install_env" = "onie" ]; then
exit 1
}
+sync
+echo 3 > /proc/sys/vm/drop_caches
elif [ "$install_env" = "sonic" ]; then
demo_mnt="/host"
eval running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ")
@@ -454,6 +467,8 @@ elif [ "$install_env" = "sonic" ]; then
rm -rf $f
fi
done
+sync
+echo 3 > /proc/sys/vm/drop_caches
else
demo_mnt="build_raw_image_mnt"
demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%"
@@ -465,6 +480,8 @@ else
mount -t auto -o loop $demo_dev $demo_mnt
fi
+sync
+echo 3 > /proc/sys/vm/drop_caches
echo "Installing SONiC to $demo_mnt/$image_dir"
# Create target directory or clean it up if exists
@@ -485,6 +502,8 @@ if [ x"$docker_inram" = x"on" ]; then
else
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir
+sync
+echo 3 > /proc/sys/vm/drop_caches
if [ "$install_env" = "onie" ]; then
TAR_EXTRA_OPTION="--numeric-owner"
else
@@ -492,6 +511,8 @@ else
fi
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
+sync
+echo 3 > /proc/sys/vm/drop_caches
fi
if [ "$install_env" = "onie" ]; then
@@ -515,6 +536,8 @@ if [ "$install_env" = "onie" ]; then
else
demo_install_grub "$demo_mnt" "$blk_dev"
fi
+sync
+echo 3 > /proc/sys/vm/drop_caches
fi
# Create a minimal grub.cfg that allows for:
@@ -609,6 +632,8 @@ menuentry '$demo_grub_entry' {
}
EOF
+sync
+echo 3 > /proc/sys/vm/drop_caches
if [ "$install_env" = "onie" ]; then
# Add menu entries for ONIE -- use the grub fragment provided by the
# ONIE distribution.
@@ -631,3 +656,10 @@ fi
cd /
echo "Installed SONiC base image $demo_volume_label successfully"
+sync
+echo 3 > /proc/sys/vm/drop_caches
+echo 120 > /proc/sys/kernel/hung_task_timeout_secs
+END_TIME=`date +%s`
+DIFF_TIME=$(($START_TIME - $END_TIME))
+#TIME_TAKEN="$(( ${DIFF_TIME} / 3600 ))h $(( (${DIFF_TIME} / 60) % 60 ))m $(( ${DIFF_TIME} % 60 ))s"
+echo "INFO: Installation took ${DIFF_TIME} s"