buildroot+mips under cygwin

1.download buildroot,gcc,bintuils.uclibc linux-header

2.upack buildroot

3.mkdir /buildroot/dl

4.put uclibc ,gcc,bintuils tarball in dl

5.cd buildroot make menuconfig

failed

fixed as follow

--- buildroot/package/config/Makefile 2007-08-04 15:15:44.000000000 +0800
+++ buildroot-old/package/config/Makefile 2007-09-09 15:58:06.728702400 +0800
@@ -20,7 +20,7 @@
  $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $< -o $@
 
 $(host-cmulti): %: $(host-cobjs) $(host-cshlib)
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $($@-objs) -o $@
+ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $($@-objs) -lintl -lncurses -o $@
 
 $(host-cobjs): %.o: %.c
  $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) -c $< -o $@

 

--- buildroot/toolchain/uClibc/uclibc.mk 2007-08-04 15:15:02.000000000 +0800
+++ buildroot-new/toolchain/uClibc/uclibc.mk 2007-10-22 09:49:39.721336200 +0800
@@ -347,14 +347,9 @@
   fi; /
  fi;
 endif
- # Build the host utils.  Need to add an install target...
- $(MAKE1) -C $(UCLIBC_DIR)/utils /
-  PREFIX=$(STAGING_DIR) /
-  HOSTCC="$(HOSTCC)" /
-  hostutils
- install -c $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/usr/bin/ldd
+# install -c $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/usr/bin/ldd
  ln -sf ldd $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldd
- install -c $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/usr/bin/ldconfig
+# install -c $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/usr/bin/ldconfig
  ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldconfig
  ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-ldconfig
  touch -c $@

6. buildroot

make menuconfig

note: not select locale,wchar support

7. make

8. failed at binutils-2.15

patched

--- binutils-2.15/ld/ldmain.c 2008-04-02 16:26:19.893733000 +0800
+++ binutils-2.15-patch/ld/ldmain.c 2007-10-11 16:47:59.282360000 +0800
@@ -398,13 +398,14 @@
       lex_string = NULL;
     }
 /* NG horrible hack, but it works and I haven't the time to do this properly */
+/*
 #ifdef bfd_set_link_info
  bfd_set_link_info(&link_info);
 #endif
 #ifdef bfd_set_force_make_executable
  bfd_set_force_make_executable(force_make_executable);
 #endif
-
+*/
 
   if (trace_file_tries)
     {

 

8. continue make 

failed at gcc

add patch

304-index_macro.patch

302-c99-snprintf.patch

 

9.make,failed at uClibc

 

10.collect some patch total as follow

diff -Nru uClibc-0.9.29/extra/config/Makefile uClibc-0.9.29-patch/extra/config/Makefile
--- uClibc-0.9.29/extra/config/Makefile 2007-09-07 14:44:50.000000000 +0800
+++ uClibc-0.9.29-patch/extra/config/Makefile 2007-09-11 10:26:41.000000000 +0800
@@ -21,7 +21,7 @@
  $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $< -o $@
 
 $(host-cmulti): %: $(host-cobjs) $(host-cshlib)
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $($@-objs) -lintl -o $@
+ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $($@-objs) -lintl -lncurses -o $@
 
 $(host-cobjs): %.o: %.c
  $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) -c $< -o $@
diff -Nru uClibc-0.9.29/libc/string/mips/memcpy.S uClibc-0.9.29-patch/libc/string/mips/memcpy.S
--- uClibc-0.9.29/libc/string/mips/memcpy.S 2006-11-05 03:48:12.000000000 +0800
+++ uClibc-0.9.29-patch/libc/string/mips/memcpy.S 2007-09-10 13:25:29.000000000 +0800
@@ -140,17 +140,17 @@
 END (memcpy)
 
 #else /* !__mips64 */
-
+#include <sys/asm.h>
 #if __BYTE_ORDER == __BIG_ENDIAN
-#  define LWHI lwl  /* high part is left in big-endian */
-#  define SWHI swl  /* high part is left in big-endian */
-#  define LWLO lwr  /* low part is right in big-endian */
-#  define SWLO swr  /* low part is right in big-endian */
+#define LWHI lwl  /* high part is left in big-endian */
+#define SWHI swl  /* high part is left in big-endian */
+#define LWLO lwr  /* low part is right in big-endian */
+#define SWLO swr  /* low part is right in big-endian */
 #else
