summaryrefslogtreecommitdiffstats
path: root/make/system-linux.mk
blob: f12a8e1b593fe1577237635ee60ef3133c793eea (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
68
69
70
71
#############################################################
#
# System Linux kernel target
#
# This uses an existing linux kernel source tree on
# your build system, and makes no effort at compiling
# anything....
#
# You will probably want to change LINUX_SOURCE to
# point to wherever you installed you kernel.
#
#  -Erik
#
#############################################################
ifneq ($(filter $(TARGETS),system-linux),)

LINUX_SOURCE=/usr/src/linux
LINUX_DIR=$(BUILD_DIR)/linux
LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel
# Used by pcmcia-cs and others
LINUX_SOURCE_DIR=$(LINUX_SOURCE)

$(LINUX_DIR)/.configured:
	mkdir -p $(LINUX_DIR)/include
	(cd $(LINUX_DIR)/include; \
	for i in $(LINUX_SOURCE)/include/*; do ln -sf $$i ; done; \
	rm -f asm; \
	if [ "$(ARCH)" = "powerpc" ];then \
	    ln -fs asm-ppc asm; \
	elif [ "$(ARCH)" = "mips" ];then \
	    ln -fs asm-mips asm; \
	elif [ "$(ARCH)" = "mipsel" ];then \
	    ln -fs asm-mips asm; \
	elif [ "$(ARCH)" = "arm" ];then \
	    ln -fs asm-arm asm; \
	    (cd asm-arm; \
	    if [ ! -L proc ] ; then \
	    ln -fs proc-armv proc; \
	    ln -fs arch-ebsa285 arch; fi); \
	elif [ "$(ARCH)" = "cris" ];then \
	    ln -fs asm-cris asm; \
	else ln -fs asm-$(ARCH) asm; \
	fi)
	cp $(LINUX_SOURCE)/Makefile $(LINUX_DIR)/
	cp $(LINUX_SOURCE)/Rules.make $(LINUX_DIR)/
	touch $(LINUX_DIR)/.configured

$(LINUX_KERNEL): $(LINUX_DIR)/.configured

$(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
	mkdir -p $(STAGING_DIR)/include
	rm -rf $(STAGING_DIR)/include/linux
	cp -dpa $(LINUX_DIR)/include/linux $(STAGING_DIR)/include/
	rm -rf $(STAGING_DIR)/include/asm
	mkdir -p $(STAGING_DIR)/include/asm
	cp -dpa $(LINUX_DIR)/include/asm/* $(STAGING_DIR)/include/asm/
	rm -rf $(STAGING_DIR)/include/scsi
	mkdir -p $(STAGING_DIR)/include/scsi
	cp -dpa $(LINUX_DIR)/include/scsi/* $(STAGING_DIR)/include/scsi
	touch -c $(STAGING_DIR)/include/linux/version.h

system-linux: $(STAGING_DIR)/include/linux/version.h

system-linux-clean: clean
	rm -f $(LINUX_KERNEL)
	rm -rf $(LINUX_DIR)

system-linux-dirclean:
	rm -rf $(LINUX_DIR)

endif