source: src/router/Makefile.x64 @ 31631

Last change on this file since 31631 was 31631, checked in by brainslayer, 3 weeks ago

testing for new fs

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