summaryrefslogtreecommitdiffstats
path: root/make/user-mode-linux.mk
diff options
context:
space:
mode:
Diffstat (limited to 'make/user-mode-linux.mk')
-rw-r--r--make/user-mode-linux.mk54
1 files changed, 54 insertions, 0 deletions
diff --git a/make/user-mode-linux.mk b/make/user-mode-linux.mk
new file mode 100644
index 000000000..930e24915
--- /dev/null
+++ b/make/user-mode-linux.mk
@@ -0,0 +1,54 @@
+#############################################################
+#
+# Linux kernel targets
+#
+#############################################################
+UMLINUX_DIR=$(BUILD_DIR)/linux
+UMLINUX_SOURCE=linux-2.4.18.tar.bz2
+UMLINUX_SITE=http://ftp.us.kernel.org/pub/linux/kernel/v2.4
+UMLINUX_PATCH_1:=uml-patch-2.4.18-19.bz2
+UMLINUX_PATCH_1_SITE:=http://prdownloads.sourceforge.net/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)/.config: $(UMLINUX_DIR)/.set_arch
+ cp $(UMLINUX_KCONFIG) $(UMLINUX_DIR)/.config
+ make -C $(UMLINUX_DIR) oldconfig
+ touch -c $(UMLINUX_DIR)/.config
+
+$(UMLINUX_DIR)/linux: $(UMLINUX_DIR)/.config
+ make -C $(UMLINUX_DIR) dep
+ 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)
+