* ugly hacks from Realtek/D-Link kernel

Signed-off-by: Sergey Lapin <[EMAIL PROTECTED]>
---
 .../patches-2.4.28/760-include-netfilter.patch     |  204 ++++++
 .../patches-2.4.28/800-include-ledman.patch        |  111 +++
 .../rtl865x-2.4/patches-2.4.28/830-init.patch      |  167 +++++
 .../rtl865x-2.4/patches-2.4.28/850-kernel.patch    |  770 ++++++++++++++++++++
 .../linux/rtl865x-2.4/patches-2.4.28/900-lib.patch |   13 +
 .../linux/rtl865x-2.4/patches-2.4.28/930-mm.patch  |   13 +
 6 files changed, 1278 insertions(+), 0 deletions(-)
 create mode 100644 
target/linux/rtl865x-2.4/patches-2.4.28/760-include-netfilter.patch
 create mode 100644 
target/linux/rtl865x-2.4/patches-2.4.28/800-include-ledman.patch
 create mode 100644 target/linux/rtl865x-2.4/patches-2.4.28/830-init.patch
 create mode 100644 target/linux/rtl865x-2.4/patches-2.4.28/850-kernel.patch
 create mode 100644 target/linux/rtl865x-2.4/patches-2.4.28/900-lib.patch
 create mode 100644 target/linux/rtl865x-2.4/patches-2.4.28/930-mm.patch

