source: freewrt/mk/kernel.mk@ 655dec8

Last change on this file since 655dec8 was 081877a, checked in by Waldemar Brodkorb <wbx@…>, 19 years ago

time to break trunk.

  • update to OpenWrt brcm-2.4 patch, wl driver and diag driver
  • fix failsafe mode to use new hotplug method
  • rework of mk/kernel-build.mk to use .config instead of stampfiles
  • simplify mk/kernel*.mk to use $(FS) instead ifeq/else crap

a lot of small stuff.

tested and verified to boot at least on

  • Netgear WG634u
  • Linksys WRT54GS v1.0
  • Asus WL500gP

Only basic lan and wlan stuff (none encryption, wep) are tested.

PLEASE update only on NON-PRODUCTIVE routers with serial access.
HELP to test the new backend code for BRCM-2.4!

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2322 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 4.0 KB
Line 
1# $FreeWRT$
2#-
3# This file is part of the FreeWRT project. FreeWRT is copyrighted
4# material, please see the LICENCE file in the top-level directory
5# or at http://www.freewrt.org/licence for details.
6
7
8KERNEL:=unknown
9ifneq (,$(findstring 2.4.,$(LINUX_VERSION)))
10KERNEL:=2.4
11endif
12ifneq (,$(findstring 2.6.,$(LINUX_VERSION)))
13KERNEL:=2.6
14endif
15
16ifeq ($(KERNEL),2.6)
17LINUX_KMOD_SUFFIX=ko
18else
19LINUX_KMOD_SUFFIX=o
20endif
21
22MODULES_SUBDIR := lib/modules/$(LINUX_VERSION)
23LINUX_BUILD_DIR := $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
24LINUX_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
25LINUX_KERNEL := $(LINUX_BUILD_DIR)/vmlinux
26LINUX_TARGET_DIR := $(LINUX_BUILD_DIR)/root
27
28IPKG_KERNEL:= env \
29 IPKG_TMP=$(BUILD_DIR)/tmp \
30 IPKG_INSTROOT=$(LINUX_TARGET_DIR) \
31 IPKG_CONF_DIR=$(LINUX_BUILD_DIR) \
32 IPKG_OFFLINE_ROOT=$(LINUX_BUILD_DIR)/root \
33 ${BASH} ${SCRIPT_DIR}/ipkg -force-defaults -force-depends
34
35LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
36 -e 's/mipsel/mips/' \
37 -e 's/mipseb/mips/' \
38 -e 's/powerpc/ppc/' \
39 -e 's/sh[234]/sh/' \
40 -e 's/armeb/arm/' \
41)
42
43KPKG_MAKEOPTS := IPKG="$(IPKG_KERNEL)" \
44 BOARD="$(BOARD)" \
45 KERNEL="$(KERNEL)" \
46 TARGET_DIR="$(LINUX_TARGET_DIR)" \
47 LINUX_BUILD_DIR="$(LINUX_BUILD_DIR)" \
48 LINUX_DIR="$(LINUX_DIR)" \
49 LINUX_VERSION="$(LINUX_VERSION)" \
50 LINUX_RELEASE="$(LINUX_RELEASE)"
51
52KMOD_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
53MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
54TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
55
56KERNEL_IPKG:=$(PACKAGE_DIR)/kernel_$(BOARD)-$(KERNEL)-$(LINUX_VERSION)_$(ARCH).ipk
57INSTALL_TARGETS:= $(KERNEL_IPKG)
58TARGETS:=
59
60# KMOD_template
61#
62# Adds a target for creating a package containing
63# the specified (kernel-provided) modules.
64# Parameters:
65# 1: the config symbol name (without leading 'FWRT_PACKAGE_KMOD_') this module depends on
66# 2: the name for the package, should be unique
67# 3: actual modules to add; absolute path inside $(MODULES_DIR)
68# OMIT THE KERNEL-SPECIFIC EXTENSION!
69# 4: this is weird - the name of the kernel's config symbol for the module(s) in $(3)
70# actually this detects if the module is built in or not
71# 5: the packages this package depends on - normally there are none
72# 6: together with $(2) forms the name of the file inside /etc/modules.d that controls
73# order of module loading at system startup; the modules in $(3) are (in their order)
74# added to this file, if $(6) is non-empty
75# 7: a custom command that is run before actually building the module - as nobody
76# needs this, you probably won't either
77#
78define KMOD_template
79ifeq ($$(strip $(4)),)
80KDEPEND_$(1):=m
81else
82KDEPEND_$(1):=$($(4))
83endif
84
85IDEPEND_$(1):=kernel ($(BOARD)-$(KERNEL)-$(LINUX_VERSION)) $(foreach pkg,$(5),", $(pkg)")
86
87PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk
88I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(2)
89
90ifeq ($$(KDEPEND_$(1)),m)
91TARGETS+=$$(PKG_$(1))
92ifeq ($$(FWRT_PACKAGE_KMOD_$(1)),y)
93INSTALL_TARGETS+=$$(PKG_$(1))
94endif
95endif
96
97$$(PKG_$(1)): $(LINUX_DIR)/.modules-install
98 rm -rf $$(I_$(1))
99 ${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh $$(I_$(1)) \
100 ../control/kmod-$(2).control \
101 $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH)
102 echo "Depends: $$(IDEPEND_$(1))" >> $$(I_$(1))/CONTROL/control
103ifneq ($(strip $(3)),)
104 mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
105 $(CP) $(foreach mod,$(3),$(mod).$(LINUX_KMOD_SUFFIX)) $$(I_$(1))/lib/modules/$(LINUX_VERSION)
106ifneq ($(6),)
107 mkdir -p $$(I_$(1))/etc/modules.d
108 for module in $(notdir $(3)); do \
109 echo $$$$module >> $$(I_$(1))/etc/modules.d/$(6)-$(2); \
110 done
111 echo "#!/bin/sh" >> $$(I_$(1))/CONTROL/postinst
112 echo "if [ -z \"\$$$${IPKG_INSTROOT}\" ]; then" >> $$(I_$(1))/CONTROL/postinst
113 echo ". /etc/functions.sh" >> $$(I_$(1))/CONTROL/postinst
114 echo "load_modules /etc/modules.d/$(6)-$(2)" >> $$(I_$(1))/CONTROL/postinst
115 echo "fi" >> $$(I_$(1))/CONTROL/postinst
116 chmod 0755 $$(I_$(1))/CONTROL/postinst
117endif
118endif
119 $(7)
120 $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR) $(MAKE_TRACE)
121endef
122
123# include kernel filesystem specific kernel configuration
124include ./$(FS)/kernelconfig
Note: See TracBrowser for help on using the repository browser.