direct-io.hg

view tools/xm-test/ramdisk/Makefile.am @ 12800:212511a8f202

Download and symlink the i386 version of the ramdisk when running on x86_64.
This means that people don't need to explicitly set BR_ARCH.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Dec 08 10:32:48 2006 +0000 (2006-12-08)
parents 83b34fbc6c75
children fb38d0794f50
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/')
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
41 if HVM
42 all: initrd.img disk.img
43 else
44 all: initrd.img
45 endif
47 $(BR_TAR):
48 wget $(BR_URL)
50 $(BR_SRC): $(BR_TAR)
51 tar xjf $(BR_TAR)
53 $(BR_IMG): $(BR_SRC)
54 cp configs/buildroot-$(BR_ARCH) $(BR_SRC)/.config
55 cp configs/busybox $(BR_SRC)/package/busybox/busybox.config
56 cp configs/uClibc $(BR_SRC)/toolchain/uClibc/uClibc.config
57 (for i in patches/buildroot/*.patch; do \
58 cd $(BR_SRC) && patch -p1 <../$$i && cd ..; done )
59 cd $(BR_SRC) && make oldconfig && make
61 $(XMTEST_VER_IMG): $(BR_IMG)
62 chmod a+x skel/etc/init.d/rcS
63 (cd skel; mkdir -p $(EXTRA_ROOT_DIRS); tar cf - .) \
64 | (cd $(BR_SRC)/$(BR_ROOT); tar xvf -)
65 cd $(BR_SRC) && make
66 cp $(BR_IMG) $(XMTEST_VER_IMG)
68 initrd.img: $(XMTEST_VER_IMG)
69 ln -sf $(XMTEST_VER_IMG) initrd.img
71 disk.img: existing
72 chmod a+x $(HVM_SCRIPT)
73 @if test ! "$(HVMKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
74 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -k $(HVMKERNEL) \
75 -d $(DRVDIR) -n $(NETDRV); \
76 elif test "$(HVMKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
77 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -d $(DRVDIR) -n $(NETDRV); \
78 elif test ! "$(HVMKERNEL)" = "no" -a "$(DRVDIR)" = "no"; then \
79 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -k $(HVMKERNEL) \
80 -n $(NETDRV); \
81 else \
82 $(HVM_SCRIPT) -r $(XMTEST_VER_IMG) -n $(NETDRV); \
83 fi
85 existing:
86 @if [ -n "$(INITRD)" ] && [ ! -f $(XMTEST_VER_IMG) ] ; then \
87 if [ ! -f $(XMTEST_DL_IMG) ] ; then \
88 wget $(INITRD)/$(XMTEST_DL_IMG); \
89 fi; \
90 if [ "$(XMTEST_DL_IMG)" != "$(XMTEST_VER_IMG)" ] ; then \
91 ln -s $(XMTEST_DL_IMG) $(XMTEST_VER_IMG); \
92 fi \
93 fi
94 @if [ -f $(XMTEST_VER_IMG) ] ; then \
95 ln -sf $(XMTEST_VER_IMG) initrd.img; \
96 else \
97 echo Error, $(XMTEST_VER_IMG) not found; \
98 false; \
99 fi
101 clean-local: am_config_clean-local
103 am_config_clean-local:
104 rm -Rf buildroot
105 rm -f *~
106 rm -f initrd.img
107 rm -f $(BR_TAR)
108 rm -f disk.img