~mabac/linaro-image-tools/bug-837201

« back to all changes in this revision

Viewing changes to linaro_image_tools/hwpack/hardwarepack.py

  • Committer: Mattias Backman
  • Date: 2011-08-24 14:05:56 UTC
  • mfrom: (397.3.21 hwpacks-v2-add-vmlinuz)
  • Revision ID: mattias.backman@linaro.org-20110824140556-8oga43g7l1ez4bjb
Add support for more hwpack v2.0 fields.

    kernel_file - path to the installed kernel
    initrd_file - path to the installed initrd
    dtb_file - path to the installed device tree binary
    dtb_addr - device tree address
    extra_boot_options - extra boot arg options
    boot_script - filename relative to /boot where to put boot script
    u_boot_in_boot_part - whether to put the uboot binary in the boot partition
    extra_serial_opts - extra serial options

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
    @classmethod
80
80
    def add_v2_config(self, serial_tty=None, kernel_addr=None, initrd_addr=None,
81
 
                      load_addr=None, fdt=None, wired_interfaces=[],
 
81
                      load_addr=None, dtb_file=None, wired_interfaces=[],
82
82
                      wireless_interfaces=[], partition_layout=None,
83
83
                      mmc_id=None, boot_min_size=None, root_min_size=None,
84
 
                      loader_min_size=None):
 
84
                      loader_min_size=None, vmlinuz=None, initrd=None,
 
85
                      dtb_addr=None, extra_boot_options=None,
 
86
                      boot_script=None, uboot_in_boot_part=None,
 
87
                      extra_serial_opts=None):
85
88
        """Add fields that are specific to the new format.
86
89
 
87
90
        These fields are not present in earlier config files.
99
102
        self.root_min_size = root_min_size
100
103
        self.loader_min_size = loader_min_size
101
104
        self.x_loader = None
 
105
        self.vmlinuz = vmlinuz
 
106
        self.initrd = initrd
 
107
        self.dtb_file = dtb_file
 
108
        self.dtb_addr = dtb_addr
 
109
        self.extra_boot_options = extra_boot_options
 
110
        self.boot_script = boot_script
 
111
        self.uboot_in_boot_part = uboot_in_boot_part
 
112
        self.extra_serial_opts = extra_serial_opts
102
113
 
103
114
    @classmethod
104
115
    def from_config(cls, config, version, architecture):
134
145
                                   mmc_id=config.mmc_id,
135
146
                                   boot_min_size=config.boot_min_size,
136
147
                                   root_min_size=config.root_min_size,
137
 
                                   loader_min_size=config.loader_min_size)
 
148
                                   loader_min_size=config.loader_min_size,
 
149
                                   vmlinuz=config.vmlinuz,
 
150
                                   initrd=config.initrd,
 
151
                                   dtb_file=config.dtb_file,
 
152
                                   dtb_addr=config.dtb_addr,
 
153
                                   extra_boot_options=config.extra_boot_options,
 
154
                                   boot_script=config.boot_script,
 
155
                                   uboot_in_boot_part=config.uboot_in_boot_part,
 
156
                                   extra_serial_opts=config.extra_serial_opts)
138
157
        return metadata
139
158
 
140
159
    def __str__(self):
162
181
            metadata += "INITRD_ADDR=%s\n" % self.initrd_addr
163
182
        if self.load_addr is not None:
164
183
            metadata += "LOAD_ADDR=%s\n" % self.load_addr
 
184
        if self.dtb_addr is not None:
 
185
            metadata += "DTB_ADDR=%s\n" % self.dtb_addr
165
186
        if self.wired_interfaces != []:
166
187
            metadata += "WIRED_INTERFACES=%s\n" % " ".join(self.wired_interfaces)
167
188
        if self.wireless_interfaces != []:
179
200
            metadata += "LOADER_MIN_SIZE=%s\n" % self.loader_min_size
180
201
        if self.x_loader is not None:
181
202
            metadata += "X_LOADER=%s\n" % self.x_loader
 
203
        if self.vmlinuz is not None:
 
204
            metadata += "KERNEL_FILE=%s\n" % self.vmlinuz
 
205
        if self.initrd is not None:
 
206
            metadata += "INITRD_FILE=%s\n" % self.initrd
 
207
        if self.dtb_file is not None:
 
208
            metadata += "DTB_FILE=%s\n" % self.dtb_file
 
209
        if self.extra_boot_options is not None:
 
210
            metadata += "EXTRA_BOOT_OPTIONS=%s\n" % self.extra_boot_options
 
211
        if self.boot_script is not None:
 
212
            metadata += "BOOT_SCRIPT=%s\n" % self.boot_script
 
213
        if self.uboot_in_boot_part is not None:
 
214
            metadata += "U_BOOT_IN_BOOT_PART=%s\n" % self.uboot_in_boot_part
 
215
        if self.extra_serial_opts is not None:
 
216
            metadata += "EXTRA_SERIAL_OPTIONS=%s\n" % self.extra_serial_opts
182
217
 
183
218
        return metadata
184
219