source: src/router/Makefile.alpine @ 31398

Last change on this file since 31398 was 31398, checked in by brainslayer, 6 weeks ago

fix find command

  • Property svn:executable set to *
File size: 18.6 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
27MAX_KERNEL_SIZE=$(shell echo $$((34 * 128 * 1024)))
28MAX_IMAGE_SIZE=$(shell echo $$(((34 + 320) * 128 * 1024)))
29MODULE_NAME=R9000
30HW_VERSION=R9000
31FW_VERSION=V1.0.1.36
32LG_VERSION=V1.0.0.280
33CLOUD_VERSION=20160909
34HW_ID="29765235+0+512+1024+4x4+4x4"
35ifndef FW_REGION
36        FW_REGION=""
37endif
38
39# Source bases
40
41export PLATFORM LINUXDIR LIBDIR USRLIBDIR
42export TOP := $(shell pwd)
43export SRCBASE := $(shell (cd $(TOP)/.. && pwd -P))
44
45
46# Set the HAL directory if you have the HAL sources
47
48# Set the Atheros Rate Control directory if you have the proprietary rate control
49export ATH_RATE=ath_rate/sample
50
51#
52# Cross-compile environment variables
53#
54
55# Build platform
56export BUILD := i386-pc-linux-gnu
57export HOSTCC := gcc
58
59# uClibc wrapper
60export ARCH:=$(PLATFORM)
61ifeq ($(CONFIG_UCLIBC),y)
62export PLATFORM := $(PLATFORM)-uclibc
63endif
64
65
66export KERNELRELEASE = $(shell cat $(LINUXDIR)/include/config/kernel.release 2> /dev/null)
67
68
69#ifeq ($(PLATFORM),mipsel-uclibc)
70export CROSS_COMPILE := $(ARCH)-linux-uclibc-
71export CONFIGURE := ./configure $(ARCH)-linux --build=$(BUILD)
72export TOOLCHAIN := $(shell cd $(dir $(shell which $(CROSS_COMPILE)gcc))/.. && pwd -P)
73#endif
74
75
76export BASEOPT:=-Os
77
78
79#ifeq ($(ARCH),arm)
80#export COPTS:=$(BASEOPT) -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fhonour-copts -msoft-float
81#export COPTS:=$(BASEOPT) -pipe -march=armv7-a -mtune=cortex-a9  -mfloat-abi=soft -fpic -fno-caller-saves
82export COPTS:=$(BASEOPT) -pipe -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard -fno-caller-saves
83#endif
84
85
86export CC := ccache $(CROSS_COMPILE)gcc
87export CXX := ccache $(CROSS_COMPILE)g++
88export AR := $(CROSS_COMPILE)ar
89export AS := $(CROSS_COMPILE)as
90export LD := $(CROSS_COMPILE)ld
91export NM := $(CROSS_COMPILE)nm
92export RANLIB := $(CROSS_COMPILE)ranlib
93export STRIP := $(CROSS_COMPILE)strip
94export SIZE := $(CROSS_COMPILE)size
95
96export CFLAGS := $(COPTS)
97
98#
99# Install and target directories
100#
101
102export PLATFORMDIR := $(TOP)/$(PLATFORM)
103export INSTALLDIR := $(PLATFORMDIR)/install
104export TARGETDIR := $(PLATFORMDIR)/target
105
106#
107# Configuration
108#
109CONFIG_IPTABLES=y
110CONFIG_MUSL=y
111CONFIG_NOOPT=y
112
113include rules/configs.mk
114
115obj-clean := $(foreach obj,$(obj-y) $(obj-n),$(obj)-clean)
116obj-install := $(foreach obj,$(obj-y),$(obj)-install)
117obj-distclean := $(foreach obj,$(obj-y) $(obj-n),$(obj)-distclean)
118
119all: install_headers build_date clean_target $(obj-y) $(LINUXDIR)/.config kernel
120
121build_date:
122        echo "#define BUILD_DATE \"$(shell date +%D)\"" > ../../opt/build.h
123        echo "CONFIG_MUSL=y" >> .config
124
125include kernel-features.mk
126
127kernel:
128        cp $(LINUXDIR)/.config_alpine $(LINUXDIR)/.config
129
130        $(kernelfeatures)
131        $(MAKE) -C $(LINUXDIR) oldconfig
132       
133        if ! grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
134            $(MAKE) -j 4 -C $(LINUXDIR) uImage dtbs CROSS_COMPILE="ccache $(ARCH)-openwrt-linux-" ; \
135        fi
136        if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
137            $(MAKE) -j 4 -C $(LINUXDIR) modules CROSS_COMPILE="ccache $(ARCH)-openwrt-linux-" ; \
138        fi
139       
140
141       
142       
143        rm -rf $(TARGETDIR)/lib/modules
144        $(MAKE) -C $(LINUXDIR) modules_install DEPMOD=/bin/true INSTALL_MOD_PATH=$(TARGETDIR)
145        rm -f $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/build
146        rm -f $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/source
147
148        -$(MAKE) -f Makefile.alpine ath9k
149        -$(MAKE) -f Makefile.alpine ath9k-install
150        -$(MAKE) -f Makefile.alpine libutils
151        -$(MAKE) -f Makefile.alpine madwifi
152        -$(MAKE) -f Makefile.alpine madwifi-install
153        -$(MAKE) -f Makefile.alpine batman-adv
154        -$(MAKE) -f Makefile.alpine batman-adv-install
155        -$(MAKE) -f Makefile.alpine opendpi
156        -$(MAKE) -f Makefile.alpine opendpi-install
157#       -$(MAKE) -f Makefile.alpine uniwip-gpio
158#       -$(MAKE) -f Makefile.alpine uniwip-gpio-install
159
160
161        mkdir -p $(ARCH)-uclibc/target/usr/sbin/
162
163        mkdir -p $(ARCH)-uclibc/target/lib/crda
164
165#       cp $(TOP)/qtnhost/host/arm/qdpc-host.ko $(ARCH)-uclibc/target/lib/modules/$(KERNELRELEASE)/
166
167       
168        find $(ARCH)-uclibc/install $(ARCH)-uclibc/target  -name \*.ko | \
169                xargs $(ARCH)-linux-nm | \
170                awk '$$1 == "U" { print $$2 } ' | \
171                sort -u > $(LINUXDIR)/mod_symtab.txt
172        $(ARCH)-linux-nm -n $(LINUXDIR)/vmlinux.o | grep ' r __ksymtab' | sed -e 's,........ r __ksymtab_,,' > $(LINUXDIR)/kernel_symtab.txt
173        $(ARCH)-linux-nm -n $(LINUXDIR)/vmlinux.o | grep ' R __ksymtab' | sed -e 's,........ R __ksymtab_,,' >> $(LINUXDIR)/kernel_symtab.txt
174        grep -f $(LINUXDIR)/mod_symtab.txt $(LINUXDIR)/kernel_symtab.txt -F > $(LINUXDIR)/sym_include.txt
175        grep -vf $(LINUXDIR)/mod_symtab.txt $(LINUXDIR)/kernel_symtab.txt -F > $(LINUXDIR)/sym_exclude.txt
176        ( \
177                echo '#define SYMTAB_KEEP \'; \
178                cat $(LINUXDIR)/sym_include.txt | \
179                        awk '{print "KEEP(*(___ksymtab+" $$$$1 ")) \\" }'; \
180                echo; \
181                echo '#define SYMTAB_KEEP_GPL \'; \
182                cat $(LINUXDIR)/sym_include.txt | \
183                        awk '{print "KEEP(*(___ksymtab_gpl+" $$$$1 ")) \\" }'; \
184                echo; \
185                echo '#define SYMTAB_DISCARD \'; \
186                cat $(LINUXDIR)/sym_exclude.txt | \
187                        awk '{print "*(___ksymtab+" $$$$1 ") \\" }'; \
188                echo; \
189                echo '#define SYMTAB_DISCARD_GPL \'; \
190                cat $(LINUXDIR)/sym_exclude.txt | \
191                        awk '{print "*(___ksymtab_gpl+" $$$$1 ") \\" }'; \
192                echo; \
193        ) > $(LINUXDIR)/symtab.h
194        #rm -f $(LINUXDIR)/vmlinux
195        #$(MAKE) -j 4 -C $(LINUXDIR) uImage dtbs EXTRA_LDSFLAGS="-I$(LINUXDIR) -include symtab.h" CROSS_COMPILE="ccache $(ARCH)-openwrt-linux-"
196       
197
198
199
200
201install_headers:
202# important step, required for new kernels
203        -mkdir -p $(TOP)/kernel_headers/$(KERNELRELEASE)
204        $(MAKE) -C $(LINUXDIR) headers_install ARCH=arm INSTALL_HDR_PATH=$(TOP)/kernel_headers/$(KERNELRELEASE)
205
206       
207realclean: $(obj-clean)
208        rm -f .config.old .config.cmd
209        #umount $(TARGETDIR)
210        rm -rf $(INSTALLDIR)
211        rm -rf $(TARGETDIR)
212        rm -rf $(TARGETDIR)/*
213        -rm -rf $(ARCH)-uclibc/*
214
215       
216clean: rc-clean httpd-clean services-clean shared-clean libutils-clean nvram-clean madwifi-clean busybox-clean dnsmasq-clean iptables-clean pppd-clean iproute2-clean
217        rm -f .config.old .config.cmd
218        #umount $(TARGETDIR)
219        rm -rf $(INSTALLDIR)
220        rm -rf $(TARGETDIR)
221        rm -f $(TARGETDIR)/*
222        -rm -f $(ARCH)-uclibc/*
223
224clean_target:
225        rm -rf $(TARGETDIR)
226        rm -rf $(INSTALLDIR)
227
228distclean mrproper: $(obj-distclean) clean_target
229        rm -rf $(INSTALLDIR)
230        $(MAKE) -C $(LINUXDIR) distclean
231        $(MAKE) -C $(LINUXDIR)/arch/mips/bcm947xx/compressed clean
232        #rm -f $(PLATFORMDIR)/zImage $(PLATFORMDIR)/linux.bin
233        $(MAKE) -C config clean
234        rm -f .config $(LINUXDIR)/.config
235        rm -f .config.old .config.cmd
236
237optimize-lib:
238ifneq ($(CONFIG_MUSL),y)
239        cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libc.so.0} $(ARCH)-uclibc/target/lib/libc.so.0
240else
241        cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libc.so} $(ARCH)-uclibc/target/lib/libc.so
242endif
243ifneq ($(CONFIG_MUSL),y)
244        cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=ld-uClibc.so.0} $(ARCH)-uclibc/target/lib/ld-uClibc.so.0
245else
246        cd $(ARCH)-uclibc/target/lib && ln -sf libc.so ld-musl-armhf.so.1
247endif
248        cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libgcc_s.so.1} $(ARCH)-uclibc/target/lib/libgcc_s.so.1
249ifeq ($(CONFIG_LIBDL),y)
250        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libdl.so.0} $(ARCH)-uclibc/target/lib/libdl.so.0
251endif
252ifeq ($(CONFIG_LIBRT),y)
253        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=librt.so.0} $(ARCH)-uclibc/target/lib/librt.so.0
254endif
255ifeq ($(CONFIG_LIBNSL),y)
256        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libnsl.so.0} $(ARCH)-uclibc/target/lib/libnsl.so.0
257endif
258ifeq ($(CONFIG_LIBUTIL),y)
259        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libutil.so.0} $(ARCH)-uclibc/target/lib/libutil.so.0
260endif
261ifeq ($(CONFIG_LIBCPP),y)
262        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libstdc++.so.6} $(ARCH)-uclibc/target/lib/libstdc++.so.6
263endif
264ifeq ($(CONFIG_LIBCRYPT),y)
265        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libcrypt.so.0} $(ARCH)-uclibc/target/lib/libcrypt.so.0
266endif
267ifeq ($(CONFIG_LIBM),y)
268        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libm.so.0} $(ARCH)-uclibc/target/lib/libm.so.0
269endif
270ifeq ($(CONFIG_LIBRESOLV),y)
271        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libresolv.so.0} $(ARCH)-uclibc/target/lib/libresolv.so.0
272endif
273ifeq ($(CONFIG_LIBPTHREAD),y)
274        -cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libpthread.so.0} $(ARCH)-uclibc/target/lib/libpthread.so.0
275endif
276ifeq ($(CONFIG_RELINK),y)
277ifneq ($(CONFIG_MUSL),y)
278        relink-lib.sh \
279                "$(ARCH)-linux-" \
280                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libc_so.a}" \
281                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libc_so.a}" \
282                "$(ARCH)-uclibc/target/lib/libc.so.0" \
283                -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
284                ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libgcc_s.so.1}
285else
286        relink-lib.sh \
287                "$(ARCH)-linux-" \
288                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libc.a}" \
289                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libc.a}" \
290                "$(ARCH)-uclibc/target/lib/libc.so" \
291                -Wl,-init,__uClibc_init -Wl,-soname=libc.so \
292                ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libgcc_s.so.1}
293endif
294
295        -relink-lib.sh \
296                "$(ARCH)-linux-" \
297                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libcrypt.so}" \
298                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libcrypt_pic.a}" \
299                "$(ARCH)-uclibc/target/lib/libcrypt.so.0" \
300                ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libgcc_s.so.1} \
301                -Wl,-soname=libcrypt.so.0
302
303        -relink-lib.sh \
304                "$(ARCH)-linux-" \
305                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libm.so}" \
306                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libm_pic.a}" \
307                "$(ARCH)-uclibc/target/lib/libm.so.0" \
308                ${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1} \
309                -Wl,-soname=libm.so.0
310
311        -relink-lib.sh \
312                "$(ARCH)-linux-" \
313                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libpthread.so.0}" \
314                "${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libpthread_so.a}" \
315                "$(ARCH)-uclibc/target/lib/libpthread.so.0" \
316                -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
317                ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libgcc_s.so.1} \
318                -Wl,-soname=libpthread.so.0
319endif
320        cp ${shell $(ARCH)-openwrt-linux-gcc -print-file-name=libgcc_s.so.1} $(ARCH)-uclibc/target/lib/libgcc_s.so.1
321#       relink-lib.sh \
322#               "$(ARCH)-linux-" \
323#               "${shell $(ARCH)-linux-gcc -print-file-name=libgcc_s.so.1}" \
324#               "${shell $(ARCH)-linux-gcc -print-file-name=libgcc_pic.a}" \
325#               "$(ARCH)-uclibc/target/lib/libgcc_s.so.1" \
326#               -Wl,--version-script=${shell $(ARCH)-linux-gcc -print-file-name=libgcc.map} -Wl,-soname=libgcc_s.so.1
327
328
329
330ifneq ($(CONFIG_NOOPT),y)
331        rm -rf /tmp/$(ARCHITECTURE)/mklibs-out
332        rm -f /tmp/$(ARCHITECTURE)/mklibs-progs
333        -mkdir -p /tmp/$(ARCHITECTURE)/
334        find $(TARGETDIR) -type f -perm /100 -exec \
335                file -r -N -F '' {} + | \
336                awk ' /executable.*dynamically/ { print $$1 }' > /tmp/$(ARCHITECTURE)/mklibs-progs
337
338        find $(TARGETDIR) -type f -name \*.so\* -exec \
339                file -r -N -F '' {} + | \
340                awk ' /shared object/ { print $$1 }' >> /tmp/$(ARCHITECTURE)/mklibs-progs
341
342        mkdir -p /tmp/$(ARCHITECTURE)/mklibs-out
343ifneq ($(CONFIG_MUSL),y)
344        mklibs.py -D \
345                -d /tmp/$(ARCHITECTURE)/mklibs-out \
346                --sysroot $(TARGETDIR) \
347                -L /lib \
348                -L /usr/lib \
349                --ldlib /lib/ld-uClibc.so.0 \
350                --target $(ARCH)-linux-uclibc \
351                `cat /tmp/$(ARCHITECTURE)/mklibs-progs` 2>&1
352else
353        mklibs.py -D \
354                -d /tmp/$(ARCHITECTURE)/mklibs-out \
355                --sysroot $(TARGETDIR) \
356                -L /lib \
357                -L /usr/lib \
358                --ldlib /lib/ld-musl-armhf.so.1 \
359                --target $(ARCH)-linux-uclibc \
360                `cat /tmp/$(ARCHITECTURE)/mklibs-progs` 2>&1
361
362endif
363        cp /tmp/$(ARCHITECTURE)/mklibs-out/* $(TARGETDIR)/lib
364endif
365#       rm -f $(TARGETDIR)/lib/*.a
366#       rm -f $(TARGETDIR)/lib/*.map
367#       cp lib.$(ARCH)/libresolv.so.0 $(TARGETDIR)/lib
368#       cp lib.$(ARCH)/libgcc_s.so.1 $(TARGETDIR)/lib
369
370
371install package: clean_target $(filter-out lib.$(ARCH)-install,$(obj-install)) $(LINUXDIR)/.config
372        # Install binaries into target directory
373        install -d $(TARGETDIR)
374        for dir in $(wildcard $(patsubst %,$(INSTALLDIR)/%,$(obj-y))) ; do \
375            (cd $${dir} && tar cpf - .) | (cd $(TARGETDIR) && tar xpf -) \
376        done
377        mkdir -p $(ARCH)-uclibc/target/etc/config
378        mkdir -p $(ARCH)-uclibc/target/etc/kaid
379        mkdir -p $(ARCH)-uclibc/target/etc/langpack
380        cd  $(ARCH)-uclibc/target/lib
381        cp ./opt/etc/preinit $(ARCH)-uclibc/target/etc
382        cp ./opt/etc/postinit $(ARCH)-uclibc/target/etc
383        cp ./opt/etc/ipkg.conf $(ARCH)-uclibc/target/etc
384        cp ./opt/etc/config/* $(ARCH)-uclibc/target/etc/config
385        cp ./opt/usr/lib/smb.conf $(ARCH)-uclibc/target/usr/lib
386        # optimize the others library by removing unneeded symbols
387        $(MAKE) -f Makefile.alpine optimize-lib
388        # Install modules into filesystem
389        if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
390            $(MAKE) -C $(LINUXDIR) modules_install DEPMOD=/bin/true INSTALL_MOD_PATH=$(TARGETDIR) ; \
391        fi
392ifeq ($(CONFIG_MADWIFI),y)
393        rm -rf $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/kernel/drivers/net/wl
394endif
395
396
397ifneq ($(CONFIG_SAMBA),y)
398        rm -rf $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/kernel/fs/cifs
399endif
400        rm -f $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/build
401        rm -f $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/source
402        # Prepare filesystem
403        # Make sure mksquashfs-2.0 is used
404        cd $(TARGETDIR)  &&  find . -iname "CVS" | xargs rm -rf
405        cd $(TARGETDIR)  &&  find . -iname ".svn" | xargs rm -rf
406
407        find $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/kernel -name *.ko -exec mv {} $(TARGETDIR)/lib/modules/$(KERNELRELEASE) \;
408        -find $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/net -name *.ko -exec mv {} $(TARGETDIR)/lib/modules/$(KERNELRELEASE) \;
409        rm -rf $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/kernel
410        rm -rf $(TARGETDIR)/lib/modules/$(KERNELRELEASE)/net
411        #e2fsck -y -f $(ARCH)-uclibc/root.fs
412        ./busybox/examples/depmod.pl -F $(LINUXDIR)/System.map -b $(ARCH)-uclibc/target/lib/modules
413#       tar --directory=$(TARGETDIR) --remove-files -cvvjf $(TARGETDIR)/etc/local.tar.bz2 usr/local
414        rm -rf $(TARGETDIR)/usr/local
415        mkdir $(TARGETDIR)/usr/local
416       
417       
418ifeq ($(CONFIG_KAID),y)
419        cp kaid/kaid $(TARGETDIR)/usr/sbin
420endif
421        mv $(TARGETDIR)/usr/lib/services.so $(TARGETDIR)/lib
422
423        export STRIP_KMOD="$(LINUXDIR)/scripts/strip-kmod.sh" && \
424        export STRIP="sstrip" && \
425        $(LINUXDIR)/scripts/rstrip.sh $(TARGETDIR)
426        cd $(TARGETDIR) && $(TOP)/misc/rootprep.sh
427        #mkdir $(TARGETDIR)/boot
428       
429        cp -fpR $(LINUXDIR)/arch/arm/boot/zImage $(ARCH)-uclibc/zImage-alpine
430#       cat $(LINUXDIR)/arch/arm/boot/dts/alpine-r9000.dtb >> $(ARCH)-uclibc/zImage-alpine;
431        $(LINUXDIR)/scripts/squashfs/mksquashfs-lzma $(ARCH)-uclibc/target $(ARCH)-uclibc/root.squashfs -noappend -root-owned -le
432       
433
434        dd if=$(ARCH)-uclibc/zImage-alpine bs=$(shell expr $(MAX_KERNEL_SIZE)) conv=sync of=$(ARCH)-uclibc/zImage-alpine-fix
435        dd if=$(ARCH)-uclibc/zImage-alpine-fix bs=1 count=$(shell expr $(MAX_KERNEL_SIZE) - 132) conv=sync of=$(ARCH)-uclibc/zImage-alpine-fix2
436        mkimage -A arm -O linux -T kernel -a 0x00008000 -C none -e 0x00008000 -n 'DD-WRT' -d $(ARCH)-uclibc/zImage-alpine-fix2 $(ARCH)-uclibc/uImage;
437
438#       dd if=$(ARCH)-uclibc/uImage bs=$(shell expr $(MAX_KERNEL_SIZE)) conv=sync of=$(ARCH)-uclibc/uImage.fix
439
440        ./tools/r9000/r9000 $(ARCH)-uclibc/uImage $(ARCH)-uclibc/vmlinux.uImage.normal add_image_size
441
442        dd if=$(ARCH)-uclibc/root.squashfs of=$(ARCH)-uclibc/root.squashfs.final bs=2k conv=sync
443        mkimage -A arm -O linux -C lzma -T kernel -a 0x40908000 \
444                -e 0x40908000 -n 'Linux-DD-WRT' \
445                -d $(ARCH)-uclibc/root.squashfs.final $(ARCH)-uclibc/squashfs.uImage
446        ./tools/r9000/r9000 \
447                $(ARCH)-uclibc/squashfs.uImage \
448                $(ARCH)-uclibc/squashfs.uImage.tmp
449        cat $(ARCH)-uclibc/squashfs.uImage.tmp >> $(ARCH)-uclibc/vmlinux.uImage.normal
450
451
452
453#       cat $(ARCH)-uclibc/vmlinux.uImage.normal > $(ARCH)-uclibc/vmlinux.uImage.tmp
454#       dd if=$(ARCH)-uclibc/vmlinux.uImage.tmp bs=$(shell expr $(MAX_KERNEL_SIZE) - 64) conv=sync of=$(ARCH)-uclibc/vmlinux.uImage.final
455#       dd if=$(ARCH)-uclibc/squashfs.uImage.tmp bs=64 count=1 >> $(ARCH)-uclibc/vmlinux.uImage.final
456#       ( \
457#               dd if=$(ARCH)-uclibc/vmlinux.uImage.final bs=$(MAX_KERNEL_SIZE) conv=sync; \
458#               dd if=$(ARCH)-uclibc/root.squashfs.final bs=64k; \
459#       ) > $(ARCH)-uclibc/alpine-sysupgrade.bin
460        ./tools/r9000/mkdniimg \
461                -B $(MODULE_NAME) -v $(FW_VERSION) -r $(FW_REGION) -H $(HW_ID) \
462                -i $(ARCH)-uclibc/vmlinux.uImage.normal \
463                -o $(ARCH)-uclibc/$(MODULE_NAME)-$(FW_VERSION)$(FW_REGION).img
464        -./tools/trx_n -m 55000000 -o $(ARCH)-uclibc/r9000.bin $(ARCH)-uclibc/vmlinux.uImage.normal
465
466
467       
468
469
470
471fixup:
472
473        dd if=$(ARCH)-uclibc/zImage-alpine bs=$(shell expr $(MAX_KERNEL_SIZE)) conv=sync of=$(ARCH)-uclibc/zImage-alpine-fix
474        dd if=$(ARCH)-uclibc/zImage-alpine-fix bs=1 count=$(shell expr $(MAX_KERNEL_SIZE) - 132) conv=sync of=$(ARCH)-uclibc/zImage-alpine-fix2
475        mkimage -A arm -O linux -T kernel -a 0x00008000 -C none -e 0x00008000 -n 'DD-WRT' -d $(ARCH)-uclibc/zImage-alpine-fix2 $(ARCH)-uclibc/uImage;
476
477#       dd if=$(ARCH)-uclibc/uImage bs=$(shell expr $(MAX_KERNEL_SIZE)) conv=sync of=$(ARCH)-uclibc/uImage.fix
478
479        ./tools/r9000/r9000 $(ARCH)-uclibc/uImage $(ARCH)-uclibc/vmlinux.uImage.normal add_image_size
480
481        dd if=$(ARCH)-uclibc/root.squashfs of=$(ARCH)-uclibc/root.squashfs.final bs=2k conv=sync
482        mkimage -A arm -O linux -C lzma -T kernel -a 0x40908000 \
483                -e 0x40908000 -n 'Linux-DD-WRT' \
484                -d $(ARCH)-uclibc/root.squashfs.final $(ARCH)-uclibc/squashfs.uImage
485        ./tools/r9000/r9000 \
486                $(ARCH)-uclibc/squashfs.uImage \
487                $(ARCH)-uclibc/squashfs.uImage.tmp
488        cat $(ARCH)-uclibc/squashfs.uImage.tmp >> $(ARCH)-uclibc/vmlinux.uImage.normal
489
490
491
492#       cat $(ARCH)-uclibc/vmlinux.uImage.normal > $(ARCH)-uclibc/vmlinux.uImage.tmp
493#       dd if=$(ARCH)-uclibc/vmlinux.uImage.tmp bs=$(shell expr $(MAX_KERNEL_SIZE) - 64) conv=sync of=$(ARCH)-uclibc/vmlinux.uImage.final
494#       dd if=$(ARCH)-uclibc/squashfs.uImage.tmp bs=64 count=1 >> $(ARCH)-uclibc/vmlinux.uImage.final
495#       ( \
496#               dd if=$(ARCH)-uclibc/vmlinux.uImage.final bs=$(MAX_KERNEL_SIZE) conv=sync; \
497#               dd if=$(ARCH)-uclibc/root.squashfs.final bs=64k; \
498#       ) > $(ARCH)-uclibc/alpine-sysupgrade.bin
499        ./tools/r9000/mkdniimg \
500                -B $(MODULE_NAME) -v $(FW_VERSION) -r $(FW_REGION) -H $(HW_ID) \
501                -i $(ARCH)-uclibc/vmlinux.uImage.normal \
502                -o $(ARCH)-uclibc/$(MODULE_NAME)-$(FW_VERSION)$(FW_REGION).img
503
504
505
506include rules/all.mk
507
508.PHONY: all clean distclean mrproper install package
509.PHONY: conf mconf oldconf kconf kmconf config menuconfig oldconfig
510.PHONY: dummy fixkc libnet libpcap
511
512
513
Note: See TracBrowser for help on using the repository browser.