Преглед на файлове

Merge branch 'master' of git+ssh://openadk.org/git/openadk

Waldemar Brodkorb преди 11 години
родител
ревизия
0a9ca018d5
променени са 100 файла, в които са добавени 1804 реда и са изтрити 1955 реда
  1. 0 1
      .gitignore
  2. 1 5
      README
  3. 22 22
      mk/build.mk
  4. 1 1
      mk/host.mk
  5. 6 6
      mk/image.mk
  6. 1 1
      mk/kernel-vars.mk
  7. 1 1
      mk/kernel-ver.mk
  8. 1 1
      mk/package.mk
  9. 3 3
      mk/pkg-bottom.mk
  10. 22 23
      mk/vars.mk
  11. 1 1
      package/base-files/Makefile
  12. 7 4
      package/gcc/Makefile
  13. 698 0
      package/gcc/patches/4.8.2/musl-cross.patch
  14. 5 3
      package/gcj/Makefile
  15. 1 1
      package/openjdk7/Makefile
  16. 92 0
      package/perl/files/config.sh.mips64.eglibc
  17. 92 0
      package/perl/files/config.sh.mips64.uclibc
  18. 92 0
      package/perl/files/config.sh.mipsel.musl
  19. 1 1
      package/xbmc/Makefile
  20. 1 0
      rules.mk
  21. 3 2
      scripts/create.sh
  22. 0 36
      scripts/scan-tools.sh
  23. 2 2
      target/arm/sys-available/toolchain-arm
  24. 0 11
      target/arm/sys-available/toolchain-armeb
  25. 23 0
      target/config/Config.in
  26. 40 0
      target/config/Config.in.tools
  27. 6 2
      target/linux/config/Config.in.kernel
  28. 6 11
      target/microblaze/Makefile
  29. 3 11
      target/mips/Makefile
  30. 1 0
      target/ppc/sys-available/toolchain-ppc
  31. 1 0
      target/ppc64/sys-available/toolchain-ppc64
  32. 0 1
      target/tarch.lst
  33. 0 4
      target/tools/addpattern/Makefile
  34. 0 300
      target/tools/lzma-loader/.svn/entries
  35. 0 663
      target/tools/lzma-loader/.svn/text-base/LzmaDecode.c.svn-base
  36. 0 100
      target/tools/lzma-loader/.svn/text-base/LzmaDecode.h.svn-base
  37. 0 77
      target/tools/lzma-loader/.svn/text-base/Makefile.svn-base
  38. 0 55
      target/tools/lzma-loader/.svn/text-base/README.svn-base
  39. 0 186
      target/tools/lzma-loader/.svn/text-base/decompress.c.svn-base
  40. 0 20
      target/tools/lzma-loader/.svn/text-base/decompress.lds.in.svn-base
  41. 0 160
      target/tools/lzma-loader/.svn/text-base/head.S.svn-base
  42. 0 17
      target/tools/lzma-loader/.svn/text-base/loader.lds.in.svn-base
  43. 0 4
      target/tools/mkfimage/Makefile
  44. 0 7
      target/tools/rules.mk
  45. 0 4
      target/tools/srec2bin/Makefile
  46. 0 4
      target/tools/trx/Makefile
  47. 3 0
      target/x86/kernel/qemu-i686
  48. 6 1
      toolchain/eglibc/Makefile
  49. 5 3
      toolchain/gcc/Makefile
  50. 0 7
      toolchain/gcc/Makefile.inc
  51. 231 0
      toolchain/gcc/patches/4.8.2/cflags.patch
  52. 49 0
      toolchain/gcc/patches/4.8.2/musl-stubs.patch
  53. 6 0
      toolchain/glibc/Makefile
  54. 2 0
      toolchain/kernel-headers/Makefile
  55. 4 0
      toolchain/musl/Makefile
  56. 197 165
      toolchain/musl/patches/musl-git-20140301.patch
  57. 4 0
      toolchain/uClibc/Makefile
  58. 26 4
      tools/Makefile
  59. 4 0
      tools/addpattern/Makefile
  60. 0 0
      tools/addpattern/addpattern.c
  61. 4 4
      tools/adk/Makefile
  62. 3 3
      tools/bc/Makefile
  63. 24 0
      tools/bzip2/Makefile
  64. 3 3
      tools/cdrtools/Makefile
  65. 2 2
      tools/cpio/Makefile
  66. 3 3
      tools/genext2fs/Makefile
  67. 3 3
      tools/gperf/Makefile
  68. 0 0
      tools/lzma-loader/Makefile
  69. 0 0
      tools/lzma-loader/src/LzmaDecode.c
  70. 0 0
      tools/lzma-loader/src/LzmaDecode.h
  71. 0 0
      tools/lzma-loader/src/LzmaDecode.o
  72. 0 0
      tools/lzma-loader/src/Makefile
  73. 0 0
      tools/lzma-loader/src/README
  74. 0 0
      tools/lzma-loader/src/data.lds
  75. 0 0
      tools/lzma-loader/src/data.o
  76. 0 0
      tools/lzma-loader/src/decompress
  77. 0 0
      tools/lzma-loader/src/decompress.c
  78. 0 0
      tools/lzma-loader/src/decompress.image
  79. 0 0
      tools/lzma-loader/src/decompress.lds
  80. 0 0
      tools/lzma-loader/src/decompress.lds.in
  81. 0 0
      tools/lzma-loader/src/decompress.o
  82. 0 0
      tools/lzma-loader/src/head.S
  83. 0 0
      tools/lzma-loader/src/head.o
  84. 0 0
      tools/lzma-loader/src/loader
  85. 0 0
      tools/lzma-loader/src/loader.elf
  86. 0 0
      tools/lzma-loader/src/loader.gz
  87. 0 0
      tools/lzma-loader/src/loader.lds
  88. 0 0
      tools/lzma-loader/src/loader.lds.in
  89. 0 0
      tools/lzma-loader/src/loader.o
  90. 3 4
      tools/lzma/Makefile
  91. 0 0
      tools/lzma/patches/001-large_files.patch
  92. 0 0
      tools/lzma/patches/002-lzmp.patch
  93. 0 0
      tools/lzma/patches/003-compile_fixes.patch
  94. 0 0
      tools/lzma/patches/100-static_library.patch
  95. 28 0
      tools/lzo/Makefile
  96. 30 0
      tools/lzop/Makefile
  97. 25 0
      tools/m4/Makefile
  98. 2 2
      tools/mkcrypt/Makefile
  99. 4 0
      tools/mkfimage/Makefile
  100. 0 0
      tools/mkfimage/mkfimage.c

+ 0 - 1
.gitignore

@@ -30,7 +30,6 @@
 /host_*/
 /pkg_*/
 /root_*/
-/bin/
 /firmware/
 /build_*/
 /config/*.o

+ 1 - 5
README

@@ -8,16 +8,11 @@ Before you can start you need to install some tools:
 - gcc 
 - binutils 
 - GNU make
-- GNU m4
 - GNU awk
 - GNU sed
 - tar
 - patch
 - gzip
-- bzip2
-- lzop
-- lzma
-- xz
 - wget
 - libc headers
 - ncurses5 headers
@@ -39,3 +34,4 @@ To switch to another target configuration, simply run "make switch". This will
 backup your existing configuration and will start with an empty one.
 
 Sunshine!
+ Waldemar Brodkorb <wbx@openadk.org>

+ 22 - 22
mk/build.mk

@@ -91,7 +91,7 @@ POSTCONFIG=		-@\
 	if [ -f .adkinit ];then rm .adkinit;\
 	else \
 	if [ -f .config.old ];then \
-		$(TOPDIR)/bin/pkgrebuild;\
+		$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgrebuild;\
 		rebuild=0; \
 		if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
 			touch .rebuild.busybox;\
@@ -138,7 +138,7 @@ include $(TOPDIR)/rules.mk
 all: world
 
 ${TOPDIR}/package/Depends.mk: ${TOPDIR}/.config $(wildcard ${TOPDIR}/package/*/Makefile)
-	$(BIN_DIR)/depmaker > ${TOPDIR}/package/Depends.mk
+	$(STAGING_HOST_DIR)/usr/bin/depmaker > ${TOPDIR}/package/Depends.mk
 
 .NOTPARALLEL:
 .PHONY: all world clean cleantarget cleandir distclean image_clean
@@ -155,12 +155,12 @@ ifeq ($(ADK_NATIVE),y)
 else
 ifeq ($(ADK_TOOLCHAIN),y)
 ifeq ($(ADK_TOOLCHAIN_ONLY),y)
-	$(MAKE) -f mk/build.mk toolchain/fixup tools/install package/compile
+	$(MAKE) -f mk/build.mk tools/install toolchain/fixup package/compile
 else
-	$(MAKE) -f mk/build.mk toolchain/fixup tools/install package/compile root_clean package/install
+	$(MAKE) -f mk/build.mk tools/install toolchain/fixup package/compile root_clean package/install
 endif
 else
-	$(MAKE) -f mk/build.mk toolchain/fixup tools/install target/config-prepare target/compile package/compile root_clean package/install target/install package_index
+	$(MAKE) -f mk/build.mk tools/install toolchain/fixup target/config-prepare target/compile package/compile root_clean package/install target/install package_index
 endif
 endif
 
@@ -250,13 +250,13 @@ root_clean:
 clean:
 	@$(TRACE) clean
 	$(MAKE) -C $(CONFIG) clean
-	for d in ${STAGING_PKG_DIR}; do \
-		for f in $$(ls $$d/[a-z]* 2>/dev/null |grep -v [A-Z] 2>/dev/null); do  \
-			while read file ; do \
-				rm ${STAGING_DIR}/$$file 2>/dev/null;\
-			done < $$f ; \
-			rm $$f ; \
-		done \
+	for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do  \
+		while read file ; do \
+			echo ${STAGING_DIR}/$$file ;\
+			rm ${STAGING_DIR}/$$file 2>/dev/null;\
+		done < $$f ; \
+		echo ${STAGING_PKG_DIR}/$$f ;\
+		rm ${STAGING_PKG_DIR}/$$f ; \
 	done
 	rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
 	    	${TOPDIR}/package/pkglist.d
@@ -535,7 +535,7 @@ bulktoolchain:
 			$(GMAKE) prereq && \
 				$(GMAKE) ARCH=$$tarch SYSTEM=toolchain-$$arch LIBC=$$libc defconfig; \
 				$(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
-				tar -cJf ${TOPDIR}/firmware/toolchain_$${arch}_$${libc}.tar.xz host_$${arch}_*_$${libc} target_$${arch}_*_$${libc}; \
+				tar -cvJf ${TOPDIR}/firmware/toolchain_$${arch}_$${libc}.tar.xz host_$${arch}_*_$${libc} target_$${arch}_*_$${libc}; \
 			rm .config; \
 		    ) 2>&1 | tee $(TOPDIR)/firmware/toolchain_$${arch}_$${libc}/build.log; \
 		    if [ -f .exit ];then break;fi \
@@ -619,24 +619,24 @@ bulkallmod:
 	  if [ -f .exit ];then echo "Bulk build failed!"; cat .exit;rm .exit; exit 1;fi \
 	done
 
-${TOPDIR}/bin/pkgmaker: $(TOPDIR)/tools/adk/pkgmaker.c $(TOPDIR)/tools/adk/sortfile.c $(TOPDIR)/tools/adk/strmap.c
-	@mkdir -p ${TOPDIR}/bin
+$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgmaker: $(TOPDIR)/tools/adk/pkgmaker.c $(TOPDIR)/tools/adk/sortfile.c $(TOPDIR)/tools/adk/strmap.c
+	@mkdir -p host_$(GNU_HOST_NAME)/usr/bin
 	@$(CC_FOR_BUILD) -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
 
-${TOPDIR}/bin/pkgrebuild: $(TOPDIR)/tools/adk/pkgrebuild.c $(TOPDIR)/tools/adk/strmap.c
+$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgrebuild: $(TOPDIR)/tools/adk/pkgrebuild.c $(TOPDIR)/tools/adk/strmap.c
 	@$(CC_FOR_BUILD) -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c
 
-package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) ${TOPDIR}/bin/pkgmaker ${TOPDIR}/bin/pkgrebuild
+package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgmaker $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgrebuild
 	@echo "Generating menu structure ..."
-	@$(TOPDIR)/bin/pkgmaker
+	@$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgmaker
 	@:>.menu
 
-${TOPDIR}/bin/depmaker: $(TOPDIR)/tools/adk/depmaker.c
-	$(CC_FOR_BUILD) -g -o $(TOPDIR)/bin/depmaker $(TOPDIR)/tools/adk/depmaker.c
+$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/depmaker: $(TOPDIR)/tools/adk/depmaker.c
+	$(CC_FOR_BUILD) -g -o $@ $(TOPDIR)/tools/adk/depmaker.c
 
-dep: $(TOPDIR)/bin/depmaker
+dep: $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/depmaker
 	@echo "Generating dependencies ..."
-	@$(TOPDIR)/bin/depmaker > ${TOPDIR}/package/Depends.mk
+	@$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/depmaker > ${TOPDIR}/package/Depends.mk
 
 .PHONY: menu dep
 

+ 1 - 1
mk/host.mk

@@ -37,7 +37,7 @@ _HOST_PATCH_COOKIE=	${WRKDIST}/.prepared
 _HOST_CONFIGURE_COOKIE=	${WRKDIR}/.host_configure_done
 _HOST_BUILD_COOKIE=	${WRKDIR}/.host_build_done
 _HOST_FAKE_COOKIE=	${HOST_WRKINST}/.host_fake_done
-_HOST_COOKIE=		${STAGING_PKG_DIR}/${PKG_NAME}${PKG_VERSION}-${PKG_RELEASE}-host
+_HOST_COOKIE=		${STAGING_PKG_DIR}/stamps/${PKG_NAME}${PKG_VERSION}-${PKG_RELEASE}-host
 
 hostextract: ${_HOST_EXTRACT_COOKIE}
 hostpatch: ${_HOST_PATCH_COOKIE}

+ 6 - 6
mk/image.mk

@@ -136,15 +136,15 @@ endif
 ${FW_DIR}/${ROOTFSTARBALL}: ${TARGET_DIR} kernel-package
 	cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | \
 		sed "s#\(.*\)#:0:0::::::\1#" | sort | \
-		${BIN_DIR}/cpio -o -Hustar -P | gzip -n9 >$@
+		${STAGING_HOST_DIR}/usr/bin/cpio -o -Hustar -P | gzip -n9 >$@
 
 ${FW_DIR}/${ROOTFSUSERTARBALL}: ${TARGET_DIR}
 	cd ${TARGET_DIR}; find . | grep -v ./boot/ | sed -n '/^\.\//s///p' | \
 		sed "s#\(.*\)#:0:0::::::\1#" | sort | \
-		${BIN_DIR}/cpio -o -Hustar -P | gzip -n9 >$@
+		${STAGING_HOST_DIR}/usr/bin/cpio -o -Hustar -P | gzip -n9 >$@
 
 ${FW_DIR}/${INITRAMFS}_list: ${TARGET_DIR}
