1 diff -bBurN WRT54G/release/src/router/rc/Makefile-openwrt WRT54G.new/release/src/router/rc/Makefile-openwrt
2 --- WRT54G/release/src/router/rc/Makefile-openwrt 1969-12-31 18:00:00.000000000 -0600
3 +++ WRT54G.new/release/src/router/rc/Makefile-openwrt 2004-03-03 16:23:40.000000000 -0600
5 +# Copyright 2001-2003, Broadcom Corporation
6 +# All Rights Reserved.
9 +# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10 +# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11 +# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
12 +# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE
16 +# Router Wireless Interface Configuration Utility Makefile
18 +# Copyright 2003, Broadcom Corporation
19 +# All Rights Reserved.
22 +# $Id: Makefile,v 1.2 2004/01/13 00:55:58 mbm Exp $
25 +CFLAGS += -I. -I$(TOP)/shared -I$(SRCBASE)/include -Wall
26 +#CFLAGS += -g -DDEBUG
28 +LDFLAGS += -L$(TOP)/shared -lshared -L$(TOP)/nvram -lnvram
30 +OBJS := mtd.o crc.o #http.o
32 +vpath %.c $(TOP)/shared $(SRCBASE)/rts/src
40 + install -d $(INSTALLDIR)/sbin
41 + install mtd $(INSTALLDIR)/sbin
42 + $(STRIP) $(INSTALLDIR)/sbin/mtd
45 + $(CC) -c $^ $(CFLAGS) $(CPPFLAGS) -DOPENWRT_MTD #-DOPENWRT_MTD_HTTP_GET
48 + $(CC) -o $@ $^ $(LDFLAGS)
49 diff -bBurN WRT54G/release/src/router/rc/mtd.c WRT54G.new/release/src/router/rc/mtd.c
50 --- WRT54G/release/src/router/rc/mtd.c 2004-01-19 20:34:50.000000000 -0600
51 +++ WRT54G.new/release/src/router/rc/mtd.c 2004-03-03 16:24:42.000000000 -0600
60 +mtd_open(const char *mtd, int flags);
62 +mtd_erase(const char *mtd);
64 +mtd_write(const char *path, const char *mtd);
66 +/* Slightly modified version of mtd_erase. */
68 +mtd_unlock(const char *mtd)
71 + mtd_info_t mtd_info;
72 + erase_info_t erase_info;
74 + /* Open MTD device */
75 + if ((mtd_fd = mtd_open(mtd, O_RDWR)) < 0) {
80 + /* Get sector size */
81 + if (ioctl(mtd_fd, MEMGETINFO, &mtd_info) != 0) {
87 + erase_info.length = mtd_info.erasesize;
89 + for (erase_info.start = 0;
90 + erase_info.start < mtd_info.size;
91 + erase_info.start += mtd_info.erasesize) {
92 + (void) ioctl(mtd_fd, MEMUNLOCK, &erase_info);
93 +/* if (ioctl(mtd_fd, MEMERASE, &erase_info) != 0) { */
104 +int main(int argc, char **argv) {
105 + if(argc == 3 && strcasecmp(argv[1],"unlock")==0) {
106 + printf("Unlocking %s\n",argv[2]);
107 + return mtd_unlock(argv[2]);
109 + if(argc == 3 && strcasecmp(argv[1],"erase")==0) {
110 + printf("Erasing %s\n",argv[2]);
111 + return mtd_erase(argv[2]);
113 + if(argc == 4 && strcasecmp(argv[1],"write")==0) {
114 + printf("writing %s to %s\n",argv[2],argv[3]);
115 + return mtd_write(argv[2],argv[3]);
118 + printf("no valid command given\n");
122 +#ifndef OPENWRT_MTD_HTTP_GET
123 +/* Dummy routines when no http support. */
125 +http_get(const char *server, char *buf, size_t count, off_t offset)
127 + printf("error opening %s\n",server);
132 +#define check_action() (fp ? ACT_IDLE : ACT_WEBS_UPGRADE)
138 * @param mtd path to or partition name of MTD device
139 diff -bBurN WRT54G/release/src/router/shared/Makefile-openwrt WRT54G.new/release/src/router/shared/Makefile-openwrt
140 --- WRT54G/release/src/router/shared/Makefile-openwrt 1969-12-31 18:00:00.000000000 -0600
141 +++ WRT54G.new/release/src/router/shared/Makefile-openwrt 2004-03-03 12:39:17.000000000 -0600
144 +# Linux router shared code Makefile
146 +# Copyright 2001-2003, Broadcom Corporation
147 +# All Rights Reserved.
149 +# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
150 +# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
151 +# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
152 +# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
154 +# $Id: Makefile,v 1.3 2004/01/13 00:51:09 mbm Exp $
156 +ifneq ($(wildcard $(SRCBASE)/cy_conf.mak),)
157 + include $(SRCBASE)/cy_conf.mak
160 +CFLAGS += -I. -I$(SRCBASE)/include -Wall -I$(SRCBASE)/
161 +#CFLAGS += -g -DDEBUG
168 + install -d $(INSTALLDIR)/usr/lib
169 + install -m 755 libshared.so $(INSTALLDIR)/usr/lib
170 + $(STRIP) $(INSTALLDIR)/usr/lib/libshared.so
175 +libshared.so: shutils.o wl.o wl_linux.o defaults.o
176 + $(LD) -shared -o $@ $^
178 +build_date.o: build_date.c
181 + echo "const char *builddate = \"`date`\";" > build_date.c
184 diff -bBurN WRT54GS/release/src/router/nvram/nvram_linux.c-dist WRT54GS.new/release/src/router/nvram/nvram_linux.c
185 --- WRT54GS/release/src/router/nvram/nvram_linux.c-dist 2004-03-30 10:04:10.000000000 -0600
186 +++ WRT54GS/release/src/router/nvram/nvram_linux.c 2004-03-30 10:10:09.000000000 -0600
188 #include <typedefs.h>
189 #include <bcmnvram.h>
190 #include <nvram_convert.h>
191 +#ifndef OPENWRT_NVRAM
196 #define PATH_DEV_NVRAM "/dev/nvram"
202 +#ifdef OPENWRT_NVRAM
203 + fprintf(stderr, "nvram_commit(): start\n");
206 + if ((ret = nvram_init(NULL)))
209 + ret = ioctl(nvram_fd, NVRAM_MAGIC, NULL);
212 + perror(PATH_DEV_NVRAM);
214 + fprintf(stderr, "nvram_commit(): end\n");
216 cprintf("nvram_commit(): start\n");
218 if((check_action() == ACT_IDLE) ||
222 cprintf("nvram_commit(): nothing to do...\n");
231 +#ifndef OPENWRT_NVRAM