Skip to content

Commit 5454c04

Browse files
committed
[alpinevs] Changes to scripts and makefiles for Alpine
1 parent b83d0ed commit 5454c04

File tree

6 files changed

+394
-0
lines changed

6 files changed

+394
-0
lines changed

build_image.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ generate_device_list()
112112
fi;
113113
fi;
114114
done
115+
116+
# Add kvm to the list
117+
if [ "$TARGET_MACHINE" = "alpinevs" ] ; then
118+
echo "x86_64-kvm_x86_64-r0" >> "$platforms_asic";
119+
fi
115120
}
116121

117122
if [ "$IMAGE_TYPE" = "onie" ]; then
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"interfaces": {
3+
"Ethernet0": {
4+
"index": "1",
5+
"lanes": "1,2,3,4,5,6,7,8",
6+
"breakout_modes": "1x100G"
7+
},
8+
"Ethernet8": {
9+
"index": "2",
10+
"lanes": "9,10,11,12,13,14,15,16",
11+
"breakout_modes": "1x100G"
12+
},
13+
"Ethernet16": {
14+
"index": "3",
15+
"lanes": "17,18,19,20,21,22,23,24",
16+
"breakout_modes": "1x100G"
17+
},
18+
"Ethernet24": {
19+
"index": "4",
20+
"lanes": "25,26,27,28,29,30,31,32",
21+
"breakout_modes": "1x100G"
22+
},
23+
"Ethernet32": {
24+
"index": "5",
25+
"lanes": "33,34,35,36,37,38,39,40",
26+
"breakout_modes": "1x100G"
27+
},
28+
"Ethernet40": {
29+
"index": "6",
30+
"lanes": "41,42,43,44,45,46,47,48",
31+
"breakout_modes": "1x100G"
32+
},
33+
"Ethernet48": {
34+
"index": "7",
35+
"lanes": "49,50,51,52,53,54,55,56",
36+
"breakout_modes": "1x100G"
37+
},
38+
"Ethernet56": {
39+
"index": "8",
40+
"lanes": "57,58,59,60,61,62,63,64",
41+
"breakout_modes": "1x100G"
42+
},
43+
"Ethernet64": {
44+
"index": "9",
45+
"lanes": "65,66,67,68,69,70,71,72",
46+
"breakout_modes": "1x100G"
47+
},
48+
"Ethernet72": {
49+
"index": "10",
50+
"lanes": "73,74,75,76,77,78,79,80",
51+
"breakout_modes": "1x100G"
52+
},
53+
"Ethernet80": {
54+
"index": "11",
55+
"lanes": "81,82,83,84,85,86,87,88",
56+
"breakout_modes": "1x100G"
57+
},
58+
"Ethernet88": {
59+
"index": "12",
60+
"lanes": "89,90,91,92,93,94,95,96",
61+
"breakout_modes": "1x100G"
62+
},
63+
"Ethernet96": {
64+
"index": "13",
65+
"lanes": "97,98,99,100,101,102,103,104",
66+
"breakout_modes": "1x100G"
67+
},
68+
"Ethernet104": {
69+
"index": "14",
70+
"lanes": "105,106,107,108,109,110,111,112",
71+
"breakout_modes": "1x100G"
72+
},
73+
"Ethernet112": {
74+
"index": "15",
75+
"lanes": "113,114,115,116,117,118,119,120",
76+
"breakout_modes": "1x100G"
77+
},
78+
"Ethernet120": {
79+
"index": "16",
80+
"lanes": "121,122,123,124,125,126,127,128",
81+
"breakout_modes": "1x100G"
82+
}
83+
}
84+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ledd_extended": true,
3+
"skip_chassis_db_init": true,
4+
"skip_componentd": true,
5+
"skip_fancontrol": true,
6+
"skip_ledd": true,
7+
"skip_pcied": true,
8+
"skip_platform_telemetryd": true,
9+
"skip_psud": true,
10+
"skip_sensors": true,
11+
"skip_syseepromd": true,
12+
"skip_thermalctld": true,
13+
"skip_xcvrd": true,
14+
"skip_ycabled": true
15+
}

