make kernel_menuconfig work without target toolchain
[openwrt/svn-archive/archive.git] / include / kernel-build.mk
index 03b4769f4bb1ba095084358f8dbdfa75dbc1bce1..23e694dc0c11f10136cdb653cd846da9338347e8 100644 (file)
@@ -21,20 +21,23 @@ endif
 ifneq ($(CONFIG_PCMCIA),)
   FEATURES += pcmcia
 endif
+ifneq ($(CONFIG_VIDEO_DEV),)
+  FEATURES += video
+endif
 
 # remove duplicates
 FEATURES:=$(sort $(FEATURES))
 
 # For target profile selection - the default set
-DEFAULT_PACKAGES:=base-files libgcc uclibc bridge busybox dnsmasq dropbear iptables mtd ppp ppp-mod-pppoe mtd
+DEFAULT_PACKAGES:=base-files libgcc uclibc bridge busybox dnsmasq dropbear iptables mtd ppp ppp-mod-pppoe mtd kmod-ipt-nathelper
 
 ifeq ($(DUMP),1)
   all: dumpinfo
 else
   all: compile
 endif
-KERNEL:=2.$(word 2,$(subst ., ,$(strip $(LINUX_VERSION))))
 
+include $(INCLUDE_DIR)/kernel-version.mk
 include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/kernel.mk
 
@@ -56,6 +59,9 @@ KERNELNAME=
 ifneq (,$(findstring x86,$(BOARD)))
   KERNELNAME="bzImage"
 endif
+ifneq (,$(findstring rdc,$(BOARD)))
+  KERNELNAME="bzImage"
+endif
 ifneq (,$(findstring ppc,$(BOARD)))
   KERNELNAME="uImage"
 endif
@@ -63,8 +69,9 @@ endif
 
 define Kernel/Prepare/Default
        bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
-       [ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) $(GENERIC_PLATFORM_DIR)/patches 
-       [ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches
+       if [ -d $(GENERIC_PLATFORM_DIR)/patches ]; then $(PATCH) $(LINUX_DIR) $(GENERIC_PLATFORM_DIR)/patches; fi
+       if [ -d ./files ]; then $(CP) ./files/* $(LINUX_DIR)/; fi
+       if [ -d ./patches ]; then $(PATCH) $(LINUX_DIR) ./patches; fi
 endef
 define Kernel/Prepare
        $(call Kernel/Prepare/Default)
@@ -85,7 +92,6 @@ define Kernel/Configure/2.6
 endef
 define Kernel/Configure/Default
        @$(CP) $(LINUX_CONFIG) $(LINUX_DIR)/.config
-       $(call Kernel/Configure/$(KERNEL))
 endef
 define Kernel/Configure
        $(call Kernel/Configure/Default)
@@ -156,6 +162,7 @@ define BuildKernel
 
   $(LINUX_DIR)/.configured: $(LINUX_DIR)/.prepared $(LINUX_CONFIG)
        $(call Kernel/Configure)
+       $(call Kernel/Configure/$(KERNEL))
        touch $$@
 
   $(LINUX_DIR)/.modules: $(LINUX_DIR)/.configured
@@ -203,10 +210,15 @@ endef
 define Profile
   $(eval $(call Profile/Default))
   $(eval $(call Profile/$(1)))
+  $(eval $(call shexport,Profile/$(1)/Description))
   DUMPINFO += \
        echo "Target-Profile: $(1)"; \
        echo "Target-Profile-Name: $(NAME)"; \
-       echo "Target-Profile-Packages: $(PACKAGES)"; 
+       echo "Target-Profile-Packages: $(PACKAGES)"; \
+       echo "Target-Profile-Description:"; \
+       getvar "$(call shvar,Profile/$(1)/Description)"; \
+       echo "@@"; \
+       echo;
 endef
 
 $(eval $(call shexport,Target/Description))
@@ -214,6 +226,14 @@ $(eval $(call shexport,Target/Description))
 download: $(DL_DIR)/$(LINUX_SOURCE)
 prepare: $(LINUX_DIR)/.configured $(TMP_DIR)/.kernel.mk
 compile: $(LINUX_DIR)/.modules
+menuconfig: $(LINUX_DIR)/.prepared FORCE
+       $(call Kernel/Configure)
+       $(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) menuconfig
+       $(SCRIPT_DIR)/config.pl $(LINUX_DIR)/.config > $(PLATFORM_DIR)/config
+ifeq ($(KERNEL),2.6)
+       $(SCRIPT_DIR)/config.pl '>' $(GENERIC_PLATFORM_DIR)/config-template $(LINUX_DIR)/.config > $(PLATFORM_DIR)/config-diff 
+endif
+
 install: $(LINUX_DIR)/.image
 
 clean: FORCE