-#  define LWHI lwr  /* high part is right in little-endian */
-#  define SWHI swr  /* high part is right in little-endian */
-#  define LWLO lwl  /* low part is left in little-endian */
-#  define SWLO swl  /* low part is left in little-endian */
+#define LWHI lwr  /* high part is right in little-endian */
+#define SWHI swr  /* high part is right in little-endian */
+#define LWLO lwl  /* low part is left in little-endian */
+#define SWLO swl  /* low part is left in little-endian */
 #endif
 
 ENTRY (memcpy)
diff -Nru uClibc-0.9.29/libc/string/mips/sysdep.h uClibc-0.9.29-patch/libc/string/mips/sysdep.h
--- uClibc-0.9.29/libc/string/mips/sysdep.h 2006-01-14 08:58:03.000000000 +0800
+++ uClibc-0.9.29-patch/libc/string/mips/sysdep.h 2007-09-10 13:46:19.000000000 +0800
@@ -29,7 +29,7 @@
   .globl name;                                                                /
   .align 2;                                                                   /
   .ent name,0;                                                                /
-  name##:
+  name:
 
 #undef END
 #define END(function)                                   /
diff -Nru uClibc-0.9.29/libc/sysdeps/linux/common/mmap64.c uClibc-0.9.29-patch/libc/sysdeps/linux/common/mmap64.c
--- uClibc-0.9.29/libc/sysdeps/linux/common/mmap64.c 2008-03-26 09:49:49.218842800 +0800
+++ uClibc-0.9.29-patch/libc/sysdeps/linux/common/mmap64.c 2007-09-10 12:02:02.000000000 +0800
@@ -63,7 +63,7 @@
                          fd,((__u_quad_t)offset >> MMAP2_PAGE_SHIFT));
 #else
    return __syscall_mmap2(addr, len, prot, flags,
-                          fd,((__ulong_t)offset >> MMAP2_PAGE_SHIFT));
+                          fd,((unsigned long)offset >> MMAP2_PAGE_SHIFT));
 #endif
 }
 
diff -Nru uClibc-0.9.29/libc/sysdeps/linux/mips/crti.S uClibc-0.9.29-patch/libc/sysdeps/linux/mips/crti.S
--- uClibc-0.9.29/libc/sysdeps/linux/mips/crti.S 2006-11-05 03:53:15.000000000 +0800
+++ uClibc-0.9.29-patch/libc/sysdeps/linux/mips/crti.S 2007-09-10 13:56:50.000000000 +0800
@@ -4,10 +4,8 @@
  .section .mdebug.abi32
  .previous
  .abicalls
-#APP
  
  .section .init
-#NO_APP
  .align 2
  .globl _init
  .ent _init
@@ -23,13 +21,11 @@
  .cprestore 16
  sw $31,28($sp)
  sw $28,24($sp)
-#APP
  
  .align 2
  .end _init
  
  .section .fini
-#NO_APP
  .align 2
  .globl _fini
  .ent _fini
@@ -45,7 +41,6 @@
  .cprestore 16
  sw $31,28($sp)
  sw $28,24($sp)
-#APP
  .align 2
  .end _fini
  
@@ -55,10 +50,8 @@
  .section .mdebug.abiN32
  .previous
  .abicalls
-#APP
  
  .section .init
-#NO_APP
  .align 2
  .align 3
  .globl _init
@@ -74,13 +67,11 @@
  addu $28,$28,$25
  addiu $28,$28,%lo(%neg(%gp_rel(_init)))
  sd $31,8($sp)
-#APP
  
  .align 3
  .end _init
 
  .section .fini
-#NO_APP
  .align 2
  .align 3
  .globl _fini
@@ -96,7 +87,6 @@
  addu $28,$28,$25
  addiu $28,$28,%lo(%neg(%gp_rel(_fini)))
  sd $31,8($sp)
-#APP
  .align 3
  .end _fini
  
@@ -106,11 +96,9 @@
  .section .mdebug.abi64
  .previous
  .abicalls
-#APP
  
  
  .section .init
-#NO_APP
  .align 2
  .globl _init
  .ent _init
@@ -127,13 +115,11 @@
  addiu $1,$1,%lo(%neg(%gp_rel(_init)))
  daddu $gp,$1,$25
  .set at
-#APP
  
  .align 2
  .end _init
  
  .section .fini
-#NO_APP
  .align 2
  .globl _fini
  .ent _fini
@@ -150,7 +136,6 @@
  addiu $1,$1,%lo(%neg(%gp_rel(_fini)))
  daddu $gp,$1,$25
  .set at
-#APP
  .align 2
  .end _fini
  
