source: src/router/Makefile.x86 @ 29183

Last change on this file since 29183 was 29183, checked in by BrainSlayer, 17 months ago

add new default option

File size: 23.4 KB
Line 
1#
2# Broadcom Linux Router Makefile
3#
4# Copyright 2001-2003, Broadcom Corporation
5# All Rights Reserved.
6#
7# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11#
12# $Id: Makefile,v 1.2 2005/09/26 11:06:58 seg Exp $
13#
14
15include .config
16ifneq ($(wildcard ../cy_conf.mak),)
17  include ../cy_conf.mak
18endif
19
20#
21# Paths
22#
23OPENSER_MODULES := sl tm rr maxfwd usrloc registrar dbtext textops exec auth auth_db nathelper
24OPENSER_MODULE_FILES := $(foreach module,$(OPENSER_MODULES),openser/modules/$(module)/$(module).so)
25OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-rmd160 no-aes192
26OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-krb5 no-threads zlib-dynamic no-engines
27CONFIG_MUSL=y
28CONFIG_NOOPT=y
29
30# Source bases
31
32export PLATFORM LINUXDIR LIBDIR USRLIBDIR
33export TOP := $(shell pwd)
34export SRCBASE := $(shell (cd $(TOP)/.. && pwd -P))
35
36
37# Set the HAL directory if you have the HAL sources
38
39# Set the Atheros Rate Control directory if you have the proprietary rate control
40export ATH_RATE=ath_rate/sample
41
42#
43# Cross-compile environment variables
44#
45
46# Build platform
47export BUILD := i486-pc-linux-gnu
48export HOSTCC := gcc
49
50# uClibc wrapper
51export ARCH:=$(PLATFORM)
52ifeq ($(CONFIG_UCLIBC),y)
53export PLATFORM := $(PLATFORM)-uclibc
54endif
55
56#export LINUXDIR := $(SRCBASE)/linux/linux.v24
57ifeq ($(ARCH),mips)
58export LINUXDIR := $(SRCBASE)/linux/brcm63xx/linux-2.6.17
59endif
60#ifeq ($(ARCH),i386)
61#export LINUXDIR := $(SRCBASE)/linux/x86/linux-2.6.29
62#endif
63ifeq ($(ARCH),armeb)
64export LINUXDIR := $(SRCBASE)/linux/xscale/linux-2.6.17
65endif
66ifeq ($(ARCH),mipsel)
67export LINUXDIR := $(SRCBASE)/kernel/rb500/linux-2.6.17-rc5
68endif
69
70#export KERNELRELEASE = $(shell cat $(LINUXDIR)/.kernelrelease 2> /dev/null)
71export KRELEASE = $(shell cat $(LINUXDIR)/include/config/kernel.release 2> /dev/null)
72
73#ifeq ($(PLATFORM),mipsel)
74#export CROSS_COMPILE := mipsel-linux-
75#export CONFIGURE := ./configure mipsel-linux --build=$(BUILD)
76#export TOOLCHAIN := $(shell cd $(dir $(shell which $(CROSS_COMPILE)gcc))/../mipsel-linux && pwd -P)
77#endif
78
79#ifeq ($(PLATFORM),mipsel-uclibc)
80export CROSS_COMPILE := i486-linux-uclibc-
81export CONFIGURE := ./configure $(ARCH)-linux --build=$(BUILD)
82export TOOLCHAIN := $(shell cd $(dir $(shell which $(CROSS_COMPILE)gcc))/.. && pwd -P)
83#endif
84
85#ifeq ($(CONFIG_BCMWPA2),y)
86#export CFLAGS += -DBCMWPA2
87#endif
88
89export BASEOPT:=-O2
90#export ARCH:= mipsel
91
92export LINUXVER = $(shell cat $(LINUXDIR)/include/config/kernel.release 2> /dev/null)
93
94ifeq ($(ARCH),mipsel)
95export COPTS:=$(BASEOPT) -pipe -mips32 -mtune=mips32 -funit-at-a-time
96endif
97ifeq ($(ARCH),armeb)
98export COPTS:=$(BASEOPT) -pipe -mtune=xscale -march=armv5te -Wa,-mcpu=xscale -mno-thumb-interwork -mno-thumb -funit-at-a-time
99endif
100ifeq ($(ARCH),mips)
101export COPTS:=$(BASEOPT) -pipe -mips32 -mtune=mips32 -funit-at-a-time
102endif
103ifeq ($(ARCH),i386)
104export COPTS:=$(BASEOPT) -pipe -march=i486 -mtune=i486 -fno-caller-saves -D_FILE_OFFSET_BITS=64 -fno-plt
105endif
106
107export CC := ccache $(CROSS_COMPILE)gcc
108export CXX := ccache $(CROSS_COMPILE)g++
109export AR := $(CROSS_COMPILE)ar
110export AS := $(CROSS_COMPILE)as
111export LD := $(CROSS_COMPILE)ld
112export NM := $(CROSS_COMPILE)nm
113export RANLIB := $(CROSS_COMPILE)ranlib
114export STRIP := $(CROSS_COMPILE)strip
115export SIZE := $(CROSS_COMPILE)size
116
117export CFLAGS := $(COPTS)
118
119#
120# Install and target directories
121#
122
123export PLATFORMDIR := $(TOP)/$(PLATFORM)
124export INSTALLDIR := $(PLATFORMDIR)/install
125export TARGETDIR := $(PLATFORMDIR)/target
126
127ifeq ($(PLATFORM),mipsel)
128obj-y += libcrypto
129endif
130#
131# Configuration
132#
133CONFIG_IPTABLES=y
134include rules/configs.mk
135
136obj-clean := $(foreach obj,$(obj-y) $(obj-n),$(obj)-clean)
137obj-install := $(foreach obj,$(obj-y),$(obj)-install)
138obj-distclean := $(foreach obj,$(obj-y) $(obj-n),$(obj)-distclean)
139
140#
141# Basic rules
142#
143
144
145all: install_headers build_date clean_target $(obj-y) $(LINUXDIR)/.config kernel
146
147build_date:
148        echo "#define BUILD_DATE \"$(shell date +%D)\"" > ../../opt/build.h
149        echo "CONFIG_MUSL=y" >> .config
150
151include kernel-features.mk
152
153kernel:
154        # Also build kernel
155        # Also build kernel
156ifeq ($(CONFIG_ISOFS),y)
157        cp $(LINUXDIR)/.config_isofs $(LINUXDIR)/.config
158endif
159        $(kernelfeatures)
160        make -C $(LINUXDIR) oldconfig
161        if ! grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
162            $(MAKE) -j 4 -C $(LINUXDIR) bzImage CROSS_COMPILE="ccache i486-linux-uclibc-" ; \
163        fi
164        if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
165            $(MAKE) -j 4 -C $(LINUXDIR) modules CROSS_COMPILE="ccache i486-linux-uclibc-" ; \
166        fi
167        rm -rf $(TARGETDIR)/lib/modules
168        $(MAKE) -C $(LINUXDIR) modules_install DEPMOD=/bin/true INSTALL_MOD_PATH=$(TARGETDIR)
169        rm -f $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/build
170        rm -f $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/source
171
172        -$(MAKE) -f Makefile.x86 ath9k
173        -$(MAKE) -f Makefile.x86 ath9k-install
174        -$(MAKE) -f Makefile.x86 libutils
175        -$(MAKE) -f Makefile.x86 madwifi
176        -$(MAKE) -f Makefile.x86 madwifi-install
177        -$(MAKE) -f Makefile.x86 batman-adv
178        -$(MAKE) -f Makefile.x86 batman-adv-install
179        -$(MAKE) -f Makefile.x86 opendpi
180        -$(MAKE) -f Makefile.x86 opendpi-install
181        -$(MAKE) -f Makefile.x86 uniwip-gpio
182        -$(MAKE) -f Makefile.x86 uniwip-gpio-install
183
184        find $(ARCH)-uclibc/install $(ARCH)-uclibc/target  -name \*.ko | \
185                xargs $(ARCH)-linux-nm | \
186                awk '$$1 == "U" { print $$2 } ' | \
187                sort -u > $(LINUXDIR)/mod_symtab.txt
188        $(ARCH)-linux-nm -n $(LINUXDIR)/vmlinux.o | grep ' r __ksymtab' | sed -e 's,........ r __ksymtab_,,' > $(LINUXDIR)/kernel_symtab.txt
189        $(ARCH)-linux-nm -n $(LINUXDIR)/vmlinux.o | grep ' R __ksymtab' | sed -e 's,........ R __ksymtab_,,' >> $(LINUXDIR)/kernel_symtab.txt
190        grep -f $(LINUXDIR)/mod_symtab.txt $(LINUXDIR)/kernel_symtab.txt -F > $(LINUXDIR)/sym_include.txt
191        grep -vf $(LINUXDIR)/mod_symtab.txt $(LINUXDIR)/kernel_symtab.txt -F > $(LINUXDIR)/sym_exclude.txt
192        ( \
193                echo '#define SYMTAB_KEEP \'; \
194                cat $(LINUXDIR)/sym_include.txt | \
195                        awk '{print "KEEP(*(___ksymtab+" $$$$1 ")) \\" }'; \
196                echo; \
197                echo '#define SYMTAB_KEEP_GPL \'; \
198                cat $(LINUXDIR)/sym_include.txt | \
199                        awk '{print "KEEP(*(___ksymtab_gpl+" $$$$1 ")) \\" }'; \
200                echo; \
201                echo '#define SYMTAB_DISCARD \'; \
202                cat $(LINUXDIR)/sym_exclude.txt | \
203                        awk '{print "*(___ksymtab+" $$$$1 ") \\" }'; \
204                echo; \
205                echo '#define SYMTAB_DISCARD_GPL \'; \
206                cat $(LINUXDIR)/sym_exclude.txt | \
207                        awk '{print "*(___ksymtab_gpl+" $$$$1 ") \\" }'; \
208                echo; \
209        ) > $(LINUXDIR)/symtab.h
210        rm -f $(LINUXDIR)/vmlinux
211        if ! grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
212            $(MAKE) -j 4 -C $(LINUXDIR) bzImage EXTRA_LDSFLAGS="-I$(LINUXDIR) -include symtab.h" CROSS_COMPILE="ccache i486-linux-uclibc-" ; \
213        fi
214       
215#       cat $(LINUXDIR)/vmlinus | lzma e -si -so -eos -lc1 -lp2 -pb2 > lzma-loader/rb500/vmlinux.lzma
216#       make -C lzma-loader/rb500 clean
217#       make -C lzma-loader/rb500
218#       cp lzma-loader/rb500/lzma.elf $(ARCH)-uclibc/vmlinux
219
220install_headers:
221# important step, required for new kernels
222        -mkdir -p $(TOP)/kernel_headers/$(KERNELRELEASE)
223        $(MAKE) -C $(LINUXDIR) headers_install ARCH=i386 INSTALL_HDR_PATH=$(TOP)/kernel_headers/$(KERNELRELEASE)
224
225       
226realclean: $(obj-clean)
227        rm -f .config.old .config.cmd
228        #umount $(TARGETDIR)
229        rm -rf $(INSTALLDIR)
230        rm -rf $(TARGETDIR)
231        rm -f $(TARGETDIR)/*
232        -rm -f $(ARCH)-uclibc/*
233
234       
235clean: rc-clean httpd-clean services-clean shared-clean libutils-clean nvram-clean madwifi-clean madwifi_mimo-clean busybox-clean pppd-clean iproute2-clean
236        rm -f .config.old .config.cmd
237        #umount $(TARGETDIR)
238        rm -rf $(INSTALLDIR)
239        rm -rf $(TARGETDIR)
240        rm -f $(TARGETDIR)/*
241        -rm -f $(ARCH)-uclibc/*
242
243clean_target:
244        #umount $(TARGETDIR)
245        rm -rf $(TARGETDIR)
246        rm -rf $(INSTALLDIR)
247#       rm -f $(PLATFORMDIR)/linux.trx $(PLATFORMDIR)/vmlinuz $(PLATFORMDIR)/target.squashfs
248
249distclean mrproper: $(obj-distclean) clean_target
250        rm -rf $(INSTALLDIR)
251        $(MAKE) -C $(LINUXDIR) distclean
252        $(MAKE) -C $(LINUXDIR)/arch/mips/bcm947xx/compressed clean
253        #rm -f $(PLATFORMDIR)/zImage $(PLATFORMDIR)/linux.bin
254        $(MAKE) -C config clean
255        rm -f .config $(LINUXDIR)/.config
256        rm -f .config.old .config.cmd
257
258optimize-lib:
259ifneq ($(CONFIG_MUSL),y)
260        cp ${shell $(ARCH)-linux-gcc -print-file-name=libc.so.0} $(ARCH)-uclibc/target/lib/libc.so.0
261else
262        cp ${shell $(ARCH)-linux-gcc -print-file-name=libc.so} $(ARCH)-uclibc/target/lib/libc.so
263endif
264ifneq ($(CONFIG_MUSL),y)
265        cp ${shell $(ARCH)-linux-gcc -print-file-name=ld-uClibc.so.0} $(ARCH)-uclibc/target/lib/ld-uClibc.so.0
266else
267        cd $(ARCH)-uclibc/target/lib && ln -sf libc.so ld-musl-i386.so.1
268endif
269ifeq ($(CONFIG_LIBDL),y)
270        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libdl.so.0} $(ARCH)-uclibc/target/lib/libdl.so.0
271endif
272ifeq ($(CONFIG_LIBRT),y)
273        -cp ${shell $(ARCH)-linux-gcc -print-file-name=librt.so.0} $(ARCH)-uclibc/target/lib/librt.so.0
274endif
275        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libatomic.so.1} $(ARCH)-uclibc/target/lib/libatomic.so.1
276ifeq ($(CONFIG_LIBNSL),y)
277        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libnsl.so.0} $(ARCH)-uclibc/target/lib/libnsl.so.0
278endif
279ifeq ($(CONFIG_LIBUTIL),y)
280        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libutil.so.0} $(ARCH)-uclibc/target/lib/libutil.so.0
281endif
282ifeq ($(CONFIG_LIBCPP),y)
283        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libstdc++.so.6} $(ARCH)-uclibc/target/lib/libstdc++.so.6
284endif
285ifeq ($(CONFIG_LIBCRYPT),y)
286        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libcrypt.so.0} $(ARCH)-uclibc/target/lib/libcrypt.so.0
287endif
288ifeq ($(CONFIG_LIBM),y)
289        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libm.so.0} $(ARCH)-uclibc/target/lib/libm.so.0
290endif
291ifeq ($(CONFIG_LIBRESOLV),y)
292        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libresolv.so.0} $(ARCH)-uclibc/target/lib/libresolv.so.0
293endif
294ifeq ($(CONFIG_LIBPTHREAD),y)
295        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libpthread.so.0} $(ARCH)-uclibc/target/lib/libpthread.so.0
296endif
297#       cp ${shell $(ARCH)-linux-gcc -print-file-name=libc.so.0} $(ARCH)-uclibc/target/lib/libc.so.0
298        -cp ${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1} $(ARCH)-uclibc/target/lib/libgcc_s.so.1
299
300ifneq ($(CONFIG_NOOPT),y)
301        rm -rf /tmp/$(ARCHITECTURE)/mklibs-out
302        rm -f /tmp/$(ARCHITECTURE)/mklibs-progs
303        -mkdir -p /tmp/$(ARCHITECTURE)/
304        find $(TARGETDIR) -type f -perm /100 -exec \
305                file -r -N -F '' {} + | \
306                awk ' /executable.*dynamically/ { print $$1 }' > /tmp/$(ARCHITECTURE)/mklibs-progs
307
308        find $(TARGETDIR) -type f -name \*.so\* -exec \
309                file -r -N -F '' {} + | \
310                awk ' /shared object/ { print $$1 }' >> /tmp/$(ARCHITECTURE)/mklibs-progs
311
312        mkdir -p /tmp/$(ARCHITECTURE)/mklibs-out
313ifneq ($(CONFIG_MUSL),y)
314        mklibs.py -D \
315                -d /tmp/$(ARCHITECTURE)/mklibs-out \
316                --sysroot $(TARGETDIR) \
317                -L /lib \
318                -L /usr/lib \
319                --ldlib /lib/ld-uClibc.so.0 \
320                --target $(ARCH)-linux-uclibc \
321                `cat /tmp/$(ARCHITECTURE)/mklibs-progs` 2>&1
322else
323        mklibs.py -D \
324                -d /tmp/$(ARCHITECTURE)/mklibs-out \
325                --sysroot $(TARGETDIR) \
326                -L /lib \
327                -L /usr/lib \
328                --ldlib /lib/ld-musl-i386.so.1 \
329                --target $(ARCH)-linux-uclibc \
330                `cat /tmp/$(ARCHITECTURE)/mklibs-progs` 2>&1
331
332endif
333
334        cp /tmp/$(ARCHITECTURE)/mklibs-out/* $(TARGETDIR)/lib
335else
336#       cp ${shell $(ARCH)-linux-gcc -print-file-name=libc.so.0} $(ARCH)-uclibc/target/lib/libc.so.0
337#       cp ${shell $(ARCH)-linux-gcc -print-file-name=libuClibc-0.99.33.2.so}  $(ARCH)-uclibc/target/lib/libc.so.0
338#       relink-lib.sh \
339#               "$(ARCH)-linux-" \
340#               "${shell $(ARCH)-linux-gcc -print-file-name=libc_so.a}" \
341#               "${shell $(ARCH)-linux-gcc -print-file-name=libc_so.a}" \
342#               "$(ARCH)-uclibc/target/lib/libc.so.0" \
343#               -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
344#               ${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1}
345
346ifneq ($(CONFIG_MUSL),y)
347
348        relink-lib.sh \
349                "$(ARCH)-linux-" \
350                "${shell $(ARCH)-linux-gcc -print-file-name=libcrypt.so}" \
351                "${shell $(ARCH)-linux-gcc -print-file-name=libcrypt_pic.a}" \
352                "$(ARCH)-uclibc/target/lib/libcrypt.so.0" \
353                ${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1} \
354                -Wl,-soname=libcrypt.so.0
355
356
357        relink-lib.sh \
358                "$(ARCH)-linux-" \
359                "${shell $(ARCH)-linux-gcc -print-file-name=libatomic.so}" \
360                "${shell $(ARCH)-linux-gcc -print-file-name=libatomic.a}" \
361                "$(ARCH)-uclibc/target/lib/libatomic.so.1" \
362                ${shell $(ARCH)-linux-gcc -print-file-name=libatomic.so.1} \
363                -Wl,-soname=libcrypt.so.0
364
365        relink-lib.sh \
366                "$(ARCH)-linux-" \
367                "${shell $(ARCH)-linux-gcc -print-file-name=libm.so}" \
368                "${shell $(ARCH)-linux-gcc -print-file-name=libm_pic.a}" \
369                "$(ARCH)-uclibc/target/lib/libm.so.0" \
370                ${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1} \
371                -Wl,-soname=libm.so.0
372
373        relink-lib.sh \
374                "$(ARCH)-linux-" \
375                "${shell $(ARCH)-linux-gcc -print-file-name=libpthread.so.0}" \
376                "${shell $(ARCH)-linux-gcc -print-file-name=libpthread_so.a}" \
377                "$(ARCH)-uclibc/target/lib/libpthread.so.0" \
378                -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
379                ${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1} \
380                -Wl,-soname=libpthread.so.0
381endif
382endif
383
384        rm -f $(TARGETDIR)/lib/*.a
385        rm -f $(TARGETDIR)/lib/*.map
386#       cp lib.$(ARCH)/libresolv.so.0 $(TARGETDIR)/lib
387#       cp lib.$(ARCH)/libgcc_s.so.1 $(TARGETDIR)/lib
388
389
390install package: clean_target $(filter-out lib.i386-install,$(obj-install)) $(LINUXDIR)/.config
391        # Install binaries into target directory
392        # Install binaries into target directory
393#       make -C viarhine clean
394#       make -C viarhine       
395        #umount -f $(TARGETDIR)
396        #dd if=/dev/zero of=mipsel-uclibc/root.fs bs=1024 count=27392
397        #mke2fs -F -b 1024 mipsel-uclibc/root.fs
398        #mkfs.ext3 -F -b 1024 mipsel-uclibc/root.fs
399        install -d $(TARGETDIR)
400        #mount mipsel-uclibc/root.fs -o loop=/dev/loop1 $(TARGETDIR)
401#       $(ARCH)-linux-strip $(LINUXDIR)/vmlinux -o $(ARCH)-uclibc/vmlinux
402#       cp $(LINUXDIR)/vmlinus mipsel-uclibc/vmlinux
403#       gunzip -c base.img.gz>image.img
404#       ../tools/write $(ARCH)-uclibc/vmlinux image.img 16384
405        #dd if=$(LINUXDIR)/vmlinux of=/dev/loop0 bs=512 seek=32
406        for dir in $(wildcard $(patsubst %,$(INSTALLDIR)/%,$(obj-y))) ; do \
407            (cd $${dir} && tar cpf - .) | (cd $(TARGETDIR) && tar xpf -) \
408        done
409        mkdir -p $(ARCH)-uclibc/target/etc/config
410        mkdir -p $(ARCH)-uclibc/target/etc/kaid
411        mkdir -p $(ARCH)-uclibc/target/etc/langpack
412        cp ./opt/bin/ipkg $(ARCH)-uclibc/target/bin
413        cd  $(ARCH)-uclibc/target/lib
414#       ln -s libgcc_s.so.1 libgcc_s.so
415#       cd ../../../../../opt
416        cp ./opt/etc/preinit $(ARCH)-uclibc/target/etc
417        cp ./opt/etc/postinit $(ARCH)-uclibc/target/etc
418        cp ./opt/etc/ipkg.conf $(ARCH)-uclibc/target/etc
419        cp ./opt/etc/config/* $(ARCH)-uclibc/target/etc/config
420        cp ./opt/usr/lib/smb.conf $(ARCH)-uclibc/target/usr/lib
421        ln -sf ../tmp/smbshare $(ARCH)-uclibc/target/www/smb
422
423        # optimize the crypto library by removing unneeded symbols
424        #[ ! -d libcrypto ] || $(MAKE) -C libcrypto optimize
425        #[ ! -d libcrypto ] || $(MAKE) -C libcrypto optimize
426        # Install (and possibly optimize) C library
427#       $(MAKE) -f Makefile.x86 lib.i486-install
428        # optimize the others library by removing unneeded symbols
429        $(MAKE) -f Makefile.x86 optimize-lib
430        # Install modules into filesystem
431        if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
432            $(MAKE) -C $(LINUXDIR) modules_install DEPMOD=/bin/true INSTALL_MOD_PATH=$(TARGETDIR) ; \
433        fi
434ifeq ($(CONFIG_MADWIFI),y)
435        rm -rf $(TARGETDIR)/lib/modules/$(KRELEASE)/kernel/drivers/net/wl
436endif
437#       mkdir -p $(TARGETDIR)/lib/modules/2.4.32/kernel/drivers/net/ctmisc
438#       cp ../wl/ctmisc/ctmisc.o $(TARGETDIR)/lib/modules/2.4.32/kernel/drivers/net/ctmisc
439        ##not used yet
440        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
441        #cp ./switch/switch-core.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
442        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
443#       cp ./viarhine/via-rhine.o $(TARGETDIR)/lib/modules/2.4.32/kernel/drivers/net
444
445        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
446        #cp ./switch/switch-adm.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
447        #cp lib.i486/libgcc_s.so.1 $(TARGETDIR)/lib
448        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
449        #cp ./switch/switch-robo.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/switch
450       
451        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc1/kernel/drivers/net/et
452        #cp ../et/linux/et.o $(TARGETDIR)/lib/modules/2.4.32-rc1/kernel/drivers/net/et
453       
454        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/et.4702
455        #cp ../et.4702/linux/4702et.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/et.4702
456        # robo switch
457        #mkdir -p $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/robo
458        #cp ../robo/linux/robo.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/robo
459       
460        find $(TARGETDIR) -name "wl_*.o"  | xargs rm -rf
461        # quick n dirty - stuff Nikki's module where it belongs
462        #mkdir $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/adm6996
463#       if [ "$(CONFIG_MMC)" = "y" ] ; then \
464#       mkdir $(TARGETDIR)/lib/modules/2.4.32/kernel/fs/mmc ; \
465#       cp mmc/mmc.o $(TARGETDIR)/lib/modules/2.4.32/kernel/fs/mmc ; \
466#       fi ;
467#ifeq ($(CONFIG_MSSID),y)
468#       cp adm6996.v24/adm6996.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/adm6996/adm6996.o
469#else   
470#       cp adm6996/adm6996.o $(TARGETDIR)/lib/modules/2.4.32-rc3/kernel/drivers/net/adm6996/adm6996.o
471#endif
472ifneq ($(CONFIG_USB),y)
473        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/usb/class
474        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/usb/core
475        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/usb/host
476        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/usb/storage
477        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/scsi
478        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/ext2
479#       rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/ext3
480        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/fat
481#       rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/jbd
482        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/msdos
483        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/vfat
484        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/xfs
485#       rm -f $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/mbcache.ko
486endif
487ifneq ($(CONFIG_USB_ADVANCED),y)
488        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/usb/serial
489        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/ext3
490        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/ext4
491        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/btrfs
492        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/jbd       
493        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/jbd2     
494endif
495ifneq ($(CONFIG_NTFS3G),y)
496        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/fuse
497endif
498ifneq ($(CONFIG_USB),y)
499ifneq ($(CONFIG_SAMBA),y)
500        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/nls
501endif
502endif
503ifneq ($(CONFIG_IPV6),y)
504        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/net/ipv6
505endif
506ifneq ($(CONFIG_3G),y)
507        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/drivers/net/usb
508endif
509ifneq ($(CONFIG_SAMBA),y)
510        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/cifs
511endif
512ifneq ($(CONFIG_JFFS2),y)
513        rm -rf $(TARGETDIR)/lib/modules/$(LINUXVER)/kernel/fs/jffs2
514endif
515
516        rm -f $(TARGETDIR)/lib/modules/$(KRELEASE)/build
517        rm -f $(TARGETDIR)/lib/modules/$(KRELEASE)/source
518       
519       
520       
521        # Prepare filesystem
522        cd $(TARGETDIR) && $(TOP)/misc/rootprep.sh
523        # Make sure mksquashfs-2.0 is used
524#       $(MAKE) -C $(LINUXDIR)/scripts/squashfs mksquashfs
525        cd $(TARGETDIR)  &&  find . -iname "CVS" | xargs rm -rf
526        cd $(TARGETDIR)  &&  find . -iname ".svn" | xargs rm -rf
527#       cp viarhine/pci-scan.o $(TARGETDIR)/lib/modules/2.4.32/kernel/drivers/net/pci-scan.o
528#       cp -f test/* $(TARGETDIR)/lib/modules/2.4.33-pre1/kernel/drivers/net
529       
530#       mknod $(TARGETDIR)/dev/cfa b 13 0
531#       mknod $(TARGETDIR)/dev/cfa1 b 13 1
532#       mknod $(TARGETDIR)/dev/cfa2 b 13 2
533#       mknod $(TARGETDIR)/dev/cfa3 b 13 3
534#       mknod $(TARGETDIR)/dev/cfa4 b 13 4
535#       umount $(TARGETDIR)
536#find $(TARGETDIR)/lib/modules -name *.ko -exec mipsel-linux-strip --strip-unneeded --remove-section=.comment {} +             
537        #e2fsck -y -f $(ARCH)-uclibc/root.fs
538        -find $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/kernel -name *.ko -exec mv {} $(TARGETDIR)/lib/modules/$(KERNELRELEASE) \;
539        -find $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/net -name *.ko -exec mv {} $(TARGETDIR)/lib/modules/$(KERNELRELEASE) \;
540        rm -rf $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/kernel
541        rm -rf $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/net
542        #e2fsck -y -f $(ARCH)-uclibc/root.fs
543        ./busybox/examples/depmod.pl -F $(LINUXDIR)/System.map -b $(ARCH)-uclibc/target/lib/modules
544        #cd $(TARGETDIR)
545#       tar --directory=$(TARGETDIR) --remove-files -cvvjf $(TARGETDIR)/etc/local.tar.bz2 usr/local
546        rm -rf $(TARGETDIR)/usr/local
547        mkdir $(TARGETDIR)/usr/local
548ifeq ($(CONFIG_KAID),y)
549        cp kaid/kaid $(TARGETDIR)/usr/sbin
550endif
551        mv $(TARGETDIR)/usr/lib/services.so $(TARGETDIR)/lib
552        export STRIP_KMOD="$(LINUXDIR)/scripts/strip-kmod.sh" && \
553        export STRIP="sstrip" && \
554        $(LINUXDIR)/scripts/rstrip.sh $(TARGETDIR)
555
556        cd grub && ./configure --host=i386-linux --target=i386-linux CC="/xfs/toolchains/staging_dir_i386.4.2.1/bin/i386-linux-gcc" LDFLAGS="-static" CFLAGS="-Os -DNEED_PRINTF"
557        make -C grub clean DESTDIR=$(INSTALLDIR)/grub   
558        make -C grub DESTDIR=$(INSTALLDIR)/grub
559        make -C grub install DESTDIR=$(INSTALLDIR)/grub
560        $(TOP)/../../tools/removewhitespace.sh $(TOP)/../../tools $(TARGETDIR)/etc/config
561        $(LINUXDIR)/scripts/squashfs/mksquashfs-lzma $(ARCH)-uclibc/target $(ARCH)-uclibc/root.fs -noappend -le
562#       $(LINUXDIR)/scripts/squashfs/mksquashfs-lzma $(ARCH)-uclibc/target $(ARCH)-uclibc/root.fs -noappend -root-owned -le -b 262144 -nopad
563        mkfs.jffs2 --pad --big-endian --squash -e 0x20000 -o $(ARCH)-uclibc/dd-wrt.jffs2 -d $(ARCH)-uclibc/target
564        mkdir -p $(ARCH)-uclibc/root.grub/boot/grub
565        cp \
566                $(INSTALLDIR)/grub/usr/local/lib/grub/i386-pc/stage1 \
567                $(INSTALLDIR)/grub/usr/local/lib/grub/i386-pc/stage2 \
568                $(INSTALLDIR)/grub/usr/local/lib/grub/i386-pc/e2fs_stage1_5 \
569                $(ARCH)-uclibc/root.grub/boot/grub/
570        cp grub/menu_serial.lst $(ARCH)-uclibc/root.grub/boot/grub/menu.lst
571        cp $(LINUXDIR)/arch/i386/boot/bzImage $(ARCH)-uclibc/root.grub/boot/vmlinuz
572
573ifeq ($(CONFIG_FULL),y)
574        -PATH="$(INSTALLDIR)/grub/usr/local/sbin:$(INSTALLDIR)/grub/usr/local/bin:$(PATH)" ./gen_image.sh $(ARCH)-uclibc/dd-wrt_serial.image 4 $(ARCH)-uclibc/root.grub 64 $(ARCH)-uclibc/root.fs 32
575        cp grub/menu_vga.lst $(ARCH)-uclibc/root.grub/boot/grub/menu.lst
576        -PATH="$(INSTALLDIR)/grub/usr/local/sbin:$(INSTALLDIR)/grub/usr/local/bin:$(PATH)" ./gen_image.sh $(ARCH)-uclibc/dd-wrt_vga.image 4 $(ARCH)-uclibc/root.grub 64 $(ARCH)-uclibc/root.fs 32
577else
578        -PATH="$(INSTALLDIR)/grub/usr/local/sbin:$(INSTALLDIR)/grub/usr/local/bin:$(PATH)" ./gen_image.sh $(ARCH)-uclibc/dd-wrt_serial.image 4 $(ARCH)-uclibc/root.grub 64 $(ARCH)-uclibc/root.fs 16
579        cp grub/menu_vga.lst $(ARCH)-uclibc/root.grub/boot/grub/menu.lst
580        -PATH="$(INSTALLDIR)/grub/usr/local/sbin:$(INSTALLDIR)/grub/usr/local/bin:$(PATH)" ./gen_image.sh $(ARCH)-uclibc/dd-wrt_vga.image 4 $(ARCH)-uclibc/root.grub 64 $(ARCH)-uclibc/root.fs 16
581endif
582        ./tools/wrap $(ARCH)-uclibc/dd-wrt_vga.image $(ARCH)-uclibc/dd-wrt-vga-webupgrade.bin
583        ./tools/wrap $(ARCH)-uclibc/dd-wrt_serial.image $(ARCH)-uclibc/dd-wrt-serial-webupgrade.bin
584
585#       mkdir -p $(TARGETDIR)/boot/grub
586#       cp $(INSTALLDIR)/grub/usr/local/lib/grub/i386-pc/stage2_eltorito $(TARGETDIR)/boot/grub
587#       mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot  -boot-load-size 4 -boot-info-table -o grub.iso $(TARGETDIR)
588       
589#endif
590#
591# Configuration rules
592#
593include rules/all.mk
594
595%:
596        [ ! -d $* ] || $(MAKE) -C $*
597
598%-distclean:
599        [ ! -d $* ] || $(MAKE) -C $* clean
600
601%-clean:
602        [ ! -d $* ] || $(MAKE) -C $* clean
603
604%-install:
605        [ ! -d $* ] || $(MAKE) -C $* install INSTALLDIR=$(INSTALLDIR)/$*
606
607$(obj-y) $(obj-n) $(obj-clean) $(obj-install): dummy
608
609.PHONY: all clean distclean mrproper install package
610.PHONY: conf mconf oldconf kconf kmconf config menuconfig oldconfig
611.PHONY: dummy fixkc libnet libpcap
612
613
614
Note: See TracBrowser for help on using the repository browser.