Index: target/linux/ar7-2.4/image/src/ckmain.c =================================================================== --- target/linux/ar7-2.4/image/src/ckmain.c (revision 0) +++ target/linux/ar7-2.4/image/src/ckmain.c (revision 0) @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002 + * Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Texas Instruments. + * 4. Neither the name of the Company nor of the product may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * File: cfgmgr_ckmain.c + * + * Created: Wed Aug 14 18:24:53 2002 + * + * $Id: ckmain.c,v 1.2 2003/12/04 19:22:01 jharrell Exp $ + */ + +#include "cksum.h" + +int main(int argc, char **argv) +{ + FILE *fp; + unsigned long sum = 0; + unsigned long res = 0; + + if(argc != 2) + { + printf("Usage: cfgmgr_cksum filename\n\n"); + return 1; + } + + fp = fopen(argv[1], "rw+"); + + if(!cs_is_tagged(fp)) + { + printf("File doesn't contain the checksum, adding\n"); + if(cs_calc_sum(fp, &sum, 0)) + { + printf("Calculated checksum is %lX\n", sum); + if(cs_set_sum(fp, sum, 0)) + printf("Added successfully\n"); + else + printf("Adding failed\n"); + } + } + else + { + printf("File already contains the checksum, verifying\n"); + if(cs_calc_sum(fp, &sum, 1)) + { + printf("Calculated checksum is %lX\n", sum); + cs_get_sum(fp, &res); + printf("Saved checksum is %lX\n", res); + if(sum != res) + printf("Checksum validation failed!\n"); + else + printf("Checksum validation successful!\n"); + } + } + + fclose(fp); + + return 0; +} Index: target/linux/ar7-2.4/image/src/cksum.c =================================================================== --- target/linux/ar7-2.4/image/src/cksum.c (revision 0) +++ target/linux/ar7-2.4/image/src/cksum.c (revision 0) @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2002 + * Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Texas Instruments. + * 4. Neither the name of the Company nor of the product may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#include "cksum.h" + +#define BUFLEN (1 << 16) + +#define MAGIC_NUMBER 0xC453DE23 + +static unsigned long crctab[256] = +{ + 0x0, + 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, + 0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, + 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, + 0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, + 0x5BD4B01B, 0x569796C2, 0x52568B75, 0x6A1936C8, 0x6ED82B7F, + 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, + 0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, + 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 0xBE2B5B58, + 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, + 0xA4AD16EA, 0xA06C0B5D, 0xD4326D90, 0xD0F37027, 0xDDB056FE, + 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95, + 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, + 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 0x34867077, 0x30476DC0, + 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, + 0x2AC12072, 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, + 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 0x7897AB07, + 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, + 0x6211E6B5, 0x66D0FB02, 0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, + 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA, + 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, + 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 0x8AAD2B2F, 0x8E6C3698, + 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, + 0x94EA7B2A, 0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, + 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 0xC6BCF05F, + 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, + 0xDC3ABDED, 0xD8FBA05A, 0x690CE0EE, 0x6DCDFD59, 0x608EDB80, + 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, + 0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, + 0x58C1663D, 0x558240E4, 0x51435D53, 0x251D3B9E, 0x21DC2629, + 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, + 0x3B5A6B9B, 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, + 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 0xF12F560E, + 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, + 0xEBA91BBC, 0xEF68060B, 0xD727BBB6, 0xD3E6A601, 0xDEA580D8, + 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3, + 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, + 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 0x9B3660C6, 0x9FF77D71, + 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, + 0x857130C3, 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, + 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 0x7B827D21, + 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, + 0x61043093, 0x65C52D24, 0x119B4BE9, 0x155A565E, 0x18197087, + 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC, + 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, + 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 0xC5A92679, 0xC1683BCE, + 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, + 0xDBEE767C, 0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, + 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 0x89B8FD09, + 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, + 0x933EB0BB, 0x97FFAD0C, 0xAFB010B1, 0xAB710D06, 0xA6322BDF, + 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4 +}; + +int cs_is_tagged(FILE *fp) +{ + char buf[8]; + + fseek(fp, -8, SEEK_END); + fread(buf, 8, 1, fp); + if(*(unsigned long*)buf == MAGIC_NUMBER) + return 1; + return 0; +} + +unsigned long cs_read_sum(FILE *fp) +{ + char buf[8]; + + fseek(fp, -8, SEEK_END); + fread(buf, 8, 1, fp); + return *((unsigned long*)&buf[4]); +} + +int cs_calc_sum(FILE *fp, unsigned long *res, int tagged) +{ + unsigned char buf[BUFLEN]; + unsigned long crc = 0; + uintmax_t length = 0; + size_t bytes_read; + + fseek(fp, 0, SEEK_SET); + + while((bytes_read = fread(buf, 1, BUFLEN, fp)) > 0) + { + unsigned char *cp = buf; + + if(length + bytes_read < length) + return 0; + + if(bytes_read != BUFLEN && tagged) + bytes_read -= 8; + + length += bytes_read; + while(bytes_read--) + crc =(crc << 8) ^ crctab[((crc >> 24) ^ *cp++) & 0xFF]; + } + + if(ferror(fp)) + return 0; + + for(; length; length >>= 8) + crc =(crc << 8) ^ crctab[((crc >> 24) ^ length) & 0xFF]; + + crc = ~crc & 0xFFFFFFFF; + + *res = crc; + + return 1; +} + +unsigned long cs_calc_buf_sum(char *buf, int size) +{ + unsigned long crc = 0; + char *cp = buf; + unsigned long length = size; + + while(size--) + crc =(crc << 8) ^ crctab[((crc >> 24) ^ *cp++) & 0xFF]; + + for(; length; length >>= 8) + crc =(crc << 8) ^ crctab[((crc >> 24) ^ length) & 0xFF]; + + crc = ~crc & 0xFFFFFFFF; + + return crc; +} + +int cs_set_sum(FILE *fp, unsigned long sum, int tagged) +{ + unsigned long magic = MAGIC_NUMBER; + + if(tagged) + fseek(fp, -8, SEEK_END); + else + fseek(fp, 0, SEEK_END); + + if(fwrite(&magic, 1, 4, fp) < 4) + return 0; + if(fwrite(&sum, 1, 4, fp) < 4) + return 0; + + return 1; +} + +void cs_get_sum(FILE *fp, unsigned long *sum) +{ + unsigned long magic = 0; + + fseek(fp, -8, SEEK_END); + + fread(&magic, 4, 1, fp); + fread(sum, 4, 1, fp); +} Index: target/linux/ar7-2.4/image/src/loader.c =================================================================== --- target/linux/ar7-2.4/image/src/loader.c (revision 6910) +++ target/linux/ar7-2.4/image/src/loader.c (working copy) @@ -25,6 +25,7 @@ void (*ke)(int, char *[], char *[]); /* Gen reference to kernel function */ void (*prnt)(unsigned int, char *); /* Gen reference to Yamon print function */ void printf(char *ptr); /* Generate our own printf */ +int ar7_compressed_kernel_size; int tikernelunzip(int argc, char *argv[], char *arge[]) { @@ -114,8 +115,10 @@ wsize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp))) * sizeof(CProb); if ((status = LzmaDecode((unsigned char *) &workspace, wsize, lc, lp, pb, - indata + 13, insize - 13, (unsigned char *) output_data, osize, &i)) == LZMA_RESULT_OK) + indata + 13, insize - 13, (unsigned char *) output_data, osize, &i)) == LZMA_RESULT_OK) { + ar7_compressed_kernel_size = insize; return 0; + } return status; } Index: target/linux/ar7-2.4/image/src/cksum.h =================================================================== --- target/linux/ar7-2.4/image/src/cksum.h (revision 0) +++ target/linux/ar7-2.4/image/src/cksum.h (revision 0) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002 + * Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Texas Instruments. + * 4. Neither the name of the Company nor of the product may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * File: cfgmgr_cksum.h + * + * Created: Wed Aug 14 18:25:30 2002 + * + * $Id: cksum.h,v 1.2 2003/12/04 19:22:01 jharrell Exp $ + */ + +#ifndef CFGMGR_CKSUM_H +#define CFGMGR_CKSUM_H + +#include +#include +#include + +int cs_is_tagged(FILE*); +unsigned long cs_read_sum(FILE*); +int cs_calc_sum(FILE*, unsigned long*, int); +int cs_set_sum(FILE*, unsigned long, int); +void cs_get_sum(FILE*, unsigned long*); +unsigned long cs_calc_buf_sum(char*, int); + +#endif Index: target/linux/ar7-2.4/image/Makefile =================================================================== --- target/linux/ar7-2.4/image/Makefile (revision 6910) +++ target/linux/ar7-2.4/image/Makefile (working copy) @@ -18,15 +18,10 @@ -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \ -DLOADADDR=$(LOADADDR) -$(PKG_BUILD_DIR)/cksum.o: $(PKG_BUILD_DIR)/cksum.c - $(HOSTCC) -o $@ $< +TICHKSUM_SRCS := src/ckmain.c src/cksum.c +$(STAGING_DIR)/bin/tichksum: $(TICHKSUM_SRCS) + $(HOSTCC) -o $@ $(TICHKSUM_SRCS) -$(PKG_BUILD_DIR)/ckmain.o: $(PKG_BUILD_DIR)/ckmain.c - $(HOSTCC) -o $@ $< - -$(PKG_BUILD_DIR)/tichksum: $(PKG_BUILD_DIR)/ckmain.o $(PKG_BUILD_DIR)/cksum.o - $(HOSTCC) -o $@ $< - $(PKG_BUILD_DIR)/LzmaDecode.o: src/LzmaDecode.c $(TARGET_CC) $(CFLAGS) -c -o $@ $< @@ -47,7 +42,7 @@ -e 's/@@LOADADDR@@/$(LOADADDR)/' \ < src/ld.script.in \ > $(PKG_BUILD_DIR)/ld.script - $(MAKE) $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin + $(MAKE) $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin $(STAGING_DIR)/bin/tichksum endef define Build/Clean @@ -57,7 +52,7 @@ define Image/Prepare cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma $(TARGET_CROSS)ld -T $(PKG_BUILD_DIR)/zimage.script -r -b binary $(KDIR)/vmlinux.lzma -o $(KDIR)/zimage.o - $(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=0x$${shell $(TARGET_CROSS)nm $(KDIR)/linux-*/vmlinux | grep kernel_entry | cut -d' ' -f1} -T $(PKG_BUILD_DIR)/ld.script \ + $(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=0x$${shell $(TARGET_CROSS)nm $(KDIR)/linux-*/vmlinux | grep kernel_entry | cut -d' ' -f1} --defsym ar7_compressed_kernel_size=0x$${shell $(TARGET_CROSS)nm $(KDIR)/linux-*/vmlinux | grep ar7_compressed_kernel_size | cut -d' ' -f1} -T $(PKG_BUILD_DIR)/ld.script \ $(PKG_BUILD_DIR)/loader.o \ $(PKG_BUILD_DIR)/LzmaDecode.o \ $(KDIR)/zimage.o \ @@ -86,6 +81,20 @@ rm -f "$(KDIR)/dgfw.tmp" endef +define Image/Build/DSL502T/squashfs + # Kernel, padded to flash erase boundary and with header from vendor image at the start + perl dsl502t/gen_header > $(BIN_DIR)/DLinkAU_DSL-502T_openwrt-$(KERNEL)-$(1).hdrkrn + cat $(KDIR)/vmlinux.bin >> $(BIN_DIR)/DLinkAU_DSL-502T_openwrt-$(KERNEL)-$(1).hdrkrn + dd if=$(BIN_DIR)/DLinkAU_DSL-502T_openwrt-$(KERNEL)-$(1).hdrkrn bs=65536 conv=sync > \ + $(BIN_DIR)/DLinkAU_DSL-502T_openwrt-$(KERNEL)-$(1).img + + # Add the root filesystem + cat $(KDIR)/root.$(1) >> $(BIN_DIR)/DLinkAU_DSL-502T_openwrt-$(KERNEL)-$(1).img + + # Checksum it + $(STAGING_DIR)/bin/tichksum $(BIN_DIR)/DLinkAU_DSL-502T_openwrt-$(KERNEL)-$(1).img +endef + define Image/Build dd if=$(KDIR)/vmlinux.bin $(call align/$(1)) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin @@ -97,6 +106,7 @@ $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1)) $(call Image/Build/sErCoMm,$(1),dg834,$(1)) $(call Image/Build/sErCoMm,$(1),jdr454wb,$(1)) + $(call Image/Build/DSL502T/$(1),$(1)) endef $(eval $(call BuildImage)) Index: target/linux/ar7-2.4/image/dsl502t/gen_header =================================================================== --- target/linux/ar7-2.4/image/dsl502t/gen_header (revision 0) +++ target/linux/ar7-2.4/image/dsl502t/gen_header (revision 0) @@ -0,0 +1,10 @@ +#!/usr/bin/perl +print "\064\104\124\115\001\002\003\004\100\060\040\020\000\000\000\000"; +print "\220\000\000\000\220\340\040\000\116\123\120\040\063\056\065\056"; +print "\061\040\122\145\154\145\141\163\145\000\000\000\000\000\000\000"; +print "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"; +print "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"; +print "\000\000\000\000\000\000\000\000\172\014\000\000\171\211\367\017"; +print "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"; +print "\220\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"; +print "\000\020\010\000\000\340\030\000\000\000\000\000\000\000\000\000"; Index: target/linux/ar7-2.4/profiles/AnnexA2.mk =================================================================== --- target/linux/ar7-2.4/profiles/AnnexA2.mk (revision 0) +++ target/linux/ar7-2.4/profiles/AnnexA2.mk (revision 0) @@ -0,0 +1,12 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/AnnexA2 + NAME:=ADSL 2/2+ Annex A + PACKAGES:=kmod-sangam-atm-adsl2-annex-a ppp-mod-pppoa +endef +$(eval $(call Profile,AnnexA2)) Index: target/linux/ar7-2.4/profiles/AnnexB2.mk =================================================================== --- target/linux/ar7-2.4/profiles/AnnexB2.mk (revision 0) +++ target/linux/ar7-2.4/profiles/AnnexB2.mk (revision 0) @@ -0,0 +1,13 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/AnnexB2 + NAME:=ADSL 2/2+ Annex B + PACKAGES:=kmod-sangam-atm-adsl2-annex-b ppp-mod-pppoa +endef +$(eval $(call Profile,AnnexB2)) + Index: target/linux/ar7-2.4/patches/007-dsl502t-singleimage.patch =================================================================== --- target/linux/ar7-2.4/patches/007-dsl502t-singleimage.patch (revision 0) +++ target/linux/ar7-2.4/patches/007-dsl502t-singleimage.patch (revision 0) @@ -0,0 +1,124 @@ +--- linux-2.4.34/drivers/mtd/maps/ar7-flash.c 2007-04-14 11:35:48.000000000 +1000 ++++ linux-2.4.34/drivers/mtd/maps/ar7-flash.c 2007-04-14 11:35:14.000000000 +1000 +@@ -19,13 +19,13 @@ + #define BUSWIDTH CONFIG_MTD_AR7_BUSWIDTH + + #include +-extern char *prom_getenv(char *name); ++#include + + static int create_mtd_partitions(void); + static void ar7_mtd_cleanup(void); + + #define MAX_NUM_PARTITIONS 5 +-static struct mtd_partition ar7_partinfo[MAX_NUM_PARTITIONS]; ++static struct mtd_partition ar7_partinfo[MAX_NUM_PARTITIONS+2]; + + static struct mtd_info *ar7_mtd_info; + +@@ -123,6 +123,7 @@ + return strcpy(s, str); + } + ++int ar7_compressed_kernel_size = 0xffffffff; + + static int create_mtd_partitions(void) + { +@@ -138,6 +139,8 @@ + unsigned int adam2_size = 0x20000; + unsigned int config_offset = WINDOW_SIZE; + unsigned int rootfs_start = 0xe0000; ++ int dsl502t_single_image = 0; ++ char *usb_prod = prom_getenv("usb_prod"); + + printk("Parsing ADAM2 partition map...\n"); + +@@ -177,6 +180,8 @@ + if (offset == 0) { + printk("Assuming adam2 size of 0x%x\n", size); + adam2_size = size; // boot loader ++ } else if (offset == 0x10090 && usb_prod && strcmp(usb_prod, "DSL-502T") == 0) { ++ dsl502t_single_image = 1; + } else if (offset > 0x120000) { + if (config_offset > offset) + config_offset = offset; // reserved at the end of the flash chip +@@ -187,6 +192,11 @@ + + p++; + } while (p < MAX_NUM_PARTITIONS); ++ ++ if (config_offset != 0x3f0000 || rootfs_start != 0x91000) ++ dsl502t_single_image = 0; ++ else if (dsl502t_single_image) ++ printk("Ignoring DSL-502T MTD layout for kernel/filesystem boundary.\n"); + + p = 0; + +@@ -195,11 +205,34 @@ + ar7_partinfo[p].size = adam2_size; + ar7_partinfo[p++].mask_flags = 0; + +- ar7_partinfo[p].name = strdup("linux"); ++ ar7_partinfo[p].name = strdup(dsl502t_single_image ? "DSL-502T header+kernel" : "linux"); + ar7_partinfo[p].offset = adam2_size; + ar7_partinfo[p].size = config_offset - adam2_size; + ar7_partinfo[p++].mask_flags = 0; + ++ if (dsl502t_single_image && ar7_compressed_kernel_size != 0xffffffff) { ++ int newoffset; ++ ++ /* Search past the end of the kernel image for the squashfs start. */ ++ ar7_partinfo[p-2].mask_flags |= MTD_WRITEABLE; ++ newoffset = ar7_compressed_kernel_size; ++ newoffset &= ~3; ++ do { ++ if (ar7_read32(&ar7_map, newoffset) == SQUASHFS_MAGIC) { ++ ar7_partinfo[p-1].size = newoffset - adam2_size; ++ ar7_partinfo[p].name = strdup("rootfs"); ++ ar7_partinfo[p].offset = newoffset; ++ ar7_partinfo[p].size = config_offset - newoffset; ++ ar7_partinfo[p++].mask_flags = 0; ++ rootfs_start = newoffset; ++ break; ++ } ++ newoffset += 4; ++ } while (newoffset < config_offset && ++ newoffset < ar7_compressed_kernel_size + ar7_mtd_info->erasesize * 4); ++ goto found_rootfs; ++ } ++ + if (ar7_read32(&ar7_map, adam2_size) == 0xfeedfa42) { + rootfs_start = ar7_read32(&ar7_map, adam2_size + 4) + adam2_size + 28; + printk("Setting new rootfs offset to %08x\n", rootfs_start); +@@ -211,10 +244,11 @@ + + ar7_partinfo[p++].mask_flags = 0; + ++found_rootfs: + ar7_partinfo[p].name = strdup("config"); + ar7_partinfo[p].offset = config_offset; + ar7_partinfo[p].size = ar7_mtd_info->size - config_offset; +- ar7_partinfo[p++].mask_flags = 0; ++ ar7_partinfo[p++].mask_flags = dsl502t_single_image ? MTD_WRITEABLE : 0; + + if (ar7_read32(&ar7_map, rootfs_start) == SQUASHFS_MAGIC) { + int newsize, newoffset; +@@ -242,6 +276,18 @@ + } + } + ++ /* For flashing back a standard image. */ ++ if (dsl502t_single_image) { ++ ar7_partinfo[p].name = strdup("DSL-502T Single Image"); ++ ar7_partinfo[p].offset = 0x10000; ++ ar7_partinfo[p].size = 0x03e0000; ++ ar7_partinfo[p++].mask_flags = 0; ++ ++ /* Use internal PHY if no value is set. */ ++ if (prom_getenv("MAC_PORT") == NULL) ++ prom_local_setenv("MAC_PORT", "0"); ++ } ++ + return p; + } + Index: target/linux/ar7-2.4/patches/006-local-env.patch =================================================================== --- target/linux/ar7-2.4/patches/006-local-env.patch (revision 0) +++ target/linux/ar7-2.4/patches/006-local-env.patch (revision 0) @@ -0,0 +1,167 @@ +--- linux-2.4.34/include/asm-mips/ar7/adam2_env.h 2007-04-13 23:31:58.000000000 +1000 ++++ linux-2.4.34/include/asm-mips/ar7/adam2_env.h 2007-04-13 22:05:27.000000000 +1000 +@@ -9,5 +9,6 @@ + + char *prom_getenv(char *); + t_env_var *prom_iterenv(t_env_var *); ++int prom_local_setenv(char *name, char *val); + + #endif /* _INCLUDE_ASM_AR7_ADAM2_ENV_H_ */ +--- linux-2.4.34/arch/mips/ar7/init.c 2007-04-13 23:31:58.000000000 +1000 ++++ linux-2.4.34/arch/mips/ar7/init.c 2007-04-13 22:54:30.000000000 +1000 +@@ -89,6 +89,75 @@ + return prom_adam2_getenv(envname); + } + ++static char *strdup(char *str) ++{ ++ int n = strlen(str)+1; ++ char *s = kmalloc(n, GFP_KERNEL); ++ if (!s) return NULL; ++ return strcpy(s, str); ++} ++ ++/* Update the local environment */ ++int prom_local_setenv(char *name, char *val) ++{ ++ t_env_var *firstempty = NULL; ++ t_env_var *lastfull = NULL; ++ t_env_var *match = NULL; ++ t_env_var *env = local_envp; ++ ++ if (env_type == 1) ++ return -EINVAL; /* Can't do */ ++ ++ while (1) { ++ if (!env->name) { ++ firstempty = env; ++ break; ++ } else ++ lastfull = env; ++ if (strcmp(env->name, name) == 0) ++ match = env; ++ env++; ++ if (env - local_envp > MAX_ENV_ENTRY) ++ break; ++ } ++ ++ if (match == NULL && firstempty == NULL) ++ return -ENOMEM; /* Not found and no space */ ++ ++ /* Nothing to delete */ ++ if (match == NULL && strlen(val) == 0) ++ return 0; ++ ++ /* New entry. */ ++ if (match == NULL) { ++ match = firstempty; ++ name = strdup(name); ++ if (name == NULL) ++ return -ENOMEM; ++ match->name = strdup(name); ++ } ++ ++ /* Delete entry */ ++ if (strlen(val) == 0) { ++ match->name = NULL; ++ match->val = NULL; ++ if (lastfull) { ++ *match = *lastfull; ++ lastfull->name = NULL; ++ lastfull->val = NULL; ++ } ++ return 0; ++ } ++ ++ /* Replace entry */ ++ val = strdup(val); ++ if (val == NULL) ++ return -ENOMEM; ++ match->val = val; ++ ++ return 0; ++} ++ + t_env_var * + prom_iterenv(t_env_var *last) + { +--- linux-2.4.34/drivers/char/ticfg/adam2_env.c 2007-04-13 23:31:58.000000000 +1000 ++++ linux-2.4.34/drivers/char/ticfg/adam2_env.c 2007-04-13 23:58:44.000000000 +1000 +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + + #include + +@@ -21,6 +22,7 @@ + + static struct proc_dir_entry *adam2_env_proc_dir; + static struct proc_dir_entry *adam2_env_proc_ent; ++static struct proc_dir_entry *adam2_env_proc_ent_local; + + static int + adam2_proc_read_env(char *page, char **start, off_t pos, int count, +@@ -45,6 +47,35 @@ + return len; + } + ++static int ticfg_proc_write_env_local(struct file *file, const char *buffer, ++ unsigned long count, void *data) ++{ ++ char envdata[256]; ++ char *pvar; ++ char *pval; ++ ++ if (!buffer || count > sizeof(envdata)) ++ return -EINVAL; ++ ++ if (copy_from_user(envdata, buffer, count)) ++ return -EFAULT; ++ ++ /* extract the variable/value pair */ ++ if (count) ++ envdata[count-1]='\0'; ++ else ++ envdata[count]='\0'; ++ ++ pvar=envdata; ++ pval=strpbrk(envdata," \t"); ++ if(pval) *pval++='\0'; ++ ++ /* Store in the local environment */ ++ prom_local_setenv(pvar, pval ? pval : ""); ++ ++ return count; ++} ++ + static int __init + adam2_env_init(void) + { +@@ -68,6 +99,17 @@ + } + adam2_env_proc_ent->read_proc = adam2_proc_read_env; + ++ adam2_env_proc_ent_local = ++ create_proc_entry(ADAM2_ENV_NAME "_local", 0200, adam2_env_proc_dir); ++ if (!adam2_env_proc_ent_local) { ++ printk(KERN_ERR "%s: Unable to create /proc/%s/%s entry\n", ++ __FUNCTION__, ADAM2_ENV_DIR, ADAM2_ENV_NAME "_local"); ++ remove_proc_entry(ADAM2_ENV_NAME, adam2_env_proc_dir); ++ remove_proc_entry(ADAM2_ENV_DIR, NULL); ++ return -ENOMEM; ++ } ++ adam2_env_proc_ent_local->write_proc = ticfg_proc_write_env_local; ++ + return 0; + } + +@@ -75,6 +117,7 @@ + void __exit + adam2_env_cleanup(void) + { ++ remove_proc_entry(ADAM2_ENV_NAME "_local", adam2_env_proc_dir); + remove_proc_entry(ADAM2_ENV_NAME, adam2_env_proc_dir); + remove_proc_entry(ADAM2_ENV_DIR, NULL); + } Index: package/ar7-atm-adsl2/patches/100-compile_fix.patch =================================================================== --- package/ar7-atm-adsl2/patches/100-compile_fix.patch (revision 0) +++ package/ar7-atm-adsl2/patches/100-compile_fix.patch (revision 0) @@ -0,0 +1,300 @@ +diff -ru sangam-atm-adsl2-7.01-dist/cppi_cpaal5.c sangam-atm-adsl2-7.01-owrt/cppi_cpaal5.c +--- sangam-atm-adsl2-7.01-dist/cppi_cpaal5.c 2005-04-08 22:22:04.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/cppi_cpaal5.c 2007-04-12 23:59:46.000000000 +1000 +@@ -352,7 +352,7 @@ + { + /* malloc failed, add this RCB to Needs Buffer List */ + TempRcb->FragCount = 1; /*MJH+030417*/ +- (HAL_RCB *)TempRcb->Eop = TempRcb; /* GSG +030430 */ ++ TempRcb->Eop = (void *)TempRcb; /* GSG +030430 */ + + if(HalDev->NeedsCount < MAX_NEEDS) /* +MJH 030410 */ + { /* +MJH 030410 */ +diff -ru sangam-atm-adsl2-7.01-dist/cp_sar_reg.h sangam-atm-adsl2-7.01-owrt/cp_sar_reg.h +--- sangam-atm-adsl2-7.01-dist/cp_sar_reg.h 2004-04-20 20:23:30.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/cp_sar_reg.h 2007-04-12 23:59:46.000000000 +1000 +@@ -214,4 +214,4 @@ + + /* END OF FILE */ + +-#endif _INC_SAR_REG ++#endif //_INC_SAR_REG +diff -ru sangam-atm-adsl2-7.01-dist/cpswhal_cpsar.h sangam-atm-adsl2-7.01-owrt/cpswhal_cpsar.h +--- sangam-atm-adsl2-7.01-dist/cpswhal_cpsar.h 2004-04-20 20:23:32.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/cpswhal_cpsar.h 2007-04-12 23:59:46.000000000 +1000 +@@ -430,10 +430,15 @@ + int (*DeviceFindInfo)(int Inst, const char *DeviceName, void *DeviceInfo); + int (*DeviceFindParmUint)(void *DeviceInfo, const char *Parm, bit32u *Value); + int (*DeviceFindParmValue)(void *DeviceInfo, const char *Parm, void *Value); +- void (*Free)(void *MemPtr); ++#ifndef OPENWRT_MODS ++#define CONST ++#else ++#define CONST const ++#endif ++ void (*Free)(CONST void *MemPtr); + void (*FreeRxBuffer)(OS_RECEIVEINFO *OsReceiveInfo, void *MemPtr); +- void (*FreeDev)(void *MemPtr); +- void (*FreeDmaXfer)(void *MemPtr); ++ void (*FreeDev)(CONST void *MemPtr); ++ void (*FreeDmaXfer)(CONST void *MemPtr); + void (*IsrRegister)(OS_DEVICE *OsDev, int (*halISR)(HAL_DEVICE*, int*), int InterruptBit); + void (*IsrUnRegister)(OS_DEVICE *OsDev, int InterruptBit); + void* (*Malloc)(bit32u size); +diff -ru sangam-atm-adsl2-7.01-dist/dsl_hal_api.c sangam-atm-adsl2-7.01-owrt/dsl_hal_api.c +--- sangam-atm-adsl2-7.01-dist/dsl_hal_api.c 2006-10-27 00:46:54.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/dsl_hal_api.c 2007-04-12 23:59:46.000000000 +1000 +@@ -234,6 +234,9 @@ + #include + + #ifndef NO_ADV_STATS ++#ifdef OPENWRT_MODS ++#define log10 log10_table ++#endif + #include + #endif + +diff -ru sangam-atm-adsl2-7.01-dist/Makefile sangam-atm-adsl2-7.01-owrt/Makefile +--- sangam-atm-adsl2-7.01-dist/Makefile 2005-06-01 17:46:28.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/Makefile 2007-04-13 09:50:34.000000000 +1000 +@@ -8,11 +8,20 @@ + # Viren Balar (vbalar@ti.com) + # Victor Wells (vwells@telogy.com) + # +-include $(TOPDIR)/Rules.make +- + ++O_TARGET := tiatm.o ++obj-m := tiatm.o + ++tiatm-objs += tn7atm.o tn7dsl.o tn7sar.o dsl_hal_api.o dsl_hal_support.o cpsar.o aal5sar.o dsl_hal_diagnostics.o dsl_hal_advcfg.o + ++#EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT + ++EXTRA_CFLAGS += -I. ++EXTRA_CFLAGS += -DPOST_SILICON -DCOMMON_NSP ++#EXTRA_CFLAGS += -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT ++EXTRA_CFLAGS += -DOPENWRT_MODS -D__NO__VOICE_PATCH__ + ++include $(TOPDIR)/Rules.make + ++tiatm.o: $(tiatm-objs) ++ $(LD) -r $(LDOPTS) -o $@ $(tiatm-objs) +diff -ru sangam-atm-adsl2-7.01-dist/tn7api.h sangam-atm-adsl2-7.01-owrt/tn7api.h +--- sangam-atm-adsl2-7.01-dist/tn7api.h 2006-10-27 00:48:34.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/tn7api.h 2007-04-13 09:48:12.000000000 +1000 +@@ -104,7 +104,11 @@ + + int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data); + int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data); ++#ifndef OPENWRT_MODS + inline int tn7dsl_handle_interrupt(void); ++#else ++int tn7dsl_handle_interrupt(Tn7AtmPrivate *priv); ++#endif + + void tn7dsl_dslmod_sysctl_register(void); + void tn7dsl_dslmod_sysctl_unregister(void); +@@ -163,4 +167,4 @@ + int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data); + int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data); + int tn7sar_tx_flush(void *privContext, int chan, int queue, int skip); +-#endif __SGAPI_H ++#endif //__SGAPI_H +diff -ru sangam-atm-adsl2-7.01-dist/tn7atm.c sangam-atm-adsl2-7.01-owrt/tn7atm.c +--- sangam-atm-adsl2-7.01-dist/tn7atm.c 2006-10-27 00:48:52.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/tn7atm.c 2007-04-13 09:50:58.000000000 +1000 +@@ -71,6 +71,9 @@ + #include + #include + #include ++#ifdef OPENWRT_MODS ++#include ++#endif + #include "dsl_hal_api.h" + #include "tn7atm.h" + #include "tn7api.h" +@@ -98,8 +101,10 @@ + /*end of externs */ + + #ifndef TI_STATIC_ALLOCATIONS ++#ifndef OPENWRT_MODS + #define TI_STATIC_ALLOCATIONS + #endif ++#endif + + #define tn7atm_kfree_skb(x) dev_kfree_skb(x) + +@@ -554,6 +559,7 @@ + * Description: retrieve VPI/VCI for connection + * + *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ++#ifndef OPENWRT_MODS + static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci) + { + struct atm_vcc *walk; +@@ -595,6 +601,7 @@ + + return 0; + } ++#endif + + + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@@ -655,7 +662,11 @@ + atmdev = (struct atm_dev *) voiddev; + priv = (Tn7AtmPrivate *) atmdev->dev_data; + ++#ifndef OPENWRT_MODS + retval = tn7dsl_handle_interrupt (); ++#else ++ retval = tn7dsl_handle_interrupt (priv); ++#endif + + dgprintf (4, "Leaving tn7atm_dsl_irq\n"); + +@@ -884,7 +895,15 @@ + MOD_INC_USE_COUNT; + + /* find a free VPI/VCI */ ++#ifndef OPENWRT_MODS + tn7atm_walk_vccs(vcc, &vpi, &vci); ++#else ++ if ((rc = atm_find_ci(vcc, &vpi, &vci))) { ++ printk("atm_find_ci err = %d\n", rc); ++ MOD_DEC_USE_COUNT; ++ return rc; ++ } ++#endif + + vcc->vpi = vpi; + vcc->vci = vci; +@@ -966,6 +985,7 @@ + tn7atm_activate_vc_parm.priority = 2; + break; + ++#ifndef OPENWRT_MODS + case ATM_VBR: /* Variable Bit Rate-Non RealTime*/ + tn7atm_activate_vc_parm.qos = 1; + tn7atm_activate_vc_parm.priority = 1; +@@ -987,6 +1007,7 @@ + tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr; + tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv; + break; ++#endif + + default: + tn7atm_activate_vc_parm.qos = 2; +diff -ru sangam-atm-adsl2-7.01-dist/tn7atm.h sangam-atm-adsl2-7.01-owrt/tn7atm.h +--- sangam-atm-adsl2-7.01-dist/tn7atm.h 2006-04-05 19:33:06.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/tn7atm.h 2007-04-12 23:59:46.000000000 +1000 +@@ -275,4 +275,4 @@ + #define PHYS_TO_K1(X) (PHYS_ADDR(X)|K1BASE) + #endif + +-#endif __TN7ATM_H ++#endif //__TN7ATM_H +diff -ru sangam-atm-adsl2-7.01-dist/tn7dsl.c sangam-atm-adsl2-7.01-owrt/tn7dsl.c +--- sangam-atm-adsl2-7.01-dist/tn7dsl.c 2006-10-27 00:48:44.000000000 +1000 ++++ sangam-atm-adsl2-7.01-owrt/tn7dsl.c 2007-04-12 23:59:46.000000000 +1000 +@@ -105,6 +105,10 @@ + #include + #include + #include ++#ifdef OPENWRT_MODS ++#include ++#define avalanche_request_intr_pacing avalanche_request_pacing ++#endif + /* Modules specific header files */ + #include "tn7atm.h" + #include "tn7api.h" +@@ -348,6 +352,7 @@ + #endif + } + ++#ifndef __HAVE_ARCH_STRCMP + int strcmp(const char *s1, const char *s2) + { + +@@ -355,7 +360,9 @@ + + return(strncmp(s1, s2, size)); + } ++#endif + ++#ifndef __HAVE_ARCH_STRNCMP + int strncmp(const char *s1, const char *s2, size_t size) + { + int i = 0; +@@ -380,6 +387,7 @@ + + return 0; + } ++#endif + + // * UR8_MERGE_START CQ10640 Jack Zhang + int tn7dsl_dump_dsp_memory(char *input_str) //cph99 +@@ -1547,28 +1555,28 @@ + if(len<=limit) + len += + sprintf (buf + len, "\tPower Management Status: L%d\tDS HLINSC: %ld\n", +- pIhw->AppData.pwrStatus, pIhw->AppData.dsHLINSC); ++ pIhw->AppData.pwrStatus, (long)pIhw->AppData.dsHLINSC); + // UR8_MERGE_END CQ10978* + + if(len<=limit) + len += + sprintf (buf + len, "\tUS ACTPSD: \t\t%ld\tDS ACTPSD: %ld\n", +- pIhw->AppData.usACTPSD, pIhw->AppData.dsACTPSD); ++ (long)pIhw->AppData.usACTPSD, (long)pIhw->AppData.dsACTPSD); + + if(len<=limit) + len += + sprintf (buf + len, "\tTotal init. errors: \t%ld\tTotal init. timeouts: %ld\n", +- pIhw->AppData.totalInitErrs, pIhw->AppData.totalInitTOs); ++ (long)pIhw->AppData.totalInitErrs, (long)pIhw->AppData.totalInitTOs); + + if(len<=limit) + len += + sprintf (buf + len, "\tShowtime init. errors: \t%ld\tShowtime init. timeouts: %ld\n", +- pIhw->AppData.showtimeInitErrs, pIhw->AppData.showtimeInitTOs); ++ (long)pIhw->AppData.showtimeInitErrs, (long)pIhw->AppData.showtimeInitTOs); + + if(len<=limit) + len += + sprintf (buf + len, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n", +- pIhw->AppData.lastshowInitErrs, pIhw->AppData.lastshowInitTOs); ++ (long)pIhw->AppData.lastshowInitErrs, (long)pIhw->AppData.lastshowInitTOs); + // UR8_MERGE_END CQ10979* + + if (len<=limit) +@@ -2551,14 +2559,20 @@ + return(rc); + } + ++#ifndef OPENWRT_MODS + inline int tn7dsl_handle_interrupt(void) ++#else ++int tn7dsl_handle_interrupt(Tn7AtmPrivate *priv) ++#endif + { + int intsrc; + unsigned char cMsgRa[6]; + short margin; + extern unsigned int def_sar_inter_pace; //Sorry + //UR8_MERGE_START CQ10450 Jack Zhang ++#ifndef OPENWRT_MODS + Tn7AtmPrivate *priv; ++#endif + //UR8_MERGE_END CQ10450* + + dgprintf(4, "tn7dsl_handle_dsl_interrupt()\n"); +@@ -2780,7 +2794,7 @@ + int value; + int i, offset[2]={4,11},oamFeature=0; + char tmp[4]; +- char dspVer[10]; ++ //char dspVer[10]; + + // OAM Feature Configuration + dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2, Index: package/ar7-atm-adsl2/Makefile =================================================================== --- package/ar7-atm-adsl2/Makefile (revision 0) +++ package/ar7-atm-adsl2/Makefile (revision 0) @@ -0,0 +1,55 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 6582 2007-03-16 20:21:39Z nbd $ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=sangam-atm-adsl2 +PKG_VERSION:=7.01 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.itee.uq.edu.au/~chrisp/DSL-502T_OpenWRT/ +PKG_MD5SUM:=15d25a5f14097f02fb019718d5f438a0 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/sangam-atm-adsl2-annex-a + SUBMENU:=Network Devices + DEPENDS:=@LINUX_2_4_AR7 +kmod-atm + TITLE:=AR7 ADSL 2/2+ driver (Annex A) + DESCRIPTION:=The AR7 ADSL driver for Annex A, with ADSL2/2+ support + VERSION:=$(PKG_VERSION)+$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) + FILES:=$(PKG_BUILD_DIR)/tiatm.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,tiatm) +endef + +define KernelPackage/sangam-atm-adsl2-annex-b + $(call KernelPackage/sangam-atm-adsl2-annex-a) + TITLE:=AR7 ADSL 2/2+ driver (Annex B) + DESCRIPTION:=The AR7 ADSL driver for Annex B, with ADSL2/2+ support +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + modules +endef + +define KernelPackage/sangam-atm-adsl2-annex-a/install + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700mp.bin $(1)/lib/modules/ar0700xx.bin +endef + +define KernelPackage/sangam-atm-adsl2-annex-b/install + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700db.bin $(1)/lib/modules/ar0700xx.bin +endef + +$(eval $(call KernelPackage,sangam-atm-adsl2-annex-a)) +$(eval $(call KernelPackage,sangam-atm-adsl2-annex-b)) Index: package/ar7-net/patches/100-disable_broken.patch =================================================================== --- package/ar7-net/patches/100-disable_broken.patch (revision 0) +++ package/ar7-net/patches/100-disable_broken.patch (revision 0) @@ -0,0 +1,18 @@ +--- avalanche-cpmac-0.1/cpmac.c 2006-10-18 00:52:21.000000000 +1000 ++++ avalanche-cpmac-0.1/cpmac.c 2007-04-14 00:04:47.000000000 +1000 +@@ -198,6 +198,7 @@ + char pad[SMP_CACHE_BYTES]; + } skb_head_pool[NR_CPUS]; + ++#if 0 + /************************************************************************** + * FUNCTION NAME : ti_release_skb + ************************************************************************** +@@ -396,6 +397,7 @@ + } + return; + } ++#endif + + +