예제 #1
0
 def _generate_boot_partition(self):
     """
     Generates the start and size (in cylinders) of the boot partition.
     """
 
     boot = Partition('boot')
     
     # Config variables
     boot_partition_size_mb = \
         self._config.get_clean('CONFIG_INSTALLER_UBOOT_PARTITION_SIZE')
     
     if self._config.has_option('CONFIG_BSP_ARCH_SD_CARD_INSTALLER_BOOTLOADER_OUT_OF_FS'):
         boot.start = 1 # Leave room for the MBR at cylinder 0
     else:
         boot.start = 0
     
     if boot_partition_size_mb == geometry.FULL_SIZE:
         boot.size = geometry.FULL_SIZE
     else:
         boot_partition_size_b = float(int(boot_partition_size_mb) << 20)
         boot_partition_size   = math.ceil(boot_partition_size_b /
                                            geometry.CYLINDER_BYTE_SIZE)
         boot.size = int(boot_partition_size)
         
     # Boot partition is bootable
     boot.bootable = True
     
     # Boot partition is FAT32/VFAT
     boot.type = Partition.TYPE_FAT32_LBA
     boot.filesystem = Partition.FILESYSTEM_VFAT
     
     # Boot components are: bootloader and kernel.
     boot.components = [boot.COMPONENT_BOOTLOADER, boot.COMPONENT_KERNEL]
         
     self._partitions.append(boot)
예제 #2
0
 def _generate_rootfs_partition(self):
     """
     Generates the information for the rootfs (filesystem) partition.
     """
     
     rootfs = Partition('rootfs')
     
     rootfs.filesystem = Partition.FILESYSTEM_UNKNOWN
     if self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT3'):
         rootfs.filesystem = Partition.FILESYSTEM_EXT3
     elif self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4'):
         rootfs.filesystem = Partition.FILESYSTEM_EXT4
     elif self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4_NO_JOURNAL'):
         rootfs.filesystem = Partition.FILESYSTEM_EXT4_WRITEBACK
     
     rootfs.type = Partition.TYPE_UNKNOWN
     if (rootfs.filesystem == Partition.FILESYSTEM_EXT3 or
         rootfs.filesystem == Partition.FILESYSTEM_EXT4 or
         rootfs.filesystem == Partition.FILESYSTEM_EXT4_WRITEBACK):
         rootfs.type = Partition.TYPE_LINUX_NATIVE
     
     # If the partition filesystem for rootfs was not specified, assume
     # Linux native, ext4.
     if rootfs.filesystem == Partition.FILESYSTEM_UNKNOWN:
         rootfs.filesystem = Partition.FILESYSTEM_EXT4
         rootfs.type = Partition.TYPE_LINUX_NATIVE
     
     # Take the whole SD card
     rootfs.start = 1
     rootfs.size = geometry.FULL_SIZE
     rootfs.bootable = False
     rootfs.components = [rootfs.COMPONENT_ROOTFS]
     self._partitions.append(rootfs)
예제 #3
0
    def _generate_rootfs_partition(self):
        """
        Generates the information for the rootfs (filesystem) partition.
        """

        rootfs = Partition('rootfs')

        rootfs.filesystem = Partition.FILESYSTEM_UNKNOWN
        if self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT3'):
            rootfs.filesystem = Partition.FILESYSTEM_EXT3
        elif self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4'):
            rootfs.filesystem = Partition.FILESYSTEM_EXT4
        elif self._config.has_option(
                'CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4_NO_JOURNAL'):
            rootfs.filesystem = Partition.FILESYSTEM_EXT4_WRITEBACK

        rootfs.type = Partition.TYPE_UNKNOWN
        if (rootfs.filesystem == Partition.FILESYSTEM_EXT3
                or rootfs.filesystem == Partition.FILESYSTEM_EXT4
                or rootfs.filesystem == Partition.FILESYSTEM_EXT4_WRITEBACK):
            rootfs.type = Partition.TYPE_LINUX_NATIVE

        # If the partition filesystem for rootfs was not specified, assume
        # Linux native, ext4.
        if rootfs.filesystem == Partition.FILESYSTEM_UNKNOWN:
            rootfs.filesystem = Partition.FILESYSTEM_EXT4
            rootfs.type = Partition.TYPE_LINUX_NATIVE

        # Take the whole SD card
        rootfs.start = 1
        rootfs.size = geometry.FULL_SIZE
        rootfs.bootable = False
        rootfs.components = [rootfs.COMPONENT_ROOTFS]
        self._partitions.append(rootfs)
