source: trunk/openwrt/openwrt.mk @ 302

Last change on this file since 302 was 302, checked in by amain, 8 years ago

openwrt: kernel compile fails - temporary reverting changeset 27849

File size: 4.9 KB
Line 
1# DebWrt - Debian on Embedded devices
2#
3# Copyright (C) 2010 Johan van Zoomeren <amain@debwrt.net>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18OPENWRT_PATCHES_DIR=$(TOPDIR)/openwrt/patches
19
20openwrt/all: openwrt/build
21        $(MAKE) -C $(TOPDIR) openwrt/deliver
22        touch $@
23
24openwrt/build: openwrt/prepare
25ifeq ("$(origin V)", "command line")
26        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) $(CONFIG_OPENWRT_MAKE_OPTIONS) V=$(V)
27else
28        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) $(CONFIG_OPENWRT_MAKE_OPTIONS)
29endif
30        touch $@
31
32openwrt/download:
33ifeq ("$(origin V)", "command line")
34        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) download V=$(V)
35else
36        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) download
37endif
38        touch $@
39
40openwrt/prepare: \
41  openwrt/checkout \
42  openwrt/patch \
43  plugins/apply-openwrt \
44  openwrt/merge-config \
45  openwrt/download-link \
46  # end openwrt/prepare:
47        touch $@
48
49openwrt/merge-config: .config $(OPENWRT_BUILD_DIR)/.config openwrt/checkout openwrt/patch
50        mkdir -p $(TMP_DIR)
51        # Copy default OpenWrt settings
52        cp $(CONFIG_DIR)/openwrt.defconfig $(TMP_DIR)/.config_openwrt
53        # Merge default OpenWrt settings with menu settings
54        #cat .config | grep -v -e CONFIG_TARGET_BOARD -e "^#" >> $(TMP_DIR)/.config_openwrt
55        cat .config | grep -v -e CONFIG_TARGET_BOARD >> $(TMP_DIR)/.config_openwrt
56        # Merge default and menu settings with possibly altered settings in make menuconfig in OpenWrt
57        touch $(OPENWRT_BUILD_DIR)/.config
58        cp $(OPENWRT_BUILD_DIR)/.config $(OPENWRT_BUILD_DIR)/.config.org
59        $(SCRIPT_KCONFIG) + $(OPENWRT_BUILD_DIR)/.config.org $(TMP_DIR)/.config_openwrt > $(OPENWRT_BUILD_DIR)/.config
60        # Make sure the config is clean
61        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) defconfig
62        # Copy DebWrt config to the build dir used to set kernel compile options
63        cp .config $(OPENWRT_BUILD_DIR)/.config.debwrt
64        touch $@
65
66$(OPENWRT_BUILD_DIR)/.config: openwrt/checkout
67        [ ! -f $@ ] && touch $(OPENWRT_BUILD_DIR)/.config
68
69openwrt/download-link: openwrt/checkout
70ifneq ($(OPENWRT_DOWNLOAD_DIR),)
71        cd $(OPENWRT_BUILD_DIR) && if [ -d $(OPENWRT_DOWNLOAD_DIR) -a ! -e dl ]; then ln -snf $(OPENWRT_DOWNLOAD_DIR) dl; fi
72endif
73        touch $@
74
75openwrt/patch: openwrt/checkout
76        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
77          < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
78ifeq ($(IS_OPENWRT_TRUNK),y)
79        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
80          < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config
81        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
82          < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs
83        patch -d $(OPENWRT_BUILD_DIR) -p 1 -N \
84      < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
85else ifeq ($(IS_OPENWRT_BACKFIRE),y)
86        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
87          < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config
88        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
89          < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs
90endif
91        #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
92          < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version
93        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
94          < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables
95        touch $@
96
97$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp:
98openwrt/checkout: $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
99        rm -rf $(OPENWRT_BUILD_DIR)
100        mkdir -p $(OPENWRT_BUILD_DIR)
101ifeq ($(IS_OPENWRT_TRUNK),y)
102        cd $(OPENWRT_BUILD_DIR) && \
103          svn co svn://svn.openwrt.org/openwrt/trunk/ .
104else ifeq ($(IS_OPENWRT_BACKFIRE),y)
105        cd $(OPENWRT_BUILD_DIR) && \
106          svn co svn://svn.openwrt.org/openwrt/branches/backfire/ .
107else
108        cd $(OPENWRT_BUILD_DIR) && \
109          svn co -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ .
110endif
111        touch $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
112        touch $@
113
114openwrt/update: openwrt/checkout
115        cd $(OPENWRT_BUILD_DIR) && svn update
116
117openwrt/menuconfig: openwrt/prepare
118        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) menuconfig
119
120# Tune kernel configuration
121openwrt/kernel_menuconfig: openwrt/prepare
122        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) kernel_menuconfig
123        rm -f openwrt/build
124
125openwrt/clean:
126        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) clean V=$(V)
127
128openwrt/dirclean:
129        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) dirclean V=$(V)
130
131openwrt/distclean:
132        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) distclean V=$(V)
133
134openwrt/debwrt-clean:
135        rm -rf $(OPENWRT_BUILD_DIR)
136        rm -f openwrt/checkout
137        rm -f openwrt/patch
Note: See TracBrowser for help on using the repository browser.