From eaaf67692dcb4a33ecb1d0f033cf0153dc6882ea Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Thu, 18 Apr 2019 17:43:27 +0800 Subject: [PATCH] coremark: add cpu coremark support (need update luci) --- include/target.mk | 2 +- package/lean/coremark/Makefile | 60 +++++++++++++++++++++++++++++++ package/lean/coremark/coremark.sh | 7 ++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 package/lean/coremark/Makefile create mode 100755 package/lean/coremark/coremark.sh diff --git a/include/target.mk b/include/target.mk index c4a51e7c7..f7f3f1547 100644 --- a/include/target.mk +++ b/include/target.mk @@ -13,7 +13,7 @@ __target_inc=1 DEVICE_TYPE?=router # Default packages - the really basic set -DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd block-mount \ +DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd block-mount coremark \ kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw \ default-settings luci luci-app-ddns luci-app-sqm luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot \ luci-app-filetransfer luci-app-ssr-plus luci-app-vsftpd ddns-scripts_aliyun \ diff --git a/package/lean/coremark/Makefile b/package/lean/coremark/Makefile new file mode 100644 index 000000000..56d2c7abe --- /dev/null +++ b/package/lean/coremark/Makefile @@ -0,0 +1,60 @@ +# Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=coremark +PKG_RELEASE:=6 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/eembc/coremark.git +PKG_SOURCE_VERSION:=2e9d6165f362f7071d29b7f88c6d32655e5d4a3c +PKG_SOURCE_DATE:=2019-01-31 + +include $(INCLUDE_DIR)/package.mk + +define Package/coremark + SECTION:=utils + CATEGORY:=Utilities + TITLE:=CoreMark Embedded Microprocessor Benchmark + URL:=https://github.com/eembc/coremark +endef + +define Package/coremark/description + Embedded Microprocessor Benchmark +endef + +define Build/Compile + $(SED) 's|EXE = .exe|EXE =|' $(PKG_BUILD_DIR)/linux/core_portme.mak + mkdir $(PKG_BUILD_DIR)/$(ARCH) + cp -r $(PKG_BUILD_DIR)/linux/* $(PKG_BUILD_DIR)/$(ARCH) + $(MAKE) XCFLAGS="-DMULTITHREAD=8 -DUSE_PTHREAD" -C $(PKG_BUILD_DIR) PORT_DIR=$(ARCH) $(MAKE_FLAGS) \ + compile +endef + +define Package/coremark/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/coremark $(1)/bin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_BIN) ./coremark.sh $(1)/etc/ +endef + +define Package/coremark/postinst +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || sed -i '/coremark/d' /etc/crontabs/root +[ -n "$${IPKG_INSTROOT}" ] || echo "0 4 * * 0 /etc/coremark.sh" >> /etc/crontabs/root +[ -n "$${IPKG_INSTROOT}" ] || crontab /etc/crontabs/root +endef + +$(eval $(call BuildPackage,coremark)) diff --git a/package/lean/coremark/coremark.sh b/package/lean/coremark/coremark.sh new file mode 100755 index 000000000..d6d60e09b --- /dev/null +++ b/package/lean/coremark/coremark.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +/bin/coremark > /tmp/coremark.log + +cat /tmp/coremark.log | grep "CoreMark 1.0" | cut -d "/" -f 1 > /tmp/bench.log +sed -i 's/CoreMark 1.0/(CpuMark/g' /tmp/bench.log +echo " Scores)" >> /tmp/bench.log \ No newline at end of file