mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
添加风扇启动
This commit is contained in:
parent
47fe97caf6
commit
b8ef4e19ad
4 changed files with 19 additions and 220 deletions
|
@ -1,169 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2020 Tony Ambardar <itugrok@yahoo.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bpftools
|
||||
PKG_VERSION:=5.11.16
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
|
||||
PKG_HASH:=21163681d130cbce5a6be39019e2c69e44f284855ddd70b1a3bd039249540f43
|
||||
|
||||
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
LINUX_VERSION:=$(PKG_VERSION)
|
||||
LINUX_TLD:=linux-$(LINUX_VERSION)
|
||||
|
||||
BPF_FILES:= \
|
||||
kernel/bpf scripts tools/Makefile tools/bpf tools/perf/perf-sys.h \
|
||||
tools/arch tools/build tools/include tools/lib tools/scripts
|
||||
TAR_OPTIONS+= \
|
||||
--transform="s;$(LINUX_TLD)/;$(PKG_NAME)-$(PKG_VERSION)/;" \
|
||||
$(addprefix $(LINUX_TLD)/,$(BPF_FILES))
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/bpftool/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=bpftool - eBPF subsystem utility
|
||||
LICENSE:=GPL-2.0-only OR BSD-2-Clause
|
||||
URL:=http://www.kernel.org
|
||||
DEPENDS:=+libelf
|
||||
endef
|
||||
|
||||
define Package/bpftool-minimal
|
||||
$(call Package/bpftool/Default)
|
||||
TITLE+= (Minimal)
|
||||
VARIANT:=minimal
|
||||
DEFAULT_VARIANT:=1
|
||||
PROVIDES:=bpftool
|
||||
ALTERNATIVES:=200:/usr/sbin/bpftool:/usr/libexec/bpftool-minimal
|
||||
endef
|
||||
|
||||
define Package/bpftool-full
|
||||
$(call Package/bpftool/Default)
|
||||
TITLE+= (Full)
|
||||
VARIANT:=full
|
||||
PROVIDES:=bpftool
|
||||
ALTERNATIVES:=300:/usr/sbin/bpftool:/usr/libexec/bpftool-full
|
||||
DEPENDS+= +libbfd +libopcodes
|
||||
endef
|
||||
|
||||
define Package/bpftool-minimal/description
|
||||
A tool for inspection and simple manipulation of eBPF programs and maps.
|
||||
endef
|
||||
|
||||
define Package/bpftool-full/description
|
||||
A tool for inspection and simple manipulation of eBPF programs and maps.
|
||||
This full version uses libbfd and libopcodes to support disassembly of
|
||||
eBPF programs and jited code.
|
||||
endef
|
||||
|
||||
define Package/libbpf
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=libbpf - eBPF helper library
|
||||
VARIANT:=lib
|
||||
LICENSE:=LGPL-2.1 OR BSD-2-Clause
|
||||
ABI_VERSION:=0
|
||||
URL:=http://www.kernel.org
|
||||
DEPENDS:=+libelf
|
||||
endef
|
||||
|
||||
define Package/libbpf/description
|
||||
libbpf is a library for loading eBPF programs and reading and manipulating eBPF objects from user-space.
|
||||
endef
|
||||
|
||||
|
||||
# LTO not compatible with DSO using PIC
|
||||
ifneq ($(BUILD_VARIANT),lib)
|
||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
endif
|
||||
|
||||
MAKE_VARS = \
|
||||
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)"
|
||||
|
||||
MAKE_FLAGS += \
|
||||
BPFTOOL_VERSION="$(LINUX_VERSION)" \
|
||||
FEATURES_DUMP="$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt" \
|
||||
OUTPUT="$(PKG_BUILD_DIR)/" \
|
||||
prefix="/usr" \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
HAVE_LIBBFD:=1
|
||||
HAVE_LIBCAP:=0
|
||||
HAVE_CLANG:=0
|
||||
MAKE_PATH:=tools/bpf/bpftool
|
||||
else ifeq ($(BUILD_VARIANT),minimal)
|
||||
HAVE_LIBBFD:=0
|
||||
HAVE_LIBCAP:=0
|
||||
HAVE_CLANG:=0
|
||||
MAKE_PATH:=tools/bpf/bpftool
|
||||
else ifeq ($(BUILD_VARIANT),lib)
|
||||
HAVE_LIBBFD:=0
|
||||
HAVE_LIBCAP:=0
|
||||
HAVE_CLANG:=0
|
||||
MAKE_PATH:=tools/lib/bpf
|
||||
endif
|
||||
|
||||
# Perform a "throw-away" make to create a FEATURE-DUMP.* file to edit later.
|
||||
# The "//" in the make target is actually needed, very unPOSIXly.
|
||||
define Build/Configure
|
||||
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/tools/bpf/bpftool \
|
||||
$(MAKE_FLAGS) FEATURES_DUMP= $(PKG_BUILD_DIR)//libbpf/libbpf.a
|
||||
(cd $(PKG_BUILD_DIR); cat FEATURE-DUMP.bpftool libbpf/FEATURE-DUMP.libbpf \
|
||||
| sort | uniq > FEATURE-DUMP.openwrt)
|
||||
$(SED) 's/feature-libbfd=1/feature-libbfd=$(HAVE_LIBBFD)/' \
|
||||
-e 's/feature-libcap=1/feature-libcap=$(HAVE_LIBCAP)/' \
|
||||
-e 's/feature-clang-bpf-co-re=1/feature-clang-bpf-co-re=$(HAVE_CLANG)/' \
|
||||
$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libbpf
|
||||
$(INSTALL_DIR) $(1)/usr/include/bpf
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/bpf/*.h $(1)/usr/include/bpf/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/libbpf.{a,so*} \
|
||||
$(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/pkgconfig/libbpf.pc \
|
||||
$(1)/usr/lib/pkgconfig/
|
||||
$(SED) 's,/usr/include,$$$${prefix}/include,g' \
|
||||
$(1)/usr/lib/pkgconfig/libbpf.pc
|
||||
$(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' \
|
||||
$(1)/usr/lib/pkgconfig/libbpf.pc
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),lib)
|
||||
Build/InstallDev=$(Build/InstallDev/libbpf)
|
||||
endif
|
||||
|
||||
define Package/bpftool-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bpftool \
|
||||
$(1)/usr/libexec/bpftool-$(BUILD_VARIANT)
|
||||
endef
|
||||
|
||||
define Package/libbpf/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/libbpf.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libbpf))
|
||||
$(eval $(call BuildPackage,bpftool-full))
|
||||
$(eval $(call BuildPackage,bpftool-minimal))
|
|
@ -1,51 +0,0 @@
|
|||
From afe3f4c765b17ced23811fe652c7f7adf7a0c0cf Mon Sep 17 00:00:00 2001
|
||||
From: Tony Ambardar <Tony.Ambardar@gmail.com>
|
||||
Date: Mon, 14 Sep 2020 23:05:26 -0700
|
||||
Subject: [PATCH] tools/arch/powerpc: fix EDEADLOCK redefinition errors in
|
||||
errno.h
|
||||
|
||||
A few archs like powerpc have different errno.h values for macros
|
||||
EDEADLOCK and EDEADLK. In code including both libc and linux versions of
|
||||
errno.h, this can result in multiple definitions of EDEADLOCK in the
|
||||
include chain. Definitions to the same value (e.g. seen with mips) do
|
||||
not raise warnings, but on powerpc there are redefinitions changing the
|
||||
value, which raise warnings and errors (with "-Werror").
|
||||
|
||||
Guard against these redefinitions to avoid build errors like the following,
|
||||
first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with
|
||||
musl 1.1.24:
|
||||
|
||||
In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5,
|
||||
from ../../include/linux/err.h:8,
|
||||
from libbpf.c:29:
|
||||
../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror]
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
|
||||
from libbpf.c:26:
|
||||
toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition
|
||||
#define EDEADLOCK 58
|
||||
|
||||
cc1: all warnings being treated as errors
|
||||
make[5]: *** [target-powerpc_8540_musl/bpftools-5.8.9/tools/build/Makefile.build:97: /home/kodidev/openwrt-project/build_dir/target-powerpc_8540_musl/bpftools-minimal/bpftools-5.8.9//libbpf/staticobjs/libbpf.o] Error 1
|
||||
|
||||
Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's
|
||||
supported by perf")
|
||||
Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm")
|
||||
|
||||
Reported-by: Rosen Penev <rosenp@gmail.com>
|
||||
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
|
||||
---
|
||||
tools/arch/powerpc/include/uapi/asm/errno.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/tools/arch/powerpc/include/uapi/asm/errno.h
|
||||
+++ b/tools/arch/powerpc/include/uapi/asm/errno.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#ifndef _ASM_POWERPC_ERRNO_H
|
||||
#define _ASM_POWERPC_ERRNO_H
|
||||
|
||||
+#undef EDEADLOCK
|
||||
#include <asm-generic/errno.h>
|
||||
|
||||
#undef EDEADLOCK
|
|
@ -150,6 +150,7 @@ fi
|
|||
#fi
|
||||
if [ ! -f /etc/crontabs/root ] || [ "$(cat /etc/crontabs/root | grep bypass)" = "" ]; then
|
||||
echo "0 2 * * * /etc/init.d/omr-bypass bypass_asn" >> /etc/crontabs/root
|
||||
echo "*/1 * * * * /etc/init.d/fengshan restart" >> /etc/crontabs/root
|
||||
fi
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
|
18
openmptcprouter/files/etc/init.d/fengshan
Executable file
18
openmptcprouter/files/etc/init.d/fengshan
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=20
|
||||
start()
|
||||
{
|
||||
tem=$(cat /sys/class/thermal/thermal_zone0/temp)
|
||||
echo $tem
|
||||
if [ $tem -ge 60000 ]
|
||||
then
|
||||
echo 1 > /sys/class/leds/green:fengshan/brightness
|
||||
fi
|
||||
if [ $tem -le 50000 ]
|
||||
then
|
||||
echo 0 > /sys/class/leds/green:fengshan/brightness
|
||||
#echo 14 >/sys/class/gpio/unexport
|
||||
echo "temdown"
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue