summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-08-01 11:19:06 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-08-01 11:19:06 +0200
commitc23016096ab5f8bae409006306e6652e04da030a (patch)
tree255c96d4ea8bd891508720bd98b3b40a4b787459 /util
parentc7d4db3862a24474655a43c98572e82503d9fa6b (diff)
parentf3bbd65d98b943e7224be2c1ff242fcf04386701 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'util')
-rw-r--r--util/Makefile.am111
-rw-r--r--util/Makefile.in111
-rw-r--r--util/ievents.c2
-rw-r--r--util/ifru.c45
-rw-r--r--util/ifruset.c37
-rw-r--r--util/ipmicmd.c9
-rw-r--r--util/ipmilan.h3
-rw-r--r--util/ipmiutil.c2
-rw-r--r--util/isel.c2
-rw-r--r--util/isensor.c5
10 files changed, 205 insertions, 122 deletions
diff --git a/util/Makefile.am b/util/Makefile.am
index f8f0bab..e37e0ef 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -1,11 +1,11 @@
localedir = $(datadir)/locale
-INCLUDES = -I..
OS_CF = @OS_CFLAGS@ @CROSS_CFLAGS@
OS_LF = @OS_LFLAGS@ @CROSS_LFLAGS@
-AM_CPPFLAGS = $(OS_CF) -DLOCALEDIR=\"$(localedir)\"
+AM_CPPFLAGS = $(OS_CF) -DLOCALEDIR=\"$(localedir)\" -I..
AM_CPPFLAGS += @IA64_CFLAGS@ @GPL_CFLAGS@
LDADD = $(OS_LF)
+# usu LD_SAMX = ../lib/libipmi_lanplus.a -lcrypto
LDSAM = $(OS_LF) @LD_SAMX@
CFLAGS_SAMX = -O2 -g -I. -I.. $(OS_CF) @LANPLUS_CFLAGS@
CFLAGS_SAM = -O2 -g -I. -I.. $(OS_CF)
@@ -22,10 +22,15 @@ CMDMOD += md5.c md2.c ipmilan.c
CMDMOD += ipmilanplus.c
# CMDMOD = ipmicmd.c mem_if.c @OS_DRIVERS@
# am: configure substitutions are not allowed in _SOURCES variables
-LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o @LIBSENSORS@
+TMPOBJL = $(tmpobj)/ipmilanL.o $(tmpobj)/ipmilanplusL.o
+TMPOBJA = $(tmpobj)/ipmilanA.o $(tmpobj)/ipmilanplusA.o
+LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o @LIBSENSORS@
OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c oem_lenovo.c oem_asus.c iekanalyzer.c
+# usu SAM2OBJ = isensor2.o ievents2.o
L2OBJ = @SAM2OBJ@
+# To build ipmiutil, need to use METACFLAGS for each .c/.o
+
AM_CPPFLAGS += -I. -I.. -DMETACOMMAND
METASOURCE = ipmiutil.c ialarms.c ihealth.c ievents.c ifru.c ifru_picmg.c igetevent.c ireset.c icmd.c ilan.c isensor.c isel.c iserial.c iwdt.c isol.c idiscover.c iconfig.c ipicmg.c ifirewall.c ifwum.c ihpm.c itsol.c idcmi.c iuser.c $(OEMMOD) $(CMDMOD)
LDADD += -lpthread
@@ -77,60 +82,55 @@ libimbapi.a: imbapi.c
$(RANLIB) libimbapi.a
rm -f $(tmpobj)/imbapi.o
+$(tmpobj)/ipmilanplusL.o: ipmilanplus.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplusL.o -c ipmilanplus.c;
+
+$(tmpobj)/ipmilanL.o: ipmilan.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanL.o -c ipmilan.c;
+
+$(tmpobj)/ipmilanplusA.o: ipmilanplus.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplusA.o -c ipmilanplus.c;
+
+$(tmpobj)/ipmilanA.o: ipmilan.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanA.o -c ipmilan.c;
+
# Build a lib to support all of the IPMI drivers (libipmiutil.a)
# If LANPLUS_SAM = yes, include LANPLUS_OBJ, else do not.
# See configure --enable-liblanplus to change this
-$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@
- mkdir -p $(tmpobj)
+$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ $(TMPOBJL) $(TMPOBJA)
if [ "x@LANPLUS_SAM@" = "xyes" ]; then \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
ar x @LANPLUS_LIB@ ; \
- $(AR) cru $(DEV_LIB) $(LIBOBJ) $(LANPLUS_OBJ); \
+ $(AR) cru $(DEV_LIB) $(LIBOBJ) $(TMPOBJL) $(LANPLUS_OBJ); \
$(RANLIB) $(DEV_LIB); \
else \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
- $(AR) cru $(DEV_LIB) $(LIBOBJ) ; \
+ $(AR) cru $(DEV_LIB) $(LIBOBJ) $(TMPOBJA) ; \
$(RANLIB) $(DEV_LIB) ; \
fi
-$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@
- mkdir -p $(tmpobj)
+$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ $(TMPOBJL) $(TMPOBJA)
if [ "x@LANPLUS_SAM@" = "xyes" ]; then \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
ar x @LANPLUS_LIB@ ; \
- $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) $(LANPLUS_OBJ); \
+ $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) $(TMPOBJL) $(LANPLUS_OBJ); \
else \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
- $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) ; \
+ $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) $(TMPOBJA) ; \
fi
$(SHR_BLIB): $(SHR_LIB)
ln -s $(SHR_LIB) $(SHR_BLIB)
-# To build ipmiutil, need to use METACFLAGS for each .c/.o
-
idiscover$(EXEEXT): idiscover.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) $(OS_LF) -o idiscover idiscover.c
-ipmimv: ipmimv.c
+ipmimv$(EXEEXT): ipmimv.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) -DTEST_BIN -o ipmimv ipmimv.c
ievents$(EXEEXT): ievents.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) -DALONE -o ievents ievents.c
-ipmi_sample: $(DEV_LIB) ipmi_sample.c isensor.c ievents.c
- $(CC) $(CFLAGS_SAM) -c ipmi_sample.c
- $(CC) -g -O2 -o ipmi_sample ipmi_sample.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-
-ialarms_enc: $(DEV_LIB) ialarms.c oem_intel.c
- $(CC) $(CFLAGS_SAM) -DTEST_ENC -o ialarms2.o -c ialarms.c
- $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c
- $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-
isensor2.o: isensor.c
$(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c
@@ -140,32 +140,59 @@ ievents2.o: ievents.c
ifru_picmg2.o: ifru_picmg.c
$(CC) $(CFLAGS_SAM) -o ifru_picmg2.o -c ifru_picmg.c
-# To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o
-# Note that this does not include oem_intel, etc. for OEM SEL decoding.
-ipmi_sample2: $(DEV_LIB) ipmi_sample.c ifru.c isel.c ifru_picmg2.o $(L2OBJ)
- $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c
+ifru2.o: ifru.c
$(CC) $(CFLAGS_SAM) -o ifru2.o -c ifru.c
+
+isel2.o: isel.c
$(CC) $(CFLAGS_SAM) -o isel2.o -c isel.c
- $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o $(L2OBJ) ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c $(L2OBJ)
+ipmi_sample.o: ipmi_sample.c
+ $(CC) $(CFLAGS_SAM) -c ipmi_sample.c
+
+ipmi_sample2.o: ipmi_sample.c
+ $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c
+
+ipmi_sample_evt.o: ipmi_sample_evt.c
$(CC) $(CFLAGS_SAM) -o ipmi_sample_evt.o -c ipmi_sample_evt.c
+
+ipmi_sample$(EXEEXT): $(DEV_LIB) ipmi_sample.o isensor.o ievents.o
+ $(CC) -g -O2 -o ipmi_sample ipmi_sample.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
+
+# To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o
+# Note that this does not include oem_intel, etc. for OEM SEL decoding.
+ipmi_sample2$(EXEEXT): $(DEV_LIB) ipmi_sample2.o ifru2.o isel2.o ifru_picmg2.o $(L2OBJ)
+ $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o $(L2OBJ) ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
+
+ipmi_sample_evt$(EXEEXT): $(DEV_LIB) ipmi_sample_evt.o $(L2OBJ)
$(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o $(L2OBJ) $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-ifruset: $(DEV_LIB) ifruset.c ifru_picmg2.o
+ialarms2.o: ialarms.c
+ $(CC) $(CFLAGS_SAM) -DTEST_ENC -o ialarms2.o -c ialarms.c
+
+oem_intel2.o: oem_intel.c
+ $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c
+
+ialarms_enc$(EXEEXT): $(DEV_LIB) ialarms2.o oem_intel2.o
+ $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
+
+ifruset.o: ifruset.c
$(CC) $(CFLAGS_SAM) -c ifruset.c
+
+ifruset$(EXEEXT): $(DEV_LIB) ifruset.o ifru_picmg2.o
$(CC) -g -O2 -o ifruset ifruset.o ifru_picmg2.o $(DEV_LIB) $(LDFLAGS) $(LDADD)
-iseltime: $(DEV_LIB) iseltime.c
+iseltime.o: iseltime.c
$(CC) $(CFLAGS_SAM) -c iseltime.c
+
+iseltime$(EXEEXT): $(DEV_LIB) iseltime.o
$(CC) -g -O2 -o iseltime iseltime.o $(DEV_LIB) $(LDFLAGS) $(LDADD)
+iconfig$(EXEEXT): iconfig.c $(DEV_LIB)
+ $(CC) $(CFLAGS_SAM) $(LDFLAGS) -o iconfig iconfig.c $(DEV_LIB) @LANPLUS_CRYPTO@
+
ipmi_port$(EXEEXT): ipmi_port.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) -o ipmi_port ipmi_port.c
-iconfig: iconfig.c $(DEV_LIB)
- $(CC) $(CFLAGS_SAM) $(LDFLAGS) -o iconfig iconfig.c $(DEV_LIB) @LANPLUS_CRYPTO@
-
# @LANPLUS_LIB@ is ../lib/libipmi_lanplus.a
../lib/libipmi_lanplus.a:
cd ../lib; make
diff --git a/util/Makefile.in b/util/Makefile.in
index 08c6ba2..28cff49 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -253,10 +253,11 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -I..
OS_CF = @OS_CFLAGS@ @CROSS_CFLAGS@
OS_LF = @OS_LFLAGS@ @CROSS_LFLAGS@
+# To build ipmiutil, need to use METACFLAGS for each .c/.o
+
# The LanDesk library is proprietary, so it is incompatible with ALLOW_GPL.
# To build with LanDesk support:
# First copy the library to ../lib/libipmiapi.a
@@ -274,11 +275,12 @@ OS_LF = @OS_LFLAGS@ @CROSS_LFLAGS@
# LDADD += -L../lib -lipmi_lanplus -L/usr/local/lib -lcrypto
# LDADD += -L../lib -lintf_lanplus -L/usr/local/lib -lcrypto (older)
# Could also use CMDMOD += ipmilan2.c instead, if completed.
-AM_CPPFLAGS = $(OS_CF) -DLOCALEDIR=\"$(localedir)\" @IA64_CFLAGS@ \
+AM_CPPFLAGS = $(OS_CF) -DLOCALEDIR=\"$(localedir)\" -I.. @IA64_CFLAGS@ \
@GPL_CFLAGS@ -I. -I.. -DMETACOMMAND @LANDESK_CFLAGS@ \
@LANPLUS_CFLAGS@ $(am__empty)
LDADD = $(OS_LF) -lpthread @LANDESK_LDADD@ @LANPLUS_LIB@ \
@LANPLUS_CRYPTO@ $(am__empty)
+# usu LD_SAMX = ../lib/libipmi_lanplus.a -lcrypto
LDSAM = $(OS_LF) @LD_SAMX@
CFLAGS_SAMX = -O2 -g -I. -I.. $(OS_CF) @LANPLUS_CFLAGS@
CFLAGS_SAM = -O2 -g -I. -I.. $(OS_CF)
@@ -294,8 +296,11 @@ CMDMOD = ipmicmd.c mem_if.c ipmidir.c imbapi.c ipmimv.c ipmild.c \
ipmilanplus.c
# CMDMOD = ipmicmd.c mem_if.c @OS_DRIVERS@
# am: configure substitutions are not allowed in _SOURCES variables
-LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o @LIBSENSORS@
+TMPOBJL = $(tmpobj)/ipmilanL.o $(tmpobj)/ipmilanplusL.o
+TMPOBJA = $(tmpobj)/ipmilanA.o $(tmpobj)/ipmilanplusA.o
+LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o @LIBSENSORS@
OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c oem_lenovo.c oem_asus.c iekanalyzer.c
+# usu SAM2OBJ = isensor2.o ievents2.o
L2OBJ = @SAM2OBJ@
METASOURCE = ipmiutil.c ialarms.c ihealth.c ievents.c ifru.c ifru_picmg.c igetevent.c ireset.c icmd.c ilan.c isensor.c isel.c iserial.c iwdt.c isol.c idiscover.c iconfig.c ipicmg.c ifirewall.c ifwum.c ihpm.c itsol.c idcmi.c iuser.c $(OEMMOD) $(CMDMOD)
LANPLUS_OBJ = $(shell ar t @LANPLUS_LIB@ 2>/dev/null)
@@ -728,60 +733,55 @@ libimbapi.a: imbapi.c
$(RANLIB) libimbapi.a
rm -f $(tmpobj)/imbapi.o
+$(tmpobj)/ipmilanplusL.o: ipmilanplus.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplusL.o -c ipmilanplus.c;
+
+$(tmpobj)/ipmilanL.o: ipmilan.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanL.o -c ipmilan.c;
+
+$(tmpobj)/ipmilanplusA.o: ipmilanplus.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplusA.o -c ipmilanplus.c;
+
+$(tmpobj)/ipmilanA.o: ipmilan.c
+ mkdir -p $(tmpobj)
+ $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanA.o -c ipmilan.c;
+
# Build a lib to support all of the IPMI drivers (libipmiutil.a)
# If LANPLUS_SAM = yes, include LANPLUS_OBJ, else do not.
# See configure --enable-liblanplus to change this
-$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@
- mkdir -p $(tmpobj)
+$(DEV_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ $(TMPOBJL) $(TMPOBJA)
if [ "x@LANPLUS_SAM@" = "xyes" ]; then \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
ar x @LANPLUS_LIB@ ; \
- $(AR) cru $(DEV_LIB) $(LIBOBJ) $(LANPLUS_OBJ); \
+ $(AR) cru $(DEV_LIB) $(LIBOBJ) $(TMPOBJL) $(LANPLUS_OBJ); \
$(RANLIB) $(DEV_LIB); \
else \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
- $(AR) cru $(DEV_LIB) $(LIBOBJ) ; \
+ $(AR) cru $(DEV_LIB) $(LIBOBJ) $(TMPOBJA) ; \
$(RANLIB) $(DEV_LIB) ; \
fi
-$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@
- mkdir -p $(tmpobj)
+$(SHR_LIB): $(CMDMOD:.c=.o) @LANPLUS_LIB@ @LIBSENSORS@ $(TMPOBJL) $(TMPOBJA)
if [ "x@LANPLUS_SAM@" = "xyes" ]; then \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAMX) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
ar x @LANPLUS_LIB@ ; \
- $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) $(LANPLUS_OBJ); \
+ $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) $(TMPOBJL) $(LANPLUS_OBJ); \
else \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilanplus.o -c ipmilanplus.c; \
- $(CC) $(CFLAGS_SAM) -o $(tmpobj)/ipmilan.o -c ipmilan.c; \
- $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) ; \
+ $(CC) $(LDFLAGS) -shared $(LDNAME) -o $(SHR_LIB) $(LIBOBJ) $(TMPOBJA) ; \
fi
$(SHR_BLIB): $(SHR_LIB)
ln -s $(SHR_LIB) $(SHR_BLIB)
-# To build ipmiutil, need to use METACFLAGS for each .c/.o
-
idiscover$(EXEEXT): idiscover.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) $(OS_LF) -o idiscover idiscover.c
-ipmimv: ipmimv.c
+ipmimv$(EXEEXT): ipmimv.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) -DTEST_BIN -o ipmimv ipmimv.c
ievents$(EXEEXT): ievents.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) -DALONE -o ievents ievents.c
-ipmi_sample: $(DEV_LIB) ipmi_sample.c isensor.c ievents.c
- $(CC) $(CFLAGS_SAM) -c ipmi_sample.c
- $(CC) -g -O2 -o ipmi_sample ipmi_sample.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-
-ialarms_enc: $(DEV_LIB) ialarms.c oem_intel.c
- $(CC) $(CFLAGS_SAM) -DTEST_ENC -o ialarms2.o -c ialarms.c
- $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c
- $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-
isensor2.o: isensor.c
$(CC) $(CFLAGS_SAM) -o isensor2.o -c isensor.c
@@ -791,32 +791,59 @@ ievents2.o: ievents.c
ifru_picmg2.o: ifru_picmg.c
$(CC) $(CFLAGS_SAM) -o ifru_picmg2.o -c ifru_picmg.c
-# To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o
-# Note that this does not include oem_intel, etc. for OEM SEL decoding.
-ipmi_sample2: $(DEV_LIB) ipmi_sample.c ifru.c isel.c ifru_picmg2.o $(L2OBJ)
- $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c
+ifru2.o: ifru.c
$(CC) $(CFLAGS_SAM) -o ifru2.o -c ifru.c
+
+isel2.o: isel.c
$(CC) $(CFLAGS_SAM) -o isel2.o -c isel.c
- $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o $(L2OBJ) ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-ipmi_sample_evt: $(DEV_LIB) ipmi_sample_evt.c $(L2OBJ)
+ipmi_sample.o: ipmi_sample.c
+ $(CC) $(CFLAGS_SAM) -c ipmi_sample.c
+
+ipmi_sample2.o: ipmi_sample.c
+ $(CC) $(CFLAGS_SAM) -D GET_SENSORS -D GET_FRU -o ipmi_sample2.o -c ipmi_sample.c
+
+ipmi_sample_evt.o: ipmi_sample_evt.c
$(CC) $(CFLAGS_SAM) -o ipmi_sample_evt.o -c ipmi_sample_evt.c
+
+ipmi_sample$(EXEEXT): $(DEV_LIB) ipmi_sample.o isensor.o ievents.o
+ $(CC) -g -O2 -o ipmi_sample ipmi_sample.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
+
+# To build ipmi_sample with GET_SENSORS enabled, need isensors.o, ievents.o
+# Note that this does not include oem_intel, etc. for OEM SEL decoding.
+ipmi_sample2$(EXEEXT): $(DEV_LIB) ipmi_sample2.o ifru2.o isel2.o ifru_picmg2.o $(L2OBJ)
+ $(CC) -g -O2 -o ipmi_sample2 ipmi_sample2.o $(L2OBJ) ifru2.o ifru_picmg2.o isel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
+
+ipmi_sample_evt$(EXEEXT): $(DEV_LIB) ipmi_sample_evt.o $(L2OBJ)
$(CC) -g -O2 -o ipmi_sample_evt ipmi_sample_evt.o $(L2OBJ) $(DEV_LIB) $(LDFLAGS) $(LDSAM)
-ifruset: $(DEV_LIB) ifruset.c ifru_picmg2.o
+ialarms2.o: ialarms.c
+ $(CC) $(CFLAGS_SAM) -DTEST_ENC -o ialarms2.o -c ialarms.c
+
+oem_intel2.o: oem_intel.c
+ $(CC) $(CFLAGS_SAM) -DNO_EVENTS -o oem_intel2.o -c oem_intel.c
+
+ialarms_enc$(EXEEXT): $(DEV_LIB) ialarms2.o oem_intel2.o
+ $(CC) -g -O2 -o ialarms_enc ialarms2.o oem_intel2.o $(DEV_LIB) $(LDFLAGS) $(LDSAM)
+
+ifruset.o: ifruset.c
$(CC) $(CFLAGS_SAM) -c ifruset.c
+
+ifruset$(EXEEXT): $(DEV_LIB) ifruset.o ifru_picmg2.o
$(CC) -g -O2 -o ifruset ifruset.o ifru_picmg2.o $(DEV_LIB) $(LDFLAGS) $(LDADD)
-iseltime: $(DEV_LIB) iseltime.c
+iseltime.o: iseltime.c
$(CC) $(CFLAGS_SAM) -c iseltime.c
+
+iseltime$(EXEEXT): $(DEV_LIB) iseltime.o
$(CC) -g -O2 -o iseltime iseltime.o $(DEV_LIB) $(LDFLAGS) $(LDADD)
+iconfig$(EXEEXT): iconfig.c $(DEV_LIB)
+ $(CC) $(CFLAGS_SAM) $(LDFLAGS) -o iconfig iconfig.c $(DEV_LIB) @LANPLUS_CRYPTO@
+
ipmi_port$(EXEEXT): ipmi_port.c
$(CC) $(CFLAGS_SAM) $(LDFLAGS) -o ipmi_port ipmi_port.c
-iconfig: iconfig.c $(DEV_LIB)
- $(CC) $(CFLAGS_SAM) $(LDFLAGS) -o iconfig iconfig.c $(DEV_LIB) @LANPLUS_CRYPTO@
-
# @LANPLUS_LIB@ is ../lib/libipmi_lanplus.a
../lib/libipmi_lanplus.a:
cd ../lib; make
diff --git a/util/ievents.c b/util/ievents.c
index bb3a81f..3958138 100644
--- a/util/ievents.c
+++ b/util/ievents.c
@@ -80,7 +80,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern char *progver; /*from ipmiutil.c*/
static char * progname = "ipmiutil events";
#else
-static char *progver = "3.11";
+static char *progver = "3.12";
static char *progname = "ievents";
#endif
static char fsensdesc = 0; /* 1= get extended sensor descriptions*/
diff --git a/util/ifru.c b/util/ifru.c
index 86e47bf..9b51aad 100644
--- a/util/ifru.c
+++ b/util/ifru.c
@@ -847,30 +847,31 @@ show_fru(uchar sa, uchar frudev, uchar frutype, uchar *pfrubuf)
pfru0 = &pfrubuf[0]; /*pointer to fru start*/
pfru = &pfrubuf[0];
sz = 8; /*minimum for common header*/
- for (i = 1; i < 6; i++) /* walk thru offsets */
- if (pfrubuf[i] != 0) sz = pfrubuf[i] * 8;
+ for (i = 1; i < 6; i++) { /* walk thru offsets */
+ if (pfrubuf[i] != 0) sz = pfrubuf[i] * 8;
+ }
if (sz > 8) { /* if have at least one section */
- if (pfrubuf[5] != 0) j = 5 + pfrubuf[sz+2]; /*if multi-record area*/
- else j = pfrubuf[sz+1] * 8; /* else add length of last section */
- sz += j;
+ if (pfrubuf[5] != 0) j = 5 + pfrubuf[sz+2]; /*if multi-record area*/
+ else j = pfrubuf[sz+1] * 8; /* else add length of last section */
+ sz += j;
}
/* Now, sz = size used, sfru = total available size */
if (sz > sfru) {
if (fdebug) {
- uchar hsum;
+ uchar hsum;
printf("FRU Header: ");
for (i = 0; i < 8; i++) printf("%02x ",pfrubuf[i]);
printf("\n");
hsum = calc_cksum(&pfrubuf[0],7);
- if (pfrubuf[7] != hsum)
+ if (pfrubuf[7] != hsum)
printf("FRU Header checksum mismatch (%x != %x)\n",pfrubuf[7],hsum);
}
printf("FRU size used=%d > available=%d\n",sz,sfru);
if (fpicmg || fdoanyway) sz = sfru; /*do it anyway*/
else {
printf("Please apply the correct FRU/SDR diskette\n");
- return(ERR_OTHER);
+ return(ERR_OTHER);
}
}
/* internal area offset, length */
@@ -890,10 +891,11 @@ show_fru(uchar sa, uchar frudev, uchar frutype, uchar *pfrubuf)
mlen = 0;
if (moff > 0) {
for (i = moff; i < sfru; ) {
+ if (pfrubuf[i] == 0 && pfrubuf[i+2] == 0) break; /*type/len invalid*/
j = 5 + pfrubuf[i+2];
- mlen += j;
+ mlen += j;
if (pfrubuf[i+1] & 0x80) break;
- i += j;
+ i += j;
}
}
@@ -1057,8 +1059,9 @@ show_fru(uchar sa, uchar frudev, uchar frutype, uchar *pfrubuf)
j = moff;
for (i = 0; j < sz ; i++)
{
+ if (pfru[0] == 0 && pfru[2] == 0) break; /*type/len invalid*/
n = pfru[2]; /* len of this record */
- show_fru_multi(devstr,i,pfru[0],&pfru[5],n);
+ show_fru_multi(devstr,i,pfru[0],&pfru[5],n);
j += (5 + n);
if (pfru[1] & 0x80) j = sz; /*0x80 = last in list, break*/
pfru += (5 + n);
@@ -1770,7 +1773,7 @@ int i_fru(int argc, char **argv)
parse_lan_options(c,optarg,fdebug);
break;
default:
- printf("Usage: %s [-bceikmtvx -a asset_tag -s ser_num -NUPREFTVY]\n",
+ printf("Usage: %s [-bceikmtvx -a asset_tag -s ser_num -NUPREFTVYZ]\n",
progname);
printf(" -a tag Sets the Product Asset Tag\n");
printf(" -b Only show Baseboard FRU data\n");
@@ -2030,7 +2033,11 @@ int i_fru(int argc, char **argv)
if (fdump && ret == 0) {
/* Dump FRU to a binary file */
+#ifdef WIN32
+ fp = fopen(binfile,"wb");
+#else
fp = fopen(binfile,"w");
+#endif
if (fp == NULL) {
ret = get_LastError();
printf("Cannot open file %s, error %d\n",binfile,ret);
@@ -2048,9 +2055,13 @@ int i_fru(int argc, char **argv)
else if (frestore) {
uchar cksum;
/* Restore FRU from a binary file */
+#ifdef WIN32
+ fp = fopen(binfile,"rb");
+#else
fp = fopen(binfile,"r");
+#endif
if (fp == NULL) {
- ret = get_LastError();
+ ret = get_LastError();
printf("Cannot open file %s, error %d\n",binfile,ret);
} else {
ret = 0;
@@ -2077,10 +2088,10 @@ int i_fru(int argc, char **argv)
free_fru(frubuf);
}
if (ret == 0) { /*successfully read data*/
- printf("Writing FRU size %d from %s ...\n",sfru,binfile);
- ret = write_fru_data(g_fruid, 0, frubuf, sfru, fdebug);
- free_fru(frubuf);
- if (ret != 0) printf("write_fru error %d (0x%02x)\n",ret,ret);
+ printf("Writing FRU size %d from %s ...\n",sfru,binfile);
+ ret = write_fru_data(g_fruid, 0, frubuf, sfru, fdebug);
+ free_fru(frubuf);
+ if (ret != 0) printf("write_fru error %d (0x%02x)\n",ret,ret);
else { /* successful, show new data */
ret = load_fru(sa,g_fruid,g_frutype,&pfru);
if (ret != 0) show_loadfru_error(sa,g_fruid,ret);
diff --git a/util/ifruset.c b/util/ifruset.c
index b2f8b66..2d7617b 100644
--- a/util/ifruset.c
+++ b/util/ifruset.c
@@ -109,7 +109,7 @@ extern void fmt_time(time_t etime, char *buf, int bufsz); /*see ievents.c*/
extern char * progver; /*from ipmiutil.c*/
static char *progname = "ipmiutil fruset";
#else
-static char * progver = "3.08";
+static char * progver = "3.12";
static char *progname = "ifruset";
#endif
static char fdebug = 0;
@@ -711,10 +711,14 @@ show_fru(uchar sa, uchar frudev, uchar frutype)
*/
pfru = &frubuf[0];
sz = 8; /*minimum for common header*/
- for (i = 1; i < 6; i++) /* walk thru offsets */
- if (frubuf[i] != 0) sz = frubuf[i] * 8;
- if (sz > 8) /* if have at least one section */
- sz += frubuf[sz+1] * 8; /* add length of last section */
+ for (i = 1; i < 6; i++) { /* walk thru offsets */
+ if (frubuf[i] != 0) sz = frubuf[i] * 8;
+ }
+ if (sz > 8) { /* if have at least one section */
+ if (frubuf[5] != 0) j = 5 + frubuf[sz+2]; /*if multi-record area*/
+ else j = frubuf[sz+1] * 8; /* else add length of last section */
+ sz += j;
+ }
/* Now, sz = size used, sfru = total available size */
if (sz > sfru) {
if (fdebug) {
@@ -752,10 +756,11 @@ show_fru(uchar sa, uchar frudev, uchar frutype)
mlen = 0;
if (moff > 0) {
for (i = moff; i < sfru; ) {
- j = 5 + frubuf[i+2];
+ if (frubuf[i] == 0 && frubuf[i+2] == 0) break; /*type/len invalid*/
+ j = 5 + frubuf[i+2];
mlen += j;
if (frubuf[i+1] & 0x80) break;
- i += j;
+ i += j;
}
}
@@ -897,8 +902,9 @@ show_fru(uchar sa, uchar frudev, uchar frutype)
j = moff;
for (i = 0; j < sz; i++)
{
+ if (pfru[0] == 0 && pfru[2] == 0) break; /*type/len invalid*/
n = pfru[2]; /* len of this record */
- show_fru_multi(devstr,i,pfru[0],&pfru[5],n);
+ show_fru_multi(devstr,i,pfru[0],&pfru[5],n);
j += (5 + n);
if (pfru[1] & 0x80) j = sz; /*0x80 = end of list*/
pfru += (5 + n);
@@ -1367,7 +1373,7 @@ main(int argc, char **argv)
parse_lan_options(c,optarg,fdebug);
break;
default:
- printf("Usage: %s [-bcimx -unpvsafo -NUPREFTVY]\n",progname);
+ printf("Usage: %s [-bcimxy -unpvsafo -NUPREFTVY]\n",progname);
printf(" -u manu Sets Product Manufacturer (0)\n");
printf(" -n name Sets Product Name (1)\n");
printf(" -p part Sets Product Part Number (2)\n");
@@ -1382,8 +1388,9 @@ main(int argc, char **argv)
printf(" -d Dump FRU to a file\n");
printf(" -r Restore FRU from a file\n");
printf(" -i 00 Get/Set a specific FRU ID\n");
- printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n");
+ printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n");
printf(" -x Display extra debug messages\n");
+ printf(" -y Ignore the check for FRU size overflow\n");
print_lan_opt_usage(0);
ret = ERR_USAGE;
goto do_exit;
@@ -1567,7 +1574,11 @@ main(int argc, char **argv)
if (fdump && ret == 0) {
/* Dump FRU to a binary file */
+#ifdef WIN32
+ fp = fopen(binfile,"wb");
+#else
fp = fopen(binfile,"w");
+#endif
if (fp == NULL) {
ret = get_LastError();
printf("Cannot open file %s, error %d\n",binfile,ret);
@@ -1583,9 +1594,13 @@ main(int argc, char **argv)
} else if (frestore) {
uchar cksum;
/* Restore FRU from a binary file */
+#ifdef WIN32
+ fp = fopen(binfile,"rb");
+#else
fp = fopen(binfile,"r");
+#endif
if (fp == NULL) {
- ret = get_LastError();
+ ret = get_LastError();
printf("Cannot open file %s, error %d\n",binfile,ret);
} else {
ret = 0;
diff --git a/util/ipmicmd.c b/util/ipmicmd.c
index b7c8a5f..f8ce1ba 100644
--- a/util/ipmicmd.c
+++ b/util/ipmicmd.c
@@ -90,6 +90,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#include "ipmicmd.h" /* has NCMDS, ipmi_cmd_t */
+#include "ipmilan2.h" /*includes ipmilan.h also*/
ipmi_cmd_t ipmi_cmds[NCMDS] = { /*if add here, also change NCMDS in ipmicmd.h*/
{/*empty,temp*/ 0, BMC_SA, PUBLIC_BUS, NETFN_APP, BMC_LUN, 0, 20},
@@ -164,7 +165,6 @@ int ipmi_cmdraw_efi( uchar cmd, uchar netfn, uchar lun, uchar sa,
uchar *presp, int *sresp, uchar *pcc, char fdebugcmd);
#else
-#include "ipmilan2.h" /*includes ipmilan.h also*/
#ifdef WIN32
extern int ipmi_cmdraw_ia( uchar cmd, uchar netfn, uchar lun, uchar sa,
uchar bus, uchar *pdata, int sdata,
@@ -1453,13 +1453,12 @@ char *get_nodename(void)
return(gnode);
}
-extern int lasterr; /*defined in ipmilan.c */
-extern void show_LastError(char *tag, int err);
-
void show_outcome(char *prog, int ret)
{
+ int err = 0;
if (prog == NULL) prog = "";
- if (ret == -1 && lasterr != 0) show_LastError(prog,lasterr);
+ err = get_LastError();
+ if (ret == -1 && err != 0) show_LastError(prog,err);
printf("%s%c %s\n",prog,bcomma,decode_rv(ret));
}
diff --git a/util/ipmilan.h b/util/ipmilan.h
index 9a47efe..b25a55e 100644
--- a/util/ipmilan.h
+++ b/util/ipmilan.h
@@ -65,6 +65,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* see ipmicmd.h for LAN_ERR definitions */
+int get_LastError( void );
+void show_LastError(char *tag, int err);
+void ipmi_lan_set_timeout(int ipmito, int tries, int pingto);
int ipmi_open_lan(char *node, int port, char *user, char *pswd, int fdebugcmd);
int ipmi_close_lan(char *node);
int ipmi_flush_lan(char *node);
diff --git a/util/ipmiutil.c b/util/ipmiutil.c
index eea67d0..20ce7c3 100644
--- a/util/ipmiutil.c
+++ b/util/ipmiutil.c
@@ -57,7 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ipmiutil.h"
static char *progname = "ipmiutil";
-char *progver = "3.11";
+char *progver = "3.12";
// static char fdebug = 0;
/*int ipmiutil(int argc, char **argv); */
diff --git a/util/isel.c b/util/isel.c
index 63a1d42..22e417c 100644
--- a/util/isel.c
+++ b/util/isel.c
@@ -719,7 +719,7 @@ int i_sel(int argc, char **argv)
parse_lan_options(c,optarg,fdebug);
break;
default:
- printf("Usage: %s [-bcdefmnprsuvwx] [-l 5] [-NUPREFTVY]\n",
+ printf("Usage: %s [-bcdefmnprsuvwx] [-l 5] [-NUPREFTVYZ]\n",
progname);
printf(" -b interpret Binary file with raw SEL data\n");
printf(" -c Show canonical output with delimiters\n");
diff --git a/util/isensor.c b/util/isensor.c
index f140cdc..8bb2935 100644
--- a/util/isensor.c
+++ b/util/isensor.c
@@ -145,7 +145,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define N_SGRP 16
#define THR_EMPTY 999
-extern int get_LastError( void ); /* ipmilan.c */
+/* prototypes */
+int get_LastError( void ); /* ipmilan.c */
extern int use_devsdrs(int picmg); /* ipmicmd.c */
extern int get_MemDesc(int array, int dimm, char *desc, int *psz); /*mem_if.c*/
extern char *get_sensor_type_desc(uchar stype); /*ievents.c*/
@@ -3405,7 +3406,7 @@ int i_sensor(int argc, char **argv)
parse_lan_options(c,optarg,fdebug);
break;
default: /*usage*/
- printf("Usage: %s [-abcdefghijlmnprstuvwxL -NUPREFTVY]\n",progname);
+ printf("Usage: %s [-abcdefghijlmnprstuvwxL -NUPREFTVYZ]\n",progname);
printf("where -x shows eXtra debug messages\n");
printf(" -a snum reArms the sensor (snum) for events\n");
printf(" -b show Bladed child MCs for PICMG (same as -e)\n");