We will start exploring the AMT WS-MAN interface with a nice C++ Library based on the Windows AMT Classes for Windows. We recycle code from Intel AMT SDK and pack this in a shared library running on most recent Linux distros. Officially supported are only the enterprise distributions SLES and RHEL. But the code we need is pure C++ with binding to openWSMAN and xerces (XML).
AMT stands for Advanced Management Technology and is part of the Intel vPro Platform. It provides out of band management for Intel Desktop Computers based on the business ‘Q’ chipsets. I will write some introduction and further readings in a different post.
Because code of the AMT SDK is not redistributable you have download the SDK first.
Open the AMT download page and download the SDK. At the time of writing the was version 220.127.116.11.
At first create a project directory, for example ‘adminundcode’. In this directory create a subdirectory ‘sdk’. Change to ‘sdk’ and unzip the SDK you have downloaded to this directory.
Parallel to the sdk directoy clone my project from github.
git clone firstname.lastname@example.org:adminundcode/libamt.git
After that change to libamt. There are some shell scripts. one of them is ‘copy_files.sh’, with the content:
#! /bin/bash sdkpath=../sdk mkdir SyncLib cp -r $sdkpath/Windows/Common/SyncLib/Include SyncLib cp -r $sdkpath/Windows/Common/SyncLib/src SyncLib mkdir intel mkdir intel/src mkdir intel/include cp ../sdk/Windows/Common/WS-Management/C++/CimFramework/include/*.h intel/include/ cp ../sdk/Windows/Common/WS-Management/C++/CimFramework/src/*.cpp intel/src/ cp ../sdk/Windows/Common/WS-Management/C++/CimFrameworkUntyped/include/*.h intel/include/ cp ../sdk/Windows/Common/WS-Management/C++/CimFrameworkUntyped/src/*.cpp intel/src/ mkdir mof mkdir mof/include mkdir mof/src cp ../sdk/Windows/Common/WS-Management/C++/CimFramework/CPPClasses/Include/*.h mof/include/ cp ../sdk/Windows/Common/WS-Management/C++/CimFramework/CPPClasses/Src/*.cpp mof/src/ cp ../sdk/Windows/Common/WS-Management/C++/CimOpenWsmanClient/CimOpenWsmanClient.h intel/include/ cp ../sdk/Windows/Common/WS-Management/C++/CimOpenWsmanClient/CimOpenWsmanClient.cpp intel/src/ cp ../sdk/Windows/Common/WS-Management/C++/openwsman/src/cpp/OpenWsmanClient.cpp intel/src/ rm intel/src/cdecode.cpp rm intel/src/cencode.cpp rm intel/include/cdecode.h rm intel/include/cencode.h
When you run this, the relevant files are copied from the SDK. Luckily there only some minor changes necessary to make this compilable. You may have a look at them in the subdirectory patches. They are split into thematic blocks:
- Make it compilable, mainly adjusting path. Replace some Windows code with Linux code
- Fix to run with recent libxerces version 3. Intel still uses Version 2 which is out of support for almost ten years.
The patches are managed with ‘quilt’, a common patch management system extensively used to apply patches to Debian packages. Install with ‘sudo apt install quilt’. Run
quilt push -a
to apply the patches. If you don’t get any error, we are ready to compile. Special care should be taken, to path to openWSMAN library. If you followed my last post libamt prerequisite: Building Openwsman the path should be ok. If your system offers openWSMAN greater than 2.6, you may comment in to corresponding statements in the Makefile. Running make will start the compilation, which will take some minutes, its quite a lot of stuff.
After this two main files have been build: The library libamt.so.11 and a silly test application, you can run with any (non SSL) AMT host. This basically reads some version information and the Event Log. Changing the power state is commented out, not to do any harmful.
To run the program you have to extend your LD_LIBRARY_PATH. You can do this in place:
Note: ~/lib64 is the directory where the wsman library is installed.
If you want to run programs using libwsman in other places, you may add this to your .bashrc.
As you see in test.cpp working with this classes is very ugly. The runtime performance is slower than slow. We will try some other ways in the next posts.