original_docstring: Builds unified kernel image for given kernel name and copies it to "<efi_path>/EFI/Linux".
  
          Unified kernel image contains kernel cmdline, os-release, kernel, initramfs and if configured
          (see configuration file) microcode image.
  
          see https://wiki.archlinux.org/title/systemd-boot#Preparing_a_unified_kernel_image
          
docstring: Builds unified kernel image for given kernel name and copies it to "/EFI/Linux".
  Unified kernel image contains kernel cmdline, os-release, kernel, initramfs and if configured
  microcode image.
  
  
docstring_tokens: Builds unified kernel image for given kernel name and copies it to " / EFI / Linux " . Unified kernel image contains kernel cmdline os - release kernel initramfs and if configured microcode image .
code: def build_unified_kernel_image(self, kernel_name: str, unified_kernel_image_path: Path) -> None:
          """Builds unified kernel image for given kernel name and copies it to "<efi_path>/EFI/Linux".
  
          Unified kernel image contains kernel cmdline, os-release, kernel, initramfs and if configured
          (see configuration file) microcode image.
  
          see https://wiki.archlinux.org/title/systemd-boot#Preparing_a_unified_kernel_image
          """
          boot_path: Path = self._config.boot_path
          kernel_image_path: Path = boot_path / (self._config.kernel_image_name_prefix + '-' + kernel_name)
          initramfs_image_path: Path = boot_path / self._config.initramfs_image_name_template.replace(
              '__kernel-name__', kernel_name)
          microcode_image_path: Path = boot_path / self._config.microcode_image_name
          microcode_initramfs_unified_image_path: Path = boot_path / 'tmp-microcode-initramfs-unified.img'
          objcopy_initrd_image_path: Path = initramfs_image_path
          kernel_cmdline_file_path: Path = Env.KERNEL_CMDLINE_ETC_FILE_PATH
  
          if not kernel_cmdline_file_path.is_file():
              kernel_cmdline_file_path = Env.KERNEL_CMDLINE_PROC_FILE_PATH
  
          if self._config.include_microcode:
              with open(microcode_initramfs_unified_image_path, 'wb') as combined_image:
                  with open(microcode_image_path, 'rb') as microcode_image:
                      shutil.copyfileobj(microcode_image, combined_image)
  
                  with open(initramfs_image_path, 'rb') as initramfs_image:
                      shutil.copyfileobj(initramfs_image, combined_image)
  
              objcopy_initrd_image_path = microcode_initramfs_unified_image_path
  
          process_result = subprocess.run([
              'objcopy',
              f'--add-section=.osrel={Env.OS_RELEASE_FILE_PATH}',
              '--change-section-vma=.osrel=0x20000',
              f'--add-section=.cmdline={kernel_cmdline_file_path}',
              '--change-section-vma=.cmdline=0x30000',
              f'--add-section=.linux={kernel_image_path}',
              '--change-section-vma=.linux=0x2000000',
              f'--add-section=.initrd={objcopy_initrd_image_path}',
              '--change-section-vma=.initrd=0x3000000',
              Env.BOOTLOADER_SYSTEMD_BOOT_STUB_FILE_PATH,
              unified_kernel_image_path
          ], capture_output=True)
  
          microcode_initramfs_unified_image_path.unlink(missing_ok=True)
  
          if process_result.returncode != 0:
              raise secbootctl.core.AppError(f'building unified kernel image "{unified_kernel_image_path}" failed')
code_tokens: def build_unified_kernel_image ( self , kernel_name : str , unified_kernel_image_path : Path ) -> None : boot_path : Path = self . _config . boot_path kernel_image_path : Path = boot_path / ( self . _config . kernel_image_name_prefix + '-' + kernel_name ) initramfs_image_path : Path = boot_path / self . _config . initramfs_image_name_template . replace ( '__kernel-name__' , kernel_name ) microcode_image_path : Path = boot_path / self . _config . microcode_image_name microcode_initramfs_unified_image_path : Path = boot_path / 'tmp-microcode-initramfs-unified.img' objcopy_initrd_image_path : Path = initramfs_image_path kernel_cmdline_file_path : Path = Env . KERNEL_CMDLINE_ETC_FILE_PATH if not kernel_cmdline_file_path . is_file ( ) : kernel_cmdline_file_path = Env . KERNEL_CMDLINE_PROC_FILE_PATH if self . _config . include_microcode : with open ( microcode_initramfs_unified_image_path , 'wb' ) as combined_image : with open ( microcode_image_path , 'rb' ) as microcode_image : shutil . copyfileobj ( microcode_image , combined_image ) with open ( initramfs_image_path , 'rb' ) as initramfs_image : shutil . copyfileobj ( initramfs_image , combined_image ) objcopy_initrd_image_path = microcode_initramfs_unified_image_path process_result = subprocess . run ( [ 'objcopy' , f'--add-section=.osrel={Env.OS_RELEASE_FILE_PATH}' , '--change-section-vma=.osrel=0x20000' , f'--add-section=.cmdline={kernel_cmdline_file_path}' , '--change-section-vma=.cmdline=0x30000' , f'--add-section=.linux={kernel_image_path}' , '--change-section-vma=.linux=0x2000000' , f'--add-section=.initrd={objcopy_initrd_image_path}' , '--change-section-vma=.initrd=0x3000000' , Env . BOOTLOADER_SYSTEMD_BOOT_STUB_FILE_PATH , unified_kernel_image_path ] , capture_output = True ) microcode_initramfs_unified_image_path . unlink ( missing_ok = True ) if process_result . returncode != 0 : raise secbootctl . core . AppError ( f'building unified kernel image "{unified_kernel_image_path}" failed' )
short_docstring: Builds unified kernel image for given kernel name and copies it to "<efi_path>/EFI/Linux".
short_docstring_tokens: Builds unified kernel image for given kernel name and copies it to " <efi_path > / EFI / Linux " .
comment: """Builds unified kernel image for given kernel name and copies it to "<efi_path>/EFI/Linux".
  
          Unified kernel image contains kernel cmdline, os-release, kernel, initramfs and if configured
          (see configuration file) microcode image.
  
          see https://wiki.archlinux.org/title/systemd-boot#Preparing_a_unified_kernel_image
          """