diff --git 
a/target/linux/rtl865x-2.4/patches-2.4.28/760-include-netfilter.patch 
b/target/linux/rtl865x-2.4/patches-2.4.28/760-include-netfilter.patch
new file mode 100644
index 0000000..2893142
--- /dev/null
+++ b/target/linux/rtl865x-2.4/patches-2.4.28/760-include-netfilter.patch
@@ -0,0 +1,204 @@
+Index: linux-2.4.27/include/linux/skbuff.h
+===================================================================
+--- linux-2.4.27.orig/include/linux/skbuff.h   2004-08-08 03:26:06.000000000 
+0400
++++ linux-2.4.27/include/linux/skbuff.h        2008-03-21 14:47:58.000000000 
+0300
+@@ -92,6 +92,17 @@
+ struct nf_ct_info {
+       struct nf_conntrack *master;
+ };
++
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++struct nf_bridge_info {
++      atomic_t use;
++      struct net_device *physindev;
++      struct net_device *physoutdev;
++      unsigned int mask;
++      unsigned long hh[16 / sizeof(unsigned long)];
++};
++#endif
++
+ #endif
+ 
+ struct sk_buff_head {
+@@ -208,6 +219,9 @@
+ #ifdef CONFIG_NETFILTER_DEBUG
+         unsigned int nf_debug;
+ #endif
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++      struct nf_bridge_info   *nf_bridge;     /* Saved data about a bridged 
frame - see br_netfilter.c */
++#endif
+ #endif /*CONFIG_NETFILTER*/
+ 
+ #if defined(CONFIG_HIPPI)
+@@ -1179,5 +1193,18 @@
+ static inline void nf_reset(struct sk_buff *skb) {}
+ #endif /* CONFIG_NETFILTER */
+ 
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
++{
++      if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
++              kfree(nf_bridge);
++}
++static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
++{
++      if (nf_bridge)
++              atomic_inc(&nf_bridge->use);
++}
++#endif
++
+ #endif        /* __KERNEL__ */
+ #endif        /* _LINUX_SKBUFF_H */
+Index: linux-2.4.27/include/linux/if_bridge.h
+===================================================================
+--- linux-2.4.27.orig/include/linux/if_bridge.h        2001-11-22 
22:47:12.000000000 +0300
++++ linux-2.4.27/include/linux/if_bridge.h     2008-03-21 14:46:25.000000000 
+0300
+@@ -102,7 +102,8 @@
+ struct net_bridge_port;
+ 
+ extern int (*br_ioctl_hook)(unsigned long arg);
+-extern void (*br_handle_frame_hook)(struct sk_buff *skb);
++extern int (*br_handle_frame_hook)(struct sk_buff *skb);
++extern int (*br_should_route_hook)(struct sk_buff **pskb);
+ 
+ #endif
+ 
+Index: linux-2.4.27/net/ipv4/netfilter/ipt_LOG.c
+===================================================================
+--- linux-2.4.27.orig/net/ipv4/netfilter/ipt_LOG.c     2003-11-28 
21:26:21.000000000 +0300
++++ linux-2.4.27/net/ipv4/netfilter/ipt_LOG.c  2008-03-21 14:46:25.000000000 
+0300
+@@ -316,6 +316,18 @@
+              loginfo->prefix,
+              in ? in->name : "",
+              out ? out->name : "");
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++      if ((*pskb)->nf_bridge) {
++              struct net_device *physindev = (*pskb)->nf_bridge->physindev;
++              struct net_device *physoutdev = (*pskb)->nf_bridge->physoutdev;
++
++              if (physindev && in != physindev)
++                      printk("PHYSIN=%s ", physindev->name);
++              if (physoutdev && out != physoutdev)
++                      printk("PHYSOUT=%s ", physoutdev->name);
++      }
++#endif
++
+       if (in && !out) {
+               /* MAC logging for input chain only. */
+               printk("MAC=");
+Index: linux-2.4.27/net/ipv4/netfilter/ip_tables.c
+===================================================================
+--- linux-2.4.27.orig/net/ipv4/netfilter/ip_tables.c   2004-08-08 
03:26:06.000000000 +0400
++++ linux-2.4.27/net/ipv4/netfilter/ip_tables.c        2008-03-21 
14:46:25.000000000 +0300
+@@ -118,12 +118,19 @@
+ static inline int
+ ip_packet_match(const struct iphdr *ip,
+               const char *indev,
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++              const char *physindev,
++#endif
+               const char *outdev,
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++              const char *physoutdev,
++#endif
+               const struct ipt_ip *ipinfo,
+               int isfrag)
+ {
+       size_t i;
+       unsigned long ret;
++      unsigned long ret2 = 1;
+ 
+ #define FWINV(bool,invflg) ((bool) ^ !!(ipinfo->invflags & invflg))
+ 
+@@ -153,7 +160,15 @@
+                       & ((const unsigned long *)ipinfo->iniface_mask)[i];
+       }
+ 
+-      if (FWINV(ret != 0, IPT_INV_VIA_IN)) {
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++      for (i = 0, ret2 = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
++              ret2 |= (((const unsigned long *)physindev)[i]
++                      ^ ((const unsigned long *)ipinfo->iniface)[i])
++                      & ((const unsigned long *)ipinfo->iniface_mask)[i];
++      }
++#endif
++
++      if (FWINV(ret != 0 && ret2 != 0, IPT_INV_VIA_IN)) {
+               dprintf("VIA in mismatch (%s vs %s).%s\n",
+                       indev, ipinfo->iniface,
+                       ipinfo->invflags&IPT_INV_VIA_IN ?" (INV)":"");
+@@ -166,7 +181,15 @@
+                       & ((const unsigned long *)ipinfo->outiface_mask)[i];
+       }
+ 
+-      if (FWINV(ret != 0, IPT_INV_VIA_OUT)) {
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++      for (i = 0, ret2 = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
++              ret2 |= (((const unsigned long *)physoutdev)[i]
++                      ^ ((const unsigned long *)ipinfo->outiface)[i])
++                      & ((const unsigned long *)ipinfo->outiface_mask)[i];
++      }
++#endif
++
++      if (FWINV(ret != 0 && ret2 != 0, IPT_INV_VIA_OUT)) {
+               dprintf("VIA out mismatch (%s vs %s).%s\n",
+                       outdev, ipinfo->outiface,
+                       ipinfo->invflags&IPT_INV_VIA_OUT ?" (INV)":"");
+@@ -265,6 +288,9 @@
+       /* Initializing verdict to NF_DROP keeps gcc happy. */
+       unsigned int verdict = NF_DROP;
+       const char *indev, *outdev;
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++      const char *physindev, *physoutdev;
++#endif
+       void *table_base;
+       struct ipt_entry *e, *back;
+ 
+@@ -274,6 +300,13 @@
+       datalen = (*pskb)->len - ip->ihl * 4;
+       indev = in ? in->name : nulldevname;
+       outdev = out ? out->name : nulldevname;
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++      physindev = ((*pskb)->nf_bridge && (*pskb)->nf_bridge->physindev) ?
++              (*pskb)->nf_bridge->physindev->name : nulldevname;
++      physoutdev = ((*pskb)->nf_bridge && (*pskb)->nf_bridge->physoutdev) ?
++              (*pskb)->nf_bridge->physoutdev->name : nulldevname;
++#endif
++
+       /* We handle fragments by dealing with the first fragment as
+        * if it was a normal packet.  All other fragments are treated
+        * normally, except that they will NEVER match rules that ask
+@@ -309,7 +342,15 @@
+               IP_NF_ASSERT(e);
+               IP_NF_ASSERT(back);
+               (*pskb)->nfcache |= e->nfcache;
+-              if (ip_packet_match(ip, indev, outdev, &e->ip, offset)) {
++              if (ip_packet_match(ip, indev,
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++                  physindev,
++#endif
++                  outdev,
++#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
++                  physoutdev,
++#endif
++                  &e->ip, offset)) {
+                       struct ipt_entry_target *t;
+ 
+                       if (IPT_MATCH_ITERATE(e, do_match,
+@@ -1700,7 +1741,7 @@
+                            off_t start_offset, char *buffer, int length,
+                            off_t *pos, unsigned int *count)
+ {
+-      if ((*count)++ >= start_offset) {
++      if (*count >= start_offset) {
+               unsigned int namelen;
+ 
+               namelen = sprintf(buffer + *pos, "%s\n",
+@@ -1711,6 +1752,7 @@
+               }
+               *pos += namelen;
+       }
++      (*count)++;
+       return 0;
+ }
+ 
diff --git a/target/linux/rtl865x-2.4/patches-2.4.28/800-include-ledman.patch 
b/target/linux/rtl865x-2.4/patches-2.4.28/800-include-ledman.patch
new file mode 100644
index 0000000..1b0bbb7
--- /dev/null
+++ b/target/linux/rtl865x-2.4/patches-2.4.28/800-include-ledman.patch
@@ -0,0 +1,111 @@
+diff --git a/include/linux/ledman.h b/include/linux/ledman.h
+new file mode 100644
+index 0000000..66ac339
+--- /dev/null
++++ b/include/linux/ledman.h
+@@ -0,0 +1,105 @@
++#ifndef __LINUX_LEDMAN_H__
++#define __LINUX_LEDMAN_H__ 1
++/****************************************************************************/
++/*
++ *    ledman.h:  LED manager header,  generic, device indepedant LED stuff
++ *
++ *    defines for led functionality which may/may not be implemented by the
++ *    currently active LED configuration
++ *
++ *    NOTE: do not change the numbering of the defines below,  tables of
++ *          LED patterns rely on these values
++ */
++
++#define LEDMAN_ALL                    0       /* special case, all LED's */
++
++#define LEDMAN_POWER          1
++#define LEDMAN_HEARTBEAT      2
++#define LEDMAN_COM1_RX                3
++#define LEDMAN_COM1_TX                4
++#define LEDMAN_COM2_RX                5
++#define LEDMAN_COM2_TX                6
++#define LEDMAN_LAN1_RX                7
++#define LEDMAN_LAN1_TX                8
++#define LEDMAN_LAN2_RX                9
++#define LEDMAN_LAN2_TX                10
++#define LEDMAN_USB1_RX                11
++#define LEDMAN_USB1_TX                12
++#define LEDMAN_USB2_RX                13
++#define LEDMAN_USB2_TX                14
++#define LEDMAN_NVRAM_1                15
++#define LEDMAN_NVRAM_2                16
++#define LEDMAN_VPN                    17
++#define LEDMAN_LAN1_DHCP      18
++#define LEDMAN_LAN2_DHCP      19
++#define LEDMAN_COM1_DCD               20
++#define LEDMAN_COM2_DCD               21
++#define LEDMAN_ONLINE         22
++#define LEDMAN_LAN1_LINK      23
++#define LEDMAN_LAN2_LINK      24
++#define LEDMAN_VPN_RX         25
++#define LEDMAN_VPN_TX         26
++#define LEDMAN_RESET          27
++#define LEDMAN_STATIC         28
++#define LEDMAN_LAN3_RX                29
++#define LEDMAN_LAN3_TX                30
++#define LEDMAN_LAN3_LINK      31
++#define LEDMAN_LAN3_DHCP      32
++#define       LEDMAN_MAX                      33      /* one more than the 
highest LED above */
++
++#define LEDMAN_MAX_NAME               16
++
++/****************************************************************************/
++/*
++ *    ioctl cmds
++ */
++
++#define LEDMAN_CMD_SET                0x01    /* turn on briefly to show 
activity */
++#define LEDMAN_CMD_ON         0x02    /* turn LED on permanently */
++#define LEDMAN_CMD_OFF                0x03    /* turn LED off permanently */
++#define LEDMAN_CMD_FLASH      0x04    /* flash this LED */
++#define LEDMAN_CMD_RESET      0x05    /* reset LED to default behaviour */
++
++#define LEDMAN_CMD_ALT_ON     0x06    /* LED is being used for non-std 
reasons */
++#define LEDMAN_CMD_ALT_OFF    0x07    /* LED is being used for std reasons */
++
++#define LEDMAN_CMD_MODE                       0x80    /* set LED to named 
mode (led=char *) */
++#define LEDMAN_CMD_STARTTIMER 0x81    /* enable and init the ledman driver */
++#define LEDMAN_CMD_KILLTIMER  0x82    /* disable the ledman driver */
++ 
++#define       LEDMAN_CMD_SIGNAL               0x100   /* pid of process to 
signal on reset */
++
++#define LEDMAN_CMD_ALTBIT             0x8000  /* operate on alternate LED 
settings */
++
++/****************************************************************************/
++
++#define LEDMAN_MAJOR  126
++
++/****************************************************************************/
++#ifdef __KERNEL__
++
++#if LINUX_VERSION_CODE < 0x020100
++extern int ledman_init(void);
++#endif
++
++extern int  ledman_setup(char *arg);
++extern void ledman_killtimer(void);
++extern void ledman_starttimer(void);
++extern int  ledman_cmd(int cmd, unsigned long led);
++extern void ledman_signalreset(void);
++
++#else
++
++#include      <fcntl.h>
++
++#define ledman_cmd(cmd, led) ({ \
++      int fd; \
++      if ((fd = open("/dev/ledman", O_RDWR)) != -1) { \
++              ioctl(fd, cmd, led); \
++              close(fd); \
++      } \
++})
++
++#endif
++/****************************************************************************/
++#endif /* __LINUX_LEDMAN_H__ */
diff --git a/target/linux/rtl865x-2.4/patches-2.4.28/830-init.patch 
b/target/linux/rtl865x-2.4/patches-2.4.28/830-init.patch
new file mode 100644
index 0000000..17d115b
--- /dev/null
+++ b/target/linux/rtl865x-2.4/patches-2.4.28/830-init.patch
@@ -0,0 +1,167 @@
+diff --git a/init/do_mounts.c b/init/do_mounts.c
+index cbdee28..d670793 100644
+--- a/init/do_mounts.c
++++ b/init/do_mounts.c
+@@ -276,10 +245,7 @@ kdev_t __init name_to_kdev_t(char *line)
+                       dev++;
+               } while (dev->name);
+       }
+-      offs = simple_strtoul(line, &end, base?10:16);
+-      if (*end)
+-              offs = 0;
+-      return to_kdev_t(base + offs);
++      return to_kdev_t(base + simple_strtoul(line,NULL,base?10:16));
+ }
+ 
+ static int __init root_dev_setup(char *line)
+@@ -360,7 +326,6 @@ retry:
+                               flags |= MS_RDONLY;
+                               goto retry;
+                       case -EINVAL:
+-                      case -EBUSY:
+                               continue;
+               }
+               /*
+@@ -901,7 +858,9 @@ void prepare_namespace(void)
+       sys_mkdir("/dev", 0700);
+       sys_mkdir("/root", 0700);
+       sys_mknod("/dev/console", S_IFCHR|0600, MKDEV(TTYAUX_MAJOR, 1));
+-#ifdef CONFIG_DEVFS_FS
++
++//cfliu: Mark this out. This is temporarily for testing devfs. We don't want 
devfs be mounted when boot up.
++#if 0//def CONFIG_DEVFS_FS
+       sys_mount("devfs", "/dev", "devfs", 0, NULL);
+       do_devfs = 1;
+ #endif
+diff --git a/init/main.c b/init/main.c
+index 00cbdb6..18c8a88 100644
+--- a/init/main.c
++++ b/init/main.c
+@@ -81,7 +81,11 @@ extern int irda_device_init(void);
+  * with a gcc that is known to be too old from the very beginning.
+  */
+ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 91)
++#if !defined(CONFIG_V850E) && !defined(CONFIG_NIOS)
+ #error Sorry, your GCC is too old. It builds incorrect kernels.
++#else
++#warning Sorry, your GCC is too old. It builds incorrect kernels.
++#endif
+ #endif
+ 
+ extern char _stext, _etext;
+@@ -167,6 +171,46 @@ void __init calibrate_delay(void)
+       unsigned long ticks, loopbit;
+       int lps_precision = LPS_PREC;
+ 
++#ifdef FIXED_BOGOMIPS
++      int bogus;
++
++/* FIXED_BOGOMIPS converted to __delay units.  */
++#define FIXED_LOOPS_PER_JIFFY (unsigned long)(FIXED_BOGOMIPS * (500000 / HZ))
++
++/* The maximum error in FIXED_LOOPS_PER_JIFFY that we will tolerate.  */
++#define FIXED_LPJ_TOLERANCE   (unsigned long)(FIXED_LOOPS_PER_JIFFY * 0.10)
++
++      /* Make sure fixed delay - T% is zero ticks.  */
++      ticks = jiffies;
++      while (ticks == jiffies) /* Synchronize with start of tick */
++              /* nothing */;
++      ticks = jiffies;
++      __delay(FIXED_LOOPS_PER_JIFFY - FIXED_LPJ_TOLERANCE);
++      bogus = (jiffies != ticks);
++
++      if (! bogus) {
++              /* Make sure fixed delay + T% is one tick.  The delay here
++                 is very short because we're actually continuing timing from
++                 the tick synchronization above (we don't resynchronize).  */
++              __delay(2 * FIXED_LPJ_TOLERANCE);
++              bogus = (jiffies != ticks + 1);
++      }
++      
++      if (! bogus) {
++              /* Use the precomputed value.  */
++              loops_per_jiffy = FIXED_LOOPS_PER_JIFFY;
++              printk("Delay loop constant: %lu.%02lu BogoMIPS 
(precomputed)\n",
++                     (unsigned long)FIXED_BOGOMIPS,
++                     ((unsigned long)(FIXED_BOGOMIPS * 100)) % 100);
++              return;
++      } else {
++              printk("Precomputed BogoMIPS value (%lu.%02lu) inaccurate!\n",
++                     (unsigned long)FIXED_BOGOMIPS,
++                     ((unsigned long)(FIXED_BOGOMIPS * 100)) % 100);
++              /* ... and fall through to normal bogomips calculation.  */
++      }
++#endif /* FIXED_BOGOMIPS */
++
+       loops_per_jiffy = (1<<12);
+ 
+       printk("Calibrating delay loop... ");
+@@ -354,6 +398,7 @@ asmlinkage void __init start_kernel(void)
+ {
+       char * command_line;
+       extern char saved_command_line[];
++
+ /*
+  * Interrupts are still disabled. Do necessary setups, then
+  * enable them
+@@ -545,9 +590,33 @@ static void __init do_basic_setup(void)
+ #endif
+ }
+ 
++#ifdef CONFIG_RTL865X
++int _chip_is_shared_pci_mode(){
++      if(0==(*((volatile unsigned int *)0xbc805030)&0x80000000)){
++              #ifdef CONFIG_PCI
++                      goto maybe8650B_208;
++              #else
++                      return 0;
++              #endif
++      }
++maybe8650B_208:
++      if(0x05005788==(*((volatile unsigned int *)0xbc805104)&0x07f0ffff)){
++              //chip is 8650B 208 package with PCI bonding and PCI kernel 
option is enabled.
++              return 1;
++      }
++      return 0;
++}
++#endif
++
++
++static char rtl865x_uart1[]={"uart1"};
+ static void run_init_process(char *init_filename)
+ {
+       argv_init[0] = init_filename;
++#ifdef CONFIG_RTL865X
++      if(_chip_is_shared_pci_mode())
++              argv_init[1]=rtl865x_uart1;
++#endif
+       execve(init_filename, argv_init, envp_init);
+ }
+ 
+@@ -578,7 +647,25 @@ static int init(void * unused)
+       if(unshare_files())
+               panic("unshare");
+       put_files_struct(files);
+-      
++
++#ifdef CONFIG_RTL865X
++        if(_chip_is_shared_pci_mode()){
++//+++Modify by shiang for devfs support 2004/10/20
++#ifdef CONFIG_DEVFS_FS
++      //shiang: we need to change the tty name as "tts/1" when devfs enabled.
++                if (open("/dev/tts/1", O_RDWR, 0) < 0)
++                        printk("Warning: unable to open an initial 
console.\n");
++                else
++                        printk("initial console created on /dev/tts/1\n");
++#else  //shiang: original code
++              if (open("/dev/ttyS1", O_RDWR, 0) < 0)
++                        printk("Warning: unable to open an initial 
console.\n");
++                else
++                        printk("initial console created on /dev/ttyS1\n");
++#endif
++//---Modify by shiang for devfs support 2004/10/20
++        }else
++#endif
+       if (open("/dev/console", O_RDWR, 0) < 0)
+               printk("Warning: unable to open an initial console.\n");
+ 
diff --git a/target/linux/rtl865x-2.4/patches-2.4.28/850-kernel.patch 
b/target/linux/rtl865x-2.4/patches-2.4.28/850-kernel.patch
new file mode 100644
index 0000000..79776da
--- /dev/null
+++ b/target/linux/rtl865x-2.4/patches-2.4.28/850-kernel.patch
@@ -0,0 +1,770 @@
+Index: linux-2.4.28/kernel/Makefile
+===================================================================
+--- linux-2.4.28.orig/kernel/Makefile  2001-09-17 08:22:40.000000000 +0400
++++ linux-2.4.28/kernel/Makefile       2008-03-27 18:58:04.000000000 +0300
+@@ -9,13 +9,19 @@
+ 
+ O_TARGET := kernel.o
+ 
+-export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o 
printk.o
++export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o 
printk.o dma.o
+ 
+-obj-y     = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
++obj-y     = sched.o fork.o exec_domain.o panic.o printk.o \
+           module.o exit.o itimer.o info.o time.o softirq.o resource.o \
+           sysctl.o acct.o capability.o ptrace.o timer.o user.o \
+           signal.o sys.o kmod.o context.o
+ 
++ifndef CONFIG_ARM
++obj-y  += dma.o
++endif
++
++OX_OBJS  += signal.o sys.o kmod.o context.o
++
+ obj-$(CONFIG_UID16) += uid16.o
+ obj-$(CONFIG_MODULES) += ksyms.o
+ obj-$(CONFIG_PM) += pm.o
+Index: linux-2.4.28/kernel/dma.c
+===================================================================
+--- linux-2.4.28.orig/kernel/dma.c     2001-02-14 01:14:06.000000000 +0300
++++ linux-2.4.28/kernel/dma.c  2008-03-27 18:58:04.000000000 +0300
+@@ -56,12 +56,17 @@
+ 
+ static struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = {
+       { 0, 0 },
++#if defined(CONFIG_M5307) || defined(CONFIG_M5407)
+       { 0, 0 },
+       { 0, 0 },
++#endif
++#ifndef CONFIG_UCLINUX
++      { 0, 0 },
+       { 0, 0 },
+       { 1, "cascade" },
+       { 0, 0 },
+       { 0, 0 },
++#endif
+       { 0, 0 }
+ };
+ 
+@@ -121,7 +126,7 @@
+ }
+ 
+ int get_dma_list(char *buf)
+-{     
++{
+       strcpy(buf, "No DMA\n");
+       return 7;
+ }
+Index: linux-2.4.28/kernel/exit.c
+===================================================================
+--- linux-2.4.28.orig/kernel/exit.c    2002-11-29 02:53:15.000000000 +0300
++++ linux-2.4.28/kernel/exit.c 2008-03-27 18:58:04.000000000 +0300
+@@ -427,7 +427,7 @@
+       struct task_struct *tsk = current;
+ 
+       if (in_interrupt())
+-              panic("Aiee, killing interrupt handler!");
++              panic("Aiee, killing interrupt handler\n");
+       if (!tsk->pid)
+               panic("Attempted to kill the idle task!");
+       if (tsk->pid == 1)
+@@ -458,6 +458,9 @@
+ 
+       tsk->exit_code = code;
+       exit_notify();
++#ifdef CONFIG_SYSCALLTIMER
++      current->curr_syscall = 0;
++#endif
+       schedule();
+       BUG();
+ /*
+@@ -587,7 +590,7 @@
+       return retval;
+ }
+ 
+-#if !defined(__alpha__) && !defined(__ia64__)
++#if !defined(__alpha__) && !defined(__ia64__) && !defined(__arm__)
+ 
+ /*
+  * sys_waitpid() remains for compatibility. waitpid() should be
+Index: linux-2.4.28/kernel/fork.c
+===================================================================
+--- linux-2.4.28.orig/kernel/fork.c    2004-11-17 14:54:22.000000000 +0300
++++ linux-2.4.28/kernel/fork.c 2008-03-27 18:58:04.000000000 +0300
+@@ -77,8 +77,11 @@
+        */
+       max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8;
+ 
+-      init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
+-      init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
++      /*
++       * we need to allow at least 10 threads to boot a system
++       */
++      init_task.rlim[RLIMIT_NPROC].rlim_cur = max(10, max_threads/2);
++      init_task.rlim[RLIMIT_NPROC].rlim_max = max(10, max_threads/2);
+ }
+ 
+ /* Protects next_safe and last_pid. */
+@@ -142,6 +145,8 @@
+       return 0;
+ }
+ 
++#ifndef CONFIG_UCLINUX
++
+ static inline int dup_mmap(struct mm_struct * mm)
+ {
+       struct vm_area_struct * mpnt, *tmp, **pprev;
+@@ -378,6 +383,131 @@
+       return retval;
+ }
+ 
++#else /* !CONFIG_UCLINUX */
++
++/*
++ * Allocate and initialize an mm_struct.
++ */
++struct mm_struct * mm_alloc(void)
++{
++      struct mm_struct * mm;
++
++      mm = kmem_cache_alloc(mm_cachep, SLAB_KERNEL);
++      if (mm) {
++              memset(mm, 0, sizeof(*mm));
++              atomic_set(&mm->mm_users, 1);
++              atomic_set(&mm->mm_count, 1);
++              init_rwsem(&mm->mmap_sem);
++              mm->page_table_lock = SPIN_LOCK_UNLOCKED;
++              return mm;
++      }
++      return NULL;
++}
++
++/*
++ * Called when the last reference to the mm
++ * is dropped: either by a lazy thread or by
++ * mmput. Free the mm.
++ */
++inline void __mmdrop(struct mm_struct *mm)
++{
++      if (mm == &init_mm) BUG();
++      kmem_cache_free(mm_cachep, mm);
++}
++
++/*
++ * Decrement the use count and release all resources for an mm.
++ */
++void mmput(struct mm_struct *mm)
++{
++      if (atomic_dec_and_test(&mm->mm_users)) {
++              exit_mmap(mm);
++              mmdrop(mm);
++      }
++}
++
++/* Please note the differences between mmput and mm_release.
++ * mmput is called whenever we stop holding onto a mm_struct,
++ * error success whatever.
++ *
++ * mm_release is called after a mm_struct has been removed
++ * from the current process.
++ *
++ * This difference is important for error handling, when we
++ * only half set up a mm_struct for a new process and need to restore
++ * the old one.  Because we mmput the new mm_struct before
++ * restoring the old one. . .
++ * Eric Biederman 10 January 1998
++ */
++void mm_release(void)
++{
++      struct task_struct *tsk = current;
++      struct completion *vfork_done = tsk->vfork_done;
++
++      /* notify parent sleeping on vfork() */
++      if (vfork_done) {
++              tsk->vfork_done = NULL;
++              complete(vfork_done);
++      }
++}
++
++static inline int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
++{
++      struct mm_struct * mm;
++      int retval;
++
++      tsk->min_flt = tsk->maj_flt = 0;
++      tsk->cmin_flt = tsk->cmaj_flt = 0;
++      tsk->nswap = tsk->cnswap = 0;
++
++      tsk->mm = NULL;
++      tsk->active_mm = NULL;
++
++      /*
++       * Are we cloning a kernel thread?
++       *
++       * We need to steal a active VM for that..
++       */
++      mm = current->mm;
++      if (!mm)
++              return 0;
++
++      if (clone_flags & CLONE_VM) {
++              atomic_inc(&mm->mm_users);
++              goto good_mm;
++      }
++
++      retval = -ENOMEM;
++      mm = mm_alloc();
++      if (!mm)
++              goto fail_nomem;
++
++      tsk->mm = mm;
++      tsk->active_mm = mm;
++
++#if DAVIDM /* is this needed,  I took it out as it didn't appear to be */
++      if (tsk->mm->executable)
++              atomic_inc(&tsk->mm->executable->i_count);
++#endif
++
++      /*
++       * child gets a private LDT (if there was an LDT in the parent)
++       */
++      copy_segments(tsk, mm);
++
++good_mm:
++      tsk->mm = mm;
++      tsk->active_mm = mm;
++      return 0;
++
++free_pt:
++      mmput(mm);
++fail_nomem:
++      return retval;
++}
++
++#endif /* !CONFIG_UCLINUX */
++
+ static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old)
+ {
+       struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL);
+@@ -617,7 +747,6 @@
+       old_task_dumpable = task->task_dumpable;
+       task->task_dumpable = 0;
+       task_unlock(task);
+-
+       ret = arch_kernel_thread(fn, arg, flags);
+ 
+       /* never reached in child process, only in parent */
+@@ -663,6 +792,10 @@
+ 
+       *p = *current;
+ 
++#ifdef CONFIG_SYSCALLTIMER
++      p->curr_syscall = 0;
++#endif
++
+       retval = -EAGAIN;
+       /*
+        * Check if we are over our maximum process limit, but be sure to
+Index: linux-2.4.28/kernel/ksyms.c
+===================================================================
+--- linux-2.4.28.orig/kernel/ksyms.c   2004-02-18 16:36:32.000000000 +0300
++++ linux-2.4.28/kernel/ksyms.c        2008-03-27 18:58:04.000000000 +0300
+@@ -87,7 +87,9 @@
+ /* process memory management */
+ EXPORT_SYMBOL(do_mmap_pgoff);
+ EXPORT_SYMBOL(do_munmap);
++#ifndef NO_MM
+ EXPORT_SYMBOL(do_brk);
++#endif
+ EXPORT_SYMBOL(exit_mm);
+ EXPORT_SYMBOL(exit_files);
+ EXPORT_SYMBOL(exit_fs);
+@@ -111,17 +113,24 @@
+ EXPORT_SYMBOL(kmem_cache_size);
+ EXPORT_SYMBOL(kmalloc);
+ EXPORT_SYMBOL(kfree);
++#ifdef NO_MM
++EXPORT_SYMBOL(ksize);
++#endif
+ EXPORT_SYMBOL(vfree);
+ EXPORT_SYMBOL(__vmalloc);
++#ifndef NO_MM
+ EXPORT_SYMBOL(vmap);
++#endif
+ EXPORT_SYMBOL(vmalloc_to_page);
+ EXPORT_SYMBOL(mem_map);
+ EXPORT_SYMBOL(remap_page_range);
+ EXPORT_SYMBOL(max_mapnr);
+ EXPORT_SYMBOL(high_memory);
+ EXPORT_SYMBOL(vmtruncate);
++#ifndef NO_MM
+ EXPORT_SYMBOL(find_vma);
+ EXPORT_SYMBOL(get_unmapped_area);
++#endif
+ EXPORT_SYMBOL(init_mm);
+ #ifdef CONFIG_HIGHMEM
+ EXPORT_SYMBOL(kmap_high);
+@@ -303,11 +312,13 @@
+ /* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */
+ EXPORT_SYMBOL(default_llseek);
+ EXPORT_SYMBOL(dentry_open);
++#ifndef NO_MM
+ EXPORT_SYMBOL(filemap_nopage);
+ EXPORT_SYMBOL(filemap_sync);
+ EXPORT_SYMBOL(filemap_fdatawrite);
+ EXPORT_SYMBOL(filemap_fdatasync);
+ EXPORT_SYMBOL(filemap_fdatawait);
++#endif
+ EXPORT_SYMBOL(lock_page);
+ EXPORT_SYMBOL(unlock_page);
+ EXPORT_SYMBOL(wakeup_page_waiters);
+@@ -365,7 +376,9 @@
+ EXPORT_SYMBOL(search_binary_handler);
+ EXPORT_SYMBOL(prepare_binprm);
+ EXPORT_SYMBOL(compute_creds);
++#ifndef NO_MM
+ EXPORT_SYMBOL(remove_arg_zero);
++#endif
+ EXPORT_SYMBOL(set_binfmt);
+ 
+ /* sysctl table registration */
+@@ -439,13 +452,21 @@
+ EXPORT_SYMBOL(kiobuf_wait_for_io);
+ 
+ /* dma handling */
++#ifdef CONFIG_GENERIC_ISA_DMA
+ EXPORT_SYMBOL(request_dma);
+ EXPORT_SYMBOL(free_dma);
+ EXPORT_SYMBOL(dma_spin_lock);
++#endif
+ #ifdef HAVE_DISABLE_HLT
+ EXPORT_SYMBOL(disable_hlt);
+ EXPORT_SYMBOL(enable_hlt);
+ #endif
++#ifdef CONFIG_CANCam
++EXPORT_SYMBOL(request_dma);
++EXPORT_SYMBOL(free_dma);
++EXPORT_SYMBOL(dma_spin_lock);
++#endif
++
+ 
+ /* resource handling */
+ EXPORT_SYMBOL(request_resource);
+@@ -530,8 +551,10 @@
+ EXPORT_SYMBOL(seq_release_private);
+ 
+ /* Program loader interfaces */
++#ifndef NO_MM
+ EXPORT_SYMBOL(setup_arg_pages);
+ EXPORT_SYMBOL(copy_strings_kernel);
++#endif
+ EXPORT_SYMBOL(do_execve);
+ EXPORT_SYMBOL(flush_old_exec);
+ EXPORT_SYMBOL(kernel_read);
+Index: linux-2.4.28/kernel/panic.c
+===================================================================
+--- linux-2.4.28.orig/kernel/panic.c   2004-11-17 14:54:22.000000000 +0300
++++ linux-2.4.28/kernel/panic.c        2008-03-27 18:58:04.000000000 +0300
+@@ -76,8 +76,9 @@
+ 
+       notifier_call_chain(&panic_notifier_list, 0, NULL);
+ 
+-      if (panic_timeout > 0)
+-      {
++      if (panic_timeout < 0) {
++              machine_halt();
++      } else if (panic_timeout > 0) {
+               /*
+                * Delay timeout seconds before rebooting the machine. 
+                * We can't use the "normal" timers since we just panicked..
+Index: linux-2.4.28/kernel/printk.c
+===================================================================
+--- linux-2.4.28.orig/kernel/printk.c  2004-11-17 14:54:22.000000000 +0300
++++ linux-2.4.28/kernel/printk.c       2008-03-27 19:02:52.000000000 +0300
+@@ -154,6 +154,25 @@
+       return 1;
+ }
+ 
++#ifdef CONFIG_UCLINUX
++/*
++ * DAVIDM - put this in so 2.0 and 2.4 NETtel images work with the
++ *          same boot args.
++ */
++
++static int __init CONSOLE_setup(char *str)
++{
++      /*
++       *      2.4 does not want the /dev/ options on the front
++       */
++      if (strncmp(str, "/dev/", 5) == 0)
++              return(console_setup(str + 5));
++      return(console_setup(str));
++}
++
++__setup("CONSOLE=", CONSOLE_setup);
++#endif
++
+ __setup("console=", console_setup);
+ 
+ /*
+@@ -353,7 +372,13 @@
+                       ((end - cur_index) > 2) &&
+                       LOG_BUF(cur_index + 0) == '<' &&
+                       LOG_BUF(cur_index + 1) >= '0' &&
+-                      LOG_BUF(cur_index + 1) <= '7' &&
++//+++ modify by siyou 2004/9/22 09:37¤U¤È
++// mainly for not to print level 9 messages.
++// _call_console_drivers() will check log level of console to print.
++// our level 9 will higher than the default log level.
++                      //LOG_BUF(cur_index + 1) <= '7' &&
++                      LOG_BUF(cur_index + 1) <= '9' &&
++//--- modify by siyou 2004/9/22 09:37¤U¤È
+                       LOG_BUF(cur_index + 2) == '>')
+               {
+                       msg_level = LOG_BUF(cur_index + 1) - '0';
+@@ -417,7 +442,11 @@
+       char *p;
+       static char printk_buf[1024];
+       static int log_level_unknown = 1;
+-
++#ifdef CONFIG_RTL865XB        
++      /*add a watchdog reset here since printk might consumes a lot of time 
if message is lengthy*/
++      #define REG32(reg)      (*(volatile unsigned int *)(reg))
++      REG32(0xbd01203c)=7<<21; /*reset watchdog and selects 2^18 watchdog 
cycle*/
++#endif        
+       if (oops_in_progress) {
+               /* If a crash is occurring, make sure we can't deadlock */
+               spin_lock_init(&logbuf_lock);
+@@ -439,7 +468,13 @@
+        */
+       for (p = printk_buf; *p; p++) {
+               if (log_level_unknown) {
+-                      if (p[0] != '<' || p[1] < '0' || p[1] > '7' || p[2] != 
'>') {
++//+++joel modify 2004/7/7 04:57¤U¤È alpha use '<9>' to log in kernel          
    
++#if 1
++                      if (p[0] != '<' || p[1] < '0' || p[1] > '9' || p[2] != 
'>') {
++#else
++                      if (p[0] != '<' || p[1] < '0' || p[1] > '7' || p[2] != 
'>') {
++#endif                            
++//---joel modify 2004/7/7 04:57¤U¤È alpha use printk("<9><224>.....") to log 
in kernel                                
+                               emit_log_char('<');
+                               emit_log_char(default_message_loglevel + '0');
+                               emit_log_char('>');
+@@ -586,6 +621,7 @@
+ {
+       int     i;
+       unsigned long flags;
++      int def_console=0;
+ 
+       if (preferred_console < 0)
+               preferred_console = selected_console;
+@@ -596,14 +632,33 @@
+        *      that registers here.
+        */
+       if (preferred_console < 0) {
++              #ifdef CONFIG_RTL865X
++              if(_chip_is_shared_pci_mode()){
++                      def_console=1;
++                      #ifdef CONFIG_GDB_CONSOLE
++                      if(strcmp(console->name,"gdb")==0&&console_drivers){
++                              //can't let gdb register earlier than console 
driver
++                              //since we only have one UART in this case.
++                              return;
++                      }
++                      #endif /*CONFIG_GDB_CONSOLE*/
++              }
++              #endif /*CONFIG_RTL865X*/
++
+               if (console->index < 0)
+-                      console->index = 0;
++                      console->index = def_console;
+               if (console->setup == NULL ||
+                   console->setup(console, NULL) == 0) {
+                       console->flags |= CON_ENABLED | CON_CONSDEV;
+                       preferred_console = 0;
+               }
+       }
++#ifdef CONFIG_RTL865X
++      else if(_chip_is_shared_pci_mode())
++              return;         //In this case, there is only one console and 
already 
++                              //registered so can't support second console 
registration
++#endif
++
+ 
+       /*
+        *      See if this console matches one we selected on
+@@ -699,4 +754,4 @@
+       if (tty && tty->driver.write)
+               tty->driver.write(tty, 0, msg, strlen(msg));
+       return;
+-}
++} 
+Index: linux-2.4.28/kernel/ptrace.c
+===================================================================
+--- linux-2.4.28.orig/kernel/ptrace.c  2003-08-25 15:44:44.000000000 +0400
++++ linux-2.4.28/kernel/ptrace.c       2008-03-27 18:58:04.000000000 +0300
+@@ -232,3 +232,4 @@
+       }
+       return copied;
+ }
++
+Index: linux-2.4.28/kernel/sched.c
+===================================================================
+--- linux-2.4.28.orig/kernel/sched.c   2004-11-17 14:54:22.000000000 +0300
++++ linux-2.4.28/kernel/sched.c        2008-03-27 18:58:04.000000000 +0300
+@@ -534,6 +534,11 @@
+       __schedule_tail(prev);
+ }
+ 
++#ifdef CONFIG_SYSCALLTIMER
++extern void timepeg_schedule_switchout(void);
++extern void timepeg_schedule_switchin(void);
++#endif
++
+ /*
+  *  'schedule()' is the scheduler function. It's a very simple and nice
+  * scheduler: it's not perfect, but certainly works for most things.
+@@ -692,7 +697,13 @@
+        * This just switches the register state and the
+        * stack.
+        */
++#ifdef CONFIG_SYSCALLTIMER
++      timepeg_schedule_switchout();
++#endif
+       switch_to(prev, next, prev);
++#ifdef CONFIG_SYSCALLTIMER
++      timepeg_schedule_switchin();
++#endif
+       __schedule_tail(prev);
+ 
+ same_process:
+Index: linux-2.4.28/kernel/signal.c
+===================================================================
+--- linux-2.4.28.orig/kernel/signal.c  2004-02-18 16:36:32.000000000 +0300
++++ linux-2.4.28/kernel/signal.c       2008-03-27 18:58:04.000000000 +0300
+@@ -1277,7 +1277,7 @@
+ #endif /* __sparc__ */
+ #endif
+ 
+-#if !defined(__alpha__) && !defined(__ia64__)
++#if !defined(__alpha__) && !defined(__ia64__) && !defined(__arm__)
+ /*
+  * For backwards compatibility.  Functionality superseded by sigprocmask.
+  */
+@@ -1305,7 +1305,8 @@
+ }
+ #endif /* !defined(__alpha__) */
+ 
+-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__)
++#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && \
++    !defined(__arm__)
+ /*
+  * For backwards compatibility.  Functionality superseded by sigaction.
+  */
+@@ -1322,4 +1323,4 @@
+ 
+       return ret ? ret : (unsigned long)old_sa.sa.sa_handler;
+ }
+-#endif /* !alpha && !__ia64__ && !defined(__mips__) */
++#endif /* !alpha && !__ia64__ && !defined(__mips__) && !defined(__arm__) */
+Index: linux-2.4.28/kernel/softirq.c
+===================================================================
+--- linux-2.4.28.orig/kernel/softirq.c 2004-11-17 14:54:22.000000000 +0300
++++ linux-2.4.28/kernel/softirq.c      2008-03-27 18:58:04.000000000 +0300
+@@ -16,6 +16,7 @@
+ #include <linux/smp_lock.h>
+ #include <linux/init.h>
+ #include <linux/tqueue.h>
++#include <linux/compiler.h>
+ 
+ /*
+    - No shared variables, all the data are CPU local.
+@@ -58,20 +59,44 @@
+               wake_up_process(tsk);
+ }
+ 
+-asmlinkage void do_softirq()
++static inline int softirqd_is_waken(unsigned cpu)
++{
++      struct task_struct * tsk = ksoftirqd_task(cpu);
++
++      return tsk && tsk->state == TASK_RUNNING;
++}
++
++/*
++ * the higher this number the less likely ksoftirqd will be waken by
++ * a short irq flood peak, but the higher unfariness the softirq load
++ * will generate against the regular scheduler tasks.
++ * Each loop will allow one more block to pass through to the
++ * higher layer. If further blocks keeps arriving we giveup and we
++ * offload the work in a scheduler friendly way. After ksoftirqd
++ * is started we will stop wasting time here, so under attack
++ * we're still competely fair.
++ */
++#define MAX_SOFTIRQ_LOOPS 8
++
++static void __do_softirq(int ksoftirqd)
+ {
+       int cpu = smp_processor_id();
+       __u32 pending;
+       unsigned long flags;
+       __u32 mask;
++      int loops;
+ 
+       if (in_interrupt())
+               return;
+ 
+       local_irq_save(flags);
+ 
+-      pending = softirq_pending(cpu);
++      if (!ksoftirqd && softirqd_is_waken(cpu))
++              pending = 0;
++      else
++              pending = softirq_pending(cpu);
+ 
++      loops = 0;
+       if (pending) {
+               struct softirq_action *h;
+ 
+@@ -101,13 +126,26 @@
+               }
+               __local_bh_enable();
+ 
+-              if (pending)
+-                      wakeup_softirqd(cpu);
++              if (!softirqd_is_waken(cpu)) {
++                      if (unlikely(++loops >= MAX_SOFTIRQ_LOOPS)) {
++                              if (pending)
++                                      wakeup_softirqd(cpu);
++                      } else {
++                              mask = ~pending;
++                              local_bh_disable();
++                              goto restart;
++                      }
++              }
+       }
+ 
+       local_irq_restore(flags);
+ }
+ 
++asmlinkage void do_softirq()
++{
++      __do_softirq(0);
++}
++
+ /*
+  * This function must run with irq disabled!
+  */
+@@ -386,7 +424,7 @@
+               __set_current_state(TASK_RUNNING);
+ 
+               while (softirq_pending(cpu)) {
+-                      do_softirq();
++                      __do_softirq(1);
+                       if (current->need_resched)
+                               schedule();
+               }
+Index: linux-2.4.28/kernel/sysctl.c
+===================================================================
+--- linux-2.4.28.orig/kernel/sysctl.c  2004-11-17 14:54:22.000000000 +0300
++++ linux-2.4.28/kernel/sysctl.c       2008-03-27 18:58:04.000000000 +0300
+@@ -33,6 +33,7 @@
+ #include <linux/swap.h>
+ 
+ #include <asm/uaccess.h>
++#include <asm/semaphore.h>
+ 
+ #ifdef CONFIG_ROOT_NFS
+ #include <linux/nfs_fs.h>
+@@ -44,7 +45,9 @@
+ extern int panic_timeout;
+ extern int C_A_D;
+ extern int bdf_prm[], bdflush_min[], bdflush_max[];
++#ifndef NO_MM
+ extern int sysctl_overcommit_memory;
++#endif
+ extern int max_threads;
+ extern atomic_t nr_queued_signals;
+ extern int max_queued_signals;
+@@ -106,7 +109,9 @@
+ extern int acct_parm[];
+ #endif
+ 
++#ifndef NO_MM
+ extern int pgt_cache_water[];
++#endif
+ 
+ static int parse_table(int *, int, void *, size_t *, void *, size_t,
+                      ctl_table *, void **);
+@@ -118,7 +123,9 @@
+       { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
+ 
+ static ctl_table kern_table[];
++#ifndef NO_MM
+ static ctl_table vm_table[];
++#endif
+ #ifdef CONFIG_NET
+ extern ctl_table net_table[];
+ #endif
+@@ -155,7 +162,9 @@
+ 
+ static ctl_table root_table[] = {
+       {CTL_KERN, "kernel", NULL, 0, 0555, kern_table},
++#ifndef NO_MM
+       {CTL_VM, "vm", NULL, 0, 0555, vm_table},
++#endif
+ #ifdef CONFIG_NET
+       {CTL_NET, "net", NULL, 0, 0555, net_table},
+ #endif
+@@ -281,6 +290,7 @@
+       {0}
+ };
+ 
++#ifndef NO_MM
+ static ctl_table vm_table[] = {
+       {VM_GFP_DEBUG, "vm_gfp_debug", 
+        &vm_gfp_debug, sizeof(int), 0644, NULL, &proc_dointvec},
+@@ -317,6 +327,7 @@
+        &block_dump, sizeof(int), 0644, NULL, &proc_dointvec},
+       {0}
+ };
++#endif /* NO_MM */
+ 
+ static ctl_table proc_table[] = {
+       {0}
+Index: linux-2.4.28/kernel/timer.c
+===================================================================
+--- linux-2.4.28.orig/kernel/timer.c   2002-11-29 02:53:15.000000000 +0300
++++ linux-2.4.28/kernel/timer.c        2008-03-27 18:58:04.000000000 +0300
+@@ -24,6 +24,7 @@
+ #include <linux/kernel_stat.h>
+ 
+ #include <asm/uaccess.h>
++#include <asm/io.h>
+ 
+ /*
+  * Timekeeping variables
+@@ -495,7 +496,23 @@
+           /* Reduce by this step the amount of time left  */
+           time_adjust -= time_adjust_step;
+       }
++#if 0
++//#if defined(CONFIG_MTD_NETtel) && !defined(CONFIG_TIMEPEG)
++{
++      extern void *cpu_mmcrp;
++      register long ms;
++      /* Work around for glitching problem of SC520 - Rev A1 silicon */
++      if (cpu_mmcrp) {
++              /* Use SC520 millisecond timer */
++              ms = *((volatile unsigned short *) (cpu_mmcrp + 0xc60));
++              xtime.tv_usec += (ms * 1000) + time_adjust_step;
++      } else {
++              xtime.tv_usec += tick + time_adjust_step;
++      }
++}
++#else
+       xtime.tv_usec += tick + time_adjust_step;
++#endif
+       /*
+        * Advance the phase, once it gets to one microsecond, then
+        * advance the tick more.
diff --git a/target/linux/rtl865x-2.4/patches-2.4.28/900-lib.patch 
b/target/linux/rtl865x-2.4/patches-2.4.28/900-lib.patch
new file mode 100644
index 0000000..ae2875c
--- /dev/null
+++ b/target/linux/rtl865x-2.4/patches-2.4.28/900-lib.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/inflate.c b/lib/inflate.c
+index 771d227..5d1b5da 100644
+--- a/lib/inflate.c
++++ b/lib/inflate.c
+@@ -996,7 +996,7 @@ STATIC int inflate()
+ 
+   /* return success */
+ #ifdef DEBUG
+-  fprintf(stderr, "<%u> ", h);
++  printk("<%u> ", h);
+ #endif /* DEBUG */
+   return 0;
+ }
diff --git a/target/linux/rtl865x-2.4/patches-2.4.28/930-mm.patch 
b/target/linux/rtl865x-2.4/patches-2.4.28/930-mm.patch
new file mode 100644
index 0000000..a858f81
--- /dev/null
+++ b/target/linux/rtl865x-2.4/patches-2.4.28/930-mm.patch
@@ -0,0 +1,13 @@
+diff --git a/mm/slab.c b/mm/slab.c
+index 4955f0a..c942528 100644
+--- a/mm/slab.c
++++ b/mm/slab.c
+@@ -682,7 +682,7 @@ kmem_cache_create (const char *name, size_t size, size_t 
offset,
+       if (size & (BYTES_PER_WORD-1)) {
+               size += (BYTES_PER_WORD-1);
+               size &= ~(BYTES_PER_WORD-1);
+-              printk("%sForcing size word alignment - %s\n", func_nm, name);
++              printk(KERN_WARNING "%sForcing size word alignment - %s\n", 
func_nm, name);
+       }
+       
+ #if DEBUG
-- 
1.5.4.1

_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to