Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The build project of s3ip framework #12896

Merged
merged 1 commit into from
Dec 14, 2022
Merged
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
46 changes: 46 additions & 0 deletions platform/s3ip-sysfs/Makefile
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions platform/s3ip-sysfs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/bash

dpkg-buildpackage -rfakeroot -b -us -uc
8 changes: 8 additions & 0 deletions platform/s3ip-sysfs/debian/README.Debian
Original file line number Diff line number Diff line change
@@ -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 <ubuntu@localhost> Mon, 07 Sep 2020 20:06:06 +0800
6 changes: 6 additions & 0 deletions platform/s3ip-sysfs/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
s3ip-sysfs (1.0.0) unstable; urgency=medium

* Initial release.

-- shangfei tian <[email protected]> Wed, 09 Sep 2021 12:00:00 -0800

1 change: 1 addition & 0 deletions platform/s3ip-sysfs/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
14 changes: 14 additions & 0 deletions platform/s3ip-sysfs/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Source: s3ip-sysfs
Maintainer: timsftian <[email protected]>
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

13 changes: 13 additions & 0 deletions platform/s3ip-sysfs/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: s3ip-sysfs
Source: <url://example.com>
#
# 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.
2 changes: 2 additions & 0 deletions platform/s3ip-sysfs/debian/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
s3ip-sysfs_1.0.0_amd64.buildinfo libs optional
s3ip-sysfs_1.0.0_amd64.deb libdevel optional
17 changes: 17 additions & 0 deletions platform/s3ip-sysfs/debian/rules
Original file line number Diff line number Diff line change
@@ -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:
3 changes: 3 additions & 0 deletions platform/s3ip-sysfs/debian/s3ip-sysfs.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
systemctl daemon-reload
systemctl start s3ip-sysfs
systemctl enable s3ip-sysfs
2 changes: 2 additions & 0 deletions platform/s3ip-sysfs/debian/s3ip-sysfs.prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
systemctl stop s3ip-sysfs
systemctl disable s3ip-sysfs
2 changes: 2 additions & 0 deletions platform/s3ip-sysfs/debian/s3ip-sysfs.substvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=
2 changes: 2 additions & 0 deletions platform/s3ip-sysfs/debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# You must remove unused comment lines for the released package.
#version=3
33 changes: 33 additions & 0 deletions platform/s3ip-sysfs/demo_driver/Makefile
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions platform/s3ip-sysfs/s3ip_sysfs_frame/Makefile
Original file line number Diff line number Diff line change
@@ -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