Skip to content

Commit d0471b0

Browse files
simonJi2018MichelMoriniaux
authored andcommitted
[nephos]: upgrade compile sdk.deb from online to dpkg and fix compile error (sonic-net#2800)
* upgrade compile sdk.deb from online to dpkg and upgrade docker syncd and orchagent to stretch * Delete docker-orchagent-nephos.mk Delete docker-orchagent-nephos.mk * Update docker-syncd-nephos.mk * Update Dockerfile.j2
1 parent a9e8032 commit d0471b0

34 files changed

+14705
-43
lines changed
+9-21
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
# docker image for nephos syncd
22

3-
DOCKER_SYNCD_NEPHOS = docker-syncd-nephos.gz
4-
$(DOCKER_SYNCD_NEPHOS)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos
5-
$(DOCKER_SYNCD_NEPHOS)_DEPENDS += $(SYNCD)
6-
ifeq ($(INSTALL_DEBUG_TOOLS), y)
7-
$(DOCKER_SYNCD_NEPHOS)_DEPENDS += $(SYNCD_DBG) \
8-
$(LIBSWSSCOMMON_DBG) \
9-
$(LIBSAIMETADATA_DBG) \
10-
$(LIBSAIREDIS_DBG)
11-
endif
12-
$(DOCKER_SYNCD_NEPHOS)_FILES += $(DSSERVE) $(NPX_DIAG)
13-
$(DOCKER_SYNCD_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
14-
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS)
15-
ifneq ($(ENABLE_SYNCD_RPC),y)
16-
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS)
17-
endif
3+
DOCKER_SYNCD_PLATFORM_CODE = nephos
4+
include $(PLATFORM_PATH)/../template/docker-syncd-base.mk
185

19-
$(DOCKER_SYNCD_NEPHOS)_CONTAINER_NAME = syncd
20-
$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += --net=host --privileged -t
21-
$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
22-
$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd
23-
$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
6+
$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API)
247

25-
$(DOCKER_SYNCD_NEPHOS)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag
8+
$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \
9+
$(LIBSWSSCOMMON_DBG) \
10+
$(LIBSAIMETADATA_DBG) \
11+
$(LIBSAIREDIS_DBG)
12+
13+
$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot

platform/nephos/docker-syncd-nephos/Dockerfile.j2

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker-config-engine
1+
FROM docker-config-engine-stretch
22

33
ARG docker_container_name
44
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
@@ -14,17 +14,25 @@ debs/{{ deb }}{{' '}}
1414
{%- endfor -%}
1515
debs/
1616

17+
COPY \
18+
{% for deb in docker_syncd_nephos_pydebs.split(' ') -%}
19+
python-debs/{{ deb }}{{' '}}
20+
{%- endfor -%}
21+
debs/
22+
23+
RUN apt-get install -y libxml2
24+
1725
RUN dpkg -i \
1826
{% for deb in docker_syncd_nephos_debs.split(' ') -%}
1927
debs/{{ deb }}{{' '}}
2028
{%- endfor %}
2129

22-
## TODO: add kmod into Depends
23-
RUN apt-get install -f kmod
24-
25-
COPY ["files/dsserve", "files/npx_diag", "start.sh", "/usr/bin/"]
26-
RUN chmod +x /usr/bin/dsserve /usr/bin/npx_diag
30+
##RUN dpkg -i \
31+
##{% for deb in docker_syncd_nephos_pydebs.split(' ') -%}
32+
##debs/{{ deb }}{{' '}}
33+
##{%- endfor %}
2734

35+
COPY ["start.sh", "/usr/bin/"]
2836
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
2937

3038
## Clean up

platform/nephos/libsaithrift-dev.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ SAI_VER = 0.9.4
44

55
LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb
66
$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
7-
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV)
7+
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV)
88
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI)
99
SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV)
1010

1111
PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb
1212
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT)))
1313

1414
SAISERVER = saiserver_$(SAI_VER)_amd64.deb
15-
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI)
15+
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI)
1616
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER)))
1717

1818
SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb

