[patchteam] add msr-tools package - Singed off by Philip Prindeville <philipp_subx@redfish-solutions.com>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@29618 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
dingo 2011-12-29 20:10:31 +00:00
parent d792892871
commit d9cf151ef7
2 changed files with 82 additions and 0 deletions

54
utils/msr-tools/Makefile Normal file
View File

@ -0,0 +1,54 @@
#
# Copyright (C) 2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=msr-tools
PKG_VERSION:=1.1.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/utils/cpu/msr-tools
PKG_MD5SUM:=2452d2233556aa0fb8b53208361a2c94
include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS += -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
define Package/msr-tools
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=
TITLE:=x86 MSR utilities.
URL:=http://www.kernel.org/pub/linux/utils/cpu/msr-tools
SUBMENU:=CPU tools
endef
define Package/msr-tools/description
Manipulate the MSR (machine state registers) on i386 and x86_64
processors.
endef
define Build/Configure
endef
define Build/Compile
$(INSTALL_DIR) "$(PKG_INSTALL_DIR)/usr/sbin"
$(MAKE) -C $(PKG_BUILD_DIR) all \
$(TARGET_CONFIGURE_OPTS) \
sbindir="$(PKG_INSTALL_DIR)/usr/sbin" \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="" \
install
endef
define Package/msr-tools/install
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,msr-tools))

View File

@ -0,0 +1,28 @@
--- msr-tools-1.1.2/wrmsr.c.orig 2004-07-20 09:54:59.000000000 -0600
+++ msr-tools-1.1.2/wrmsr.c 2011-12-27 14:07:24.505887313 -0700
@@ -90,7 +90,11 @@ int main(int argc, char *argv[])
reg = strtoul(argv[optind++], NULL, 0);
+#ifdef SMP
sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
+#else
+ sprintf(msr_file_name, "/dev/msr%d", cpu);
+#endif
fd = open(msr_file_name, O_WRONLY);
if ( fd < 0 ) {
if ( errno == ENXIO ) {
--- msr-tools-1.1.2/rdmsr.c.orig 2004-07-20 09:54:59.000000000 -0600
+++ msr-tools-1.1.2/rdmsr.c 2011-12-27 14:06:37.831584784 -0700
@@ -167,7 +167,11 @@ int main(int argc, char *argv[])
reg = strtoul(argv[optind], NULL, 0);
+#ifdef SMP
sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
+#else
+ sprintf(msr_file_name, "/dev/msr%d", cpu);
+#endif
fd = open(msr_file_name, O_RDONLY);
if ( fd < 0 ) {
if ( errno == ENXIO ) {