From 4b15e7fd78da67313149e38a0d40165b8e288a0f Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 28 Nov 2009 22:25:26 +0000 Subject: [PATCH] [kernel] Some build fixes. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18590 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.21/024-mips_disable_fpu.patch | 2 +- .../patches-2.6.25/024-mips_disable_fpu.patch | 155 ++++++++++++++++++ .../30-fix_conflicting_getline.patch | 29 ++++ 3 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch create mode 100644 target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch 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 index eabc3bfcc..3476d158e 100644 --- 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 @@ -135,6 +135,7 @@ Signed-off-by: Florian Fainelli + return 0; +} + ++#ifdef CONFIG_64BIT +int fpu_emulator_save_context32(struct sigcontext32 __user *sc) +{ + return 0; @@ -145,6 +146,5 @@ Signed-off-by: Florian Fainelli + return 0; +} + -+#ifdef CONFIG_64BIT +#endif /* CONFIG_64BIT */ +#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch new file mode 100644 index 000000000..3dfbec792 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch @@ -0,0 +1,155 @@ +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 +-- +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -831,6 +831,17 @@ config I8259 + config MIPS_BONITO64 + bool + ++config MIPS_FPU_EMU ++ bool "Enable FPU emulation" ++ default y ++ 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 +@@ -2,12 +2,14 @@ + # Makefile for the Linux/MIPS kernel FPU emulation. + # + +-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ ++obj-y := kernel_linkage.o dsemul.o cp1emu.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 + + EXTRA_CFLAGS += -Werror +--- a/arch/mips/math-emu/cp1emu.c ++++ b/arch/mips/math-emu/cp1emu.c +@@ -57,6 +57,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 *, +@@ -67,10 +73,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,6 +1279,13 @@ 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 */ + + #ifdef CONFIG_DEBUG_FS + extern struct dentry *mips_debugfs_dir; +--- a/arch/mips/math-emu/dsemul.c ++++ b/arch/mips/math-emu/dsemul.c +@@ -110,6 +110,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 __user *fr; +@@ -166,3 +167,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; ++} ++ ++#ifdef CONFIG_64BIT ++int fpu_emulator_save_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++#endif /* CONFIG_64BIT */ ++#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch b/target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch new file mode 100644 index 000000000..0a68134f7 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch @@ -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; -- 2.35.1