Add hping to the ramdisk. Also, do some very simple versioning.
This is the first change to the ramdisk since v0.1.0. So, we now build
the image as initrd-X.Y.img, and link initrd.img to it. This lets us
have a few checks to make sure that people rebuild their ramdisks when
necessary.
Signed-off-by: Dan Smith <danms@xxxxxxxxxx>
# HG changeset patch
# User dan@xxxxxxxxxxxxxxxxxxxxx
# Node ID 0d1d24e1bdfc219a2babf8f2ae2e5df7646fcb8e
# Parent f6fdb6e0d3c96241354fe87cb264d740dfe4087c
Add hping to the ramdisk. Also, do some very simple versioning.
This is the first change to the ramdisk since v0.1.0. So, we now build
the image as initrd-X.Y.img, and link initrd.img to it. This lets us
have a few checks to make sure that people rebuild their ramdisks when
necessary.
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/Makefile.am
--- a/tools/xm-test/Makefile.am Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/Makefile.am Thu Nov 17 21:50:51 2005
@@ -1,5 +1,8 @@
SUBDIRS = ramdisk tests
EXTRA_DIST = lib runtest.sh mkreport
+
+existing:
+ $(MAKE) -C ramdisk existing
# Remove any pyc's, CVS dirs, and prune the skel dirs
dist-hook:
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/README
--- a/tools/xm-test/README Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/README Thu Nov 17 21:50:51 2005
@@ -45,11 +45,15 @@
NB: If you have the initrd.img from another installation of xm-test,
you can copy it into the ramdisk directory to eliminate the need to
rebuild it. If you do this, there is no need to run 'make' again.
-Simply copy the initrd.img file into ramdisk/ and then run the
-runtest.sh script. Note that in general, you should not attempt to
-use a ramdisk from a previous minor version of xm-test (i.e., don't
-use a ramdisk from 0.4.0 with 0.5.0. 0.5.0 should work for 0.5.3
-though)
+Simply copy the initrd-X.Y.img file into ramdisk/ and then run:
+
+ # make existing
+
+This will set up the link so that xm-test will use the existing
+ramdisk. Next, just run "runtest.sh" normally. Note that in general,
+you should not attempt to use a ramdisk from a previous minor version
+of xm-test (i.e., don't use a ramdisk from 0.4.0 with 0.5.0. 0.5.0
+should work for 0.5.3 though)
Running
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/configure.ac
--- a/tools/xm-test/configure.ac Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/configure.ac Thu Nov 17 21:50:51 2005
@@ -1,7 +1,7 @@
# xm-test configure.ac input script
# Basic header information
-AC_INIT([xm-test], [0.5.0])
+AC_INIT([xm-test], [0.6.0])
AM_INIT_AUTOMAKE([1.7 foreign])
# Check for dependencies
@@ -65,5 +65,6 @@
lib/XmTestLib/config.py
])
+AC_OUTPUT
-AC_OUTPUT
+chmod a+x lib/XmTestReport/xmtest.py
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/lib/XmTestReport/xmtest.py.in
--- a/tools/xm-test/lib/XmTestReport/xmtest.py.in Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/lib/XmTestReport/xmtest.py.in Thu Nov 17 21:50:51 2005
@@ -1,3 +1,15 @@
#!/usr/bin/python
XM_TEST_VERSION = "@PACKAGE_VERSION@"
+
+if __name__ == "__main__":
+ import re
+
+ match = re.match("^(\d+)\.(\d+)\.(\d+)$", XM_TEST_VERSION)
+
+ print "XM_TEST_VERSION=%s" % XM_TEST_VERSION
+ if match:
+ print "XM_TEST_MAJ=%s" % match.group(1)
+ print "XM_TEST_MIN=%s" % match.group(2)
+ print "XM_TEST_REV=%s" % match.group(3)
+
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/ramdisk/Makefile.am
--- a/tools/xm-test/ramdisk/Makefile.am Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/ramdisk/Makefile.am Thu Nov 17 21:50:51 2005
@@ -1,5 +1,5 @@
-EXTRA_DIST = skel configs
+EXTRA_DIST = skel configs patches
BR_TAR = buildroot-20050823.tar.bz2
BR_URL = http://buildroot.uclibc.org/downloads/snapshots/$(BR_TAR)
@@ -8,6 +8,9 @@
BR_IMG = $(BR_SRC)/rootfs.i386.ext2
BR_ROOT = build_i386/root
+
+XMTEST_MAJ_VER = $(shell echo @PACKAGE_VERSION@ | perl -pe
's/(\d+)\.(\d+)\.\d+/\1.\2/')
+XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER).img
all: initrd.img
@@ -21,12 +24,21 @@
cp configs/buildroot $(BR_SRC)/.config
cp configs/busybox $(BR_SRC)/package/busybox/busybox.config
cp configs/uClibc $(BR_SRC)/toolchain/uClibc/uClibc.config
+ (for i in patches/buildroot/*.patch; do \
+ cd $(BR_SRC) && patch -p1 <../$$i; done )
cd $(BR_SRC) && make oldconfig && make
-initrd.img: $(BR_IMG)
+$(XMTEST_VER_IMG): $(BR_IMG)
(cd skel; tar cf - .) | (cd $(BR_SRC)/$(BR_ROOT); tar xvf -)
cd $(BR_SRC) && make
- cp $(BR_IMG) initrd.img
+ cp $(BR_IMG) initrd-$(XMTEST_MAJ_VER).img
+
+initrd.img: $(XMTEST_VER_IMG)
+ ln -sf $(XMTEST_VER_IMG) initrd.img
+
+existing:
+ @[ -f $(XMTEST_VER_IMG) ] && ln -sf $(XMTEST_VER_IMG) initrd.img || \
+ echo Error, $(XMTEST_VER_IMG) not found
clean-local: am_config_clean-local
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/ramdisk/configs/buildroot
--- a/tools/xm-test/ramdisk/configs/buildroot Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/ramdisk/configs/buildroot Thu Nov 17 21:50:51 2005
@@ -225,6 +225,7 @@
# BR2_PACKAGE_WIRELESS_TOOLS is not set
# BR2_PACKAGE_XORG is not set
# BR2_PACKAGE_ZLIB is not set
+BR2_PACKAGE_HPING=y
#
# Target Options
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc tools/xm-test/runtest.sh
--- a/tools/xm-test/runtest.sh Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/runtest.sh Thu Nov 17 21:50:51 2005
@@ -61,19 +61,31 @@
fi
# See if the ramdisk has been built
- rdsize=$(stat -c %s ramdisk/initrd.img 2>/dev/null)
+ rdsize=$(stat -Lc %s ramdisk/initrd.img 2>/dev/null)
if [ -z "$rdsize" ] || [ $rdsize -le 16384 ]; then
echo "Cannot find a valid ramdisk. You need to run \"make\" or"
echo "copy in a previously-built ramdisk to the ramdisk/ directory"
exit 1
fi
+ # Figure out the version of the ramdisk link and compare it
+ # to what it should be as a cheap way of making sure we're
+ # using the right version
+ realrd=$(readlink ramdisk/initrd.img)
+ eval $(./lib/XmTestReport/xmtest.py)
+ rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}.img"
+ if [ "$realrd" != "$rrdver" ]; then
+ echo "Error: ramdisk/initrd.img is from an old version"
+ echo "You need to build a ramdisk from at least
${XM_TEST_MAJ}.${XM_TEST_MIN}"
+ exit 1
+ fi
+
# See if xend is running
if ! xm list >/dev/null 2>&1; then
echo "'xm list' failed: is xend running?"
exit 1
fi
-
+
}
# Get contact info if needed
diff -r f6fdb6e0d3c9 -r 0d1d24e1bdfc
tools/xm-test/ramdisk/patches/buildroot/hping.patch
--- /dev/null Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/ramdisk/patches/buildroot/hping.patch Thu Nov 17
21:50:51 2005
@@ -0,0 +1,67 @@
+diff -Naur buildroot.orig/package/Config.in buildroot/package/Config.in
+--- buildroot.orig/package/Config.in 2005-11-15 07:30:21.000000000 -0800
++++ buildroot/package/Config.in 2005-11-15 07:30:54.000000000 -0800
+@@ -118,6 +118,6 @@
+ source "package/wireless-tools/Config.in"
+ source "package/xorg/Config.in"
+ source "package/zlib/Config.in"
+-
++source "package/hping/Config.in"
+
+ endmenu
+diff -Naur buildroot.orig/package/hping/Config.in
buildroot/package/hping/Config.in
+--- buildroot.orig/package/hping/Config.in 1969-12-31 16:00:00.000000000
-0800
++++ buildroot/package/hping/Config.in 2005-11-14 14:13:20.000000000 -0800
+@@ -0,0 +1,5 @@
++config BR2_PACKAGE_HPING
++ bool "hping"
++ default y
++ help
++ This is the hping package
+diff -Naur buildroot.orig/package/hping/hping.mk
buildroot/package/hping/hping.mk
+--- buildroot.orig/package/hping/hping.mk 1969-12-31 16:00:00.000000000
-0800
++++ buildroot/package/hping/hping.mk 2005-11-14 15:11:06.000000000 -0800
+@@ -0,0 +1,43 @@
++# Taken from the buildroot examples
++
++HPING_VERSION = 2.0.0-rc3
++HPING_TBALL = hping$(HPING_VERSION).tar.gz
++HPING_URL = http://www.hping.org/$(HPING_TBALL)
++HPING_DIR = $(BUILD_DIR)/hping2-rc3
++HPING_TARGET_BINARY = usr/bin/hping
++HPING_BINARY = hping
++
++$(DL_DIR)/$(HPING_TBALL):
++ $(WGET) -P $(DL_DIR) $(HPING_URL)
++
++$(HPING_DIR)/.source: $(DL_DIR)/$(HPING_TBALL)
++ tar xzf $(DL_DIR)/$(HPING_TBALL) -C $(BUILD_DIR)
++ touch $(HPING_DIR)/.source
++
++$(HPING_DIR)/.configured: $(HPING_DIR)/.source
++ (cd $(HPING_DIR); \
++ ./configure; )
++ cat $(HPING_DIR)/Makefile | grep -v './hping2 -v' > $(HPING_DIR)/foo
++ mv $(HPING_DIR)/foo $(HPING_DIR)/Makefile
++ touch $(HPING_DIR)/.configured
++
++$(HPING_DIR)/$(HPING_BINARY): $(HPING_DIR)/.configured
++ $(MAKE) CC=$(TARGET_CC) -C $(HPING_DIR)
++
++$(TARGET_DIR)/$(HPING_TARGET_BINARY): $(HPING_DIR)/$(HPING_BINARY)
++ cp $(HPING_DIR)/hping2 $(TARGET_DIR)/bin
++
++hping: $(TARGET_DIR)/$(HPING_TARGET_BINARY)
++
++hping-clean:
++ $(MAKE) prefix=$(TARGET_DIR)/usr -C $(HPING_DIR) uninstall
++ -$(MAKE) -C $(HPING_DIR) clean
++
++hping-dirclean:
++ rm -Rf $(HPING_DIR)
++
++ifeq ($(strip $(BR2_PACKAGE_HPING)),y)
++TARGETS += hping
++endif
++
++
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|