Code Monkey home page Code Monkey logo

dmidecode-osx's Introduction

** INTRODUCTION **

Dmidecode reports information about your system's hardware as described in
your system BIOS according to the SMBIOS/DMI standard. This information
typically includes system manufacturer, model name, serial number, BIOS
version, asset tag as well as a lot of other details of varying level of
interest and reliability depending on the manufacturer. This will often
include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI,
ISA) and memory module slots, and the list of I/O ports (e.g. serial,
parallel, USB).

DMI data can be used to enable or disable specific portions of kernel code
depending on the specific hardware. Thus, one use of dmidecode is for kernel
developers to detect system "signatures" and add them to the kernel source
code when needed.

Beware that DMI data have proven to be too unreliable to be blindly trusted.
Dmidecode does not scan your hardware, it only reports what the BIOS told it
to.


** INSTALLATION **

The home web page for dmidecode is hosted on Savannah:
  http://www.nongnu.org/dmidecode/
You will find the latest version (including CVS) there, as well as fresh news
and other interesting material, such as a list of related projects and
articles.

This program was first written for Linux, and has since been reported to work
on FreeBSD, NetBSD, OpenBSD, BeOS and Solaris as well.

There's no configure script, so simply run "make" to build dmidecode, and
"make install" to install it. You also can use "make uninstall" to remove
all the files you installed. By default, files are installed in /usr/local
but you can change this behavior by editing the Makefile file and setting
prefix to wherever you want. You may change the C compiler and the
compilation flags as well.

Optionally, you can run "make strip" prior to "make install" if you want
smaller binaries. However, be aware that this will prevent any further
attempt to debug the programs.

Two parameters can be set in the Makefile file to make dmidecode work on
non-i386 systems. They should be used if your system uses the big endian
byte ordering (Motorola) or doesn't support unaligned memory accesses,
respectively. For example, compiling for a SPARC processor would require
both (but I am not aware of SPARC-based systems implementing SMBIOS).
Compiling for an IA64 processor requires the memory alignment workaround,
and it is enabled automatically.


** DOCUMENTATION **

Each tool has a manual page, found in the "man" subdirectory. Manual pages
are installed by "make install". See these manual pages for command line
interface details and tool specific information.

For an history of the changes made to dmidecode, see the CHANGELOG file.

If you need help, your best chances are to visit the web page (see the
INSTALLATION section above) or to get in touch with the developers directly.
Have a look at the AUTHORS file and contact one of the maintainers.

If you want to help with the development of dmidecode, please consider
joining the dmidecode-devel discussion list:
  http://lists.nongnu.org/mailman/listinfo/dmidecode-devel


** COMMON PROBLEMS **

IA-64

Non-Linux systems are not yet supported.

MMAP

Note that mmap() is now used by default wherever possible, since this seems
to solve a number of problems. This default behavior can be changed in
config.h. Just to make sure this is clear, mmap() is not used for performance
reasons but to increase the number of systems on which dmidecode can be
successfully run.

CYGWIN

Dmidecode used to work under Cygwin. However the /dev/mem interface was
removed at some point in time so it no longer works.


** MISCELLANEOUS TOOLS **

Three other tools come along with dmidecode: biosdecode, ownership and
vpddecode. These tools are only useful on systems with a BIOS, so they
are not built on IA-64 by default.

BIOSDECODE

This one prints all BIOS related information it can find in /dev/mem.
It used to be part of dmidecode itself, but as dmidecode was growing,
we felt that the non-DMI part had to be moved to a separate tool.

OWNERSHIP

This tool was written on a request by Luc Van de Velde for use with Novell
tools in his company. It retrieves the "ownership tag" that can be set on
most Compaq computers. Since it uses the same mechanisms dmidecode and
biosdecode use, and could be of some use for other people as well, we
decided to make it part of the project.

VPDDECODE

This tool prints the contents of the "vital product data" structure as
found in most IBM and Lenovo computers. It used to have a lookup table
for the machine name, but it was unreliable and hard to maintain so it
was ultimately dropped. It has a command line interface.

dmidecode-osx's People

Contributors

cavaliercoder avatar jarodwilson avatar jdelvare avatar orosp avatar westeri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmidecode-osx's Issues

Crash on OSX 10.12

dmidecode

dmidecode 3.0

Getting SMBIOS data from Apple SMBIOS service.
SMBIOS 2.4 present.
61 structures occupying 2888 bytes.

Trace/BPT trap: 5
No way to get any further, any ideas?

dmidecode-osx doesn't work on mini M1

Doesn't seem to work on mini M1 (2020). Suggestions? MacOSX 11.2.

% sudo ./dmidecode
Password:

dmidecode 3.1

Getting SMBIOS data from Apple SMBIOS service.
AppleSMBIOS service is unreachable, sorry.%
%
% uname -ar
Darwin srl-minim1.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64

