ia64/xen-unstable

view tools/xm-test/ramdisk/Makefile.am @ 13573:ee7c422c5f7b

[XM-TEST] Allow building of ramdisk on x86_64

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Tue Jan 23 11:39:32 2007 +0000 (2007-01-23)
parents fb38d0794f50
children 923b8dbb0fed
line source
1 #
2 # make existing:
3 #
4 # Download a pre-built ramdisk.
5 # INITRD = <Directory to download ramdisk from>
6 #
7 # make initrd.img:
8 #
9 # Make a ramdisk from scratch.
10 # BR_URL = <The URL of the Buildroot source code>
11 # BR_SNAPSHOT = 1 Set BR_URL to the upstream Buildroot daily snapshot.
12 # BR_ARCH = <The build architecture for the initrd>
13 #
15 INITRD ?= http://xm-test.xensource.com/ramdisks
17 BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/ppc\(64\)*/powerpc/' -e 's/x86_64/i386/')
19 @MK@ifdef BR_SNAPSHOT
20 @MK@ BR_URL = http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2
21 @MK@else
22 @MK@ BR_URL = http://xm-test.xensource.com/ramdisks/buildroot-20061023.tar.bz2
23 @MK@endif
24 BR_TAR = $(notdir $(BR_URL))
26 BR_SRC = buildroot
27 BR_IMG = $(BR_SRC)/rootfs.$(BR_ARCH).ext2
29 BR_ROOT = build_$(BR_ARCH)/root
31 EXTRA_DIST = skel configs patches
33 HVM_SCRIPT = bin/create_disk_image
35 XMTEST_MAJ_VER = $(shell echo @PACKAGE_VERSION@ | perl -pe 's/(\d+)\.(\d+)\.\d+/\1.\2/')
36 XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER)-$(BR_ARCH).img
37 XMTEST_DL_IMG = $(shell echo $(XMTEST_VER_IMG) | sed -e 's/x86_64/i386/g')
39 EXTRA_ROOT_DIRS = sys modules
41 BLKDRV = /lib/modules/$(shell uname -r)/kernel/drivers/xen/blkfront/xenblk.ko
42 NETDRV = /lib/modules/$(shell uname -r)/kernel/drivers/xen/netfront/xennet.ko
43 PKTDRV = /lib/modules/$(shell uname -r)/kernel/net/packet/af_packet.ko
46 if HVM
47 all: initrd.img disk.img
48 else
49 all: initrd.img
50 endif
52 $(BR_TAR):
53 wget $(BR_URL)
55 $(BR_SRC): $(BR_TAR)
56 tar xjf $(BR_TAR)
58 $(BR_IMG): $(BR_SRC)
59 cp configs/buildroot-$(BR_ARCH) $(BR_SRC)/.config
60 cp configs/busybox $(BR_SRC)/package/busybox/busybox.config
61 cp configs/uClibc $(BR_SRC)/toolchain/uClibc/uClibc.config
62 (for i in patches/buildroot/*.patch; do \
63 cd $(BR_SRC) && patch -p1 <../$$i && cd ..; done )
64 cd $(BR_SRC) && make oldconfig && make
66 $(XMTEST_VER_IMG): $(BR_IMG)
67 chmod a+x skel/etc/init.d/rcS
68 cd skel && mkdir -p $(EXTRA_ROOT_DIRS)
69 -[ -e "$(BLKDRV)" ] && cp $(BLKDRV) skel/modules
70 -[ -e "$(NETDRV)" ] && cp $(NETDRV) skel/modules
71 -[ -e "$(PKTDRV)" ] && cp $(PKTDRV) skel/modules
72 (cd skel; tar cf - .) \
73 | (cd $(BR_SRC)/$(BR_ROOT); tar xvf -)
74 cd $(BR_SRC) && make
75 cp $(BR_IMG) $(XMTEST_VER_IMG)
77 initrd.img: $(XMTEST_VER_IMG)
78 ln -sf $(XMTEST_VER_IMG) initrd.img
80 disk.img: existing
81 chmod a+x $(HVM_SCRIPT)
82 @if test ! "$(HVMKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
83 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -k $(HVMKERNEL) \
84 -d $(DRVDIR) -n $(NETDRV); \
85 elif test "$(HVMKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
86 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -d $(DRVDIR) -n $(NETDRV); \
87 elif test ! "$(HVMKERNEL)" = "no" -a "$(DRVDIR)" = "no"; then \
88 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -k $(HVMKERNEL) \
89 -n $(NETDRV); \
90 else \
91 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -n $(NETDRV); \
92 fi
94 existing:
95 @if [ -n "$(INITRD)" ] && [ ! -f $(XMTEST_VER_IMG) ] ; then \
96 if [ ! -f $(XMTEST_DL_IMG) ] ; then \
97 wget $(INITRD)/$(XMTEST_DL_IMG); \
98 fi; \
99 if [ "$(XMTEST_DL_IMG)" != "$(XMTEST_VER_IMG)" ] ; then \
100 ln -s $(XMTEST_DL_IMG) $(XMTEST_VER_IMG); \
101 fi \
102 fi
103 @if [ -f $(XMTEST_VER_IMG) ] ; then \
104 ln -sf $(XMTEST_VER_IMG) initrd.img; \
105 else \
106 echo Error, $(XMTEST_VER_IMG) not found; \
107 false; \
108 fi
110 clean-local: am_config_clean-local
112 am_config_clean-local:
113 rm -Rf buildroot
114 rm -f *~
115 rm -f initrd.img
116 rm -f $(BR_TAR)
117 rm -f disk.img