* wimlib_export_image(), with the exception of the call to wimlib_free(). */
#define WIMLIB_EXPORT_FLAG_GIFT 0x00000008
+/**
+ * Mark each exported image as WIMBoot-compatible.
+ *
+ * Note: by itself, this does change the destination WIM's compression type, nor
+ * does it add the file \Windows\System32\WimBootCompress.ini in the WIM image.
+ * Before writing the destination WIM, it's recommended to do something like:
+ *
+ * \code
+ * wimlib_set_output_compression_type(wim, WIMLIB_COMPRESSION_TYPE_XPRESS);
+ * wimlib_set_output_chunk_size(wim, 4096);
+ * wimlib_add_tree(wim, image, L"myconfig.ini",
+ * L"\\Windows\\System32\\WimBootCompress.ini", 0);
+ * \endcode
+ */
+#define WIMLIB_EXPORT_FLAG_WIMBOOT 0x00000010
+
/** @} */
/** @ingroup G_extracting_wims
* @{ */
{T("rebuild"), no_argument, NULL, IMAGEX_REBUILD_OPTION},
{T("pipable"), no_argument, NULL, IMAGEX_PIPABLE_OPTION},
{T("not-pipable"), no_argument, NULL, IMAGEX_NOT_PIPABLE_OPTION},
+ {T("wimboot"), no_argument, NULL, IMAGEX_WIMBOOT_OPTION},
{NULL, 0, NULL, 0},
};
case IMAGEX_NOT_PIPABLE_OPTION:
write_flags |= WIMLIB_WRITE_FLAG_NOT_PIPABLE;
break;
+ case IMAGEX_WIMBOOT_OPTION:
+ export_flags |= WIMLIB_EXPORT_FLAG_WIMBOOT;
+ break;
default:
goto out_usage;
}
if (compression_type == WIMLIB_COMPRESSION_TYPE_INVALID) {
/* The user did not specify a compression type; default
- * to that of the source WIM, unless --pack-streams or
- * --solid was specified. */
+ * to that of the source WIM, unless --pack-streams,
+ * --solid, or --wimboot was specified. */
if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS)
compression_type = WIMLIB_COMPRESSION_TYPE_LZMS;
+ else if (export_flags & WIMLIB_EXPORT_FLAG_WIMBOOT)
+ compression_type = WIMLIB_COMPRESSION_TYPE_XPRESS;
else
compression_type = src_info.compression_type;
}
if (ret)
goto out_free_src_wim;
- /* Use same chunk size if compression type is the same. */
- if (compression_type == src_info.compression_type &&
- chunk_size == UINT32_MAX)
+ if ((export_flags & WIMLIB_EXPORT_FLAG_WIMBOOT)
+ && compression_type == WIMLIB_COMPRESSION_TYPE_XPRESS)
+ {
+ /* For --wimboot export, use small XPRESS chunks. */
+ wimlib_set_output_chunk_size(dest_wim, 4096);
+ } else if (compression_type == src_info.compression_type &&
+ chunk_size == UINT32_MAX)
+ {
+ /* Use same chunk size if compression type is the same. */
wimlib_set_output_chunk_size(dest_wim, src_info.chunk_size);
+ }
}
if (chunk_size != UINT32_MAX) {
if (export_flags & ~(WIMLIB_EXPORT_FLAG_BOOT |
WIMLIB_EXPORT_FLAG_NO_NAMES |
WIMLIB_EXPORT_FLAG_NO_DESCRIPTIONS |
- WIMLIB_EXPORT_FLAG_GIFT))
+ WIMLIB_EXPORT_FLAG_GIFT |
+ WIMLIB_EXPORT_FLAG_WIMBOOT))
return WIMLIB_ERR_INVALID_PARAM;
if (src_wim == NULL || dest_wim == NULL)
dest_wim->hdr.boot_idx = dest_wim->hdr.image_count;
}
+ /* Possibly set WIMBoot flag */
+ if (export_flags & WIMLIB_EXPORT_FLAG_WIMBOOT) {
+ wim_info_set_wimboot(dest_wim->wim_info,
+ dest_wim->hdr.image_count,
+ true);
+ }
+
}
/* Set the reparse point fixup flag on the destination WIM if the flag
* is set on the source WIM. */