The build project of s3ip frameworkk (#12896)

Why I did it
The build project of s3ip framework

How I did it
How to verify it
This commit is contained in:
tianshangfei 2022-12-14 22:36:08 +08:00 committed by GitHub
parent ea807d7d0b
commit de4506dbf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 179 additions and 0 deletions

View File

@ -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
platform/s3ip-sysfs/build.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
dpkg-buildpackage -rfakeroot -b -us -uc

View File

@ -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

View File

@ -0,0 +1,6 @@
s3ip-sysfs (1.0.0) unstable; urgency=medium
* Initial release.
-- shangfei tian <timsftian@tencent.com> Wed, 09 Sep 2021 12:00:00 -0800

View File

@ -0,0 +1 @@
9

View File

@ -0,0 +1,14 @@
Source: s3ip-sysfs
Maintainer: timsftian <timsftian@tencent.com>
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

View File

@ -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.

View File

@ -0,0 +1,2 @@
s3ip-sysfs_1.0.0_amd64.buildinfo libs optional
s3ip-sysfs_1.0.0_amd64.deb libdevel optional

View File

@ -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:

View File

@ -0,0 +1,3 @@
systemctl daemon-reload
systemctl start s3ip-sysfs
systemctl enable s3ip-sysfs

View File

@ -0,0 +1,2 @@
systemctl stop s3ip-sysfs
systemctl disable s3ip-sysfs

View File

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

View File

@ -0,0 +1,2 @@
# You must remove unused comment lines for the released package.
#version=3

View File

@ -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

View File

@ -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