2 * File: BootImageGenerator.h
4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
7 #if !defined(_BootImageGenerator_h_)
8 #define _BootImageGenerator_h_
10 #include "OutputSection.h"
11 #include "BootImage.h"
12 #include "OptionContext.h"
18 * \brief Abstract base class for generators of specific boot image formats.
20 * Subclasses implement a concrete generator for a certain boot image format, but
21 * they all have the same interface.
23 * After creating an instance of a subclass the user adds OutputSection objects
24 * to the generator. These objects describe discrete sections within the resulting
25 * boot image file. If the format does not support multiple sections then only
26 * the first will be used.
28 * Options that are common to all boot image formats are handled by methods
29 * defined in this class. These are the current common options:
34 class BootImageGenerator
37 //! \brief Constructor.
38 BootImageGenerator() {}
40 //! \brief Destructor.
41 virtual ~BootImageGenerator() {}
43 //! \brief Add another section to the output.
44 void addOutputSection(OutputSection * section) { m_sections.push_back(section); }
46 //! \brief Set the global option context.
47 void setOptionContext(OptionContext * context) { m_options = context; }
49 //! \brief Pure virtual method to generate the output BootImage from input sections.
50 virtual BootImage * generate()=0;
53 //! Type for a list of model output sections.
54 typedef std::vector<OutputSection*> section_vector_t;
56 section_vector_t m_sections; //!< Requested output sections.
57 OptionContext * m_options; //!< Global option context.
59 //! \brief Handle common product and component version options.
60 void processVersionOptions(BootImage * image);
62 //! \brief Handle the common option which sets the system drive tag.
63 void processDriveTagOption(BootImage * image);
66 }; // namespace elftosb
68 #endif // _BootImageGenerator_h_