disks that use a different sector size as the disk on which the image is produced.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--architecture=</option><arg>ARCH</arg></term>
+
+ <listitem><para>This option allows overriding the architecture used for architecture specific
+ partition types. For example, if set to <literal>arm64</literal> a partition type of
+ <literal>root-x86-64</literal> referenced in <filename>repart.d/</filename> drop-ins will be patched
+ dynamically to refer to <literal>root-arm64</literal> instead. Takes one of
+ <literal>alpha</literal>,
+ <literal>arc</literal>,
+ <literal>arm</literal>,
+ <literal>arm64</literal>,
+ <literal>ia64</literal>,
+ <literal>loongarch64</literal>,
+ <literal>mips-le</literal>,
+ <literal>mips64-le</literal>,
+ <literal>parisc</literal>,
+ <literal>ppc</literal>,
+ <literal>ppc64</literal>,
+ <literal>ppc64-le</literal>,
+ <literal>riscv32</literal>,
+ <literal>riscv64</literal>,
+ <literal>s390</literal>,
+ <literal>s390x</literal>,
+ <literal>tilegx</literal>,
+ <literal>x86</literal> or
+ <literal>x86-64</literal>.</para></listitem>
+ </varlistentry>
+
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
static char *arg_tpm2_public_key = NULL;
static uint32_t arg_tpm2_public_key_pcr_mask = UINT32_MAX;
static bool arg_split = false;
-static sd_id128_t *arg_filter_partitions = NULL;
+static GptPartitionType *arg_filter_partitions = NULL;
static size_t arg_n_filter_partitions = 0;
static FilterPartitionsType arg_filter_partitions_type = FILTER_PARTITIONS_NONE;
-static sd_id128_t *arg_defer_partitions = NULL;
+static GptPartitionType *arg_defer_partitions = NULL;
static size_t arg_n_defer_partitions = 0;
static uint64_t arg_sector_size = 0;
static ImagePolicy *arg_image_policy = NULL;
+static Architecture arg_architecture = _ARCHITECTURE_INVALID;
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
return false;
for (size_t i = 0; i < arg_n_filter_partitions; i++)
- if (sd_id128_equal(p->type.uuid, arg_filter_partitions[i]))
+ if (sd_id128_equal(p->type.uuid, arg_filter_partitions[i].uuid))
return arg_filter_partitions_type == FILTER_PARTITIONS_EXCLUDE;
return arg_filter_partitions_type == FILTER_PARTITIONS_INCLUDE;
assert(p);
for (size_t i = 0; i < arg_n_defer_partitions; i++)
- if (sd_id128_equal(p->type.uuid, arg_defer_partitions[i]))
+ if (sd_id128_equal(p->type.uuid, arg_defer_partitions[i].uuid))
return true;
return false;
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse partition type: %s", rvalue);
+ if (arg_architecture >= 0)
+ *type = gpt_partition_type_override_architecture(*type, arg_architecture);
+
return 0;
}
return 0;
}
-static int parse_partition_types(const char *p, sd_id128_t **partitions, size_t *n_partitions) {
+static int parse_partition_types(const char *p, GptPartitionType **partitions, size_t *n_partitions) {
int r;
assert(partitions);
if (!GREEDY_REALLOC(*partitions, *n_partitions + 1))
return log_oom();
- (*partitions)[(*n_partitions)++] = type.uuid;
+ (*partitions)[(*n_partitions)++] = type;
}
return 0;
" Take partitions of the specified types into account\n"
" but don't populate them yet\n"
" --sector-size=SIZE Set the logical sector size for the image\n"
+ " --architecture=ARCH Set the generic architecture for the image\n"
"\nSee the %s for details.\n",
program_invocation_short_name,
ansi_highlight(),
ARG_DEFER_PARTITIONS,
ARG_SECTOR_SIZE,
ARG_SKIP_PARTITIONS,
+ ARG_ARCHITECTURE,
};
static const struct option options[] = {
{ "exclude-partitions", required_argument, NULL, ARG_EXCLUDE_PARTITIONS },
{ "defer-partitions", required_argument, NULL, ARG_DEFER_PARTITIONS },
{ "sector-size", required_argument, NULL, ARG_SECTOR_SIZE },
+ { "architecture", required_argument, NULL, ARG_ARCHITECTURE },
{}
};
break;
+ case ARG_ARCHITECTURE:
+ r = architecture_from_string(optarg);
+ if (r < 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid architecture '%s'", optarg);
+
+ arg_architecture = r;
+ break;
+
case '?':
return -EINVAL;
if (arg_pretty < 0 && isatty(STDOUT_FILENO))
arg_pretty = true;
+ if (arg_architecture >= 0) {
+ FOREACH_ARRAY(p, arg_filter_partitions, arg_n_filter_partitions)
+ *p = gpt_partition_type_override_architecture(*p, arg_architecture);
+
+ FOREACH_ARRAY(p, arg_defer_partitions, arg_n_defer_partitions)
+ *p = gpt_partition_type_override_architecture(*p, arg_architecture);
+ }
+
return 1;
}