"Illegal instruction: 4" on Mid-2010 Mac Mini, MacOS 10.13.6

dmidecode compiled with -O0 -g3 on a Mid-2010 Mac Mini, MacOS 10.13.6. I am not really a Mac person and I'm at a loss as to how to proceed:

bash-3.2# gmake dmidecode
gcc -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef -D_FILE_OFFSET_BITS=64 -O0 -g3 -Wno-constant-logical-operand -c dmidecode.c -o dmidecode.o
gcc -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef -D_FILE_OFFSET_BITS=64 -O0 -g3 -Wno-constant-logical-operand -c dmiopt.c -o dmiopt.o
gcc -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef -D_FILE_OFFSET_BITS=64 -O0 -g3 -Wno-constant-logical-operand -c dmioem.c -o dmioem.o
gcc -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef -D_FILE_OFFSET_BITS=64 -O0 -g3 -Wno-constant-logical-operand -c util.c -o util.o
gcc -framework CoreServices -framework IOKit dmidecode.o dmiopt.o dmioem.o util.o -o dmidecode
bash-3.2# ./dmidecode

dmidecode 3.1

Getting SMBIOS data from Apple SMBIOS service.
SMBIOS 2.4 present.
44 structures occupying 1946 bytes.

Bad address
Illegal instruction: 4
bash-3.2# gdb ./dmidecode
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...unable to read unknown load command 0x80000028
Reading symbols for shared libraries ..... done
unable to read unknown load command 0x80000028

(gdb) run
Starting program: /usr/local/src/dmidecode-osx/dmidecode

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.

&/&& confusion?

Clang just pointed out this to me:

dmidecode.c:4514:26: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
                                                DWORD(data + 0x0A) && 0xFF);
                                                                   ^  ~~~~
dmidecode.c:4514:26: note: use '&' for a bitwise operation
                                                DWORD(data + 0x0A) && 0xFF);
                                                                   ^~
                                                                   &
dmidecode.c:4514:26: note: remove constant to silence this warning
                                                DWORD(data + 0x0A) && 0xFF);
                                                                  ~^~~~~~~
2 warnings generated.

Looking at the code:

					printf("\tFirmware Revision: %u.%u\n",
						DWORD(data + 0x0A) >> 16,
						DWORD(data + 0x0A) && 0xFF);

I think that clang is right, a bitwise AND is intended here.

Assert failure on Ventura

When running on macOS Ventura I get the following assertion failure:

dmidecode 3.1

Getting SMBIOS data from Apple SMBIOS service.
Assertion failed: (range.location + range.length <= dataLength), function __CFDataValidateRange, file CFData.c, line 235.
zsh: abort dmidecode

Tracing this back the root cause was the CFDataRef was 31 bytes instead of 32. Viewing the apple documentation the correct fix is it should use the CFDataGetLength call to get the actual size rather than hardcoding it. I also had to add an ifdef to remove the Problematic CFRelease(properties) as per the comments. I believe this should be a compile option for the Makefile, as I don't need a signed binary. Here is a diff of my version:

diff --git a/dmidecode.c b/dmidecode.c
index bb651da..194108c 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4811,8 +4811,10 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
 		 * This CFRelease throws 'Segmentation fault: 11' since macOS 10.12, if
 		 * the compiled binary is not signed with an Apple developer profile.
 		 */
+		#ifdef SIGNED_BINARY  // So don't do that unless you signed it
 		if (NULL != properties)
 			CFRelease(properties);
+		#endif
 
 		IOObjectRelease(service);
 	}
@@ -5147,7 +5149,7 @@ int main(int argc, char * const argv[])
 		goto exit_free;
 	}
 
-	CFDataGetBytes(dataRef, CFRangeMake(0, 0x20), (UInt8*)buf);
+	CFDataGetBytes(dataRef, CFRangeMake(0, CFDataGetLength(dataRef)), (UInt8*)buf);
 
 	if (NULL != dataRef)
 		CFRelease(dataRef);

Odd extra zero pairs between entries in dmi_table buffer

Using ./dmidecode I get about 40 of the 42 structures before getting a:
Invalid entry length (0). DMI table is broken! Stop.

Investigating the raw buffer I discover that the last few entries are separated by multiple pairs of zeros, rather than the expected one pair. To address this oddity I changed:

in dmidecode.c:dmi_table_decode(..)

        /* look for the next handle */
        next = data + h.length;
        while ((unsigned long)(next - buf + 1) < len
               && (next[0] != 0 || next[1] != 0)) {
            next++;
        }
        next+=2;

Replacing the final next+=2 with:

        while((unsigned long)(next - buf + 1) < len && (next[0] == 0 && next[1] == 0)) {
            next+=2;
        }

MacBookAir6,1 - osx 10.11.2
I've attached a zip of '--dump-bin' file so you can try it yourself.

air.raw.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.