blob: 63daf26bc586020c64b0cc4d726de85796e7b9ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* BootImageGenerator.cpp
* elftosb
*
* Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
* See included license file for license details.
*/
#include "BootImageGenerator.h"
#include "Logging.h"
//! Name of product version option.
#define kProductVersionOption "productVersion"
//! Name of component version option.
#define kComponentVersionOption "componentVersion"
//! Name of option that specifies the drive tag for this .sb file.
#define kDriveTagOption "driveTag"
using namespace elftosb;
void BootImageGenerator::processVersionOptions(BootImage * image)
{
// bail if no option context was set
if (!m_options)
{
return;
}
const StringValue * stringValue;
version_t version;
// productVersion
if (m_options->hasOption(kProductVersionOption))
{
stringValue = dynamic_cast<const StringValue *>(m_options->getOption(kProductVersionOption));
if (stringValue)
{
version.set(*stringValue);
image->setProductVersion(version);
}
else
{
Log::log(Logger::WARNING, "warning: productVersion option is an unexpected type\n");
}
}
// componentVersion
if (m_options->hasOption(kComponentVersionOption))
{
stringValue = dynamic_cast<const StringValue *>(m_options->getOption(kComponentVersionOption));
if (stringValue)
{
version.set(*stringValue);
image->setComponentVersion(version);
}
else
{
Log::log(Logger::WARNING, "warning: componentVersion option is an unexpected type\n");
}
}
}
void BootImageGenerator::processDriveTagOption(BootImage * image)
{
if (m_options->hasOption(kDriveTagOption))
{
const IntegerValue * intValue = dynamic_cast<const IntegerValue *>(m_options->getOption(kDriveTagOption));
if (intValue)
{
image->setDriveTag(intValue->getValue());
}
else
{
Log::log(Logger::WARNING, "warning: driveTag option is an unexpected type\n");
}
}
}
|