forked from Marvell-switching/sonic-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonic_master_apply_patch_bullseye.sh
executable file
·182 lines (157 loc) · 5.86 KB
/
sonic_master_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
#!/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="5d91bd14cdfcb3ed0a9c348d9c75eb286ad88596"
#
# END of CONFIGURATIONS
#
# PREDEFINED VALUES
CUR_DIR=$(basename `pwd`)
LOG_FILE=patches_result.log
FULL_PATH=`pwd`
# Path for master patches
WGET_PATH="https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master_03/files/master-bullseye/"
# Patches
SERIES="0001-Marvell-arm64-Support-for-lazy-install-sdk-drivers.patch
0002-marvell-arm64-Add-platform-support-for-rd98DX35xx.patch
0003-marvell-arm64-Add-platform-support-db98cx8540.patch
0004-marvell-arm64-Add-platform-support-db98cx8580.patch
0005-marvell-arm64-Add-platform-support-rd98DX35xx_ext.patch
0006-marvell-arm64-Add-platform-support-for-CN9131.patch"
PATCHES=""
# Sub module patches
declare -a SUB_PATCHES=(SP1 SP2 SP3 SP4)
declare -A SP1=([NAME]="0001-Marvell-pfc-detect-change.patch" [DIR]="src/sonic-swss")
declare -A SP2=([NAME]="0001-SAI-switch-create-timeout-WA.patch" [DIR]="src/sonic-sairedis")
declare -A SP3=([NAME]="0001-ac5x-8G-DDR-support-changes.patch" [DIR]="src/sonic-linux-kernel")
declare -A SP4=([NAME]="0002-marvell-Add-support-for-CN913X-DB-Comexpress.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"
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/master_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
# Apply patches
apply_patches
# Apply submodule patches
apply_submodule_patches
# Apply hwsku changes
apply_hwsku_changes
}
main $@