diffs

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
commit 29f801e297671ae912da21102ad519d455fd3892
2+
Author: Sreemoolanathan Iyer <[email protected]>
3+
Date: Thu Oct 23 09:47:39 2025 +0000
4+
5+
[alpinevs] Changes to scripts and makefiles
6+
7+
diff --git a/build_image.sh b/build_image.sh
8+
index 2ef9be097..687de0db6 100755
9+
--- a/build_image.sh
10+
+++ b/build_image.sh
11+
@@ -112,6 +112,11 @@ generate_device_list()
12+
fi;
13+
fi;
14+
done
15+
+
16+
+ # Add kvm to the list
17+
+ if [ "$TARGET_MACHINE" = "alpinevs" ] ; then
18+
+ echo "x86_64-kvm_x86_64-r0" >> "$platforms_asic";
19+
+ fi
20+
}
21+
22+
if [ "$IMAGE_TYPE" = "onie" ]; then
23+
diff --git a/device/virtual/x86_64-kvm_x86_64-r0/alpine_vs/platform.json b/device/virtual/x86_64-kvm_x86_64-r0/alpine_vs/platform.json
24+
new file mode 100644
25+
index 000000000..2aeb61fdc
26+
--- /dev/null
27+
+++ b/device/virtual/x86_64-kvm_x86_64-r0/alpine_vs/platform.json
28+
@@ -0,0 +1,84 @@
29+
+{
30+
+ "interfaces": {
31+
+ "Ethernet0": {
32+
+ "index": "1",
33+
+ "lanes": "1,2,3,4,5,6,7,8",
34+
+ "breakout_modes": "1x100G"
35+
+ },
36+
+ "Ethernet8": {
37+
+ "index": "2",
38+
+ "lanes": "9,10,11,12,13,14,15,16",
39+
+ "breakout_modes": "1x100G"
40+
+ },
41+
+ "Ethernet16": {
42+
+ "index": "3",
43+
+ "lanes": "17,18,19,20,21,22,23,24",
44+
+ "breakout_modes": "1x100G"
45+
+ },
46+
+ "Ethernet24": {
47+
+ "index": "4",
48+
+ "lanes": "25,26,27,28,29,30,31,32",
49+
+ "breakout_modes": "1x100G"
50+
+ },
51+
+ "Ethernet32": {
52+
+ "index": "5",
53+
+ "lanes": "33,34,35,36,37,38,39,40",
54+
+ "breakout_modes": "1x100G"
55+
+ },
56+
+ "Ethernet40": {
57+
+ "index": "6",
58+
+ "lanes": "41,42,43,44,45,46,47,48",
59+
+ "breakout_modes": "1x100G"
60+
+ },
61+
+ "Ethernet48": {
62+
+ "index": "7",
63+
+ "lanes": "49,50,51,52,53,54,55,56",
64+
+ "breakout_modes": "1x100G"
65+
+ },
66+
+ "Ethernet56": {
67+
+ "index": "8",
68+
+ "lanes": "57,58,59,60,61,62,63,64",
69+
+ "breakout_modes": "1x100G"
70+
+ },
71+
+ "Ethernet64": {
72+
+ "index": "9",
73+
+ "lanes": "65,66,67,68,69,70,71,72",
74+
+ "breakout_modes": "1x100G"
75+
+ },
76+
+ "Ethernet72": {
77+
+ "index": "10",
78+
+ "lanes": "73,74,75,76,77,78,79,80",
79+
+ "breakout_modes": "1x100G"
80+
+ },
81+
+ "Ethernet80": {
82+
+ "index": "11",
83+
+ "lanes": "81,82,83,84,85,86,87,88",
84+
+ "breakout_modes": "1x100G"
85+
+ },
86+
+ "Ethernet88": {
87+
+ "index": "12",
88+
+ "lanes": "89,90,91,92,93,94,95,96",
89+
+ "breakout_modes": "1x100G"
90+
+ },
91+
+ "Ethernet96": {
92+
+ "index": "13",
93+
+ "lanes": "97,98,99,100,101,102,103,104",
94+
+ "breakout_modes": "1x100G"
95+
+ },
96+
+ "Ethernet104": {
97+
+ "index": "14",
98+
+ "lanes": "105,106,107,108,109,110,111,112",
99+
+ "breakout_modes": "1x100G"
100+
+ },
101+
+ "Ethernet112": {
102+
+ "index": "15",
103+
+ "lanes": "113,114,115,116,117,118,119,120",
104+
+ "breakout_modes": "1x100G"
105+
+ },
106+
+ "Ethernet120": {
107+
+ "index": "16",
108+
+ "lanes": "121,122,123,124,125,126,127,128",
109+
+ "breakout_modes": "1x100G"
110+
+ }
111+
+ }
112+
+}
113+
diff --git a/device/virtual/x86_64-kvm_x86_64-r0/alpine_vs/pmon_daemon_control.json b/device/virtual/x86_64-kvm_x86_64-r0/alpine_vs/pmon_daemon_control.json
114+
new file mode 100644
115+
index 000000000..caeb08be0
116+
--- /dev/null
117+
+++ b/device/virtual/x86_64-kvm_x86_64-r0/alpine_vs/pmon_daemon_control.json
118+
@@ -0,0 +1,15 @@
119+
+{
120+
+ "ledd_extended": true,
121+
+ "skip_chassis_db_init": true,
122+
+ "skip_componentd": true,
123+
+ "skip_fancontrol": true,
124+
+ "skip_ledd": true,
125+
+ "skip_pcied": true,
126+
+ "skip_platform_telemetryd": true,
127+
+ "skip_psud": true,
128+
+ "skip_sensors": true,
129+
+ "skip_syseepromd": true,
130+
+ "skip_thermalctld": true,
131+
+ "skip_xcvrd": false,
132+
+ "skip_ycabled": true
133+
+}
134+
diff --git a/dockers/docker-sonic-p4rt/p4rt.sh b/dockers/docker-sonic-p4rt/p4rt.sh
135+
index 128d21742..687cf6f50 100755
136+
--- a/dockers/docker-sonic-p4rt/p4rt.sh
137+
+++ b/dockers/docker-sonic-p4rt/p4rt.sh
138+
@@ -89,6 +89,10 @@ fi
139+
# Try to read P4RT unix socket config from ConfigDB.
140+
readonly UNIX_SOCKET=$(echo ${P4RT} | jq -r '.p4rt_unix_socket // empty')
141+
if [ ! -z "${UNIX_SOCKET}" ]; then
142+
+ SOCK_DIR="$(dirname "$UNIX_SOCKET")"
143+
+ if [ ! -d "$SOCK_DIR" ]; then
144+
+ mkdir -p "$SOCK_DIR"
145+
+ fi
146+
P4RT_ARGS+=" --p4rt_unix_socket=${UNIX_SOCKET}"
147+
fi
148+
149+
diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2
150+
index 4eb8c66a3..cbf7343f2 100644
151+
--- a/files/build_templates/sonic_debian_extension.j2
152+
+++ b/files/build_templates/sonic_debian_extension.j2
153+
@@ -409,10 +409,14 @@ sudo cp $IMAGE_CONFIGS/cli_sessions/serial-config.sh $FILESYSTEM_ROOT/usr/bin/
154+
sudo cp $IMAGE_CONFIGS/cli_sessions/serial-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
155+
echo "serial-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
156+
157+
+# Don't copy warmboot-finalizer for Alpine. The cleanup will be done by
158+
+# RebootBackend.
159+
+{% if sonic_asic_platform != "alpinevs" %}
160+
# Copy warmboot-finalizer files
161+
sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/finalize-warmboot.sh $FILESYSTEM_ROOT/usr/local/bin/finalize-warmboot.sh
162+
sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/warmboot-finalizer.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
163+
echo "warmboot-finalizer.service" | sudo tee -a $GENERATED_SERVICE_FILE
164+
+{% endif %}
165+
166+
# Copy watchdog-control files
167+
sudo LANG=C cp $IMAGE_CONFIGS/watchdog-control/watchdog-control.sh $FILESYSTEM_ROOT/usr/local/bin/watchdog-control.sh
168+
@@ -1177,6 +1181,45 @@ sudo chmod -R 640 $FILESYSTEM_ROOT/etc/sonic/frr/
169+
sudo chmod 750 $FILESYSTEM_ROOT/etc/sonic/frr
170+
{%- endif %}
171+
172+
+{% if sonic_asic_platform == "alpinevs" %}
173+
+
174+
+# Adding fake platform files for Alpine
175+
+ALPINE_SERVICES=src/sonic-alpine/services
176+
+ALPINE_PLATFORM=src/sonic-alpine/platform
177+
+sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/device/gfpga-platform
178+
+ALPINE_SSD=$FILESYSTEM_ROOT/usr/share/sonic/device/host_block/sda
179+
+sudo mkdir -p $ALPINE_SSD
180+
+sudo cp $ALPINE_PLATFORM/smartctl.txt $ALPINE_SSD
181+
+sudo cp $ALPINE_PLATFORM/removable $ALPINE_SSD
182+
+sudo cp $ALPINE_PLATFORM/stat $ALPINE_SSD
183+
+GENERIC_PCIE_DEVICE=$FILESYSTEM_ROOT/usr/share/sonic/device/pci/0000:00:01.0
184+
+sudo mkdir -p $GENERIC_PCIE_DEVICE
185+
+sudo cp $ALPINE_PLATFORM/aer_dev_correctable $GENERIC_PCIE_DEVICE
186+
+sudo cp $ALPINE_PLATFORM/aer_dev_fatal $GENERIC_PCIE_DEVICE
187+
+sudo cp $ALPINE_PLATFORM/aer_dev_nonfatal $GENERIC_PCIE_DEVICE
188+
+
189+
+#Including add-on services for Alpine
190+
+sudo cp $ALPINE_SERVICES/config/alpinevs-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
191+
+echo "alpinevs-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
192+
+sudo cp $ALPINE_SERVICES/config/alpinevs-config.sh $FILESYSTEM_ROOT/usr/bin/
193+
+
194+
+sudo cp $ALPINE_SERVICES/init/alpinevs-init.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
195+
+echo "alpinevs-init.service" | sudo tee -a $GENERATED_SERVICE_FILE
196+
+sudo cp $ALPINE_SERVICES/init/alpinevs-init.sh $FILESYSTEM_ROOT/usr/bin/
197+
+
198+
+sudo cp $ALPINE_SERVICES/config/alpinevs-appdb.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
199+
+echo "alpinevs-appdb.service" | sudo tee -a $GENERATED_SERVICE_FILE
200+
+sudo cp $ALPINE_SERVICES/config/alpinevs-appdb.sh $FILESYSTEM_ROOT/usr/bin/
201+
+
202+
+# Alpine warm-boot related files
203+
+ALPINE_WARMBOOT=$ALPINE_PLATFORM/warm-boot
204+
+sudo cp $ALPINE_WARMBOOT/alpine-warm-reboot $FILESYSTEM_ROOT/usr/local/bin/
205+
+sudo chmod 755 $FILESYSTEM_ROOT/usr/local/bin/alpine-warm-reboot
206+
+
207+
+sudo cp $ALPINE_PLATFORM/copp_cfg.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
208+
+
209+
+{%- endif %}
210+
+
211+
# Mask services which are disabled by default
212+
sudo cp $BUILD_SCRIPTS_DIR/mask_disabled_services.py $FILESYSTEM_ROOT/tmp/
213+
sudo chmod a+x $FILESYSTEM_ROOT/tmp/mask_disabled_services.py
214+
diff --git a/rules/docker-p4rt.mk b/rules/docker-p4rt.mk
215+
index b0ced39f7..552346f54 100644
216+
--- a/rules/docker-p4rt.mk
217+
+++ b/rules/docker-p4rt.mk
218+
@@ -31,7 +31,7 @@ endif
219+
220+
$(DOCKER_P4RT)_CONTAINER_NAME = p4rt
221+
$(DOCKER_P4RT)_RUN_OPT += -t
222+
-$(DOCKER_P4RT)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
223+
+$(DOCKER_P4RT)_RUN_OPT += -v /etc/sonic:/etc/sonic:rw
224+
$(DOCKER_P4RT)_RUN_OPT += -v /etc/localtime:/etc/localtime:ro
225+
$(DOCKER_P4RT)_GIT_COMMIT = $(shell cd "$($(SONIC_P4RT)_SRC_PATH)" && git log -n 1 --format=format:"%H %s" || echo "Unable to fetch git log for p4rt")
226+
227+
diff --git a/src/sonic-device-data/src/Makefile b/src/sonic-device-data/src/Makefile
228+
index c6e05b5a8..b15efd728 100644
229+
--- a/src/sonic-device-data/src/Makefile
230+
+++ b/src/sonic-device-data/src/Makefile
231+
@@ -12,6 +12,11 @@ test:
232+
./media_checker $$f
233+
done
234+
for f in $$(find ../../../device -name platform.json); do
235+
+ if [[ $$(dirname $$f) =~ '../../../device/virtual/x86_64-kvm_x86_64-r0/alpine_' ]]; then
236+
+ # Tests expect the platform.json to be in a certain format different
237+
+ # from what Alpine uses
238+
+ continue
239+
+ fi
240+
./platform_json_checker $$f
241+
done
242+
for f in $$(find ../../../device -name hwsku.json); do

0 commit comments

Comments
 (0)