예제 #4
0
 def _generate_boot_partition(self):    
     boot = Partition('boot')
     if self._config.has_option('CONFIG_BSP_ARCH_SD_CARD_INSTALLER_BOOTLOADER_OUT_OF_FS'):
         boot.start = 1 # Leave room for the MBR at cylinder 0
     else:
         boot.start = 0
     boot.size = geometry.FULL_SIZE
     boot.bootable = True
     boot.type = Partition.TYPE_FAT32_LBA
     boot.filesystem = Partition.FILESYSTEM_VFAT
     boot.components = [boot.COMPONENT_BOOTLOADER]
     self._partitions.append(boot)
예제 #5
0
 def _generate_boot_partition(self):
     boot = Partition('boot')
     if self._config.has_option(
             'CONFIG_BSP_ARCH_SD_CARD_INSTALLER_BOOTLOADER_OUT_OF_FS'):
         boot.start = 1  # Leave room for the MBR at cylinder 0
     else:
         boot.start = 0
     boot.size = geometry.FULL_SIZE
     boot.bootable = True
     boot.type = Partition.TYPE_FAT32_LBA
     boot.filesystem = Partition.FILESYSTEM_VFAT
     boot.components = [boot.COMPONENT_BOOTLOADER]
     self._partitions.append(boot)
예제 #6
0
    def _generate_boot_partition(self):
        """
        Generates the start and size (in cylinders) of the boot partition.
        """

        boot = Partition('boot')

        # Config variables
        boot_partition_size_mb = \
            self._config.get_clean('CONFIG_INSTALLER_UBOOT_PARTITION_SIZE')

        if self._config.has_option(
                'CONFIG_BSP_ARCH_SD_CARD_INSTALLER_BOOTLOADER_OUT_OF_FS'):
            boot.start = 1  # Leave room for the MBR at cylinder 0
        else:
            boot.start = 0

        if boot_partition_size_mb == geometry.FULL_SIZE:
            boot.size = geometry.FULL_SIZE
        else:
            boot_partition_size_b = float(int(boot_partition_size_mb) << 20)
            boot_partition_size = math.ceil(boot_partition_size_b /
                                            geometry.CYLINDER_BYTE_SIZE)
            boot.size = int(boot_partition_size)

        # Boot partition is bootable
        boot.bootable = True

        # Boot partition is FAT32/VFAT
        boot.type = Partition.TYPE_FAT32_LBA
        boot.filesystem = Partition.FILESYSTEM_VFAT

        # Boot components are: bootloader and kernel.
        boot.components = [boot.COMPONENT_BOOTLOADER, boot.COMPONENT_KERNEL]

        self._partitions.append(boot)
예제 #7
0
    def _generate_rootfs_partition(self):
        """
        Generates the start and size (in cylinders) of the rootfs (filesystem)
        partition.
        
        Note that the rootfs partition might not be appended if
        CONFIG_FS_TARGET_SD is not set, or the boot partition size is '-',
        since it means that the boot partition took all the available space.
        
        Assumes that the boot partition has already been appended to the
        partitions list.
        """
        
        # Check that the uboot partition has been appended
        if not self._partitions:
            self._logger.error('No info for the boot partition, '
                               'refused to generate rootfs partition info.')
            return
        
        # We need some info from the boot partition later on
        boot   = self._partitions[0]
        rootfs = Partition('rootfs')
        
        # Config variables
        rootfs_in_sd = self._config.get_clean('CONFIG_FS_TARGET_SD')
        rootfs_partition_size_mb = self._config.get_clean('CONFIG_INSTALLER_SD_ROOTFS_SIZE')
        
        rootfs_partition_fs = Partition.FILESYSTEM_UNKNOWN
        if self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT3'):
            rootfs_partition_fs = Partition.FILESYSTEM_EXT3
        elif self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4'): 
            rootfs_partition_fs = Partition.FILESYSTEM_EXT4
        elif self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4_NO_JOURNAL'): 
            rootfs_partition_fs = Partition.FILESYSTEM_EXT4_WRITEBACK
        
        rootfs_partition_type = Partition.TYPE_UNKNOWN
        if (rootfs_partition_fs == Partition.FILESYSTEM_EXT3 or
            rootfs_partition_fs == Partition.FILESYSTEM_EXT4 or
            rootfs_partition_fs == Partition.FILESYSTEM_EXT4_WRITEBACK):
            rootfs_partition_type = Partition.TYPE_LINUX_NATIVE

        # Populate the rootfs partition
        if rootfs_in_sd == 'y' and boot.size != geometry.FULL_SIZE:
            
            # rootfs is installed next to the boot partition            
            rootfs.start = int(boot.start + boot.size)
            
            if rootfs_partition_size_mb == geometry.FULL_SIZE:
                rootfs.size = geometry.FULL_SIZE
            else:
                rootfs_partition_size_b = \
                    float(int(rootfs_partition_size_mb) << 20)
                rootfs_partition_size = math.ceil(rootfs_partition_size_b /
                                                geometry.CYLINDER_BYTE_SIZE)
                rootfs.size = int(rootfs_partition_size)

            # If the partition type for rootfs was not specified, assume
            # Linux native, ext4. A warning should've been raised already 
            # by validate_config().
            if rootfs_partition_type == Partition.TYPE_UNKNOWN:
                rootfs_partition_fs = Partition.FILESYSTEM_EXT4
                rootfs_partition_type = Partition.TYPE_LINUX_NATIVE
            
            rootfs.type = rootfs_partition_type
            rootfs.filesystem = rootfs_partition_fs
            
            # Rootfs components are: rootfs
            rootfs.components = [rootfs.COMPONENT_ROOTFS]
                
            self._partitions.append(rootfs)
