diff --git a/platform/s3ip-sysfs/Makefile b/platform/s3ip-sysfs/Makefile new file mode 100644 index 000000000000..fa562ba235d5 --- /dev/null +++ b/platform/s3ip-sysfs/Makefile @@ -0,0 +1,46 @@ +PWD = $(shell pwd) +SYSFS_OUT_PUT := $(PWD)/build +sysfs_out_put_dir := $(SYSFS_OUT_PUT)/S3IP_sysfs/ +export sysfs_out_put_dir +KERNEL_SRC=/lib/modules/$(shell uname -r) +export KERNEL_SRC + +SYSFS_DRIVER_DIR = $(PWD)/s3ip_sysfs_frame +SWITCH_DRIVER_DIR = $(PWD)/demo_driver + +KBUILD_EXTRA_SYMBOLS += $(SYSFS_DRIVER_DIR)/Module.symvers +KBUILD_EXTRA_SYMBOLS += $(SWITCH_DRIVER_DIR)/Module.symvers +export KBUILD_EXTRA_SYMBOLS + +all : + $(MAKE) -C $(SYSFS_DRIVER_DIR) + $(MAKE) -C $(SWITCH_DRIVER_DIR) + +clean : + -rm -rf $(SYSFS_OUT_PUT) + $(MAKE) -C $(SYSFS_DRIVER_DIR) clean + $(MAKE) -C $(SWITCH_DRIVER_DIR) clean + + + +install: + install -d $(DESTDIR)/lib/modules/s3ip/ + install -D $(sysfs_out_put_dir)/*.ko \ + $(DESTDIR)/lib/modules/s3ip/ + install -D scripts/s3ip_load.py \ + $(DESTDIR)/$(prefix)/bin/s3ip_load.py + install -D scripts/s3ip_sysfs_conf.json \ + $(DESTDIR)/etc/s3ip/s3ip_sysfs_conf.json + install -D scripts/s3ip_sysfs_tool.sh \ + $(DESTDIR)/$(prefix)/bin/s3ip_sysfs_tool.sh + install -D scripts/s3ip-sysfs.service \ + $(DESTDIR)/etc/systemd/system/s3ip-sysfs.service + + +uninstall: + -rm -f $(DESTDIR)$(prefix)/bin/s3ip_load.py + -rm -f $(DESTDIR)/lib/modules/s3ip/ + -rm -f $(DESTDIR)/etc/s3ip + -rm -f $(DESTDIR)/$(prefix)/bin/s3ip_sysfs_tool.sh + -rm -f $(DESTDIR)/etc/systemd/system/s3ip-sysfs.service + diff --git a/platform/s3ip-sysfs/build.sh b/platform/s3ip-sysfs/build.sh new file mode 100755 index 000000000000..d72369ea50a1 --- /dev/null +++ b/platform/s3ip-sysfs/build.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +dpkg-buildpackage -rfakeroot -b -us -uc diff --git a/platform/s3ip-sysfs/debian/.debhelper/generated/s3ip-sysfs/installed-by-dh_installdocs b/platform/s3ip-sysfs/debian/.debhelper/generated/s3ip-sysfs/installed-by-dh_installdocs new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/s3ip-sysfs/debian/README.Debian b/platform/s3ip-sysfs/debian/README.Debian new file mode 100755 index 000000000000..0a2ca471ac20 --- /dev/null +++ b/platform/s3ip-sysfs/debian/README.Debian @@ -0,0 +1,8 @@ +s3ip-sysfs for Debian + +Please edit this to provide information specific to +this libkbc Debian package. + + (Automatically generated by debmake Version 4.2.9) + + -- ubuntu Mon, 07 Sep 2020 20:06:06 +0800 diff --git a/platform/s3ip-sysfs/debian/changelog b/platform/s3ip-sysfs/debian/changelog new file mode 100755 index 000000000000..6f6762dd2262 --- /dev/null +++ b/platform/s3ip-sysfs/debian/changelog @@ -0,0 +1,6 @@ +s3ip-sysfs (1.0.0) unstable; urgency=medium + + * Initial release. + + -- shangfei tian Wed, 09 Sep 2021 12:00:00 -0800 + diff --git a/platform/s3ip-sysfs/debian/compat b/platform/s3ip-sysfs/debian/compat new file mode 100755 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/s3ip-sysfs/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/s3ip-sysfs/debian/control b/platform/s3ip-sysfs/debian/control new file mode 100755 index 000000000000..9b1d90ed1cfd --- /dev/null +++ b/platform/s3ip-sysfs/debian/control @@ -0,0 +1,14 @@ +Source: s3ip-sysfs +Maintainer: timsftian +Section: libs +Priority: optional +Build-Depends: dh-exec (>=0.3),debhelper (>= 8.0.0), autotools-dev +Standards-Version: 3.9.3 +Homepage: https://tencent.com + +Package: s3ip-sysfs +Architecture: any +Section: libdevel +Depends: ${misc:Depends} +Description: This package contains development files for s3ip sysfs + diff --git a/platform/s3ip-sysfs/debian/copyright b/platform/s3ip-sysfs/debian/copyright new file mode 100755 index 000000000000..0cf1e83c5a65 --- /dev/null +++ b/platform/s3ip-sysfs/debian/copyright @@ -0,0 +1,13 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: s3ip-sysfs +Source: +# +# Please double check copyright with the licensecheck(1) command. + +Files: Makefile +Copyright: __NO_COPYRIGHT_NOR_LICENSE__ +License: __NO_COPYRIGHT_NOR_LICENSE__ + +#---------------------------------------------------------------------------- +# Files marked as NO_LICENSE_TEXT_FOUND may be covered by the following +# license/copyright files. diff --git a/platform/s3ip-sysfs/debian/files b/platform/s3ip-sysfs/debian/files new file mode 100644 index 000000000000..b1b2585c4365 --- /dev/null +++ b/platform/s3ip-sysfs/debian/files @@ -0,0 +1,2 @@ +s3ip-sysfs_1.0.0_amd64.buildinfo libs optional +s3ip-sysfs_1.0.0_amd64.deb libdevel optional diff --git a/platform/s3ip-sysfs/debian/rules b/platform/s3ip-sysfs/debian/rules new file mode 100755 index 000000000000..86f77f3211c7 --- /dev/null +++ b/platform/s3ip-sysfs/debian/rules @@ -0,0 +1,17 @@ +#!/usr/bin/make -f +# You must remove unused comment lines for the released package. +#export DH_VERBOSE = 1 + +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +%: + dh $@ + +override_dh_auto_install: + dh_auto_install -- prefix=/usr + +override_dh_shlibdeps: + +override_dh_installmodules: diff --git a/platform/s3ip-sysfs/debian/s3ip-sysfs.postinst b/platform/s3ip-sysfs/debian/s3ip-sysfs.postinst new file mode 100644 index 000000000000..a57c5a76865c --- /dev/null +++ b/platform/s3ip-sysfs/debian/s3ip-sysfs.postinst @@ -0,0 +1,3 @@ +systemctl daemon-reload +systemctl start s3ip-sysfs +systemctl enable s3ip-sysfs diff --git a/platform/s3ip-sysfs/debian/s3ip-sysfs.prerm b/platform/s3ip-sysfs/debian/s3ip-sysfs.prerm new file mode 100644 index 000000000000..3e6b2b5180ea --- /dev/null +++ b/platform/s3ip-sysfs/debian/s3ip-sysfs.prerm @@ -0,0 +1,2 @@ +systemctl stop s3ip-sysfs +systemctl disable s3ip-sysfs diff --git a/platform/s3ip-sysfs/debian/s3ip-sysfs.substvars b/platform/s3ip-sysfs/debian/s3ip-sysfs.substvars new file mode 100644 index 000000000000..978fc8b5a0eb --- /dev/null +++ b/platform/s3ip-sysfs/debian/s3ip-sysfs.substvars @@ -0,0 +1,2 @@ +misc:Depends= +misc:Pre-Depends= diff --git a/platform/s3ip-sysfs/debian/watch b/platform/s3ip-sysfs/debian/watch new file mode 100755 index 000000000000..33435127f6c8 --- /dev/null +++ b/platform/s3ip-sysfs/debian/watch @@ -0,0 +1,2 @@ +# You must remove unused comment lines for the released package. +#version=3 diff --git a/platform/s3ip-sysfs/demo_driver/Makefile b/platform/s3ip-sysfs/demo_driver/Makefile new file mode 100644 index 000000000000..2d565cef50c5 --- /dev/null +++ b/platform/s3ip-sysfs/demo_driver/Makefile @@ -0,0 +1,33 @@ +PWD = $(shell pwd) + +MAKEFILE_FILE_PATH = $(abspath $(lastword $(MAKEFILE_LIST))) +DEV_SYSFS_HEADER_DIR = $(abspath $(MAKEFILE_FILE_PATH)/../../s3ip_sysfs_frame/include) +SWITCH_DVR_HEADER_DIR = $(abspath $(MAKEFILE_FILE_PATH)/../../s3ip_sysfs_frame/include) +EXTRA_CFLAGS:= -I$(M)/include +EXTRA_CFLAGS+= -I$(DEV_SYSFS_HEADER_DIR) +EXTRA_CFLAGS+= -I$(SWITCH_DVR_HEADER_DIR) +EXTRA_CFLAGS+= -Wall + +obj-m := syseeprom_device_driver.o +obj-m += fan_device_driver.o +obj-m += cpld_device_driver.o +obj-m += sysled_device_driver.o +obj-m += slot_device_driver.o +obj-m += psu_device_driver.o +obj-m += transceiver_device_driver.o +obj-m += temp_sensor_device_driver.o +obj-m += vol_sensor_device_driver.o +obj-m += curr_sensor_device_driver.o +obj-m += fpga_device_driver.o +obj-m += watchdog_device_driver.o + + +all: + $(MAKE) -C $(KERNEL_SRC)/build M=$(PWD) modules + @if [ ! -d $(sysfs_out_put_dir) ]; then mkdir -p $(sysfs_out_put_dir) ;fi + cp -p $(PWD)/*.ko $(sysfs_out_put_dir) +clean: + rm -f $(PWD)/*.o $(PWD)/*.ko $(PWD)/*.mod.c $(PWD)/.*.cmd + rm -f $(PWD)/Module.markers $(PWD)/Module.symvers $(PWD)/modules.order + rm -rf $(PWD)/.tmp_versions + rm -rf $(PWD)/.cache.mk \ No newline at end of file diff --git a/platform/s3ip-sysfs/s3ip_sysfs_frame/Makefile b/platform/s3ip-sysfs/s3ip_sysfs_frame/Makefile new file mode 100755 index 000000000000..38ed6083335a --- /dev/null +++ b/platform/s3ip-sysfs/s3ip_sysfs_frame/Makefile @@ -0,0 +1,27 @@ +PWD = $(shell pwd) + +EXTRA_CFLAGS:= -I$(M)/include +EXTRA_CFLAGS+= -Wall + +s3ip_sysfs-objs := switch.o cpld_sysfs.o \ +curr_sensor_sysfs.o \ +fan_sysfs.o \ +fpga_sysfs.o \ +psu_sysfs.o \ +slot_sysfs.o \ +sysled_sysfs.o \ +temp_sensor_sysfs.o \ +transceiver_sysfs.o \ +vol_sensor_sysfs.o \ +watchdog_sysfs.o \ + +obj-m := s3ip_sysfs.o + +all: + $(MAKE) -C $(KERNEL_SRC)/build M=$(PWD) modules + @if [ ! -d $(sysfs_out_put_dir) ]; then mkdir -p $(sysfs_out_put_dir) ;fi + cp -p $(PWD)/*.ko $(sysfs_out_put_dir) +clean: + rm -f $(PWD)/*.o $(PWD)/*.ko $(PWD)/*.mod.c $(PWD)/.*.cmd + rm -f $(PWD)/Module.markers $(PWD)/Module.symvers $(PWD)/modules.order + rm -rf $(PWD)/.tmp_versions \ No newline at end of file