diff --git a/kiwi/bootloader_config_grub2.py b/kiwi/bootloader_config_grub2.py index 735b24af..90e02fb3 100644 --- a/kiwi/bootloader_config_grub2.py +++ b/kiwi/bootloader_config_grub2.py @@ -100,7 +100,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): Create the grub.cfg in memory from a template suitable to boot from a disk image """ - log.info('Creating config file from template') + log.info('Creating grub config file from template') parameters = { 'search_params': '--fs-uuid --set=root ' + uuid, 'default_boot': '0', @@ -139,7 +139,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): Create the grub.cfg in memory from a template suitable to boot from an ISO image in EFI boot mode """ - log.info('Creating install config file from template') + log.info('Creating grub install config file from template') parameters = { 'search_params': '--file --set=root /boot/' + mbrid.get_id(), 'default_boot': '0', @@ -179,7 +179,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): Create the grub.cfg in memory from a template suitable to boot a live system from an ISO image in EFI boot mode """ - log.info('Creating live ISO config file from template') + log.info('Creating grub live ISO config file from template') parameters = { 'search_params': '--file --set=root /boot/' + mbrid.get_id(), 'default_boot': '0', diff --git a/kiwi/bootloader_config_isolinux.py b/kiwi/bootloader_config_isolinux.py index 730b6581..1e4a91e7 100644 --- a/kiwi/bootloader_config_isolinux.py +++ b/kiwi/bootloader_config_isolinux.py @@ -89,7 +89,7 @@ class BootLoaderConfigIsoLinux(BootLoaderConfigBase): # mbrid parameter is not used, the information is placed as the # application id when creating the iso filesystem. Thus not part # of the configuration file - log.info('Creating install config file from template') + log.info('Creating isolinux install config file from template') parameters = { 'default_boot': 'Boot_from_Hard_Disk', 'kernel_file': kernel, @@ -130,7 +130,7 @@ class BootLoaderConfigIsoLinux(BootLoaderConfigBase): # mbrid parameter is not used, the information is placed as the # application id when creating the iso filesystem. Thus not part # of the configuration file - log.info('Creating live ISO config file from template') + log.info('Creating isolinux live ISO config file from template') parameters = { 'default_boot': self.get_menu_entry_title(plain=True), 'kernel_file': kernel, diff --git a/kiwi/live_image_builder.py b/kiwi/live_image_builder.py index 7321db65..f38777b6 100644 --- a/kiwi/live_image_builder.py +++ b/kiwi/live_image_builder.py @@ -23,6 +23,7 @@ from bootloader_config import BootLoaderConfig from filesystem_squashfs import FileSystemSquashFs from filesystem_isofs import FileSystemIsoFs from internal_boot_image_task import BootImageTask +from system_size import SystemSize from firmware import FirmWare from defaults import Defaults from path import Path @@ -89,15 +90,19 @@ class LiveImageBuilder(object): self.media_dir = mkdtemp( prefix='live-media.', dir=self.target_dir ) + rootsize = SystemSize(self.media_dir) # custom iso metadata + log.info('Using following live ISO metadata:') + log.info('--> Application id: %s', self.mbrid.get_id()) + log.info('--> Publisher: %s', Defaults.get_publisher()) custom_iso_args = [ '-A', self.mbrid.get_id(), - '-allow-limited-size', '-udf', '-p', '"' + Defaults.get_preparer() + '"', '-publisher', '"' + Defaults.get_publisher() + '"', ] if self.volume_id: + log.info('--> Volume id: %s', self.volume_id) custom_iso_args.append('-V') custom_iso_args.append('"' + self.volume_id + '"') @@ -114,18 +119,18 @@ class LiveImageBuilder(object): Command.run( ['mv', self.live_image_file, self.media_dir] ) + # TODO: create config.isoclient + # Example: + # IMAGE='/dev/ram1;LimeJeOS-openSUSE-13.2.x86_64;1.13.2' + # UNIONFS_CONFIG='/dev/ram1,loop,clicfs' else: raise KiwiLiveBootImageError( 'live ISO type "%s" not supported, supported are %s' % (self.live_type, Defaults.get_live_iso_types()) ) - # TODO: create config.isoclient - - # TODO: create liveboot - # setup bootloader config to boot the ISO via isolinux - log.info('Setting up live iso bootloader configuration') + log.info('Setting up isolinux bootloader configuration') bootloader_config_isolinux = BootLoaderConfig( 'isolinux', self.xml_state, self.media_dir ) @@ -140,6 +145,7 @@ class LiveImageBuilder(object): # setup bootloader config to boot the ISO via EFI if self.firmware.efi_mode(): + log.info('Setting up EFI grub bootloader configuration') bootloader_config_grub = BootLoaderConfig( 'grub2', self.xml_state, self.media_dir ) @@ -156,6 +162,12 @@ class LiveImageBuilder(object): log.info('Creating live ISO boot image') self.__create_live_iso_kernel_and_initrd() + # calculate size and decide if we need UDF + if rootsize.accumulate_mbyte_file_sizes() > 4096: + log.info('ISO exceeds 4G size, using UDF filesystem') + custom_iso_args.append('-allow-limited-size') + custom_iso_args.append('-udf') + # create iso filesystem from media_dir log.info('Creating live ISO image') iso_image = FileSystemIsoFs( diff --git a/test/unit/live_image_builder_test.py b/test/unit/live_image_builder_test.py index 96c30b08..9852c18b 100644 --- a/test/unit/live_image_builder_test.py +++ b/test/unit/live_image_builder_test.py @@ -74,8 +74,9 @@ class TestLiveImageBuilder(object): @patch('kiwi.live_image_builder.FileSystemSquashFs') @patch('kiwi.live_image_builder.FileSystemIsoFs') @patch('kiwi.live_image_builder.BootLoaderConfig') + @patch('kiwi.live_image_builder.SystemSize') def test_create_overlay_structure( - self, mock_bootloader, mock_isofs, mock_squashfs, + self, mock_size, mock_bootloader, mock_isofs, mock_squashfs, mock_hybrid, mock_command, mock_dtemp ): tmpdir_name = ['temp-squashfs', 'temp_media_dir'] @@ -92,6 +93,11 @@ class TestLiveImageBuilder(object): iso_image = mock.Mock() iso_image.create_on_file.return_value = 'offset' mock_isofs.return_value = iso_image + rootsize = mock.Mock() + rootsize.accumulate_mbyte_file_sizes = mock.Mock( + return_value=8192 + ) + mock_size.return_value = rootsize self.live_image.create() @@ -144,13 +150,17 @@ class TestLiveImageBuilder(object): assert mock_command.call_args_list[1] == call( ['mv', 'initrd', 'temp_media_dir/boot/x86_64/loader/initrd'] ) + mock_size.assert_called_once_with( + 'temp_media_dir' + ) + rootsize.accumulate_mbyte_file_sizes.assert_called_once_with() mock_isofs.assert_called_once_with( custom_args=[ '-A', '0xffffffff', - '-allow-limited-size', - '-udf', '-p', '"KIWI - http://suse.github.com/kiwi"', + '-p', '"KIWI - http://suse.github.com/kiwi"', '-publisher', '"SUSE LINUX GmbH"', - '-V', '"volid"' + '-V', '"volid"', + '-allow-limited-size', '-udf' ], device_provider=None, source_dir='temp_media_dir' ) iso_image.create_on_file.assert_called_once_with(