Skip to contentSkip to conversation

kvm tools, bios: Don't include glibc headers

RFC/PATCH Superseded Pekka Enberg 1 participant 3 messages Oct 25, 2011 KVM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

We should not include glibc headers from BIOS code which can't rely on glibc at runtime.

This patch fixes the following build breakage on 64-bit:

CC bios/e820.o
In file included from /usr/include/features.h:387:0,

                   from /usr/include/unistd.h:26,
                   from include/kvm/util.h:12,
                   from bios/e820.c:5:

/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated.
make: *** [bios/bios.bin.elf] Error 1

when built without the 'glibc-devel.i686' package on Fedora, for example.

Cc Asias He <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Sasha Levin <[email protected]>
---
 tools/kvm/README       |    2 +-
 tools/kvm/bios/e820.c  |    1 -
 tools/kvm/bios/int10.c |    3 ---
 3 files changed, 1 insertions(+), 5 deletions(-)
tools/kvm/README +1 -1
index 7cbf530..c262995 100644
@@ -102,7 +102,7 @@ For rpm based systems:
 32-bit:
 yum install glibc-devel
 64-bit:
-yum install glibc-devel glibc-devel.i686 glibc-static
+yum install glibc-devel glibc-static
 
 On 64-bit Arch Linux make sure the multilib repository is enabled in your
 /etc/pacman.conf and run
tools/kvm/bios/e820.c +0 -1
index 1eafb5b..a9bca29 100644
@@ -2,7 +2,6 @@
 
 #include "kvm/segment.h"
 #include "kvm/bios.h"
-#include "kvm/util.h"
 
 #include <asm/processor-flags.h>
 #include <asm/e820.h>
tools/kvm/bios/int10.c +0 -3
index 6387ca8..32f7c92 100644
@@ -1,12 +1,9 @@
 #include "kvm/segment.h"
 #include "kvm/bios.h"
-#include "kvm/util.h"
 #include "kvm/vesa.h"
 
 #include "bios/memcpy.h"
 
-#include <stdint.h>
-
 #define VESA_MAGIC ('V' + ('E' << 8) + ('S' << 16) + ('A' << 24))
 
 /* VESA General Information table */
Signature · 1 line
1.7.6.4
#1 lore raw

PATCH 1/2 kvm tools: Kill double slash from kvm__get_dir()

In preparation for showing kvm__get_dir() path to the user, kill the unnecessary double slash to make the output more readable.

Cc Asias He <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Sasha Levin <[email protected]>
---
 tools/kvm/include/kvm/kvm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/kvm/include/kvm/kvm.h +1 -1
index 2b3024a..38253da 100644
@@ -22,7 +22,7 @@
 #define SIGKVMSTOP		(SIGRTMIN + 4)
 #define SIGKVMRESUME		(SIGRTMIN + 5)
 
-#define KVM_PID_FILE_PATH	"/.kvm-tools/"
+#define KVM_PID_FILE_PATH	".kvm-tools/"
 #define HOME_DIR		getenv("HOME")
 
 struct kvm {
Signature · 1 line
1.7.6.4
#2 lore raw

PATCH 2/2 kvm tools: Improve "kvm setup" info and error messages

In reply to Pekka Enberg

This patch improves the output of 'kvm setup' as follows:

[penberg@tux kvm]$ ./kvm setup

kvm setup creates a new rootfs under /home/penberg//.kvm-tools/. This can be used later by the '-d' parameter of 'kvm run'.

usage: kvm setup [name]

[penberg@tux kvm]$ ./kvm setup test-box
A new rootfs 'test-box' has been created in '/home/penberg//.kvm-tools/test-box'.

You can now start it by running the following command:

kvm run -d test-box

[penberg@tux kvm]$ ./kvm setup test-box
Unable to create rootfs in /home/penberg//.kvm-tools/test-box: File exists

Cc Asias He <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Sasha Levin <[email protected]>
---
 tools/kvm/builtin-setup.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
tools/kvm/builtin-setup.c +9 -6
index dce1748..7deb0ed 100644
@@ -46,8 +46,9 @@ static void parse_setup_options(int argc, const char **argv)
 
 void kvm_setup_help(void)
 {
-	printf("\nkvm setup creates a new rootfs and stores it under ~/.kvm-tools/ .\n"
-		"This can be used later by the '-d' parameter of 'kvm run'.\n");
+	printf("\nkvm setup creates a new rootfs under %s.\n"
+		"This can be used later by the '-d' parameter of 'kvm run'.\n",
+		kvm__get_dir());
 	usage_with_options(setup_usage, setup_options);
 }
 
@@ -215,11 +216,13 @@ int kvm_cmd_setup(int argc, const char **argv, const char *prefix)
 
 	r = do_setup(instance_name);
 	if (r == 0)
-		pr_info("Your new rootfs named %s has been created.\n"
-			"You can now start it by running 'kvm run -d %s'\n",
-			instance_name, instance_name);
+		printf("A new rootfs '%s' has been created in '%s%s'.\n\n"
+			"You can now start it by running the following command:\n\n"
+			"  kvm run -d %s\n",
+			instance_name, kvm__get_dir(), instance_name, instance_name);
 	else
-		perror("Error creating rootfs");
+		printf("Unable to create rootfs in %s%s: %s\n",
+			kvm__get_dir(), instance_name, strerror(errno));
 
 	return r;
 }
Signature · 1 line
1.7.6.4