예제 #8
0
    def _generate_rootfs_partition(self):
        """
        Generates the start and size (in cylinders) of the rootfs (filesystem)
        partition.
        
        Note that the rootfs partition might not be appended if
        CONFIG_FS_TARGET_SD is not set, or the boot partition size is '-',
        since it means that the boot partition took all the available space.
        
        Assumes that the boot partition has already been appended to the
        partitions list.
        """

        # Check that the uboot partition has been appended
        if not self._partitions:
            self._logger.error('No info for the boot partition, '
                               'refused to generate rootfs partition info.')
            return

        # We need some info from the boot partition later on
        boot = self._partitions[0]
        rootfs = Partition('rootfs')

        # Config variables
        rootfs_in_sd = self._config.get_clean('CONFIG_FS_TARGET_SD')
        rootfs_partition_size_mb = self._config.get_clean(
            'CONFIG_INSTALLER_SD_ROOTFS_SIZE')

        rootfs_partition_fs = Partition.FILESYSTEM_UNKNOWN
        if self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT3'):
            rootfs_partition_fs = Partition.FILESYSTEM_EXT3
        elif self._config.has_option('CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4'):
            rootfs_partition_fs = Partition.FILESYSTEM_EXT4
        elif self._config.has_option(
                'CONFIG_INSTALLER_SD_ROOTFS_TYPE_EXT4_NO_JOURNAL'):
            rootfs_partition_fs = Partition.FILESYSTEM_EXT4_WRITEBACK

        rootfs_partition_type = Partition.TYPE_UNKNOWN
        if (rootfs_partition_fs == Partition.FILESYSTEM_EXT3
                or rootfs_partition_fs == Partition.FILESYSTEM_EXT4
                or rootfs_partition_fs == Partition.FILESYSTEM_EXT4_WRITEBACK):
            rootfs_partition_type = Partition.TYPE_LINUX_NATIVE

        # Populate the rootfs partition
        if rootfs_in_sd == 'y' and boot.size != geometry.FULL_SIZE:

            # rootfs is installed next to the boot partition
            rootfs.start = int(boot.start + boot.size)

            if rootfs_partition_size_mb == geometry.FULL_SIZE:
                rootfs.size = geometry.FULL_SIZE
            else:
                rootfs_partition_size_b = \
                    float(int(rootfs_partition_size_mb) << 20)
                rootfs_partition_size = math.ceil(rootfs_partition_size_b /
                                                  geometry.CYLINDER_BYTE_SIZE)
                rootfs.size = int(rootfs_partition_size)

            # If the partition type for rootfs was not specified, assume
            # Linux native, ext4. A warning should've been raised already
            # by validate_config().
            if rootfs_partition_type == Partition.TYPE_UNKNOWN:
                rootfs_partition_fs = Partition.FILESYSTEM_EXT4
                rootfs_partition_type = Partition.TYPE_LINUX_NATIVE

            rootfs.type = rootfs_partition_type
            rootfs.filesystem = rootfs_partition_fs

            # Rootfs components are: rootfs
            rootfs.components = [rootfs.COMPONENT_ROOTFS]

            self._partitions.append(rootfs)