platform/nephos/nephos-modules.mk

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Nephos Platform modules
2+
3+
VERSION = 1.0.0
4+
5+
NEPHOS_MODULE = nephos-modules_$(VERSION)_amd64.deb
6+
$(NEPHOS_MODULE)_SRC_PATH = $(PLATFORM_PATH)/nephos-modules
7+
$(NEPHOS_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
8+
SONIC_DPKG_DEBS += $(NEPHOS_MODULE)
9+
10+
SONIC_STRETCH_DEBS += $(NEPHOS_MODULE)
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Nephos-modules
2+
Device drivers for support of Nephos platform for the SONiC project
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
nephos-modules (1.0.0) unstable; urgency=low
2+
3+
* Initial release
4+
5+
-- Support <[email protected]> Fri, 15 Mar 2019 15:54:00 +0800
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Source: nephos-modules
2+
Section: main
3+
Priority: extra
4+
Maintainer: support <[email protected]>
5+
Build-Depends: debhelper (>= 8.0.0), bzip2
6+
Standards-Version: 3.9.3
7+
8+
Package: nephos-modules
9+
Architecture: amd64
10+
Depends: linux-image-4.9.0-8-2-amd64
11+
Description: kernel modules for nephos asic
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/make -f
2+
3+
export INSTALL_MOD_DIR:=extra
4+
5+
PACKAGE_NAME := nephos-modules
6+
KVERSION ?= $(shell uname -r)
7+
KERNEL_SRC := /lib/modules/$(KVERSION)
8+
SERVICE_DIR := service
9+
INITD_DIR := init.d
10+
MODULE_SRC := $(shell pwd)/modules
11+
CURRENT_DIR := $(cd "$(dirname "$0")"; pwd)
12+
13+
%:
14+
dh $@
15+
16+
override_dh_auto_build:
17+
make -C $(MODULE_SRC)
18+
19+
override_dh_auto_install:
20+
dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/extra
21+
cp $(MODULE_SRC)/build/module/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/extra
22+
dh_installdirs -p$(PACKAGE_NAME) /lib/systemd/system
23+
cp $(MODULE_SRC)/service/*.service debian/$(PACKAGE_NAME)/lib/systemd/system/
24+
dh_installdirs -p$(PACKAGE_NAME) /etc/init.d
25+
cp $(MODULE_SRC)/init.d/* debian/$(PACKAGE_NAME)/etc/init.d/
26+
27+
override_dh_usrlocal:
28+
29+
override_dh_pysupport:
30+
31+
override_dh_clean:
32+
dh_clean
33+
test -d $(MODULE_SRC)/build || rm -rf $(MODULE_SRC)/build
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
################################################################################
2+
# Copyright (C) 2019 Nephos, Inc.
3+
#
4+
# This program is free software; you can redistribute it and/or
5+
# modify it under the terms of version 2 of the GNU General Public
6+
# License as published by the Free Software Foundation.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# version 2 along with this program.
15+
################################################################################
16+
NPS_MODULES_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
17+
SRC_PATH := $(NPS_MODULES_DIR)/src
18+
INC_PATH := $(SRC_PATH)/inc
19+
################################################################################
20+
include $(NPS_MODULES_DIR)/config.mk
21+
################################################################################
22+
MODULE_OUTPUT_DIR := $(BUILD_OUTPUT_DIR)/module
23+
################################################################################
24+
all: compile install
25+
################################################################################
26+
EXTRA_CFLAGS += -I$(INC_PATH)
27+
EXTRA_CFLAGS += -DNPS_EN_NETIF
28+
EXTRA_CFLAGS += -DNPS_EN_TAURUS
29+
EXTRA_CFLAGS += -DNPS_LINUX_USER_MODE
30+
EXTRA_CFLAGS += -DNPS_EN_LITTLE_ENDIAN
31+
ifeq ($(shell uname -m),x86_64)
32+
EXTRA_CFLAGS += -DNPS_EN_HOST_64_BIT_LITTLE_ENDIAN
33+
else
34+
EXTRA_CFLAGS += -DNPS_EN_HOST_32_BIT_LITTLE_ENDIAN
35+
endif
36+
################################################################################
37+
include $(SRC_PATH)/make.mk
38+
################################################################################
39+
compile::
40+
41+
install::
42+
$(TEST_PATH) $(MODULE_OUTPUT_DIR) || $(MKDIR) $(MODULE_OUTPUT_DIR)
43+
$(MV) $(BUILD_OUTPUT_DIR)/$(DEV_MODULE_NAME).ko $(MODULE_OUTPUT_DIR)/$(DEV_MODULE_NAME).ko
44+
$(MV) $(BUILD_OUTPUT_DIR)/$(NETIF_MODULE_NAME).ko $(MODULE_OUTPUT_DIR)/$(NETIF_MODULE_NAME).ko
45+
46+
clean::
47+
$(RM) $(BUILD_OUTPUT_DIR)
48+
49+
.PHONY: all compile install clean
50+
.NOTPARALLEL: all compile install clean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
################################################################################
2+
# Copyright (C) 2019 Nephos, Inc.
3+
#
4+
# This program is free software; you can redistribute it and/or
5+
# modify it under the terms of version 2 of the GNU General Public
6+
# License as published by the Free Software Foundation.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# version 2 along with this program.
15+
################################################################################
16+
Step 1~4 show how to build and execute NPS kernel modules.
17+
18+
1. Modify nps-modules/config.mk to specify the output directory to BUILD_OUTPUT_DIR.
19+
The default output path is nps-modules/build.
20+
21+
2. Compile:
22+
cd nps-modules/ && make
23+
24+
3. The output kernel modules will be found in $(BUILD_OUTPUT_DIR)/modules/
25+
- nps_dev.ko
26+
- nps_netif.ko
27+
28+
4. Load modules:
29+
(1) insmod nps_dev.ko
30+
(2) insmod nps_netif.ko
31+
32+
Note that the module inserting sequence cannot be changed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
################################################################################
2+
# Copyright (C) 2019 Nephos, Inc.
3+
#
4+
# This program is free software; you can redistribute it and/or
5+
# modify it under the terms of version 2 of the GNU General Public
6+
# License as published by the Free Software Foundation.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# version 2 along with this program.
15+
################################################################################
16+
BUILD_OUTPUT_DIR := $(NPS_MODULES_DIR)/build
17+
################################################################################
18+
#OS_PATH := /lib/modules/$(shell uname -r)/build
19+
OS_PATH := /lib/modules/$(KVERSION)/build
20+
21+
################################################################################
22+
MAKE := make
23+
RM := rm -rf
24+
MKDIR := mkdir -p
25+
CP := cp
26+
MV := mv
27+
TEST_PATH := test -d
28+
################################################################################
29+
export BUILD_OUTPUT_DIR
30+
export OS_PATH
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# This script load/unload nps kernel modules
3+
4+
### BEGIN INIT INFO
5+
# Provides: load-nps-modules
6+
# Required-Start:
7+
# Required-Stop:
8+
# Should-Start:
9+
# Should-Stop:
10+
# Default-Start: S
11+
# Default-Stop: 0 6
12+
# Short-Description: Load nps kernel modules
13+
### END INIT INFO
14+
15+
case "$1" in
16+
start)
17+
echo -n "Load nps kernel modules... "
18+
19+
RMEM_SIZE=`cat /proc/sys/net/core/rmem_max`
20+
if [ $RMEM_SIZE -lt 8388608 ]; then
21+
echo "8388608" > /proc/sys/net/core/rmem_max
22+
fi
23+
WMEM_SIZE=`cat /proc/sys/net/core/wmem_max`
24+
if [ $WMEM_SIZE -lt 25165824 ]; then
25+
echo "25165824" > /proc/sys/net/core/wmem_max
26+
fi
27+
28+
modprobe nps_dev
29+
modprobe nps_netif
30+
31+
echo "done."
32+
;;
33+
34+
stop)
35+
echo -n "Unload nps kernel modules... "
36+
37+
rmmod nps_netif
38+
rmmod nps_dev
39+
40+
echo "done."
41+
;;
42+
43+
force-reload|restart)
44+
echo "Not supported"
45+
;;
46+
47+
*)
48+
echo "Usage: /etc/init.d/nps-modules-4.9.0-8-2-amd64.init {start|stop}"
49+
exit 1
50+
;;
51+
esac
52+
53+
exit 0
54+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Nephos kernel modules init
3+
After=local-fs.target
4+
Before=syncd.service
5+
6+
[Service]
7+
Type=oneshot
8+
ExecStart=-/etc/init.d/nps-modules-4.9.0-8-2-amd64 start
9+
ExecStop=-/etc/init.d/nps-modules-4.9.0-8-2-amd64 stop
10+
RemainAfterExit=yes
11+
12+
[Install]
13+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)