diff -Nru uClibc-0.9.29/libc/sysdeps/linux/mips/crtn.S uClibc-0.9.29-patch/libc/sysdeps/linux/mips/crtn.S
--- uClibc-0.9.29/libc/sysdeps/linux/mips/crtn.S 2006-11-05 03:53:15.000000000 +0800
+++ uClibc-0.9.29-patch/libc/sysdeps/linux/mips/crtn.S 2007-09-10 14:04:02.000000000 +0800
@@ -4,17 +4,14 @@
  .section .mdebug.abi32
  .previous
  .abicalls
-#APP
  
  .section .init
-#NO_APP
  .align 2
  .globl _init
  .ent _init
  .type _init, @function
-#NO_APP
  lw $31,28($sp)
- #nop
+
  .set noreorder
  .set nomacro
  j $31
@@ -23,17 +20,14 @@
  .set reorder
 
  .end _init
-#APP
  
  .section .fini
-#NO_APP
  .align 2
  .globl _fini
  .ent _fini
  .type _fini, @function
-#NO_APP
  lw $31,28($sp)
- #nop
+
  .set noreorder
  .set nomacro
  j $31
@@ -42,7 +36,6 @@
  .set reorder
 
  .end _fini
-#APP
  
  .ident "GCC: (GNU) 3.3.2"
 #elif _MIPS_SIM == _MIPS_SIM_NABI32
@@ -50,16 +43,13 @@
  .section .mdebug.abiN32
  .previous
  .abicalls
-#APP
  
  .section .init
-#NO_APP
  .align 2
  .align 3
  .globl _init
  .ent _init
  .type _init, @function
-#NO_APP
  ld $31,8($sp)
  ld $28,0($sp)
  .set noreorder
@@ -70,16 +60,13 @@
  .set reorder
 
  .end _init
-#APP
  
  .section .fini
-#NO_APP
  .align 2
  .align 3
  .globl _fini
  .ent _fini
  .type _fini, @function
-#NO_APP
  ld $31,8($sp)
  ld $28,0($sp)
  .set noreorder
@@ -90,7 +77,6 @@
  .set reorder
 
  .end _fini
-#APP
  
  .ident "GCC: (GNU) 3.4.3"
 #else /* N64 */
@@ -98,19 +84,16 @@
  .section .mdebug.abi64
  .previous
  .abicalls
-#APP
  
  
  .section .init
-#NO_APP
  .align 2
  .globl _init
  .ent _init
  .type _init, @function
-#NO_APP
  ld $31,24($sp)
  ld $28,16($sp)
- #nop
+
  .set noreorder
  .set nomacro
  j $31
@@ -119,18 +102,15 @@
  .set reorder
 
  .end _init
-#APP
  
  .section .fini
-#NO_APP
  .align 2
  .globl _fini
  .ent _fini
  .type _fini, @function
-#NO_APP
  ld $31,24($sp)
  ld $28,16($sp)
- #nop
+
  .set noreorder
  .set nomacro
  j $31
@@ -139,7 +119,6 @@
  .set reorder
 
  .end _fini
-#APP
  
  .ident "GCC: (GNU) 3.3.2"
 #endif /* N64 */
diff -Nru uClibc-0.9.29/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h uClibc-0.9.29-patch/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
--- uClibc-0.9.29/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h 2006-01-31 13:05:15.000000000 +0800
+++ uClibc-0.9.29-patch/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h 2007-09-10 14:41:48.000000000 +0800
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
+
 #ifndef __ASSEMBLER__
 # include <linuxthreads/internals.h>
 #endif
diff -Nru uClibc-0.9.29/utils/readelf.c uClibc-0.9.29-patch/utils/readelf.c
--- uClibc-0.9.29/utils/readelf.c 2006-10-07 14:01:37.000000000 +0800
+++ uClibc-0.9.29-patch/utils/readelf.c 2007-09-10 16:09:34.000000000 +0800
@@ -24,7 +24,7 @@
 #include <sys/types.h>
 
 #include "bswap.h"
-#include "link.h"
+#include "../include/link.h"
 /* makefile will include elf.h for us */
 
 int byteswap;

10. test build

hello in c

hello in c++

hello with pthread

build with shared libc, and -static

you will find some error at "***.os"

cd uClibc-xxx; rm the "**.os" then make; and cp -a lib/* to toolchain lib

 

11.test again

failed at link hello-thread static

in uClibc-*/libpthread/linuxthreads/Makefile.in, i add a libc-cancellation.o

i am not sure it correct, but it workes

libc-static-y += $(libpthread_OUT)/libc_pthread_init.o $(libpthread_OUT)/libc-cancellation.o

 

12.OK

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值