nfs swap patch; bzip loader
[openwrt.git] / obsolete-buildroot / sources / openwrt-wrt54g-router.patch
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
4 @@ -0,0 +1,44 @@
5 +# Copyright 2001-2003, Broadcom Corporation
6 +# All Rights Reserved.
7 +#
8 +#
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
13 +#
14 +
15 +#
16 +# Router Wireless Interface Configuration Utility Makefile
17 +#
18 +# Copyright 2003, Broadcom Corporation
19 +# All Rights Reserved.
20 +#
21 +#
22 +# $Id: Makefile,v 1.2 2004/01/13 00:55:58 mbm Exp $
23 +#
24 +
25 +CFLAGS += -I. -I$(TOP)/shared -I$(SRCBASE)/include -Wall
26 +#CFLAGS += -g -DDEBUG
27 +CFLAGS += -s -Os
28 +LDFLAGS += -L$(TOP)/shared -lshared -L$(TOP)/nvram -lnvram
29 +
30 +OBJS := mtd.o crc.o #http.o
31 +
32 +vpath %.c $(TOP)/shared $(SRCBASE)/rts/src
33 +
34 +all: mtd
35 +
36 +clean:
37 + rm -f *.o mtd
38 +
39 +install: all
40 + install -d $(INSTALLDIR)/sbin
41 + install mtd $(INSTALLDIR)/sbin
42 + $(STRIP) $(INSTALLDIR)/sbin/mtd
43 +
44 +mtd.o: mtd.c
45 + $(CC) -c $^ $(CFLAGS) $(CPPFLAGS) -DOPENWRT_MTD #-DOPENWRT_MTD_HTTP_GET
46 +
47 +mtd: $(OBJS)
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
52 @@ -37,6 +37,86 @@
53 #include <cy_conf.h>
54 #include <utils.h>
55
56 +
57 +#ifdef OPENWRT_MTD
58 +
59 +extern int
60 +mtd_open(const char *mtd, int flags);
61 +extern int
62 +mtd_erase(const char *mtd);
63 +extern int
64 +mtd_write(const char *path, const char *mtd);
65 +
66 +/* Slightly modified version of mtd_erase. */
67 +int
68 +mtd_unlock(const char *mtd)
69 +{
70 + int mtd_fd;
71 + mtd_info_t mtd_info;
72 + erase_info_t erase_info;
73 +
74 + /* Open MTD device */
75 + if ((mtd_fd = mtd_open(mtd, O_RDWR)) < 0) {
76 + perror(mtd);
77 + return errno;
78 + }
79 +
80 + /* Get sector size */
81 + if (ioctl(mtd_fd, MEMGETINFO, &mtd_info) != 0) {
82 + perror(mtd);
83 + close(mtd_fd);
84 + return errno;
85 + }
86 +
87 + erase_info.length = mtd_info.erasesize;
88 +
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) { */
94 +/* perror(mtd); */
95 +/* close(mtd_fd); */
96 +/* return errno; */
97 +/* } */
98 + }
99 +
100 + close(mtd_fd);
101 + return 0;
102 +}
103 +
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]);
108 + }
109 + if(argc == 3 && strcasecmp(argv[1],"erase")==0) {
110 + printf("Erasing %s\n",argv[2]);
111 + return mtd_erase(argv[2]);
112 + }
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]);
116 + }
117 +
118 + printf("no valid command given\n");
119 + return -1;
120 +}
121 +
122 +#ifndef OPENWRT_MTD_HTTP_GET
123 +/* Dummy routines when no http support. */
124 +int
125 +http_get(const char *server, char *buf, size_t count, off_t offset)
126 +{
127 + printf("error opening %s\n",server);
128 + exit(-1);
129 +}
130 +#endif
131 +
132 +#define check_action() (fp ? ACT_IDLE : ACT_WEBS_UPGRADE)
133 +
134 +#endif
135 +
136 /*
137 * Open an MTD device
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
142 @@ -0,0 +1,41 @@
143 +#
144 +# Linux router shared code Makefile
145 +#
146 +# Copyright 2001-2003, Broadcom Corporation
147 +# All Rights Reserved.
148 +#
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.
153 +#
154 +# $Id: Makefile,v 1.3 2004/01/13 00:51:09 mbm Exp $
155 +#
156 +ifneq ($(wildcard $(SRCBASE)/cy_conf.mak),)
157 + include $(SRCBASE)/cy_conf.mak
158 +endif
159 +
160 +CFLAGS += -I. -I$(SRCBASE)/include -Wall -I$(SRCBASE)/
161 +#CFLAGS += -g -DDEBUG
162 +CFLAGS += -s -Os
163 +LDFLAGS += -L.
164 +
165 +all: libshared.so
166 +
167 +install: all
168 + install -d $(INSTALLDIR)/usr/lib
169 + install -m 755 libshared.so $(INSTALLDIR)/usr/lib
170 + $(STRIP) $(INSTALLDIR)/usr/lib/libshared.so
171 +
172 +clean:
173 + rm -f *.o *.so
174 +
175 +libshared.so: shutils.o wl.o wl_linux.o defaults.o
176 + $(LD) -shared -o $@ $^
177 +
178 +build_date.o: build_date.c
179 +
180 +build_date:
181 + echo "const char *builddate = \"`date`\";" > build_date.c
182 +
183 +*.o: $(CY_DEPS)
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
187 @@ -27,8 +27,10 @@
188 #include <typedefs.h>
189 #include <bcmnvram.h>
190 #include <nvram_convert.h>
191 +#ifndef OPENWRT_NVRAM
192 #include <shutils.h>
193 #include <utils.h>
194 +#endif
195
196 #define PATH_DEV_NVRAM "/dev/nvram"
197
198 @@ -182,6 +184,20 @@
199 {
200 int ret;
201
202 +#ifdef OPENWRT_NVRAM
203 + fprintf(stderr, "nvram_commit(): start\n");
204 +
205 + if (nvram_fd < 0)
206 + if ((ret = nvram_init(NULL)))
207 + return ret;
208 +
209 + ret = ioctl(nvram_fd, NVRAM_MAGIC, NULL);
210 +
211 + if (ret < 0)
212 + perror(PATH_DEV_NVRAM);
213 +
214 + fprintf(stderr, "nvram_commit(): end\n");
215 +#else
216 cprintf("nvram_commit(): start\n");
217
218 if((check_action() == ACT_IDLE) ||
219 @@ -200,6 +216,7 @@
220 }
221 else
222 cprintf("nvram_commit(): nothing to do...\n");
223 +#endif
224
225 return ret;
226 }
227 @@ -272,6 +289,7 @@
228 return j;
229 }
230
231 +#ifndef OPENWRT_NVRAM
232 int
233 check_action(void)
234 {
235 @@ -318,3 +336,5 @@
236
237 return 0;
238 }
239 +
240 +#endif
This page took 0.047887 seconds and 5 git commands to generate.