-	bash ${LINUX_DIR}/scripts/gen_initramfs_list.sh -u squash -g squash \
+	$(BASH) ${LINUX_DIR}/scripts/gen_initramfs_list.sh -u squash -g squash \
 		${TARGET_DIR}/ >$@
 	( \
 		echo "nod /dev/console 0644 0 0 c 5 1"; \
@@ -162,12 +162,12 @@ ${FW_DIR}/${INITRAMFS}: ${FW_DIR}/${INITRAMFS}_list
 		${ADK_COMPRESSION_TOOL} -c >$@
 
 ${BUILD_DIR}/root.squashfs: ${TARGET_DIR}
-	${STAGING_HOST_DIR}/bin/mksquashfs ${TARGET_DIR} \
+	${STAGING_HOST_DIR}/usr/bin/mksquashfs ${TARGET_DIR} \
 		${BUILD_DIR}/root.squashfs -comp xz \
 		-nopad -noappend -root-owned $(MAKE_TRACE)
 
 ${FW_DIR}/${ROOTFSJFFS2}: ${TARGET_DIR}
-	${STAGING_HOST_DIR}/bin/mkfs.jffs2 $(ADK_JFFS2_OPTS) -q -r ${TARGET_DIR} \
+	${STAGING_HOST_DIR}/usr/bin/mkfs.jffs2 $(ADK_JFFS2_OPTS) -q -r ${TARGET_DIR} \
 		--pad=$(ADK_TARGET_MTD_SIZE) -o ${FW_DIR}/${ROOTFSJFFS2} $(MAKE_TRACE)
 
 createinitramfs: ${FW_DIR}/${INITRAMFS}_list
@@ -242,7 +242,7 @@ ${FW_DIR}/${ROOTFSISO}: ${TARGET_DIR} kernel-package
 		${TARGET_DIR}/boot/syslinux
 	echo 'DEFAULT /boot/kernel root=/dev/sr0 init=/init' > \
 		${TARGET_DIR}/boot/syslinux/isolinux.cfg
-	${BIN_DIR}/mkisofs -R -uid 0 -gid 0 -o $@ \
+	${STAGING_HOST_DIR}/usr/bin/mkisofs -R -uid 0 -gid 0 -o $@ \
 		-b boot/syslinux/isolinux.bin \
 		-c boot/syslinux/boot.cat -no-emul-boot \
 		-boot-load-size 4 -boot-info-table ${TARGET_DIR}

+ 1 - 1
mk/kernel-vars.mk

@@ -25,4 +25,4 @@ ADK_KCPPFLAGS+=		-DBCM47XX_OVERRIDE_FLASHSIZE=0x800000 \
 endif
 
 KERNEL_MAKE_ENV+=	KCPPFLAGS='${ADK_KCPPFLAGS}' \
-			PATH="${BIN_DIR}:$$PATH"
+			PATH="${STAGING_HOST_DIR}/usr/bin:$$PATH"

+ 1 - 1
mk/kernel-ver.mk

@@ -2,7 +2,7 @@ ifeq ($(ADK_KERNEL_VERSION_TOOLCHAIN),y)
 KERNEL_VERSION:=	3.12.13
 KERNEL_MOD_VERSION:=	$(KERNEL_VERSION)
 KERNEL_RELEASE:=	1
-KERNEL_MD5SUM:=		c5b0775d187bc79992bae17ae781de1e
+KERNEL_MD5SUM:=		345f5883cfb906dac4aef87e303d3a2d
 endif
 ifeq ($(ADK_KERNEL_VERSION_3_13_5),y)
 KERNEL_VERSION:=	3.13.5

+ 1 - 1
mk/package.mk

@@ -249,7 +249,7 @@ endif
 	    find usr ! -type d 2>/dev/null | \
 	    grep -E -v -e '^usr/lib/pkgconfig' -e '^usr/share' -e '^usr/doc' -e '^usr/src' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' -e '^usr/bin/[a-z0-9-]+-config' | \
 	    tee '$${STAGING_PKG_DIR}/$(1)' | \
-	    $(BIN_DIR)/cpio -padlmu '$${STAGING_DIR}'
+	    $(STAGING_HOST_DIR)/usr/bin/cpio -padlmu '$${STAGING_DIR}'
 	@cd '$${STAGING_DIR}'; grep 'usr/lib/.*\.la$$$$' \
 	    '$${STAGING_PKG_DIR}/$(1)' | while read fn; do \
 		chmod u+w $$$$fn; \

+ 3 - 3
mk/pkg-bottom.mk

@@ -171,11 +171,11 @@ ifneq (,$(filter dev,${PKG_OPTS}))
 	@mkdir -p  $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/include
 	@test -d ${WRKINST}/usr/include && cd ${WRKINST}/usr/include; \
 	    find . -name \*.h | \
- 	    $(BIN_DIR)/cpio -padlmu $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/include
+ 	    $(STAGING_HOST_DIR)/usr/bin/cpio -padlmu $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/include
 	@mkdir -p  $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/lib/pkgconfig
 	@test -d ${WRKINST}/usr/lib/pkgconfig && cd ${WRKINST}/usr/lib/pkgconfig; \
 	    find . -name \*.pc | \
- 	    $(BIN_DIR)/cpio -padlmu $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/lib/pkgconfig
+ 	    $(STAGING_HOST_DIR)/usr/bin/cpio -padlmu $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/lib/pkgconfig
 	@for a in ${WRKINST}/usr/bin/*-config*; do \
 		[[ -e $$a ]] || continue; \
 		mkdir -p $(WRKDIR)/fake-${CPU_ARCH}/pkg-$(PKG_LIBNAME)-dev/usr/bin; \
@@ -191,7 +191,7 @@ endif
 	    find usr ! -type d 2>/dev/null | \
 	    grep -E -v -e '^usr/lib/pkgconfig' -e '^usr/share' -e '^usr/src' -e '^usr/doc' -e '^usr/local' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' -e '^usr/bin/[a-z0-9-]+-config*' -e '^/usr/lib/libpthread_nonshared.a' | \
 	    tee '${STAGING_PKG_DIR}/${PKG_NAME}' | \
-	    $(BIN_DIR)/cpio -padlmu '${STAGING_DIR}'
+	    $(STAGING_HOST_DIR)/usr/bin/cpio -padlmu '${STAGING_DIR}'
 	@cd '${STAGING_DIR}'; grep 'usr/lib/.*\.la$$' \
 	    '${STAGING_PKG_DIR}/${PKG_NAME}' | while read fn; do \
 		chmod u+w $$fn; \

+ 22 - 23
mk/vars.mk

@@ -16,34 +16,38 @@ BUILD_DIR:=		${BASE_DIR}/build_${ADK_TARGET_SYSTEM}_${CPU_ARCH}_${ADK_TARGET_LIB
 BUILD_DIR_PFX:=		$(BASE_DIR)/build_*
 STAGING_PKG_DIR:=	${BASE_DIR}/pkg_${ADK_TARGET_SYSTEM}_${CPU_ARCH}_${ADK_TARGET_LIBC}
 STAGING_PKG_DIR_PFX:=	${BASE_DIR}/pkg_*
-STAGING_HOST_DIR:=	${BASE_DIR}/host_${CPU_ARCH}_${ADK_TARGET_SUFFIX}_${ADK_TARGET_LIBC}
+STAGING_HOST_DIR:=	${BASE_DIR}/host_${GNU_HOST_NAME}
 STAGING_HOST_DIR_PFX:=	${BASE_DIR}/host_*
 # use headers and foo-config from system
 ifeq ($(ADK_NATIVE),y)
 STAGING_TARGET_DIR:=
 SCRIPT_TARGET_DIR:=	/usr/bin
 else
-STAGING_TARGET_DIR:=	${BASE_DIR}/target_${CPU_ARCH}_${ADK_TARGET_SUFFIX}_${ADK_TARGET_LIBC}
+ifeq ($(ADK_TARGET_ABI),)
+STAGING_TARGET_DIR:=	${BASE_DIR}/target_${CPU_ARCH}_${ADK_TARGET_LIBC}
+STAGING_DIR:=		${BASE_DIR}/target_${CPU_ARCH}_${ADK_TARGET_LIBC}
+STAGING_HOST2TARGET:=	../target_${CPU_ARCH}_${ADK_TARGET_LIBC}
+TOOLCHAIN_BUILD_DIR=	$(BASE_DIR)/toolchain_build_${CPU_ARCH}_${ADK_TARGET_LIBC}
+else
+STAGING_TARGET_DIR:=	${BASE_DIR}/target_${CPU_ARCH}_${ADK_TARGET_LIBC}_${ADK_TARGET_ABI}
+STAGING_DIR:=		${BASE_DIR}/target_${CPU_ARCH}_${ADK_TARGET_LIBC}_${ADK_TARGET_ABI}
+STAGING_HOST2TARGET:=	../target_${CPU_ARCH}_${ADK_TARGET_LIBC}_${ADK_TARGET_ABI}
+TOOLCHAIN_BUILD_DIR=	$(BASE_DIR)/toolchain_build_${CPU_ARCH}_${ADK_TARGET_LIBC}_${ADK_TARGET_ABI}
+endif
 SCRIPT_TARGET_DIR:=	${STAGING_TARGET_DIR}/scripts
 endif
-STAGING_DIR:=		${BASE_DIR}/target_${CPU_ARCH}_${ADK_TARGET_SUFFIX}_${ADK_TARGET_LIBC}
 STAGING_TARGET_DIR_PFX:=${BASE_DIR}/target_*
-# relation from STAGING_HOST_DIR to STAGING_TARGET_DIR (for gcc to find
-# its sysroot while staying relocatable)
-STAGING_HOST2TARGET:=	../target_${CPU_ARCH}_${ADK_TARGET_SUFFIX}_${ADK_TARGET_LIBC}
-TOOLCHAIN_BUILD_DIR=	$(BASE_DIR)/toolchain_build_${CPU_ARCH}_${ADK_TARGET_SUFFIX}_${ADK_TARGET_LIBC}
 TOOLCHAIN_BUILD_DIR_PFX=$(BASE_DIR)/toolchain_build_*
 TOOLS_BUILD_DIR=	$(BASE_DIR)/tools_build
-BIN_DIR:=		$(BASE_DIR)/bin
 SCRIPT_DIR:=		$(BASE_DIR)/scripts
 FW_DIR:=		$(BASE_DIR)/firmware/${ADK_TARGET_SYSTEM}_${CPU_ARCH}_${ADK_TARGET_LIBC}
 FW_DIR_PFX:=		$(BASE_DIR)/firmware
 PACKAGE_DIR:=		$(FW_DIR)/packages
 TARGET_DIR:=		$(BASE_DIR)/root_${ADK_TARGET_SYSTEM}_${CPU_ARCH}_${ADK_TARGET_LIBC}
 TARGET_DIR_PFX:=	$(BASE_DIR)/root_*
-TARGET_PATH=		${SCRIPT_DIR}:${BIN_DIR}:${STAGING_TARGET_DIR}/scripts:${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH}
-HOST_PATH=		${SCRIPT_DIR}:${BIN_DIR}:${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH}
-AUTOTOOL_PATH=		${BIN_DIR}:${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_TARGET_DIR}/scripts:${_PATH}
+TARGET_PATH=		${SCRIPT_DIR}:${STAGING_TARGET_DIR}/scripts:${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH}
+HOST_PATH=		${SCRIPT_DIR}:${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH}
+AUTOTOOL_PATH=		${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_TARGET_DIR}/scripts:${_PATH}
 REAL_GNU_TARGET_NAME=	$(CPU_ARCH)-$(ADK_VENDOR)-linux-$(ADK_TARGET_SUFFIX)
 GNU_TARGET_NAME=	$(CPU_ARCH)-$(ADK_VENDOR)-linux
 
@@ -82,13 +86,8 @@ endif
 endif
 
 TARGET_CPPFLAGS:=	
-ifeq ($(ADK_LINUX_MICROBLAZE),y)
-TARGET_CFLAGS:=		$(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident $(ADK_TARGET_ABI_CFLAGS)
-TARGET_CFLAGS_LIBC:=	$(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident $(TARGET_OPTIMIZATION)
-else
 TARGET_CFLAGS:=		$(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts $(ADK_TARGET_ABI_CFLAGS) $(MODE_FLAGS)
 TARGET_CFLAGS_LIBC:=	$(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts $(TARGET_OPTIMIZATION) $(MODE_FLAGS)
-endif
 TARGET_CXXFLAGS:=	$(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident $(MODE_FLAGS)
 TARGET_LDFLAGS:=	-L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
 			-Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
@@ -185,7 +184,7 @@ PKG_INSTALL:=		IPKG_TMP=$(BUILD_DIR)/tmp \
 			IPKG_INSTROOT=$(TARGET_DIR) \
 			IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
 			IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
-			BIN_DIR=$(BIN_DIR) \
+			BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
 			${BASH} ${SCRIPT_DIR}/ipkg \
 			-force-defaults -force-depends install
 PKG_STATE_DIR:=		$(TARGET_DIR)/usr/lib/ipkg
@@ -208,21 +207,21 @@ EXTRACT_CMD=		mkdir -p ${WRKDIR}; \
 			cd ${WRKDIR} && \
 			for file in ${FULLDISTFILES}; do case $$file in \
 			*.cpio) \
-				cat $$file | $(BIN_DIR)/cpio -i -d ;; \
+				cat $$file | $(STAGING_HOST_DIR)/usr/bin/cpio -i -d ;; \
 			*.tar) \
 				tar -xf $$file ;; \
 			*.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \
-				gzip -dc $$file | $(BIN_DIR)/cpio -i -d ;; \
+				gzip -dc $$file | $(STAGING_HOST_DIR)/usr/bin/cpio -i -d ;; \
 			*.tar.xz | *.txz) \
-				xz -dc $$file | tar -xf - ;; \
+				$(STAGING_HOST_DIR)/usr/bin/xz -dc $$file | tar -xf - ;; \
 			*.tar.Z | *.tar.gz | *.taz | *.tgz) \
 				gzip -dc $$file | tar -xf - ;; \
 			*.cpio.bz2 | *.cbz) \
-				bzip2 -dc $$file | $(BIN_DIR)/cpio -i -d ;; \
+				$(STAGING_HOST_DIR)/usr/bin/bzip2 -dc $$file | $(STAGING_HOST_DIR)/usr/bin/cpio -i -d ;; \
 			*.tar.bz2 | *.tbz | *.tbz2) \
-				bzip2 -dc $$file | tar -xf - ;; \
+				$(STAGING_HOST_DIR)/usr/bin/bzip2 -dc $$file | tar -xf - ;; \
 			*.zip) \
-				cat $$file | $(BIN_DIR)/cpio -ivd -H zip ;; \
+				cat $$file | $(STAGING_HOST_DIR)/usr/bin/cpio -ivd -H zip ;; \
 			*.arm) \
 				cp $$file ${WRKDIR} ;; \
 			*) \

+ 1 - 1
package/base-files/Makefile

@@ -85,7 +85,7 @@ endif
 	    echo "::1		localhost" >> $(IDIR_BASE_FILES)/etc/hosts
 	    echo "127.0.1.1	$(ADK_RUNTIME_HOSTNAME)" >> $(IDIR_BASE_FILES)/etc/hosts
 	test -z $(ADK_RUNTIME_PASSWORD) || \
-	    $(SED) 's,\*NP\*,'"$$(${TOPDIR}/bin/mkcrypt \
+	    $(SED) 's,\*NP\*,'"$$($(STAGING_HOST_DIR)/usr/bin/mkcrypt \
 	    ${ADK_RUNTIME_PASSWORD}),g" $(IDIR_BASE_FILES)/etc/shadow
 	git log -1|head -1|sed -e 's#commit ##' \
 		> $(IDIR_BASE_FILES)/etc/adkversion

+ 7 - 4
package/gcc/Makefile

@@ -23,16 +23,16 @@ $(eval $(call PKG_template,GXX,g++,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},
 
 TARGET_CPPFLAGS:=	''
 TARGET_CFLAGS:=		''
-TARGET_CXXFLAGS:=	$(filter-out -fstack-protector,$(TARGET_CXXFLAGS))
+TARGET_CXXFLAGS:=	''
 
 ifeq ($(ADK_TARGET_SYSTEM_LEMOTE_YEELONG),y)
-CONFIGURE_ARGS+=       --with-abi=$(ADK_TARGET_ABI)
+CONFIGURE_ARGS+=       --with-abi=$(ADK_TARGET_MIPS_ABI)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_MIPS64),y)
-CONFIGURE_ARGS+=       --with-abi=$(ADK_TARGET_ABI)
+CONFIGURE_ARGS+=       --with-abi=$(ADK_TARGET_MIPS_ABI)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_MIPS64EL),y)
-CONFIGURE_ARGS+=       --with-abi=$(ADK_TARGET_ABI)
+CONFIGURE_ARGS+=       --with-abi=$(ADK_TARGET_MIPS_ABI)
 endif
 
 ifeq ($(ADK_TOOLCHAIN_GCC_SJLJ),y)
@@ -57,6 +57,7 @@ endif
 CONFIGURE_ENV+=		have_sys_sdt_h=no
 CONFIGURE_ARGS+=	--host=$(REAL_GNU_TARGET_NAME) \
 			--target=$(REAL_GNU_TARGET_NAME) \
+			--build=$(GNU_HOST_NAME) \
 			--disable-__cxa_atexit \
 			--without-headers \
 			--libexecdir=/usr/lib \
@@ -66,6 +67,8 @@ CONFIGURE_ARGS+=	--host=$(REAL_GNU_TARGET_NAME) \
 			--disable-libgomp \
 			--disable-multilib \
 			--disable-libstdcxx-pch \
+			--disable-libsanitizer \
+			--disable-libitm \
 			--enable-cxx-flags="${TARGET_LDFLAGS}"
 
 # disable honour cflags stuff

+ 698 - 0
package/gcc/patches/4.8.2/musl-cross.patch

@@ -0,0 +1,698 @@
+# HG changeset patch
+# Parent df1a439b9058b07024ca556225d55535f5feb5dd
+Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
+
+diff -r df1a439b9058 libstdc++-v3/configure.host
+--- a/libstdc++-v3/configure.host	Tue Dec 31 14:52:24 2013 -0500
++++ b/libstdc++-v3/configure.host	Tue Dec 31 14:54:49 2013 -0500
+@@ -264,6 +264,13 @@
+     os_include_dir="os/bsd/freebsd"
+     ;;
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++    # check for musl by target
++    case "${host_os}" in
++      *-musl*)
++        os_include_dir="os/generic"
++        ;;
++      *)
++
+     if [ "$uclibc" = "yes" ]; then
+       os_include_dir="os/uclibc"
+     elif [ "$bionic" = "yes" ]; then
+@@ -272,6 +279,9 @@
+       os_include_dir="os/gnu-linux"
+     fi
+     ;;
++
++    esac
++    ;;
+   hpux*)
+     os_include_dir="os/hpux"
+     ;;
+# HG changeset patch
+# Parent e5b4564f249f8634194bdabef4b3057d0e54ee97
+Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
+
+diff -r e5b4564f249f gcc/config.gcc
+--- a/gcc/config.gcc	Tue Dec 31 14:54:49 2013 -0500
++++ b/gcc/config.gcc	Tue Dec 31 14:54:52 2013 -0500
+@@ -550,7 +550,7 @@
+ esac
+ 
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+ 
+ # Common parts for widely ported systems.
+ case ${target} in
+@@ -653,6 +653,9 @@
+     *-*-*uclibc*)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+       ;;
++    *-*-*musl*)
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++      ;;
+     *)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+       ;;
+diff -r e5b4564f249f gcc/config/linux.h
+--- a/gcc/config/linux.h	Tue Dec 31 14:54:49 2013 -0500
++++ b/gcc/config/linux.h	Tue Dec 31 14:54:52 2013 -0500
+@@ -32,10 +32,12 @@
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ 
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()			\
+@@ -53,18 +55,21 @@
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+ 
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)	\
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)	\
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+ 
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -84,21 +89,21 @@
+ 
+ #define GNU_USER_DYNAMIC_LINKER						\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,	\
+-			 BIONIC_DYNAMIC_LINKER)
++			 BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+-			 BIONIC_DYNAMIC_LINKER32)
++			 BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+-			 BIONIC_DYNAMIC_LINKER64)
++			 BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32					\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+-			 BIONIC_DYNAMIC_LINKERX32)
++			 BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+ 
+ /* Determine whether the entire c99 runtime
+    is present in the runtime library.  */
+ #undef TARGET_C99_FUNCTIONS
+-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
++#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
+ 
+ /* Whether we have sincos that follows the GNU extension.  */
+ #undef TARGET_HAS_SINCOS
+@@ -107,3 +112,74 @@
+ /* Whether we have Bionic libc runtime */
+ #undef TARGET_HAS_BIONIC
+ #define TARGET_HAS_BIONIC (OPTION_BIONIC)
++
++/* musl avoids problematic includes by rearranging the include directories.
++ * Unfortunately, this is mostly duplicated from cppdefault.c */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP			\
++    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,		\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },		\
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,		\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },		\
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,	\
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL			\
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },		\
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX			\
++    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS			\
++    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL			\
++    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE			\
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },	\
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS				\
++  {							\
++    INCLUDE_DEFAULTS_MUSL_GPP				\
++    INCLUDE_DEFAULTS_MUSL_PREFIX			\
++    INCLUDE_DEFAULTS_MUSL_CROSS				\
++    INCLUDE_DEFAULTS_MUSL_TOOL				\
++    INCLUDE_DEFAULTS_MUSL_NATIVE			\
++    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },		\
++    { 0, 0, 0, 0, 0, 0 }				\
++  }
++#endif
+diff -r e5b4564f249f gcc/config/linux.opt
+--- a/gcc/config/linux.opt	Tue Dec 31 14:54:49 2013 -0500
++++ b/gcc/config/linux.opt	Tue Dec 31 14:54:52 2013 -0500
+@@ -30,3 +30,7 @@
+ muclibc
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Use musl C library
+diff -r e5b4564f249f gcc/ginclude/stddef.h
+--- a/gcc/ginclude/stddef.h	Tue Dec 31 14:54:49 2013 -0500
++++ b/gcc/ginclude/stddef.h	Tue Dec 31 14:54:52 2013 -0500
+@@ -181,6 +181,7 @@
+ #ifndef _GCC_SIZE_T
+ #ifndef _SIZET_
+ #ifndef __size_t
++#ifndef __DEFINED_size_t /* musl */
+ #define __size_t__	/* BeOS */
+ #define __SIZE_T__	/* Cray Unicos/Mk */
+ #define _SIZE_T
+@@ -197,6 +198,7 @@
+ #define ___int_size_t_h
+ #define _GCC_SIZE_T
+ #define _SIZET_
++#define __DEFINED_size_t /* musl */
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+   || defined(__FreeBSD_kernel__)
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
+@@ -214,6 +216,7 @@
+ typedef long ssize_t;
+ #endif /* __BEOS__ */
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
++#endif /* __DEFINED_size_t */
+ #endif /* __size_t */
+ #endif /* _SIZET_ */
+ #endif /* _GCC_SIZE_T */
+# HG changeset patch
+# Parent e08e44e39f5edde422f444487422046147d5821e
+A fix for libgomp to correctly request a POSIX version for time support.
+
+diff -r e08e44e39f5e libgomp/config/posix/time.c
+--- a/libgomp/config/posix/time.c	Tue Dec 31 14:54:52 2013 -0500
++++ b/libgomp/config/posix/time.c	Tue Dec 31 14:54:55 2013 -0500
+@@ -28,6 +28,8 @@
+    The following implementation uses the most simple POSIX routines.
+    If present, POSIX 4 clocks should be used instead.  */
+ 
++#define _POSIX_C_SOURCE 199309L /* for clocks */
++
+ #include "libgomp.h"
+ #include <unistd.h>
+ #if TIME_WITH_SYS_TIME
+diff -r 809c85574bfe libgcc/unwind-dw2-fde-dip.c
+--- a/libgcc/unwind-dw2-fde-dip.c	Tue Dec 31 14:54:55 2013 -0500
++++ b/libgcc/unwind-dw2-fde-dip.c	Tue Dec 31 14:54:58 2013 -0500
+@@ -46,33 +46,13 @@
+ #include "unwind-compat.h"
+ #include "gthr.h"
+ 
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+-	|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+ # define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(__BIONIC__)
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+-# define ElfW __ElfN
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(__OpenBSD__)
+-# define ElfW(type) Elf_##type
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(TARGET_DL_ITERATE_PHDR) \
+-    && defined(__sun__) && defined(__svr4__)
+-# define USE_PT_GNU_EH_FRAME
++# ifdef __OpenBSD__
++#  define ElfW(type) Elf_##typ
++# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
++#  define ElfW __ElfN
++# endif
+ #endif
+ 
+ #if defined(USE_PT_GNU_EH_FRAME)
+diff -r 03604918697c gcc/configure
+--- a/gcc/configure	Tue Dec 31 14:54:58 2013 -0500
++++ b/gcc/configure	Tue Dec 31 14:55:01 2013 -0500
+@@ -26739,6 +26739,9 @@
+ else
+   gcc_cv_libc_provides_ssp=no
+     case "$target" in
++       *-*-musl*)
++         # All versions of musl provide stack protector
++	 gcc_cv_libc_provides_ssp=yes;;
+        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+       # glibc 2.4 and later provides __stack_chk_fail and
+       # either __stack_chk_guard, or TLS access to stack guard canary.
+@@ -26772,6 +26775,7 @@
+ 	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+ 	 # simply assert that glibc does provide this, which is true for all
+ 	 # realistically usable GNU/Hurd configurations.
++	 # All supported versions of musl provide it as well
+ 	 gcc_cv_libc_provides_ssp=yes;;
+        *-*-darwin* | *-*-freebsd*)
+ 	 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
+@@ -26854,6 +26858,9 @@
+       gcc_cv_target_dl_iterate_phdr=no
+     fi
+     ;;
++  *-linux-musl*)
++    gcc_cv_target_dl_iterate_phdr=yes
++    ;;
+ esac
+ 
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+diff -r 03604918697c gcc/configure.ac
+--- a/gcc/configure.ac	Tue Dec 31 14:54:58 2013 -0500
++++ b/gcc/configure.ac	Tue Dec 31 14:55:01 2013 -0500
+@@ -4722,6 +4722,9 @@
+       gcc_cv_libc_provides_ssp,
+       [gcc_cv_libc_provides_ssp=no
+     case "$target" in
++       *-*-musl*)
++         # All versions of musl provide stack protector
++	 gcc_cv_libc_provides_ssp=yes;;
+        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+       [# glibc 2.4 and later provides __stack_chk_fail and
+       # either __stack_chk_guard, or TLS access to stack guard canary.
+@@ -4755,6 +4758,7 @@
+ 	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+ 	 # simply assert that glibc does provide this, which is true for all
+ 	 # realistically usable GNU/Hurd configurations.
++	 # All supported versions of musl provide it as well
+ 	 gcc_cv_libc_provides_ssp=yes;;
+        *-*-darwin* | *-*-freebsd*)
+ 	 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
+@@ -4820,6 +4824,9 @@
+       gcc_cv_target_dl_iterate_phdr=no
+     fi
+     ;;
++  *-linux-musl*)
++    gcc_cv_target_dl_iterate_phdr=yes
++    ;;
+ esac
+ GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+# HG changeset patch
+# Parent 600a8a422ccaf5627ad1f5a138e7398df2b9e9d8
+Get rid of ever-broken fixincludes on musl.
+
+diff -r 600a8a422cca fixincludes/mkfixinc.sh
+--- a/fixincludes/mkfixinc.sh	Tue Dec 31 14:55:01 2013 -0500
++++ b/fixincludes/mkfixinc.sh	Tue Dec 31 14:55:04 2013 -0500
+@@ -19,7 +19,8 @@
+     powerpc-*-eabi*    | \
+     powerpc-*-rtems*   | \
+     powerpcle-*-eabisim* | \
+-    powerpcle-*-eabi* )
++    powerpcle-*-eabi* | \
++    *-musl* )
+ 	#  IF there is no include fixing,
+ 	#  THEN create a no-op fixer and exit
+ 	(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
+# HG changeset patch
+# Parent 4696c3bf3d913eca88e9385ea9717541dfe1e033
+Support for i386-linux-musl and x86_64-linux-musl.
+
+diff -r 4696c3bf3d91 gcc/config/i386/linux.h
+--- a/gcc/config/i386/linux.h	Tue Dec 31 14:55:04 2013 -0500
++++ b/gcc/config/i386/linux.h	Tue Dec 31 14:55:08 2013 -0500
+@@ -21,3 +21,4 @@
+ 
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+diff -r 4696c3bf3d91 gcc/config/i386/linux64.h
+--- a/gcc/config/i386/linux64.h	Tue Dec 31 14:55:04 2013 -0500
++++ b/gcc/config/i386/linux64.h	Tue Dec 31 14:55:08 2013 -0500
+@@ -30,3 +30,7 @@
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
+diff -r 4696c3bf3d91 libitm/config/linux/x86/tls.h
+--- a/libitm/config/linux/x86/tls.h	Tue Dec 31 14:55:04 2013 -0500
++++ b/libitm/config/linux/x86/tls.h	Tue Dec 31 14:55:08 2013 -0500
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+    GLIBC has reserved words 10 through 13 for TM.  */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+ 
+ #include "config/generic/tls.h"
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+ 
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@
+ 
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+ 
+ #endif // LIBITM_X86_TLS_H
+# HG changeset patch
+# Parent 6738fd6f6fcc2a72f2ba527bda3325642af26885
+Support for arm-linux-musl.
+
+diff -r 6738fd6f6fcc gcc/config/arm/linux-eabi.h
+--- a/gcc/config/arm/linux-eabi.h	Tue Dec 31 14:55:08 2013 -0500
++++ b/gcc/config/arm/linux-eabi.h	Tue Dec 31 14:55:11 2013 -0500
+@@ -77,6 +77,23 @@
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+ 
++/* For ARM musl currently supports four dynamic linkers:
++   - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
++   - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
++   - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
++   - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
++   musl does not support the legacy OABI mode.
++   All the dynamic linkers live in /lib.
++   We default to soft-float, EL. */
++#undef  MUSL_DYNAMIC_LINKER
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
++#endif
++#define MUSL_DYNAMIC_LINKER \
++  "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+diff -r 6738fd6f6fcc libitm/config/arm/hwcap.cc
+--- a/libitm/config/arm/hwcap.cc	Tue Dec 31 14:55:08 2013 -0500
++++ b/libitm/config/arm/hwcap.cc	Tue Dec 31 14:55:11 2013 -0500
+@@ -40,7 +40,11 @@
+ 
+ #ifdef __linux__
+ #include <unistd.h>
++#ifdef __GLIBC__
+ #include <sys/fcntl.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <elf.h>
+ 
+ static void __attribute__((constructor))
+# HG changeset patch
+# Parent 7d7383f638705a01fdc18e0e7e0c9cdb6387fc5d
+Support for mips-linux-musl.
+
+diff -r 7d7383f63870 gcc/config/mips/linux.h
+--- a/gcc/config/mips/linux.h	Tue Dec 31 14:55:11 2013 -0500
++++ b/gcc/config/mips/linux.h	Tue Dec 31 14:55:14 2013 -0500
+@@ -18,3 +18,10 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++
++#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
++#endif
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
+# HG changeset patch
+# Parent 89df6d7e91c686da676ce27ef9b9d10522810c26
+Support for powerpc-linux-musl.
+
+diff -r 89df6d7e91c6 gcc/config.gcc
+--- a/gcc/config.gcc	Tue Dec 31 14:55:14 2013 -0500
++++ b/gcc/config.gcc	Tue Dec 31 14:55:17 2013 -0500
+@@ -2117,6 +2117,10 @@
+ 	    powerpc*-*-linux*paired*)
+ 		tm_file="${tm_file} rs6000/750cl.h" ;;
+ 	esac
++        case ${target} in
++            *-linux*-musl*)
++                enable_secureplt=yes ;;
++        esac
+ 	if test x${enable_secureplt} = xyes; then
+ 		tm_file="rs6000/secureplt.h ${tm_file}"
+ 	fi
+diff -r 89df6d7e91c6 gcc/config/rs6000/linux64.h
+--- a/gcc/config/rs6000/linux64.h	Tue Dec 31 14:55:14 2013 -0500
++++ b/gcc/config/rs6000/linux64.h	Tue Dec 31 14:55:17 2013 -0500
+@@ -354,17 +354,21 @@
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ 
+ #undef  DEFAULT_ASM_ENDIAN
+ #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+diff -r 89df6d7e91c6 gcc/config/rs6000/secureplt.h
+--- a/gcc/config/rs6000/secureplt.h	Tue Dec 31 14:55:14 2013 -0500
++++ b/gcc/config/rs6000/secureplt.h	Tue Dec 31 14:55:17 2013 -0500
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+diff -r 89df6d7e91c6 gcc/config/rs6000/sysv4.h
+--- a/gcc/config/rs6000/sysv4.h	Tue Dec 31 14:55:14 2013 -0500
++++ b/gcc/config/rs6000/sysv4.h	Tue Dec 31 14:55:17 2013 -0500
+@@ -550,6 +550,9 @@
+ #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
+ 
+ /* Pass -G xxx to the compiler and set correct endian mode.  */
+ #define	CC1_SPEC "%{G*} %(cc1_cpu)" \
+@@ -600,7 +603,8 @@
+ 
+ /* Override the default target of the linker.  */
+ #define	LINK_TARGET_SPEC \
+-  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
++  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
++  "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
+ 
+ /* Any specific OS flags.  */
+ #define LINK_OS_SPEC "\
+@@ -778,15 +782,18 @@
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ 
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+@@ -912,6 +919,7 @@
+   { "cc1_endian_little",	CC1_ENDIAN_LITTLE_SPEC },		\
+   { "cc1_endian_default",	CC1_ENDIAN_DEFAULT_SPEC },		\
+   { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },		\
++  { "link_secure_plt_default",	LINK_SECURE_PLT_DEFAULT_SPEC },		\
+   { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
+   { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
+   { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\
+diff -r d7ce17b2f2d6 gcc/config/aarch64/aarch64-linux.h
+--- a/gcc/config/aarch64/aarch64-linux.h	Tue Dec 31 14:55:17 2013 -0500
++++ b/gcc/config/aarch64/aarch64-linux.h	Tue Dec 31 14:55:20 2013 -0500
+@@ -21,7 +21,11 @@
+ #ifndef GCC_AARCH64_LINUX_H
+ #define GCC_AARCH64_LINUX_H
+ 
++/* The AArch64 port currently supports two dynamic linkers:
++   - ld-linux-aarch64.so.1 - GLIBC dynamic linker
++   - ld-musl-aarch64.so.1 - musl libc dynamic linker  */
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
+ 
+ #define CPP_SPEC "%{pthread:-D_REENTRANT}"
+ 
+# HG changeset patch
+# Parent f2601e4063d0d58d8ab04185e8baefd560d09496
+Microblaze support (again).
+
+
+diff -r f2601e4063d0 -r 0736dfe1aa0d gcc/config/microblaze/linux.h
+--- a/gcc/config/microblaze/linux.h	Tue Dec 31 14:55:20 2013 -0500
++++ b/gcc/config/microblaze/linux.h	Tue Dec 31 15:09:52 2013 -0500
+@@ -25,7 +25,22 @@
+ #undef TLS_NEEDS_GOT
+ #define TLS_NEEDS_GOT 1
+ 
+-#define DYNAMIC_LINKER "/lib/ld.so.1"
++#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
++#endif
++
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
++#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++
++#if DEFAULT_LIBC == LIBC_MUSL
++#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
++#else
++#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
++#endif
++
++
+ #undef  SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS \
+   { "dynamic_linker", DYNAMIC_LINKER }
+From 478ee0c03a08e2ef9371fd88d516738936943e78 Mon Sep 17 00:00:00 2001
+From: David Holsgrove <david.holsgrove@xilinx.com>
+Date: Fri, 28 Sep 2012 16:32:03 +1000
+Subject: [PATCH 06/11] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to
+ microblaze.h
+
+Fixes warnings like;
+
+warning: format '%zX' expects argument of type 'size_t',
+but argument 3 has type 'unsigned int' [-Wformat]
+
+Changelog
+
+2013-03-18  David Holsgrove <david.holsgrove@xilinx.com>
+
+ * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
+   and PTRDIFF_TYPE.
+
+Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
+---
+ gcc/config/microblaze/microblaze.h |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index 19cdfed..e772a3f 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -213,6 +213,12 @@ extern enum pipeline_type microblaze_pipe;
+ #define STRICT_ALIGNMENT        1
+ #define PCC_BITFIELD_TYPE_MATTERS 1
+ 
++#undef SIZE_TYPE
++#define SIZE_TYPE "unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "int"
++
+ #define CONSTANT_ALIGNMENT(EXP, ALIGN)					\
+   ((TREE_CODE (EXP) == STRING_CST  || TREE_CODE (EXP) == CONSTRUCTOR)	\
+    && (ALIGN) < BITS_PER_WORD						\
+-- 
+1.7.9.5
+

+ 5 - 3
package/gcj/Makefile

@@ -4,12 +4,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=		gcj
-PKG_VERSION:=		4.7.3
+PKG_VERSION:=		4.8.2
 PKG_RELEASE:=		1
-PKG_MD5SUM:=		86f428a30379bdee0224e353ee2f999e
+PKG_MD5SUM:=		a3d7d63b9cb6b6ea049469a0c4a43c9d
 PKG_DESCR:=		GNU java compiler
 PKG_SECTION:=		lang
 PKG_SITES:=		${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/}
+
 DISTFILES:=		gcc-$(PKG_VERSION).tar.bz2
 
 PKG_ARCH_DEPENDS:=	native
@@ -22,7 +23,8 @@ $(eval $(call HOST_template,GCJ,gcj,$(PKG_VERSION)-${PKG_RELEASE}))
 
 HOST_STYLE:=		auto
 HOST_MAKE_ENV+=		"JAR=no LDFLAGS=-liconv"
-HOST_CONFIGURE_ARGS:=	\
+# http://gcc.gnu.org/bugzilla/attachment.cgi?id=30880&action=diff
+HOST_CONFIGURE_ARGS:=	--enable-dependency-tracking \
 			--enable-java-home \
 			--enable-languages=java \
 			--enable-shared \

+ 1 - 1
package/openjdk7/Makefile

@@ -26,7 +26,7 @@ PKG_SITES:=		http://icedtea.classpath.org/download/source/
 DISTFILES:=		icedtea-$(PKG_VERSION).tar.gz
 WRKDIST=		${WRKDIR}/icedtea-${PKG_VERSION}
 
-GCJ_VER:=		4.7.3
+GCJ_VER:=		4.8.2
 
 PKG_HOST_DEPENDS:=	linux
 PKG_ARCH_DEPENDS:=	arm mips ppc x86 x86_64

Файловите разлики са ограничени, защото са твърде много
+ 92 - 0
package/perl/files/config.sh.mips64.eglibc


Файловите разлики са ограничени, защото са твърде много
+ 92 - 0
package/perl/files/config.sh.mips64.uclibc


Файловите разлики са ограничени, защото са твърде много
+ 92 - 0
package/perl/files/config.sh.mipsel.musl


+ 1 - 1
package/xbmc/Makefile

@@ -33,7 +33,7 @@ PKG_DEPENDS_RASPBERRY_PI:=	bcm2835-vc omxplayer
 PKG_BUILDDEP_RASPBERRY_PI:=	bcm2835-vc omxplayer
 PKG_BUILDDEP_IBM_X40:=	nasm-host
 PKG_SYSTEM_DEPENDS:=	raspberry-pi ibm-x40
-PKG_LIBC_DEPENDS:=	eglibc glibc musl
+PKG_LIBC_DEPENDS:=	eglibc glibc
 
 WRKDIST=		$(WRKDIR)/$(PKG_NAME)-$(PKG_VERSION)-Frodo
 

+ 1 - 0
rules.mk

@@ -39,6 +39,7 @@ ADK_TARGET_ABI_CFLAGS:=	$(strip $(subst ",, $(ADK_TARGET_ABI_CFLAGS)))
 ADK_TARGET_ABI_LDFLAGS:=	$(strip $(subst ",, $(ADK_TARGET_ABI_LDFLAGS)))
 ADK_TARGET_KERNEL_LDFLAGS:=	$(strip $(subst ",, $(ADK_TARGET_KERNEL_LDFLAGS)))
 ADK_TARGET_ABI:=	$(strip $(subst ",, $(ADK_TARGET_ABI)))
+ADK_TARGET_MIPS_ABI:=	$(strip $(subst ",, $(ADK_TARGET_MIPS_ABI)))
 ADK_TARGET_IP:=		$(strip $(subst ",, $(ADK_TARGET_IP)))
 ADK_TARGET_SUFFIX:=	$(strip $(subst ",, $(ADK_TARGET_SUFFIX)))
 ADK_TARGET_CMDLINE:=	$(strip $(subst ",, $(ADK_TARGET_CMDLINE)))

+ 3 - 2
scripts/create.sh

@@ -28,11 +28,12 @@
 # root partition and an OpenADK cfgfs partition.
 
 TOPDIR=$(pwd)
+HOST=$(gcc -dumpmachine)
 me=$0
 
 case :$PATH: in
-(*:$TOPDIR/bin:*) ;;
-(*) export PATH=$PATH:$TOPDIR/bin ;;
+(*:$TOPDIR/host_$HOST/usr/bin:*) ;;
+(*) export PATH=$PATH:$TOPDIR/host_$HOST/usr/bin ;;
 esac
 
 test -n "$KSH_VERSION" || if ! which mksh >/dev/null 2>&1; then

+ 0 - 36
scripts/scan-tools.sh

@@ -112,30 +112,6 @@ if ! which gzip >/dev/null 2>&1; then
 	out=1
 fi
 
-if ! which bzip2 >/dev/null 2>&1; then
-	echo You must install bzip2 to continue.
-	echo
-	out=1
-fi
-
-if ! which lzop >/dev/null 2>&1; then
-	echo You must install lzop to continue.
-	echo
-	out=1
-fi
-
-if ! which lzma >/dev/null 2>&1; then
-	echo You must install lzma to continue.
-	echo
-	out=1
-fi
-
-if ! which xz >/dev/null 2>&1; then
-	echo You must install xz-utils to continue.
-	echo
-	out=1
-fi
-
 if ! which patch >/dev/null 2>&1; then
 	echo You must install patch to continue.
 	echo
@@ -219,18 +195,6 @@ if ! which perl >/dev/null 2>&1; then
 	out=1
 fi
 
-if ! which m4 >/dev/null 2>&1; then
-       echo "You must install m4 (macro processor) to continue."
-       echo
-       out=1
-fi
-
-if ! which bc >/dev/null 2>&1; then
-	echo  "You need bc to continue."
-	echo
-	out=1
-fi
-
 if ! which xargs >/dev/null 2>&1; then
 	echo  "You need xargs to continue."
 	echo

+ 2 - 2
target/arm/sys-available/toolchain-arm

@@ -3,9 +3,9 @@ config ADK_TARGET_SYSTEM_TOOLCHAIN_ARM
 	select ADK_arm
 	select ADK_toolchain_arm
 	select ADK_little
+	select ADK_soft_float
 	select ADK_TOOLCHAIN
 	select ADK_EABI
 	select ADK_TARGET_PACKAGE_TGZ
 	help
-	  ARM toolchain (little endian).
-
+	  ARM toolchain (soft float).

+ 0 - 11
target/arm/sys-available/toolchain-armeb

@@ -1,11 +0,0 @@
-config ADK_TARGET_SYSTEM_TOOLCHAIN_ARMEB
-	bool "Toolchain only (big endian)"
-	select ADK_arm
-	select ADK_toolchain_armeb
-	select ADK_big
-	select ADK_TOOLCHAIN
-	select ADK_EABI
-	select ADK_TARGET_PACKAGE_TGZ
-	help
-	  ARM toolchain (big endian).
-

+ 23 - 0
target/config/Config.in

@@ -118,6 +118,17 @@ config ADK_n64
 	boolean
 
 config ADK_TARGET_ABI
+	string
+	default "o32" if ADK_o32
+	default "n32" if ADK_n32
+	default "n64" if ADK_n64
+	default "32" if ADK_32
+	default "x32" if ADK_x32
+	default "64" if ADK_64
+	default "eabi" if ADK_EABI
+	default "eabihf" if ADK_EABIHF
+
+config ADK_TARGET_MIPS_ABI
 	string
 	default "32" if ADK_o32
 	default "n32" if ADK_n32
@@ -653,6 +664,7 @@ config ADK_TARGET_LIB_EGLIBC
 	prompt "Embedded GNU C library"
 	boolean
 	select ADK_eglibc
+	select ADK_HOST_NEED_GPERF
 	depends on \
 		ADK_LINUX_ARM || \
 		ADK_LINUX_ARMEB || \
@@ -723,6 +735,11 @@ config ADK_TARGET_SUFFIX
 	default "muslgnueabihf" if ADK_TARGET_LIB_MUSL && ADK_EABIHF
 	default "muslgnueabi" if ADK_TARGET_LIB_MUSL && ADK_EABI
 	default "musl" if ADK_TARGET_LIB_MUSL && !ADK_EABI
+	default "n64" if ADK_n64
+	default "n32" if ADK_n32
+	default "o32" if ADK_o32
+	default "32" if ADK_32
+	default "x32" if ADK_x32
 	default "gnu"
 
 choice
@@ -771,6 +788,7 @@ config ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK
 config ADK_TARGET_ROOTFS_SQUASHFS
 	bool "Compressed read-only root filesystem (squashfs)"
 	select ADK_KERNEL_SQUASHFS
+	select ADK_HOST_NEED_SQUASHFS
 	depends on ADK_TARGET_WITH_MTD
 	help
 	  highly compressed read-only filesystem for MTD flash systems.
@@ -779,6 +797,7 @@ config ADK_TARGET_ROOTFS_JFFS2
 	bool "Compressed read-write root filesystem (jffs2)"
 	select ADK_KERNEL_MISC_FILESYSTEMS
 	select ADK_KERNEL_JFFS2
+	select ADK_HOST_NEED_JFFS2
 	depends on ADK_TARGET_WITH_MTD
 	help
 	  compressed read-write filesystem for MTD flash systems.
@@ -837,6 +856,7 @@ config ADK_TARGET_ROOTFS_GENEXT2FS
 	depends on ADK_TARGET_WITH_CF
 	select ADK_KERNEL_EXT2_FS
 	select ADK_KERNEL_SCSI
+	select ADK_HOST_NEED_GENEXT2FS
 	help
 	  Use this option if you have a compact flash based system.
 	  (ext2 filesystem is used.)
@@ -857,6 +877,8 @@ config ADK_TARGET_ROOTFS_ISO
 	select ADK_KERNEL_JOLIET
 	select ADK_KERNEL_SCSI
 	select ADK_KERNEL_BLK_DEV_SR
+	select ADK_HOST_NEED_MKISOFS
+	select ADK_HOST_NEED_SYSLINUX
 	depends on ADK_HOST_LINUX
 	depends on ADK_LINUX_X86
 	help
@@ -864,6 +886,7 @@ config ADK_TARGET_ROOTFS_ISO
 
 config ADK_TARGET_ROOTFS_ARCHIVE
 	bool "Archive usable for different filesystems"
+	select ADK_HOST_NEED_GENEXT2FS if ADK_HARDWARE_QEMU
 	select ADK_KERNEL_EXT2_FS if ADK_HARDWARE_QEMU
 	depends on !ADK_LINUX_MICROBLAZE
 	help

+ 40 - 0
target/config/Config.in.tools

@@ -1,3 +1,43 @@
+config ADK_HOST_NEED_MKISOFS
+	boolean
+	default n
+
+config ADK_HOST_NEED_SYSLINUX
+	boolean
+	default n
+
+config ADK_HOST_NEED_GPERF
+	boolean
+	default n
+
+config ADK_HOST_NEED_SQUASHFS
+	boolean
+	default n
+
+config ADK_HOST_NEED_JFFS2
+	boolean
+	default n
+
+config ADK_HOST_NEED_GENEXT2FS
+	boolean
+	default n
+
+config ADK_HOST_NEED_LZOP
+	boolean
+	default n
+
+config ADK_HOST_NEED_LZMA
+	boolean
+	default n
+
+config ADK_HOST_NEED_BZIP2
+	boolean
+	default n
+
+config ADK_HOST_NEED_XZ
+	boolean
+	default n
+
 config ADK_TOOLS_ADDPATTERN_ARGS
 	string
 	default "-p W54G -v v4.20.6" if ADK_TARGET_BROADCOM_MODEL_LINKSYS_WRT54G

+ 6 - 2
target/linux/config/Config.in.kernel

@@ -11,18 +11,22 @@ config ADK_KERNEL_INITRAMFS_COMPRESSION_NONE
 	boolean
 
 config ADK_KERNEL_INITRAMFS_COMPRESSION_XZ
+	select ADK_HOST_NEED_XZ
 	boolean
 
 config ADK_KERNEL_INITRAMFS_COMPRESSION_LZMA
+	select ADK_HOST_NEED_LZMA
 	boolean
 
 config ADK_KERNEL_INITRAMFS_COMPRESSION_LZO
+	select ADK_HOST_NEED_LZOP
 	boolean
 
-config ADK_KERNEL_INITRAMFS_COMPRESSION_GZIP
+config ADK_KERNEL_INITRAMFS_COMPRESSION_BZIP2
+	select ADK_HOST_NEED_BZIP2
 	boolean
 
-config ADK_KERNEL_INITRAMFS_COMPRESSION_BZIP2
+config ADK_KERNEL_INITRAMFS_COMPRESSION_GZIP
 	boolean
 
 config ADK_KERNEL_RD_GZIP

+ 6 - 11
target/microblaze/Makefile

@@ -9,11 +9,6 @@ include $(TOPDIR)/mk/image.mk
 
 KERNEL:=$(LINUX_DIR)/arch/microblaze/boot/$(ADK_TARGET_KERNEL)
 
-tools-compile:
-	$(MAKE) -C ../tools/mtd-utils all
-	$(MAKE) -C ../tools/xz all
-	$(MAKE) -C ../tools/squashfs all
-
 ifeq ($(ADK_TARGET_QEMU_MICROBLAZE_MODEL_ML605),y)
 MODEL:=petalogix-ml605
 DTB:=-dtb target/microblaze/ml605.dtb
@@ -24,21 +19,21 @@ DTB:=
 endif
 
 ifeq ($(ADK_TARGET_FS),squashfs)
-imageinstall: tools-compile $(BUILD_DIR)/root.squashfs
+imageinstall: $(BUILD_DIR)/root.squashfs
 	qemu-img create -f raw $(FW_DIR)/$(ROOTFSSQUASHFS) $(ADK_TARGET_MTD_SIZE)
 	dd conv=notrunc if=$(BUILD_DIR)/root.squashfs of=$(FW_DIR)/$(ROOTFSSQUASHFS)
 	@cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
 ifneq ($(ADK_HARDWARE_QEMU),)
 	@echo "Start qemu with following options:"
-	@echo 'qemu-system-${CPU_ARCH} $(DTB) -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -pflash $(FW_DIR)/$(ROOTFSSQUASHFS)'
+	@echo 'qemu-system-${CPU_ARCH} -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -pflash $(FW_DIR)/$(ROOTFSSQUASHFS) $(DTB)'
 endif
 endif
 ifeq ($(ADK_TARGET_FS),jffs2)
-imageinstall: tools-compile $(FW_DIR)/$(ROOTFSJFFS2)
+imageinstall: $(FW_DIR)/$(ROOTFSJFFS2)
 	@cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
 ifneq ($(ADK_HARDWARE_QEMU),)
 	@echo "Start qemu with following options:"
-	@echo 'qemu-system-${CPU_ARCH} $(DTB) -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -pflash $(FW_DIR)/$(ROOTFSJFFS2)'
+	@echo 'qemu-system-${CPU_ARCH} -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -pflash $(FW_DIR)/$(ROOTFSJFFS2) $(DTB)'
 endif
 endif
 ifeq ($(ADK_TARGET_FS),initramfs)
@@ -48,7 +43,7 @@ imageinstall: $(FW_DIR)/$(INITRAMFS)
 	@echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
 ifneq ($(ADK_HARDWARE_QEMU),)
 	@echo "Start qemu with following command line:"
-	@echo 'qemu-system-${CPU_ARCH} $(DTB) -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
+	@echo 'qemu-system-${CPU_ARCH} -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS} $(DTB)'
 endif
 endif
 ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
@@ -57,6 +52,6 @@ imageinstall: createinitramfs
 	@echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
 ifneq ($(ADK_HARDWARE_QEMU),)
 	@echo "Start qemu with following command line:"
-	@echo 'qemu-system-${CPU_ARCH} $(DTB) -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL)'
+	@echo 'qemu-system-${CPU_ARCH} -M $(MODEL) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(DTB)'
 endif
 endif

+ 3 - 11
target/mips/Makefile

@@ -11,16 +11,8 @@ KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
 
 OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
 
-tools-compile:
-	$(MAKE) -C ../tools/trx all
-	$(MAKE) -C ../tools/addpattern all
-	$(MAKE) -C ../tools/srec2bin all
-	$(MAKE) -C ../tools/squashfs all
-	$(MAKE) -C ../tools/lzma all
-	$(MAKE) -C ../tools/lzma-loader all
-
 ifeq ($(ADK_TARGET_SYSTEM_BROADCOM_BCM47XX),y)
-kernel-install: tools-compile
+kernel-install:
 	${TARGET_CROSS}objcopy ${OSTRIP} -S ${LINUX_DIR}/vmlinuz.elf \
 	    ${BUILD_DIR}/${TARGET_KERNEL}
 
@@ -39,7 +31,7 @@ endif
 endif
 
 ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_AG241),y)
-kernel-install: tools-compile
+kernel-install:
 	${TARGET_CROSS}objcopy -S -O srec $(KERNEL) $(LINUX_DIR)/vmlinux.srec
 	PATH='${TARGET_PATH}' srec2bin $(LINUX_DIR)/vmlinux.srec $(LINUX_DIR)/vmlinux.bin
 	(dd if=/dev/zero bs=16 count=1; cat $(LINUX_DIR)/vmlinux.bin) > $(LINUX_DIR)/vmlinux.tmp
@@ -56,7 +48,7 @@ kernel-install:
 	$(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_FON_FON2100),y)
-kernel-install: tools-compile
+kernel-install:
 	$(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
 
 ${BUILD_DIR}/${ROOTFSSQUASHFS}: ${BUILD_DIR}/root.squashfs

+ 1 - 0
target/ppc/sys-available/toolchain-ppc

@@ -2,6 +2,7 @@ config ADK_TARGET_SYSTEM_TOOLCHAIN_PPC
 	bool "Toolchain only"
 	select ADK_ppc
 	select ADK_toolchain_ppc
+	select ADK_CPU_PPC
 	select ADK_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TGZ
 	help

+ 1 - 0
target/ppc64/sys-available/toolchain-ppc64

@@ -2,6 +2,7 @@ config ADK_TARGET_SYSTEM_TOOLCHAIN_PPC64
 	bool "Toolchain only"
 	select ADK_ppc64
 	select ADK_toolchain_ppc64
+	select ADK_CPU_PPC64
 	select ADK_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TGZ
 	help

+ 0 - 1
target/tarch.lst

@@ -1,5 +1,4 @@
 arm
-armeb
 m68k
 microblaze
 microblazeel

+ 0 - 4
target/tools/addpattern/Makefile

@@ -1,4 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-all: addpattern.c
-	$(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -o ${STAGING_HOST_DIR}/bin/addpattern addpattern.c

+ 0 - 300
target/tools/lzma-loader/.svn/entries

@@ -1,300 +0,0 @@
-10
-
-dir
-29646
-svn://svn.openwrt.org/openwrt/trunk/target/linux/brcm47xx/image/lzma-loader/src
-svn://svn.openwrt.org/openwrt
-
-
-
-2010-12-02T21:27:54.805904Z
-24217
-hauke
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3c298f89-4303-0410-b956-a3cf2f4a3e73
-
-head.S
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-566bfb5f462e85d45d1d0c4faca0dadd
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3585
-
-decompress.c
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-b9ae9d76bf7f1f35ce46b5e496a02aa1
-2010-12-02T21:27:54.805904Z
-24217
-hauke
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-5426
-
-LzmaDecode.c
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-14403972ddbcfadbe017a6aeb3e8fae1
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-17104
-
-decompress.lds.in
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-c80cc6ad34b26e0af3c1d764218a3a61
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-186
-
-loader.lds.in
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-f06b23d31242fb56a60b864b741c1266
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-151
-
-LzmaDecode.h
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-12fcb710de789e54587079c021ae5e33
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2465
-
-Makefile
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-61400e27cb7c0099046d83e2146e0053
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2325
-
-README
-file
-
-
-
-
-2011-11-10T10:12:04.000000Z
-b29e81088cc18e92dede243f094c4134
-2010-06-26T20:41:49.877730Z
-21945
-nbd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2464
-

+ 0 - 663
target/tools/lzma-loader/.svn/text-base/LzmaDecode.c.svn-base

@@ -1,663 +0,0 @@
-/*
-  LzmaDecode.c
-  LZMA Decoder
-  
-  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "LzmaDecode.h"
-
-#ifndef Byte
-#define Byte unsigned char
-#endif
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-typedef struct _CRangeDecoder
-{
-  Byte *Buffer;
-  Byte *BufferLim;
-  UInt32 Range;
-  UInt32 Code;
-  #ifdef _LZMA_IN_CB
-  ILzmaInCallback *InCallback;
-  int Result;
-  #endif
-  int ExtraBytes;
-} CRangeDecoder;
-
-Byte RangeDecoderReadByte(CRangeDecoder *rd)
-{
-  if (rd->Buffer == rd->BufferLim)
-  {
-    #ifdef _LZMA_IN_CB
-    UInt32 size;
-    rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
-    rd->BufferLim = rd->Buffer + size;
-    if (size == 0)
-    #endif
-    {
-      rd->ExtraBytes = 1;
-      return 0xFF;
-    }
-  }
-  return (*rd->Buffer++);
-}
-
-/* #define ReadByte (*rd->Buffer++) */
-#define ReadByte (RangeDecoderReadByte(rd))
-
-void RangeDecoderInit(CRangeDecoder *rd,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-  #else
-    Byte *stream, UInt32 bufferSize
-  #endif
-    )
-{
-  int i;
-  #ifdef _LZMA_IN_CB
-  rd->InCallback = inCallback;
-  rd->Buffer = rd->BufferLim = 0;
-  #else
-  rd->Buffer = stream;
-  rd->BufferLim = stream + bufferSize;
-  #endif
-  rd->ExtraBytes = 0;
-  rd->Code = 0;
-  rd->Range = (0xFFFFFFFF);
-  for(i = 0; i < 5; i++)
-    rd->Code = (rd->Code << 8) | ReadByte;
-}
-
-#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;        
-#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
-#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
-
-UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
-{
-  RC_INIT_VAR
-  UInt32 result = 0;
-  int i;
-  for (i = numTotalBits; i > 0; i--)
-  {
-    /* UInt32 t; */
-    range >>= 1;
-
-    result <<= 1;
-    if (code >= range)
-    {
-      code -= range;
-      result |= 1;
-    }
-    /*
-    t = (code - range) >> 31;
-    t &= 1;
-    code -= range & (t - 1);
-    result = (result + result) | (1 - t);
-    */
-    RC_NORMALIZE
-  }
-  RC_FLUSH_VAR
-  return result;
-}
-
-int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
-{
-  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
-  if (rd->Code < bound)
-  {
-    rd->Range = bound;
-    *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
-    if (rd->Range < kTopValue)
-    {
-      rd->Code = (rd->Code << 8) | ReadByte;
-      rd->Range <<= 8;
-    }
-    return 0;
-  }
-  else
-  {
-    rd->Range -= bound;
-    rd->Code -= bound;
-    *prob -= (*prob) >> kNumMoveBits;
-    if (rd->Range < kTopValue)
-    {
-      rd->Code = (rd->Code << 8) | ReadByte;
-      rd->Range <<= 8;
-    }
-    return 1;
-  }
-}
-
-#define RC_GET_BIT2(prob, mi, A0, A1) \
-  UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
-  if (code < bound) \
-    { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
-  else \
-    { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
-  RC_NORMALIZE
-
-#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)               
-
-int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-{
-  int mi = 1;
-  int i;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  for(i = numLevels; i > 0; i--)
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + mi;
-    RC_GET_BIT(prob, mi)
-    #else
-    mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
-    #endif
-  }
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return mi - (1 << numLevels);
-}
-
-int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-{
-  int mi = 1;
-  int i;
-  int symbol = 0;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  for(i = 0; i < numLevels; i++)
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + mi;
-    RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
-    #else
-    int bit = RangeDecoderBitDecode(probs + mi, rd);
-    mi = mi + mi + bit;
-    symbol |= (bit << i);
-    #endif
-  }
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
-{ 
-  int symbol = 1;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  do
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + symbol;
-    RC_GET_BIT(prob, symbol)
-    #else
-    symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-    #endif
-  }
-  while (symbol < 0x100);
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
-{ 
-  int symbol = 1;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  do
-  {
-    int bit;
-    int matchBit = (matchByte >> 7) & 1;
-    matchByte <<= 1;
-    #ifdef _LZMA_LOC_OPT
-    {
-      CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
-      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
-    }
-    #else
-    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
-    symbol = (symbol << 1) | bit;
-    #endif
-    if (matchBit != bit)
-    {
-      while (symbol < 0x100)
-      {
-        #ifdef _LZMA_LOC_OPT
-        CProb *prob = probs + symbol;
-        RC_GET_BIT(prob, symbol)
-        #else
-        symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-        #endif
-      }
-      break;
-    }
-  }
-  while (symbol < 0x100);
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
-
-int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
-{
-  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
-    return RangeDecoderBitTreeDecode(p + LenLow +
-        (posState << kLenNumLowBits), kLenNumLowBits, rd);
-  if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
-    return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
-        (posState << kLenNumMidBits), kLenNumMidBits, rd);
-  return kLenNumLowSymbols + kLenNumMidSymbols + 
-      RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
-}
-
-#define kNumStates 12
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-#ifdef _LZMA_OUT_READ
-
-typedef struct _LzmaVarState
-{
-  CRangeDecoder RangeDecoder;
-  Byte *Dictionary;
-  UInt32 DictionarySize;
-  UInt32 DictionaryPos;
-  UInt32 GlobalPos;
-  UInt32 Reps[4];
-  int lc;
-  int lp;
-  int pb;
-  int State;
-  int PreviousIsMatch;
-  int RemainLen;
-} LzmaVarState;
-
-int LzmaDecoderInit(
-    unsigned char *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    unsigned char *dictionary, UInt32 dictionarySize,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-    #else
-    unsigned char *inStream, UInt32 inSize
-    #endif
-    )
-{
-  LzmaVarState *vs = (LzmaVarState *)buffer;
-  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-  UInt32 i;
-  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
-    return LZMA_RESULT_NOT_ENOUGH_MEM;
-  vs->Dictionary = dictionary;
-  vs->DictionarySize = dictionarySize;
-  vs->DictionaryPos = 0;
-  vs->GlobalPos = 0;
-  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
-  vs->lc = lc;
-  vs->lp = lp;
-  vs->pb = pb;
-  vs->State = 0;
-  vs->PreviousIsMatch = 0;
-  vs->RemainLen = 0;
-  dictionary[dictionarySize - 1] = 0;
-  for (i = 0; i < numProbs; i++)
-    p[i] = kBitModelTotal >> 1; 
-  RangeDecoderInit(&vs->RangeDecoder, 
-      #ifdef _LZMA_IN_CB
-      inCallback
-      #else
-      inStream, inSize
-      #endif
-  );
-  return LZMA_RESULT_OK;
-}
-
-int LzmaDecode(unsigned char *buffer, 
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed)
-{
-  LzmaVarState *vs = (LzmaVarState *)buffer;
-  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-  CRangeDecoder rd = vs->RangeDecoder;
-  int state = vs->State;
-  int previousIsMatch = vs->PreviousIsMatch;
-  Byte previousByte;
-  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
-  UInt32 nowPos = 0;
-  UInt32 posStateMask = (1 << (vs->pb)) - 1;
-  UInt32 literalPosMask = (1 << (vs->lp)) - 1;
-  int lc = vs->lc;
-  int len = vs->RemainLen;
-  UInt32 globalPos = vs->GlobalPos;
-
-  Byte *dictionary = vs->Dictionary;
-  UInt32 dictionarySize = vs->DictionarySize;
-  UInt32 dictionaryPos = vs->DictionaryPos;
-
-  if (len == -1)
-  {
-    *outSizeProcessed = 0;
-    return LZMA_RESULT_OK;
-  }
-
-  while(len > 0 && nowPos < outSize)
-  {
-    UInt32 pos = dictionaryPos - rep0;
-    if (pos >= dictionarySize)
-      pos += dictionarySize;
-    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
-    if (++dictionaryPos == dictionarySize)
-      dictionaryPos = 0;
-    len--;
-  }
-  if (dictionaryPos == 0)
-    previousByte = dictionary[dictionarySize - 1];
-  else
-    previousByte = dictionary[dictionaryPos - 1];
-#else
-
-int LzmaDecode(
-    Byte *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-    #else
-    unsigned char *inStream, UInt32 inSize,
-    #endif
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed)
-{
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-  CProb *p = (CProb *)buffer;
-  CRangeDecoder rd;
-  UInt32 i;
-  int state = 0;
-  int previousIsMatch = 0;
-  Byte previousByte = 0;
-  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
-  UInt32 nowPos = 0;
-  UInt32 posStateMask = (1 << pb) - 1;
-  UInt32 literalPosMask = (1 << lp) - 1;
-  int len = 0;
-  if (bufferSize < numProbs * sizeof(CProb))
-    return LZMA_RESULT_NOT_ENOUGH_MEM;
-  for (i = 0; i < numProbs; i++)
-    p[i] = kBitModelTotal >> 1; 
-  RangeDecoderInit(&rd, 
-      #ifdef _LZMA_IN_CB
-      inCallback
-      #else
-      inStream, inSize
-      #endif
-      );
-#endif
-
-  *outSizeProcessed = 0;
-  while(nowPos < outSize)
-  {
-    int posState = (int)(
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & posStateMask);
-    #ifdef _LZMA_IN_CB
-    if (rd.Result != LZMA_RESULT_OK)
-      return rd.Result;
-    #endif
-    if (rd.ExtraBytes != 0)
-      return LZMA_RESULT_DATA_ERROR;
-    if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
-    {
-      CProb *probs = p + Literal + (LZMA_LIT_SIZE * 
-        (((
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
-      if (state < 4) state = 0;
-      else if (state < 10) state -= 3;
-      else state -= 6;
-      if (previousIsMatch)
-      {
-        Byte matchByte;
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        matchByte = dictionary[pos];
-        #else
-        matchByte = outStream[nowPos - rep0];
-        #endif
-        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
-        previousIsMatch = 0;
-      }
-      else
-        previousByte = LzmaLiteralDecode(probs, &rd);
-      outStream[nowPos++] = previousByte;
-      #ifdef _LZMA_OUT_READ
-      dictionary[dictionaryPos] = previousByte;
-      if (++dictionaryPos == dictionarySize)
-        dictionaryPos = 0;
-      #endif
-    }
-    else             
-    {
-      previousIsMatch = 1;
-      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
-      {
-        if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
-        {
-          if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
-          {
-            #ifdef _LZMA_OUT_READ
-            UInt32 pos;
-            #endif
-            if (
-               (nowPos 
-                #ifdef _LZMA_OUT_READ
-                + globalPos
-                #endif
-               )
-               == 0)
-              return LZMA_RESULT_DATA_ERROR;
-            state = state < 7 ? 9 : 11;
-            #ifdef _LZMA_OUT_READ
-            pos = dictionaryPos - rep0;
-            if (pos >= dictionarySize)
-              pos += dictionarySize;
-            previousByte = dictionary[pos];
-            dictionary[dictionaryPos] = previousByte;
-            if (++dictionaryPos == dictionarySize)
-              dictionaryPos = 0;
-            #else
-            previousByte = outStream[nowPos - rep0];
-            #endif
-            outStream[nowPos++] = previousByte;
-            continue;
-          }
-        }
-        else
-        {
-          UInt32 distance;
-          if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
-            distance = rep1;
-          else 
-          {
-            if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
-              distance = rep2;
-            else
-            {
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
-        state = state < 7 ? 8 : 11;
-      }
-      else
-      {
-        int posSlot;
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        state = state < 7 ? 7 : 10;
-        len = LzmaLenDecode(p + LenCoder, &rd, posState);
-        posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
-            kNumPosSlotBits), kNumPosSlotBits, &rd);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-          rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
-          if (posSlot < kEndPosModelIndex)
-          {
-            rep0 += RangeDecoderReverseBitTreeDecode(
-                p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
-          }
-          else
-          {
-            rep0 += RangeDecoderDecodeDirectBits(&rd, 
-                numDirectBits - kNumAlignBits) << kNumAlignBits;
-            rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
-          }
-        }
-        else
-          rep0 = posSlot;
-        rep0++;
-      }
-      if (rep0 == (UInt32)(0))
-      {
-        /* it's for stream version */
-        len = -1;
-        break;
-      }
-      if (rep0 > nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-      {
-        return LZMA_RESULT_DATA_ERROR;
-      }
-      len += kMatchMinLen;
-      do
-      {
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        previousByte = dictionary[pos];
-        dictionary[dictionaryPos] = previousByte;
-        if (++dictionaryPos == dictionarySize)
-          dictionaryPos = 0;
-        #else
-        previousByte = outStream[nowPos - rep0];
-        #endif
-        outStream[nowPos++] = previousByte;
-        len--;
-      }
-      while(len > 0 && nowPos < outSize);
-    }
-  }
-
-  #ifdef _LZMA_OUT_READ
-  vs->RangeDecoder = rd;
-  vs->DictionaryPos = dictionaryPos;
-  vs->GlobalPos = globalPos + nowPos;
-  vs->Reps[0] = rep0;
-  vs->Reps[1] = rep1;
-  vs->Reps[2] = rep2;
-  vs->Reps[3] = rep3;
-  vs->State = state;
-  vs->PreviousIsMatch = previousIsMatch;
-  vs->RemainLen = len;
-  #endif
-
-  *outSizeProcessed = nowPos;
-  return LZMA_RESULT_OK;
-}

+ 0 - 100
target/tools/lzma-loader/.svn/text-base/LzmaDecode.h.svn-base

@@ -1,100 +0,0 @@
-/* 
-  LzmaDecode.h
-  LZMA Decoder interface
-
-  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMADECODE_H
-#define __LZMADECODE_H
-
-/* #define _LZMA_IN_CB */
-/* Use callback for input data */
-
-/* #define _LZMA_OUT_READ */
-/* Use read function for output data */
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs, 
-   but memory usage will be doubled in that case */
-
-/* #define _LZMA_LOC_OPT */
-/* Enable local speed optimizations inside code */
-
-#ifndef UInt32
-#ifdef _LZMA_UINT32_IS_ULONG
-#define UInt32 unsigned long
-#else
-#define UInt32 unsigned int
-#endif
-#endif
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb unsigned short
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-#define LZMA_RESULT_NOT_ENOUGH_MEM 2
-
-#ifdef _LZMA_IN_CB
-typedef struct _ILzmaInCallback
-{
-  int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
-} ILzmaInCallback;
-#endif
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-/* 
-bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
-bufferSize += 100 in case of _LZMA_OUT_READ
-by default CProb is unsigned short, 
-but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
-*/
-
-#ifdef _LZMA_OUT_READ
-int LzmaDecoderInit(
-    unsigned char *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    unsigned char *dictionary, UInt32 dictionarySize,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-  #else
-    unsigned char *inStream, UInt32 inSize
-  #endif
-);
-#endif
-
-int LzmaDecode(
-    unsigned char *buffer, 
-  #ifndef _LZMA_OUT_READ
-    UInt32 bufferSize,
-    int lc, int lp, int pb,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-  #else
-    unsigned char *inStream, UInt32 inSize,
-  #endif
-  #endif
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed);
-
-#endif

+ 0 - 77
target/tools/lzma-loader/.svn/text-base/Makefile.svn-base

@@ -1,77 +0,0 @@
-#
-# Makefile for Broadcom BCM947XX boards
-#
-# Copyright 2001-2003, Broadcom Corporation
-# All Rights Reserved.
-# 
-# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
-# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
-# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
-# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
-#
-# Copyright 2004  Manuel Novoa III <mjn3@codepoet.org>
-#   Modified to support bzip'd kernels.
-#   Of course, it would be better to integrate bunzip capability into CFE.
-#
-# Copyright 2005  Oleg I. Vdovikin <oleg@cs.msu.su>
-#   Cleaned up, modified for lzma support, removed from kernel
-#
-
-TEXT_START	:= 0x80001000
-BZ_TEXT_START	:= 0x80400000
-
-OBJCOPY		:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
-
-CFLAGS		= -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-		  -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
-		  -ffunction-sections -pipe -mlong-calls -fno-common \
-		  -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
-CFLAGS		+= -DLOADADDR=$(TEXT_START) -D_LZMA_IN_CB
-
-ASFLAGS		= $(CFLAGS) -D__ASSEMBLY__ -DBZ_TEXT_START=$(BZ_TEXT_START)
-
-SEDFLAGS	:= s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
-
-OBJECTS		:= head.o data.o
-
-all: loader.gz loader.elf
-
-# Don't build dependencies, this may die if $(CC) isn't gcc
-dep:
-
-install:
-
-loader.gz: loader
-	gzip -nc9 $< > $@
-
-loader.elf: loader.o
-	cp $< $@
-
-loader: loader.o
-	$(OBJCOPY) $< $@
-
-loader.o: loader.lds $(OBJECTS)
-	$(LD) -static --gc-sections -no-warn-mismatch -T loader.lds -o $@ $(OBJECTS)
-
-loader.lds: loader.lds.in Makefile
-	@sed "$(SEDFLAGS)" < $< > $@
-
-data.o: data.lds decompress.image
-	$(LD) -no-warn-mismatch -T data.lds -r -o $@ -b binary decompress.image -b elf32-tradlittlemips
-
-data.lds:
-	@echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > $@
-
-decompress.image: decompress
-	$(OBJCOPY) $< $@
-
-decompress: decompress.lds decompress.o LzmaDecode.o
-	$(LD) -static --gc-sections -no-warn-mismatch -T decompress.lds -o $@ decompress.o LzmaDecode.o
-
-decompress.lds: decompress.lds.in Makefile
-	@sed "$(SEDFLAGS)" < $< > $@
-
-mrproper: clean
-
-clean:
-	rm -f loader.gz loader decompress *.lds *.o *.image

+ 0 - 55
target/tools/lzma-loader/.svn/text-base/README.svn-base

@@ -1,55 +0,0 @@
-/*
- * LZMA compressed kernel decompressor for bcm947xx boards
- *
- * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-The code is intended to decompress kernel, being compressed using lzma utility
-build using 7zip LZMA SDK. This utility is located in the LZMA_Alone directory
-
-decompressor code expects that your .trx file consist of three partitions: 
-
-1) decompressor itself (this is gziped code which pmon/cfe will extract and run
-on boot-up instead of real kernel)
-2) LZMA compressed kernel (both streamed and regular modes are supported now)
-3) Root filesystem
-
-Please be sure to apply the following patch for use this new trx layout (it will
-allow using both new and old trx files for root filesystem lookup code)
-
---- linuz/arch/mips/brcm-boards/bcm947xx/setup.c        2005-01-23 19:24:27.503322896 +0300
-+++ linux/arch/mips/brcm-boards/bcm947xx/setup.c        2005-01-23 19:29:05.237100944 +0300
-@@ -221,7 +221,9 @@
-                /* Try looking at TRX header for rootfs offset */
-                if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
-                        bcm947xx_parts[1].offset = off;
--                       if (le32_to_cpu(trx->offsets[1]) > off)
-+                       if (le32_to_cpu(trx->offsets[2]) > off)
-+                               off = le32_to_cpu(trx->offsets[2]);
-+                       else if (le32_to_cpu(trx->offsets[1]) > off)
-                                off = le32_to_cpu(trx->offsets[1]);
-                        continue;
-                }
-
-
-Revision history:
-	0.02	Initial release
-	0.03	Added Mineharu Takahara <mtakahar@yahoo.com> patch to pass actual
-		output size to decoder (stream mode compressed input is not 
-		a requirement anymore)
-	0.04	Reordered functions using lds script

+ 0 - 186
target/tools/lzma-loader/.svn/text-base/decompress.c.svn-base

@@ -1,186 +0,0 @@
-/*
- * LZMA compressed kernel decompressor for bcm947xx boards
- *
- * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * Please note, this was code based on the bunzip2 decompressor code
- * by Manuel Novoa III  (mjn3@codepoet.org), although the only thing left
- * is an idea and part of original vendor code
- *
- *
- * 12-Mar-2005  Mineharu Takahara <mtakahar@yahoo.com>
- *   pass actual output size to decoder (stream mode
- *   compressed input is not a requirement anymore)
- *
- * 24-Apr-2005 Oleg I. Vdovikin
- *   reordered functions using lds script, removed forward decl
- *
- */
-
-#include "LzmaDecode.h"
-
-#define BCM4710_FLASH		0x1fc00000	/* Flash */
-
-#define KSEG0			0x80000000
-#define KSEG1			0xa0000000
-
-#define KSEG1ADDR(a)		((((unsigned)(a)) & 0x1fffffffU) | KSEG1)
-
-#define Index_Invalidate_I	0x00
-#define Index_Writeback_Inv_D   0x01
-
-#define cache_unroll(base,op)	\
-	__asm__ __volatile__(		\
-		".set noreorder;\n"		\
-		".set mips3;\n"			\
-		"cache %1, (%0);\n"		\
-		".set mips0;\n"			\
-		".set reorder\n"		\
-		:						\
-		: "r" (base),			\
-		  "i" (op));
-
-static __inline__ void blast_icache(unsigned long size, unsigned long lsize)
-{
-	unsigned long start = KSEG0;
-	unsigned long end = (start + size);
-
-	while(start < end) {
-		cache_unroll(start,Index_Invalidate_I);
-		start += lsize;
-	}
-}
-
-static __inline__ void blast_dcache(unsigned long size, unsigned long lsize)
-{
-	unsigned long start = KSEG0;
-	unsigned long end = (start + size);
-
-	while(start < end) {
-		cache_unroll(start,Index_Writeback_Inv_D);
-		start += lsize;
-	}
-}
-
-#define TRX_MAGIC       0x30524448      /* "HDR0" */
-
-struct trx_header {
-	unsigned int magic;		/* "HDR0" */
-	unsigned int len;		/* Length of file including header */
-	unsigned int crc32;		/* 32-bit CRC from flag_version to end of file */
-	unsigned int flag_version;	/* 0:15 flags, 16:31 version */
-	unsigned int offsets[3];	/* Offsets of partitions from start of header */
-};
-
-#define EDIMAX_PS_HEADER_MAGIC	0x36315350 /*  "PS16"  */
-#define EDIMAX_PS_HEADER_LEN	0xc /* 12 bytes long for edimax header */
-
-/* beyound the image end, size not known in advance */
-extern unsigned char workspace[];
-
-unsigned int offset;
-unsigned char *data;
-
-/* flash access should be aligned, so wrapper is used */
-/* read byte from the flash, all accesses are 32-bit aligned */
-static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
-{
-	static unsigned int val;
-
-	if (((unsigned int)offset % 4) == 0) {
-		val = *(unsigned int *)data;
-		data += 4;
-	}
-	
-	*bufferSize = 1;
-	*buffer = ((unsigned char *)&val) + (offset++ & 3);
-	
-	return LZMA_RESULT_OK;
-}
-
-static __inline__ unsigned char get_byte(void)
-{
-	unsigned char *buffer;
-	UInt32 fake;
-	
-	return read_byte(0, &buffer, &fake), *buffer;
-}
-
-/* should be the first function */
-void entry(unsigned long icache_size, unsigned long icache_lsize, 
-	unsigned long dcache_size, unsigned long dcache_lsize,
-	unsigned long fw_arg0, unsigned long fw_arg1,
-	unsigned long fw_arg2, unsigned long fw_arg3)
-{
-	unsigned int i;  /* temp value */
-	unsigned int lc; /* literal context bits */
-	unsigned int lp; /* literal pos state bits */
-	unsigned int pb; /* pos state bits */
-	unsigned int osize; /* uncompressed size */
-
-	ILzmaInCallback callback;
-	callback.Read = read_byte;
-
-	/* look for trx header, 32-bit data access */
-	for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
-		((struct trx_header *)data)->magic != TRX_MAGIC &&
-		((struct trx_header *)data)->magic != EDIMAX_PS_HEADER_MAGIC;
-		 data += 65536);
-
-	if (((struct trx_header *)data)->magic == EDIMAX_PS_HEADER_MAGIC)
-		data += EDIMAX_PS_HEADER_LEN;
-	/* compressed kernel is in the partition 0 or 1 */
-	if (((struct trx_header *)data)->offsets[1] > 65536) 
-		data += ((struct trx_header *)data)->offsets[0];
-	else
-		data += ((struct trx_header *)data)->offsets[1];
-
-	offset = 0;
-
-	/* lzma args */
-	i = get_byte();
-	lc = i % 9, i = i / 9;
-	lp = i % 5, pb = i / 5;
-
-	/* skip rest of the LZMA coder property */
-	for (i = 0; i < 4; i++)
-		get_byte();
-
-	/* read the lower half of uncompressed size in the header */
-	osize = ((unsigned int)get_byte()) +
-		((unsigned int)get_byte() << 8) +
-		((unsigned int)get_byte() << 16) +
-		((unsigned int)get_byte() << 24);
-
-	/* skip rest of the header (upper half of uncompressed size) */
-	for (i = 0; i < 4; i++) 
-		get_byte();
-
-	/* decompress kernel */
-	if (LzmaDecode(workspace, ~0, lc, lp, pb, &callback,
-		(unsigned char*)LOADADDR, osize, &i) == LZMA_RESULT_OK)
-	{
-		blast_dcache(dcache_size, dcache_lsize);
-		blast_icache(icache_size, icache_lsize);
-
-		/* Jump to load address */
-		((void (*)(unsigned long, unsigned long, unsigned long,
-			unsigned long)) LOADADDR)(fw_arg0, fw_arg1, fw_arg2,
-				fw_arg3);
-	}
-}

+ 0 - 20
target/tools/lzma-loader/.svn/text-base/decompress.lds.in.svn-base

@@ -1,20 +0,0 @@
-OUTPUT_ARCH(mips)
-ENTRY(entry)
-SECTIONS {
-	. = BZ_TEXT_START;
-	.text : {
-		*(.text.entry)
-		*(.text)
-		*(.rodata)
-	}
-
-	.data : {
-		*(.data)
-	}
-
-	.bss : {
-		*(.bss)
-	}
-
-	workspace = .;
-}

+ 0 - 160
target/tools/lzma-loader/.svn/text-base/head.S.svn-base

@@ -1,160 +0,0 @@
-/* Copyright 2005 Oleg I. Vdovikin (oleg@cs.msu.su)	*/
-/* cache manipulation adapted from Broadcom code 	*/
-/* idea taken from original bunzip2 decompressor code	*/
-/* Copyright 2004 Manuel Novoa III (mjn3@codepoet.org)	*/
-/* Licensed under the linux kernel's version of the GPL.*/
-
-#include <asm/asm.h>
-#include <asm/regdef.h>
-
-#define KSEG0		0x80000000
-
-#define C0_CONFIG	$16
-#define C0_TAGLO	$28
-#define C0_TAGHI	$29
-
-#define	CONF1_DA_SHIFT	7			/* D$ associativity */
-#define CONF1_DA_MASK	0x00000380
-#define CONF1_DA_BASE	1
-#define CONF1_DL_SHIFT	10			/* D$ line size */
-#define CONF1_DL_MASK	0x00001c00
-#define CONF1_DL_BASE	2
-#define CONF1_DS_SHIFT	13			/* D$ sets/way */
-#define CONF1_DS_MASK	0x0000e000
-#define CONF1_DS_BASE	64
-#define CONF1_IA_SHIFT	16			/* I$ associativity */
-#define CONF1_IA_MASK	0x00070000
-#define CONF1_IA_BASE	1
-#define CONF1_IL_SHIFT	19			/* I$ line size */
-#define CONF1_IL_MASK	0x00380000
-#define CONF1_IL_BASE	2
-#define CONF1_IS_SHIFT	22			/* Instruction cache sets/way */
-#define CONF1_IS_MASK	0x01c00000
-#define CONF1_IS_BASE	64
-
-#define Index_Invalidate_I	0x00
-#define Index_Writeback_Inv_D   0x01
-
-	.text
-	LEAF(startup)
-	.set noreorder
-	addi    sp, -48 
-	sw      a0, 16(sp) 
-	sw      a1, 20(sp) 
-	sw      a2, 24(sp) 
-	sw      a3, 28(sp)
-	
-	/* Copy decompressor code to the right place */
-	li	t2, BZ_TEXT_START
-	add	a0, t2, 0
-	la      a1, code_start
-	la	a2, code_stop
-$L1:
-	lw	t0, 0(a1)
-	sw	t0, 0(a0)
-	add	a1, 4
-	add	a0, 4
-	blt	a1, a2, $L1
-	nop
-	
-	/* At this point we need to invalidate dcache and */
-	/* icache before jumping to new code */
-
-1:	/* Get cache sizes */
-	.set	mips32
-	mfc0	s0,C0_CONFIG,1
-	.set	mips0
-
-	li	s1,CONF1_DL_MASK
-	and	s1,s0
-	beq	s1,zero,nodc
-	nop
-
-	srl	s1,CONF1_DL_SHIFT
-	li	t0,CONF1_DL_BASE
-	sll	s1,t0,s1		/* s1 has D$ cache line size */
-
-	li	s2,CONF1_DA_MASK
-	and	s2,s0
-	srl	s2,CONF1_DA_SHIFT
-	addiu	s2,CONF1_DA_BASE	/* s2 now has D$ associativity */
-
-	li	t0,CONF1_DS_MASK
-	and	t0,s0
-	srl	t0,CONF1_DS_SHIFT
-	li	s3,CONF1_DS_BASE
-	sll	s3,s3,t0		/* s3 has D$ sets per way */
-
-	multu	s2,s3			/* sets/way * associativity */
-	mflo	t0			/* total cache lines */
-
-	multu	s1,t0			/* D$ linesize * lines */
-	mflo	s2			/* s2 is now D$ size in bytes */
-
-	/* Initilize the D$: */
-	mtc0	zero,C0_TAGLO
-	mtc0	zero,C0_TAGHI
-
-	li	t0,KSEG0		/* Just an address for the first $ line */
-	addu	t1,t0,s2		/*  + size of cache == end */
-
-	.set	mips3
-1:	cache	Index_Writeback_Inv_D,0(t0)
-	.set	mips0
-	bne	t0,t1,1b
-	addu	t0,s1
-	
-nodc:
-	/* Now we get to do it all again for the I$ */
-	
-	move	s3,zero			/* just in case there is no icache */
-	move	s4,zero
-
-	li	t0,CONF1_IL_MASK
-	and	t0,s0
-	beq	t0,zero,noic
-	nop
-
-	srl	t0,CONF1_IL_SHIFT
-	li	s3,CONF1_IL_BASE
-	sll	s3,t0			/* s3 has I$ cache line size */
-
-	li	t0,CONF1_IA_MASK
-	and	t0,s0
-	srl	t0,CONF1_IA_SHIFT
-	addiu	s4,t0,CONF1_IA_BASE	/* s4 now has I$ associativity */
-
-	li	t0,CONF1_IS_MASK
-	and	t0,s0
-	srl	t0,CONF1_IS_SHIFT
-	li	s5,CONF1_IS_BASE
-	sll	s5,t0			/* s5 has I$ sets per way */
-
-	multu	s4,s5			/* sets/way * associativity */
-	mflo	t0			/* s4 is now total cache lines */
-
-	multu	s3,t0			/* I$ linesize * lines */
-	mflo	s4			/* s4 is cache size in bytes */
-
-	/* Initilize the I$: */
-	mtc0	zero,C0_TAGLO
-	mtc0	zero,C0_TAGHI
-
-	li	t0,KSEG0		/* Just an address for the first $ line */
-	addu	t1,t0,s4		/*  + size of cache == end */
-
-	.set	mips3
-1:	cache	Index_Invalidate_I,0(t0)
-	.set	mips0
-	bne	t0,t1,1b
-	addu	t0,s3
-
-noic:
-	move	a0,s3			/* icache line size */
-	move	a1,s4			/* icache size */
-	move	a2,s1			/* dcache line size */
-	jal	t2
-	move	a3,s2			/* dcache size */
-	
-	.set reorder
-	END(startup)

+ 0 - 17
target/tools/lzma-loader/.svn/text-base/loader.lds.in.svn-base

@@ -1,17 +0,0 @@
-OUTPUT_ARCH(mips)
-ENTRY(startup)
-SECTIONS {
-	. = TEXT_START;
-	.text : {
-		*(.text)
-		*(.rodata)
-	}
-
-	.data : {
-		*(.data)
-	}
-
-	.bss : {
-		*(.bss)
-	}
-}

+ 0 - 4
target/tools/mkfimage/Makefile

@@ -1,4 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-all: mkfimage.c
-	$(CC_FOR_BUILD) ${FLAGS_FOR_BUILD} -o ${STAGING_HOST_DIR}/bin/mkfimage mkfimage.c $(MAKE_TRACE)

+ 0 - 7
target/tools/rules.mk

@@ -1,7 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-WRKDIR_BASE=    ${TOOLS_BUILD_DIR}
-WRKDIR=		${WRKDIR_BASE}
-
-include ${TOPDIR}/mk/buildhlp.mk

+ 0 - 4
target/tools/srec2bin/Makefile

@@ -1,4 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-all: srec2bin.c
-	$(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -o ${STAGING_HOST_DIR}/bin/srec2bin srec2bin.c

+ 0 - 4
target/tools/trx/Makefile

@@ -1,4 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-all: trx.c
-	$(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -o ${STAGING_HOST_DIR}/bin/trx trx.c

+ 3 - 0
target/x86/kernel/qemu-i686

@@ -10,6 +10,9 @@ CONFIG_SCSI=y
 CONFIG_SCSI_DMA=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_ATA=y
+CONFIG_SATA_PMP=y
+CONFIG_ATA_SFF=y
+CONFIG_ATA_BMDMA=y
 CONFIG_ATA_PIIX=y
 CONFIG_NETDEVICES=y
 CONFIG_NET_CORE=y

+ 6 - 1
toolchain/eglibc/Makefile

@@ -84,11 +84,16 @@ $(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so
 		$(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
 	${INSTALL_DIR} ${STAGING_TARGET_DIR}/etc
 	${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
-	${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
 	${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
 	touch $@
 
 $(WRKBUILD)/.fixup:
+	-find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
+	-find $(STAGING_TARGET_DIR) -type -f -name \*_pic\* -delete
+	rm -rf $(STAGING_TARGET_DIR)/usr/share/locale $(STAGING_TARGET_DIR)/usr/share/i18n
+	rm -rf $(STAGING_TARGET_DIR)/usr/lib/gconv
+	PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_TARGET_DIR)
+	prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_HOST_DIR)
 	touch $@
 
 include ${TOPDIR}/mk/toolchain.mk

+ 5 - 3
toolchain/gcc/Makefile

@@ -18,6 +18,8 @@ GCC_CONFOPTS=		--prefix=$(STAGING_HOST_DIR) \
 			--with-libelf=$(STAGING_HOST_DIR) \
 			--disable-__cxa_atexit \
 			--with-gnu-ld \
+			--disable-libsanitizer \
+			--disable-libitm \
 			--disable-libmudflap \
 			--disable-libgomp \
 			--disable-decimal-float \
@@ -71,7 +73,7 @@ else
 GCC_CONFOPTS+=		--enable-tls
 endif
 
-ifeq ($(ARCH),powerpc)
+ifeq ($(ADK_LINUX_PPC),y)
 ifeq ($(ADK_TARGET_LIBC),uclibc)
 GCC_CONFOPTS+=		--disable-target-optspace --with-long-double-128 --enable-secureplt
 else
@@ -98,8 +100,8 @@ ifeq ($(ADK_CPU_CORTEX_A9),y)
 GCC_CONFOPTS+=          --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=neon
 endif
 
-ifneq ($(ADK_TARGET_ABI),)
-GCC_CONFOPTS+=		--with-abi=${ADK_TARGET_ABI}
+ifneq ($(ADK_TARGET_MIPS_ABI),)
+GCC_CONFOPTS+=		--with-abi=${ADK_TARGET_MIPS_ABI}
 endif
 
 ifeq (${ADK_MAKE_PARALLEL},y)

+ 0 - 7
toolchain/gcc/Makefile.inc

@@ -2,15 +2,8 @@
 # material, please see the LICENCE file in the top-level directory.
 
 PKG_NAME:=		gcc
-
-ifeq ($(ADK_LINUX_MICROBLAZE),y)
 PKG_VERSION:=		4.8.2
 PKG_MD5SUM:=		a3d7d63b9cb6b6ea049469a0c4a43c9d
-else
-PKG_VERSION:=		4.7.3
-PKG_MD5SUM:=		86f428a30379bdee0224e353ee2f999e
-endif
-
 PKG_RELEASE:=		1
 PKG_SITES:=		${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/}
 DISTFILES:=		$(PKG_NAME)-$(PKG_VERSION).tar.bz2

+ 231 - 0
toolchain/gcc/patches/4.8.2/cflags.patch

@@ -0,0 +1,231 @@
+diff -Nur gcc-4.8.2.orig/gcc/c-family/c.opt gcc-4.8.2/gcc/c-family/c.opt
+--- gcc-4.8.2.orig/gcc/c-family/c.opt	2013-01-19 06:25:25.000000000 +0100
++++ gcc-4.8.2/gcc/c-family/c.opt	2014-02-23 20:22:48.000000000 +0100
+@@ -379,6 +379,10 @@
+ C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
+ This switch is deprecated; use -Werror=implicit-function-declaration instead
+ 
++Werror-maybe-reset
++C ObjC C++ ObjC++
++; Documented in common.opt
++
+ Wfloat-equal
+ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
+ Warn if testing floating point numbers for equality
+@@ -949,6 +953,9 @@
+ fhonor-std
+ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+ 
++fhonour-copts
++C ObjC C++ ObjC++ RejectNegative
++
+ fhosted
+ C ObjC
+ Assume normal C execution environment
+diff -Nur gcc-4.8.2.orig/gcc/c-family/c-opts.c gcc-4.8.2/gcc/c-family/c-opts.c
+--- gcc-4.8.2.orig/gcc/c-family/c-opts.c	2013-02-18 20:42:56.000000000 +0100
++++ gcc-4.8.2/gcc/c-family/c-opts.c	2014-02-23 20:22:48.000000000 +0100
+@@ -104,6 +104,9 @@
+ /* Whether any standard preincluded header has been preincluded.  */
+ static bool done_preinclude;
+ 
++/* Check if a port honours COPTS.  */
++static int honour_copts = 0;
++
+ static void handle_OPT_d (const char *);
+ static void set_std_cxx98 (int);
+ static void set_std_cxx11 (int);
+@@ -491,6 +494,12 @@
+       flag_no_builtin = !value;
+       break;
+ 
++    case OPT_fhonour_copts:
++      if (c_language == clk_c) {
++        honour_copts++;
++      }
++      break;
++
+     case OPT_fconstant_string_class_:
+       constant_string_class_name = arg;
+       break;
+@@ -1027,6 +1036,47 @@
+       return false;
+     }
+ 
++  if (c_language == clk_c) {
++    char *ev = getenv ("GCC_HONOUR_COPTS");
++    int evv;
++    if (ev == NULL)
++      evv = -1;
++    else if ((*ev == '0') || (*ev == '\0'))
++      evv = 0;
++    else if (*ev == '1')
++      evv = 1;
++    else if (*ev == '2')
++      evv = 2;
++    else if (*ev == 's')
++      evv = -1;
++    else {
++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
++    }
++    if (evv == 1) {
++      if (honour_copts == 0) {
++        error ("someone does not honour COPTS at all in lenient mode");
++        return false;
++      } else if (honour_copts != 1) {
++        warning (0, "someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++      }
++    } else if (evv == 2) {
++      if (honour_copts == 0) {
++        error ("someone does not honour COPTS at all in strict mode");
++        return false;
++      } else if (honour_copts != 1) {
++        error ("someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++        return false;
++      }
++    } else if (evv == 0) {
++      if (honour_copts != 1)
++        inform (0, "someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++    }
++  }
++
+   return true;
+ }
+ 
+diff -Nur gcc-4.8.2.orig/gcc/common.opt gcc-4.8.2/gcc/common.opt
+--- gcc-4.8.2.orig/gcc/common.opt	2013-03-14 10:13:36.000000000 +0100
++++ gcc-4.8.2/gcc/common.opt	2014-02-23 20:22:48.000000000 +0100
+@@ -541,6 +541,10 @@
+ Common Joined
+ Treat specified warning as error
+ 
++Werror-maybe-reset
++Common
++If environment variable GCC_NO_WERROR is set, act as -Wno-error
++
+ Wextra
+ Common Var(extra_warnings) Warning
+ Print extra (possibly unwanted) warnings
+@@ -1242,6 +1246,9 @@
+ Common Report Var(flag_guess_branch_prob) Optimization
+ Enable guessing of branch probabilities
+ 
++fhonour-copts
++Common RejectNegative
++
+ ; Nonzero means ignore `#ident' directives.  0 means handle them.
+ ; Generate position-independent code for executables if possible
+ ; On SVR4 targets, it also controls whether or not to emit a
+diff -Nur gcc-4.8.2.orig/gcc/doc/cppopts.texi gcc-4.8.2/gcc/doc/cppopts.texi
+--- gcc-4.8.2.orig/gcc/doc/cppopts.texi	2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.2/gcc/doc/cppopts.texi	2014-02-23 20:22:48.000000000 +0100
+@@ -163,6 +163,11 @@
+ Make all warnings into hard errors.  Source code which triggers warnings
+ will be rejected.
+ 
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
+ @item -Wsystem-headers
+ @opindex Wsystem-headers
+ Issue warnings for code in system headers.  These are normally unhelpful
+diff -Nur gcc-4.8.2.orig/gcc/doc/invoke.texi gcc-4.8.2/gcc/doc/invoke.texi
+--- gcc-4.8.2.orig/gcc/doc/invoke.texi	2013-06-19 21:55:50.000000000 +0200
++++ gcc-4.8.2/gcc/doc/invoke.texi	2014-02-23 20:22:48.000000000 +0100
+@@ -240,7 +240,7 @@
+ -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
+ -Wno-deprecated-declarations -Wdisabled-optimization  @gol
+ -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
+--Wno-endif-labels -Werror  -Werror=* @gol
++-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol
+ -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
+ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
+ -Wformat-security  -Wformat-y2k @gol
+@@ -4807,6 +4807,22 @@
+ @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
+ @option{-Wno-pointer-sign}.
+ 
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
++ at item -fhonour-copts
++ at opindex fhonour-copts
++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
++given at least once, and warn if it is given more than once.
++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
++given exactly once.
++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
++is not given exactly once.
++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
++This flag and environment variable only affect the C language.
++
+ @item -Wstack-protector
+ @opindex Wstack-protector
+ @opindex Wno-stack-protector
+@@ -6918,7 +6934,7 @@
+ second branch or a point immediately following it, depending on whether
+ the condition is known to be true or false.
+ 
+-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
++Enabled at levels @option{-O3}.
+ 
+ @item -fsplit-wide-types
+ @opindex fsplit-wide-types
+diff -Nur gcc-4.8.2.orig/gcc/java/jvspec.c gcc-4.8.2/gcc/java/jvspec.c
+--- gcc-4.8.2.orig/gcc/java/jvspec.c	2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.2/gcc/java/jvspec.c	2014-02-23 20:22:48.000000000 +0100
+@@ -626,6 +626,7 @@
+      class name.  Append dummy `.c' that can be stripped by set_input so %b
+      is correct.  */ 
+   set_input (concat (main_class_name, "main.c", NULL));
++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
+   err = do_spec (jvgenmain_spec);
+   if (err == 0)
+     {
+diff -Nur gcc-4.8.2.orig/gcc/opts.c gcc-4.8.2/gcc/opts.c
+--- gcc-4.8.2.orig/gcc/opts.c	2013-03-05 07:01:13.000000000 +0100
++++ gcc-4.8.2/gcc/opts.c	2014-02-23 20:22:48.000000000 +0100
+@@ -468,8 +468,6 @@
+     { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
+ #endif
+     { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
+@@ -488,6 +486,8 @@
+     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
+ 
+     /* -O3 optimizations.  */
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
+     { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
+     { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
+     /* Inlining of functions reducing size is a good idea with -Os
+@@ -1423,6 +1423,17 @@
+ 			       opts, opts_set, loc, dc);
+       break;
+ 
++    case OPT_Werror_maybe_reset:
++      {
++        char *ev = getenv ("GCC_NO_WERROR");
++        if ((ev != NULL) && (*ev != '0'))
++          warnings_are_errors = 0;
++      }
++      break;
++
++    case OPT_fhonour_copts:
++      break;
++
+     case OPT_Wlarger_than_:
+       opts->x_larger_than_size = value;
+       opts->x_warn_larger_than = value != -1;

+ 49 - 0
toolchain/gcc/patches/4.8.2/musl-stubs.patch

@@ -0,0 +1,49 @@
+diff -Nur gcc-4.8.2.orig/gcc/config/m68k/linux.h gcc-4.8.2/gcc/config/m68k/linux.h
+--- gcc-4.8.2.orig/gcc/config/m68k/linux.h	2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.2/gcc/config/m68k/linux.h	2014-02-24 10:19:00.214399704 +0100
+@@ -72,6 +72,7 @@
+    done.  */
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-m68k.so.1"
+ 
+ #undef LINK_SPEC
+ #define LINK_SPEC "-m m68kelf %{shared} \
+diff -Nur gcc-4.8.2.orig/gcc/config/mips/linux64.h gcc-4.8.2/gcc/config/mips/linux64.h
+--- gcc-4.8.2.orig/gcc/config/mips/linux64.h	2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.2/gcc/config/mips/linux64.h	2014-02-24 10:19:47.238583895 +0100
+@@ -27,6 +27,9 @@
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+-			 BIONIC_DYNAMIC_LINKERN32)
++			 BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+diff -Nur gcc-4.8.2.orig/gcc/config/sparc/linux64.h gcc-4.8.2/gcc/config/sparc/linux64.h
+--- gcc-4.8.2.orig/gcc/config/sparc/linux64.h	2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.2/gcc/config/sparc/linux64.h	2014-02-24 10:20:49.414827006 +0100
+@@ -94,6 +94,9 @@
+ 
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-sparc.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-sparc.so.1"
++
+ 
+ #ifdef SPARC_BI_ARCH
+ 
+diff -Nur gcc-4.8.2.orig/gcc/config/sparc/linux.h gcc-4.8.2/gcc/config/sparc/linux.h
+--- gcc-4.8.2.orig/gcc/config/sparc/linux.h	2013-01-10 21:38:27.000000000 +0100
++++ gcc-4.8.2/gcc/config/sparc/linux.h	2014-02-24 10:21:14.342924339 +0100
+@@ -84,6 +84,7 @@
+    done.  */
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sparc.so.1"
+ 
+ #undef  LINK_SPEC
+ #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \

+ 6 - 0
toolchain/glibc/Makefile

@@ -69,6 +69,12 @@ $(WRKBUILD)/.installed:
 	touch $@
 
 $(WRKBUILD)/.fixup:
+	-find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
+	-find $(STAGING_TARGET_DIR) -type f -name \*_pic\* -delete
+	rm -rf $(STAGING_TARGET_DIR)/usr/share/locale $(STAGING_TARGET_DIR)/usr/share/i18n
+	rm -rf $(STAGING_TARGET_DIR)/usr/lib/gconv
+	PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_TARGET_DIR)
+	prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_HOST_DIR)
 	touch $@
 
 include ${TOPDIR}/mk/toolchain.mk

+ 2 - 0
toolchain/kernel-headers/Makefile

@@ -12,6 +12,8 @@ $(WRKBUILD)/.headers:
 	$(MAKE) -C $(WRKBUILD) HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
 		INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
 		headers_install
+        @-find $(STAGING_DIR)/usr/include -name .install -delete
+        @-find $(STAGING_DIR)/usr/include -name ..install.cmd -delete
 	touch $@
 
 include ${TOPDIR}/mk/toolchain.mk

+ 4 - 0
toolchain/musl/Makefile

@@ -57,6 +57,10 @@ $(WRKBUILD)/.fixup:
 	)
 	$(MAKE) CFLAGS='$(TARGET_CFLAGS)' -C $(WRKBUILD) all
 	$(MAKE) -C $(WRKBUILD) DESTDIR=$(STAGING_TARGET_DIR) install
+	# cleanup toolchain
+	-find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
+	PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_TARGET_DIR)
+	prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_HOST_DIR)
 	touch $@
 
 include ${TOPDIR}/mk/toolchain.mk

Файловите разлики са ограничени, защото са твърде много
+ 197 - 165
toolchain/musl/patches/musl-git-20140301.patch


+ 4 - 0
toolchain/uClibc/Makefile

@@ -118,6 +118,10 @@ endif
 		all install_runtime
 	rm -rf $(STAGING_TARGET_DIR)/lib/libc.so
 	ln -s libc.so.0 $(STAGING_TARGET_DIR)/lib/libc.so
+	# cleanup toolchain
+	-find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
+	PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_TARGET_DIR)
+	prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_HOST_DIR)
 	touch $@
 
 include ${TOPDIR}/mk/toolchain.mk

+ 26 - 4
tools/Makefile

@@ -3,13 +3,35 @@
 
 include $(TOPDIR)/rules.mk
 
-TARGETS:=adk mkcrypt cpio mkimage genext2fs bc
-ifeq ($(ADK_TARGET_ROOTFS_ISO),y)
-TARGETS+=cdrtools syslinux
+TARGETS:=adk mkcrypt cpio bc bzip2 m4 xz
+
+ifeq ($(ADK_HOST_NEED_GENEXT2FS),y)
+TARGETS+=genext2fs
+endif
+ifeq ($(ADK_HOST_NEED_MKIMAGE),y)
+TARGETS+=mkimage
+endif
+ifeq ($(ADK_HOST_NEED_MKISOFS),y)
+TARGETS+=cdrtools
+endif
+ifeq ($(ADK_HOST_NEED_SYSLINUX),y)
+TARGETS+=syslinux
 endif
-ifeq ($(ADK_TARGET_LIB_EGLIBC),y)
+ifeq ($(ADK_HOST_NEED_GPERF),y)
 TARGETS+=gperf
 endif
+ifeq ($(ADK_HOST_NEED_JFFS2),y)
+TARGETS+=mtd-utils
+endif
+ifeq ($(ADK_HOST_NEED_SQUASHFS),y)
+TARGETS+=squashfs
+endif
+ifeq ($(ADK_HOST_NEED_LZOP),y)
+TARGETS+=lzo lzop
+endif
+ifeq ($(ADK_HOST_NEED_LZMA),y)
+TARGETS+=lzma
+endif
 
 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS))
 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))

+ 4 - 0
tools/addpattern/Makefile

@@ -0,0 +1,4 @@
+include $(TOPDIR)/rules.mk
+
+all: addpattern.c
+	$(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -o ${STAGING_HOST_DIR}/usr/bin/addpattern addpattern.c

+ 0 - 0
target/tools/addpattern/addpattern.c → tools/addpattern/addpattern.c


+ 4 - 4
tools/adk/Makefile

@@ -3,15 +3,15 @@
 
 include $(TOPDIR)/rules.mk
 
-install: ${BIN_DIR}/depmaker ${BIN_DIR}/pkgrebuild ${BIN_DIR}/dkgetsz
+install: ${STAGING_HOST_DIR}/usr/bin/depmaker ${STAGING_HOST_DIR}/usr/bin/pkgrebuild ${STAGING_HOST_DIR}/usr/bin/dkgetsz
 
-${BIN_DIR}/depmaker: depmaker.c
+${STAGING_HOST_DIR}/usr/bin/depmaker: depmaker.c
 	${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -o $@ depmaker.c
 
-${BIN_DIR}/pkgrebuild: pkgrebuild.c strmap.c
+${STAGING_HOST_DIR}/usr/bin/pkgrebuild: pkgrebuild.c strmap.c
 	${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -o $@ pkgrebuild.c strmap.c
 
-${BIN_DIR}/dkgetsz: dkgetsz.c
+${STAGING_HOST_DIR}/usr/bin/dkgetsz: dkgetsz.c
 	${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -o $@ dkgetsz.c
 
 include $(TOPDIR)/mk/tools.mk

+ 3 - 3
tools/bc/Makefile

@@ -11,15 +11,15 @@ PKG_SITES:=		http://ftp.gnu.org/pub/gnu/bc/
 
 include ../rules.mk
 
-install: ${BIN_DIR}/bc
+install: ${STAGING_HOST_DIR}/usr/bin/bc
 
 $(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
 	(cd ${WRKBUILD}; ./configure)
 	${MAKE} -C ${WRKBUILD} CC='${CC_FOR_BUILD}'
 	touch $@
 
-${BIN_DIR}/bc: $(WRKBUILD)/.compiled
+${STAGING_HOST_DIR}/usr/bin/bc: $(WRKBUILD)/.compiled
 	$(INSTALL_BIN) $(WRKBUILD)/bc/bc \
-		${BIN_DIR}
+		${STAGING_HOST_DIR}/usr/bin
 
 include $(TOPDIR)/mk/tools.mk

+ 24 - 0
tools/bzip2/Makefile

@@ -0,0 +1,24 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=		bzip2
+PKG_VERSION:=		1.0.6
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		00b516f4704d4a7cb50a1d97e6e8e15b
+PKG_SITES:=		http://www.bzip.org/${PKG_VERSION}/
+
+include ../rules.mk
+
+install: ${STAGING_HOST_DIR}/usr/bin/bzip2
+
+$(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
+	${MAKE} -C ${WRKBUILD} CC='${CC_FOR_BUILD}' PREFIX=$(STAGING_HOST_DIR)/usr
+	touch $@
+
+${STAGING_HOST_DIR}/usr/bin/bzip2: $(WRKBUILD)/.compiled
+	$(INSTALL_BIN) $(WRKBUILD)/bzip2 \
+		${STAGING_HOST_DIR}/usr/bin
+
+include $(TOPDIR)/mk/tools.mk

+ 3 - 3
tools/cdrtools/Makefile

@@ -11,15 +11,15 @@ PKG_SITES:=		ftp://ftp.berlios.de/pub/cdrecord/
 
 include ../rules.mk
 
-install: ${BIN_DIR}/mkisofs
+install: ${STAGING_HOST_DIR}/usr/bin/mkisofs
 
 $(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
 	#(cd ${WRKBUILD}; ./configure)
 	${MAKE} -C ${WRKBUILD} CC='${CC_FOR_BUILD}'
 	touch $@
 
-${BIN_DIR}/mkisofs: $(WRKBUILD)/.compiled
+${STAGING_HOST_DIR}/usr/bin/mkisofs: $(WRKBUILD)/.compiled
 	$(INSTALL_BIN) $(WRKBUILD)/mkisofs/OBJ/*/mkisofs \
-		${BIN_DIR}
+		${STAGING_HOST_DIR}/usr/bin
 
 include $(TOPDIR)/mk/tools.mk

+ 2 - 2
tools/cpio/Makefile

@@ -3,7 +3,7 @@
 
 include $(TOPDIR)/rules.mk
 
-install: ${BIN_DIR}/cpio
+install: ${STAGING_HOST_DIR}/usr/bin/cpio
 
 SRCS:=		src/ib_open.c \
 		src/ib_close.c \
@@ -26,7 +26,7 @@ SRCS:=		src/ib_open.c \
 		src/nonpax.c \
 		src/cpio.c
 
-${BIN_DIR}/cpio: ${SRCS}
+${STAGING_HOST_DIR}/usr/bin/cpio: ${SRCS}
 	${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -D_GNU_SOURCE -Isrc -o $@ $^
 
 include $(TOPDIR)/mk/tools.mk

+ 3 - 3
tools/genext2fs/Makefile

@@ -11,15 +11,15 @@ PKG_SITES:=		${MASTER_SITE_SOURCEFORGE:=genext2fs/}
 
 include ../rules.mk
 
-install: ${BIN_DIR}/genext2fs
+install: ${STAGING_HOST_DIR}/usr/bin/genext2fs
 
 $(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
 	(cd ${WRKBUILD}; ./configure)
 	${MAKE} -C ${WRKBUILD} CC='${CC_FOR_BUILD}'
 	touch $@
 
-${BIN_DIR}/genext2fs: $(WRKBUILD)/.compiled
+${STAGING_HOST_DIR}/usr/bin/genext2fs: $(WRKBUILD)/.compiled
 	$(INSTALL_BIN) $(WRKBUILD)/genext2fs \
-		${BIN_DIR}
+		${STAGING_HOST_DIR}/usr/bin
 
 include $(TOPDIR)/mk/tools.mk

+ 3 - 3
tools/gperf/Makefile

@@ -11,15 +11,15 @@ PKG_SITES:=		http://ftp.gnu.org/pub/gnu/gperf/
 
 include ../rules.mk
 
-install: ${BIN_DIR}/gperf
+install: ${STAGING_HOST_DIR}/usr/bin/gperf
 
 $(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
 	(cd ${WRKBUILD}; ./configure)
 	${MAKE} -C ${WRKBUILD} CC='${CC_FOR_BUILD}'
 	touch $@
 
-${BIN_DIR}/gperf: $(WRKBUILD)/.compiled
+${STAGING_HOST_DIR}/usr/bin/gperf: $(WRKBUILD)/.compiled
 	$(INSTALL_BIN) $(WRKBUILD)/src/gperf \
-		${BIN_DIR}
+		${STAGING_HOST_DIR}/usr/bin
 
 include $(TOPDIR)/mk/tools.mk

+ 0 - 0
target/tools/lzma-loader/Makefile → tools/lzma-loader/Makefile


+ 0 - 0
target/tools/lzma-loader/src/LzmaDecode.c → tools/lzma-loader/src/LzmaDecode.c


+ 0 - 0
target/tools/lzma-loader/src/LzmaDecode.h → tools/lzma-loader/src/LzmaDecode.h


+ 0 - 0
target/tools/lzma-loader/src/LzmaDecode.o → tools/lzma-loader/src/LzmaDecode.o


+ 0 - 0
target/tools/lzma-loader/src/Makefile → tools/lzma-loader/src/Makefile


+ 0 - 0
target/tools/lzma-loader/src/README → tools/lzma-loader/src/README


+ 0 - 0
target/tools/lzma-loader/src/data.lds → tools/lzma-loader/src/data.lds


+ 0 - 0
target/tools/lzma-loader/src/data.o → tools/lzma-loader/src/data.o


+ 0 - 0
target/tools/lzma-loader/src/decompress → tools/lzma-loader/src/decompress


+ 0 - 0
target/tools/lzma-loader/src/decompress.c → tools/lzma-loader/src/decompress.c


+ 0 - 0
target/tools/lzma-loader/src/decompress.image → tools/lzma-loader/src/decompress.image


+ 0 - 0
target/tools/lzma-loader/src/decompress.lds → tools/lzma-loader/src/decompress.lds


+ 0 - 0
target/tools/lzma-loader/src/decompress.lds.in → tools/lzma-loader/src/decompress.lds.in


+ 0 - 0
target/tools/lzma-loader/src/decompress.o → tools/lzma-loader/src/decompress.o


+ 0 - 0
target/tools/lzma-loader/src/head.S → tools/lzma-loader/src/head.S


+ 0 - 0
target/tools/lzma-loader/src/head.o → tools/lzma-loader/src/head.o


+ 0 - 0
target/tools/lzma-loader/src/loader → tools/lzma-loader/src/loader


+ 0 - 0
target/tools/lzma-loader/src/loader.elf → tools/lzma-loader/src/loader.elf


+ 0 - 0
target/tools/lzma-loader/src/loader.gz → tools/lzma-loader/src/loader.gz


+ 0 - 0
target/tools/lzma-loader/src/loader.lds → tools/lzma-loader/src/loader.lds


+ 0 - 0
target/tools/lzma-loader/src/loader.lds.in → tools/lzma-loader/src/loader.lds.in


+ 0 - 0
target/tools/lzma-loader/src/loader.o → tools/lzma-loader/src/loader.o


+ 3 - 4
target/tools/lzma/Makefile → tools/lzma/Makefile

@@ -10,11 +10,10 @@ PKG_MD5SUM:=		434e51a018b4c8ef377bf81520a53af0
 PKG_SITES:=		http://downloads.openwrt.org/sources/
 
 DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.bz2
-#WRKDIST=		${WRKDIR}/$(PKG_NAME)${PKG_VERSION}
 
 include ../rules.mk
 
-all: ${STAGING_HOST_DIR}/bin/lzma
+install: ${STAGING_HOST_DIR}/usr/bin/lzma
 
 UTIL_DIR=$(WRKBUILD)/C/LzmaUtil
 ALONE_DIR=$(WRKBUILD)/CPP/7zip/Compress/LZMA_Alone
@@ -24,8 +23,8 @@ $(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
 	$(MAKE) -C $(ALONE_DIR) -f makefile.gcc
 	touch $@
 
-${STAGING_HOST_DIR}/bin/lzma: $(WRKBUILD)/.compiled
+${STAGING_HOST_DIR}/usr/bin/lzma: $(WRKBUILD)/.compiled
 	$(INSTALL_BIN) $(WRKBUILD)/CPP/7zip/Compress/LZMA_Alone/lzma_alone \
-		$(STAGING_DIR)/bin/lzma
+		$(STAGING_DIR)/usr/bin/lzma
 
 include $(TOPDIR)/mk/tools.mk

+ 0 - 0
target/tools/lzma/patches/001-large_files.patch → tools/lzma/patches/001-large_files.patch


+ 0 - 0
target/tools/lzma/patches/002-lzmp.patch → tools/lzma/patches/002-lzmp.patch


+ 0 - 0
target/tools/lzma/patches/003-compile_fixes.patch → tools/lzma/patches/003-compile_fixes.patch


+ 0 - 0
target/tools/lzma/patches/100-static_library.patch → tools/lzma/patches/100-static_library.patch


+ 28 - 0
tools/lzo/Makefile

@@ -0,0 +1,28 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=		lzo
+PKG_VERSION:=		2.06
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		95380bd4081f85ef08c5209f4107e9f8
+PKG_SITES:=		http://www.oberhumer.com/opensource/lzo/download/
+
+include ../rules.mk
+
+install: $(WRKBUILD)/.installed
+
+$(WRKBUILD)/.configured: ${WRKDIST}/.prepared
+	(cd ${WRKBUILD}; ./configure --prefix=$(STAGING_HOST_DIR)/usr)
+	@touch $@
+
+$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
+	${MAKE} -C ${WRKBUILD}
+	@touch $@
+
+$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
+	${MAKE} -C ${WRKBUILD} install
+	@touch $@
+
+include $(TOPDIR)/mk/tools.mk

+ 30 - 0
tools/lzop/Makefile

@@ -0,0 +1,30 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=		lzop
+PKG_VERSION:=		1.03
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		006c5e27fb78cdd14a628fdfa5aa1905
+PKG_SITES:=		http://www.lzop.org/download/
+
+include ../rules.mk
+
+install: $(WRKBUILD)/.installed
+
+$(WRKBUILD)/.configured: ${WRKDIST}/.prepared
+	(cd ${WRKBUILD}; CPPFLAGS='$(CPPFLAGS_FOR_BUILD)' \
+		LDFLAGS='$(LDFLAGS_FOR_BUILD)' \
+		./configure --prefix=$(STAGING_HOST_DIR)/usr)
+	@touch $@
+
+$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
+	${MAKE} -C ${WRKBUILD}
+	@touch $@
+
+$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
+	${MAKE} -C ${WRKBUILD} install
+	@touch $@
+
+include $(TOPDIR)/mk/tools.mk

+ 25 - 0
tools/m4/Makefile

@@ -0,0 +1,25 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=		m4
+PKG_VERSION:=		1.4.17
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		a5e9954b1dae036762f7b13673a2cf76
+PKG_SITES:=		http://www.gnu.org/software/m4/
+
+include ../rules.mk
+
+install: ${STAGING_HOST_DIR}/usr/bin/m4
+
+$(WRKBUILD)/.compiled: ${WRKDIST}/.prepared
+	(cd ${WRKBUILD}; ./configure --prefix=$(STAGING_HOST_DIR)/usr)
+	${MAKE} -C ${WRKBUILD} CC='${CC_FOR_BUILD}'
+	touch $@
+
+${STAGING_HOST_DIR}/usr/bin/m4: $(WRKBUILD)/.compiled
+	$(INSTALL_BIN) $(WRKBUILD)/src/m4 \
+		${STAGING_HOST_DIR}/usr/bin
+
+include $(TOPDIR)/mk/tools.mk

+ 2 - 2
tools/mkcrypt/Makefile

@@ -3,9 +3,9 @@
 
 include $(TOPDIR)/rules.mk
 
-install: ${BIN_DIR}/mkcrypt
+install: ${STAGING_HOST_DIR}/usr/bin/mkcrypt
 
-${BIN_DIR}/mkcrypt:
+${STAGING_HOST_DIR}/usr/bin/mkcrypt:
 	$(CC_FOR_BUILD) ${FLAGS_FOR_BUILD} -o $@ mkcrypt.c
 
 include $(TOPDIR)/mk/tools.mk

+ 4 - 0
tools/mkfimage/Makefile

@@ -0,0 +1,4 @@
+include $(TOPDIR)/rules.mk
+
+all: mkfimage.c
+	$(CC_FOR_BUILD) ${FLAGS_FOR_BUILD} -o ${STAGING_HOST_DIR}/usr/bin/mkfimage mkfimage.c $(MAKE_TRACE)

+ 0 - 0
target/tools/mkfimage/mkfimage.c → tools/mkfimage/mkfimage.c


Някои файлове не бяха показани, защото твърде много файлове са промени