def _generate_bootloader(self):
     start_blk = 0
     ipl_last_blk = 0
     if self._c.has_option('CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START'):
         start_blk = int(self._c.get_clean('CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START'), 16)
     for part in self._partitions: 
         if part.name == self.names['ipl']:
             ipl_last_blk = part.start_blk + part.size_blks
     if start_blk < ipl_last_blk:
         if self._c.has_option('CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START'):
             raise MemoryMapException("IPL ends at block %s, can't start the "
                 "bootloader partition at block %s, please check "
                 "CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START" % 
                 (hex(ipl_last_blk), hex(start_blk)))
         start_blk = ipl_last_blk
     img = '%s/%s' % (self._devdir, self.imgs['bootloader'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     if self._c.has_option('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'):
         uboot_last_blk = start_blk + size_blks
         uboot_last_allowed_blk = int(self._c.get_clean('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'))
         if uboot_last_blk > uboot_last_allowed_blk:
             raise MemoryMapException("The allowed space for %s and %s "
             "(CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS = %s) is smaller than "
             "the required one (%s NAND blocks), please reconfigure your SDK"
             % (self.names['ipl'], self.names['bootloader'],
                uboot_last_allowed_blk, uboot_last_blk))
     uboot = NandPartition(self.names['bootloader'])
     uboot.image = img
     uboot.start_blk = start_blk
     uboot.size_blks = size_blks
     self._partitions.append(uboot)
 def _generate_bootloader_env(self):
     if self._c.has_option('CONFIG_UBOOT_FW_PRINTENV'):
         uboot_env = NandPartition(self.names['bootloader_env'])
         uboot_env.image = None
         uboot_env.start_blk = 19  # Default DM816x env start blk (0x260000)
         uboot_env.size_blks = 1  # Default DM816x env size (0x2000)
         self._partitions.append(uboot_env)
 def _generate_ipl(self):
     start_blk = 0
     if self._c.has_option('CONFIG_BSP_ARCH_INSTALLER_IPL_FLASH_BLK_START'):
         start_blk = int(self._c.get_clean('CONFIG_BSP_ARCH_INSTALLER_IPL_FLASH_BLK_START'), 16)
     if self._c.has_option('CONFIG_ARCH_IPL_COPIES'):
         img = '%s/%s' % (self._devdir, self.imgs['ipl_multi'])
     else:
         img = '%s/%s' % (self._devdir, self.imgs['ipl'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     ipl = NandPartition(self.names['ipl'])
     ipl.image = img
     ipl.start_blk = start_blk
     ipl.size_blks = size_blks
     self._partitions.append(ipl)
 def _generate_ipl(self):
     start_blk = 0
     if self._c.has_option('CONFIG_BSP_ARCH_INSTALLER_IPL_FLASH_BLK_START'):
         start_blk = int(
             self._c.get_clean(
                 'CONFIG_BSP_ARCH_INSTALLER_IPL_FLASH_BLK_START'), 16)
     if self._c.has_option('CONFIG_ARCH_IPL_COPIES'):
         img = '%s/%s' % (self._devdir, self.imgs['ipl_multi'])
     else:
         img = '%s/%s' % (self._devdir, self.imgs['ipl'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     ipl = NandPartition(self.names['ipl'])
     ipl.image = img
     ipl.start_blk = start_blk
     ipl.size_blks = size_blks
     self._partitions.append(ipl)
 def _generate_fs(self):
     start_blk = 0
     for part in self._partitions: 
         if part.name == self.names['kernel']:
             start_blk = part.start_blk + part.size_blks
     img = '%s/%s' % (self._devdir, self.imgs['fs'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     size_blks += FS_EXTRA_BLKS
     if self._c.has_option('CONFIG_INSTALLER_FS_SIZE_IN_BLKS'):
         min_size_blks = int(self._c.get_clean('CONFIG_INSTALLER_FS_SIZE_IN_BLKS'))
         if size_blks < min_size_blks:
             size_blks = min_size_blks
     fs = NandPartition(self.names['fs'])
     fs.image = img
     fs.start_blk = start_blk
     fs.size_blks = size_blks
     fs.filesystem = self._fs_name()
     self._partitions.append(fs)
 def _generate_fs(self):
     start_blk = 0
     for part in self._partitions:
         if part.name == self.names['kernel']:
             start_blk = part.start_blk + part.size_blks
     img = '%s/%s' % (self._devdir, self.imgs['fs'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     size_blks += FS_EXTRA_BLKS
     if self._c.has_option('CONFIG_INSTALLER_FS_SIZE_IN_BLKS'):
         min_size_blks = int(
             self._c.get_clean('CONFIG_INSTALLER_FS_SIZE_IN_BLKS'))
         if size_blks < min_size_blks:
             size_blks = min_size_blks
     fs = NandPartition(self.names['fs'])
     fs.image = img
     fs.start_blk = start_blk
     fs.size_blks = size_blks
     fs.filesystem = self._fs_name()
     self._partitions.append(fs)
 def _generate_bootloader(self):
     start_blk = 0
     ipl_last_blk = 0
     if self._c.has_option(
             'CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START'):
         start_blk = int(
             self._c.get_clean(
                 'CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START'), 16)
     for part in self._partitions:
         if part.name == self.names['ipl']:
             ipl_last_blk = part.start_blk + part.size_blks
     if start_blk < ipl_last_blk:
         if self._c.has_option(
                 'CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START'):
             raise MemoryMapException(
                 "IPL ends at block %s, can't start the "
                 "bootloader partition at block %s, please check "
                 "CONFIG_BSP_ARCH_INSTALLER_UBOOT_FLASH_BLK_START" %
                 (hex(ipl_last_blk), hex(start_blk)))
         start_blk = ipl_last_blk
     img = '%s/%s' % (self._devdir, self.imgs['bootloader'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     if self._c.has_option('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'):
         uboot_last_blk = start_blk + size_blks
         uboot_last_allowed_blk = int(
             self._c.get_clean('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'))
         if uboot_last_blk > uboot_last_allowed_blk:
             raise MemoryMapException(
                 "The allowed space for %s and %s "
                 "(CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS = %s) is smaller than "
                 "the required one (%s NAND blocks), please reconfigure your SDK"
                 % (self.names['ipl'], self.names['bootloader'],
                    uboot_last_allowed_blk, uboot_last_blk))
     uboot = NandPartition(self.names['bootloader'])
     uboot.image = img
     uboot.start_blk = start_blk
     uboot.size_blks = size_blks
     self._partitions.append(uboot)
 def _generate_kernel(self):
     start_blk = 0
     if self._c.has_option('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'):
                 uboot_last_blk = int(self._c.get_clean('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'))
                 start_blk = uboot_last_blk 
     else:
         for part in self._partitions: 
             if part.name == self.names['bootloader']:
                 start_blk = part.start_blk + part.size_blks
     img = '%s/%s' % (self._devdir, self.imgs['kernel'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     size_blks += KERNEL_EXTRA_BLKS
     if self._c.has_option('CONFIG_INSTALLER_KERNEL_SIZE_IN_BLKS'):
         min_size_blks = int(self._c.get_clean('CONFIG_INSTALLER_KERNEL_SIZE_IN_BLKS'))
         if size_blks < min_size_blks:
             size_blks = min_size_blks
     kernel = NandPartition(self.names['kernel'])
     kernel.image = img
     kernel.start_blk = start_blk
     kernel.size_blks = size_blks
     self._partitions.append(kernel)
 def _generate_kernel(self):
     start_blk = 0
     if self._c.has_option('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'):
         uboot_last_blk = int(
             self._c.get_clean('CONFIG_INSTALLER_UBOOT_SIZE_IN_BLKS'))
         start_blk = uboot_last_blk
     else:
         for part in self._partitions:
             if part.name == self.names['bootloader']:
                 start_blk = part.start_blk + part.size_blks
     img = '%s/%s' % (self._devdir, self.imgs['kernel'])
     size = os.path.getsize(img)
     size_blks = self._bytes_to_blks(size)
     size_blks += KERNEL_EXTRA_BLKS
     if self._c.has_option('CONFIG_INSTALLER_KERNEL_SIZE_IN_BLKS'):
         min_size_blks = int(
             self._c.get_clean('CONFIG_INSTALLER_KERNEL_SIZE_IN_BLKS'))
         if size_blks < min_size_blks:
             size_blks = min_size_blks
     kernel = NandPartition(self.names['kernel'])
     kernel.image = img
     kernel.start_blk = start_blk
     kernel.size_blks = size_blks
     self._partitions.append(kernel)