[PATCH] qemubuilder: Add qemu machine type overwrite.
Benedikt Spranger
b.spranger at linutronix.de
Thu Nov 12 19:24:13 UTC 2015
qemubuilder determine the build architecture to select the qemu machine
type from a hardcoded list. This prohibits to build armel and armhf using
the same kernel. Add a qemu machine type overwrite.
Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
---
parameter.c | 14 ++++++++++++++
parameter.h | 1 +
qemuarch.c | 7 ++++++-
qemuarch.h | 2 +-
qemubuilder.c | 2 +-
5 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/parameter.c b/parameter.c
index 8c015a6..54abf4c 100644
--- a/parameter.c
+++ b/parameter.c
@@ -146,6 +146,14 @@ int load_config_file(const char* config, pbuilderconfig* pc)
{
pc->arch=strdup_strip_quote(delim);
}
+ else if (!strcmp(buf, "MACHINE"))
+ {
+ pc->mach=strdup_strip_quote(delim);
+ }
+ else if (!strcmp(buf, "MACH"))
+ {
+ pc->mach=strdup_strip_quote(delim);
+ }
else if (!strcmp(buf, "BASEPATH"))
{
pc->basepath=strdup_strip_quote(delim);
@@ -246,6 +254,7 @@ int cpbuilder_dumpconfig(pbuilderconfig* pc)
DUMPSTR(initrd);
DUMPINT(memory_megs);
DUMPSTR(arch);
+ DUMPSTR(mach);
return 0;
}
@@ -291,6 +300,7 @@ int parse_parameter(int ac, char** av,
{"inputfile", required_argument, 0, 0},
{"outputfile", required_argument, 0, 0},
{"architecture", required_argument, 0, 0},
+ {"machine", required_argument, 0, 0},
{"http-proxy", required_argument, 0, 0},
/* cowbuilder specific options */
@@ -448,6 +458,10 @@ int parse_parameter(int ac, char** av,
{
pc.arch=strdup(optarg);
}
+ else if (!strcmp(long_options[index_point].name,"machine"))
+ {
+ pc.mach=strdup(optarg);
+ }
else if (!strcmp(long_options[index_point].name,"arch-diskdevice"))
{
pc.arch_diskdevice=strdup(optarg);
diff --git a/parameter.h b/parameter.h
index 9ef23a7..d4eac52 100644
--- a/parameter.h
+++ b/parameter.h
@@ -57,6 +57,7 @@ typedef struct pbuilderconfig
char* smp;
int memory_megs; /* megabytes of memory */
char* arch;
+ char* mach;
char* arch_diskdevice;
enum {
diff --git a/qemuarch.c b/qemuarch.c
index 3fe7f11..5003144 100644
--- a/qemuarch.c
+++ b/qemuarch.c
@@ -160,8 +160,13 @@ const char* qemu_arch_qemu(const char* arch)
/**
* arch-specific routine; the machine spec for this arch
*/
-const char* qemu_arch_qemumachine(const char* arch)
+const char* qemu_arch_qemumachine(const struct pbuilderconfig* pc)
{
+ const char *arch = pc->arch;
+
+ if (pc->mach)
+ return strdup(pc->mach);
+
if (!strcmp(arch, "arm") ||
!strcmp(arch, "armel"))
return "versatilepb";
diff --git a/qemuarch.h b/qemuarch.h
index 12d989e..c374a6f 100644
--- a/qemuarch.h
+++ b/qemuarch.h
@@ -12,7 +12,7 @@ const int qemu_create_arch_serialdevice(const char* basedir, const char* arch);
const int qemu_create_arch_devices(const char* basedir, const char* arch);
char* get_host_dpkg_arch();
const char* qemu_arch_qemu(const char* arch);
-const char* qemu_arch_qemumachine(const char* arch);
+const char* qemu_arch_qemumachine(const struct pbuilderconfig* pc);
const char* qemu_arch_tty(const char* arch);
#endif
diff --git a/qemubuilder.c b/qemubuilder.c
index 4436703..904ea4f 100755
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -267,7 +267,7 @@ static int fork_qemu(const char* hda, const char* hdb, const struct pbuilderconf
{
/* this is the child process */
const char* qemu = qemu_arch_qemu(pc->arch);
- const char* machine = qemu_arch_qemumachine(pc->arch);
+ const char* machine = qemu_arch_qemumachine(pc);
char* hda_command;
char* hdb_command;
char* append_command;
--
2.6.2
More information about the Pbuilder-maint
mailing list