Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -806,33 +806,6 @@ if [[ $TARGET_BOOTLOADER == uboot ]]; then
sudo LANG=C chroot $FILESYSTEM_ROOT mkimage -f /boot/sonic_fit.its /boot/sonic_${CONFIGURED_ARCH}.fit
fi
fi

# Install platform-level scripts and services for aspeed platform
if [[ $CONFIGURED_PLATFORM == aspeed ]]; then
echo "Installing platform scripts and services for aspeed..."

# Copy all scripts from platform/aspeed/scripts/
if [ -d "$PLATFORM_DIR/$CONFIGURED_PLATFORM/scripts" ]; then
for script in $PLATFORM_DIR/$CONFIGURED_PLATFORM/scripts/*.sh; do
if [ -f "$script" ]; then
echo "Installing $(basename $script)..."
sudo cp -v "$script" $FILESYSTEM_ROOT/usr/bin/
sudo chmod +x $FILESYSTEM_ROOT/usr/bin/$(basename $script)
fi
done
fi

# Copy all systemd services from platform/aspeed/systemd/
if [ -d "$PLATFORM_DIR/$CONFIGURED_PLATFORM/systemd" ]; then
for service in $PLATFORM_DIR/$CONFIGURED_PLATFORM/systemd/*.service; do
if [ -f "$service" ]; then
echo "Installing and enabling $(basename $service)..."
sudo cp -v "$service" $FILESYSTEM_ROOT/etc/systemd/system/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable $(basename $service)
fi
done
fi
fi
fi

# Collect host image version files before cleanup
Expand Down
3 changes: 0 additions & 3 deletions device/aspeed/arm64-aspeed_ast2700_evb-r0/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"colors": ["green", "amber", "off"]
},
"components": [
{
"name": "BMC"
},
{
"name": "BIOS"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"chassis": {
"AST2700-EVB-BMC": {
"component": {
"BMC": {},
"BIOS": {}
}
}
Expand Down
6 changes: 6 additions & 0 deletions device/nexthop/arm64-nexthop_b27-r0/70-usb-network.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Aspeed BMC USB Network Gadget Interface Renaming Rule
# Renames USB NCM gadget interface from usb0 to bmc0 for consistent naming

# Match USB NCM gadget interface with BMC MAC address and rename to bmc0
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:00:00:00:00:01", NAME="bmc0"

7 changes: 7 additions & 0 deletions device/nexthop/arm64-nexthop_b27-r0/bmc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"usb_network": {
"interface": "bmc0",
"bmc_ipv4": "192.168.100.1/24",
"switch_host_ipv4": "192.168.100.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[program:nexthop_bmc_chassis_db_init]
command=/usr/local/bin/nexthop_bmc_chassis_db_init
priority=1
autostart=true
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true

5 changes: 1 addition & 4 deletions device/nexthop/arm64-nexthop_b27-r0/platform.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"chassis": {
"name": "NH-B27-BMC",
"name": "Nexthop BMC Card",
"thermal_manager": false,
"status_led": {
"controllable": true,
"colors": ["green", "amber", "off"]
},
"components": [
{
"name": "BMC"
},
{
"name": "BIOS"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"chassis": {
"NH-B27-BMC": {
"component": {
"BMC": {},
"BIOS": {}
}
}
Expand Down
3 changes: 2 additions & 1 deletion device/nexthop/arm64-nexthop_b27-r0/pmon_daemon_control.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"skip_ledd": true,
"skip_xcvrd": true,
"skip_psud": true,
"skip_syseepromd": true,
"skip_syseepromd": false,
"skip_pcied": true,
"skip_chassisd": true,
"skip_chassis_db_init": true,
"skip_fancontrol": true,
"include_sensormond": false,
"thermalctld": {
Expand Down
8 changes: 8 additions & 0 deletions dockers/docker-platform-monitor/docker_init.j2
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ else
SONIC_PLATFORM_API_PYTHON_VERSION=3
fi

# Copy platform-specific supervisor configs if they exist (Aspeed BMC platforms)
{% if CONFIGURED_PLATFORM == "aspeed" %}
if [ -n "$(ls /usr/share/sonic/platform/*.supervisord.conf 2>/dev/null)" ]; then
echo "Installing platform-specific supervisor configs..."
cp /usr/share/sonic/platform/*.supervisord.conf /etc/supervisor/conf.d/
fi
{% endif %}

{% if CONFIGURED_PLATFORM == "mellanox" %}

# Dynamic sensors.conf setup: create a symlink from SONiC platform directory sensors.conf -> hw-management sensors.conf
Expand Down
7 changes: 7 additions & 0 deletions platform/aspeed/aspeed-platform-services.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Aspeed Platform Services Package
# Vendor-independent services for all Aspeed platforms
#
ASPEED_PLATFORM_SERVICES = aspeed-platform-services_1.0.0_all.deb
$(ASPEED_PLATFORM_SERVICES)_SRC_PATH = $(PLATFORM_PATH)/aspeed-platform-services
SONIC_DPKG_DEBS += $(ASPEED_PLATFORM_SERVICES)

8 changes: 8 additions & 0 deletions platform/aspeed/aspeed-platform-services/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.PHONY: clean

clean:
rm -rf debian/aspeed-platform-services
rm -rf debian/.debhelper
rm -f debian/files
rm -f debian/*.log
rm -f debian/*.substvars
8 changes: 8 additions & 0 deletions platform/aspeed/aspeed-platform-services/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
aspeed-platform-services (1.0.0) unstable; urgency=low

* Initial release
* Consolidate Aspeed platform initialization services
* Add watchdog keepalive daemon (180s timeout, 60s interval)

-- SONiC Team <[email protected]> Mon, 16 Mar 2026 00:00:00 +0000

2 changes: 2 additions & 0 deletions platform/aspeed/aspeed-platform-services/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
10

21 changes: 21 additions & 0 deletions platform/aspeed/aspeed-platform-services/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Source: aspeed-platform-services
Section: misc
Priority: optional
Maintainer: SONiC Team <[email protected]>
Build-Depends: debhelper (>= 10)
Standards-Version: 3.9.6

Package: aspeed-platform-services
Architecture: all
Depends: ${misc:Depends}
Description: Aspeed platform services for SONiC
This package provides platform-specific services for Aspeed-based BMC platforms:
- Machine configuration initialization
- Platform initialization
- Switch CPU console initialization
- U-Boot environment initialization
- Watchdog keepalive daemon
.
The watchdog keepalive daemon keeps the hardware watchdog armed and sends
periodic keepalive signals to prevent system resets.

24 changes: 24 additions & 0 deletions platform/aspeed/aspeed-platform-services/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/make -f

%:
dh $@

override_dh_auto_build:
# Nothing to build

override_dh_auto_install:
# Install scripts
install -d $(CURDIR)/debian/aspeed-platform-services/usr/bin
install -m 0755 $(CURDIR)/scripts/*.sh $(CURDIR)/debian/aspeed-platform-services/usr/bin/

# Install systemd service files
install -d $(CURDIR)/debian/aspeed-platform-services/lib/systemd/system
install -m 0644 $(CURDIR)/systemd/*.service $(CURDIR)/debian/aspeed-platform-services/lib/systemd/system/

override_dh_installsystemd:
dh_installsystemd --name=sonic-machine-conf-init sonic-machine-conf-init.service
dh_installsystemd --name=sonic-platform-init sonic-platform-init.service
dh_installsystemd --name=sonic-switchcpu-console-init sonic-switchcpu-console-init.service
dh_installsystemd --name=sonic-uboot-env-init sonic-uboot-env-init.service
dh_installsystemd --name=watchdog-keepalive watchdog-keepalive.service

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash
#
# Watchdog keepalive daemon for Aspeed platforms.
#
# This daemon keeps the hardware watchdog alive by sending periodic keepalive
# signals. It opens /dev/watchdog and writes 'w' character every 60 seconds
# (with a 180 second watchdog timeout).
#

WATCHDOG_DEVICE="/dev/watchdog0"
KEEPALIVE_INTERVAL=60 # seconds
LOG_FILE="/var/log/aspeed-watchdog.log"
MAX_RETAINED_LOGS=5

# Rotate old logs
rotate_logs() {
ls -t /var/log/aspeed-watchdog*.log 2>/dev/null | cat -n | while read n f; do
if [ $n -gt $MAX_RETAINED_LOGS ]; then
rm -f "$f"
fi
done
}

# Signal handler for graceful shutdown
cleanup() {
echo "$(date -u): Watchdog keepalive daemon stopping" >> "$LOG_FILE"

# Disarm the watchdog using watchdogutil
if command -v watchdogutil &> /dev/null; then
watchdogutil disarm >> "$LOG_FILE" 2>&1 || {
echo "$(date -u): WARNING: Failed to disarm watchdog - system may reboot" >> "$LOG_FILE"
}
else
echo "$(date -u): WARNING: watchdogutil not found - cannot disarm watchdog" >> "$LOG_FILE"
fi

# Close the file descriptor
exec {wdt_fd}>&- 2>/dev/null || true

echo "$(date -u): Watchdog keepalive daemon stopped" >> "$LOG_FILE"
exit 0
}

trap 'cleanup' SIGTERM SIGINT

# Rotate logs
rotate_logs

# Start logging
echo "$(date -u): Watchdog keepalive daemon starting" > "$LOG_FILE"

# Set watchdog interval to 180 seconds
# Set watchdog timeout to 180 seconds
if command -v watchdogutil &> /dev/null; then
watchdogutil arm -s 180 >> "$LOG_FILE" 2>&1
echo "$(date -u): Watchdog timeout set to 180 seconds" >> "$LOG_FILE"
else
echo "$(date -u): WARNING: watchdogutil not found, using default timeout" >> "$LOG_FILE"
fi

# Open watchdog device and assign FD to variable wdt_fd
exec {wdt_fd}>"$WATCHDOG_DEVICE"
if [ $? -ne 0 ]; then
echo "$(date -u): ERROR: Failed to open $WATCHDOG_DEVICE" >> "$LOG_FILE"
exit 1
fi

echo "$(date -u): Opened $WATCHDOG_DEVICE with FD $wdt_fd" >> "$LOG_FILE"

# Send first keepalive
echo "w" >&${wdt_fd}
echo "$(date -u): First watchdog keepalive sent" >> "$LOG_FILE"

# Main keepalive loop
while true; do
sleep $KEEPALIVE_INTERVAL
echo "w" >&${wdt_fd}
echo "$(date -u): Watchdog keepalive sent" >> "$LOG_FILE"
done

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=Watchdog Keepalive Daemon
Documentation=man:watchdog(8)
After=multi-user.target
Before=shutdown.target

[Service]
Type=simple
ExecStart=/usr/bin/watchdog-keepalive.sh
Copy link
Copy Markdown
Contributor

@judyjoseph judyjoseph Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need infra change to copy the watchdog script from platform/aspeed/aspeed-platform-services/scripts/watchdog-keepalive.sh to /usr/bin -- as I see some line relating to this removed in build_debian.sh‎ ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we now have a separate debian package, aspeed-platform-services. Its install rules takes care of this. Earlier we were doing it from build_debian.sh directly with a platform check. That was a stop gap.

Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

1 change: 1 addition & 0 deletions platform/aspeed/build-emmc-image-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set -e # Exit on error
# Configuration
# We use 10GB as the 32G eMMC card in chipmunk will be 10G post pSLC partitioning
EMMC_SIZE_MB=10240
#EMMC_SIZE_MB=7168
PARTITION_LABEL="SONiC-OS" # Single partition for all SONiC images
ROOT_PART_SIZE_MB=$((EMMC_SIZE_MB - 100)) # SONiC-OS partition size (leave 100MB for GPT overhead)

Expand Down
Loading
Loading