summaryrefslogtreecommitdiffstats
path: root/make/user-mode-linux.mk
blob: f7dddccc76055f9e6e02b04a0b663113777613d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#############################################################
#
# Linux kernel targets
#
#############################################################
UMLINUX_DIR=$(BUILD_DIR)/linux-2.4.19
LINUX_DIR=$(UMLINUX_DIR)
UMLINUX_SOURCE=linux-2.4.19.tar.bz2
UMLINUX_SITE=http://ftp.us.kernel.org/pub/linux/kernel/v2.4
UMLINUX_PATCH_1:=uml-patch-2.4.19-5.bz2
UMLINUX_PATCH_1_SITE:=http://telia.dl.sourceforge.net/sourceforge/user-mode-linux
UMLINUX_KCONFIG=$(SOURCE_DIR)/linux-uml.config

$(DL_DIR)/$(UMLINUX_SOURCE):
	wget -P $(DL_DIR) --passive-ftp $(UMLINUX_SITE)/$(UMLINUX_SOURCE)

$(DL_DIR)/$(UMLINUX_PATCH_1):
	wget -P $(DL_DIR) --passive-ftp $(UMLINUX_PATCH_1_SITE)/$(UMLINUX_PATCH_1)

user-mode-linux-source: $(DL_DIR)/$(UMLINUX_SOURCE) $(DL_DIR)/$(UMLINUX_PATCH_1)

$(UMLINUX_DIR)/.unpacked: $(DL_DIR)/$(UMLINUX_SOURCE) $(DL_DIR)/$(UMLINUX_PATCH_1)
	bzcat $(DL_DIR)/$(UMLINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
	touch $(UMLINUX_DIR)/.unpacked

$(UMLINUX_DIR)/.patched: $(UMLINUX_DIR)/.unpacked
	bzcat $(DL_DIR)/$(UMLINUX_PATCH_1) | patch -d $(UMLINUX_DIR) -p1
	touch $(UMLINUX_DIR)/.patched

$(UMLINUX_DIR)/.set_arch: $(UMLINUX_DIR)/.patched
	perl -i -p -e "s/^ARCH :=.*/ARCH:=um/g;" $(UMLINUX_DIR)/Makefile
	touch $(UMLINUX_DIR)/.set_arch

$(UMLINUX_DIR)/.configured:  $(UMLINUX_DIR)/.set_arch  $(UMLINUX_KCONFIG)
	cp $(UMLINUX_KCONFIG) $(UMLINUX_DIR)/.config
	make -C $(UMLINUX_DIR) oldconfig include/linux/version.h
	touch $(UMLINUX_DIR)/.configured

$(UMLINUX_DIR)/.depend_done:  $(UMLINUX_DIR)/.configured
	make -C $(UMLINUX_DIR) dep
	touch $(UMLINUX_DIR)/.depend_done

$(UMLINUX_DIR)/linux: $(UMLINUX_DIR)/.depend_done
	make -C $(UMLINUX_DIR) linux

$(LINUX_KERNEL): $(UMLINUX_DIR)/linux
	cp -fa $(UMLINUX_DIR)/linux $(LINUX_KERNEL)

user-mode-linux: $(LINUX_KERNEL)

# Renamed so it is not cleaned by default on a make clean
user-mode-linux_clean: clean
	rm -f $(LINUX_KERNEL)
	-make -C $(UMLINUX_DIR) clean

user-mode-linux-dirclean:
	rm -rf $(UMLINUX_DIR)

#############################################################
#
# Setup the kernel headers, but don't compile anything for the target yet,
# since we still need to build a cross-compiler to do that little task for
# us...  Try to work around this little chicken-and-egg problem..
#
#############################################################
linux_headers: $(UMLINUX_DIR)/.configured