Fixed USB key setup.bin encoding.
This commit is contained in:
parent
522631eaba
commit
f0c319e070
|
@ -127,7 +127,6 @@ var CreateAmtSetupBinStack = function () {
|
|||
|
||||
// Parse the Setup.bin file
|
||||
o.AmtSetupBinDecode = function (file) {
|
||||
|
||||
// Format of the setup file header:
|
||||
// FileTypeUUID(16) - uniquely identifies the file type. This identifier will remain valid and constant across all versions of the file type.
|
||||
// RecordChunkCount(2) - indicates the number of 512-byte chunks occupied by this record, including all header, body, and reserved fields.
|
||||
|
@ -135,9 +134,11 @@ var CreateAmtSetupBinStack = function () {
|
|||
// RecordNumber(4) - uniquely identifies the record among all records in the file. The field contains a non-negative ordinal value. The value of this field is always zero in the Local Provisioning File Header Record.
|
||||
// MajorVersion(1) - identifies the major version of the file format specification. This is a positive integer that is greater than or equal to 1. The Major Version number is incremented to indicate that changes have been introduced that will cause code written against a lower Major Version number to fail.
|
||||
// MinorVersion(1) - identifies the minor version of the file format specification. This is an integer that is greater than or equal to 0. The Minor Version number is incremented to indicate that changes have been introduced that will not cause code written against the same Major Version and a lower Minor Version number to fail. The purpose of this behavior is to allow a single local provisioning file to be used for multiple generations of Intel® AMT platform.
|
||||
// Flags (2) - File Flags, 1 = Do not consume records
|
||||
// DataRecordCount(4) - indicates the total number of data records written in the file when it was created.
|
||||
// DataRecordsConsumed(4) - is a counter value that begins at 0 and is incremented by 1 by each platform BIOS when it consumes a data record from the file. This value is used to determine the offset of the next data record in the file.
|
||||
// DataRecordChunkCount(2) - contains the number of 512-byte chunks in each data record. All data records are the same length.
|
||||
// Reserved (2) - Reserved
|
||||
// ModuleList - contains a list of module identifiers. A module’s identifier appears in the list if and only if the data records contain entries for that module. Each module identifier is two bytes in length. The list is terminated by an identifier value of 0.
|
||||
|
||||
var obj = {}, UUID = file.substring(0, 16);
|
||||
|
@ -216,14 +217,21 @@ var CreateAmtSetupBinStack = function () {
|
|||
o.AmtSetupBinEncode = function (obj) {
|
||||
if (obj.fileType < 1 && obj.fileType > AmtSetupBinSetupGuids.length) return null;
|
||||
var out = [], r = AmtSetupBinSetupGuids[obj.fileType - 1], reccount = 0;
|
||||
|
||||
// Get the list of modules used
|
||||
var modulesInUse = [];
|
||||
for (var i in obj.records) { var rec = obj.records[i]; for (var j in rec.variables) { var v = rec.variables[j]; if (modulesInUse.indexOf(v.moduleid) == -1) { modulesInUse.push(v.moduleid); } } }
|
||||
|
||||
r += ShortToStrX(obj.recordChunkCount);
|
||||
r += ShortToStrX(obj.recordHeaderByteCount);
|
||||
r += ShortToStrX(42 + (modulesInUse.length * 2)); // Header is 42 bytes long + 2 bytes for each additional modules in use.
|
||||
r += IntToStrX(obj.recordNumber);
|
||||
r += String.fromCharCode(obj.majorVersion, obj.minorVersion);
|
||||
r += ShortToStrX(obj.flags); // Flags: 1 = Do not consume records
|
||||
r += IntToStrX(obj.records.length);
|
||||
r += IntToStrX(obj.dataRecordsConsumed);
|
||||
r += ShortToStrX(obj.dataRecordChunkCount);
|
||||
r += ShortToStrX(0); // Reserved
|
||||
for (var i in modulesInUse) { r += ShortToStrX(modulesInUse[i]); } // Write each module in use. Needs to be null terminated, but the padding that follows will do that.
|
||||
while (r.length < 512) { r += '\0'; } // Pad the header
|
||||
out.push(r);
|
||||
|
||||
|
|
|
@ -447,12 +447,12 @@ module.exports.CertificateOperations = function (parent) {
|
|||
v.value = port;
|
||||
setupbin.records[0].variables.push(v);
|
||||
|
||||
// Create "Remote Configuration Enabled (RCFG)" variable
|
||||
// Create "ME Provision Halt Active" variable
|
||||
v = {};
|
||||
v.moduleid = 2;
|
||||
v.varid = 5;
|
||||
v.varid = 28;
|
||||
v.length = -1;
|
||||
v.value = '1'; // Turn on
|
||||
v.value = 1; // Start
|
||||
setupbin.records[0].variables.push(v);
|
||||
|
||||
// Write to log file
|
||||
|
|
Loading…
Reference in New Issue