-
Notifications
You must be signed in to change notification settings - Fork 16
/
sonic_202211_apply_patch_teralynx.sh
161 lines (136 loc) · 3.96 KB
/
sonic_202211_apply_patch_teralynx.sh
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
# Copyright (c) Marvell, Inc. All rights reservered. Confidential.
# Description: Applying open PRs needed for compilation
#
# patch script for TL10 X86 board
#
#
# CONFIGURATIONS:-
#
SONIC_COMMIT="5500dc47d1178555a4807b566b0ff29bc3844f28"
#
# END of CONFIGURATIONS
#
# PREDEFINED VALUES
CUR_DIR=$(basename `pwd`)
LOG_FILE=patches_result.log
FULL_PATH=`pwd`
# Path for 202211 patches
WGET_PATH="https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/tl_03/files/202211/"
# Patches
SERIES="0001-marvell-x86-syncd-docker-TL10-and-SAI-inclusions.patch
0002-marvell-Backport-of-master-PR-14589-to-202211-branch.patch
0003-marvell-backport-master-PR-12653-innovium-platform-f.patch
0004-marvell-midstone-Compilation-Error-in-master-branch-.patch
0005-marvell-platform-and-hwsku-files-for-wistron-and-cel.patch
0006-marvell-bullseye-migration-for-innovium.patch
0007-marvell-teralynx-Use-the-archive-repo-for-Buster-186.patch
0008-marvell-teralynx-Add-SDK-dependent-python-packages-1.patch"
PATCHES=""
# Sub module patches
declare -a SUB_PATCHES=(SP1 SP2)
declare -A SP1=([NAME]="0001-Marvell-teralynx-generate_dump.patch" [DIR]="src/sonic-utilities")
declare -A SP2=([NAME]="0001-kempld-patches-for-5.10.patch" [DIR]="src/sonic-linux-kernel")
log()
{
echo $@
echo $@ >> ${FULL_PATH}/${LOG_FILE}
}
pre_patch_help()
{
log "STEPS TO BUILD:"
log "git clone https://github.com/sonic-net/sonic-buildimage.git -b 202211"
log "cd sonic-buildimage"
log "git checkout $SONIC_COMMIT"
log "make init"
log "<<Apply patches using patch script>>"
log "bash $0"
log "<<FOR INTEL>> make configure PLATFORM=innovium"
log "make target/sonic-innovium.bin"
}
apply_patch_series()
{
for patch in $SERIES
do
echo $patch
pushd patches
wget -c --timeout=2 $WGET_PATH/$patch
popd
git am patches/$patch
if [ $? -ne 0 ]; then
log "ERROR: Failed to apply patch $patch"
exit 1
fi
done
}
apply_patches()
{
for patch in $PATCHES
do
echo $patch
pushd patches
wget -c --timeout=2 $WGET_PATH/$patch
popd
patch -p1 < patches/$patch
if [ $? -ne 0 ]; then
log "ERROR: Failed to apply patch $patch"
exit 1
fi
done
}
apply_submodule_patches()
{
CWD=`pwd`
for SP in ${SUB_PATCHES[*]}
do
patch=${SP}[NAME]
dir=${SP}[DIR]
echo "${!patch}"
pushd patches
wget -c --timeout=2 $WGET_PATH/${!patch}
popd
pushd ${!dir}
git am $CWD/patches/${!patch}
if [ $? -ne 0 ]; then
log "ERROR: Failed to apply patch ${!patch}"
exit 1
fi
popd
done
}
apply_hwsku_changes()
{
# Download hwsku
wget -c --timeout=2 https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/tl_03/files/mrvl_sonic_hwsku_dbmvtx9180.tgz
wget -c --timeout=2 https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/tl_03/files/mrvl_sonic_platform_dbmvtx9180.tgz
rm -fr device/marvell/x86_64-marvell_dbmvtx9180-r0 || true
rm -fr platform/innovium/sonic-platform-modules-marvell || true
tar -C device/marvell/ -xzf mrvl_sonic_hwsku_dbmvtx9180.tgz
tar -C platform/innovium/ -xzf mrvl_sonic_platform_dbmvtx9180.tgz
}
main()
{
sonic_buildimage_commit=`git rev-parse HEAD`
if [ "$CUR_DIR" != "sonic-buildimage" ]; then
log "ERROR: Need to be at sonic-builimage git clone path"
pre_patch_help
exit
fi
if [ "${sonic_buildimage_commit}" != "$SONIC_COMMIT" ]; then
log "Checkout sonic-buildimage commit to proceed"
log "git checkout ${SONIC_COMMIT}"
pre_patch_help
exit
fi
date > ${FULL_PATH}/${LOG_FILE}
[ -d patches ] || mkdir patches
# Apply patch series
apply_patch_series
# Apply patches
apply_patches
# Apply submodule patches
apply_submodule_patches
# Apply hwsku changes
apply_hwsku_changes
}
main $@