-
Notifications
You must be signed in to change notification settings - Fork 16
/
sonic_202211_apply_patch_bullseye.sh
186 lines (161 loc) · 6.14 KB
/
sonic_202211_apply_patch_bullseye.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/bin/bash
# Copyright (c) Marvell, Inc. All rights reservered. Confidential.
# Description: Applying open PRs needed for compilation
#
# patch script for ARM64 Falcon and AC5X board
#
#
# CONFIGURATIONS:-
#
SONIC_COMMIT="cf66a45b8ddea345fd90dc735103bc983c3478b8"
#
# 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/202211_03/files/202211/"
# Patches
SERIES="0001-Marvell-arm64-Migrate-dockers-to-bullseye.patch
0002-Update-sai-debian-to-1.11.0-9.patch
0003-Marvell-arm64-Create-submodule-for-sdk-drivers.patch
0004-Marvell-arm64-Add-platform-support-for-rd98DX35xx.patch
0005-Add-HWSKU-for-rd98DX35xx-and-rd98DX35xx_cn9131.patch
0006-Redis-timeout-WA.patch"
PATCHES=""
# Sub module patches
declare -a SUB_PATCHES=(SP1 SP2 SP3 SP4 SP5 SP6 SP7)
declare -A SP1=([NAME]="0001-Marvell-generate_dump-utility.patch" [DIR]="src/sonic-utilities")
declare -A SP2=([NAME]="0002-Use-kexec_load-syscall-for-stability.patch" [DIR]="src/sonic-utilities")
declare -A SP3=([NAME]="0001-SAI-switch-create-timeout-WA.patch" [DIR]="src/sonic-sairedis")
declare -A SP4=([NAME]="0001-arm64-Enable-CONFIG_KEXEC_FILE.patch" [DIR]="src/sonic-linux-kernel")
declare -A SP5=([NAME]="0002-arm64-Select-CONFIG_PHY_MVEBU_CP110_COMPHY.patch" [DIR]="src/sonic-linux-kernel")
declare -A SP6=([NAME]="0003-arm64-Select-CONFIG_SPI_ORION.patch" [DIR]="src/sonic-linux-kernel")
declare -A SP7=([NAME]="0004-marvell-ac5-Support-boards-with-more-that-4G-DDR.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 ARM64>> make configure PLATFORM=marvell-arm64 PLATFORM_ARCH=arm64"
log "<<FOR INTEL>> make configure PLATFORM=marvell"
log "make all"
}
apply_patch_series()
{
for patch in $SERIES
do
echo $patch
pushd patches
wget -c $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 $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 $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 https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/202211_03/files/mrvl_sonic_hwsku_ezb.tgz
rm -fr device/marvell/x86_64-marvell_db98cx8580_32cd-r0 || true
rm -rf device/marvell/x86_64-marvell_slm5401_54x-r0 || true
rm -fr device/marvell/arm64-marvell_db98cx8580_32cd-r0 || true
rm -fr device/marvell/x86_64-marvell_db98cx8540_16cd-r0 || true
rm -fr device/marvell/arm64-marvell_db98cx8540_16cd-r0 || true
rm -fr device/marvell/armhf-marvell_et6448m_52x-r0 || true
tar -C device/marvell/ -xzf mrvl_sonic_hwsku_ezb.tgz
cp -dr device/marvell/arm64-marvell_db98cx8580_32cd-r0 device/marvell/x86_64-marvell_db98cx8580_32cd-r0
cp -dr device/marvell/arm64-marvell_db98cx8540_16cd-r0 device/marvell/x86_64-marvell_db98cx8540_16cd-r0
cp -dr device/marvell/arm64-marvell_db98cx8514_10cc-r0 device/marvell/x86_64-marvell_db98cx8514_10cc-r0
rm device/marvell/arm64-marvell_db98cx8580_32cd-r0/plugins/x86_64_sfputil.py
rm device/marvell/arm64-marvell_db98cx8540_16cd-r0/plugins/x86_64_sfputil.py
rm device/marvell/arm64-marvell_db98cx8514_10cc-r0/plugins/x86_64_sfputil.py
mv device/marvell/x86_64-marvell_db98cx8580_32cd-r0/plugins/x86_64_sfputil.py device/marvell/x86_64-marvell_db98cx8580_32cd-r0/plugins/sfputil.py
mv device/marvell/x86_64-marvell_db98cx8540_16cd-r0/plugins/x86_64_sfputil.py device/marvell/x86_64-marvell_db98cx8540_16cd-r0/plugins/sfputil.py
mv device/marvell/x86_64-marvell_db98cx8514_10cc-r0/plugins/x86_64_sfputil.py device/marvell/x86_64-marvell_db98cx8514_10cc-r0/plugins/sfputil.py
echo "marvell" > device/marvell/x86_64-marvell_db98cx8514_10cc-r0/platform_asic
echo "marvell" > device/marvell/x86_64-marvell_db98cx8540_16cd-r0/platform_asic
echo "marvell" > device/marvell/x86_64-marvell_db98cx8580_32cd-r0/platform_asic
echo "marvell-arm64" > device/marvell/arm64-marvell_db98cx8514_10cc-r0/platform_asic
echo "marvell-arm64" > device/marvell/arm64-marvell_db98cx8540_16cd-r0/platform_asic
echo "marvell-arm64" > device/marvell/arm64-marvell_db98cx8580_32cd-r0/platform_asic
echo "marvell-arm64" > device/marvell/arm64-marvell_rd98DX35xx-r0/platform_asic
echo "marvell-arm64" > device/marvell/arm64-marvell_rd98DX35xx_ext-r0/platform_asic
echo "marvell-arm64" > device/marvell/arm64-marvell_rd98DX35xx_cn9131-r0/platform_asic
}
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
git submodule update --init
# Apply patches
apply_patches
# Apply submodule patches
apply_submodule_patches
# Apply hwsku changes
#apply_hwsku_changes
}
main $@