[amazon] Add some build fixes for kernel 2.6.21 and the infineon amazon target.
authorhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 8 Nov 2009 21:56:59 +0000 (21:56 +0000)
committerhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 8 Nov 2009 21:56:59 +0000 (21:56 +0000)
Now it compiles with the new toolchain.
These are mostly backports from mainline linux and newer linux kernels from openwrt.

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18345 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/amazon/config-2.6.21
target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch [new file with mode: 0644]
target/linux/generic-2.6/patches-2.6.21/150-netfilter_imq.patch
target/linux/generic-2.6/patches-2.6.21/160-netfilter_route.patch
target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch [new file with mode: 0644]
target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch [new file with mode: 0644]
target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch [new file with mode: 0644]
target/linux/generic-2.6/patches-2.6.21/900-headers_type_and_time.patch

index c406070..6d830e1 100644 (file)
@@ -74,6 +74,7 @@ CONFIG_MIPS=y
 # CONFIG_MIPS_DB1500 is not set
 # CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_EV64120 is not set
+# CONFIG_MIPS_FPU_EMU is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_MIPS_MALTA is not set
 # CONFIG_MIPS_MIRAGE is not set
diff --git a/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch
new file mode 100644 (file)
index 0000000..4775069
--- /dev/null
@@ -0,0 +1,150 @@
+MIPS: allow disabling the kernel FPU emulator
+
+This patch allows turning off the in-kernel Algorithmics
+FPU emulator support, which allows one to save a couple of
+precious blocks on an embedded system.
+
+Signed-off-by: Florian Fainelli <florian@openwrt.org>
+
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -938,6 +938,17 @@ config LIMITED_DMA
+ config MIPS_BONITO64
+       bool
++config MIPS_FPU_EMU
++      bool
++      default n
++      help
++         This option allows building a kernel with or without the Algorithmics
++         FPU emulator enabled. Turning off this option results in a kernel which
++         does not catch floating operations exceptions. Make sure that your toolchain
++         is configured to enable software floating point emulation in that case.
++              
++         If unsure say Y here.
++
+ config MIPS_MSC
+       bool
+--- a/arch/mips/math-emu/Makefile
++++ b/arch/mips/math-emu/Makefile
+@@ -1,11 +1,12 @@
+ #
+ # Makefile for the Linux/MIPS kernel FPU emulation.
+ #
++obj-y :=      kernel_linkage.o dsemul.o cp1emu.o
+-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
++obj-$(CONFIG_MIPS_FPU_EMU)    += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
+          ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
+          dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
+          dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \
+          sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
+          sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
+-         dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
++         dp_sqrt.o sp_sqrt.o
+--- a/arch/mips/math-emu/cp1emu.c
++++ b/arch/mips/math-emu/cp1emu.c
+@@ -56,6 +56,12 @@
+ #endif
+ #define __mips 4
++/* Further private data for which no space exists in mips_fpu_struct */
++
++struct mips_fpu_emulator_stats fpuemustats;
++
++#ifdef CONFIG_MIPS_FPU_EMU
++
+ /* Function which emulates a floating point instruction. */
+ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
+@@ -66,10 +72,6 @@ static int fpux_emu(struct pt_regs *,
+       struct mips_fpu_struct *, mips_instruction);
+ #endif
+-/* Further private data for which no space exists in mips_fpu_struct */
+-
+-struct mips_fpu_emulator_stats fpuemustats;
+-
+ /* Control registers */
+ #define FPCREG_RID    0       /* $0  = revision id */
+@@ -1277,3 +1279,10 @@ int fpu_emulator_cop1Handler(struct pt_r
+       return sig;
+ }
++#else
++int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
++        int has_fpu)
++{
++      return 0;
++}
++#endif /* CONFIG_MIPS_FPU_EMU */
+--- a/arch/mips/math-emu/dsemul.c
++++ b/arch/mips/math-emu/dsemul.c
+@@ -112,6 +112,7 @@ int mips_dsemul(struct pt_regs *regs, mi
+       return SIGILL;          /* force out of emulation loop */
+ }
++#ifdef CONFIG_MIPS_FPU_EMU
+ int do_dsemulret(struct pt_regs *xcp)
+ {
+       struct emuframe *fr;
+@@ -167,3 +168,9 @@ int do_dsemulret(struct pt_regs *xcp)
+       return 1;
+ }
++#else
++int do_dsemulret(struct pt_regs *xcp)
++{
++      return 0;
++}
++#endif /* CONFIG_MIPS_FPU_EMU */
+--- a/arch/mips/math-emu/kernel_linkage.c
++++ b/arch/mips/math-emu/kernel_linkage.c
+@@ -28,6 +28,7 @@
+ #define SIGNALLING_NAN 0x7ff800007ff80000LL
++#ifdef CONFIG_MIPS_FPU_EMU
+ void fpu_emulator_init_fpu(void)
+ {
+       static int first = 1;
+@@ -111,4 +112,36 @@ int fpu_emulator_restore_context32(struc
+       return err;
+ }
+-#endif
++#endif        /* CONFIG_64BIT */
++#else
++
++void fpu_emulator_init_fpu(void)
++{
++      printk(KERN_INFO "FPU emulator disabled, make sure your toolchain"
++              "was compiled with software floating point support (soft-float)\n");
++      return;
++}
++
++int fpu_emulator_save_context(struct sigcontext __user *sc)
++{
++      return 0;
++}
++
++int fpu_emulator_restore_context(struct sigcontext __user *sc)
++{
++      return 0;
++}
++
++int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
++{
++      return 0;
++}
++
++int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
++{
++      return 0;
++}
++
++#ifdef CONFIG_64BIT
++#endif        /* CONFIG_64BIT */
++#endif /* CONFIG_MIPS_FPU_EMU */
index b3ba77b..f57dd5b 100644 (file)
        depends on IP_NF_MANGLE
 --- a/net/ipv4/netfilter/Makefile
 +++ b/net/ipv4/netfilter/Makefile
-@@ -98,6 +98,7 @@ obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ip
+@@ -97,6 +97,7 @@ obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ip
  obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o
  obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
  obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
index 0d305e3..8fcec08 100644 (file)
 +module_exit(fini);
 --- a/net/ipv4/netfilter/Kconfig
 +++ b/net/ipv4/netfilter/Kconfig
-@@ -825,5 +825,22 @@ config IP_NF_TARGET_SET
-         To compile it as a module, choose M here.  If unsure, say N.
+@@ -684,5 +684,22 @@ config IP_NF_ARP_MANGLE
+         Allows altering the ARP packet payload: source and destination
+         hardware and network addresses.
  
 +config IP_NF_TARGET_ROUTE
 +      tristate  'ROUTE target support'
  
 --- a/net/ipv4/netfilter/Makefile
 +++ b/net/ipv4/netfilter/Makefile
-@@ -101,6 +101,7 @@ obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_EC
+@@ -100,6 +100,7 @@ obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_EC
  obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
  obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
  obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
diff --git a/target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch b/target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch
new file mode 100644 (file)
index 0000000..0a68134
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/scripts/unifdef.c
++++ b/scripts/unifdef.c
+@@ -206,7 +206,7 @@ static void             done(void);
+ static void             error(const char *);
+ static int              findsym(const char *);
+ static void             flushline(bool);
+-static Linetype         getline(void);
++static Linetype         get_line(void);
+ static Linetype         ifeval(const char **);
+ static void             ignoreoff(void);
+ static void             ignoreon(void);
+@@ -512,7 +512,7 @@ process(void)
+       for (;;) {
+               linenum++;
+-              lineval = getline();
++              lineval = get_line();
+               trans_table[ifstate[depth]][lineval]();
+               debug("process %s -> %s depth %d",
+                   linetype_name[lineval],
+@@ -526,7 +526,7 @@ process(void)
+  * help from skipcomment().
+  */
+ static Linetype
+-getline(void)
++get_line(void)
+ {
+       const char *cp;
+       int cursym;
diff --git a/target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch b/target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch
new file mode 100644 (file)
index 0000000..45c753b
--- /dev/null
@@ -0,0 +1,21 @@
+[MIPS] Fix computation of {PGD,PMD,PTE}_T_LOG2.
+
+For the generation of asm-offset.h to work these need to be evaulatable
+by gcc as a constant expression.  This issue did exist for a while but
+didn't bite because they're only in asm-offset.h for debugging purposes.
+
+--- a/include/asm-mips/pgtable.h
++++ b/include/asm-mips/pgtable.h
+@@ -168,9 +168,9 @@ static inline void pte_clear(struct mm_s
+ #define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
+ #endif
+-#define PGD_T_LOG2    ffz(~sizeof(pgd_t))
+-#define PMD_T_LOG2    ffz(~sizeof(pmd_t))
+-#define PTE_T_LOG2    ffz(~sizeof(pte_t))
++#define PGD_T_LOG2    (__builtin_ffs(sizeof(pgd_t)) - 1)
++#define PMD_T_LOG2    (__builtin_ffs(sizeof(pmd_t)) - 1)
++#define PTE_T_LOG2    (__builtin_ffs(sizeof(pte_t)) - 1)
+ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
diff --git a/target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch b/target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch
new file mode 100644 (file)
index 0000000..378ee28
--- /dev/null
@@ -0,0 +1,17 @@
+time: prevent the loop in timespec_add_ns() from being optimised away
+
+Since some architectures don't support __udivdi3().
+
+--- a/include/linux/time.h
++++ b/include/linux/time.h
+@@ -170,6 +170,10 @@ static inline void timespec_add_ns(struc
+ {
+       ns += a->tv_nsec;
+       while(unlikely(ns >= NSEC_PER_SEC)) {
++              /* The following asm() prevents the compiler from
++               * optimising this loop into a modulo operation.  */
++              asm("" : "+r"(ns));
++
+               ns -= NSEC_PER_SEC;
+               a->tv_sec++;
+       }
index ed812ee..8d74859 100644 (file)
@@ -11,7 +11,7 @@
  #include <linux/types.h>
  
  #ifdef __KERNEL__
-@@ -224,4 +228,6 @@ struct itimerval {
+@@ -228,4 +232,6 @@ struct itimerval {
   */
  #define TIMER_ABSTIME                 0x01