From: Mike Baker Date: Tue, 25 May 2004 04:32:27 +0000 (+0000) Subject: Initial revision X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e5f9af658d60e0a3a1eb6cc56cbabce4ea7e8c98;p=librecmc%2Flibrecmc.git Initial revision SVN-Revision: 30 --- diff --git a/obsolete-buildroot/.cvsignore b/obsolete-buildroot/.cvsignore new file mode 100644 index 0000000000..08611a0d4d --- /dev/null +++ b/obsolete-buildroot/.cvsignore @@ -0,0 +1,4 @@ +UMlinux +root_fs* +build_* +toolchain_build_* diff --git a/obsolete-buildroot/Makefile b/obsolete-buildroot/Makefile new file mode 100644 index 0000000000..96fa2494a8 --- /dev/null +++ b/obsolete-buildroot/Makefile @@ -0,0 +1,370 @@ +# Makefile for a simple busybox/uClibc root filesystem +# +# Copyright (C) 2001-2004 Erik Andersen +# Copyright (C) 2002 by Tim Riker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + + +############################################################# +# +# EDIT this stuff to suit your system and preferences +# +# Use := when possible to get precomputation, thereby +# speeding up the build process. +# +############################################################# + +# What sortof target system shall we compile this for? +#ARCH:=i386 +#ARCH:=arm +#ARCH:=mips +ARCH:=mipsel +#ARCH:=powerpc +#ARCH:=sh4 +# Busybox link failing due to needing libgcc functions that are statics. +#ARCH:=cris + +# The following currently fail to build since no shared lib support. +#ARCH:=sh64 +#ARCH:=m68k +#ARCH:=v850 +#ARCH:=sparc +#ARCH:=whatever + +# If you are building a native gcc toolchain, do you want to +# build the old gcc-2.95 based toolchain, or would you prefer +# a nice and shiny new gcc-3.3.2 toolchain? +# WARNING -- 2.95 currently only builds for i386, arm, mips*, and powerpc. +# WARNING -- 2.95 does not currently build natively for the target. +GCC_2_95_TOOLCHAIN:=false + +# Enable this to use the uClibc daily snapshot instead of a released +# version. Daily snapshots may contain new features and bugfixes. Or +# they may not even compile at all, depending on what Erik is doing... +#USE_UCLIBC_SNAPSHOT:= +#USE_UCLIBC_SNAPSHOT:=snapshot +USE_UCLIBC_SNAPSHOT:=20040509 + +# Temporary option... Fall back to (slightly modified) ldso 0.9.24 code? +# This is here temporarily since I'm having problems with the current +# cvs ldso code on mipsel. +USE_UCLIBC_LDSO_0_9_24:=true +#USE_UCLIBC_LDSO_0_9_24:=false + +# Enable this to use the busybox daily snapshot instead of a released +# version. Daily snapshots may contain new features and bugfixes. Or +# they may not even compile at all.... +#USE_BUSYBOX_SNAPSHOT:= +#USE_BUSYBOX_SNAPSHOT:=snapshot +USE_BUSYBOX_SNAPSHOT:=20040509 + +# Enable large file (files > 2 GB) support +BUILD_WITH_LARGEFILE:=true + +# Command used to download source code +WGET:=wget --passive-ftp + +# Optimize toolchain for which type of CPU? +OPTIMIZE_FOR_CPU=$(ARCH) +#OPTIMIZE_FOR_CPU=i686 +# Note... gcc 2.95 does not seem to like anything higher than i586. +#OPTIMIZE_FOR_CPU=i586 +#OPTIMIZE_FOR_CPU=whatever + +# Soft floating point options. +# Notes: +# Currently builds with gcc 3.3 for arm, mips, mipsel, powerpc. +# (i386 support will be added back in at some point.) +# Only tested with multilib enabled. +# For i386, long double is the same as double (64 bits). While this +# is unusual for x86, it seemed the best approach considering the +# limitations in the gcc floating point emulation library. +# For arm, soft float uses the usual libfloat routines. +# Custom specs files are used to set the default gcc mode to soft float +# as a convenience, since you shouldn't link hard and soft float +# together. In fact, arm won't even let you. +# (Un)comment the appropriate line below. +#SOFT_FLOAT:=true +SOFT_FLOAT:=false + +TARGET_OPTIMIZATION=-Os -mips2 +TARGET_DEBUGGING= #-g + +# Currently the unwind stuff seems to work for staticly linked apps but +# not dynamic. So use setjmp/longjmp exceptions by default. +GCC_USE_SJLJ_EXCEPTIONS:=--enable-sjlj-exceptions +#GCC_USE_SJLJ_EXCEPTIONS:= + +# Any additional gcc options you may want to include.... +EXTRA_GCC_CONFIG_OPTIONS:= + +# Enable the following if you want locale/gettext/i18n support. +# NOTE! Currently the pregnerated locale stuff only works for x86! +#ENABLE_LOCALE:=true +ENABLE_LOCALE:=false + +# If you want multilib enabled, enable this... +MULTILIB:=--enable-multilib + +# Build/install c++ compiler and libstdc++? +#INSTALL_LIBSTDCPP:=true +INSTALL_LIBSTDCPP:=false + +# Build/install java compiler and libgcj? (requires c++) +# WARNING!!! DOES NOT BUILD FOR TARGET WITHOUT INTERVENTION!!! mjn3 +#INSTALL_LIBGCJ:=true +INSTALL_LIBGCJ:=false + +# For SMP machines some stuff can be run in parallel +#JLEVEL=-j3 + +############################################################# +# +# The list of stuff to build for the target filesystem +# +############################################################# +TARGETS:=host-sed + +ifeq ($(GCC_2_95_TOOLCHAIN),true) +TARGETS+=uclibc-configured binutils gcc2_95 +else +TARGETS+=uclibc-configured binutils gcc3_3 +endif + +# Do you want user mode Linux (x86 only), or are you building a +# your own kernel that will run on its own? Perhaps you have a +# kernel you have already configured and you want to use that? +# The default is to just use a set of known working kernel +# headers. Unless you want to build a kernel, I recommend just +# using that... +#TARGETS+=kernel-headers +#TARGETS+=linux +#TARGETS+=user-mode-linux +#TARGETS+=system-linux +TARGETS+= openwrt-base + +# The default minimal set +#TARGETS+=busybox tinylogin + +# Openssh... +#TARGETS+=zlib openssl openssh +# Dropbear sshd is much smaller than openssl + openssh +#TARGETS+=dropbear_sshd + +# Everything needed to build a full uClibc development system! +#TARGETS+=coreutils findutils bash make diffutils patch sed +#TARGETS+=ed flex bison file gawk tar grep bzip2 + +#If you want a development system, you probably want gcc built +# with uClibc so it can run within your dev system... +#TARGETS+=gcc2_95_target ccache_target # NOT WORKING!!! +#TARGETS+=gcc3_3_target ccache_target + +# Of course, if you are installing a development system, you +# may want some header files so you can compile stuff.... +#TARGETS+=ncurses-headers zlib-headers openssl-headers + +# More development system stuff for those that want it +#TARGETS+=m4 autoconf automake libtool + +# Perl +#TARGETS+=perl + +# Some nice debugging tools +#TARGETS+=gdb strace ltrace + +# The Valgrind debugger (x86 only) +#TARGETS+=valgrind + +# Some stuff for access points and firewalls +#TARGETS+=iptables hostap wtools dhcp_relay bridge +#TARGETS+=iproute2 netsnmp + +# Run customize.mk at the very end to add your own special config. +# This is useful for making your own distro within the buildroot +# process. +# TARGETS+=customize + +############################################################# +# +# Pick your root filesystem type. +# +############################################################# +#TARGETS+=ext2root + +# Must mount cramfs with 'ramdisk_blocksize=4096' +#TARGETS+=cramfsroot + +# You may need to edit make/jffs2root.mk to change target +# endian-ness or similar, but this is sufficient for most +# things as-is... +#TARGETS+=jffs2root + +#TARGETS+= openwrt-linux.trx +TARGETS+= openwrt-code.bin + +############################################################# +# +# You should probably leave this stuff alone unless you know +# what you are doing. +# +############################################################# + +ifeq ($(SOFT_FLOAT),true) +SOFT_FLOAT_CONFIG_OPTION:=--without-float +TARGET_SOFT_FLOAT:=-msoft-float +ARCH_FPU_SUFFIX:=_nofpu +else +SOFT_FLOAT_CONFIG_OPTION:= +TARGET_SOFT_FLOAT:= +ARCH_FPU_SUFFIX:= +endif + +ifeq ($(INSTALL_LIBGCJ),true) +INSTALL_LIBSTDCPP:=true +endif + +# WARNING -- uClibc currently disables large file support on cris. +ifeq ("$(strip $(ARCH))","cris") +BUILD_WITH_LARGEFILE:=false +endif + +ifneq ($(BUILD_WITH_LARGEFILE),true) +DISABLE_LARGEFILE= --disable-largefile +endif +TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) + +HOSTCC:=gcc +BASE_DIR:=${shell pwd} +SOURCE_DIR:=$(BASE_DIR)/sources +DL_DIR:=$(SOURCE_DIR)/dl +PATCH_DIR=$(SOURCE_DIR)/patches +BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX) +TARGET_DIR:=$(BUILD_DIR)/root +STAGING_DIR=$(BUILD_DIR)/staging_dir +TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX) +TARGET_PATH=$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin +IMAGE:=$(BASE_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX) +REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc +GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux +KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc- +TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc- +TARGET_CC=$(TARGET_CROSS)gcc +STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note + + +HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \ + -e 's/sparc.*/sparc/' \ + -e 's/arm.*/arm/g' \ + -e 's/m68k.*/m68k/' \ + -e 's/ppc/powerpc/g' \ + -e 's/v850.*/v850/g' \ + -e 's/sh[234]/sh/' \ + -e 's/mips-.*/mips/' \ + -e 's/mipsel-.*/mipsel/' \ + -e 's/cris.*/cris/' \ + -e 's/i[3-9]86/i386/' \ + ) +GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu +TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \ + AR=$(TARGET_CROSS)ar \ + AS=$(TARGET_CROSS)as \ + LD=$(TARGET_CROSS)ld \ + NM=$(TARGET_CROSS)nm \ + CC=$(TARGET_CROSS)gcc \ + GCC=$(TARGET_CROSS)gcc \ + CXX=$(TARGET_CROSS)g++ \ + RANLIB=$(TARGET_CROSS)ranlib + +ifeq ($(ENABLE_LOCALE),true) +DISABLE_NLS:= +else +DISABLE_NLS:=--disable-nls +endif + + +all: world + +TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) +TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) +TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) + +world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) + @echo "ALL DONE." + +.PHONY: all world clean dirclean distclean source $(TARGETS) \ + $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) + +include make/*.mk + +############################################################# +# +# staging and target directories do NOT list these as +# dependancies anywhere else +# +############################################################# +$(DL_DIR): + mkdir $(DL_DIR) + +$(BUILD_DIR): + mkdir $(BUILD_DIR) + +$(STAGING_DIR): + rm -rf $(STAGING_DIR) + mkdir -p $(STAGING_DIR)/lib + mkdir -p $(STAGING_DIR)/usr + ln -fs $(REAL_GNU_TARGET_NAME)/include $(STAGING_DIR)/include + ln -fs ../lib $(STAGING_DIR)/usr/lib + ln -fs ../$(REAL_GNU_TARGET_NAME)/include $(STAGING_DIR)/usr/include + + +$(TARGET_DIR): $(DL_DIR)/$(OPENWRT_ROOT_SKEL) + rm -rf $(TARGET_DIR) + #zcat $(SOURCE_DIR)/skel.tar.gz | tar -C $(BUILD_DIR) -xf - + zcat $(DL_DIR)/$(OPENWRT_ROOT_SKEL) | tar -C $(BUILD_DIR) -xf - + #cp -a $(SOURCE_DIR)/target_skeleton/* $(TARGET_DIR)/ + -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1 + +source: $(TARGETS_SOURCE) + +############################################################# +# +# Cleanup and misc junk +# +############################################################# +clean: + rm -rf $(TOOL_BUILD_DIR) $(BUILD_DIR) $(IMAGE) \ + openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \ + openwrt-kmodules.tar.bz2 + +dirclean: $(TARGETS_DIRCLEAN) + rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE) \ + openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \ + openwrt-kmodules.tar.bz2 + +distclean: + rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) \ + openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \ + openwrt-kmodules.tar.bz2 + +sourceball: + rm -rf $(BUILD_DIR) + set -e; \ + cd ..; \ + rm -f buildroot.tar.bz2; \ + tar -cvf buildroot.tar buildroot; \ + bzip2 -9 buildroot.tar; \ diff --git a/obsolete-buildroot/README b/obsolete-buildroot/README new file mode 100644 index 0000000000..3b5b771af4 --- /dev/null +++ b/obsolete-buildroot/README @@ -0,0 +1,42 @@ +This is a modified uClibc buildroot, customized to build OpenWRT. +NOTE! This tarball is meant to be unpacked on top of a stock uClibc +buildroot directory as it only include the necessary customizations! + +If you already have the linksys tarball (check make/openwrt.mk for the +version used), then move/copy/symlink it into sources/dl. At the +moment (2004/03/05) I'm using wrt54gv2.2.02.2.tgz. + +Simply running 'make' will build openwrt-code.bin and a tarball of +the kernel modules. Customizations of the kernel, uClibc, and busybox +are possible by modifying the appropriate config files in source. +Copies of the stock openwrt Makefile, uClibc.config, busybox.config, +are included with a '-openwrt' suffix. + +Remember that different configurations of uClibc may not be binary +compatible. Also, uClibc is not necessarily binary compatible between +versions. In particular, dynamicly linked applications and libraries +built with the linksys/broadcom toolchain are NOT binary compatible +with current uClibc. + +Manuel Novoa III +mjn3@codepoet.org + + +2004/03/16 Added patch to support boardtype of bcm94710ap. + Updated resetmon patch as per mbm. + Set busybox and uClibc snapshots to known good versions. + +2004/03/30 Switch to wrt54gs.2.07.1.tgz as the base tarball. + Start grabbing the (updated) root skeleton from openwrt cvs. + Add busybox applets: passwd and nameif. + Update snapshots of buildroot, uClibc, and busybox. + Fix broken /var symlink. + +2004/03/31 Replace diag_led.c with mbm's rewrite. + Create code.bin files for both 'G' and 'GS' units. + Update busybox for sed fix. + +2004/05/08 Add busybox applets: chown, chgrp, lsmod, sysctl + Remove: ipaddr, iplink, iproute + Update snapshots of buildroot, uClibc, busybox, netfilter. + diff --git a/obsolete-buildroot/make/autoconf.mk b/obsolete-buildroot/make/autoconf.mk new file mode 100644 index 0000000000..8343160ae1 --- /dev/null +++ b/obsolete-buildroot/make/autoconf.mk @@ -0,0 +1,72 @@ +############################################################# +# +# autoconf +# +############################################################# +AUTOCONF_SOURCE:=autoconf-2.57.tar.bz2 +AUTOCONF_SITE:=ftp://ftp.gnu.org/gnu/autoconf +AUTOCONF_CAT:=bzcat +AUTOCONF_DIR:=$(BUILD_DIR)/autoconf-2.57 +AUTOCONF_BINARY:=autoconf +AUTOCONF_TARGET_BINARY:=usr/bin/autoconf + +$(DL_DIR)/$(AUTOCONF_SOURCE): + $(WGET) -P $(DL_DIR) $(AUTOCONF_SITE)/$(AUTOCONF_SOURCE) + +autoconf-source: $(DL_DIR)/$(AUTOCONF_SOURCE) + +$(AUTOCONF_DIR)/.unpacked: $(DL_DIR)/$(AUTOCONF_SOURCE) + $(AUTOCONF_CAT) $(DL_DIR)/$(AUTOCONF_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(AUTOCONF_DIR)/.unpacked + +$(AUTOCONF_DIR)/.configured: $(AUTOCONF_DIR)/.unpacked + (cd $(AUTOCONF_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) EMACS="no" \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + ); + touch $(AUTOCONF_DIR)/.configured + +$(AUTOCONF_DIR)/bin/$(AUTOCONF_BINARY): $(AUTOCONF_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(AUTOCONF_DIR) + +$(TARGET_DIR)/$(AUTOCONF_TARGET_BINARY): $(AUTOCONF_DIR)/bin/$(AUTOCONF_BINARY) + $(MAKE) \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + bindir=$(TARGET_DIR)/usr/bin \ + sbindir=$(TARGET_DIR)/usr/sbin \ + libexecdir=$(TARGET_DIR)/usr/lib \ + datadir=$(TARGET_DIR)/usr/share \ + sysconfdir=$(TARGET_DIR)/etc \ + localstatedir=$(TARGET_DIR)/var \ + libdir=$(TARGET_DIR)/usr/lib \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(TARGET_DIR)/usr/include \ + -C $(AUTOCONF_DIR) install; + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +autoconf: uclibc $(TARGET_DIR)/$(AUTOCONF_TARGET_BINARY) + +autoconf-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(AUTOCONF_DIR) uninstall + -$(MAKE) -C $(AUTOCONF_DIR) clean + +autoconf-dirclean: + rm -rf $(AUTOCONF_DIR) + diff --git a/obsolete-buildroot/make/automake.mk b/obsolete-buildroot/make/automake.mk new file mode 100644 index 0000000000..6ac66003ac --- /dev/null +++ b/obsolete-buildroot/make/automake.mk @@ -0,0 +1,74 @@ +############################################################# +# +# automake +# +############################################################# +AUTOMAKE_SOURCE:=automake-1.6.3.tar.bz2 +AUTOMAKE_SITE:=ftp://ftp.gnu.org/gnu/automake +AUTOMAKE_CAT:=bzcat +AUTOMAKE_DIR:=$(BUILD_DIR)/automake-1.6.3 +AUTOMAKE_BINARY:=automake +AUTOMAKE_TARGET_BINARY:=usr/bin/automake + +$(DL_DIR)/$(AUTOMAKE_SOURCE): + $(WGET) -P $(DL_DIR) $(AUTOMAKE_SITE)/$(AUTOMAKE_SOURCE) + +automake-source: $(DL_DIR)/$(AUTOMAKE_SOURCE) + +$(AUTOMAKE_DIR)/.unpacked: $(DL_DIR)/$(AUTOMAKE_SOURCE) + $(AUTOMAKE_CAT) $(DL_DIR)/$(AUTOMAKE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(AUTOMAKE_DIR)/.unpacked + +$(AUTOMAKE_DIR)/.configured: $(AUTOMAKE_DIR)/.unpacked + (cd $(AUTOMAKE_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + ); + touch $(AUTOMAKE_DIR)/.configured + +$(AUTOMAKE_DIR)/$(AUTOMAKE_BINARY): $(AUTOMAKE_DIR)/.configured + $(MAKE) -C $(AUTOMAKE_DIR) + touch -c $(AUTOMAKE_DIR)/$(AUTOMAKE_BINARY) + +$(TARGET_DIR)/$(AUTOMAKE_TARGET_BINARY): $(AUTOMAKE_DIR)/$(AUTOMAKE_BINARY) + $(MAKE) \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + bindir=$(TARGET_DIR)/usr/bin \ + sbindir=$(TARGET_DIR)/usr/sbin \ + libexecdir=$(TARGET_DIR)/usr/lib \ + datadir=$(TARGET_DIR)/usr/share \ + sysconfdir=$(TARGET_DIR)/etc \ + localstatedir=$(TARGET_DIR)/var \ + libdir=$(TARGET_DIR)/usr/lib \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(TARGET_DIR)/usr/include \ + -C $(AUTOMAKE_DIR) install; + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + touch -c $(TARGET_DIR)/$(AUTOMAKE_TARGET_BINARY) + +automake: uclibc $(TARGET_DIR)/$(AUTOMAKE_TARGET_BINARY) + +automake-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(AUTOMAKE_DIR) uninstall + -$(MAKE) -C $(AUTOMAKE_DIR) clean + +automake-dirclean: + rm -rf $(AUTOMAKE_DIR) + diff --git a/obsolete-buildroot/make/bash.mk b/obsolete-buildroot/make/bash.mk new file mode 100644 index 0000000000..26c408fc9d --- /dev/null +++ b/obsolete-buildroot/make/bash.mk @@ -0,0 +1,71 @@ +############################################################# +# +# bash +# +############################################################# +BASH_SOURCE:=bash-2.05b.tar.gz +BASH_SITE:=ftp://ftp.gnu.org/gnu/bash +BASH_CAT:=zcat +BASH_DIR:=$(BUILD_DIR)/bash-2.05b +BASH_BINARY:=bash +BASH_TARGET_BINARY:=bin/bash + +$(DL_DIR)/$(BASH_SOURCE): + $(WGET) -P $(DL_DIR) $(BASH_SITE)/$(BASH_SOURCE) + +bash-source: $(DL_DIR)/$(BASH_SOURCE) + +$(BASH_DIR)/.unpacked: $(DL_DIR)/$(BASH_SOURCE) + $(BASH_CAT) $(DL_DIR)/$(BASH_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # This is broken when -lintl is added to LIBS + $(SED) 's,LIBS_FOR_BUILD =.*,LIBS_FOR_BUILD =,g' \ + $(BASH_DIR)/builtins/Makefile.in + touch $(BASH_DIR)/.unpacked + +$(BASH_DIR)/.configured: $(BASH_DIR)/.unpacked + (cd $(BASH_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) CC_FOR_BUILD=$(HOSTCC) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ac_cv_func_setvbuf_reversed=no \ + bash_cv_have_mbstate_t=yes \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --with-curses \ + --enable-alias \ + ); + touch $(BASH_DIR)/.configured + +$(BASH_DIR)/$(BASH_BINARY): $(BASH_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) CC_FOR_BUILD=$(HOSTCC) -C $(BASH_DIR) + +$(TARGET_DIR)/$(BASH_TARGET_BINARY): $(BASH_DIR)/$(BASH_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BASH_DIR) install + rm -f $(TARGET_DIR)/bin/bash* + mv $(TARGET_DIR)/usr/bin/bash* $(TARGET_DIR)/bin/ + (cd $(TARGET_DIR)/bin; ln -fs bash sh) + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +bash: ncurses uclibc $(TARGET_DIR)/$(BASH_TARGET_BINARY) + +bash-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BASH_DIR) uninstall + -$(MAKE) -C $(BASH_DIR) clean + +bash-dirclean: + rm -rf $(BASH_DIR) + diff --git a/obsolete-buildroot/make/berkeleydb.mk b/obsolete-buildroot/make/berkeleydb.mk new file mode 100644 index 0000000000..5b4105a8e6 --- /dev/null +++ b/obsolete-buildroot/make/berkeleydb.mk @@ -0,0 +1,94 @@ +############################################################# +# +# berkeley db +# +############################################################# +DB_SITE:=http://www.sleepycat.com/update/snapshot +DB_SOURCE:=db-4.1.25.NC.tar.gz +DB_DIR:=$(BUILD_DIR)/db-4.1.25.NC + + +$(DL_DIR)/$(DB_SOURCE): + $(WGET) -P $(DL_DIR) $(DB_SITE)/$(DB_SOURCE) + +berkeleydb-source: $(DL_DIR)/$(DB_SOURCE) + +$(DB_DIR)/.dist: $(DL_DIR)/$(DB_SOURCE) + zcat $(DL_DIR)/$(DB_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(DB_DIR)/.dist + +$(DB_DIR)/.configured: $(DB_DIR)/.dist + (cd $(DB_DIR)/build_unix; rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ../dist/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --with-gnu-ld \ + --enable-shared \ + --disable-cxx \ + --disable-java \ + --disable-rpc \ + --disable-tcl \ + --disable-compat185 \ + --with-pic \ + ); + $(SED) 's/\.lo/.o/g' $(DB_DIR)/build_unix/Makefile + touch $(DB_DIR)/.configured + +$(DB_DIR)/build_unix/.libs/libdb-4.1.so: $(DB_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(DB_DIR)/build_unix + +$(STAGING_DIR)/lib/libdb-4.1.so: $(DB_DIR)/build_unix/.libs/libdb-4.1.so + $(MAKE) \ + prefix=$(STAGING_DIR) \ + exec_prefix=$(STAGING_DIR) \ + bindir=$(STAGING_DIR)/bin \ + sbindir=$(STAGING_DIR)/sbin \ + libexecdir=$(STAGING_DIR)/lib \ + datadir=$(STAGING_DIR)/share \ + sysconfdir=$(STAGING_DIR)/etc \ + localstatedir=$(STAGING_DIR)/var \ + libdir=$(STAGING_DIR)/lib \ + infodir=$(STAGING_DIR)/info \ + mandir=$(STAGING_DIR)/man \ + includedir=$(STAGING_DIR)/include \ + -C $(DB_DIR)/build_unix install; + chmod a-x $(STAGING_DIR)/lib/libdb*so* + rm -f $(STAGING_DIR)/bin/db_* + rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/info \ + $(STAGING_DIR)/man $(STAGING_DIR)/share/doc + +$(TARGET_DIR)/lib/libdb-4.1.so: $(STAGING_DIR)/lib/libdb-4.1.so + rm -rf $(TARGET_DIR)/lib/libdb* + cp -a $(STAGING_DIR)/lib/libdb*so* $(TARGET_DIR)/lib/ + rm -f $(TARGET_DIR)/lib/libdb.so $(TARGET_DIR)/lib/libdb.la $(TARGET_DIR)/lib/libdb.a + (cd $(TARGET_DIR)/usr/lib; ln -fs /lib/libdb-4.1.so libdb.so) + -$(STRIP) --strip-unneeded $(TARGET_DIR)/lib/libdb*so* + +$(TARGET_DIR)/usr/lib/libdb.a: $(STAGING_DIR)/lib/libdb-4.1.a + cp -dpf $(STAGING_DIR)/include/db.h $(TARGET_DIR)/usr/include/ + cp -dpf $(STAGING_DIR)/lib/libdb*.a $(TARGET_DIR)/usr/lib/ + cp -dpf $(STAGING_DIR)/lib/libdb*.la $(TARGET_DIR)/usr/lib/ + touch -c $(TARGET_DIR)/usr/lib/libdb.a + +berkeleydb-headers: $(TARGET_DIR)/usr/lib/libdb.a + +berkeleydb-clean: + $(MAKE) -C $(DB_DIR)/build_unix clean + +berkeleydb-dirclean: + rm -rf $(DB_DIR) + +berkeleydb: uclibc $(TARGET_DIR)/lib/libdb-4.1.so + diff --git a/obsolete-buildroot/make/binutils-uclibc.mk b/obsolete-buildroot/make/binutils-uclibc.mk new file mode 100644 index 0000000000..ae2e5284be --- /dev/null +++ b/obsolete-buildroot/make/binutils-uclibc.mk @@ -0,0 +1,120 @@ +############################################################# +# +# build binutils for use on the host system +# +############################################################# +BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils +BINUTILS_SOURCE:=binutils-2.14.90.0.7.tar.bz2 +BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.14.90.0.7 +BINUTILS_CAT:=bzcat + +BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-build + +$(DL_DIR)/$(BINUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) + +$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) + mkdir -p $(TOOL_BUILD_DIR) + mkdir -p $(DL_DIR) + $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(BINUTILS_DIR)/.unpacked + +$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked + # Apply any files named binutils-*.patch from the source directory to binutils + $(SOURCE_DIR)/patch-kernel.sh $(BINUTILS_DIR) $(SOURCE_DIR) binutils-uclibc*.patch + touch $(BINUTILS_DIR)/.patched + +$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched + mkdir -p $(BINUTILS_DIR1) + (cd $(BINUTILS_DIR1); \ + $(BINUTILS_DIR)/configure \ + --prefix=$(STAGING_DIR) \ + --build=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) ); + touch $(BINUTILS_DIR1)/.configured + +$(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured + $(MAKE) $(JLEVEL) -C $(BINUTILS_DIR1) all + +# Make install will put gettext data in staging_dir/share/locale. +# Unfortunatey, it isn't configureable. +$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump + $(MAKE) $(JLEVEL) -C $(BINUTILS_DIR1) install + +binutils-dependancies: + @if [ ! -x /usr/bin/bison ] ; then \ + echo -e "\n\nYou must install 'bison' on your build machine\n"; \ + exit 1; \ + fi; + @if [ ! -x /usr/bin/flex ] ; then \ + echo -e "\n\nYou must install 'flex' on your build machine\n"; \ + exit 1; \ + fi; + @if [ ! -x /usr/bin/msgfmt ] ; then \ + echo -e "\n\nYou must install 'gettext' on your build machine\n"; \ + exit 1; \ + fi; + +binutils: binutils-dependancies $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld + +binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE) + +binutils-clean: + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + -$(MAKE) -C $(BINUTILS_DIR1) clean + +binutils-dirclean: + rm -rf $(BINUTILS_DIR1) + + + +############################################################# +# +# build binutils for use on the target system +# +############################################################# +BINUTILS_DIR2:=$(BUILD_DIR)/binutils-target +$(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched + mkdir -p $(BINUTILS_DIR2) + (cd $(BINUTILS_DIR2); \ + PATH=$(TARGET_PATH) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CFLAGS_FOR_BUILD="-O2 -g" \ + $(BINUTILS_DIR)/configure \ + --prefix=/usr \ + --exec-prefix=/usr \ + --build=$(GNU_HOST_NAME) \ + --host=$(REAL_GNU_TARGET_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) ); + touch $(BINUTILS_DIR2)/.configured + +$(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured + PATH=$(TARGET_PATH) \ + $(MAKE) $(JLEVEL) -C $(BINUTILS_DIR2) all + +$(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump + PATH=$(TARGET_PATH) \ + $(MAKE) $(JLEVEL) DESTDIR=$(TARGET_DIR) \ + tooldir=/usr build_tooldir=/usr \ + -C $(BINUTILS_DIR2) install + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1 + -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1 + +binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld + +binutils_target-clean: + rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + -$(MAKE) -C $(BINUTILS_DIR2) clean + +binutils_target-dirclean: + rm -rf $(BINUTILS_DIR2) + diff --git a/obsolete-buildroot/make/bison.mk b/obsolete-buildroot/make/bison.mk new file mode 100644 index 0000000000..89c9b916cc --- /dev/null +++ b/obsolete-buildroot/make/bison.mk @@ -0,0 +1,62 @@ +############################################################# +# +# bison +# +############################################################# +BISON_SOURCE:=bison-1.35.tar.bz2 +BISON_SITE:=ftp://ftp.gnu.org/gnu/bison +BISON_DIR:=$(BUILD_DIR)/bison-1.35 +BISON_CAT:=bzcat +BISON_BINARY:=src/bison +BISON_TARGET_BINARY:=usr/bin/bison + +$(DL_DIR)/$(BISON_SOURCE): + $(WGET) -P $(DL_DIR) $(BISON_SITE)/$(BISON_SOURCE) + +bison-source: $(DL_DIR)/$(BISON_SOURCE) + +$(BISON_DIR)/.unpacked: $(DL_DIR)/$(BISON_SOURCE) + $(BISON_CAT) $(DL_DIR)/$(BISON_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(BISON_DIR)/.unpacked + +$(BISON_DIR)/.configured: $(BISON_DIR)/.unpacked + (cd $(BISON_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + gt_cv_func_gnugettext2_libintl=yes \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(BISON_DIR)/.configured + +$(BISON_DIR)/$(BISON_BINARY): $(BISON_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(BISON_DIR) + +$(TARGET_DIR)/$(BISON_TARGET_BINARY): $(BISON_DIR)/$(BISON_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BISON_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + cp -a $(SOURCE_DIR)/yacc $(TARGET_DIR)/usr/bin/yacc + +bison: uclibc $(TARGET_DIR)/$(BISON_TARGET_BINARY) + +bison-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BISON_DIR) uninstall + -$(MAKE) -C $(BISON_DIR) clean + +bison-dirclean: + rm -rf $(BISON_DIR) + diff --git a/obsolete-buildroot/make/boa.mk b/obsolete-buildroot/make/boa.mk new file mode 100644 index 0000000000..1eb233fbc6 --- /dev/null +++ b/obsolete-buildroot/make/boa.mk @@ -0,0 +1,57 @@ +############################################################# +# +# boa +# +############################################################# + +BOA_VERSION=0.94.14rc4 + +# Don't alter below this line unless you (think) you know +# what you are doing! Danger, Danger! + +BOA_SOURCE=boa-$(BOA_VERSION).tar.gz +BOA_SITE=http://www.boa.org/ +BOA_DIR=$(BUILD_DIR)/${shell basename $(BOA_SOURCE) .tar.gz} +BOA_WORKDIR=$(BUILD_DIR)/boa_workdir + +$(DL_DIR)/$(BOA_SOURCE): + $(WGET) -P $(DL_DIR) $(BOA_SITE)/$(BOA_SOURCE) + +$(BOA_DIR)/.unpacked: $(DL_DIR)/$(BOA_SOURCE) + gzip -d -c $(DL_DIR)/$(BOA_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(BOA_DIR)/.unpacked + +$(BOA_WORKDIR)/Makefile: $(BOA_DIR)/.unpacked + rm -f $(BOA_WORKDIR)/Makefile + mkdir -p $(BOA_WORKDIR) + (cd $(BOA_WORKDIR) && CONFIG_SITE=$(SOURCE_DIR)/boa-config.site-$(ARCH) \ + CC=$(TARGET_CC) $(BOA_DIR)/configure) + touch $(BOA_WORKDIR)/.depend + +$(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer: $(BOA_WORKDIR)/Makefile + rm -f $@ + $(MAKE) VPATH=$(BOA_DIR)/src/ -C $(BOA_WORKDIR) + +$(BOA_WORKDIR)/.installed: $(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer + mkdir -p $(TARGET_DIR)/usr/sbin + cp -f $(BOA_WORKDIR)/src/boa $(TARGET_DIR)/usr/sbin/boa + mkdir -p $(TARGET_DIR)/usr/lib/boa + cp -f $(BOA_WORKDIR)/src/boa_indexer $(TARGET_DIR)/usr/lib/boa/boa_indexer + mkdir -p $(TARGET_DIR)/etc/boa + cp -f $(SOURCE_DIR)/boa.conf $(TARGET_DIR)/etc/boa + cp -f $(SOURCE_DIR)/mime.types $(TARGET_DIR)/etc/mime.types + strip --strip-all $(TARGET_DIR)/usr/sbin/boa $(TARGET_DIR)/usr/lib/boa/boa_indexer + touch $(BOA_WORKDIR)/.installed + +boa: uclibc $(BOA_WORKDIR)/.installed + +boa-source: $(DL_DIR)/$(BOA_SOURCE) + +boa-clean: + @if [ -d $(BOA_WORKDIR)/Makefile ] ; then \ + $(MAKE) -C $(BOA_WORKDIR) clean ; \ + fi; + +boa-dirclean: + rm -rf $(BOA_DIR) $(BOA_WORKDIR) + diff --git a/obsolete-buildroot/make/bridge.mk b/obsolete-buildroot/make/bridge.mk new file mode 100644 index 0000000000..7deb719605 --- /dev/null +++ b/obsolete-buildroot/make/bridge.mk @@ -0,0 +1,62 @@ +############################################################# +# +# bridgeutils - User Space Program For Controling Bridging +# +############################################################# +# +BRIDGE_SOURCE_URL=http://bridge.sourceforge.net/bridge-utils +BRIDGE_SOURCE=bridge-utils-0.9.6.tar.gz +BRIDGE_BUILD_DIR=$(BUILD_DIR)/bridge-utils-0.9.6 +BRIDGE_TARGET_BINARY:=usr/sbin/brctl + +$(DL_DIR)/$(BRIDGE_SOURCE): + $(WGET) -P $(DL_DIR) $(BRIDGE_SOURCE_URL)/$(BRIDGE_SOURCE) + +$(BRIDGE_BUILD_DIR)/.unpacked: $(DL_DIR)/$(BRIDGE_SOURCE) + zcat $(DL_DIR)/$(BRIDGE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + mv -f $(BUILD_DIR)/bridge-utils $(BRIDGE_BUILD_DIR) + patch -p1 -d $(BRIDGE_BUILD_DIR) < $(SOURCE_DIR)/bridge.patch + touch $(BRIDGE_BUILD_DIR)/.unpacked + +$(BRIDGE_BUILD_DIR)/.configured: $(BRIDGE_BUILD_DIR)/.unpacked + (cd $(BRIDGE_BUILD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --with-linux=$(LINUX_DIR) \ + ); + touch $(BRIDGE_BUILD_DIR)/.configured + +$(BRIDGE_BUILD_DIR)/brctl/brctl: $(BRIDGE_BUILD_DIR)/.configured + $(MAKE) -C $(BRIDGE_BUILD_DIR) + +$(TARGET_DIR)/$(BRIDGE_TARGET_BINARY): $(BRIDGE_BUILD_DIR)/brctl/brctl + cp -af $(BRIDGE_BUILD_DIR)/brctl/brctl $(TARGET_DIR)/$(BRIDGE_TARGET_BINARY) + $(STRIP) $(TARGET_DIR)/$(BRIDGE_TARGET_BINARY) + #cp -af $(BRIDGE_BUILD_DIR)/brctl/brctld $(TARGET_DIR)/usr/sbin/ + #$(STRIP) $(TARGET_DIR)/usr/sbin/brctld + +bridge: $(TARGET_DIR)/$(BRIDGE_TARGET_BINARY) + +bridge-source: $(DL_DIR)/$(BRIDGE_SOURCE) + +bridge-clean: + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BRIDGE_BUILD_DIR) uninstall + -$(MAKE) -C $(BRIDGE_BUILD_DIR) clean + +bridge-dirclean: + rm -rf $(BRIDGE_BUILD_DIR) diff --git a/obsolete-buildroot/make/busybox.mk b/obsolete-buildroot/make/busybox.mk new file mode 100644 index 0000000000..510489de39 --- /dev/null +++ b/obsolete-buildroot/make/busybox.mk @@ -0,0 +1,59 @@ +############################################################# +# +# busybox +# +############################################################# + +ifneq ($(strip $(USE_BUSYBOX_SNAPSHOT)),) +# Be aware that this changes daily.... +BUSYBOX_DIR:=$(BUILD_DIR)/busybox +BUSYBOX_SOURCE:=busybox-$(strip $(USE_BUSYBOX_SNAPSHOT)).tar.bz2 +BUSYBOX_SITE:=http://www.busybox.net/downloads/snapshots +else +BUSYBOX_DIR:=$(BUILD_DIR)/busybox-1.00-pre8 +BUSYBOX_SOURCE:=busybox-1.00-pre8.tar.bz2 +BUSYBOX_SITE:=http://www.busybox.net/downloads +endif +BUSYBOX_UNZIP=bzcat +BUSYBOX_CONFIG:=$(SOURCE_DIR)/busybox.config + +$(DL_DIR)/$(BUSYBOX_SOURCE): + $(WGET) -P $(DL_DIR) $(BUSYBOX_SITE)/$(BUSYBOX_SOURCE) + +busybox-source: $(DL_DIR)/$(BUSYBOX_SOURCE) $(BUSYBOX_CONFIG) + +$(BUSYBOX_DIR)/.configured: $(DL_DIR)/$(BUSYBOX_SOURCE) $(BUSYBOX_CONFIG) + $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # Allow busybox patches. + $(SOURCE_DIR)/patch-kernel.sh $(BUSYBOX_DIR) $(SOURCE_DIR) busybox-*.patch + cp $(BUSYBOX_CONFIG) $(BUSYBOX_DIR)/.config + $(SED) "s,^CROSS.*,CROSS=$(TARGET_CROSS)\n\ + PREFIX=$(TARGET_DIR),;" $(BUSYBOX_DIR)/Rules.mak +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) + $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=y/;" $(BUSYBOX_DIR)/.config +else + $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=n/;" $(BUSYBOX_DIR)/.config +endif + $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_DIR) oldconfig + touch $(BUSYBOX_DIR)/.configured + +busybox-unpack: $(BUSYBOX_DIR)/.configured + +$(BUSYBOX_DIR)/busybox: $(BUSYBOX_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS) -fomit-frame-pointer" -C $(BUSYBOX_DIR) + +$(TARGET_DIR)/bin/busybox: $(BUSYBOX_DIR)/busybox + $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" PREFIX="$(TARGET_DIR)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS)" -C $(BUSYBOX_DIR) install + # Just in case + -chmod a+x $(TARGET_DIR)/usr/share/udhcpc/default.script + +busybox: uclibc $(TARGET_DIR)/bin/busybox + +busybox-clean: + rm -f $(TARGET_DIR)/bin/busybox + -$(MAKE) -C $(BUSYBOX_DIR) clean + +busybox-dirclean: + rm -rf $(BUSYBOX_DIR) diff --git a/obsolete-buildroot/make/bzip2.mk b/obsolete-buildroot/make/bzip2.mk new file mode 100644 index 0000000000..299105a911 --- /dev/null +++ b/obsolete-buildroot/make/bzip2.mk @@ -0,0 +1,86 @@ +############################################################# +# +# bzip2 +# +############################################################# +BZIP2_SOURCE:=bzip2-1.0.2.tar.gz +BZIP2_SITE:=ftp://sources.redhat.com/pub/bzip2/v102 +BZIP2_DIR:=$(BUILD_DIR)/bzip2-1.0.2 +BZIP2_CAT:=zcat +BZIP2_BINARY:=$(BZIP2_DIR)/bzip2 +BZIP2_TARGET_BINARY:=$(TARGET_DIR)/usr/bin/bzmore + +$(DL_DIR)/$(BZIP2_SOURCE): + $(WGET) -P $(DL_DIR) $(BZIP2_SITE)/$(BZIP2_SOURCE) + +bzip2-source: $(DL_DIR)/$(BZIP2_SOURCE) + +$(BZIP2_DIR)/.unpacked: $(DL_DIR)/$(BZIP2_SOURCE) + $(BZIP2_CAT) $(DL_DIR)/$(BZIP2_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SED) "s,ln \$$(,ln -sf \$$(,g" $(BZIP2_DIR)/Makefile + $(SED) "s,ln -s (lib.*),ln -sf \$$1 ; ln -sf libbz2.so.1.0.2 libbz2.so,g" \ + $(BZIP2_DIR)/Makefile-libbz2_so +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),false) + $(SED) "s,^BIGFILES,#BIGFILES,g" $(BZIP2_DIR)/Makefile + $(SED) "s,^BIGFILES,#BIGFILES,g" $(BZIP2_DIR)/Makefile-libbz2_so +endif + touch $(BZIP2_DIR)/.unpacked + +$(STAGING_DIR)/lib/libbz2.so.1.0.2: $(BZIP2_DIR)/.unpacked + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) CC=$(TARGET_CC) -C $(BZIP2_DIR) -f Makefile-libbz2_so + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) CC=$(TARGET_CC) -C $(BZIP2_DIR) libbz2.a + cp $(BZIP2_DIR)/bzlib.h $(STAGING_DIR)/include/ + cp $(BZIP2_DIR)/libbz2.so.1.0.2 $(STAGING_DIR)/lib/ + cp $(BZIP2_DIR)/libbz2.a $(STAGING_DIR)/lib/ + (cd $(STAGING_DIR)/lib/; ln -sf libbz2.so.1.0.2 libbz2.so) + (cd $(STAGING_DIR)/lib/; ln -sf libbz2.so.1.0.2 libbz2.so.1.0) + +$(BZIP2_BINARY): $(STAGING_DIR)/lib/libbz2.so.1.0.2 + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) CC=$(TARGET_CC) -C $(BZIP2_DIR) bzip2 bzip2recover + +$(BZIP2_TARGET_BINARY): $(BZIP2_BINARY) + (cd $(TARGET_DIR)/usr/bin; \ + rm -f bzip2 bunzip2 bzcat bzip2recover bzgrep bzegrep bzfgrep bzmore bzless bzdiff bzcmp); + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) PREFIX=$(TARGET_DIR)/usr -C $(BZIP2_DIR) install + rm -f $(TARGET_DIR)/usr/lib/libbz2.a + rm -f $(TARGET_DIR)/usr/include/bzlib.h + cp $(BZIP2_DIR)/libbz2.so.1.0.2 $(TARGET_DIR)/usr/lib/ + (cd $(TARGET_DIR)/usr/lib; \ + ln -sf libbz2.so.1.0.2 libbz2.so.1.0; \ + ln -sf libbz2.so.1.0.2 libbz2.so) + (cd $(TARGET_DIR)/usr/bin; \ + ln -sf bzip2 bunzip2; \ + ln -sf bzip2 bzcat; \ + ln -sf bzdiff bzcmp; \ + ln -sf bzmore bzless; \ + ln -sf bzgrep bzegrep; \ + ln -sf bzgrep bzfgrep;) + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +$(TARGET_DIR)/usr/lib/libbz2.a: $(STAGING_DIR)/lib/libbz2.a + mkdir -p $(TARGET_DIR)/usr/include + cp $(STAGING_DIR)/include/bzlib.h $(TARGET_DIR)/usr/include/ + cp $(STAGING_DIR)/lib/libbz2.a $(TARGET_DIR)/usr/lib/ + rm -f $(TARGET_DIR)/lib/libbz2.so + (cd $(TARGET_DIR)/usr/lib; \ + ln -fs /usr/lib/libbz2.so.1.0 libbz2.so; \ + ) + -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libbz2.so.1.0 + touch -c $(TARGET_DIR)/usr/lib/libbz2.a + +bzip2-headers: $(TARGET_DIR)/usr/lib/libbz2.a + +bzip2: uclibc $(BZIP2_TARGET_BINARY) + +bzip2-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(BZIP2_DIR) uninstall + -$(MAKE) -C $(BZIP2_DIR) clean + +bzip2-dirclean: + rm -rf $(BZIP2_DIR) + diff --git a/obsolete-buildroot/make/ccache.mk b/obsolete-buildroot/make/ccache.mk new file mode 100644 index 0000000000..f973a529e5 --- /dev/null +++ b/obsolete-buildroot/make/ccache.mk @@ -0,0 +1,147 @@ +############################################################# +# +# build ccache to make recompiles faster on the build system +# +############################################################# +CCACHE_SITE:=http://ccache.samba.org/ftp/ccache +CCACHE_SOURCE:=ccache-2.3.tar.gz +CCACHE_DIR1:=$(TOOL_BUILD_DIR)/ccache-2.3 +CCACHE_DIR2:=$(BUILD_DIR)/ccache-2.3 +CCACHE_CAT:=zcat +CCACHE_BINARY:=ccache +CCACHE_TARGET_BINARY:=usr/bin/ccache + +$(DL_DIR)/$(CCACHE_SOURCE): + $(WGET) -P $(DL_DIR) $(CCACHE_SITE)/$(CCACHE_SOURCE) + +$(CCACHE_DIR1)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE) + $(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(CCACHE_DIR1)/.unpacked + +$(CCACHE_DIR1)/.patched: $(CCACHE_DIR1)/.unpacked + $(SED) "s,getenv(\"CCACHE_PATH\"),\"$(STAGING_DIR)/usr/bin\",g" \ + $(CCACHE_DIR1)/execute.c + $(SED) "s,getenv(\"CCACHE_DIR\"),\"$(CCACHE_DIR1)/cache\",g" \ + $(CCACHE_DIR1)/ccache.c + mkdir -p $(CCACHE_DIR1)/cache + touch $(CCACHE_DIR1)/.patched + +$(CCACHE_DIR1)/.configured: $(CCACHE_DIR1)/.patched + mkdir -p $(CCACHE_DIR1) + (cd $(CCACHE_DIR1); rm -rf config.cache; \ + CC=$(HOSTCC) \ + $(CCACHE_DIR1)/configure \ + --target=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + ); + touch $(CCACHE_DIR1)/.configured + +$(CCACHE_DIR1)/$(CCACHE_BINARY): $(CCACHE_DIR1)/.configured + $(MAKE) CC=$(HOSTCC) -C $(CCACHE_DIR1) + +$(STAGING_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR1)/$(CCACHE_BINARY) + mkdir -p $(STAGING_DIR)/usr/bin; + mkdir -p $(TOOL_BUILD_DIR)/.ccache; + cp $(CCACHE_DIR1)/ccache $(STAGING_DIR)/usr/bin + (cd $(STAGING_DIR)/usr/bin; \ + ln -fs $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(OPTIMIZE_FOR_CPU)-linux-gcc; \ + ln -fs $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(OPTIMIZE_FOR_CPU)-linux-cc; \ + ln -fs $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(OPTIMIZE_FOR_CPU)-linux-uclibc-cc); + [ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc ] && \ + mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(STAGING_DIR)/usr/bin/ + (cd $(STAGING_DIR)/bin; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-cc; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-gcc; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-cc; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc); +ifeq ($(INSTALL_LIBSTDCPP),true) + [ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-c++ ] && \ + mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-c++ $(STAGING_DIR)/usr/bin/ + [ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-g++ ] && \ + mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-g++ $(STAGING_DIR)/usr/bin/ + (cd $(STAGING_DIR)/bin; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-c++; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-g++;\ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-c++; \ + ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-g++); +endif + +ifeq ($(GCC_2_95_TOOLCHAIN),true) +ccache: gcc2_95 $(STAGING_DIR)/$(CCACHE_TARGET_BINARY) +else +ccache: gcc3_3 $(STAGING_DIR)/$(CCACHE_TARGET_BINARY) +endif + +ccache-clean: + $(MAKE) -C $(CCACHE_DIR1) uninstall + -$(MAKE) -C $(CCACHE_DIR1) clean + +ccache-dirclean: + rm -rf $(CCACHE_DIR1) + + + + +############################################################# +# +# build ccache for use on the target system +# +############################################################# + +$(CCACHE_DIR2)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE) + $(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(CCACHE_DIR2)/.unpacked + +$(CCACHE_DIR2)/.patched: $(CCACHE_DIR2)/.unpacked + touch $(CCACHE_DIR2)/.patched + +$(CCACHE_DIR2)/.configured: $(CCACHE_DIR2)/.patched + mkdir -p $(CCACHE_DIR2) + (cd $(CCACHE_DIR2); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + $(CCACHE_DIR2)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(CCACHE_DIR2)/.configured + +$(CCACHE_DIR2)/$(CCACHE_BINARY): $(CCACHE_DIR2)/.configured + $(MAKE) -C $(CCACHE_DIR2) + +$(TARGET_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR2)/$(CCACHE_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(CCACHE_DIR2) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + # put a bunch of symlinks into /bin, since that is earlier + # in the default PATH than /usr/bin where gcc lives + (cd $(TARGET_DIR)/bin; \ + ln -fs /usr/bin/ccache cc; \ + ln -fs /usr/bin/ccache gcc; \ + ln -fs /usr/bin/ccache c++; \ + ln -fs /usr/bin/ccache g++;) + +ccache_target: uclibc $(TARGET_DIR)/$(CCACHE_TARGET_BINARY) + +ccache_target-sources: $(DL_DIR)/$(CCACHE_SOURCE) + +ccache_target-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(CCACHE_DIR2) uninstall + -$(MAKE) -C $(CCACHE_DIR2) clean + +ccache_target-dirclean: + rm -rf $(CCACHE_DIR2) + diff --git a/obsolete-buildroot/make/coreutils.mk b/obsolete-buildroot/make/coreutils.mk new file mode 100644 index 0000000000..825c0f3549 --- /dev/null +++ b/obsolete-buildroot/make/coreutils.mk @@ -0,0 +1,82 @@ +############################################################# +# +# coreutils +# +############################################################# +COREUTILS_SOURCE:=coreutils-5.0.tar.bz2 +COREUTILS_SITE:=ftp://ftp.gnu.org/gnu/coreutils/ +COREUTILS_CAT:=bzcat +COREUTILS_DIR:=$(BUILD_DIR)/coreutils-5.0 +COREUTILS_BINARY:=src/vdir +COREUTILS_TARGET_BINARY:=bin/vdir +BIN_PROGS:=cat chgrp chmod chown cp date dd df dir echo false hostname \ + ln ls mkdir mknod mv pwd rm rmdir vdir sleep stty sync touch true uname + +$(DL_DIR)/$(COREUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(COREUTILS_SITE)/$(COREUTILS_SOURCE) + +coreutils-source: $(DL_DIR)/$(COREUTILS_SOURCE) + +$(COREUTILS_DIR)/.unpacked: $(DL_DIR)/$(COREUTILS_SOURCE) + $(COREUTILS_CAT) $(DL_DIR)/$(COREUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(COREUTILS_DIR)/.unpacked + +$(COREUTILS_DIR)/.configured: $(COREUTILS_DIR)/.unpacked + (cd $(COREUTILS_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --disable-rpath \ + --disable-dependency-tracking \ + ); + #Fix up the max number of open files per process, which apparently + # is not set when cross compiling + $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \ + $(COREUTILS_DIR)/config.h + # This is undefined when crosscompiling... + $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \ + $(COREUTILS_DIR)/config.h + touch $(COREUTILS_DIR)/.configured + +$(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR) + rm -f $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY) + +$(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install + # some things go in root rather than usr + for f in $(BIN_PROGS); do \ + mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \ + done + # link for archaic shells + ln -fs test $(TARGET_DIR)/usr/bin/[ + # gnu thinks chroot is in bin, debian thinks it's in sbin + mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot + $(STRIP) $(TARGET_DIR)/usr/sbin/chroot > /dev/null 2>&1 + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY) + +coreutils-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall + -$(MAKE) -C $(COREUTILS_DIR) clean + +coreutils-dirclean: + rm -rf $(COREUTILS_DIR) + diff --git a/obsolete-buildroot/make/cramfsroot.mk b/obsolete-buildroot/make/cramfsroot.mk new file mode 100644 index 0000000000..0f1204a258 --- /dev/null +++ b/obsolete-buildroot/make/cramfsroot.mk @@ -0,0 +1,52 @@ +############################################################# +# +# mkcramfs to build to target cramfs filesystems +# +############################################################# +CRAMFS_DIR=$(BUILD_DIR)/cramfs-1.1 +CRAMFS_SOURCE=cramfs-1.1.tar.gz +CRAMFS_SITE=http://aleron.dl.sourceforge.net/sourceforge/cramfs +CRAMFS_PATCH=$(SOURCE_DIR)/cramfs.patch + +$(DL_DIR)/$(CRAMFS_SOURCE): + $(WGET) -P $(DL_DIR) $(CRAMFS_SITE)/$(CRAMFS_SOURCE) + +$(CRAMFS_DIR): $(DL_DIR)/$(CRAMFS_SOURCE) $(CRAMFS_PATCH) + zcat $(DL_DIR)/$(CRAMFS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(CRAMFS_PATCH) | patch -p1 -d $(CRAMFS_DIR) + +$(CRAMFS_DIR)/mkcramfs: $(CRAMFS_DIR) + $(MAKE) CFLAGS="-Wall -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" -C $(CRAMFS_DIR); + touch -c $(CRAMFS_DIR)/mkcramfs + +cramfs: $(CRAMFS_DIR)/mkcramfs + +cramfs-source: $(DL_DIR)/$(CRAMFS_SOURCE) + +cramfs-clean: + -$(MAKE) -C $(CRAMFS_DIR) clean + +cramfs-dirclean: + rm -rf $(CRAMFS_DIR) + +############################################################# +# +# Build the cramfs root filesystem image +# +############################################################# + +cramfsroot: cramfs + #-@find $(TARGET_DIR)/lib -type f -name \*.so\* | xargs $(STRIP) --strip-unneeded 2>/dev/null || true; + -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true; + @rm -rf $(TARGET_DIR)/usr/man + @rm -rf $(TARGET_DIR)/usr/info + $(CRAMFS_DIR)/mkcramfs -q -D $(SOURCE_DIR)/device_table.txt $(TARGET_DIR) $(IMAGE) + +cramfsroot-source: cramfs-source + +cramfsroot-clean: + -$(MAKE) -C $(CRAMFS_DIR) clean + +cramfsroot-dirclean: + rm -rf $(CRAMFS_DIR) + diff --git a/obsolete-buildroot/make/customize.mk b/obsolete-buildroot/make/customize.mk new file mode 100644 index 0000000000..2cfed18345 --- /dev/null +++ b/obsolete-buildroot/make/customize.mk @@ -0,0 +1,10 @@ +############################################################# +# +# Any custom stuff you feel like doing.... +# +############################################################# +CUST_DIR:=$(SOURCE_DIR)/customize +ROOT_DIR:=$(BUILD_DIR)/root + +customize: + cp -af $(CUST_DIR)/* $(ROOT_DIR)/ diff --git a/obsolete-buildroot/make/dhcp_relay.mk b/obsolete-buildroot/make/dhcp_relay.mk new file mode 100644 index 0000000000..8252b4aebd --- /dev/null +++ b/obsolete-buildroot/make/dhcp_relay.mk @@ -0,0 +1,47 @@ +############################################################# +# +# dhcp_relay +# +############################################################# +DHCP_RELAY_SOURCE:=dhcp-3.0pl2.tar.gz +DHCP_RELAY_SITE:=ftp://ftp.isc.org/isc/dhcp +DHCP_RELAY_CAT:=zcat +DHCP_RELAY_DIR:=$(BUILD_DIR)/dhcp-3.0pl2 +DHCP_RELAY_BINARY:=work.linux-2.2/relay/dhcrelay +DHCP_RELAY_TARGET_BINARY:=usr/sbin/dhcrelay +BVARS=PREDEFINES='-D_PATH_DHCPD_DB=\"/var/lib/dhcp/dhcpd.leases\" \ + -D_PATH_DHCLIENT_DB=\"/var/lib/dhcp/dhclient.leases\"' \ + VARDB=/var/lib/dhcp + +$(DL_DIR)/$(DHCP_RELAY_SOURCE): + $(WGET) -P $(DL_DIR) $(DHCP_RELAY_SITE)/$(DHCP_RELAY_SOURCE) + +dhcp_relay-source: $(DL_DIR)/$(DHCP_RELAY_SOURCE) + +$(DHCP_RELAY_DIR)/.unpacked: $(DL_DIR)/$(DHCP_RELAY_SOURCE) + $(DHCP_RELAY_CAT) $(DL_DIR)/$(DHCP_RELAY_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(DHCP_RELAY_DIR)/.unpacked + +$(DHCP_RELAY_DIR)/.configured: $(DHCP_RELAY_DIR)/.unpacked + (cd $(DHCP_RELAY_DIR); $(TARGET_CONFIGURE_OPTS) ./configure ); + touch $(DHCP_RELAY_DIR)/.configured + +$(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY): $(DHCP_RELAY_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) $(BVARS) -C $(DHCP_RELAY_DIR) + $(STRIP) $(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY) + +$(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY): $(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY) + (cd $(TARGET_DIR)/var/lib; ln -sf /tmp dhcp) + cp -a $(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY) $(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY) + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +dhcp_relay: uclibc $(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY) + +dhcp_relay-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(DHCP_RELAY_DIR) uninstall + -$(MAKE) -C $(DHCP_RELAY_DIR) clean + +dhcp_relay-dirclean: + rm -rf $(DHCP_RELAY_DIR) + diff --git a/obsolete-buildroot/make/diffutils.mk b/obsolete-buildroot/make/diffutils.mk new file mode 100644 index 0000000000..0019bd8d44 --- /dev/null +++ b/obsolete-buildroot/make/diffutils.mk @@ -0,0 +1,61 @@ +############################################################# +# +# diffutils +# +############################################################# +DIFFUTILS_SOURCE:=diffutils-2.8.4.tar.gz +DIFFUTILS_SITE:=ftp://alpha.gnu.org/gnu/diffutils/ +DIFFUTILS_CAT:=zcat +DIFFUTILS_DIR:=$(BUILD_DIR)/diffutils-2.8.4 +DIFFUTILS_BINARY:=src/diff +DIFFUTILS_TARGET_BINARY:=usr/bin/diff + +$(DL_DIR)/$(DIFFUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(DIFFUTILS_SITE)/$(DIFFUTILS_SOURCE) + +diffutils-source: $(DL_DIR)/$(DIFFUTILS_SOURCE) + +$(DIFFUTILS_DIR)/.unpacked: $(DL_DIR)/$(DIFFUTILS_SOURCE) + $(DIFFUTILS_CAT) $(DL_DIR)/$(DIFFUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(DIFFUTILS_DIR)/.unpacked + +$(DIFFUTILS_DIR)/.configured: $(DIFFUTILS_DIR)/.unpacked + (cd $(DIFFUTILS_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(DIFFUTILS_DIR)/.configured + +$(DIFFUTILS_DIR)/$(DIFFUTILS_BINARY): $(DIFFUTILS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(DIFFUTILS_DIR) + +$(TARGET_DIR)/$(DIFFUTILS_TARGET_BINARY): $(DIFFUTILS_DIR)/$(DIFFUTILS_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(DIFFUTILS_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +diffutils: uclibc $(TARGET_DIR)/$(DIFFUTILS_TARGET_BINARY) + +diffutils-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(DIFFUTILS_DIR) uninstall + -$(MAKE) -C $(DIFFUTILS_DIR) clean + +diffutils-dirclean: + rm -rf $(DIFFUTILS_DIR) + diff --git a/obsolete-buildroot/make/dnsmasq.mk b/obsolete-buildroot/make/dnsmasq.mk new file mode 100644 index 0000000000..7944d62114 --- /dev/null +++ b/obsolete-buildroot/make/dnsmasq.mk @@ -0,0 +1,50 @@ +############################################################# +# +# dnsmasq +# +############################################################# + +DNSMASQ_SITE=http://thekelleys.org.uk/dnsmasq +ifeq ($(filter $(TARGETS),dnsmasq1),) +DNSMASQ_SOURCE=dnsmasq-2.6.tar.gz +DNSMASQ_DIR=$(BUILD_DIR)/dnsmasq-2.6 +DNSMASQ_VER=dnsmasq2 +else +DNSMASQ_SOURCE=dnsmasq-1.18.tar.gz +DNSMASQ_DIR=$(BUILD_DIR)/dnsmasq-1.18 +DNSMASQ_VER=dnsmasq1 +endif +DNSMASQ_BINARY=dnsmasq +DNSMASQ_TARGET_BINARY=usr/sbin/dnsmasq + +$(DL_DIR)/$(DNSMASQ_SOURCE): + $(WGET) -P $(DL_DIR) $(DNSMASQ_SITE)/$(DNSMASQ_SOURCE) + +$(DNSMASQ_DIR)/.source: $(DL_DIR)/$(DNSMASQ_SOURCE) + zcat $(DL_DIR)/$(DNSMASQ_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SOURCE_DIR)/patch-kernel.sh $(DNSMASQ_DIR) $(SOURCE_DIR) \ + $(DNSMASQ_VER)-*.patch + touch $(DNSMASQ_DIR)/.source + +$(DNSMASQ_DIR)/$(DNSMASQ_BINARY): $(DNSMASQ_DIR)/.source + $(MAKE) CC=$(TARGET_CC) CFLAGS="$(TARGET_CFLAGS)" \ + BINDIR=/usr/sbin MANDIR=/usr/man -C $(DNSMASQ_DIR) + +$(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY): $(DNSMASQ_DIR)/$(DNSMASQ_BINARY) + $(MAKE) BINDIR=/usr/sbin MANDIR=/usr/man \ + DESTDIR=$(TARGET_DIR) -C $(DNSMASQ_DIR) install + $(STRIP) $(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY) + rm -rf $(TARGET_DIR)/usr/man + +dnsmasq: uclibc $(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY) + +dnsmasq1: uclibc $(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY) + +dnsmasq-source: $(DL_DIR)/$(DNSMASQ_SOURCE) + +dnsmasq-clean: + #$(MAKE) prefix=$(TARGET_DIR)/usr -C $(DNSMASQ_DIR) uninstall + -$(MAKE) -C $(DNSMASQ_DIR) clean + +dnsmasq-dirclean: + rm -rf $(DNSMASQ_DIR) diff --git a/obsolete-buildroot/make/dropbear_sshd.mk b/obsolete-buildroot/make/dropbear_sshd.mk new file mode 100644 index 0000000000..d694508f92 --- /dev/null +++ b/obsolete-buildroot/make/dropbear_sshd.mk @@ -0,0 +1,74 @@ +############################################################# +# +# dropbear_sshd +# +############################################################# +DROPBEAR_SSHD_SOURCE:=dropbear-0.41.tar.bz2 +DROPBEAR_SSHD_SITE:=http://matt.ucc.asn.au/dropbear/releases/ +DROPBEAR_SSHD_DIR:=$(BUILD_DIR)/dropbear-0.41 +DROPBEAR_SSHD_CAT:=bzcat +DROPBEAR_SSHD_BINARY:=dropbearmulti +DROPBEAR_SSHD_TARGET_BINARY:=usr/sbin/dropbear + + +$(DL_DIR)/$(DROPBEAR_SSHD_SOURCE): + $(WGET) -P $(DL_DIR) $(DROPBEAR_SSHD_SITE)/$(DROPBEAR_SSHD_SOURCE) + +dropbear_sshd-source: $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE) + +$(DROPBEAR_SSHD_DIR)/.unpacked: $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE) + $(DROPBEAR_SSHD_CAT) $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SOURCE_DIR)/patch-kernel.sh $(DROPBEAR_SSHD_DIR) $(SOURCE_DIR) dropbear-*.patch + $(SED) 's,^/\* #define DROPBEAR_MULTI.*,#define DROPBEAR_MULTI,g' $(DROPBEAR_SSHD_DIR)/options.h + touch $(DROPBEAR_SSHD_DIR)/.unpacked + +$(DROPBEAR_SSHD_DIR)/.configured: $(DROPBEAR_SSHD_DIR)/.unpacked + (cd $(DROPBEAR_SSHD_DIR); rm -rf config.cache; \ + autoconf; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --with-shared \ + ); + touch $(DROPBEAR_SSHD_DIR)/.configured + +$(DROPBEAR_SSHD_DIR)/$(DROPBEAR_SSHD_BINARY): $(DROPBEAR_SSHD_DIR)/.configured + $(MAKE) $(TARGET_CONFIGURE_OPTS) LD=$(TARGET_CC) \ + -C $(DROPBEAR_SSHD_DIR) dropbearmulti + +$(TARGET_DIR)/$(DROPBEAR_SSHD_TARGET_BINARY): $(DROPBEAR_SSHD_DIR)/$(DROPBEAR_SSHD_BINARY) + #$(MAKE) DESTDIR=$(TARGET_DIR) $(TARGET_CONFIGURE_OPTS) \ + # LD=$(TARGET_CC) -C $(DROPBEAR_SSHD_DIR) install + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + install -d -m 755 $(TARGET_DIR)/usr/sbin + install -d -m 755 $(TARGET_DIR)/usr/bin + install -m 755 $(DROPBEAR_SSHD_DIR)/$(DROPBEAR_SSHD_BINARY) \ + $(TARGET_DIR)/$(DROPBEAR_SSHD_TARGET_BINARY) + ln -sf ../sbin/dropbear $(TARGET_DIR)/usr/bin/dropbearkey + ln -sf ../sbin/dropbear $(TARGET_DIR)/usr/bin/dropbearconvert + +dropbear_sshd: uclibc zlib $(TARGET_DIR)/$(DROPBEAR_SSHD_TARGET_BINARY) + +dropbear_sshd-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) $(TARGET_CONFIGURE_OPTS) \ + LD=$(TARGET_CC) -C $(DROPBEAR_SSHD_DIR) uninstall + -$(MAKE) -C $(DROPBEAR_SSHD_DIR) clean + +dropbear_sshd-dirclean: + rm -rf $(DROPBEAR_SSHD_DIR) + diff --git a/obsolete-buildroot/make/ed.mk b/obsolete-buildroot/make/ed.mk new file mode 100644 index 0000000000..de6c3cb251 --- /dev/null +++ b/obsolete-buildroot/make/ed.mk @@ -0,0 +1,55 @@ +############################################################# +# +# ed +# +############################################################# +ED_SOURCE:=ed_0.2.orig.tar.gz +ED_PATCH:=ed_0.2-19.diff.gz +ED_SITE:=http://ftp.debian.org/debian/pool/main/e/ed +ED_CAT:=zcat +ED_DIR:=$(BUILD_DIR)/ed-0.2 +ED_BINARY:=ed +ED_TARGET_BINARY:=bin/ed + +$(DL_DIR)/$(ED_SOURCE): + $(WGET) -P $(DL_DIR) $(ED_SITE)/$(ED_SOURCE) + +$(DL_DIR)/$(ED_PATCH): + $(WGET) -P $(DL_DIR) $(ED_SITE)/$(ED_PATCH) + +ed-source: $(DL_DIR)/$(ED_SOURCE) $(DL_DIR)/$(ED_PATCH) + +$(ED_DIR)/.unpacked: $(DL_DIR)/$(ED_SOURCE) $(DL_DIR)/$(ED_PATCH) + $(ED_CAT) $(DL_DIR)/$(ED_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SOURCE_DIR)/patch-kernel.sh $(ED_DIR) $(DL_DIR) $(ED_PATCH) + touch $(ED_DIR)/.unpacked + +$(ED_DIR)/.configured: $(ED_DIR)/.unpacked + (cd $(ED_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + $(DISABLE_NLS) \ + ); + touch $(ED_DIR)/.configured + +$(ED_DIR)/$(ED_BINARY): $(ED_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(ED_DIR) + +$(TARGET_DIR)/$(ED_TARGET_BINARY): $(ED_DIR)/$(ED_BINARY) + cp -a $(ED_DIR)/$(ED_BINARY) $(TARGET_DIR)/$(ED_TARGET_BINARY) + +ed: uclibc $(TARGET_DIR)/$(ED_TARGET_BINARY) + +ed-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(ED_DIR) uninstall + -$(MAKE) -C $(ED_DIR) clean + +ed-dirclean: + rm -rf $(ED_DIR) + diff --git a/obsolete-buildroot/make/ext2root.mk b/obsolete-buildroot/make/ext2root.mk new file mode 100644 index 0000000000..0c66c18a9a --- /dev/null +++ b/obsolete-buildroot/make/ext2root.mk @@ -0,0 +1,56 @@ +############################################################# +# +# genext2fs to build to target ext2 filesystems +# +############################################################# +GENEXT2_DIR=$(BUILD_DIR)/genext2fs-1.3 +GENEXT2_SOURCE=genext2fs_1.3.orig.tar.gz +GENEXT2_SITE=http://ftp.debian.org/debian/pool/main/g/genext2fs +GENEXT2_PATCH=$(SOURCE_DIR)/genext2fs.patch + +$(DL_DIR)/$(GENEXT2_SOURCE): + $(WGET) -P $(DL_DIR) $(GENEXT2_SITE)/$(GENEXT2_SOURCE) + +$(GENEXT2_DIR): $(DL_DIR)/$(GENEXT2_SOURCE) $(GENEXT2_PATCH) + zcat $(DL_DIR)/$(GENEXT2_SOURCE) | tar -C $(BUILD_DIR) -xvf - + mv $(GENEXT2_DIR).orig $(GENEXT2_DIR) + cat $(GENEXT2_PATCH) | patch -p1 -d $(GENEXT2_DIR) + +$(GENEXT2_DIR)/genext2fs: $(GENEXT2_DIR) + $(MAKE) CFLAGS="-Wall -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \ + -D_FILE_OFFSET_BITS=64" -C $(GENEXT2_DIR); + touch -c $(GENEXT2_DIR)/genext2fs + +genext2fs: $(GENEXT2_DIR)/genext2fs + + + +############################################################# +# +# Build the ext2 root filesystem image +# +############################################################# + +# How much KB we want to add to the calculated size for slack space +#GENEXT2_ADDTOROOTSIZE=4096 +GENEXT2_ADDTOROOTSIZE=16384 +GENEXT2_REALSIZE=$(subst total,, $(shell LANG=C du $(TARGET_DIR) -s -c -k | grep total )) +GENEXT2_SIZE=$(shell expr $(GENEXT2_REALSIZE) + $(GENEXT2_ADDTOROOTSIZE)) +# We currently add about 400 device nodes, so add that into the total +GENEXT2_INODES=$(shell expr $(shell find $(TARGET_DIR) | wc -l) + 400) +#GENEXT2_SIZE=100000 + +ext2root: genext2fs + #-@find $(TARGET_DIR)/lib -type f -name \*.so\* | xargs $(STRIP) --strip-unneeded 2>/dev/null || true; + -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true; + $(GENEXT2_DIR)/genext2fs -i $(GENEXT2_INODES) -b $(GENEXT2_SIZE) \ + -d $(TARGET_DIR) -q -D $(SOURCE_DIR)/device_table.txt $(IMAGE) + +ext2root-source: $(DL_DIR)/$(GENEXT2_SOURCE) + +ext2root-clean: + -$(MAKE) -C $(GENEXT2_DIR) clean + +ext2root-dirclean: + rm -rf $(GENEXT2_DIR) + diff --git a/obsolete-buildroot/make/fakeroot.mk b/obsolete-buildroot/make/fakeroot.mk new file mode 100644 index 0000000000..f56105f7f8 --- /dev/null +++ b/obsolete-buildroot/make/fakeroot.mk @@ -0,0 +1,63 @@ +############################################################# +# +# fakeroot +# +############################################################# +FAKEROOT_SOURCE:=fakeroot_0.7.5.tar.gz +FAKEROOT_SITE:=http://ftp.debian.org/debian/pool/main/f/fakeroot +FAKEROOT_CAT:=zcat +FAKEROOT_DIR:=$(BUILD_DIR)/fakeroot-0.7.5 + + +$(DL_DIR)/$(FAKEROOT_SOURCE): + $(WGET) -P $(DL_DIR) $(FAKEROOT_SITE)/$(FAKEROOT_SOURCE) + +fakeroot-source: $(DL_DIR)/$(FAKEROOT_SOURCE) + +$(FAKEROOT_DIR)/.unpacked: $(DL_DIR)/$(FAKEROOT_SOURCE) + $(FAKEROOT_CAT) $(DL_DIR)/$(FAKEROOT_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # If using busybox getopt, make it be quiet. + $(SED) "s,getopt --version,getopt --version 2>/dev/null," \ + $(FAKEROOT_DIR)/scripts/fakeroot + touch $(FAKEROOT_DIR)/.unpacked + +$(FAKEROOT_DIR)/.configured: $(FAKEROOT_DIR)/.unpacked + (cd $(FAKEROOT_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libdir=/usr/lib/libfakeroot \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(FAKEROOT_DIR)/.configured + +$(FAKEROOT_DIR)/faked: $(FAKEROOT_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(FAKEROOT_DIR) + +$(TARGET_DIR)/usr/bin/fakeroot: $(FAKEROOT_DIR)/faked + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(FAKEROOT_DIR) install + -mv $(TARGET_DIR)/usr/bin/$(ARCH)-linux-faked $(TARGET_DIR)/usr/bin/faked + -mv $(TARGET_DIR)/usr/bin/$(ARCH)-linux-fakeroot $(TARGET_DIR)/usr/bin/fakeroot + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +fakeroot: uclibc $(TARGET_DIR)/usr/bin/fakeroot + +fakeroot-clean: + $(MAKE) -C $(FAKEROOT_DIR) clean + +fakeroot-dirclean: + rm -rf $(FAKEROOT_DIR) + + diff --git a/obsolete-buildroot/make/file.mk b/obsolete-buildroot/make/file.mk new file mode 100644 index 0000000000..e3ef381f40 --- /dev/null +++ b/obsolete-buildroot/make/file.mk @@ -0,0 +1,64 @@ +############################################################# +# +# file +# +############################################################# +FILE_SOURCE:=file-4.08.tar.gz +FILE_SITE:=ftp://ftp.astron.com/pub/file +FILE_DIR:=$(BUILD_DIR)/file-4.08 +FILE_CAT:=zcat +FILE_BINARY:=src/file +FILE_TARGET_BINARY:=usr/bin/file + +$(DL_DIR)/$(FILE_SOURCE): + $(WGET) -P $(DL_DIR) $(FILE_SITE)/$(FILE_SOURCE) + +file-source: $(DL_DIR)/$(FILE_SOURCE) + +$(FILE_DIR)/.unpacked: $(DL_DIR)/$(FILE_SOURCE) + $(FILE_CAT) $(DL_DIR)/$(FILE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(SOURCE_DIR)/file.patch | patch -p1 -d $(FILE_DIR) + touch $(FILE_DIR)/.unpacked + +$(FILE_DIR)/.configured: $(FILE_DIR)/.unpacked + (cd $(FILE_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share/misc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --disable-fsect-man5 \ + ); + touch $(FILE_DIR)/.configured + +$(FILE_DIR)/$(FILE_BINARY): $(FILE_DIR)/.configured + $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(FILE_DIR) + +$(TARGET_DIR)/$(FILE_TARGET_BINARY): $(FILE_DIR)/$(FILE_BINARY) + $(MAKE) $(TARGET_CONFIGURE_OPTS) DESTDIR=$(TARGET_DIR) -C $(FILE_DIR) install + -($(STRIP) $(TARGET_DIR)/usr/lib/libmagic.so.*.* > /dev/null 2>&1) + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +file: zlib uclibc $(TARGET_DIR)/$(FILE_TARGET_BINARY) + +file-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(FILE_DIR) uninstall + -$(MAKE) -C $(FILE_DIR) clean + +file-dirclean: + rm -rf $(FILE_DIR) + diff --git a/obsolete-buildroot/make/findutils.mk b/obsolete-buildroot/make/findutils.mk new file mode 100644 index 0000000000..0a68a13454 --- /dev/null +++ b/obsolete-buildroot/make/findutils.mk @@ -0,0 +1,70 @@ +############################################################# +# +# findutils +# +############################################################# +FINDUTILS_SOURCE:=findutils_4.1.7.orig.tar.gz +FINDUTILS_SITE:=http://ftp.debian.org/debian/pool/main/f/findutils +FINDUTILS_CAT:=zcat +FINDUTILS_DIR:=$(BUILD_DIR)/findutils-4.1.7 +FINDUTILS_BINARY:=find/find +FINDUTILS_TARGET_BINARY:=usr/bin/find + +$(DL_DIR)/$(FINDUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(FINDUTILS_SITE)/$(FINDUTILS_SOURCE) + +findutils-source: $(DL_DIR)/$(FINDUTILS_SOURCE) + +$(FINDUTILS_DIR)/.unpacked: $(DL_DIR)/$(FINDUTILS_SOURCE) + $(FINDUTILS_CAT) $(DL_DIR)/$(FINDUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + mv $(FINDUTILS_DIR).orig $(FINDUTILS_DIR) + touch $(FINDUTILS_DIR)/.unpacked + +$(FINDUTILS_DIR)/.configured: $(FINDUTILS_DIR)/.unpacked + (cd $(FINDUTILS_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ac_cv_func_setvbuf_reversed=no \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib/locate \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var/lib \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(FINDUTILS_DIR)/.configured + +$(FINDUTILS_DIR)/$(FINDUTILS_BINARY): $(FINDUTILS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(FINDUTILS_DIR) + +# This stuff is needed to work around GNU make deficiencies +findutils-target_binary: $(FINDUTILS_DIR)/$(FINDUTILS_BINARY) + @if [ -L $(TARGET_DIR)/$(FINDUTILS_TARGET_BINARY) ] ; then \ + rm -f $(TARGET_DIR)/$(FINDUTILS_TARGET_BINARY); fi; + @if [ ! -f $(FINDUTILS_DIR)/$(FINDUTILS_BINARY) -o $(TARGET_DIR)/$(FINDUTILS_TARGET_BINARY) \ + -ot $(FINDUTILS_DIR)/$(FINDUTILS_BINARY) ] ; then \ + set -x; \ + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(FINDUTILS_DIR) install; \ + $(STRIP) $(TARGET_DIR)/usr/lib/locate/* > /dev/null 2>&1; \ + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc; fi; + +findutils: uclibc findutils-target_binary + +findutils-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(FINDUTILS_DIR) uninstall + -$(MAKE) -C $(FINDUTILS_DIR) clean + +findutils-dirclean: + rm -rf $(FINDUTILS_DIR) + diff --git a/obsolete-buildroot/make/flex.mk b/obsolete-buildroot/make/flex.mk new file mode 100644 index 0000000000..a29fa5875e --- /dev/null +++ b/obsolete-buildroot/make/flex.mk @@ -0,0 +1,81 @@ +############################################################# +# +# flex +# +############################################################# +FLEX_SOURCE:=flex_2.5.4a.orig.tar.gz +FLEX_PATCH:=flex_2.5.4a-24.diff.gz +FLEX_SITE:=http://ftp.debian.org/debian/pool/main/f/flex +FLEX_DIR:=$(BUILD_DIR)/flex-2.5.4 +FLEX_CAT:=zcat +FLEX_BINARY:=flex +FLEX_TARGET_BINARY:=usr/bin/flex + +$(DL_DIR)/$(FLEX_SOURCE): + $(WGET) -P $(DL_DIR) $(FLEX_SITE)/$(FLEX_SOURCE) + +$(DL_DIR)/$(FLEX_PATCH): + $(WGET) -P $(DL_DIR) $(FLEX_SITE)/$(FLEX_PATCH) + +flex-source: $(DL_DIR)/$(FLEX_SOURCE) $(DL_DIR)/$(FLEX_PATCH) + +$(FLEX_DIR)/.unpacked: $(DL_DIR)/$(FLEX_SOURCE) $(DL_DIR)/$(FLEX_PATCH) + $(FLEX_CAT) $(DL_DIR)/$(FLEX_SOURCE) | tar -C $(BUILD_DIR) -xvf - + #$(SOURCE_DIR)/patch-kernel.sh $(FLEX_DIR) $(DL_DIR) $(FLEX_PATCH) + touch $(FLEX_DIR)/.unpacked + +$(FLEX_DIR)/.configured: $(FLEX_DIR)/.unpacked + (cd $(FLEX_DIR); autoconf; rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(FLEX_DIR)/.configured + +$(FLEX_DIR)/$(FLEX_BINARY): $(FLEX_DIR)/.configured + $(MAKE) -C $(FLEX_DIR) + +$(TARGET_DIR)/$(FLEX_TARGET_BINARY): $(FLEX_DIR)/$(FLEX_BINARY) + $(MAKE) \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + bindir=$(TARGET_DIR)/usr/bin \ + sbindir=$(TARGET_DIR)/usr/sbin \ + libexecdir=$(TARGET_DIR)/usr/lib \ + datadir=$(TARGET_DIR)/usr/share \ + sysconfdir=$(TARGET_DIR)/etc \ + sharedstatedir=$(TARGET_DIR)/usr/com \ + localstatedir=$(TARGET_DIR)/var \ + libdir=$(TARGET_DIR)/usr/lib \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(TARGET_DIR)/usr/include \ + -C $(FLEX_DIR) install; + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + (cd $(TARGET_DIR)/usr/bin; ln -s flex lex) + +flex: uclibc $(TARGET_DIR)/$(FLEX_TARGET_BINARY) + +flex-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(FLEX_DIR) uninstall + -$(MAKE) -C $(FLEX_DIR) clean + +flex-dirclean: + rm -rf $(FLEX_DIR) + diff --git a/obsolete-buildroot/make/gawk.mk b/obsolete-buildroot/make/gawk.mk new file mode 100644 index 0000000000..523b0479bb --- /dev/null +++ b/obsolete-buildroot/make/gawk.mk @@ -0,0 +1,66 @@ +############################################################# +# +# gawk +# +############################################################# +GAWK_SOURCE:=gawk-3.1.2.tar.gz +GAWK_SITE:=ftp://ftp.gnu.org/gnu/gawk +GAWK_CAT:=zcat +GAWK_DIR:=$(BUILD_DIR)/gawk-3.1.2 +GAWK_BINARY:=gawk +GAWK_TARGET_BINARY:=usr/bin/gawk + +$(DL_DIR)/$(GAWK_SOURCE): + $(WGET) -P $(DL_DIR) $(GAWK_SITE)/$(GAWK_SOURCE) + +gawk-source: $(DL_DIR)/$(GAWK_SOURCE) + +$(GAWK_DIR)/.unpacked: $(DL_DIR)/$(GAWK_SOURCE) + $(GAWK_CAT) $(DL_DIR)/$(GAWK_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(GAWK_DIR)/.unpacked + +$(GAWK_DIR)/.configured: $(GAWK_DIR)/.unpacked + (cd $(GAWK_DIR); rm -rf config.cache; autoconf; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ac_cv_func_getpgrp_void=yes \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(GAWK_DIR)/.configured + +$(GAWK_DIR)/$(GAWK_BINARY): $(GAWK_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(GAWK_DIR) + +$(TARGET_DIR)/$(GAWK_TARGET_BINARY): $(GAWK_DIR)/$(GAWK_BINARY) + rm -f $(TARGET_DIR)/usr/bin/awk + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GAWK_DIR) install + rm -f $(TARGET_DIR)/usr/bin/gawk-* + (cd $(TARGET_DIR)/usr/bin; ln -sf gawk awk) + $(STRIP) $(TARGET_DIR)/usr/lib/awk/* > /dev/null 2>&1 + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +gawk: uclibc $(TARGET_DIR)/$(GAWK_TARGET_BINARY) + +gawk-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GAWK_DIR) uninstall + -$(MAKE) -C $(GAWK_DIR) clean + +gawk-dirclean: + rm -rf $(GAWK_DIR) + diff --git a/obsolete-buildroot/make/gcc-uclibc-2.95.mk b/obsolete-buildroot/make/gcc-uclibc-2.95.mk new file mode 100644 index 0000000000..9294b53f73 --- /dev/null +++ b/obsolete-buildroot/make/gcc-uclibc-2.95.mk @@ -0,0 +1,276 @@ +# Makefile for to build a gcc/uClibc toolchain +# +# Copyright (C) 2002-2003 Erik Andersen +# Copyright (C) 2004 Manuel Novoa III +# +# 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 + +ifeq ($(GCC_2_95_TOOLCHAIN),true) + +GCC_SITE:=http://www.uclibc.org/downloads/toolchain +GCC_SOURCE:=gcc-20011006.tar.bz2 +GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-20011006 +GCC_CAT:=bzcat + +STLPORT_SITE=http://www.stlport.org/archive +STLPORT_SOURCE=STLport-4.5.3.tar.gz +STLPORT_DIR=$(TOOL_BUILD_DIR)/STLport-4.5.3 +GCC_STRIP_HOST_BINARIES:=true + +############################################################# +# +# Setup some initial stuff +# +############################################################# + +ifeq ($(INSTALL_LIBSTDCPP),true) +TARGET_LANGUAGES:=c,c++ +STLPORT_TARGET=stlport +else +TARGET_LANGUAGES:=c +STLPORT_TARGET= +endif + +############################################################# +# +# build the first pass gcc compiler +# +############################################################# +GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc2_95-initial + +$(DL_DIR)/$(GCC_SOURCE): + $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) + +$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) + $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(GCC_DIR)/.unpacked + +$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked + # Apply any files named gcc-*.patch from the source directory to gcc + $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc2.95-mega.patch.bz2 + $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc2.95-uclibc-conf.patch + #$(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc-uclibc2_95*.patch + # + # We do not wish to build the libstdc++ library provided with gcc, + # since it doesn't seem to work at all with uClibc plus gcc 2.95... + # + mv $(GCC_DIR)/libstdc++ $(GCC_DIR)/libstdc++.orig + mv $(GCC_DIR)/libio $(GCC_DIR)/libio.orig + # + touch $(GCC_DIR)/.patched + +# The --without-headers option stopped working with gcc 3.0 and has never been +# # fixed, so we need to actually have working C library header files prior to +# # the step or libgcc will not build... +$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched + mkdir -p $(GCC_BUILD_DIR1) + -mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include + # Important! Required for limits.h to be fixed. + ln -sf include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include + (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) \ + $(GCC_DIR)/configure \ + --prefix=$(STAGING_DIR) \ + --build=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=c \ + --disable-shared \ + --includedir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include \ + --with-headers=$(TOOL_BUILD_DIR)/uClibc_dev/usr/include \ + --disable-__cxa_atexit \ + --enable-target-optspace \ + --with-gnu-ld \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(EXTRA_GCC_CONFIG_OPTIONS)); + touch $(GCC_BUILD_DIR1)/.configured + +$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) all-gcc + touch $(GCC_BUILD_DIR1)/.compiled + +$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) install-gcc + #rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov + #rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc $(STAGING_DIR)/share/locale + +gcc2_95_initial: uclibc-configured binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc + +gcc2_95_initial-clean: + rm -rf $(GCC_BUILD_DIR1) + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + +gcc2_95_initial-dirclean: + rm -rf $(GCC_BUILD_DIR1) + +############################################################# +# +# STLport -- an alternative C++ library +# +############################################################# +STLPORT_PATCH=$(SOURCE_DIR)/STLport-4.5.3.patch + +$(DL_DIR)/$(STLPORT_SOURCE): + $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE) + +$(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH) + zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1 + +$(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile + $(MAKE) ARCH=$(OPTIMIZE_FOR_CPU) PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) -C $(STLPORT_DIR) + +$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a + $(MAKE) ARCH=$(OPTIMIZE_FOR_CPU) PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) -C $(STLPORT_DIR) install + +stlport: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a + +stlport-source: $(DL_DIR)/$(STLPORT_SOURCE) + +stlport-clean: + rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++* + rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++* + -$(MAKE) -C $(STLPORT_DIR) clean + +stlport-dirclean: + rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++* + rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/g++-v3* + rm -rf $(STLPORT_DIR) + +############################################################# +# +# second pass compiler build. Build the compiler targeting +# the newly built shared uClibc library. +# +############################################################# +GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc2_95-final + +$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a + mkdir -p $(GCC_BUILD_DIR2) + (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) \ + $(GCC_DIR)/configure \ + --prefix=$(STAGING_DIR) \ + --build=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=$(TARGET_LANGUAGES) \ + --enable-shared \ + --with-gxx-include-dir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++ \ + --disable-__cxa_atexit \ + --enable-target-optspace \ + --with-gnu-ld \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(EXTRA_GCC_CONFIG_OPTIONS)); + touch $(GCC_BUILD_DIR2)/.configured + +$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR2) all + touch $(GCC_BUILD_DIR2)/.compiled + +$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR2) install + # Strip the host binaries +ifeq ($(GCC_STRIP_HOST_BINARIES),true) + -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/* +endif + # Set up the symlinks to enable lying about target name. + set -e; \ + (cd $(STAGING_DIR); \ + ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \ + cd bin; \ + for app in $(REAL_GNU_TARGET_NAME)-* ; do \ + ln -sf $${app} \ + $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \ + done; \ + ); + touch $(GCC_BUILD_DIR2)/.installed + +gcc2_95: uclibc-configured binutils gcc2_95_initial $(LIBFLOAT_TARGET) uclibc \ + $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) $(STLPORT_TARGET) + +gcc2_95-source: $(DL_DIR)/$(GCC_SOURCE) + +gcc2_95-clean: + rm -rf $(GCC_BUILD_DIR2) + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + +gcc2_95-dirclean: + rm -rf $(GCC_BUILD_DIR2) + +############################################################# +# +# Next build target gcc compiler +# +############################################################# +GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc2_95-target + +$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed + mkdir -p $(GCC_BUILD_DIR3) + (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \ + $(GCC_DIR)/configure \ + --prefix=/usr \ + --build=$(GNU_HOST_NAME) \ + --host=$(REAL_GNU_TARGET_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=$(TARGET_LANGUAGES) \ + --enable-shared \ + --with-gxx-include-dir=/usr/include/c++ \ + --disable-__cxa_atexit \ + --enable-target-optspace \ + --with-gnu-ld \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(EXTRA_GCC_CONFIG_OPTIONS)); + touch $(GCC_BUILD_DIR3)/.configured + +$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured + PATH=$(TARGET_PATH) \ + $(MAKE) $(JLEVEL) $(TARGET_GCC_ARGS) -C $(GCC_BUILD_DIR3) all + touch $(GCC_BUILD_DIR3)/.compiled + +$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled + PATH=$(TARGET_PATH) \ + $(MAKE) $(JLEVEL) DESTDIR=$(TARGET_DIR) -C $(GCC_BUILD_DIR3) install + # Remove broken specs file (cross compile flag is set). + rm -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs + -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/lib; $(STRIP) libstdc++.so.*.*.* > /dev/null 2>&1) + -(cd $(TARGET_DIR)/lib; $(STRIP) libgcc_s.so.*.*.* > /dev/null 2>&1) + # + rm -f $(TARGET_DIR)/usr/lib/*.la* + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + # Work around problem of missing syslimits.h + cp -f $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/syslimits.h $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/ + # These are in /lib, so... + #rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so* + #touch -c $(TARGET_DIR)/usr/bin/gcc + +gcc2_95_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc + +gcc2_95_target-clean: + rm -rf $(GCC_BUILD_DIR3) + rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + +gcc2_95_target-dirclean: + rm -rf $(GCC_BUILD_DIR3) + +endif diff --git a/obsolete-buildroot/make/gcc-uclibc-3.3.mk b/obsolete-buildroot/make/gcc-uclibc-3.3.mk new file mode 100644 index 0000000000..b3795e66a4 --- /dev/null +++ b/obsolete-buildroot/make/gcc-uclibc-3.3.mk @@ -0,0 +1,267 @@ +# Makefile for to build a gcc/uClibc toolchain +# +# Copyright (C) 2002-2003 Erik Andersen +# Copyright (C) 2004 Manuel Novoa III +# +# 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 + +ifneq ($(GCC_2_95_TOOLCHAIN),true) + +# Shiny new stuff... +GCC_VERSION:=3.3.3 +GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(GCC_VERSION) +#GCC_SITE:=http://www.binarycode.org/gcc/releases/gcc-$(GCC_VERSION) +#GCC_SITE:=http://gcc.get-software.com/releases/gcc-$(GCC_VERSION) + +# +# snapshots.... +#GCC_VERSION:=3.3-20031013 +#GCC_SITE:=http://gcc.get-software.com/snapshots/$(GCC_VERSION) +# +GCC_SOURCE:=gcc-$(GCC_VERSION).tar.bz2 +GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION) +GCC_CAT:=bzcat +GCC_STRIP_HOST_BINARIES:=true + +############################################################# +# +# Setup some initial stuff +# +############################################################# + +ifeq ($(INSTALL_LIBGCJ),true) +TARGET_LANGUAGES:=c,c++,java +else +ifeq ($(INSTALL_LIBSTDCPP),true) +TARGET_LANGUAGES:=c,c++ +else +TARGET_LANGUAGES:=c +endif +endif + +############################################################# +# +# build the first pass gcc compiler +# +############################################################# +GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-3.3-initial + +$(DL_DIR)/$(GCC_SOURCE): + $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) + +$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) + $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(GCC_DIR)/.unpacked + +$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked + # Apply any files named gcc-*.patch from the source directory to gcc + $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc3.3-mega.patch.bz2 + $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc-uclibc-3.3*.patch +ifeq ($(SOFT_FLOAT),true) +ifeq ("$(strip $(ARCH))","i386") + $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) i386-gcc-soft-float.patch +endif +endif + touch $(GCC_DIR)/.patched + +# The --without-headers option stopped working with gcc 3.0 and has never been +# # fixed, so we need to actually have working C library header files prior to +# # the step or libgcc will not build... +$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched + mkdir -p $(GCC_BUILD_DIR1) + -mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include + (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) \ + $(GCC_DIR)/configure \ + --prefix=$(STAGING_DIR) \ + --build=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=c \ + --disable-shared \ + --includedir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include \ + --with-sysroot=$(TOOL_BUILD_DIR)/uClibc_dev/ \ + --disable-__cxa_atexit \ + --enable-target-optspace \ + --with-gnu-ld \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(EXTRA_GCC_CONFIG_OPTIONS)); + touch $(GCC_BUILD_DIR1)/.configured + +$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) all-gcc + touch $(GCC_BUILD_DIR1)/.compiled + +$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) install-gcc + #rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov + #rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc $(STAGING_DIR)/share/locale + +gcc3_3_initial: uclibc-configured binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc + +gcc3_3_initial-clean: + rm -rf $(GCC_BUILD_DIR1) + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + +gcc3_3_initial-dirclean: + rm -rf $(GCC_BUILD_DIR1) + +############################################################# +# +# second pass compiler build. Build the compiler targeting +# the newly built shared uClibc library. +# +############################################################# +GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-3.3-final +$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a + mkdir -p $(GCC_BUILD_DIR2) + # Important! Required for limits.h to be fixed. + ln -sf include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include + (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) \ + $(GCC_DIR)/configure \ + --prefix=$(STAGING_DIR) \ + --build=$(GNU_HOST_NAME) \ + --host=$(GNU_HOST_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=$(TARGET_LANGUAGES) \ + --enable-shared \ + --with-gxx-include-dir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++ \ + --disable-__cxa_atexit \ + --enable-target-optspace \ + --with-gnu-ld \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(GCC_USE_SJLJ_EXCEPTIONS) \ + $(EXTRA_GCC_CONFIG_OPTIONS)); + touch $(GCC_BUILD_DIR2)/.configured + +$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR2) all + touch $(GCC_BUILD_DIR2)/.compiled + +$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled + PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR2) install + # Strip the host binaries +ifeq ($(GCC_STRIP_HOST_BINARIES),true) + -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/* +endif + # Set up the symlinks to enable lying about target name. + set -e; \ + (cd $(STAGING_DIR); \ + ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \ + cd bin; \ + for app in $(REAL_GNU_TARGET_NAME)-* ; do \ + ln -sf $${app} \ + $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \ + done; \ + ); +ifeq ($(SOFT_FLOAT),true) + # Replace specs file with one that defaults to soft float mode. + if [ ! -f $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \ + echo staging dir specs file is missing ; \ + /bin/false ; \ + fi; + cp $(SOURCE_DIR)/specs-$(ARCH)-soft-float $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs +endif + touch $(GCC_BUILD_DIR2)/.installed + +gcc3_3: uclibc-configured binutils gcc3_3_initial $(LIBFLOAT_TARGET) uclibc \ + $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) + +gcc3_3-source: $(DL_DIR)/$(GCC_SOURCE) + +gcc3_3-clean: + rm -rf $(GCC_BUILD_DIR2) + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + +gcc3_3-dirclean: + rm -rf $(GCC_BUILD_DIR2) + +############################################################# +# +# Next build target gcc compiler +# +############################################################# +GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-3.3-target + +$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed + mkdir -p $(GCC_BUILD_DIR3) + (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \ + $(GCC_DIR)/configure \ + --prefix=/usr \ + --build=$(GNU_HOST_NAME) \ + --host=$(REAL_GNU_TARGET_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=$(TARGET_LANGUAGES) \ + --enable-shared \ + --with-gxx-include-dir=/usr/include/c++ \ + --disable-__cxa_atexit \ + --enable-target-optspace \ + --with-gnu-ld \ + $(DISABLE_NLS) \ + $(MULTILIB) \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(GCC_USE_SJLJ_EXCEPTIONS) \ + $(EXTRA_GCC_CONFIG_OPTIONS)); + touch $(GCC_BUILD_DIR3)/.configured + +$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured + PATH=$(TARGET_PATH) \ + $(MAKE) $(JLEVEL) $(TARGET_GCC_ARGS) -C $(GCC_BUILD_DIR3) all + touch $(GCC_BUILD_DIR3)/.compiled + +$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled + PATH=$(TARGET_PATH) \ + $(MAKE) $(JLEVEL) DESTDIR=$(TARGET_DIR) -C $(GCC_BUILD_DIR3) install +ifeq ($(SOFT_FLOAT),true) + # Replace specs file with one that defaults to soft float mode. + if [ ! -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \ + echo target dir specs file is missing ; \ + /bin/false ; \ + fi; + cp $(SOURCE_DIR)/specs-$(ARCH)-soft-float $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs + # Make sure gcc does not think we are cross compiling + $(SED) "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs +else + # Remove broken specs file (cross compile flag is set). + rm -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs +endif + -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/lib; $(STRIP) libstdc++.so.*.*.* > /dev/null 2>&1) + -(cd $(TARGET_DIR)/lib; $(STRIP) libgcc_s.so.*.*.* > /dev/null 2>&1) + # + rm -f $(TARGET_DIR)/usr/lib/*.la* + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + # Work around problem of missing syslimits.h + cp -f $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/syslimits.h $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/ + # These are in /lib, so... + #rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so* + #touch -c $(TARGET_DIR)/usr/bin/gcc + +gcc3_3_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc + +gcc3_3_target-clean: + rm -rf $(GCC_BUILD_DIR3) + rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + +gcc3_3_target-dirclean: + rm -rf $(GCC_BUILD_DIR3) + +endif diff --git a/obsolete-buildroot/make/gdb.mk b/obsolete-buildroot/make/gdb.mk new file mode 100644 index 0000000000..59a08be3d5 --- /dev/null +++ b/obsolete-buildroot/make/gdb.mk @@ -0,0 +1,80 @@ +############################################################# +# +# gdb +# +############################################################# + +GDB_SITE:=ftp://ftp.gnu.org/gnu/gdb/ +GDB_DIR:=$(BUILD_DIR)/gdb-5.3 +GDB_SOURCE:=gdb-5.3.tar.gz +GDB_PATCH:=$(SOURCE_DIR)/gdb.patch +GDB_UCLIBC_PATCH:=$(SOURCE_DIR)/gdb-5.3-uclibc.patch + +$(DL_DIR)/$(GDB_SOURCE): + $(WGET) -P $(DL_DIR) $(GDB_SITE)/$(GDB_SOURCE) + +$(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE) $(GDB_PATCH) + gunzip -c $(DL_DIR)/$(GDB_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(GDB_PATCH) | patch -p1 -d $(GDB_DIR) + cat $(GDB_UCLIBC_PATCH) | patch -p1 -d $(GDB_DIR) + touch $(GDB_DIR)/.unpacked + +$(GDB_DIR)/.configured: $(GDB_DIR)/.unpacked + # Copy a config.sub from gcc. This is only necessary until + # gdb's config.sub supports -linux-uclibc tuples. + cp $(GCC_DIR)/config.sub $(GDB_DIR) + cp $(GCC_DIR)/config.sub $(GDB_DIR)/readline/support/ + (cd $(GDB_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ac_cv_type_uintptr_t=yes \ + gt_cv_func_gettext_libintl=yes \ + ac_cv_func_dcgettext=yes \ + gdb_cv_func_sigsetjmp=yes \ + bash_cv_func_strcoll_broken=no \ + bash_cv_must_reinstall_sighandlers=no \ + bash_cv_func_sigsetjmp=present \ + ./configure \ + --target=$(REAL_GNU_TARGET_NAME) \ + --host=$(REAL_GNU_TARGET_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --includedir=$(STAGING_DIR)/include \ + $(DISABLE_NLS) \ + --without-uiout --disable-gdbmi \ + --disable-tui --disable-gdbtk --without-x \ + --disable-sim --enable-gdbserver \ + --without-included-gettext \ + ); +ifeq ($(ENABLE_LOCALE),true) + -$(SED) "s,^INTL *=.*,INTL = -lintl,g;" $(GDB_DIR)/gdb/Makefile +endif + touch $(GDB_DIR)/.configured + +$(GDB_DIR)/gdb/gdb: $(GDB_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(GDB_DIR) + $(STRIP) $(GDB_DIR)/gdb/gdb + +$(TARGET_DIR)/usr/bin/gdb: $(GDB_DIR)/gdb/gdb + install -c $(GDB_DIR)/gdb/gdb $(TARGET_DIR)/usr/bin/gdb + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +gdb: $(TARGET_DIR)/usr/bin/gdb + +gdb-source: $(DL_DIR)/$(GDB_SOURCE) + +gdb-clean: + $(MAKE) -C $(GDB_DIR) clean + +gdb-dirclean: + rm -rf $(GDB_DIR) + diff --git a/obsolete-buildroot/make/gdbserver.mk b/obsolete-buildroot/make/gdbserver.mk new file mode 100644 index 0000000000..1ab44a2367 --- /dev/null +++ b/obsolete-buildroot/make/gdbserver.mk @@ -0,0 +1,53 @@ +############################################################# +# +# gdbserver +# +############################################################# + +#Use GDB_DIR/etc values from gdb.mk +#Build gdbserver in a dir outside of the main gdb tree +GDB_WDIR:=$(BUILD_DIR)/gdbserver + + +$(GDB_WDIR)/.configured: $(GDB_DIR)/.unpacked + mkdir -p $(GDB_WDIR) + (cd $(GDB_WDIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + $(GDB_DIR)/gdb/gdbserver/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --includedir=$(STAGING_DIR)/include \ + $(DISABLE_NLS) \ + --without-uiout --disable-gdbmi \ + --disable-tui --disable-gdbtk --without-x \ + --without-included-gettext \ + ); + touch $(GDB_WDIR)/.configured + +$(GDB_WDIR)/gdbserver: $(GDB_WDIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(GDB_WDIR) + $(STRIP) $(GDB_WDIR)/gdbserver + +$(TARGET_DIR)/usr/bin/gdbserver: $(GDB_WDIR)/gdbserver + install -c $(GDB_WDIR)/gdbserver $(TARGET_DIR)/usr/bin/gdbserver + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +gdbserver: $(TARGET_DIR)/usr/bin/gdbserver + +gdbserver-clean: + $(MAKE) -C $(GDB_WDIR) clean + +gdbserver-dirclean: + rm -rf $(GDB_WDIR) + diff --git a/obsolete-buildroot/make/gettext.mk b/obsolete-buildroot/make/gettext.mk new file mode 100644 index 0000000000..84c7a25bc2 --- /dev/null +++ b/obsolete-buildroot/make/gettext.mk @@ -0,0 +1,60 @@ +############################################################# +# +# gettext +# +############################################################# +GETTEXT_SOURCE:=gettext-0.11.5.tar.gz +GETTEXT_SITE:=ftp://ftp.gnu.org/gnu/gettext +GETTEXT_DIR:=$(BUILD_DIR)/gettext-0.11.5 +GETTEXT_CAT:=zcat +GETTEXT_BINARY:=gettext +GETTEXT_TARGET_BINARY:=usr/bin/gettext + +$(DL_DIR)/$(GETTEXT_SOURCE): + $(WGET) -P $(DL_DIR) $(GETTEXT_SITE)/$(GETTEXT_SOURCE) + +gettext-source: $(DL_DIR)/$(GETTEXT_SOURCE) + +$(GETTEXT_DIR)/.unpacked: $(DL_DIR)/$(GETTEXT_SOURCE) + $(GETTEXT_CAT) $(DL_DIR)/$(GETTEXT_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(GETTEXT_DIR)/.unpacked + +$(GETTEXT_DIR)/.configured: $(GETTEXT_DIR)/.unpacked + (cd $(GETTEXT_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + ); + touch $(GETTEXT_DIR)/.configured + +$(GETTEXT_DIR)/$(GETTEXT_BINARY): $(GETTEXT_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(GETTEXT_DIR) + +$(TARGET_DIR)/$(GETTEXT_TARGET_BINARY): $(GETTEXT_DIR)/$(GETTEXT_BINARY) + $(MAKE) DESTDIR=$(STAGING_DIR) CC=$(TARGET_CC) -C $(GETTEXT_DIR) install + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GETTEXT_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc \ + $(TARGET_DIR)/usr/doc + +gettext: uclibc $(TARGET_DIR)/$(GETTEXT_TARGET_BINARY) + +gettext-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GETTEXT_DIR) uninstall + -$(MAKE) -C $(GETTEXT_DIR) clean + +gettext-dirclean: + rm -rf $(GETTEXT_DIR) + diff --git a/obsolete-buildroot/make/grep.mk b/obsolete-buildroot/make/grep.mk new file mode 100644 index 0000000000..cc7856c087 --- /dev/null +++ b/obsolete-buildroot/make/grep.mk @@ -0,0 +1,73 @@ +############################################################# +# +# grep +# +############################################################# +GNUGREP_SOURCE:=grep_2.5.1.ds1.orig.tar.gz +GNUGREP_SITE:=http://ftp.debian.org/debian/pool/main/g/grep/ +GNUGREP_DIR:=$(BUILD_DIR)/grep-2.5.1 +GNUGREP_CAT:=zcat +GNUGREP_BINARY:=src/grep +GNUGREP_TARGET_BINARY:=bin/grep + +$(DL_DIR)/$(GNUGREP_SOURCE): + $(WGET) -P $(DL_DIR) $(GNUGREP_SITE)/$(GNUGREP_SOURCE) + +grep-source: $(DL_DIR)/$(GNUGREP_SOURCE) + +$(GNUGREP_DIR)/.unpacked: $(DL_DIR)/$(GNUGREP_SOURCE) + rm -rf $(GNUGREP_DIR).xxx + $(GNUGREP_CAT) $(DL_DIR)/$(GNUGREP_SOURCE) | tar -C $(BUILD_DIR) -xvf - + mv $(GNUGREP_DIR) $(GNUGREP_DIR).xxx + $(GNUGREP_CAT) $(GNUGREP_DIR).xxx/grep_2.5.1.tar.gz | tar -C $(BUILD_DIR) -xvf - + rm -rf $(GNUGREP_DIR).xxx + touch $(GNUGREP_DIR)/.unpacked + +$(GNUGREP_DIR)/.configured: $(GNUGREP_DIR)/.unpacked + (cd $(GNUGREP_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --disable-perl-regexp \ + --without-included-regex \ + ); + touch $(GNUGREP_DIR)/.configured + +$(GNUGREP_DIR)/$(GNUGREP_BINARY): $(GNUGREP_DIR)/.configured + $(MAKE) -C $(GNUGREP_DIR) + +# This stuff is needed to work around GNU make deficiencies +grep-target_binary: $(GNUGREP_DIR)/$(GNUGREP_BINARY) + @if [ -L $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY) ] ; then \ + rm -f $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY); fi; + @if [ ! -f $(GNUGREP_DIR)/$(GNUGREP_BINARY) -o $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY) -ot \ + $(GNUGREP_DIR)/$(GNUGREP_BINARY) ] ; then \ + set -x; \ + rm -f $(TARGET_DIR)/bin/grep $(TARGET_DIR)/bin/egrep $(TARGET_DIR)/bin/fgrep; \ + cp -a $(GNUGREP_DIR)/src/grep $(GNUGREP_DIR)/src/egrep \ + $(GNUGREP_DIR)/src/fgrep $(TARGET_DIR)/bin/; fi + +grep: uclibc grep-target_binary + +grep-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUGREP_DIR) uninstall + -$(MAKE) -C $(GNUGREP_DIR) clean + +grep-dirclean: + rm -rf $(GNUGREP_DIR) + diff --git a/obsolete-buildroot/make/gzip.mk b/obsolete-buildroot/make/gzip.mk new file mode 100644 index 0000000000..8098dd9333 --- /dev/null +++ b/obsolete-buildroot/make/gzip.mk @@ -0,0 +1,70 @@ +############################################################# +# +# gzip +# +############################################################# +GZIP_SOURCE:=gzip-1.3.5.tar.gz +GZIP_SITE:=ftp://alpha.gnu.org/gnu/gzip +GZIP_DIR:=$(BUILD_DIR)/gzip-1.3.5 +GZIP_CAT:=zcat +GZIP_BINARY:=$(GZIP_DIR)/gzip +GZIP_TARGET_BINARY:=$(TARGET_DIR)/bin/zmore + +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),false) +GZIP_LARGEFILE="--disable-largefile" +endif + +$(DL_DIR)/$(GZIP_SOURCE): + $(WGET) -P $(DL_DIR) $(GZIP_SITE)/$(GZIP_SOURCE) + +gzip-source: $(DL_DIR)/$(GZIP_SOURCE) + +$(GZIP_DIR)/.unpacked: $(DL_DIR)/$(GZIP_SOURCE) + $(GZIP_CAT) $(DL_DIR)/$(GZIP_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(GZIP_DIR)/.unpacked + +$(GZIP_DIR)/.configured: $(GZIP_DIR)/.unpacked + (cd $(GZIP_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/ \ + --bindir=/bin \ + --sbindir=/bin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share/misc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(GZIP_LARGEFILE) \ + ); + touch $(GZIP_DIR)/.configured + +$(GZIP_BINARY): $(GZIP_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(GZIP_DIR) + +$(GZIP_TARGET_BINARY): $(GZIP_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GZIP_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + (cd $(TARGET_DIR)/bin; \ + ln -sf gzip gunzip; \ + ln -sf gzip zcat; \ + ln -sf zdiff zcmp; \ + ln -sf zgrep zegrep; \ + ln -sf zgrep zfgrep;) + +gzip: uclibc $(GZIP_TARGET_BINARY) + +gzip-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GZIP_DIR) uninstall + -$(MAKE) -C $(GZIP_DIR) clean + +gzip-dirclean: + rm -rf $(GZIP_DIR) + diff --git a/obsolete-buildroot/make/hostap.mk b/obsolete-buildroot/make/hostap.mk new file mode 100644 index 0000000000..b7908fd170 --- /dev/null +++ b/obsolete-buildroot/make/hostap.mk @@ -0,0 +1,53 @@ +############################################################# +# +# hostap +# +############################################################# +HOSTAP_SOURCE_URL=http://hostap.epitest.fi/cgi-bin/viewcvs.cgi/hostap/hostap.tar.gz?tarball=1 +HOSTAP_SOURCE=hostap.tar.gz +HOSTAP_DIR=$(BUILD_DIR)/hostap-snapshot + +$(DL_DIR)/$(HOSTAP_SOURCE): + $(WGET) -P $(DL_DIR) $(HOSTAP_SOURCE_URL) -O $(DL_DIR)/$(HOSTAP_SOURCE) + +hostap-source: $(DL_DIR)/$(HOSTAP_SOURCE) + +$(HOSTAP_DIR)/.unpacked: $(DL_DIR)/$(HOSTAP_SOURCE) + zcat $(DL_DIR)/$(HOSTAP_SOURCE) | tar -C $(BUILD_DIR) -xvf - + mv -f $(BUILD_DIR)/hostap $(HOSTAP_DIR) + touch $(HOSTAP_DIR)/.unpacked + +$(HOSTAP_DIR)/.configured: $(HOSTAP_DIR)/.unpacked + #$(SED) "s,/.*#define PRISM2_DOWNLOAD_SUPPORT.*/,#define PRISM2_DOWNLOAD_SUPPORT,g" \ + # $(HOSTAP_DIR)/driver/modules/hostap_config.h + touch $(HOSTAP_DIR)/.configured + +$(HOSTAP_DIR)/utils/hostap_crypt_conf: $(HOSTAP_DIR)/.configured + $(MAKE) -C $(HOSTAP_DIR)/utils CC=$(TARGET_CC) CFLAGS="-Os -Wall $(TARGET_CFLAGS) -I../driver/modules" + $(MAKE) -C $(HOSTAP_DIR)/hostapd CC=$(TARGET_CC) CFLAGS="-Os -Wall $(TARGET_CFLAGS) -I../driver/modules -I../utils" + touch -c $(HOSTAP_DIR)/driver/modules/hostap.o + +$(TARGET_DIR)//usr/bin/hostap_crypt_conf: $(HOSTAP_DIR)/utils/hostap_crypt_conf + # Make the dir + -rm -rf $(HOSTAP_TARGET_MODULE_DIR) + -mkdir -p $(HOSTAP_TARGET_MODULE_DIR) + # Copy the pcmcia-cs conf file + -mkdir -p $(TARGET_DIR)/etc/pcmcia + cp -af $(HOSTAP_DIR)/driver/etc/hostap_cs.conf $(TARGET_DIR)/etc/pcmcia/ + # Copy The Utils + cp -af $(HOSTAP_DIR)/utils/hostap_crypt_conf $(TARGET_DIR)/usr/bin/ + cp -af $(HOSTAP_DIR)/utils/hostap_diag $(TARGET_DIR)/usr/bin/ + cp -af $(HOSTAP_DIR)/utils/prism2_param $(TARGET_DIR)/usr/bin/ + cp -af $(HOSTAP_DIR)/utils/prism2_srec $(TARGET_DIR)/usr/bin/ + # Copy hostapd + cp -af $(HOSTAP_DIR)/hostapd/hostapd $(TARGET_DIR)/usr/sbin/ + +hostap: pcmcia $(TARGET_DIR)//usr/bin/hostap_crypt_conf + +hostap-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(HOSTAP_DIR) uninstall + -$(MAKE) -C $(HOSTAP_DIR) clean + +hostap-dirclean: + rm -rf $(HOSTAP_DIR) + diff --git a/obsolete-buildroot/make/hotplug.mk b/obsolete-buildroot/make/hotplug.mk new file mode 100644 index 0000000000..e13a6025dd --- /dev/null +++ b/obsolete-buildroot/make/hotplug.mk @@ -0,0 +1,39 @@ +############################################################# +# +# hotplug support +# +############################################################# +HOTPLUG_SOURCE=diethotplug-0.4.tar.gz +HOTPLUG_SITE=http://aleron.dl.sourceforge.net/sourceforge/linux-hotplug +HOTPLUG_DIR=$(BUILD_DIR)/diethotplug-0.4 +HOTPLUG_PATCH=$(SOURCE_DIR)/hotplug.patch + +$(DL_DIR)/$(HOTPLUG_SOURCE): + $(WGET) -P $(DL_DIR) $(HOTPLUG_SITE)/$(HOTPLUG_SOURCE) + +$(HOTPLUG_DIR): $(DL_DIR)/$(HOTPLUG_SOURCE) $(HOTPLUG_PATCH) + zcat $(DL_DIR)/$(HOTPLUG_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(HOTPLUG_PATCH) | patch -p1 -d $(HOTPLUG_DIR) + +$(HOTPLUG_DIR)/hotplug: $(HOTPLUG_DIR) + $(MAKE) CROSS=$(TARGET_CROSS) DEBUG=false KLIBC=false \ + KERNEL_INCLUDE_DIR=$(STAGING_DIR)/include \ + TARGET_DIR=$(TARGET_DIR) -C $(HOTPLUG_DIR); + $(STRIP) $(HOTPLUG_DIR)/hotplug; + touch -c $(HOTPLUG_DIR)/hotplug + +$(TARGET_DIR)/sbin/hotplug: $(HOTPLUG_DIR)/hotplug + cp $(HOTPLUG_DIR)/hotplug $(TARGET_DIR)/sbin/hotplug; + touch -c $(TARGET_DIR)/sbin/hotplug + +hotplug: uclibc $(TARGET_DIR)/sbin/hotplug + +hotplug-source: $(DL_DIR)/$(HOTPLUG_SOURCE) + +hotplug-clean: + rm -f $(TARGET_DIR)/sbin/hotplug + -$(MAKE) -C $(HOTPLUG_DIR) clean + +hotplug-dirclean: + rm -rf $(HOTPLUG_DIR) + diff --git a/obsolete-buildroot/make/iproute2.mk b/obsolete-buildroot/make/iproute2.mk new file mode 100644 index 0000000000..7a33034b62 --- /dev/null +++ b/obsolete-buildroot/make/iproute2.mk @@ -0,0 +1,57 @@ +############################################################# +# +# iproute2 +# +############################################################# +IPROUTE2_DIR=$(BUILD_DIR)/iproute2 + +#IPROUTE2_SOURCE_URL=ftp://ftp.inr.ac.ru/ip-routing/ +#IPROUTE2_SOURCE=iproute2-2.4.7-now-ss020116-try.tar.gz + +#Use the debian source for now, as the .ru site has availability problems +IPROUTE2_SOURCE_URL=http://ftp.debian.org/debian/pool/main/i/iproute/ +IPROUTE2_SOURCE=iproute_20010824.orig.tar.gz +IPROUTE2_PATCH:=iproute_20010824-8.diff.gz + + +$(DL_DIR)/$(IPROUTE2_SOURCE): + $(WGET) -P $(DL_DIR) $(IPROUTE2_SOURCE_URL)$(IPROUTE2_SOURCE) + +$(DL_DIR)/$(IPROUTE2_PATCH): + $(WGET) -P $(DL_DIR) $(IPROUTE2_SOURCE_URL)/$(IPROUTE2_PATCH) + +iproute2-source: $(DL_DIR)/$(IPROUTE2_SOURCE) #$(DL_DIR)/$(IPROUTE2_PATCH) + +$(IPROUTE2_DIR)/.unpacked: $(DL_DIR)/$(IPROUTE2_SOURCE) #$(DL_DIR)/$(IPROUTE2_PATCH) + rm -rf $(IPROUTE2_DIR).orig $(IPROUTE2_DIR) + zcat $(DL_DIR)/$(IPROUTE2_SOURCE) | tar -C $(BUILD_DIR) -xvf - + #zcat $(DL_DIR)/$(IPROUTE2_PATCH) | patch -p1 -d $(IPROUTE2_DIR) + touch $(IPROUTE2_DIR)/.unpacked + +$(IPROUTE2_DIR)/.configured: $(IPROUTE2_DIR)/.unpacked + $(SED) "s,-I/usr/include/db3,," $(IPROUTE2_DIR)/Makefile + $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \ + $(IPROUTE2_DIR)/Makefile + $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \ + $(IPROUTE2_DIR)/Makefile + # For now disable compiling of the misc directory because it seems to fail + rm -rf $(IPROUTE2_DIR)/misc + $(SED) "s, misc,," $(IPROUTE2_DIR)/Makefile + touch $(IPROUTE2_DIR)/.configured + +$(IPROUTE2_DIR)/tc/tc: $(IPROUTE2_DIR)/.configured + $(MAKE) -C $(IPROUTE2_DIR) KERNEL_INCLUDE=$(LINUX_SOURCE_DIR)/include CC=$(TARGET_CC) AR=$(TARGET_AR) + +$(TARGET_DIR)/usr/sbin/tc: $(IPROUTE2_DIR)/tc/tc + # Copy The tc binary + cp -af $(IPROUTE2_DIR)/tc/tc $(TARGET_DIR)/usr/sbin/ + +iproute2: $(TARGET_DIR)/usr/sbin/tc + +iproute2-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(IPROUTE2_DIR) uninstall + -$(MAKE) -C $(IPROUTE2_DIR) clean + +iproute2-dirclean: + rm -rf $(IPROUTE2_DIR) + diff --git a/obsolete-buildroot/make/iptables.mk b/obsolete-buildroot/make/iptables.mk new file mode 100644 index 0000000000..886e54213d --- /dev/null +++ b/obsolete-buildroot/make/iptables.mk @@ -0,0 +1,51 @@ +############################################################# +# +# iptables +# +############################################################# +IPTABLES_SOURCE_URL=http://www.netfilter.org/files +IPTABLES_SOURCE=iptables-1.2.9.tar.bz2 +IPTABLES_BUILD_DIR=$(BUILD_DIR)/iptables-1.2.9 + +$(DL_DIR)/$(IPTABLES_SOURCE): + $(WGET) -P $(DL_DIR) $(IPTABLES_SOURCE_URL)/$(IPTABLES_SOURCE) + +$(IPTABLES_BUILD_DIR)/.unpacked: $(DL_DIR)/$(IPTABLES_SOURCE) + bzcat $(DL_DIR)/$(IPTABLES_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(IPTABLES_BUILD_DIR)/.unpacked + +$(IPTABLES_BUILD_DIR)/.configured: $(IPTABLES_BUILD_DIR)/.unpacked + # Allow patches. Needed for openwrt for instance. + $(SOURCE_DIR)/patch-kernel.sh $(IPTABLES_BUILD_DIR) $(SOURCE_DIR) iptables-*.patch + # + $(SED) "s;\[ -f /usr/include/netinet/ip6.h \];grep -q '__UCLIBC_HAS_IPV6__ 1' \ + $(BUILD_DIR)/uClibc/include/bits/uClibc_config.h;" $(IPTABLES_BUILD_DIR)/Makefile + touch $(IPTABLES_BUILD_DIR)/.configured + +$(IPTABLES_BUILD_DIR)/iptables: $(IPTABLES_BUILD_DIR)/.configured + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) -C $(IPTABLES_BUILD_DIR) \ + KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \ + CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" + +$(TARGET_DIR)/sbin/iptables: $(IPTABLES_BUILD_DIR)/iptables + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) -C $(IPTABLES_BUILD_DIR) \ + KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \ + CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \ + DESTDIR=$(TARGET_DIR) install + $(STRIP) $(TARGET_DIR)/usr/sbin/iptables* + $(STRIP) $(TARGET_DIR)/usr/lib/iptables/*.so + rm -rf $(TARGET_DIR)/usr/man + +iptables: $(TARGET_DIR)/sbin/iptables + +iptables-source: $(DL_DIR)/$(IPTABLES_SOURCE) + +iptables-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(IPTABLES_BUILD_DIR) uninstall + -$(MAKE) -C $(IPTABLES_BUILD_DIR) clean + +iptables-dirclean: + rm -rf $(IPTABLES_BUILD_DIR) + diff --git a/obsolete-buildroot/make/jffs2root.mk b/obsolete-buildroot/make/jffs2root.mk new file mode 100644 index 0000000000..569ae7e39a --- /dev/null +++ b/obsolete-buildroot/make/jffs2root.mk @@ -0,0 +1,49 @@ +############################################################# +# +# mtd provides us with mkfs.jffs2, to target JFFS2 filesystems +# +############################################################# + +MTD_DIR:=$(BUILD_DIR)/mtd-20011217 +MTD_SOURCE=mtd_20011217.orig.tar.gz +MTD_SITE=http://ftp.debian.org/debian/pool/main/m/mtd +MKFS_JFFS2=$(shell which mkfs.jffs2 || echo $(MTD_DIR)/util/mkfs.jffs2) + +$(DL_DIR)/$(MTD_SOURCE): + $(WGET) -P $(DL_DIR) $(MTD_SITE)/$(MTD_SOURCE) + +$(MTD_DIR)/.unpacked: $(DL_DIR)/$(MTD_SOURCE) + zcat $(DL_DIR)/$(MTD_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(MTD_DIR)/.unpacked + +$(MTD_DIR)/util/mkfs.jffs2: $(MTD_DIR)/.unpacked + CFLAGS=-I$(LINUX_DIR)/include $(MAKE) LINUXDIR=$(LINUX_DIR) -C $(MTD_DIR)/util + +mtd: $(MKFS_JFFS2) + + +############################################################# +# +# Build the jffs2 root filesystem image +# +############################################################# + +jffs2root: mtd + #-@find $(TARGET_DIR)/lib -type f -name \*.so\* | xargs $(STRIP) --strip-unneeded 2>/dev/null || true; + -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true; + @rm -rf $(TARGET_DIR)/usr/man + @rm -rf $(TARGET_DIR)/usr/info + $(MKFS_JFFS2) --pad --little-endian --squash -e 0x20000 \ + -D $(SOURCE_DIR)/device_table.txt -d $(TARGET_DIR) \ + -o $(IMAGE) + +jffs2root-source: $(DL_DIR)/$(MTD_SOURCE) + +jffs2root-clean: + -$(MAKE) -C $(MTD_DIR) clean + +jffs2root-dirclean: + rm -rf $(MTD_DIR) + + + diff --git a/obsolete-buildroot/make/jpeg.mk b/obsolete-buildroot/make/jpeg.mk new file mode 100644 index 0000000000..d3f99676de --- /dev/null +++ b/obsolete-buildroot/make/jpeg.mk @@ -0,0 +1,73 @@ +############################################################# +# +# jpeg (libraries needed by some apps) +# +############################################################# +# Copyright (C) 2001-2003 by Erik Andersen +# Copyright (C) 2002 by Tim Riker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 +JPEG_DIR=$(BUILD_DIR)/jpeg-6b +JPEG_SITE:=ftp://ftp.uu.net/graphics/jpeg/ +JPEG_SOURCE=jpegsrc.v6b.tar.gz +JPEG_CAT:=zcat + +$(DL_DIR)/$(JPEG_SOURCE): + $(WGET) -P $(DL_DIR) $(JPEG_SITE)/$(JPEG_SOURCE) + +jpeg-source: $(DL_DIR)/$(JPEG_SOURCE) + +$(JPEG_DIR)/.unpacked: $(DL_DIR)/$(JPEG_SOURCE) + $(JPEG_CAT) $(DL_DIR)/$(JPEG_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # The config.guess distributed with the package is not able + # to handle cross compilation. Use the one from binutils. + cp $(BINUTILS_DIR)/config.guess $(JPEG_DIR)/ + touch $(JPEG_DIR)/.unpacked + +$(JPEG_DIR)/.configured: $(JPEG_DIR)/.unpacked + (cd $(JPEG_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --enable-shared \ + ); + touch $(JPEG_DIR)/.configured + +$(STAGING_DIR)/lib/libjpeg.so.62.0.0: $(JPEG_DIR)/.configured + $(MAKE) -C $(JPEG_DIR) all + # Note: This does not install the utilities. + $(MAKE) -C $(JPEG_DIR) prefix=$(STAGING_DIR) exec_prefix=$(STAGING_DIR) install-headers install-lib + +$(TARGET_DIR)/lib/libjpeg.so.62.0.0: $(STAGING_DIR)/lib/libjpeg.so.62.0.0 + cp -dpf $(STAGING_DIR)/lib/libjpeg.so* $(TARGET_DIR)/usr/lib/ + -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libjpeg.so.62.0.0 + +jpeg: uclibc $(TARGET_DIR)/lib/libjpeg.so.62.0.0 + +jpeg-clean: + -$(MAKE) -C $(JPEG_DIR) clean diff --git a/obsolete-buildroot/make/kernel-headers.mk b/obsolete-buildroot/make/kernel-headers.mk new file mode 100644 index 0000000000..2f8f950a67 --- /dev/null +++ b/obsolete-buildroot/make/kernel-headers.mk @@ -0,0 +1,85 @@ +############################################################# +# +# Setup the kernel headers. I include a generic package of +# kernel headers here, so you shouldn't need to include your +# own. Be aware these kernel headers _will_ get blown away +# by a 'make clean' so don't put anything sacred in here... +# +############################################################# +ifneq ($(filter $(TARGETS),kernel-headers),) + +VERSION=2 +PATCHLEVEL=4 +SUBLEVEL=25 +LINUX_SITE:=http://www.uclibc.org/downloads/toolchain +LINUX_SOURCE:=kernel-headers-2.4.25.tar.bz2 +LINUX_UNPACK_DIR:=$(TOOL_BUILD_DIR)/linux + + +# Uncomment this for 2.6.x kernel header files +#VERSION=2 +#PATCHLEVEL=6 +#SUBLEVEL=5 +#LINUX_SITE:=http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ +#LINUX_SOURCE:=linux-libc-headers-2.6.5.0.tar.bz2 +#LINUX_UNPACK_DIR:=$(TOOL_BUILD_DIR)/linux-libc-headers-2.6.5.0 + + + +LINUX_DIR:=$(TOOL_BUILD_DIR)/linux + +$(DL_DIR)/$(LINUX_SOURCE): + $(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE) + +$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) + mkdir -p $(TOOL_BUILD_DIR) + bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - +ifneq ($(LINUX_UNPACK_DIR),$(LINUX_DIR)) + mv $(LINUX_UNPACK_DIR) $(LINUX_DIR) +endif + touch $(LINUX_DIR)/.unpacked + +$(LINUX_DIR)/.configured: $(LINUX_DIR)/.unpacked + rm -f $(LINUX_DIR)/include/asm + @if [ ! -f $(LINUX_DIR)/Makefile ] ; then \ + echo -e "VERSION = $(VERSION)\nPATCHLEVEL = $(PATCHLEVEL)\n" > \ + $(LINUX_DIR)/Makefile; \ + echo -e "SUBLEVEL = $(SUBLEVEL)\nEXTRAVERSION =\n" > \ + $(LINUX_DIR)/Makefile; \ + echo -e "KERNELRELEASE=\$$(VERSION).\$$(PATCHLEVEL).\$$(SUBLEVEL)\$$(EXTRAVERSION)" >> \ + $(LINUX_DIR)/Makefile; \ + fi; + @if [ "$(ARCH)" = "powerpc" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-ppc$(NOMMU) asm;) \ + elif [ "$(ARCH)" = "mips" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-mips$(NOMMU) asm;) \ + elif [ "$(ARCH)" = "mipsel" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-mips$(NOMMU) asm;) \ + elif [ "$(ARCH)" = "arm" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-arm$(NOMMU) asm; \ + cd asm; \ + if [ ! -L proc ] ; then \ + ln -fs proc-armv proc; \ + ln -fs arch-ebsa285 arch; fi); \ + elif [ "$(ARCH)" = "cris" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-cris asm;) \ + else \ + (cd $(LINUX_DIR)/include; ln -fs asm-$(ARCH)$(NOMMU) asm;) \ + fi + touch $(LINUX_DIR)/include/linux/autoconf.h; + touch $(LINUX_DIR)/.configured + +$(LINUX_KERNEL): $(LINUX_DIR)/.configured + +kernel-headers: $(LINUX_DIR)/.configured + +kernel-headers-source: $(DL_DIR)/$(LINUX_SOURCE) + +kernel-headers-clean: clean + rm -f $(LINUX_KERNEL) + rm -rf $(LINUX_DIR) + +kernel-headers-dirclean: + rm -rf $(LINUX_DIR) + +endif diff --git a/obsolete-buildroot/make/less.mk b/obsolete-buildroot/make/less.mk new file mode 100644 index 0000000000..af0ed4a3d3 --- /dev/null +++ b/obsolete-buildroot/make/less.mk @@ -0,0 +1,48 @@ +############################################################# +# +# less +# +############################################################# +LESS_SOURCE=less-381.tar.gz +LESS_SITE=http://www.greenwoodsoftware.com/less +LESS_DIR=$(BUILD_DIR)/less-381 +LESS_BINARY=less +LESS_TARGET_BINARY=usr/bin/less + +$(DL_DIR)/$(LESS_SOURCE): + $(WGET) -P $(DL_DIR) $(LESS_SITE)/$(LESS_SOURCE) + +$(LESS_DIR)/.source: $(DL_DIR)/$(LESS_SOURCE) + zcat $(DL_DIR)/$(LESS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LESS_DIR)/.source + +$(LESS_DIR)/.configured: $(LESS_DIR)/.source + (cd $(LESS_DIR); \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --sysconfdir=/etc \ + ); + touch $(LESS_DIR)/.configured; + +$(LESS_DIR)/$(LESS_BINARY): $(LESS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(LESS_DIR) + +$(TARGET_DIR)/$(LESS_TARGET_BINARY): $(LESS_DIR)/$(LESS_BINARY) + $(MAKE) prefix=$(TARGET_DIR)/usr -C $(LESS_DIR) install + rm -Rf $(TARGET_DIR)/usr/man + +less: uclibc $(TARGET_DIR)/$(LESS_TARGET_BINARY) + +less-source: $(DL_DIR)/$(LESS_SOURCE) + +less-clean: + $(MAKE) prefix=$(TARGET_DIR)/usr -C $(LESS_DIR) uninstall + -$(MAKE) -C $(LESS_DIR) clean + +less-dirclean: + rm -rf $(LESS_DIR) + diff --git a/obsolete-buildroot/make/libfloat.mk b/obsolete-buildroot/make/libfloat.mk new file mode 100644 index 0000000000..dffef3de56 --- /dev/null +++ b/obsolete-buildroot/make/libfloat.mk @@ -0,0 +1,55 @@ +############################################################# +# +# libfloat +# +############################################################# +LIBFLOAT_SOURCE:=libfloat_990616.orig.tar.gz +LIBFLOAT_PATCH:=libfloat_990616-3.diff.gz +LIBFLOAT_SITE:=http://ftp.debian.org/debian/pool/main/libf/libfloat +LIBFLOAT_CAT:=zcat +LIBFLOAT_DIR:=$(BUILD_DIR)/libfloat + +LIBFLOAT_TARGET= +ifeq ($(strip $(SOFT_FLOAT)),true) +ifeq ("$(strip $(ARCH))","arm") +LIBFLOAT_TARGET+=$(STAGING_DIR)/lib/libfloat.so +endif +endif + +$(DL_DIR)/$(LIBFLOAT_SOURCE): + $(WGET) -P $(DL_DIR) $(LIBFLOAT_SITE)/$(LIBFLOAT_SOURCE) + +$(DL_DIR)/$(LIBFLOAT_PATCH): + $(WGET) -P $(DL_DIR) $(LIBFLOAT_SITE)/$(LIBFLOAT_PATCH) + +libfloat-source: $(DL_DIR)/$(LIBFLOAT_SOURCE) $(DL_DIR)/$(LIBFLOAT_PATCH) + +$(LIBFLOAT_DIR)/.unpacked: $(DL_DIR)/$(LIBFLOAT_SOURCE) $(DL_DIR)/$(LIBFLOAT_PATCH) + $(LIBFLOAT_CAT) $(DL_DIR)/$(LIBFLOAT_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # Remove the binary files distributed with the the package. + make -C $(LIBFLOAT_DIR) clean + $(SOURCE_DIR)/patch-kernel.sh $(LIBFLOAT_DIR) $(DL_DIR) $(LIBFLOAT_PATCH) + $(SOURCE_DIR)/patch-kernel.sh $(LIBFLOAT_DIR) $(SOURCE_DIR) libfloat.patch + touch $(LIBFLOAT_DIR)/.unpacked + +$(LIBFLOAT_DIR)/libfloat.so.1: $(LIBFLOAT_DIR)/.unpacked $(TARGET_CC) + $(MAKE) CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld -C $(LIBFLOAT_DIR) + +$(STAGING_DIR)/lib/libfloat.so: $(LIBFLOAT_DIR)/libfloat.so.1 + cp -a $(LIBFLOAT_DIR)/libfloat.a $(STAGING_DIR)/lib/libfloat.a + cp -a $(LIBFLOAT_DIR)/libfloat.so.1 $(STAGING_DIR)/lib/libfloat.so.1 + (cd $(STAGING_DIR)/lib ; ln -sf libfloat.so.1 libfloat.so) + cp -a $(LIBFLOAT_DIR)/libfloat.a $(TARGET_DIR)/usr/lib/libfloat.a + cp -a $(LIBFLOAT_DIR)/libfloat.so.1 $(TARGET_DIR)/lib/libfloat.so.1 + $(STRIP) $(TARGET_DIR)/lib/libfloat.so.1 > /dev/null 2>&1 + (cd $(TARGET_DIR)/lib ; ln -sf libfloat.so.1 libfloat.so) + (cd $(TARGET_DIR)/usr/lib ; ln -sf /lib/libfloat.so libfloat.so) + +libfloat: $(STAGING_DIR)/lib/libfloat.so + +libfloat-clean: + -$(MAKE) -C $(LIBFLOAT_DIR) clean + +libfloat-dirclean: + rm -rf $(LIBFLOAT_DIR) + diff --git a/obsolete-buildroot/make/libglib12.mk b/obsolete-buildroot/make/libglib12.mk new file mode 100644 index 0000000000..f6211ee107 --- /dev/null +++ b/obsolete-buildroot/make/libglib12.mk @@ -0,0 +1,79 @@ +############################################################# +# +# libglib1.2 +# +############################################################# +LIBGLIB12_SOURCE:=glib-1.2.10.tar.gz +LIBGLIB12_SITE:=ftp://ftp.gtk.org/pub/gtk/v1.2 +LIBGLIB12_CAT:=zcat +LIBGLIB12_DIR:=$(BUILD_DIR)/glib-1.2.10 +LIBGLIB12_BINARY:=libglib.a +LIBGLIB12_PATCH:=$(SOURCE_DIR)/libglib_configure_1.2.10.bz2 + + +$(DL_DIR)/$(LIBGLIB12_SOURCE): + $(WGET) -P $(DL_DIR) $(LIBGLIB12_SITE)/$(LIBGLIB12_SOURCE) + +libglib12-source: $(DL_DIR)/$(LIBGLIB12_SOURCE) + +$(LIBGLIB12_DIR)/.unpacked: $(DL_DIR)/$(LIBGLIB12_SOURCE) + $(LIBGLIB12_CAT) $(DL_DIR)/$(LIBGLIB12_SOURCE) | tar -C $(BUILD_DIR) -xvf - + bzcat $(LIBGLIB12_PATCH) | patch -p1 -d $(LIBGLIB12_DIR) + touch $(LIBGLIB12_DIR)/.unpacked + +$(LIBGLIB12_DIR)/.configured: $(LIBGLIB12_DIR)/.unpacked + (cd $(LIBGLIB12_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --enable-shared \ + ); + touch $(LIBGLIB12_DIR)/.configured + +$(LIBGLIB12_DIR)/.libs/$(LIBGLIB12_BINARY): $(LIBGLIB12_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(LIBGLIB12_DIR) + +$(STAGING_DIR)/lib/$(LIBGLIB12_BINARY): $(LIBGLIB12_DIR)/.libs/$(LIBGLIB12_BINARY) + $(MAKE) prefix=$(STAGING_DIR) \ + exec_prefix=$(STAGING_DIR) \ + bindir=$(STAGING_DIR)/bin \ + sbindir=$(STAGING_DIR)/sbin \ + libexecdir=$(STAGING_DIR)/libexec \ + datadir=$(STAGING_DIR)/share \ + sysconfdir=$(STAGING_DIR)/etc \ + sharedstatedir=$(STAGING_DIR)/com \ + localstatedir=$(STAGING_DIR)/var \ + libdir=$(STAGING_DIR)/lib \ + includedir=$(STAGING_DIR)/include \ + oldincludedir=$(STAGING_DIR)/include \ + infodir=$(STAGING_DIR)/info \ + mandir=$(STAGING_DIR)/man \ + -C $(LIBGLIB12_DIR) install; + +$(TARGET_DIR)/lib/$(LIBGLIB12_BINARY): $(STAGING_DIR)/lib/$(LIBGLIB12_BINARY) + cp -a $(STAGING_DIR)/lib/$(LIBGLIB12_BINARY) $(TARGET_DIR)/lib/ + cp -a $(STAGING_DIR)/lib/libglib.so $(TARGET_DIR)/lib/ + cp -a $(STAGING_DIR)/lib/libglib-1.2.so.0 $(TARGET_DIR)/lib/ + $(STRIP) --strip-unneeded $(TARGET_DIR)/lib/$(LIBGLIB12_BINARY) + +libglib12: uclibc $(TARGET_DIR)/lib/$(LIBGLIB12_BINARY) + +libglib12-clean: + rm -f $(TARGET_DIR)/lib/$(LIBGLIB12_BINARY) + -$(MAKE) -C $(LIBGLIB12_DIR) clean + +libglib12-dirclean: + rm -rf $(LIBGLIB12_DIR) + diff --git a/obsolete-buildroot/make/libmad.mk b/obsolete-buildroot/make/libmad.mk new file mode 100644 index 0000000000..fc077203cb --- /dev/null +++ b/obsolete-buildroot/make/libmad.mk @@ -0,0 +1,56 @@ +############################################################# +# +# libmad +# +############################################################# + +LIBMAD_VERSION=0.15.0b + +# Don't alter below this line unless you (think) you know +# what you are doing! Danger, Danger! + +LIBMAD_SOURCE=libmad-$(LIBMAD_VERSION).tar.gz +LIBMAD_SITE=http://easynews.dl.sourceforge.net/sourceforge/mad/ +LIBMAD_DIR=$(BUILD_DIR)/${shell basename $(LIBMAD_SOURCE) .tar.gz} +LIBMAD_WORKDIR=$(BUILD_DIR)/libmad-$(LIBMAD_VERSION) + +$(DL_DIR)/$(LIBMAD_SOURCE): + $(WGET) -P $(DL_DIR) $(LIBMAD_SITE)/$(LIBMAD_SOURCE) + +$(LIBMAD_DIR)/.unpacked: $(DL_DIR)/$(LIBMAD_SOURCE) + gzip -d -c $(DL_DIR)/$(LIBMAD_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LIBMAD_DIR)/.unpacked + +$(LIBMAD_DIR)/.configured: $(LIBMAD_DIR)/.unpacked + (cd $(LIBMAD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + ); + touch $(LIBMAD_DIR)/.configured + +$(LIBMAD_WORKDIR)/libmad: $(LIBMAD_DIR)/.configured + rm -f $@ + $(MAKE) CC=$(TARGET_CC) -C $(LIBMAD_WORKDIR) + +$(LIBMAD_WORKDIR)/.installed: $(LIBMAD_WORKDIR)/libmad + $(MAKE) prefix=$(TARGET_DIR)/usr -C $(LIBMAD_WORKDIR) install + touch $(LIBMAD_WORKDIR)/.installed + +libmad: uclibc $(LIBMAD_WORKDIR)/.installed + +libmad-source: $(DL_DIR)/$(LIBMAD_SOURCE) + +libmad-clean: + @if [ -d $(LIBMAD_WORKDIR)/Makefile ] ; then \ + $(MAKE) -C $(LIBMAD_WORKDIR) clean ; \ + fi; + +libmad-dirclean: + rm -rf $(LIBMAD_DIR) $(LIBMAD_WORKDIR) + diff --git a/obsolete-buildroot/make/libtool.mk b/obsolete-buildroot/make/libtool.mk new file mode 100644 index 0000000000..fbe1fb663f --- /dev/null +++ b/obsolete-buildroot/make/libtool.mk @@ -0,0 +1,77 @@ +############################################################# +# +# libtool +# +############################################################# +LIBTOOL_SOURCE:=libtool_1.4.3.orig.tar.gz +LIBTOOL_SITE:=http://ftp.debian.org/debian/pool/main/libt/libtool +LIBTOOL_CAT:=zcat +LIBTOOL_DIR:=$(BUILD_DIR)/libtool-1.4.3 +LIBTOOL_BINARY:=libtool +LIBTOOL_TARGET_BINARY:=usr/bin/libtool + +$(DL_DIR)/$(LIBTOOL_SOURCE): + $(WGET) -P $(DL_DIR) $(LIBTOOL_SITE)/$(LIBTOOL_SOURCE) + +libtool-source: $(DL_DIR)/$(LIBTOOL_SOURCE) + +$(LIBTOOL_DIR)/.unpacked: $(DL_DIR)/$(LIBTOOL_SOURCE) + $(LIBTOOL_CAT) $(DL_DIR)/$(LIBTOOL_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LIBTOOL_DIR)/.unpacked + +$(LIBTOOL_DIR)/.configured: $(LIBTOOL_DIR)/.unpacked + (cd $(LIBTOOL_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(LIBTOOL_DIR)/.configured + +$(LIBTOOL_DIR)/$(LIBTOOL_BINARY): $(LIBTOOL_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(LIBTOOL_DIR) + touch -c $(LIBTOOL_DIR)/$(LIBTOOL_BINARY) + +$(TARGET_DIR)/$(LIBTOOL_TARGET_BINARY): $(LIBTOOL_DIR)/$(LIBTOOL_BINARY) + $(MAKE) \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + bindir=$(TARGET_DIR)/usr/bin \ + sbindir=$(TARGET_DIR)/usr/sbin \ + libexecdir=$(TARGET_DIR)/usr/lib \ + datadir=$(TARGET_DIR)/usr/share \ + sysconfdir=$(TARGET_DIR)/etc \ + localstatedir=$(TARGET_DIR)/var \ + libdir=$(TARGET_DIR)/usr/lib \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(TARGET_DIR)/usr/include \ + -C $(LIBTOOL_DIR) install; + $(STRIP) $(TARGET_DIR)//usr/lib/libltdl.so.*.*.* > /dev/null 2>&1 + $(SED) "s,^CC.*,CC=\"/usr/bin/gcc\"," $(TARGET_DIR)/usr/bin/libtool + $(SED) "s,^LD.*,LD=\"/usr/bin/ld\"," $(TARGET_DIR)/usr/bin/libtool + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +libtool: uclibc $(TARGET_DIR)/$(LIBTOOL_TARGET_BINARY) + +libtool-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(LIBTOOL_DIR) uninstall + -$(MAKE) -C $(LIBTOOL_DIR) clean + +libtool-dirclean: + rm -rf $(LIBTOOL_DIR) + diff --git a/obsolete-buildroot/make/links.mk b/obsolete-buildroot/make/links.mk new file mode 100644 index 0000000000..28c5a9cc40 --- /dev/null +++ b/obsolete-buildroot/make/links.mk @@ -0,0 +1,54 @@ +############################################################# +# +# links (text based web browser) +# +############################################################# +LINKS_SITE:=http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/links/download/no-ssl +LINKS_SOURCE:=links-0.99pre9-no-ssl.tar.gz +LINKS_DIR:=$(BUILD_DIR)/links-0.99pre9-no-ssl + +$(DL_DIR)/$(LINKS_SOURCE): + $(WGET) -P $(DL_DIR) $(LINKS_SITE)/$(LINKS_SOURCE) + +links-source: $(DL_DIR)/$(LINKS_SOURCE) + +$(LINKS_DIR)/.unpacked: $(DL_DIR)/$(LINKS_SOURCE) + zcat $(DL_DIR)/$(LINKS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LINKS_DIR)/.unpacked + +$(LINKS_DIR)/.configured: $(LINKS_DIR)/.unpacked + (cd $(LINKS_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/tmp \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(LINKS_DIR)/.configured + +$(LINKS_DIR)/links: $(LINKS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(LINKS_DIR) + $(STRIP) $(LINKS_DIR)/links + +$(TARGET_DIR)/usr/bin/links: $(LINKS_DIR)/links + install -c $(LINKS_DIR)/links $(TARGET_DIR)/usr/bin/links + +links-clean: + $(MAKE) -C $(LINKS_DIR) clean + +links-dirclean: + rm -rf $(LINKS_DIR) + +links: uclibc $(TARGET_DIR)/usr/bin/links + diff --git a/obsolete-buildroot/make/linux.mk b/obsolete-buildroot/make/linux.mk new file mode 100644 index 0000000000..fcd808a7ae --- /dev/null +++ b/obsolete-buildroot/make/linux.mk @@ -0,0 +1,113 @@ +############################################################# +# +# Linux kernel targets +# +# Note: If you have any patches to apply, create the directory +# sources/kernel-patches and put your patches in there and number +# them in the order you wish to apply them... i.e. +# +# sources/kernel-patches/001-my-special-stuff.bz2 +# sources/kernel-patches/003-gcc-Os.bz2 +# sources/kernel-patches/004_no-warnings.bz2 +# sources/kernel-patches/030-lowlatency-mini.bz2 +# sources/kernel-patches/031-lowlatency-fixes-5.bz2 +# sources/kernel-patches/099-shutup.bz2 +# etc... +# +# these patches will all be applied by the patch-kernel.sh +# script (which will also abort the build if it finds rejects) +# -Erik +# +############################################################# +ifneq ($(filter $(TARGETS),linux),) + +# Version of Linux to download and then apply patches to +DOWNLOAD_LINUX_VERSION=2.4.25 +# Version of Linux AFTER patches +LINUX_VERSION=2.4.26-pre5-erik + +LINUX_FORMAT=bzImage +#LINUX_FORMAT=images/zImage.prep +LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \ + -e 's/mipsel/mips/' \ + -e 's/powerpc/ppc/' \ + -e 's/sh[234]/sh/' \ + ) +LINUX_BINLOC=arch/$(LINUX_KARCH)/boot/$(LINUX_FORMAT) + +LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION) +LINUX_SOURCE=linux-$(DOWNLOAD_LINUX_VERSION).tar.bz2 +LINUX_SITE=ftp://ftp.kernel.org/pub/linux/kernel/v2.4 +LINUX_KCONFIG=$(SOURCE_DIR)/linux.config +LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel +# Used by pcmcia-cs and others +LINUX_SOURCE_DIR=$(LINUX_DIR) + + +$(DL_DIR)/$(LINUX_SOURCE): + $(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE) + +$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) + mkdir -p $(LINUX_DIR) $(TOOL_BUILD_DIR) + rm -rf $(LINUX_DIR) + bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf - +ifneq ($(DOWNLOAD_LINUX_VERSION),$(LINUX_VERSION)) + # Rename the dir from the downloaded version to the AFTER patch version + mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX_VERSION) $(BUILD_DIR)/linux-$(LINUX_VERSION) +endif + mkdir -p $(SOURCE_DIR)/kernel-patches + $(SOURCE_DIR)/patch-kernel.sh $(LINUX_DIR) $(SOURCE_DIR)/kernel-patches + -(cd $(TOOL_BUILD_DIR); ln -sf $(LINUX_DIR) linux) + touch $(LINUX_DIR)/.unpacked + +$(LINUX_KCONFIG): + @if [ ! -f "$(LINUX_KCONFIG)" ] ; then \ + echo ""; \ + echo "You should create a .config for your kernel"; \ + echo "and install it as $(LINUX_KCONFIG)"; \ + echo ""; \ + sleep 5; \ + fi; + +$(LINUX_DIR)/.configured $(BUILD_DIR)/linux/.configured: $(LINUX_DIR)/.unpacked $(LINUX_KCONFIG) + $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile + -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config + $(MAKE) -C $(LINUX_DIR) oldconfig include/linux/version.h + touch $(LINUX_DIR)/.configured + +$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured + $(MAKE) -C $(LINUX_DIR) dep + touch $(LINUX_DIR)/.depend_done + +$(LINUX_DIR)/$(LINUX_BINLOC): $(LINUX_DIR)/.depend_done + $(MAKE) -C $(LINUX_DIR) $(LINUX_FORMAT) + $(MAKE) -C $(LINUX_DIR) modules + +$(LINUX_KERNEL): $(LINUX_DIR)/$(LINUX_BINLOC) + cp -fa $(LINUX_DIR)/$(LINUX_BINLOC) $(LINUX_KERNEL) + touch -c $(LINUX_KERNEL) + +$(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep: $(LINUX_KERNEL) + rm -rf $(TARGET_DIR)/lib/modules + rm -f $(TARGET_DIR)/sbin/cardmgr + $(MAKE) -C $(LINUX_DIR) INSTALL_MOD_PATH=$(TARGET_DIR) modules_install + (cd $(TARGET_DIR)/lib/modules; ln -s $(LINUX_VERSION)/kernel/drivers .) + +$(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured + mkdir -p $(STAGING_DIR)/include + tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/ + tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/ + +linux: $(STAGING_DIR)/include/linux/version.h $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep + +linux-source: $(DL_DIR)/$(LINUX_SOURCE) + +# This has been renamed so we do _NOT_ by default run this on 'make clean' +linuxclean: clean + rm -f $(LINUX_KERNEL) + -$(MAKE) -C $(LINUX_DIR) clean + +linux-dirclean: + rm -rf $(LINUX_DIR) + +endif diff --git a/obsolete-buildroot/make/lrzsz.mk b/obsolete-buildroot/make/lrzsz.mk new file mode 100644 index 0000000000..222d64a712 --- /dev/null +++ b/obsolete-buildroot/make/lrzsz.mk @@ -0,0 +1,76 @@ +############################################################# +# +# lrzsz (provides zmodem) +# +############################################################# +# Copyright (C) 2001-2003 by Erik Andersen +# Copyright (C) 2002 by Tim Riker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + +LRZSZ_SITE:=http://www.ohse.de/uwe/releases +LRZSZ_SOURCE:=lrzsz-0.12.20.tar.gz +LRZSZ_DIR:=$(BUILD_DIR)/lrzsz-0.12.20 + +$(DL_DIR)/$(LRZSZ_SOURCE): + $(WGET) -P $(DL_DIR) $(LRZSZ_SITE)/$(LRZSZ_SOURCE) + +lrzsz-source: $(DL_DIR)/$(LRZSZ_SOURCE) + +$(LRZSZ_DIR)/.unpacked: $(DL_DIR)/$(LRZSZ_SOURCE) + zcat $(DL_DIR)/$(LRZSZ_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LRZSZ_DIR)/.unpacked + +$(LRZSZ_DIR)/.configured: $(LRZSZ_DIR)/.unpacked + (cd $(LRZSZ_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/tmp \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --disable-timesync \ + ); + $(SED) "s/-lnsl//;" $(LRZSZ_DIR)/src/Makefile + $(SED) "s~\(#define ENABLE_SYSLOG.*\)~/* \1 */~;" $(LRZSZ_DIR)/config.h + touch $(LRZSZ_DIR)/.configured + +$(LRZSZ_DIR)/src/lrz: $(LRZSZ_DIR)/.configured + $(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" prefix="$(TARGET_DIR)" -C $(LRZSZ_DIR) + $(STRIP) $(LRZSZ_DIR)/src/lrz $(LRZSZ_DIR)/src/lsz + +$(TARGET_DIR)/usr/bin/rz: $(LRZSZ_DIR)/src/lrz + cp $(LRZSZ_DIR)/src/lrz $(TARGET_DIR)/usr/bin/rz + cp $(LRZSZ_DIR)/src/lsz $(TARGET_DIR)/usr/bin/sz + +lrzsz: uclibc $(TARGET_DIR)/usr/bin/rz + +lrzsz-clean: + rm -f $(TARGET_DIR)/usr/bin/rz + -$(MAKE) -C $(LRZSZ_DIR) clean + +lrzsz-dirclean: + rm -rf $(LRZSZ_DIR) diff --git a/obsolete-buildroot/make/ltp-testsuite.mk b/obsolete-buildroot/make/ltp-testsuite.mk new file mode 100644 index 0000000000..cb4a0161d1 --- /dev/null +++ b/obsolete-buildroot/make/ltp-testsuite.mk @@ -0,0 +1,39 @@ +############################################################# +# +# ltp-testsuite +# +############################################################# +LTP_TESTSUITE_SOURCE:=ltp-full-20040206.tgz +LTP_TESTSUITE_SITE:=http://aleron.dl.sourceforge.net/sourceforge/ltp +LTP_TESTSUITE_CAT:=zcat +LTP_TESTSUITE_DIR:=$(BUILD_DIR)/ltp-full-20040206 +LTP_TESTSUITE_PATCH:=$(SOURCE_DIR)/ltp-testsuite.patch + + +$(DL_DIR)/$(LTP_TESTSUITE_SOURCE): + $(WGET) -P $(DL_DIR) $(LTP_TESTSUITE_SITE)/$(LTP_TESTSUITE_SOURCE) + +ltp-testsuite-source: $(DL_DIR)/$(LTP_TESTSUITE_SOURCE) + +$(LTP_TESTSUITE_DIR)/.unpacked: $(DL_DIR)/$(LTP_TESTSUITE_SOURCE) + $(LTP_TESTSUITE_CAT) $(DL_DIR)/$(LTP_TESTSUITE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(LTP_TESTSUITE_PATCH) | patch -p1 -d $(LTP_TESTSUITE_DIR) + touch $(LTP_TESTSUITE_DIR)/.unpacked + +$(LTP_TESTSUITE_DIR)/ltp-testsuite: $(LTP_TESTSUITE_DIR)/.unpacked + $(MAKE) $(TARGET_CONFIGURE_OPTS) CROSS_COMPILER=$(TARGET_CROSS) \ + -C $(LTP_TESTSUITE_DIR) + +$(TARGET_DIR)/usr/bin/ltp-testsuite: $(LTP_TESTSUITE_DIR)/ltp-testsuite + $(MAKE) $(TARGET_CONFIGURE_OPTS) CROSS_COMPILER=$(TARGET_CROSS) \ + -C $(LTP_TESTSUITE_DIR) install + +ltp-testsuite: uclibc $(TARGET_DIR)/usr/bin/ltp-testsuite + +ltp-testsuite-clean: + $(MAKE) -C $(LTP_TESTSUITE_DIR) clean + +ltp-testsuite-dirclean: + rm -rf $(LTP_TESTSUITE_DIR) + + diff --git a/obsolete-buildroot/make/ltrace.mk b/obsolete-buildroot/make/ltrace.mk new file mode 100644 index 0000000000..9b41626e08 --- /dev/null +++ b/obsolete-buildroot/make/ltrace.mk @@ -0,0 +1,48 @@ +############################################################# +# +# ltrace +# +############################################################# +LTRACE_SOURCE=ltrace_0.3.31.tar.gz +LTRACE_SITE=http://ftp.debian.org/debian/pool/main/l/ltrace +LTRACE_DIR=$(BUILD_DIR)/ltrace-0.3.31 +LTRACE_BINARY=ltrace +LTRACE_TARGET_BINARY=usr/bin/ltrace + +$(DL_DIR)/$(LTRACE_SOURCE): + $(WGET) -P $(DL_DIR) $(LTRACE_SITE)/$(LTRACE_SOURCE) + +$(LTRACE_DIR)/.source: $(DL_DIR)/$(LTRACE_SOURCE) + zcat $(DL_DIR)/$(LTRACE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LTRACE_DIR)/.source + +$(LTRACE_DIR)/.configured: $(LTRACE_DIR)/.source + (cd $(LTRACE_DIR); \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --sysconfdir=/etc \ + ); + touch $(LTRACE_DIR)/.configured; + +$(LTRACE_DIR)/$(LTRACE_BINARY): $(LTRACE_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(LTRACE_DIR) + +$(TARGET_DIR)/$(LTRACE_TARGET_BINARY): $(LTRACE_DIR)/$(LTRACE_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(LTRACE_DIR) install + rm -Rf $(TARGET_DIR)/usr/man + +ltrace: uclibc $(TARGET_DIR)/$(LTRACE_TARGET_BINARY) + +ltrace-source: $(DL_DIR)/$(LTRACE_SOURCE) + +ltrace-clean: + $(MAKE) prefix=$(TARGET_DIR)/usr -C $(LTRACE_DIR) uninstall + -$(MAKE) -C $(LTRACE_DIR) clean + +ltrace-dirclean: + rm -rf $(LTRACE_DIR) + diff --git a/obsolete-buildroot/make/lzo.mk b/obsolete-buildroot/make/lzo.mk new file mode 100644 index 0000000000..48e9d7b5db --- /dev/null +++ b/obsolete-buildroot/make/lzo.mk @@ -0,0 +1,65 @@ +############################################################# +# +# lzo +# +# Note: this builds only a static library, it does not provide +# anything to be installed into the target system. +# +############################################################# +LZO_SOURCE:=lzo_1.08.orig.tar.gz +LZO_SITE:=http://ftp.debian.org/debian/pool/main/l/lzo +#LZO_SOURCE:=lzo-1.08.tar.bz2 +#LZO_SITE:=http://www.oberhumer.com/opensource/lzo/download +LZO_DIR:=$(BUILD_DIR)/lzo-1.08 +LZO_CAT:=zcat +LZO_PATCH:=$(SOURCE_DIR)/lzo-cross-compile.patch + +$(DL_DIR)/$(LZO_SOURCE): + $(WGET) -P $(DL_DIR) $(LZO_SITE)/$(LZO_SOURCE) + +lzo-source: $(DL_DIR)/$(LZO_SOURCE) + +$(LZO_DIR)/.unpacked: $(DL_DIR)/$(LZO_SOURCE) + $(LZO_CAT) $(DL_DIR)/$(LZO_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(LZO_PATCH) | patch -p1 -d $(LZO_DIR) + touch $(LZO_DIR)/.unpacked + +LZO_CONFIG_SHARED:=--disable-shared +#LZO_CONFIG_SHARED:=--enable-shared + +$(LZO_DIR)/.configured: $(LZO_DIR)/.unpacked + (cd $(LZO_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(LZO_CONFIG_SHARED) \ + ); + touch $(LZO_DIR)/.configured + +$(LZO_DIR)/src/liblzo.la: $(LZO_DIR)/.configured + $(MAKE) -C $(LZO_DIR) + +$(STAGING_DIR)/lib/liblzo.a: $(LZO_DIR)/src/liblzo.la + $(MAKE) CC=$(TARGET_CC) DESTDIR=$(STAGING_DIR) -C $(LZO_DIR) install + +lzo: uclibc $(STAGING_DIR)/lib/liblzo.a + +lzo-clean: + $(MAKE) DESTDIR=$(STAGING_DIR) -C $(LZO_DIR) uninstall + -$(MAKE) -C $(LZO_DIR) clean + +lzo-dirclean: + rm -rf $(LZO_DIR) + diff --git a/obsolete-buildroot/make/m4.mk b/obsolete-buildroot/make/m4.mk new file mode 100644 index 0000000000..5a09889729 --- /dev/null +++ b/obsolete-buildroot/make/m4.mk @@ -0,0 +1,65 @@ +############################################################# +# +# m4 +# +############################################################# +M4_SOURCE:=m4-1.4.tar.gz +M4_SITE:=ftp://ftp.gnu.org/gnu/m4 +M4_CAT:=zcat +M4_DIR:=$(BUILD_DIR)/m4-1.4 +M4_BINARY:=m4 +M4_TARGET_BINARY:=usr/bin/m4 + +$(DL_DIR)/$(M4_SOURCE): + $(WGET) -P $(DL_DIR) $(M4_SITE)/$(M4_SOURCE) + +m4-source: $(DL_DIR)/$(M4_SOURCE) + +$(M4_DIR)/.unpacked: $(DL_DIR)/$(M4_SOURCE) + $(M4_CAT) $(DL_DIR)/$(M4_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(M4_DIR)/.unpacked + +$(M4_DIR)/.configured: $(M4_DIR)/.unpacked + (cd $(M4_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + ); + touch $(M4_DIR)/.configured + +$(M4_DIR)/src/$(M4_BINARY): $(M4_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(M4_DIR) + +$(TARGET_DIR)/$(M4_TARGET_BINARY): $(M4_DIR)/src/$(M4_BINARY) + $(MAKE) \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + bindir=$(TARGET_DIR)/usr/bin \ + sbindir=$(TARGET_DIR)/usr/sbin \ + libexecdir=$(TARGET_DIR)/usr/lib \ + datadir=$(TARGET_DIR)/usr/share \ + sysconfdir=$(TARGET_DIR)/etc \ + localstatedir=$(TARGET_DIR)/var \ + libdir=$(TARGET_DIR)/usr/lib \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(TARGET_DIR)/usr/include \ + -C $(M4_DIR) install; + $(STRIP) $(TARGET_DIR)/$(M4_TARGET_BINARY) > /dev/null 2>&1 + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +m4: uclibc $(TARGET_DIR)/$(M4_TARGET_BINARY) + +m4-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(M4_DIR) uninstall + -$(MAKE) -C $(M4_DIR) clean + +m4-dirclean: + rm -rf $(M4_DIR) + diff --git a/obsolete-buildroot/make/make.mk b/obsolete-buildroot/make/make.mk new file mode 100644 index 0000000000..ec508fed3b --- /dev/null +++ b/obsolete-buildroot/make/make.mk @@ -0,0 +1,61 @@ +############################################################# +# +# make +# +############################################################# +GNUMAKE_SOURCE:=make-3.80.tar.bz2 +GNUMAKE_SITE:=ftp://ftp.gnu.org/gnu/make +GNUMAKE_DIR:=$(BUILD_DIR)/make-3.80 +GNUMAKE_CAT:=bzcat +GNUMAKE_BINARY:=make +GNUMAKE_TARGET_BINARY:=usr/bin/make + +$(DL_DIR)/$(GNUMAKE_SOURCE): + $(WGET) -P $(DL_DIR) $(GNUMAKE_SITE)/$(GNUMAKE_SOURCE) + +make-source: $(DL_DIR)/$(GNUMAKE_SOURCE) + +$(GNUMAKE_DIR)/.unpacked: $(DL_DIR)/$(GNUMAKE_SOURCE) + $(GNUMAKE_CAT) $(DL_DIR)/$(GNUMAKE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(GNUMAKE_DIR)/.unpacked + +$(GNUMAKE_DIR)/.configured: $(GNUMAKE_DIR)/.unpacked + (cd $(GNUMAKE_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(GNUMAKE_DIR)/.configured + +$(GNUMAKE_DIR)/$(GNUMAKE_BINARY): $(GNUMAKE_DIR)/.configured + $(MAKE) -C $(GNUMAKE_DIR) + +$(TARGET_DIR)/$(GNUMAKE_TARGET_BINARY): $(GNUMAKE_DIR)/$(GNUMAKE_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUMAKE_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +make: uclibc $(TARGET_DIR)/$(GNUMAKE_TARGET_BINARY) + +make-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUMAKE_DIR) uninstall + -$(MAKE) -C $(GNUMAKE_DIR) clean + +make-dirclean: + rm -rf $(GNUMAKE_DIR) + diff --git a/obsolete-buildroot/make/microcom.mk b/obsolete-buildroot/make/microcom.mk new file mode 100644 index 0000000000..bf01cf3d7f --- /dev/null +++ b/obsolete-buildroot/make/microcom.mk @@ -0,0 +1,59 @@ +############################################################# +# +# microcom terminal emulator +# +# Maintainer: Tim Riker +# +############################################################# +# Copyright (C) 2001-2003 by Erik Andersen +# Copyright (C) 2002 by Tim Riker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + +# TARGETS +# http://microcom.port5.com/m102.tar.gz +MICROCOM_SITE:=http://microcom.port5.com/ +MICROCOM_SOURCE:=m102.tar.gz +MICROCOM_DIR:=$(BUILD_DIR)/microcom-1.02 + +$(DL_DIR)/$(MICROCOM_SOURCE): + $(WGET) -P $(DL_DIR) $(MICROCOM_SITE)/$(MICROCOM_SOURCE) + +microcom-source: $(DL_DIR)/$(MICROCOM_SOURCE) + +$(MICROCOM_DIR)/.unpacked: $(DL_DIR)/$(MICROCOM_SOURCE) + mkdir -p $(MICROCOM_DIR) + zcat $(DL_DIR)/$(MICROCOM_SOURCE) | tar -C $(MICROCOM_DIR) -xvf - + touch $(MICROCOM_DIR)/.unpacked + +$(MICROCOM_DIR)/.configured: $(MICROCOM_DIR)/.unpacked + $(SED) 's~gcc~${TARGET_CC}~' $(MICROCOM_DIR)/Makefile + touch $(MICROCOM_DIR)/.configured + +$(MICROCOM_DIR)/microcom: $(MICROCOM_DIR)/.configured + $(MAKE) -C $(MICROCOM_DIR) + +$(TARGET_DIR)/usr/bin/microcom: $(MICROCOM_DIR)/microcom + install -c $(MICROCOM_DIR)/microcom $(TARGET_DIR)/usr/bin/microcom + +microcom-clean: + rm $(MICROCOM_DIR)/*.o + +microcom-dirclean: + rm -rf $(MICROCOM_DIR) + +microcom: uclibc $(TARGET_DIR)/usr/bin/microcom + diff --git a/obsolete-buildroot/make/microwin.mk b/obsolete-buildroot/make/microwin.mk new file mode 100644 index 0000000000..e59600f39b --- /dev/null +++ b/obsolete-buildroot/make/microwin.mk @@ -0,0 +1,46 @@ +############################################################# +# +# Microwindows - 2003/11/17 Greg Haerr +# (requires CVS 2003/11/17 or later) +# +############################################################# +MICROWIN_SITE:=ftp://ftp.microwindows.org/pub/microwindows +MICROWIN_SOURCE:=microwindows-src-snapshot.tar.gz +MICROWIN_DIR:=$(BUILD_DIR)/microwin +#MICROWIN_SOURCE:=microwindows-0.91.tar.gz +#MICROWIN_DIR:=$(BUILD_DIR)/microwindows-0.91 + +MICROWIN_CAT:=zcat +MICROWIN_BINARY:=$(MICROWIN_DIR)/src/bin/nano-X +MICROWIN_TARGET_BINARY:=$(TARGET_DIR)/usr/bin/nano-X + +MICROWIN_CONFIG:=$(MICROWIN_DIR)/src/Configs/config.uclibc + +$(DL_DIR)/$(MICROWIN_SOURCE): + $(WGET) -P $(DL_DIR) $(MICROWIN_SITE)/$(MICROWIN_SOURCE) + +microwin-source: $(DL_DIR)/$(MICROWIN_SOURCE) + +$(MICROWIN_DIR)/.unpacked: $(DL_DIR)/$(MICROWIN_SOURCE) + $(MICROWIN_CAT) $(DL_DIR)/$(MICROWIN_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(MICROWIN_DIR)/.unpacked + +$(MICROWIN_DIR)/.configured: $(MICROWIN_DIR)/.unpacked + (cd $(MICROWIN_DIR); \ + ); + touch $(MICROWIN_DIR)/.configured + +$(MICROWIN_BINARY): $(MICROWIN_DIR)/.configured + $(MAKE) ARCH=LINUX-$(shell echo $(ARCH) | tr a-z A-Z) $(shell echo $(ARCH) | tr a-z A-Z)TOOLSPREFIX=$(TARGET_CROSS) CC=$(TARGET_CC) -C $(MICROWIN_DIR)/src CONFIG=$(MICROWIN_CONFIG) + +$(MICROWIN_TARGET_BINARY): $(MICROWIN_BINARY) + $(MAKE) INSTALL_PREFIX=$(TARGET_DIR)/usr INSTALL_OWNER1= INSTALL_OWNER2= CC=$(TARGET_CC) -C $(MICROWIN_DIR)/src CONFIG=$(MICROWIN_CONFIG) install + +microwin: uclibc $(MICROWIN_TARGET_BINARY) + +microwin-clean: + -$(MAKE) -C $(MICROWIN_DIR)/src clean + +microwin-dirclean: + rm -rf $(MICROWIN_DIR) + diff --git a/obsolete-buildroot/make/mkdosfs.mk b/obsolete-buildroot/make/mkdosfs.mk new file mode 100644 index 0000000000..98288afed3 --- /dev/null +++ b/obsolete-buildroot/make/mkdosfs.mk @@ -0,0 +1,44 @@ +############################################################# +# +# mkdosfs +# +############################################################# +MKDOSFS_SOURCE=dosfstools-2.8.src.tar.gz +MKDOSFS_SITE=http://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools +MKDOSFS_DIR=$(BUILD_DIR)/dosfstools-2.8 +MKDOSFS_CAT:=zcat +MKDOSFS_BINARY:=mkdosfs/mkdosfs +MKDOSFS_TARGET_BINARY:=sbin/mkdosfs +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) +MKDOSFS_CFLAGS="-Os -g -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" +else +MKDOSFS_CFLAGS="-Os -g" +endif + +$(DL_DIR)/$(MKDOSFS_SOURCE): + $(WGET) -P $(DL_DIR) $(MKDOSFS_SITE)/$(MKDOSFS_SOURCE) + +mkdosfs-source: $(DL_DIR)/$(MKDOSFS_SOURCE) + +$(MKDOSFS_DIR)/.unpacked: $(DL_DIR)/$(MKDOSFS_SOURCE) + $(MKDOSFS_CAT) $(DL_DIR)/$(MKDOSFS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(MKDOSFS_DIR)/.unpacked + +$(MKDOSFS_DIR)/$(MKDOSFS_BINARY): $(MKDOSFS_DIR)/.unpacked + $(MAKE) CFLAGS=$(MKDOSFS_CFLAGS) CC=$(TARGET_CC) -C $(MKDOSFS_DIR); + $(STRIP) $(MKDOSFS_DIR)/mkdosfs/mkdosfs; + touch -c $(MKDOSFS_DIR)/mkdosfs/mkdosfs + +$(TARGET_DIR)/$(MKDOSFS_TARGET_BINARY): $(MKDOSFS_DIR)/$(MKDOSFS_BINARY) + cp -a $(MKDOSFS_DIR)/$(MKDOSFS_BINARY) $(TARGET_DIR)/$(MKDOSFS_TARGET_BINARY) + touch -c $(TARGET_DIR)/sbin/mkdosfs + +mkdosfs: uclibc $(TARGET_DIR)/$(MKDOSFS_TARGET_BINARY) + +mkdosfs-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(MKDOSFS_DIR) uninstall + -$(MAKE) -C $(MKDOSFS_DIR) clean + +mkdosfs-dirclean: + rm -rf $(MKDOSFS_DIR) + diff --git a/obsolete-buildroot/make/mke2fs.mk b/obsolete-buildroot/make/mke2fs.mk new file mode 100644 index 0000000000..6168cfaed4 --- /dev/null +++ b/obsolete-buildroot/make/mke2fs.mk @@ -0,0 +1,71 @@ +############################################################# +# +# mke2fs +# +############################################################# +MKE2FS_SOURCE=e2fsprogs-1.27.tar.gz +MKE2FS_SITE=http://aleron.dl.sourceforge.net/sourceforge/e2fsprogs +MKE2FS_DIR=$(BUILD_DIR)/e2fsprogs-1.27 +MKE2FS_CAT:=zcat +MKE2FS_BINARY:=misc/mke2fs +MKE2FS_TARGET_BINARY:=sbin/mke2fs + +$(DL_DIR)/$(MKE2FS_SOURCE): + $(WGET) -P $(DL_DIR) $(MKE2FS_SITE)/$(MKE2FS_SOURCE) + +mke2fs-source: $(DL_DIR)/$(MKE2FS_SOURCE) + +$(MKE2FS_DIR)/.unpacked: $(DL_DIR)/$(MKE2FS_SOURCE) + $(MKE2FS_CAT) $(DL_DIR)/$(MKE2FS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(MKE2FS_DIR)/.unpacked + +$(MKE2FS_DIR)/.configured: $(MKE2FS_DIR)/.unpacked + (cd $(MKE2FS_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --with-cc=$(TARGET_CC) \ + --with-linker=$(TARGET_CROSS)ld \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --disable-elf-shlibs --disable-swapfs \ + --disable-debugfs --disable-imager \ + --disable-resizer --disable-fsck \ + --without-catgets $(DISABLE_NLS) \ + ); + touch $(MKE2FS_DIR)/.configured + +$(MKE2FS_DIR)/$(MKE2FS_BINARY): $(MKE2FS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(MKE2FS_DIR) + $(STRIP) $(MKE2FS_DIR)/misc/mke2fs $(MKE2FS_DIR)/misc/badblocks; + touch -c $(MKE2FS_DIR)/misc/mke2fs + +$(TARGET_DIR)/$(MKE2FS_TARGET_BINARY): $(MKE2FS_DIR)/$(MKE2FS_BINARY) + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(MKE2FS_DIR) install + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + # Only install a few selected items... + cp -dpf $(MKE2FS_DIR)/misc/mke2fs $(TARGET_DIR)/sbin/mke2fs; + cp -dpf $(MKE2FS_DIR)/misc/badblocks $(TARGET_DIR)/sbin/badblocks; + touch -c $(TARGET_DIR)/sbin/mke2fs + +mke2fs: uclibc $(TARGET_DIR)/$(MKE2FS_TARGET_BINARY) + +mke2fs-clean: + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(MKE2FS_DIR) uninstall + rm -f $(TARGET_DIR)/sbin/mke2fs $(TARGET_DIR)/sbin/badblocks; + -$(MAKE) -C $(MKE2FS_DIR) clean + +mke2fs-dirclean: + rm -rf $(MKE2FS_DIR) + diff --git a/obsolete-buildroot/make/mpg123.mk b/obsolete-buildroot/make/mpg123.mk new file mode 100644 index 0000000000..796db7f79f --- /dev/null +++ b/obsolete-buildroot/make/mpg123.mk @@ -0,0 +1,45 @@ +############################################################# +# +# mpg123 +# +############################################################# + +MPG123_VERSION=0.59r + +# Don't alter below this line unless you (think) you know +# what you are doing! Danger, Danger! + +MPG123_SOURCE=mpg123-$(MPG123_VERSION).tar.gz +MPG123_SITE=http://www.mpg123.de/mpg123 +MPG123_DIR=$(BUILD_DIR)/${shell basename $(MPG123_SOURCE) .tar.gz} +MPG123_WORKDIR=$(BUILD_DIR)/mpg123-$(MPG123_VERSION) + +$(DL_DIR)/$(MPG123_SOURCE): + $(WGET) -P $(DL_DIR) $(MPG123_SITE)/$(MPG123_SOURCE) + +$(MPG123_DIR)/.unpacked: $(DL_DIR)/$(MPG123_SOURCE) + gzip -d -c $(DL_DIR)/$(MPG123_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(MPG123_DIR)/.unpacked + +$(MPG123_WORKDIR)/mpg123: $(MPG123_DIR)/.unpacked + rm -f $@ + $(MAKE) CC=$(TARGET_CC) -C $(MPG123_WORKDIR) linux + +$(MPG123_WORKDIR)/.installed: $(MPG123_WORKDIR)/mpg123 + mkdir -p $(TARGET_DIR)/usr/bin + cp -f $(MPG123_WORKDIR)/mpg123 $(TARGET_DIR)/usr/bin + $(STRIP) --strip-all $(TARGET_DIR)/usr/bin/mpg123 + touch $(MPG123_WORKDIR)/.installed + +mpg123: uclibc libmad $(MPG123_WORKDIR)/.installed + +mpg123-source: $(DL_DIR)/$(MPG123_SOURCE) + +mpg123-clean: + @if [ -d $(MPG123_WORKDIR)/Makefile ] ; then \ + $(MAKE) -C $(MPG123_WORKDIR) clean ; \ + fi; + +mpg123-dirclean: + rm -rf $(MPG123_DIR) $(MPG123_WORKDIR) + diff --git a/obsolete-buildroot/make/mrouted.mk b/obsolete-buildroot/make/mrouted.mk new file mode 100644 index 0000000000..13a4f8c720 --- /dev/null +++ b/obsolete-buildroot/make/mrouted.mk @@ -0,0 +1,45 @@ +############################################################# +# +# mrouted +# +# +############################################################# +MROUTED_SOURCE:=mrouted_3.9-beta3.orig.tar.gz +MROUTED_SITE:=http://ftp.debian.org/debian/pool/non-free/m/mrouted +MROUTED_DIR:=$(BUILD_DIR)/mrouted-3.9-beta3.orig +MROUTED_CAT:=zcat +#MROUTED_PATCH:=$(SOURCE_DIR)/mrouted_3.9-beta3-1.1.diff +MROUTED_PATCH:=mrouted_3.9-beta3-1.1.diff.gz +MROUTED_BINARY:=mrouted +MROUTED_TARGET_BINARY:=usr/sbin/mrouted + +$(DL_DIR)/$(MROUTED_SOURCE): + $(WGET) -P $(DL_DIR) $(MROUTED_SITE)/$(MROUTED_SOURCE) + +$(DL_DIR)/$(MROUTED_PATCH): + $(WGET) -P $(DL_DIR) $(MROUTED_SITE)/$(MROUTED_PATCH) + +mrouted-source: $(DL_DIR)/$(MROUTED_SOURCE) $(DL_DIR)/$(MROUTED_PATCH) + +$(MROUTED_DIR)/.unpacked: mrouted-source + $(MROUTED_CAT) $(DL_DIR)/$(MROUTED_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(MROUTED_CAT) $(DL_DIR)/$(MROUTED_PATCH) | patch -p1 -d $(MROUTED_DIR) + $(SOURCE_DIR)/patch-kernel.sh $(MROUTED_DIR) $(SOURCE_DIR) mrouted-*.patch + touch $(MROUTED_DIR)/.unpacked + +$(MROUTED_DIR)/$(MROUTED_BINARY): $(MROUTED_DIR)/.unpacked + $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) CC=$(TARGET_CC) -C $(MROUTED_DIR) + +$(TARGET_DIR)/$(MROUTED_TARGET_BINARY): $(MROUTED_DIR)/$(MROUTED_BINARY) + cp -a $(MROUTED_DIR)/$(MROUTED_BINARY) $(TARGET_DIR)/$(MROUTED_TARGET_BINARY) + +mrouted: uclibc $(TARGET_DIR)/$(MROUTED_TARGET_BINARY) + +mrouted-clean: + rm -f $(TARGET_DIR)/$(MROUTED_TARGET_BINARY) + -$(MAKE) -C $(MROUTED_DIR) clean + +mrouted-dirclean: + rm -rf $(MROUTED_DIR) + diff --git a/obsolete-buildroot/make/ncurses.mk b/obsolete-buildroot/make/ncurses.mk new file mode 100644 index 0000000000..f0e91271c5 --- /dev/null +++ b/obsolete-buildroot/make/ncurses.mk @@ -0,0 +1,133 @@ +############################################################# +# +# ncurses +# this installs only a few vital termcap entries +# +############################################################# +# Copyright (C) 2002 by Ken Restivo +# $Id$ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + +# TARGETS +NCURSES_SITE:=ftp://ftp.gnu.org/pub/gnu/ncurses +NCURSES_DIR:=$(BUILD_DIR)/ncurses-5.2 +NCURSES_SOURCE:=ncurses-5.2.tar.gz + +$(DL_DIR)/$(NCURSES_SOURCE): + $(WGET) -P $(DL_DIR) $(NCURSES_SITE)/$(NCURSES_SOURCE) + +$(NCURSES_DIR)/.dist: $(DL_DIR)/$(NCURSES_SOURCE) + gunzip -c $(DL_DIR)/$(NCURSES_SOURCE) | tar -C $(BUILD_DIR) -xvf - + #use the local tic and not whatever the build system was going to find. + $(SED) 's~\$$srcdir/shlib tic\$$suffix~/usr/bin/tic~' \ + $(NCURSES_DIR)/misc/run_tic.in + touch $(NCURSES_DIR)/.dist + +$(NCURSES_DIR)/.configured: $(NCURSES_DIR)/.dist + (cd $(NCURSES_DIR); rm -rf config.cache; \ + BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --with-terminfo-dirs=/usr/share/terminfo \ + --with-default-terminfo-dir=/usr/share/terminfo \ + --libdir=$(STAGING_DIR)/lib \ + --with-shared --without-cxx --without-cxx-binding \ + --without-ada --without-progs $(DISABLE_NLS) \ + --without-profile --without-debug --disable-rpath \ + --enable-echo --enable-const --enable-overwrite \ + ); + touch $(NCURSES_DIR)/.configured + +$(NCURSES_DIR)/lib/libncurses.so.5.2: $(NCURSES_DIR)/.configured + $(MAKE) BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \ + BUILD_CCFLAGS="-I$(NCURSES_DIR) -I$(NCURSES_DIR)/include" \ + BUILD_LDFLAGS="" DESTDIR=$(STAGING_DIR) -C $(NCURSES_DIR) \ + libs panel menu form headers + +$(STAGING_DIR)/lib/libncurses.a: $(NCURSES_DIR)/lib/libncurses.so.5.2 + BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) CC=$(TARGET_CC) \ + $(MAKE) \ + prefix=$(STAGING_DIR) \ + exec_prefix=$(STAGING_DIR) \ + bindir=$(STAGING_DIR)/bin \ + sbindir=$(STAGING_DIR)/sbin \ + libexecdir=$(STAGING_DIR)/lib \ + datadir=$(STAGING_DIR)/usr/share \ + sysconfdir=$(STAGING_DIR)/etc \ + localstatedir=$(STAGING_DIR)/var \ + libdir=$(STAGING_DIR)/lib \ + infodir=$(STAGING_DIR)/info \ + mandir=$(STAGING_DIR)/man \ + includedir=$(STAGING_DIR)/include \ + gxx_include_dir=$(STAGING_DIR)/include/c++ \ + ticdir=$(STAGING_DIR)/usr/share/terminfo \ + -C $(NCURSES_DIR) install; + chmod a-x $(NCURSES_DIR)/lib/libncurses.so* + touch -c $(STAGING_DIR)/lib/libncurses.a + +$(TARGET_DIR)/lib/libncurses.so.5.2: $(STAGING_DIR)/lib/libncurses.a + cp -dpf $(NCURSES_DIR)/lib/libncurses.so* $(TARGET_DIR)/lib/ + -cp -dpf $(STAGING_DIR)/usr/lib/terminfo $(TARGET_DIR)/usr/lib/ + mkdir -p $(TARGET_DIR)/usr/share/terminfo + for i in x/xterm x/xterm-color x/xterm-xfree86 v/vt100 v/vt200 a/ansi l/linux; do \ + cp -dpf $(STAGING_DIR)/usr/share/terminfo/$${i} $(TARGET_DIR)/usr/share/terminfo/; \ + done + +$(TARGET_DIR)/usr/lib/libncurses.a: $(STAGING_DIR)/lib/libncurses.a + cp -dpf $(NCURSES_DIR)/include/curses.h $(TARGET_DIR)/usr/include/ncurses.h + cp -dpf $(NCURSES_DIR)/include/term.h $(TARGET_DIR)/usr/include/ + cp -dpf $(NCURSES_DIR)/include/unctrl.h $(TARGET_DIR)/usr/include/ + cp -dpf $(NCURSES_DIR)/include/termcap.h $(TARGET_DIR)/usr/include/ + cp -dpf $(NCURSES_DIR)/lib/libncurses.a $(TARGET_DIR)/usr/lib/ + rm -f $(TARGET_DIR)/usr/lib/terminfo + (cd $(TARGET_DIR)/usr/lib; ln -fs /usr/share/terminfo) + (cd $(TARGET_DIR)/usr/lib; ln -fs libncurses.a libcurses.a) + (cd $(TARGET_DIR)/usr/lib; ln -fs libncurses.a libtermcap.a) + (cd $(TARGET_DIR)/usr/include; ln -fs ncurses.h curses.h) + rm -f $(TARGET_DIR)/lib/libncurses.so + (cd $(TARGET_DIR)/usr/lib; ln -fs /lib/libncurses.so.5.2 libncurses.so) + -$(STRIP) --strip-unneeded $(TARGET_DIR)/lib/libncurses.so.5.2 + touch -c $(TARGET_DIR)/usr/lib/libncurses.a + +ncurses-headers: $(TARGET_DIR)/usr/lib/libncurses.a + +ncurses-source: $(DL_DIR)/$(NCURSES_SOURCE) + +ncurses-clean: + rm -f $(STAGING_DIR)/lib/libncurses.so* $(TARGET_DIR)/lib/libncurses.so* + rm -f $(STAGING_DIR)/usr/share/tabset $(TARGET_DIR)/usr/share/tabset + rm -rf $(STAGING_DIR)/usr/share/terminfo $(TARGET_DIR)/usr/share/terminfo + -$(MAKE) -C $(NCURSES_DIR) clean + +ncurses-dirclean: + rm -rf $(NCURSES_DIR) + +ncurses: $(TARGET_DIR)/lib/libncurses.so.5.2 + diff --git a/obsolete-buildroot/make/netfilter.mk b/obsolete-buildroot/make/netfilter.mk new file mode 100644 index 0000000000..114a31940f --- /dev/null +++ b/obsolete-buildroot/make/netfilter.mk @@ -0,0 +1,49 @@ +############################################################# +# +# netfilter +# +############################################################# + +NETFILTER_SNAPSHOT:=20040508 +NETFILTER_SOURCE:=patch-o-matic-$(NETFILTER_SNAPSHOT).tar.bz2 +NETFILTER_SITE:=ftp://ftp.netfilter.org/pub/patch-o-matic/snapshot/ +NETFILTER_DIR:=$(BUILD_DIR)/patch-o-matic-$(NETFILTER_SNAPSHOT) +NETFILTER_CAT:=bzcat + +# ipv6_mld breaks net/ipv6/mcast.c +NETFILTER_EXCLUDE:=--exclude submitted/89_ipv6_mld_netfilter.patch + +NETFILTER_PATCHES:= \ + base \ + extra/CLASSIFY.patch \ + extra/CONNMARK.patch \ + extra/IPMARK.patch \ + extra/condition.patch \ + extra/h323-conntrack-nat.patch \ + extra/mms-conntrack-nat.patch \ + extra/pptp-conntrack-nat.patch \ + extra/string.patch + +LINUX_DIR:=$(BUILD_DIR)/WRT54GS/release/src/linux/linux + +$(DL_DIR)/$(NETFILTER_SOURCE): + $(WGET) -P $(DL_DIR) $(NETFILTER_SITE)/$(NETFILTER_SOURCE) + +netfilter-source: $(DL_DIR)/$(NETFILTER_SOURCE) + +$(NETFILTER_DIR)/.unpacked: $(DL_DIR)/$(NETFILTER_SOURCE) + $(NETFILTER_CAT) $(DL_DIR)/$(NETFILTER_SOURCE) | tar -C $(BUILD_DIR) -xvf - + #ignore whitespace in patches + $(SED) "s,\-p1,\-l \-p1," $(NETFILTER_DIR)/runme + touch $(NETFILTER_DIR)/.unpacked + +$(LINUX_DIR)/.nf-patched: $(LINUX_DIR)/.patched $(NETFILTER_DIR)/.unpacked + -(cd $(NETFILTER_DIR); KERNEL_DIR=$(LINUX_DIR) ./runme --batch $(NETFILTER_EXCLUDE) $(NETFILTER_PATCHES)) + touch $(LINUX_DIR)/.nf-patched + +netfilter: $(LINUX_DIR)/.nf-patched + +netfilter-clean: + +netfilter-dirclean: + rm -rf $(NETFILTER_DIR) diff --git a/obsolete-buildroot/make/netkitbase.mk b/obsolete-buildroot/make/netkitbase.mk new file mode 100644 index 0000000000..cb2a023e00 --- /dev/null +++ b/obsolete-buildroot/make/netkitbase.mk @@ -0,0 +1,57 @@ +############################################################# +# +# netkitbase +# +############################################################# +NETKITBASE_SOURCE:=netkit-base-0.17.tar.gz +NETKITBASE_SITE:=ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/ +NETKITBASE_DIR:=$(BUILD_DIR)/netkit-base-0.17 +NETKITBASE_CAT:=zcat +NETKITBASE_BINARY:=inetd/inetd +NETKITBASE_TARGET_BINARY:=usr/sbin/inetd + +$(DL_DIR)/$(NETKITBASE_SOURCE): + $(WGET) -P $(DL_DIR) $(NETKITBASE_SITE)/$(NETKITBASE_SOURCE) + +netkitbase-source: $(DL_DIR)/$(NETKITBASE_SOURCE) + +$(NETKITBASE_DIR)/.unpacked: $(DL_DIR)/$(NETKITBASE_SOURCE) + $(NETKITBASE_CAT) $(DL_DIR)/$(NETKITBASE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # use ANSI syntax + $(SED) "s/main()/main(void)/;" $(NETKITBASE_DIR)/configure + # don't try to run cross compiled binaries while configuring things + $(SED) "s~./__conftest~#./__conftest~;" $(NETKITBASE_DIR)/configure + touch $(NETKITBASE_DIR)/.unpacked + +$(NETKITBASE_DIR)/.configured: $(NETKITBASE_DIR)/.unpacked + (cd $(NETKITBASE_DIR); PATH=$(TARGET_PATH) CC=$(TARGET_CC) \ + ./configure --installroot=$(TARGET_DIR) --with-c-compiler=$(TARGET_CC) \ + ) + touch $(NETKITBASE_DIR)/.configured + +$(NETKITBASE_DIR)/$(NETKITBASE_BINARY): $(NETKITBASE_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(NETKITBASE_DIR) + $(STRIP) $(NETKITBASE_DIR)/$(NETKITBASE_BINARY) + +$(TARGET_DIR)/$(NETKITBASE_TARGET_BINARY): $(NETKITBASE_DIR)/$(NETKITBASE_BINARY) + # Only install a few selected items... + mkdir -p $(TARGET_DIR)/usr/sbin + cp $(NETKITBASE_DIR)/$(NETKITBASE_BINARY) $(TARGET_DIR)/$(NETKITBASE_TARGET_BINARY) + mkdir -p $(TARGET_DIR)/etc + cp $(NETKITBASE_DIR)/etc.sample/inetd.conf $(TARGET_DIR)/etc/ + $(SED) "s/^\([a-z]\)/#\1/;" $(TARGET_DIR)/etc/inetd.conf + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETKITBASE_DIR) install + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +netkitbase: uclibc $(TARGET_DIR)/$(NETKITBASE_TARGET_BINARY) + +netkitbase-clean: + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETKITBASE_DIR) uninstall + -rm -f $(TARGET_DIR)/usr/sbin/inetd $(TARGET_DIR)/etc/inetd.conf + -rm -f $(TARGET_DIR)/etc/inetd.conf + -$(MAKE) -C $(NETKITBASE_DIR) clean + +netkitbase-dirclean: + rm -rf $(NETKITBASE_DIR) + diff --git a/obsolete-buildroot/make/netkittelnet.mk b/obsolete-buildroot/make/netkittelnet.mk new file mode 100644 index 0000000000..401b885cab --- /dev/null +++ b/obsolete-buildroot/make/netkittelnet.mk @@ -0,0 +1,59 @@ +############################################################# +# +# netkittelnet +# +############################################################# +NETKITTELNET_SOURCE:=netkit-telnet-0.17.tar.gz +NETKITTELNET_SITE:=ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/ +NETKITTELNET_DIR:=$(BUILD_DIR)/netkit-telnet-0.17 +NETKITTELNET_CAT:=zcat +NETKITTELNET_BINARY:=telnetd/telnetd +NETKITTELNET_TARGET_BINARY:=usr/sbin/telnetd +NETKITTELNET_PATCH:=$(SOURCE_DIR)/netkittelnet.patch + +$(DL_DIR)/$(NETKITTELNET_SOURCE): + $(WGET) -P $(DL_DIR) $(NETKITTELNET_SITE)/$(NETKITTELNET_SOURCE) + +netkittelnet-source: $(DL_DIR)/$(NETKITTELNET_SOURCE) + +$(NETKITTELNET_DIR)/.unpacked: $(DL_DIR)/$(NETKITTELNET_SOURCE) + $(NETKITTELNET_CAT) $(DL_DIR)/$(NETKITTELNET_SOURCE) | tar -C $(BUILD_DIR) -xvf - + # use ANSI syntax + $(SED) "s/main()/main(void)/;" $(NETKITTELNET_DIR)/configure + # Disable termcap support + $(SED) "s~\(.*termcap\.h.*\)~/* \1 */~;" $(NETKITTELNET_DIR)/telnetd/telnetd.c + # don't try to run cross compiled binaries while configuring things + cat $(NETKITTELNET_PATCH) | patch -p1 -d $(NETKITTELNET_DIR) + touch $(NETKITTELNET_DIR)/.unpacked + +$(NETKITTELNET_DIR)/.configured: $(NETKITTELNET_DIR)/.unpacked + (cd $(NETKITTELNET_DIR); PATH=$(TARGET_PATH) CC=$(TARGET_CC) \ + ./configure --installroot=$(TARGET_DIR) --with-c-compiler=$(TARGET_CC) \ + ) + touch $(NETKITTELNET_DIR)/.configured + +$(NETKITTELNET_DIR)/$(NETKITTELNET_BINARY): $(NETKITTELNET_DIR)/.configured + $(MAKE) SUB=telnetd CC=$(TARGET_CC) -C $(NETKITTELNET_DIR) + $(STRIP) $(NETKITTELNET_DIR)/$(NETKITTELNET_BINARY) + +$(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY): $(NETKITTELNET_DIR)/$(NETKITTELNET_BINARY) + # Only install a few selected items... + mkdir -p $(TARGET_DIR)/usr/sbin + rm -f $(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY) + cp $(NETKITTELNET_DIR)/$(NETKITTELNET_BINARY) $(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY) + # Enable telnet in inetd + $(SED) "s~^#telnet.*~telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\t/usr/sbin/telnetd~;" $(TARGET_DIR)/etc/inetd.conf + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETKITTELNET_DIR) install + #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +netkittelnet: uclibc netkitbase $(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY) + +netkittelnet-clean: + #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETKITTELNET_DIR) uninstall + -rm -f $(TARGET_DIR)/usr/sbin/telnetd + -$(MAKE) -C $(NETKITTELNET_DIR) clean + +netkittelnet-dirclean: + rm -rf $(NETKITTELNET_DIR) + diff --git a/obsolete-buildroot/make/netsnmp.mk b/obsolete-buildroot/make/netsnmp.mk new file mode 100644 index 0000000000..eeb2449676 --- /dev/null +++ b/obsolete-buildroot/make/netsnmp.mk @@ -0,0 +1,105 @@ +############################################################# +# +# netsnmp +# +############################################################# + +NETSNMP_URL:=http://aleron.dl.sourceforge.net/sourceforge/net-snmp/ +NETSNMP_DIR:=$(BUILD_DIR)/net-snmp-5.1 +NETSNMP_SOURCE:=net-snmp-5.1.tar.gz +NETSNMP_PATCH1:=net-snmp_5.1-5.diff.gz +NETSNMP_PATCH1_URL:=http://ftp.debian.org/debian/pool/main/n/net-snmp/ +NETSNMP_PATCH2:=$(SOURCE_DIR)/netsnmp.patch + +$(DL_DIR)/$(NETSNMP_SOURCE): + $(WGET) -P $(DL_DIR) $(NETSNMP_URL)/$(NETSNMP_SOURCE) + +$(DL_DIR)/$(NETSNMP_PATCH1): + $(WGET) -P $(DL_DIR) $(NETSNMP_PATCH1_URL)/$(NETSNMP_PATCH1) + +$(NETSNMP_DIR)/.unpacked: $(DL_DIR)/$(NETSNMP_SOURCE) $(DL_DIR)/$(NETSNMP_PATCH1) + zcat $(DL_DIR)/$(NETSNMP_SOURCE) | tar -C $(BUILD_DIR) -xvf - + zcat $(DL_DIR)/$(NETSNMP_PATCH1) | patch -p1 -d $(NETSNMP_DIR) + cat $(NETSNMP_PATCH2) | patch -p1 -d $(NETSNMP_DIR) + touch $(NETSNMP_DIR)/.unpacked + +# We set CAN_USE_SYSCTL to no and use /proc since the +# sysctl code in this thing is apparently intended for +# freebsd or some such thing... +$(NETSNMP_DIR)/.configured: $(NETSNMP_DIR)/.unpacked + (cd $(NETSNMP_DIR); autoconf; \ + ac_cv_CAN_USE_SYSCTL=no \ + PATH=$(TARGET_PATH) \ + ./configure \ + --with-cc=$(TARGET_CROSS)gcc \ + --with-ar=$(TARGET_CROSS)ar \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --with-endianness=little \ + --with-persistent-directory=/var/lib/snmp \ + --enable-ucd-snmp-compatibility \ + --enable-shared \ + --disable-static \ + --with-logfile=none \ + --without-rpm \ + --with-openssl \ + --without-dmalloc \ + --without-efence \ + --without-rsaref \ + --with-sys-contact="root" \ + --with-sys-location="Unknown" \ + --with-mib-modules="host smux ucd-snmp/dlmod" \ + --with-defaults \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/man \ + --infodir=/usr/info \ + ); + touch $(NETSNMP_DIR)/.configured + +$(NETSNMP_DIR)/agent/snmpd: $(NETSNMP_DIR)/.configured + $(MAKE) -C $(NETSNMP_DIR) + +$(TARGET_DIR)/usr/sbin/snmpd: $(NETSNMP_DIR)/agent/snmpd + #$(MAKE) DESTDIR=$(TARGET_DIR) -C $(NETSNMP_DIR) install + $(MAKE) PREFIX=$(TARGET_DIR)/usr \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + persistentdir=$(TARGET_DIR)/var/lib/snmp \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(STAGING_DIR)/include/net-snmp \ + ucdincludedir=$(STAGING_DIR)/include/ucd-snmp \ + -C $(NETSNMP_DIR) install; + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + # Copy the .conf files. + mkdir -p $(TARGET_DIR)/etc/snmp + cp $(NETSNMP_DIR)/EXAMPLE.conf $(TARGET_DIR)/etc/snmp/snmpd.conf + cp $(NETSNMP_DIR)/EXAMPLE-trap.conf $(TARGET_DIR)/etc/snmp/snmptrapd.conf + -mv $(TARGET_DIR)/usr/share/snmp/mib2c*.conf $(TARGET_DIR)/etc/snmp + mkdir -p $(TARGET_DIR)/etc/default + cp $(NETSNMP_DIR)/debian/snmpd.default $(TARGET_DIR)/etc/default/snmpd + # Remove the unsupported snmpcheck program + rm $(TARGET_DIR)/usr/bin/snmpcheck + # Install the "broken" headers + cp $(NETSNMP_DIR)/agent/mibgroup/struct.h $(STAGING_DIR)/include/net-snmp/agent + cp $(NETSNMP_DIR)/agent/mibgroup/util_funcs.h $(STAGING_DIR)/include/net-snmp + cp $(NETSNMP_DIR)/agent/mibgroup/mibincl.h $(STAGING_DIR)/include/net-snmp/library + cp $(NETSNMP_DIR)/agent/mibgroup/header_complex.h $(STAGING_DIR)/include/net-snmp/agent + +netsnmp: $(TARGET_DIR)/usr/sbin/snmpd + +netsnmp-headers: $(TARGET_DIR)/usr/include/net-snmp/net-snmp-config.h + cp -a $(STAGING_DIR)/include/net-snmp $(TARGET_DIR)/usr/include/net-snmp + cp -a $(STAGING_DIR)/include/ucd-snmp $(TARGET_DIR)/usr/include/net-snmp + +netsnmp-source: $(DL_DIR)/$(NETSNMP_SOURCE) + +netsnmp-clean: + $(MAKE) -C $(NETSNMP_DIR) clean + +netsnmp-dirclean: + rm -rf $(NETSNMP_DIR) + diff --git a/obsolete-buildroot/make/newt.mk b/obsolete-buildroot/make/newt.mk new file mode 100644 index 0000000000..cc2359e70d --- /dev/null +++ b/obsolete-buildroot/make/newt.mk @@ -0,0 +1,72 @@ +############################################################# +# +# newt +# +############################################################# +NEWT_SOURCE=newt-0.51.0.tar.bz2 +NEWT_SITE=http://www.uclibc.org/ +NEWT_DIR=$(BUILD_DIR)/newt-0.51.0 +NEWT_VERSION=0.51.0 +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) +NEWT_CFLAGS=-Os -g -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +else +NEWT_CFLAGS=-Os -g +endif +NEWT_CFLAGS+=-fPIC + +$(DL_DIR)/$(NEWT_SOURCE): + $(WGET) -P $(DL_DIR) $(NEWT_SITE)/$(NEWT_SOURCE) + +$(NEWT_DIR)/.source: $(DL_DIR)/$(NEWT_SOURCE) + bzcat $(DL_DIR)/$(NEWT_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(NEWT_DIR)/.source; + +$(NEWT_DIR)/.configured: $(NEWT_DIR)/.source + (cd $(NEWT_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(NEWT_DIR)/.configured; + +$(NEWT_DIR)/libnewt.so.$(NEWT_VERSION): $(NEWT_DIR)/.configured + $(MAKE) CFLAGS="$(NEWT_CFLAGS)" CC=$(TARGET_CC) -C $(NEWT_DIR) + touch -c $(NEWT_DIR)/libnewt.so.$(NEWT_VERSION) + +$(STAGING_DIR)/lib/libnewt.a: $(NEWT_DIR)/libnewt.so.$(NEWT_VERSION) + cp -a $(NEWT_DIR)/libnewt.a $(STAGING_DIR)/lib; + cp -a $(NEWT_DIR)/newt.h $(STAGING_DIR)/include; + cp -a $(NEWT_DIR)/libnewt.so* $(STAGING_DIR)/lib; + (cd $(STAGING_DIR)/lib; ln -fs libnewt.so.$(NEWT_VERSION) libnewt.so); + (cd $(STAGING_DIR)/lib; ln -fs libnewt.so.$(NEWT_VERSION) libnewt.so.0.51); + touch -c $(STAGING_DIR)/lib/libnewt.a + +$(TARGET_DIR)/lib/libnewt.so.$(NEWT_VERSION): $(STAGING_DIR)/lib/libnewt.a + cp -a $(STAGING_DIR)/lib/libnewt.so* $(TARGET_DIR)/lib; + -$(STRIP) --strip-unneeded $(TARGET_DIR)/lib/libnewt.so* + touch -c $(TARGET_DIR)/lib/libnewt.so.$(NEWT_VERSION) + +newt: uclibc slang $(TARGET_DIR)/lib/libnewt.so.$(NEWT_VERSION) + +newt-source: $(DL_DIR)/$(NEWT_SOURCE) + +newt-clean: + rm -f $(TARGET_DIR)/lib/libnewt.so* + -$(MAKE) -C $(NEWT_DIR) clean + +newt-dirclean: slang-dirclean + rm -rf $(NEWT_DIR) + diff --git a/obsolete-buildroot/make/ntp.mk b/obsolete-buildroot/make/ntp.mk new file mode 100644 index 0000000000..b3f840a3e1 --- /dev/null +++ b/obsolete-buildroot/make/ntp.mk @@ -0,0 +1,62 @@ +############################################################# +# +# ntp +# +############################################################# +NTP_SOURCE:=ntp-4.1.2.tar.gz +NTP_SITE:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4 +NTP_DIR:=$(BUILD_DIR)/ntp-4.1.2 +NTP_CAT:=zcat +NTP_BINARY:=ntpdate/ntpdate +NTP_TARGET_BINARY:=usr/bin/ntpdate + + +$(DL_DIR)/$(NTP_SOURCE): + $(WGET) -P $(DL_DIR) $(NTP_SITE)/$(NTP_SOURCE) + +ntp-source: $(DL_DIR)/$(NTP_SOURCE) + +$(NTP_DIR)/.unpacked: $(DL_DIR)/$(NTP_SOURCE) + $(NTP_CAT) $(DL_DIR)/$(NTP_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SED) "s,^#if.*__GLIBC__.*_BSD_SOURCE.*$$,#if 0," \ + $(NTP_DIR)/ntpd/refclock_pcf.c; + touch $(NTP_DIR)/.unpacked + +$(NTP_DIR)/.configured: $(NTP_DIR)/.unpacked + (cd $(NTP_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --with-shared \ + --program-transform-name=s,,, \ + ); + touch $(NTP_DIR)/.configured + +$(NTP_DIR)/$(NTP_BINARY): $(NTP_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(NTP_DIR) + +$(TARGET_DIR)/$(NTP_TARGET_BINARY): $(NTP_DIR)/$(NTP_BINARY) + install -m 755 $(NTP_DIR)/$(NTP_BINARY) $(TARGET_DIR)/$(NTP_TARGET_BINARY) + +ntp: uclibc $(TARGET_DIR)/$(NTP_TARGET_BINARY) + +ntp-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NTP_DIR) uninstall + -$(MAKE) -C $(NTP_DIR) clean + +ntp-dirclean: + rm -rf $(NTP_DIR) + diff --git a/obsolete-buildroot/make/openssh.mk b/obsolete-buildroot/make/openssh.mk new file mode 100644 index 0000000000..c7feba20c6 --- /dev/null +++ b/obsolete-buildroot/make/openssh.mk @@ -0,0 +1,78 @@ +############################################################# +# +# openssh +# +############################################################# + +OPENSSH_SITE:=ftp://ftp.tux.org/bsd/openbsd/OpenSSH/portable/ +OPENSSH_DIR:=$(BUILD_DIR)/openssh-3.8p1 +OPENSSH_SOURCE:=openssh-3.8p1.tar.gz +OPENSSH_PATCH:=$(SOURCE_DIR)/openssh.patch + +$(DL_DIR)/$(OPENSSH_SOURCE): + $(WGET) -P $(DL_DIR) $(OPENSSH_SITE)/$(OPENSSH_SOURCE) + +$(OPENSSH_DIR)/.unpacked: $(DL_DIR)/$(OPENSSH_SOURCE) $(OPENSSH_PATCH) + zcat $(DL_DIR)/$(OPENSSH_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(OPENSSH_PATCH) | patch -p1 -d $(OPENSSH_DIR) + touch $(OPENSSH_DIR)/.unpacked + +$(OPENSSH_DIR)/.configured: $(OPENSSH_DIR)/.unpacked + (cd $(OPENSSH_DIR); rm -rf config.cache; autoconf; \ + $(TARGET_CONFIGURE_OPTS) \ + LD=$(TARGET_CROSS)gcc \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/sbin \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --includedir=$(STAGING_DIR)/include \ + --disable-lastlog --disable-utmp \ + --disable-utmpx --disable-wtmp --disable-wtmpx \ + --without-x \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(OPENSSH_DIR)/.configured + +$(OPENSSH_DIR)/ssh: $(OPENSSH_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(OPENSSH_DIR) + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/scp + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/sftp + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/sftp-server + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh-add + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh-agent + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh-keygen + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh-keyscan + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh-keysign + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/ssh-rand-helper + -$(STRIP) --strip-unneeded $(OPENSSH_DIR)/sshd + +$(TARGET_DIR)/usr/bin/ssh: $(OPENSSH_DIR)/ssh + $(MAKE) CC=$(TARGET_CC) DESTDIR=$(TARGET_DIR) -C $(OPENSSH_DIR) install + mkdir -p $(TARGET_DIR)/etc/init.d/ + cp $(OPENSSH_DIR)/S50sshd $(TARGET_DIR)/etc/init.d/ + chmod a+x $(TARGET_DIR)/etc/init.d/S50sshd + rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +openssh: $(TARGET_DIR)/usr/bin/ssh + +openssh-source: $(DL_DIR)/$(OPENSSH_SOURCE) + +openssh-clean: + $(MAKE) -C $(OPENSSH_DIR) clean + +openssh-dirclean: + rm -rf $(OPENSSH_DIR) + diff --git a/obsolete-buildroot/make/openssl.mk b/obsolete-buildroot/make/openssl.mk new file mode 100644 index 0000000000..a4003553b1 --- /dev/null +++ b/obsolete-buildroot/make/openssl.mk @@ -0,0 +1,78 @@ +############################################################# +# +# openssl +# +############################################################# + +# TARGETS +OPENSSL_SITE:=http://www.openssl.org/source +OPENSSL_SOURCE:=openssl-0.9.7d.tar.gz +OPENSSL_DIR:=$(BUILD_DIR)/openssl-0.9.7d +OPENSSL_PATCH=$(SOURCE_DIR)/openssl.patch + +$(DL_DIR)/$(OPENSSL_SOURCE): + $(WGET) -P $(DL_DIR) $(OPENSSL_SITE)/$(OPENSSL_SOURCE) + +$(OPENSSL_DIR)/.unpacked: $(DL_DIR)/$(OPENSSL_SOURCE) $(OPENSSL_PATCH) + gunzip -c $(DL_DIR)/$(OPENSSL_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(OPENSSL_PATCH) | patch -p1 -d $(OPENSSL_DIR) + # sigh... we have to resort to this just to set a gcc flag. + $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' \ + $(OPENSSL_DIR)/Configure + touch $(OPENSSL_DIR)/.unpacked + +$(OPENSSL_DIR)/Makefile: $(OPENSSL_DIR)/.unpacked + (cd $(OPENSSL_DIR); \ + CFLAGS="-DOPENSSL_NO_KRB5 -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5" \ + PATH=$(TARGET_PATH) ./Configure linux-$(ARCH) --prefix=/ \ + --openssldir=/usr/lib/ssl -L$(STAGING_DIR)/lib -ldl \ + -I$(STAGING_DIR)/include $(OPENSSL_OPTS) no-threads \ + shared no-idea no-mdc2 no-rc5) + +$(OPENSSL_DIR)/apps/openssl: $(OPENSSL_DIR)/Makefile + $(MAKE) CC=$(TARGET_CC) -C $(OPENSSL_DIR) all build-shared + # Work around openssl build bug to link libssl.so with libcrypto.so. + -rm $(OPENSSL_DIR)/libssl.so.*.*.* + $(MAKE) CC=$(TARGET_CC) -C $(OPENSSL_DIR) do_linux-shared + +$(STAGING_DIR)/lib/libcrypto.a: $(OPENSSL_DIR)/apps/openssl + $(MAKE) CC=$(TARGET_CC) INSTALL_PREFIX=$(STAGING_DIR) -C $(OPENSSL_DIR) install + cp -fa $(OPENSSL_DIR)/libcrypto.so* $(STAGING_DIR)/lib/ + chmod a-x $(STAGING_DIR)/lib/libcrypto.so.0.9.7 + (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so) + (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so.0) + cp -fa $(OPENSSL_DIR)/libssl.so* $(STAGING_DIR)/lib/ + chmod a-x $(STAGING_DIR)/lib/libssl.so.0.9.7 + (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so) + (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so.0) + +$(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7: $(STAGING_DIR)/lib/libcrypto.a + mkdir -p $(TARGET_DIR)/usr/lib + cp -fa $(STAGING_DIR)/lib/libcrypto.so* $(TARGET_DIR)/usr/lib/ + cp -fa $(STAGING_DIR)/lib/libssl.so* $(TARGET_DIR)/usr/lib/ + #cp -fa $(STAGING_DIR)/bin/openssl $(TARGET_DIR)/bin/ + -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libssl.so.0.9.7 + -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7 + +$(TARGET_DIR)/usr/lib/libssl.a: $(STAGING_DIR)/lib/libcrypto.a + mkdir -p $(TARGET_DIR)/usr/include + cp -a $(STAGING_DIR)/include/openssl $(TARGET_DIR)/usr/include/ + cp -dpf $(STAGING_DIR)/lib/libssl.a $(TARGET_DIR)/usr/lib/ + cp -dpf $(STAGING_DIR)/lib/libcrypto.a $(TARGET_DIR)/usr/lib/ + touch -c $(TARGET_DIR)/usr/lib/libssl.a + +openssl-headers: $(TARGET_DIR)/usr/lib/libssl.a + +openssl: uclibc $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7 + +openssl-source: $(DL_DIR)/$(OPENSSL_SOURCE) + +openssl-clean: + rm -f $(STAGING_DIR)/bin/openssl $(TARGET_DIR)/bin/openssl + rm -f $(STAGING_DIR)/lib/libcrypto.so* $(TARGET_DIR)/lib/libcrypto.so* + rm -f $(STAGING_DIR)/lib/libssl.so* $(TARGET_DIR)/lib/libssl.so* + $(MAKE) -C $(OPENSSL_DIR) clean + +openssl-dirclean: + rm -rf $(OPENSSL_DIR) + diff --git a/obsolete-buildroot/make/openvpn.mk b/obsolete-buildroot/make/openvpn.mk new file mode 100644 index 0000000000..0ac6279328 --- /dev/null +++ b/obsolete-buildroot/make/openvpn.mk @@ -0,0 +1,68 @@ +############################################################# +# +# openvpn +# +# NOTE: Uses start-stop-daemon in init script, so be sure +# to enable that within busybox +# +############################################################# +OPENVPN_SOURCE:=openvpn-1.5.0.tar.gz +OPENVPN_SITE:=http://aleron.dl.sourceforge.net/sourceforge/openvpn/ +OPENVPN_DIR:=$(BUILD_DIR)/openvpn-1.5.0 +OPENVPN_CAT:=zcat +OPENVPN_BINARY:=openvpn +OPENVPN_TARGET_BINARY:=usr/sbin/openvpn +#OPENVPN_PATCH:=$(SOURCE_DIR)/openvpn.patch + +$(DL_DIR)/$(OPENVPN_SOURCE): + $(WGET) -P $(DL_DIR) $(OPENVPN_SITE)/$(OPENVPN_SOURCE) + +openvpn-source: $(DL_DIR)/$(OPENVPN_SOURCE) + +$(OPENVPN_DIR)/.unpacked: $(DL_DIR)/$(OPENVPN_SOURCE) + $(OPENVPN_CAT) $(DL_DIR)/$(OPENVPN_SOURCE) | tar -C $(BUILD_DIR) -xvf - + #cat $(OPENVPN_PATCH) | patch -p1 -d $(OPENVPN_DIR) + touch $(OPENVPN_DIR)/.unpacked + +$(OPENVPN_DIR)/.configured: $(OPENVPN_DIR)/.unpacked + (cd $(OPENVPN_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --program-prefix="" \ + --enable-pthread \ + ); + touch $(OPENVPN_DIR)/.configured + +$(OPENVPN_DIR)/$(OPENVPN_BINARY): $(OPENVPN_DIR)/.configured + $(MAKE) -C $(OPENVPN_DIR) + +$(TARGET_DIR)/$(OPENVPN_TARGET_BINARY): $(OPENVPN_DIR)/$(OPENVPN_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(OPENVPN_DIR) install + mkdir -p $(TARGET_DIR)/etc/openvpn + cp $(SOURCE_DIR)/openvpn $(TARGET_DIR)/etc/init.d/openvpn + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +openvpn: uclibc lzo openssl $(TARGET_DIR)/$(OPENVPN_TARGET_BINARY) + +openvpn-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(OPENVPN_DIR) uninstall + -$(MAKE) -C $(OPENVPN_DIR) clean + +openvpn-dirclean: + rm -rf $(OPENVPN_DIR) + diff --git a/obsolete-buildroot/make/openwrt.mk b/obsolete-buildroot/make/openwrt.mk new file mode 100644 index 0000000000..f3b479b901 --- /dev/null +++ b/obsolete-buildroot/make/openwrt.mk @@ -0,0 +1,270 @@ +# Makefile for to build the base openwrt +# +# Copyright (C) 2004 Manuel Novoa III +# +# 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 +# +###################################################################### +# +# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! +# +# Currently the dependencies are not all handled. But that's true of +# our buildroot in general, since it wasn't really set up for end users. + +OPENWRT_TARGETS:= openwrt-linux openwrt-kmodules.tar.bz2 \ + openwrt-shared openwrt-mtd openwrt-nvram openwrt-wlconf \ + bridge dnsmasq1 iptables wtools busybox \ + openwrt-rootprep + +.PHONY: $(OPENWRT_TARGETS) openwrt-code.bin + +openwrt-base: $(OPENWRT_TARGETS) + +###################################################################### + +ifneq ($(filter $(TARGETS),openwrt-base),) + +# WRT54G_SOURCE=wrt54gv2.2.02.2.tgz +# WRT54G_SITE=http://www.linksys.com/support/opensourcecode/wrt54gv2/2.02.2 + +# WRT54G_SOURCE=wrt54g.2.02.7.tgz +# WRT54G_SITE=http://www.linksys.com/support/opensourcecode/wrt54gv2/2.02.7 +# WRT54G_DIR=$(BUILD_DIR)/WRT54G + +WRT54G_SOURCE=wrt54gs.2.07.1.tgz +WRT54G_SITE=http://www.linksys.com/support/opensourcecode/wrt54gs/2.07.1 + +WRT54G_DIR=$(BUILD_DIR)/WRT54GS + +# OPENWRT_ROOT=openwrt-root.tar.bz2 +# OPENWRT_SITE=http://127.0.0.1 +# OPENWRT_DIR=$(BUILD_DIR)/openwrt + +LINUX_DIR=$(WRT54G_DIR)/release/src/linux/linux +LINUX_FORMAT=zImage +LINUX_BINLOC=arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz + +TARGET_MODULES_DIR:=$(TARGET_DIR)/lib/modules/2.4.20 + +$(LINUX_DIR)/.unpacked: $(WRT54G_DIR)/.prepared + -(cd $(BUILD_DIR); ln -sf $(LINUX_DIR) linux) + # preserve the binary-only driver + #mv $(LINUX_DIR)/drivers/net/mac/mac.o \ + # $(LINUX_DIR)/drivers/net/mac/mac.o-saved + touch $(LINUX_DIR)/.unpacked + +$(LINUX_DIR)/.patched: $(WRT54G_DIR)/.prepared + $(SOURCE_DIR)/patch-kernel.sh $(LINUX_DIR)/../.. $(SOURCE_DIR) openwrt-linux-netfilter.patch + $(SOURCE_DIR)/patch-kernel.sh $(LINUX_DIR)/../.. $(SOURCE_DIR) openwrt-wrt54g-linux.patch + # use replacement diag module code + cp -f $(SOURCE_DIR)/openwrt-diag.c $(LINUX_DIR)/drivers/net/diag/diag_led.c + cp -f $(SOURCE_DIR)/openwrt-wrt54g-linux.config $(LINUX_DIR)/.config + -(cd $(BUILD_DIR); ln -sf $(LINUX_DIR) linux) + touch $(LINUX_DIR)/.patched + +$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched netfilter + $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile + $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/arch/mips/Makefile + $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile + make -C $(LINUX_DIR) oldconfig include/linux/version.h + touch $(LINUX_DIR)/.configured + +$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured $(GCC_BUILD_DIR2)/.installed + $(MAKE) -C $(LINUX_DIR) dep + touch $(LINUX_DIR)/.depend_done + +$(LINUX_DIR)/$(LINUX_BINLOC): $(LINUX_DIR)/.depend_done + $(MAKE) -C $(LINUX_DIR) $(LINUX_FORMAT) + +openwrt-kmodules.tar.bz2: $(LINUX_DIR)/$(LINUX_BINLOC) + $(MAKE) -C $(LINUX_DIR) modules + $(MAKE) -C $(LINUX_DIR) DEPMOD=/bin/true \ + INSTALL_MOD_PATH=$(LINUX_DIR)/modules modules_install + tar -C $(LINUX_DIR)/modules/lib -cjf openwrt-kmodules.tar.bz2 modules + +openwrt-linux: $(LINUX_DIR)/$(LINUX_BINLOC) + +$(DL_DIR)/$(WRT54G_SOURCE): + $(WGET) -P $(DL_DIR) $(WRT54G_SITE)/$(WRT54G_SOURCE) + +$(WRT54G_DIR)/.source: $(DL_DIR)/$(WRT54G_SOURCE) + #zcat $(DL_DIR)/$(WRT54G_SOURCE) | tar -C $(BUILD_DIR) -xvf - WRT54G/README.TXT WRT54G/release + zcat $(DL_DIR)/$(WRT54G_SOURCE) | tar -C $(BUILD_DIR) -xvf - WRT54GS/README.TXT WRT54GS/release + touch $(WRT54G_DIR)/.source + +$(WRT54G_DIR)/.prepared: $(WRT54G_DIR)/.source + $(SOURCE_DIR)/patch-kernel.sh $(WRT54G_DIR) $(SOURCE_DIR) openwrt-wrt54g-router.patch + $(SOURCE_DIR)/patch-kernel.sh $(WRT54G_DIR) $(SOURCE_DIR) openwrt-wrt54g-shared.patch + touch $(WRT54G_DIR)/.prepared + +###################################################################### + +OPENWRT_ROOT_SKEL:=root.tar.gz +OPENWRT_SITE=http://openwrt.ksilebo.net/cgi-bin/viewcvs.cgi/root + +$(DL_DIR)/$(OPENWRT_ROOT_SKEL): + $(WGET) -P $(DL_DIR) $(OPENWRT_SITE)/$(OPENWRT_ROOT_SKEL) + +###################################################################### + +OPENWRT_SRCBASE:=$(WRT54G_DIR)/release/src +OPENWRT_SHARED_BUILD_DIR:=$(OPENWRT_SRCBASE)/router/shared +OPENWRT_SHARED_TARGET_BINARY:=usr/lib/libshared.so + +$(TARGET_DIR)/$(OPENWRT_SHARED_TARGET_BINARY): $(WRT54G_DIR)/.source + $(MAKE) -C $(OPENWRT_SHARED_BUILD_DIR) -f Makefile-openwrt \ + SRCBASE=$(OPENWRT_SRCBASE) INSTALLDIR=$(TARGET_DIR) \ + CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld STRIP="$(STRIP)" \ + CFLAGS="$(TARGET_CFLAGS) -I. -I$(OPENWRT_SRCBASE)/include -Wall -I$(OPENWRT_SRCBASE)/" \ + install + +openwrt-shared: $(TARGET_DIR)/$(OPENWRT_SHARED_TARGET_BINARY) + +openwrt-shared-clean: + -$(MAKE) -C $(OPENWRT_SHARED_BUILD_DIR) clean + +###################################################################### + +OPENWRT_NVRAM_BUILD_DIR:=$(OPENWRT_SRCBASE)/router/nvram +OPENWRT_NVRAM_TARGET_BINARY:=usr/sbin/nvram + +$(TARGET_DIR)/$(OPENWRT_NVRAM_TARGET_BINARY): $(WRT54G_DIR)/.source + $(MAKE) -C $(OPENWRT_NVRAM_BUILD_DIR) \ + SRCBASE=$(OPENWRT_SRCBASE) INSTALLDIR=$(TARGET_DIR) \ + CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld STRIP="$(STRIP)" \ + CFLAGS="$(TARGET_CFLAGS) -I. -I$(OPENWRT_SRCBASE)/include -Wall -DOPENWRT_NVRAM" \ + install + + +openwrt-nvram: $(TARGET_DIR)/$(OPENWRT_NVRAM_TARGET_BINARY) + +openwrt-nvram-clean: + -$(MAKE) -C $(OPENWRT_NVRAM_BUILD_DIR) clean + +###################################################################### + +OPENWRT_MTD_BUILD_DIR:=$(OPENWRT_SRCBASE)/router/rc +OPENWRT_MTD_TARGET_BINARY:=sbin/mtd + +$(TARGET_DIR)/$(OPENWRT_MTD_TARGET_BINARY): $(WRT54G_DIR)/.source $(TARGET_DIR)/$(OPENWRT_NVRAM_TARGET_BINARY) # need libnvram + $(MAKE) -C $(OPENWRT_MTD_BUILD_DIR) -f Makefile-openwrt \ + TOP=$(OPENWRT_SRCBASE)/router \ + SRCBASE=$(OPENWRT_SRCBASE) INSTALLDIR=$(TARGET_DIR) \ + CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld STRIP="$(STRIP)" \ + CFLAGS="$(TARGET_CFLAGS) -I. -I$(OPENWRT_SRCBASE)/router/shared -I$(OPENWRT_SRCBASE)/include -Wall -I$(OPENWRT_SRCBASE)/" \ + install + +openwrt-mtd: $(TARGET_DIR)/$(OPENWRT_MTD_TARGET_BINARY) + +openwrt-mtd-clean: + -$(MAKE) -C $(OPENWRT_MTD_BUILD_DIR) clean + +###################################################################### + +OPENWRT_WLCONF_BUILD_DIR:=$(OPENWRT_SRCBASE)/router/wlconf +OPENWRT_WLCONF_TARGET_BINARY:=usr/sbin/wlconf + +$(TARGET_DIR)/$(OPENWRT_WLCONF_TARGET_BINARY): $(WRT54G_DIR)/.source + $(MAKE) -C $(OPENWRT_WLCONF_BUILD_DIR) \ + TOP=$(OPENWRT_SRCBASE)/router \ + SRCBASE=$(OPENWRT_SRCBASE) INSTALLDIR=$(TARGET_DIR) \ + CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld STRIP="$(STRIP)" \ + CFLAGS="$(TARGET_CFLAGS) -I. -I$(OPENWRT_SRCBASE)/router/shared -I$(OPENWRT_SRCBASE)/include -Wall" \ + install + + +openwrt-wlconf: $(TARGET_DIR)/$(OPENWRT_WLCONF_TARGET_BINARY) + +openwrt-wlconf-clean: + -$(MAKE) -C $(OPENWRT_WLCONF_BUILD_DIR) clean + +###################################################################### + +openwrt-rootprep: + # tmp + mkdir -p $(TARGET_DIR)/tmp + chmod a+rwxt $(TARGET_DIR)/tmp + ln -sf /tmp $(TARGET_DIR)/var + rm -f $(TARGET_DIR)/usr/tmp + ln -sf ../tmp $(TARGET_DIR)/usr/tmp + # dev + mkdir -p $(TARGET_DIR)/dev + # etc + mkdir -p $(TARGET_DIR)/etc + ln -sf /tmp/resolv.conf $(TARGET_DIR)/etc/resolv.conf + # miscellaneous + mkdir -p $(TARGET_DIR)/mnt + mkdir -p $(TARGET_DIR)/proc + mkdir -p $(TARGET_DIR)/jffs + mkdir -p $(TARGET_DIR)/rom + # modules + mkdir -p $(TARGET_MODULES_DIR) + cp $(LINUX_DIR)/drivers/net/wl/wl.o $(TARGET_MODULES_DIR) + #cp $(LINUX_DIR)/drivers/net/et.4702/et.4702.o $(TARGET_MODULES_DIR) + cp $(LINUX_DIR)/drivers/net/et/et.o $(TARGET_MODULES_DIR) + cp $(LINUX_DIR)/drivers/net/diag/diag.o $(TARGET_MODULES_DIR) + +###################################################################### + +openwrt-prune: + -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true; + # remove unneeded uClibc libs + rm -rf $(TARGET_DIR)/lib/libthread_db* + rm -rf $(TARGET_DIR)/lib/libpthread* + # remove unneeded uClibc utils + rm -f $(TARGET_DIR)/sbin/ldconfig + rm -f $(TARGET_DIR)/usr/bin/ldd + # remove other unneeded files + rm -f $(TARGET_DIR)/usr/sbin/iptables-save + rm -f $(TARGET_DIR)/usr/sbin/iptables-restore + rm -f $(TARGET_DIR)/usr/sbin/ip6tables + +###################################################################### + +openwrt-linux.trx: openwrt-prune squashfsroot + $(WRT54G_DIR)/release/tools/trx -o openwrt-linux.trx \ + $(LINUX_DIR)/$(LINUX_BINLOC) $(IMAGE) + +openwrt-gs-code.bin: openwrt-linux.trx + $(WRT54G_DIR)/release/tools/addpattern -i openwrt-linux.trx \ + -o openwrt-gs-code.bin -g + +openwrt-g-code.bin: openwrt-gs-code.bin + sed -e "1s,^W54S,W54G," < openwrt-gs-code.bin > openwrt-g-code.bin + +openwrt-code.bin: openwrt-gs-code.bin openwrt-g-code.bin + +###################################################################### + +openwrt-sourceball: + tar cjf buildroot-openwrt.tar.bz2 \ + README.openwrt \ + Makefile \ + Makefile-openwrt \ + make/openwrt.mk \ + make/uclibc.mk \ + make/busybox.mk \ + sources/uClibc.config \ + sources/uClibc.config-openwrt \ + sources/busybox-openwrt-*.patch \ + sources/busybox.config \ + sources/busybox.config-openwrt \ + sources/dnsmasq1-openwrt.patch \ + sources/iptables-openwrt-extensions.patch \ + sources/openwrt-wrt54g-linux.config \ + sources/openwrt-wrt54g-*.patch \ + sources/openwrt-diag.c + +endif diff --git a/obsolete-buildroot/make/patch.mk b/obsolete-buildroot/make/patch.mk new file mode 100644 index 0000000000..d49102c855 --- /dev/null +++ b/obsolete-buildroot/make/patch.mk @@ -0,0 +1,60 @@ +############################################################# +# +# patch +# +############################################################# +GNUPATCH_SOURCE:=patch_2.5.9.orig.tar.gz +GNUPATCH_SITE:=http://ftp.debian.org/debian/pool/main/p/patch +GNUPATCH_CAT:=zcat +GNUPATCH_DIR:=$(BUILD_DIR)/patch-2.5.9 +GNUPATCH_BINARY:=patch +GNUPATCH_TARGET_BINARY:=usr/bin/patch + +$(DL_DIR)/$(GNUPATCH_SOURCE): + $(WGET) -P $(DL_DIR) $(GNUPATCH_SITE)/$(GNUPATCH_SOURCE) + +patch-source: $(DL_DIR)/$(GNUPATCH_SOURCE) + +$(GNUPATCH_DIR)/.unpacked: $(DL_DIR)/$(GNUPATCH_SOURCE) + $(GNUPATCH_CAT) $(DL_DIR)/$(GNUPATCH_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(GNUPATCH_DIR)/.unpacked + +$(GNUPATCH_DIR)/.configured: $(GNUPATCH_DIR)/.unpacked + (cd $(GNUPATCH_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(GNUPATCH_DIR)/.configured + +$(GNUPATCH_DIR)/$(GNUPATCH_BINARY): $(GNUPATCH_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(GNUPATCH_DIR) + +$(TARGET_DIR)/$(GNUPATCH_TARGET_BINARY): $(GNUPATCH_DIR)/$(GNUPATCH_BINARY) + rm -f $(TARGET_DIR)/$(GNUPATCH_TARGET_BINARY) + cp -a $(GNUPATCH_DIR)/$(GNUPATCH_BINARY) $(TARGET_DIR)/$(GNUPATCH_TARGET_BINARY) + +patch: uclibc $(TARGET_DIR)/$(GNUPATCH_TARGET_BINARY) + +patch-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(GNUPATCH_DIR) uninstall + -$(MAKE) -C $(GNUPATCH_DIR) clean + +patch-dirclean: + rm -rf $(GNUPATCH_DIR) + diff --git a/obsolete-buildroot/make/pciutils.mk b/obsolete-buildroot/make/pciutils.mk new file mode 100644 index 0000000000..f8608d8fce --- /dev/null +++ b/obsolete-buildroot/make/pciutils.mk @@ -0,0 +1,71 @@ +############################################################# +# +# pciutils +# +############################################################# +PCIUTILS_SOURCE:=pciutils-2.1.10.tar.gz +PCIUTILS_SITE:=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci +PCIUTILS_DIR:=$(BUILD_DIR)/pciutils-2.1.10 +PCIUTILS_CAT:=zcat + +# Yet more targets... +PCIIDS_SITE:=http://pciids.sourceforge.net/ +PCIIDS_SOURCE:=pci.ids.bz2 +PCIIDS_CAT:=bzcat + +$(DL_DIR)/$(PCIUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(PCIUTILS_SITE)/$(PCIUTILS_SOURCE) + +$(DL_DIR)/$(PCIIDS_SOURCE): + $(WGET) -P $(DL_DIR) $(PCIIDS_SITE)/$(PCIIDS_SOURCE) + +pciutils-source: $(DL_DIR)/$(PCIUTILS_SOURCE) $(DL_DIR)/$(PCIIDS_SOURCE) + +$(PCIUTILS_DIR)/.unpacked: $(DL_DIR)/$(PCIUTILS_SOURCE) $(DL_DIR)/$(PCIIDS_SOURCE) + $(PCIUTILS_CAT) $(DL_DIR)/$(PCIUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(PCIIDS_CAT) $(DL_DIR)/$(PCIIDS_SOURCE) > $(PCIUTILS_DIR)/pci.id + touch $(PCIUTILS_DIR)/.unpacked + +$(PCIUTILS_DIR)/.configured: $(PCIUTILS_DIR)/.unpacked + (cd $(PCIUTILS_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(PCIUTILS_DIR)/.configured + +$(PCIUTILS_DIR)/lspci: $(PCIUTILS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(PCIUTILS_DIR) + +$(TARGET_DIR)/sbin/lspci: $(PCIUTILS_DIR)/lspci + install -c $(PCIUTILS_DIR)/lspci $(TARGET_DIR)/sbin/lspci + +$(TARGET_DIR)/sbin/setpci: $(PCIUTILS_DIR)/setpci + install -c $(PCIUTILS_DIR)/setpci $(TARGET_DIR)/sbin/setpci + +$(TARGET_DIR)/usr/share/misc/pci.ids: $(PCIUTILS_DIR)/.dist + install -Dc $(PCIUTILS_DIR)/pci.ids $(TARGET_DIR)/usr/share/misc/pci.ids + + +pciutils: uclibc $(TARGET_DIR)/sbin/setpci $(TARGET_DIR)/sbin/lspci $(TARGET_DIR)/usr/share/misc/pci.ids + +pciutils-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(PCIUTILS_DIR) uninstall + -$(MAKE) -C $(PCIUTILS_DIR) clean + +pciutils-dirclean: + rm -rf $(PCIUTILS_DIR) + diff --git a/obsolete-buildroot/make/pcmcia.mk b/obsolete-buildroot/make/pcmcia.mk new file mode 100644 index 0000000000..8ae82633c9 --- /dev/null +++ b/obsolete-buildroot/make/pcmcia.mk @@ -0,0 +1,108 @@ +############################################################# +# +# pcmcia card services +# +############################################################# +# Copyright (C) 2001-2003 by Erik Andersen +# Copyright (C) 2002 by Tim Riker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + +PCMCIA_SOURCE:=pcmcia-cs-3.2.7.tar.gz +PCMCIA_SITE:=http://aleron.dl.sourceforge.net/sourceforge/pcmcia-cs +PCMCIA_DIR:=$(BUILD_DIR)/pcmcia-cs-3.2.7 +PCMCIA_PATCH:=$(SOURCE_DIR)/pcmcia.patch +PCMCIA_CAT:=zcat + +$(DL_DIR)/$(PCMCIA_SOURCE): + $(WGET) -P $(DL_DIR) $(PCMCIA_SITE)/$(PCMCIA_SOURCE) + +pcmcia-source: $(DL_DIR)/$(PCMCIA_SOURCE) + +$(PCMCIA_DIR)/.unpacked: $(DL_DIR)/$(PCMCIA_SOURCE) + $(PCMCIA_CAT) $(DL_DIR)/$(PCMCIA_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(PCMCIA_DIR)/.unpacked + +$(PCMCIA_DIR)/.patched: $(PCMCIA_DIR)/.unpacked + cat $(PCMCIA_PATCH) | patch -d $(PCMCIA_DIR) -p1 + touch $(PCMCIA_DIR)/.patched + +$(PCMCIA_DIR)/.configured: $(PCMCIA_DIR)/.patched + ( cd $(PCMCIA_DIR) ; ./Configure --kernel=$(LINUX_SOURCE_DIR) --noprompt \ + --rcdir=/etc --arch=$(ARCH) --trust --srctree --nocardbus \ + --sysv --kcc=$(KERNEL_CROSS)gcc --ucc=$(TARGET_CC) --ld=$(TARGET_CROSS)ld \ + --target=$(TARGET_DIR)) + $(SED) "s/pump/udhcpc/" $(PCMCIA_DIR)/etc/network + $(SED) "s/ide_cs/ide-cs/" $(PCMCIA_DIR)/etc/config + $(SED) "s/bind \"wvlan_cs\"/bind \"orinoco_cs\"/g" $(PCMCIA_DIR)/etc/config + touch $(PCMCIA_DIR)/.configured + +$(PCMCIA_DIR)/cardmgr/cardmgr: $(PCMCIA_DIR)/.configured + $(MAKE) -C $(PCMCIA_DIR) -i all + -A=`find $(PCMCIA_DIR) -type f -perm +111` ; \ + for fo in $$A; do \ + file $$fo | grep "ELF" | grep "executable" > /dev/null 2>&1; \ + if [ $$? = 0 ] ; then \ + $(STRIP) $$fo; \ + fi; \ + done + touch -c $(PCMCIA_DIR)/cardmgr/cardmgr + +$(TARGET_DIR)/sbin/cardmgr: $(PCMCIA_DIR)/cardmgr/cardmgr + rm -rf $(TARGET_DIR)/etc/pcmcia; + $(MAKE) -i -C $(PCMCIA_DIR) install + rm -rf $(TARGET_DIR)/usr/man; + rm -rf $(TARGET_DIR)/usr/share/man; + rm -rf $(TARGET_DIR)/usr/X11R6/man; + rm -rf $(TARGET_DIR)/etc/rc.d; + rm -rf $(TARGET_DIR)/etc/rc?.d; + rm -f $(TARGET_DIR)/etc/init.d/pcmcia*; + rm -f $(TARGET_DIR)/sbin/dump_cis $(TARGET_DIR)/sbin/pack_cis + rm -f $(TARGET_DIR)/usr/share/pnp.ids $(TARGET_DIR)/sbin/lspnp $(TARGET_DIR)/sbin/setpnp; + rm -f $(TARGET_DIR)/sbin/pcinitrd + rm -f $(TARGET_DIR)/sbin/probe + rm -f $(TARGET_DIR)/sbin/ide_info + rm -f $(TARGET_DIR)/sbin/scsi_info + rm -f $(TARGET_DIR)/sbin/ftl_check + rm -f $(TARGET_DIR)/sbin/ftl_format + rm -f $(TARGET_DIR)/usr/X11R6/bin/xcardinfo + rm -rf $(TARGET_DIR)/etc/sysconfig + mkdir -p $(TARGET_DIR)/etc/default + cp -f $(PCMCIA_DIR)/etc/pcmcia $(TARGET_DIR)/etc/default/ + cp -f $(PCMCIA_DIR)/etc/rc.pcmcia $(TARGET_DIR)/etc/init.d/S30pcmcia + rm -rf $(TARGET_DIR)/etc/pcmcia/cis + chmod a+x $(TARGET_DIR)/etc/init.d/S30pcmcia + chmod -R u+w $(TARGET_DIR)/etc/pcmcia/* + +# use busybox depmod.pl so we need the sources unpacked +$(PCMCIA_DIR)/.modules.dep: $(BUSYBOX_DIR)/.configured $(TARGET_DIR)/lib/modules + [ -d $(TARGET_DIR)/lib/modules/$(LINUX_VERSION) ] && \ + $(BUSYBOX_DIR)/examples/depmod.pl \ + -b $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/ \ + -k $(LINUX_DIR)/vmlinux \ + -F $(LINUX_DIR)/System.map \ + > $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep + touch $(PCMCIA_DIR)/.modules.dep + +pcmcia: uclibc $(TARGET_DIR)/sbin/cardmgr $(PCMCIA_DIR)/.modules.dep + +pcmcia-clean: + rm -f $(TARGET_DIR)/sbin/cardmgr + -$(MAKE) -C $(PCMCIA_DIR) clean + rm -f $(PCMCIA_DIR)/.configured $(PCMCIA_DIR)/config.out + +pcmcia-dirclean: + rm -rf $(PCMCIA_DIR) diff --git a/obsolete-buildroot/make/pppd.mk b/obsolete-buildroot/make/pppd.mk new file mode 100644 index 0000000000..a76149b9aa --- /dev/null +++ b/obsolete-buildroot/make/pppd.mk @@ -0,0 +1,68 @@ +############################################################# +# +# pppd +# +############################################################# +PPPD_SOURCE:=ppp-2.4.1.tar.gz +PPPD_SITE:=ftp://ftp.samba.org/pub/ppp +PPPD_DIR:=$(BUILD_DIR)/ppp-2.4.1 +PPPD_CAT:=zcat +PPPD_BINARY:=pppd/pppd +PPPD_TARGET_BINARY:=usr/sbin/pppd + + +$(DL_DIR)/$(PPPD_SOURCE): + $(WGET) -P $(DL_DIR) $(PPPD_SITE)/$(PPPD_SOURCE) + +pppd-source: $(DL_DIR)/$(PPPD_SOURCE) + +$(PPPD_DIR)/.unpacked: $(DL_DIR)/$(PPPD_SOURCE) + $(PPPD_CAT) $(DL_DIR)/$(PPPD_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SED) 's/ -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP//' $(PPPD_DIR)/pppd/Makefile.linux + $(SED) 's/$(INSTALL) -s/$(INSTALL)/' $(PPPD_DIR)/*/Makefile.linux + $(SED) 's/ -o root//' $(PPPD_DIR)/*/Makefile.linux + $(SED) 's/ -g daemon//' $(PPPD_DIR)/*/Makefile.linux + touch $(PPPD_DIR)/.unpacked + +$(PPPD_DIR)/.configured: $(PPPD_DIR)/.unpacked + (cd $(PPPD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(PPPD_DIR)/.configured + +$(PPPD_DIR)/$(PPPD_BINARY): $(PPPD_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(PPPD_DIR) + +$(TARGET_DIR)/$(PPPD_TARGET_BINARY): $(PPPD_DIR)/$(PPPD_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(PPPD_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +pppd: uclibc $(TARGET_DIR)/$(PPPD_TARGET_BINARY) + +pppd-clean: + rm -f $(TARGET_DIR)/usr/sbin/pppd + rm -f $(TARGET_DIR)/usr/sbin/chat + rm -rf $(TARGET_DIR)/etc/ppp + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(PPPD_DIR) uninstall + -$(MAKE) -C $(PPPD_DIR) clean + +pppd-dirclean: + rm -rf $(PPPD_DIR) + + diff --git a/obsolete-buildroot/make/python.mk b/obsolete-buildroot/make/python.mk new file mode 100644 index 0000000000..0be3a74a91 --- /dev/null +++ b/obsolete-buildroot/make/python.mk @@ -0,0 +1,57 @@ +############################################################# +# +# python +# +############################################################# +PYTHON_VERSION=2.3.2 +PYTHON_SOURCE:=Python-$(PYTHON_VERSION).tgz +PYTHON_SITE:=http://python.org/ftp/python/$(PYTHON_VERSION) +PYTHON_DIR:=$(BUILD_DIR)/Python-$(PYTHON_VERSION) +PYTHON_CAT:=zcat +PYTHON_BINARY:=python +PYTHON_INSTALL_DIR:=$(BUILD_DIR)/python_install +PYTHON_TARGET_BINARY:=$(PYTHON_INSTALL_DIR)/bin/python + + +$(DL_DIR)/$(PYTHON_SOURCE): + $(WGET) -P $(DL_DIR) $(PYTHON_SITE)/$(PYTHON_SOURCE) + +python-source: $(DL_DIR)/$(PYTHON_SOURCE) + +$(PYTHON_DIR)/.unpacked: $(DL_DIR)/$(PYTHON_SOURCE) + $(PYTHON_CAT) $(DL_DIR)/$(PYTHON_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(PYTHON_DIR)/.unpacked + +$(PYTHON_DIR)/.configured: $(PYTHON_DIR)/.unpacked + (cd $(PYTHON_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + ); + touch $(PYTHON_DIR)/.configured + +$(PYTHON_DIR)/$(PYTHON_BINARY): $(PYTHON_DIR)/.configured + LD_LIBRARY_PATH=$(STAGING_DIR)/lib + $(MAKE) CC=$(TARGET_CC) -C $(PYTHON_DIR) + +$(TARGET_DIR)/$(PYTHON_TARGET_BINARY): $(PYTHON_DIR)/$(PYTHON_BINARY) + +python: uclibc $(TARGET_DIR)/$(PYTHON_TARGET_BINARY) + $(MAKE) CC=$(TARGET_CC) -C $(PYTHON_DIR) install + rm $(PYTHON_INSTALL_DIR)/bin/idle + rm $(PYTHON_INSTALL_DIR)/bin/pydoc + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +python-clean: + -$(MAKE) -C $(PYTHON_DIR) distclean + rm $(PYTHON_DIR)/.configured + +python-dirclean: + rm -rf $(PYTHON_DIR) + diff --git a/obsolete-buildroot/make/raidtools.mk b/obsolete-buildroot/make/raidtools.mk new file mode 100644 index 0000000000..657f245f31 --- /dev/null +++ b/obsolete-buildroot/make/raidtools.mk @@ -0,0 +1,59 @@ +############################################################# +# +# raidtools2 +# +############################################################# +RAIDTOOLS2_SOURCE:=raidtools2-1.00.3.tar.gz +RAIDTOOLS2_SITE:= +RAIDTOOLS2_DIR:=$(BUILD_DIR)/raidtools2-1.00.3 +RAIDTOOLS2_CAT:=zcat +RAIDTOOLS2_BINARY:=mkraid +RAIDTOOLS2_TARGET_BINARY:=sbin/mkraid + +$(DL_DIR)/$(RAIDTOOLS2_SOURCE): + $(WGET) -P $(DL_DIR) $(RAIDTOOLS2_SITE)/$(RAIDTOOLS2_SOURCE) + +raidtools2-source: $(DL_DIR)/$(RAIDTOOLS2_SOURCE) + +$(RAIDTOOLS2_DIR)/.unpacked: $(DL_DIR)/$(RAIDTOOLS2_SOURCE) + $(RAIDTOOLS2_CAT) $(DL_DIR)/$(RAIDTOOLS2_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(RAIDTOOLS2_DIR)/.unpacked + +$(RAIDTOOLS2_DIR)/.configured: $(RAIDTOOLS2_DIR)/.unpacked + (cd $(RAIDTOOLS2_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share/misc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --enable-fsect-man5 \ + ); + touch $(RAIDTOOLS2_DIR)/.configured + +$(RAIDTOOLS2_DIR)/$(RAIDTOOLS2_BINARY): $(RAIDTOOLS2_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(RAIDTOOLS2_DIR) + +$(TARGET_DIR)/$(RAIDTOOLS2_TARGET_BINARY): $(RAIDTOOLS2_DIR)/$(RAIDTOOLS2_BINARY) + $(MAKE) ROOTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(RAIDTOOLS2_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +raidtools2: zlib uclibc $(TARGET_DIR)/$(RAIDTOOLS2_TARGET_BINARY) + +raidtools2-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(RAIDTOOLS2_DIR) uninstall + -$(MAKE) -C $(RAIDTOOLS2_DIR) clean + +raidtools2-dirclean: + rm -rf $(RAIDTOOLS2_DIR) diff --git a/obsolete-buildroot/make/rxvt.mk b/obsolete-buildroot/make/rxvt.mk new file mode 100644 index 0000000000..a633547038 --- /dev/null +++ b/obsolete-buildroot/make/rxvt.mk @@ -0,0 +1,70 @@ +############################################################# +# +# rxvt +# +############################################################# +# Copyright (C) 2002 by Tom Walsh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + +RXVT_SOURCE:=rxvt-2.6.4.tar.bz2 +RXVT_PATCH:=$(SOURCE_DIR)/rxvt-2.6.4.patch +RXVT_SITE:=ftp://ftp.rxvt.org/pub/rxvt/ +RXVT_CAT:=bzcat +RXVT_DIR:=$(BUILD_DIR)/rxvt-2.6.4 +RXVT_BINARY:=$(RXVT_DIR)/src/rxvt + +$(DL_DIR)/$(RXVT_SOURCE): + $(WGET) -P $(DL_DIR) $(RXVT_SITE)/$(RXVT_SOURCE) + +rxvt-source: $(DL_DIR)/$(RXVT_SOURCE) + +$(RXVT_DIR)/.unpacked: $(DL_DIR)/$(RXVT_SOURCE) + $(RXVT_CAT) $(DL_DIR)/$(RXVT_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(RXVT_DIR)/.unpacked + +$(RXVT_DIR)/.configured: $(RXVT_DIR)/.unpacked + (cd $(RXVT_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr/X11R6 \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --x-includes=$(TINYX_DIR)/exports/include \ + --x-libraries=$(TINYX_DIR)/exports/lib \ + ); + cat $(RXVT_PATCH) | patch -d $(RXVT_DIR) -p1 + touch $(RXVT_DIR)/.configured + +$(RXVT_BINARY): $(RXVT_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(RXVT_DIR) + $(STRIP) -x $(RXVT_BINARY) + +$(TARGET_DIR)/usr/X11R6/bin/rxvt: $(RXVT_BINARY) + cp -f $(RXVT_BINARY) $(TARGET_DIR)/usr/X11R6/bin + +rxvt: tinyx $(TARGET_DIR)/usr/X11R6/bin/rxvt + +rxvt-clean: + rm -f $(TARGET_DIR)/usr/X11R6/bin/rxvt + -$(MAKE) -C $(RXVT_DIR) clean + +rxvt-dirclean: + rm -rf $(RXVT_DIR) + diff --git a/obsolete-buildroot/make/sed.mk b/obsolete-buildroot/make/sed.mk new file mode 100644 index 0000000000..2476c59aad --- /dev/null +++ b/obsolete-buildroot/make/sed.mk @@ -0,0 +1,136 @@ +############################################################# +# +# sed +# +############################################################# +SED_SOURCE:=sed-4.0.8.tar.gz +SED_SITE:=ftp://ftp.gnu.org/gnu/sed +SED_CAT:=zcat +SED_DIR1:=$(TOOL_BUILD_DIR)/sed-4.0.8 +SED_DIR2:=$(BUILD_DIR)/sed-4.0.8 +SED_BINARY:=sed/sed +SED_TARGET_BINARY:=bin/sed +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) +SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64 +endif +SED:=$(STAGING_DIR)/bin/sed -i -e + +HOST_SED_TARGET=$(shell ./sources/sedcheck.sh) + +$(DL_DIR)/$(SED_SOURCE): + $(WGET) -P $(DL_DIR) $(SED_SITE)/$(SED_SOURCE) + +sed-source: $(DL_DIR)/$(SED_SOURCE) + + +############################################################# +# +# build sed for use on the host system +# +############################################################# +$(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE) + mkdir -p $(TOOL_BUILD_DIR) + mkdir -p $(DL_DIR) + mkdir -p $(STAGING_DIR)/bin; + $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(SED_DIR1)/.unpacked + +$(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked + (cd $(SED_DIR1); rm -rf config.cache; \ + ./configure \ + --prefix=$(STAGING_DIR) \ + --prefix=/usr \ + ); + touch $(SED_DIR1)/.configured + +$(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured + $(MAKE) -C $(SED_DIR1) + +# This stuff is needed to work around GNU make deficiencies +build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY) + @if [ -L $(STAGING_DIR)/$(SED_TARGET_BINARY) ] ; then \ + rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); fi; + @if [ ! -f $(STAGING_DIR)/$(SED_TARGET_BINARY) -o $(STAGING_DIR)/$(SED_TARGET_BINARY) \ + -ot $(SED_DIR1)/$(SED_BINARY) ] ; then \ + set -x; \ + mkdir -p $(STAGING_DIR)/bin; \ + $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) install; \ + mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \ + rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \ + $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; fi + +use-sed-host-binary: + @if [ -x /usr/bin/sed ]; then SED="/usr/bin/sed"; else \ + if [ -x /bin/sed ]; then SED="/bin/sed"; fi; fi; \ + mkdir -p $(STAGING_DIR)/bin; \ + rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); \ + ln -s $$SED $(STAGING_DIR)/$(SED_TARGET_BINARY) + +host-sed: $(HOST_SED_TARGET) + +host-sed-clean: + $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) uninstall + -$(MAKE) -C $(SED_DIR1) clean + +host-sed-dirclean: + rm -rf $(SED_DIR1) + + +############################################################# +# +# build sed for use on the target system +# +############################################################# +$(SED_DIR2)/.unpacked: $(DL_DIR)/$(SED_SOURCE) + $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(SED_DIR2)/.unpacked + +$(SED_DIR2)/.configured: $(SED_DIR2)/.unpacked + (cd $(SED_DIR2); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(SED_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + touch $(SED_DIR2)/.configured + +$(SED_DIR2)/$(SED_BINARY): $(SED_DIR2)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR2) + +# This stuff is needed to work around GNU make deficiencies +sed-target_binary: $(SED_DIR2)/$(SED_BINARY) + @if [ -L $(TARGET_DIR)/$(SED_TARGET_BINARY) ] ; then \ + rm -f $(TARGET_DIR)/$(SED_TARGET_BINARY); fi; + + @if [ ! -f $(SED_DIR2)/$(SED_BINARY) -o $(TARGET_DIR)/$(SED_TARGET_BINARY) \ + -ot $(SED_DIR2)/$(SED_BINARY) ] ; then \ + set -x; \ + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) install; \ + mv $(TARGET_DIR)/usr/bin/sed $(TARGET_DIR)/bin/; \ + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc; fi + +sed: uclibc sed-target_binary + +sed-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) uninstall + -$(MAKE) -C $(SED_DIR2) clean + +sed-dirclean: + rm -rf $(SED_DIR2) + + diff --git a/obsolete-buildroot/make/sfdisk.mk b/obsolete-buildroot/make/sfdisk.mk new file mode 100644 index 0000000000..c6b5e632b0 --- /dev/null +++ b/obsolete-buildroot/make/sfdisk.mk @@ -0,0 +1,36 @@ +############################################################# +# +# sfdisk support +# +############################################################# +SFDISK_SOURCE=sfdisk.tar.bz2 +SFDISK_SITE:=http://www.uclibc.org/ +SFDISK_DIR=$(BUILD_DIR)/sfdisk + + +$(DL_DIR)/$(SFDISK_SOURCE): + $(WGET) -P $(DL_DIR) $(SFDISK_SITE)/$(SFDISK_SOURCE) + +$(SFDISK_DIR): $(DL_DIR)/$(SFDISK_SOURCE) + bzcat $(DL_DIR)/$(SFDISK_SOURCE) | tar -C $(BUILD_DIR) -xvf - + +$(SFDISK_DIR)/sfdisk: $(SFDISK_DIR) + $(MAKE) CROSS=$(TARGET_CROSS) DEBUG=false -C $(SFDISK_DIR); + -$(STRIP) $(SFDISK_DIR)/sfdisk; + touch -c $(SFDISK_DIR)/sfdisk + +$(TARGET_DIR)/sbin/sfdisk: $(SFDISK_DIR)/sfdisk + cp $(SFDISK_DIR)/sfdisk $(TARGET_DIR)/sbin/sfdisk; + touch -c $(TARGET_DIR)/sbin/sfdisk + +sfdisk: uclibc $(TARGET_DIR)/sbin/sfdisk + +sfdisk-source: $(DL_DIR)/$(SFDISK_SOURCE) + +sfdisk-clean: + rm -f $(TARGET_DIR)/sbin/sfdisk + -$(MAKE) -C $(SFDISK_DIR) clean + +sfdisk-dirclean: + rm -rf $(SFDISK_DIR) + diff --git a/obsolete-buildroot/make/slang.mk b/obsolete-buildroot/make/slang.mk new file mode 100644 index 0000000000..17dcaddd59 --- /dev/null +++ b/obsolete-buildroot/make/slang.mk @@ -0,0 +1,48 @@ +############################################################# +# +# slang +# +############################################################# +SLANG_SOURCE=slang-1.4.5-mini.tar.bz2 +SLANG_SITE:=http://www.uclibc.org/ +SLANG_DIR=$(BUILD_DIR)/slang-1.4.5-mini +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) +SLANG_CFLAGS=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +endif +SLANG_CFLAGS+=-fPIC + +$(DL_DIR)/$(SLANG_SOURCE): + $(WGET) -P $(DL_DIR) $(SLANG_SITE)/$(SLANG_SOURCE) + +$(SLANG_DIR): $(DL_DIR)/$(SLANG_SOURCE) + bzcat $(DL_DIR)/$(SLANG_SOURCE) | tar -C $(BUILD_DIR) -xvf - + +$(SLANG_DIR)/libslang.so: $(SLANG_DIR) + $(MAKE) CFLAGS="-Os -g $(SLANG_CFLAGS)" CC=$(TARGET_CC) -C $(SLANG_DIR) + touch -c $(SLANG_DIR)/libslang.so; + +$(STAGING_DIR)/lib/libslang.so.1: $(SLANG_DIR)/libslang.so + cp -a $(SLANG_DIR)/libslang.a $(STAGING_DIR)/lib; + cp -a $(SLANG_DIR)/libslang.so $(STAGING_DIR)/lib; + cp -a $(SLANG_DIR)/slang.h $(STAGING_DIR)/include; + cp -a $(SLANG_DIR)/slcurses.h $(STAGING_DIR)/include; + (cd $(STAGING_DIR)/lib; ln -fs libslang.so libslang.so.1); + touch -c $(STAGING_DIR)/lib/libslang.so.1 + +$(TARGET_DIR)/lib/libslang.so.1: $(STAGING_DIR)/lib/libslang.so.1 + cp -a $(STAGING_DIR)/lib/libslang.so* $(TARGET_DIR)/lib; + -$(STRIP) --strip-unneeded $(TARGET_DIR)/lib/libslang.so* + touch -c $(TARGET_DIR)/lib/libslang.so.1 + +slang: uclibc $(STAGING_DIR)/lib/libslang.so.1 $(TARGET_DIR)/lib/libslang.so.1 + +slang-source: $(DL_DIR)/$(SLANG_SOURCE) + +slang-clean: + rm -f $(TARGET_DIR)/lib/libslang.so* + -$(MAKE) -C $(SLANG_DIR) clean + +slang-dirclean: + rm -rf $(SLANG_DIR) + + diff --git a/obsolete-buildroot/make/socat.mk b/obsolete-buildroot/make/socat.mk new file mode 100644 index 0000000000..010326d640 --- /dev/null +++ b/obsolete-buildroot/make/socat.mk @@ -0,0 +1,67 @@ +############################################################# +# +# socat +# +############################################################# + +SOCAT_VERSION=1.3.0.1 + +# Don't alter below this line unless you (think) you know +# what you are doing! Danger, Danger! + +SOCAT_SOURCE=socat-$(SOCAT_VERSION).tar.bz2 +SOCAT_SITE=http://www.dest-unreach.org/socat/download/ +#SOCAT_DIR=$(BUILD_DIR)/${shell basename $(SOCAT_SOURCE) .tar.bz2} +SOCAT_DIR=$(BUILD_DIR)/socat-1.3 +#SOCAT_WORKDIR=$(BUILD_DIR)/socat_workdir +SOCAT_WORKDIR=$(SOCAT_DIR) + +$(DL_DIR)/$(SOCAT_SOURCE): + $(WGET) -P $(DL_DIR) $(SOCAT_SITE)/$(SOCAT_SOURCE) + +$(SOCAT_DIR)/.unpacked: $(DL_DIR)/$(SOCAT_SOURCE) + bzip2 -d -c $(DL_DIR)/$(SOCAT_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(SOCAT_DIR)/.unpacked + +$(SOCAT_WORKDIR)/Makefile: $(SOCAT_DIR)/.unpacked + rm -f $(SOCAT_WORKDIR)/Makefile + mkdir -p $(SOCAT_WORKDIR) + (cd $(SOCAT_WORKDIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + $(SOCAT_DIR)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ); + +$(SOCAT_WORKDIR)/socat: $(SOCAT_WORKDIR)/Makefile + rm -f $@ + $(MAKE) -C $(SOCAT_WORKDIR) + +$(SOCAT_WORKDIR)/.installed: $(SOCAT_WORKDIR)/socat + mkdir -p $(TARGET_DIR)/usr/man/man1 + $(MAKE) -C $(SOCAT_WORKDIR) install prefix=$(TARGET_DIR)/usr + +socat: uclibc $(SOCAT_WORKDIR)/.installed + +socat-source: $(DL_DIR)/$(SOCAT_SOURCE) + +socat-clean: + @if [ -d $(SOCAT_WORKDIR)/Makefile ] ; then \ + $(MAKE) -C $(SOCAT_WORKDIR) clean ; \ + fi; + +socat-dirclean: + rm -rf $(SOCAT_DIR) $(SOCAT_WORKDIR) + diff --git a/obsolete-buildroot/make/squashfsroot.mk b/obsolete-buildroot/make/squashfsroot.mk new file mode 100644 index 0000000000..523d5e2a9d --- /dev/null +++ b/obsolete-buildroot/make/squashfsroot.mk @@ -0,0 +1,51 @@ +############################################################# +# +# mksquashfs to build to target squashfs filesystems +# +############################################################# +SQUASHFS_DIR=$(BUILD_DIR)/squashfs1.3r3 +SQUASHFS_SOURCE=squashfs1.3r3.tar.gz +SQUASHFS_SITE=http://aleron.dl.sourceforge.net/sourceforge/squashfs + +$(DL_DIR)/$(SQUASHFS_SOURCE): + $(WGET) -P $(DL_DIR) $(SQUASHFS_SITE)/$(SQUASHFS_SOURCE) + +$(SQUASHFS_DIR): $(DL_DIR)/$(SQUASHFS_SOURCE) #$(SQUASHFS_PATCH) + zcat $(DL_DIR)/$(SQUASHFS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SOURCE_DIR)/patch-kernel.sh $(SQUASHFS_DIR) $(SOURCE_DIR) squashfs.patch + +$(SQUASHFS_DIR)/squashfs-tools/mksquashfs: $(SQUASHFS_DIR) + $(MAKE) -C $(SQUASHFS_DIR)/squashfs-tools; + +squashfs: $(SQUASHFS_DIR)/squashfs-tools/mksquashfs + +squashfs-source: $(DL_DIR)/$(SQUASHFS_SOURCE) + +squashfs-clean: + -$(MAKE) -C $(SQUASHFS_DIR)/squashfs-tools clean + +squashfs-dirclean: + rm -rf $(SQUASHFS_DIR) + +############################################################# +# +# Build the squashfs root filesystem image +# +############################################################# + +squashfsroot: squashfs + #-@find $(TARGET_DIR)/lib -type f -name \*.so\* | xargs $(STRIP) --strip-unneeded 2>/dev/null || true; + -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true; + @rm -rf $(TARGET_DIR)/usr/man + @rm -rf $(TARGET_DIR)/usr/info + #$(SQUASHFS_DIR)/squashfs-tools/mksquashfs -q -D $(SOURCE_DIR)/device_table.txt $(TARGET_DIR) $(IMAGE) + $(SQUASHFS_DIR)/squashfs-tools/mksquashfs $(TARGET_DIR) $(IMAGE) -noappend -root-owned + +squashfsroot-source: squashfs-source + +squashfsroot-clean: + -$(MAKE) -C $(SQUASHFS_DIR) clean + +squashfsroot-dirclean: + rm -rf $(SQUASHFS_DIR) + diff --git a/obsolete-buildroot/make/strace.mk b/obsolete-buildroot/make/strace.mk new file mode 100644 index 0000000000..546584d80e --- /dev/null +++ b/obsolete-buildroot/make/strace.mk @@ -0,0 +1,59 @@ +############################################################# +# +# strace +# +############################################################# +STRACE_SOURCE:=strace-4.5.3.tar.bz2 +STRACE_SITE:=http://aleron.dl.sourceforge.net/sourceforge/strace +STRACE_CAT:=bzcat +STRACE_DIR:=$(BUILD_DIR)/strace-4.5.3 + + +$(DL_DIR)/$(STRACE_SOURCE): + $(WGET) -P $(DL_DIR) $(STRACE_SITE)/$(STRACE_SOURCE) + +strace-source: $(DL_DIR)/$(STRACE_SOURCE) + +$(STRACE_DIR)/.unpacked: $(DL_DIR)/$(STRACE_SOURCE) + $(STRACE_CAT) $(DL_DIR)/$(STRACE_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(STRACE_DIR)/.unpacked + +$(STRACE_DIR)/.configured: $(STRACE_DIR)/.unpacked + (cd $(STRACE_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(STRACE_DIR)/.configured + +$(STRACE_DIR)/strace: $(STRACE_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(STRACE_DIR) + +$(TARGET_DIR)/usr/bin/strace: $(STRACE_DIR)/strace + install -c $(STRACE_DIR)/strace $(TARGET_DIR)/usr/bin/strace + $(STRIP) $(TARGET_DIR)/usr/bin/strace > /dev/null 2>&1 + +strace: uclibc $(TARGET_DIR)/usr/bin/strace + +strace-clean: + $(MAKE) -C $(STRACE_DIR) clean + +strace-dirclean: + rm -rf $(STRACE_DIR) + + diff --git a/obsolete-buildroot/make/system-linux.mk b/obsolete-buildroot/make/system-linux.mk new file mode 100644 index 0000000000..2f55dd5979 --- /dev/null +++ b/obsolete-buildroot/make/system-linux.mk @@ -0,0 +1,59 @@ +############################################################# +# +# System Linux kernel target +# +# This uses an existing linux kernel source tree on +# your build system, and makes no effort at compiling +# anything.... +# +# You will probably want to change LINUX_SOURCE to +# point to wherever you installed you kernel. +# +# -Erik +# +############################################################# +ifneq ($(filter $(TARGETS),system-linux),) + +LINUX_SOURCE=/usr/src/linux +LINUX_DIR=$(BUILD_DIR)/linux +LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel +# Used by pcmcia-cs and others +LINUX_SOURCE_DIR=$(LINUX_SOURCE) + +$(LINUX_DIR)/.configured: + mkdir -p $(LINUX_DIR)/include + (cd $(LINUX_DIR)/include; \ + for i in $(LINUX_SOURCE)/include/*; do ln -sf $$i ; done; \ + rm -f asm; \ + if [ "$(ARCH)" = "powerpc" ];then \ + ln -fs asm-ppc asm; \ + elif [ "$(ARCH)" = "mips" ];then \ + ln -fs asm-mips asm; \ + elif [ "$(ARCH)" = "mipsel" ];then \ + ln -fs asm-mips asm; \ + elif [ "$(ARCH)" = "arm" ];then \ + ln -fs asm-arm asm; \ + (cd asm-arm; \ + if [ ! -L proc ] ; then \ + ln -fs proc-armv proc; \ + ln -fs arch-ebsa285 arch; fi); \ + elif [ "$(ARCH)" = "cris" ];then \ + ln -fs asm-cris asm; \ + else ln -fs asm-$(ARCH) asm; \ + fi) + cp $(LINUX_SOURCE)/Makefile $(LINUX_DIR)/ + cp $(LINUX_SOURCE)/Rules.make $(LINUX_DIR)/ + touch $(LINUX_DIR)/.configured + +$(LINUX_KERNEL): $(LINUX_DIR)/.configured + +system-linux: $(LINUX_DIR)/.configured + +system-linux-clean: clean + rm -f $(LINUX_KERNEL) + rm -rf $(LINUX_DIR) + +system-linux-dirclean: + rm -rf $(LINUX_DIR) + +endif diff --git a/obsolete-buildroot/make/tar.mk b/obsolete-buildroot/make/tar.mk new file mode 100644 index 0000000000..01e9187413 --- /dev/null +++ b/obsolete-buildroot/make/tar.mk @@ -0,0 +1,66 @@ +############################################################# +# +# tar +# +############################################################# +GNUTAR_SOURCE:=tar-1.13.25.tar.gz +GNUTAR_SITE:=ftp://alpha.gnu.org/gnu/tar +GNUTAR_DIR:=$(BUILD_DIR)/tar-1.13.25 +GNUTAR_CAT:=zcat +GNUTAR_BINARY:=src/tar +GNUTAR_TARGET_BINARY:=bin/tar + +$(DL_DIR)/$(GNUTAR_SOURCE): + $(WGET) -P $(DL_DIR) $(GNUTAR_SITE)/$(GNUTAR_SOURCE) + +tar-source: $(DL_DIR)/$(GNUTAR_SOURCE) + +$(GNUTAR_DIR)/.unpacked: $(DL_DIR)/$(GNUTAR_SOURCE) + $(GNUTAR_CAT) $(DL_DIR)/$(GNUTAR_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(GNUTAR_DIR)/.unpacked + +$(GNUTAR_DIR)/.configured: $(GNUTAR_DIR)/.unpacked + (cd $(GNUTAR_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(GNUTAR_DIR)/.configured + +$(GNUTAR_DIR)/$(GNUTAR_BINARY): $(GNUTAR_DIR)/.configured + $(MAKE) -C $(GNUTAR_DIR) + +# This stuff is needed to work around GNU make deficiencies +tar-target_binary: $(GNUTAR_DIR)/$(GNUTAR_BINARY) + @if [ -L $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY) ] ; then \ + rm -f $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY); fi; + @if [ ! -f $(GNUTAR_DIR)/$(GNUTAR_BINARY) -o $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY) \ + -ot $(GNUTAR_DIR)/$(GNUTAR_BINARY) ] ; then \ + set -x; \ + rm -f $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY); \ + cp -a $(GNUTAR_DIR)/$(GNUTAR_BINARY) $(TARGET_DIR)/$(GNUTAR_TARGET_BINARY); fi ; + +tar: uclibc tar-target_binary + +tar-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUTAR_DIR) uninstall + -$(MAKE) -C $(GNUTAR_DIR) clean + +tar-dirclean: + rm -rf $(GNUTAR_DIR) + diff --git a/obsolete-buildroot/make/tinylogin.mk b/obsolete-buildroot/make/tinylogin.mk new file mode 100644 index 0000000000..549de76b64 --- /dev/null +++ b/obsolete-buildroot/make/tinylogin.mk @@ -0,0 +1,52 @@ +############################################################# +# +# tinylogin +# +############################################################# +# Enable this to use the tinylogin daily snapshot +USE_TINYLOGIN_SNAPSHOT=true + +ifeq ($(USE_TINYLOGIN_SNAPSHOT),true) +# Be aware that this changes daily.... +TINYLOGIN_DIR:=$(BUILD_DIR)/tinylogin +TINYLOGIN_SOURCE:=tinylogin-snapshot.tar.bz2 +TINYLOGIN_SITE:=http://tinylogin.busybox.net/downloads/snapshots +else +TINYLOGIN_DIR:=$(BUILD_DIR)/tinylogin-1.4 +TINYLOGIN_SOURCE:=tinylogin-1.4.tar.bz2 +TINYLOGIN_SITE:=http://tinylogin.busybox.net/downloads +endif + +$(DL_DIR)/$(TINYLOGIN_SOURCE): + $(WGET) -P $(DL_DIR) $(TINYLOGIN_SITE)/$(TINYLOGIN_SOURCE) + +tinylogin-source: $(DL_DIR)/$(TINYLOGIN_SOURCE) + +$(TINYLOGIN_DIR)/Config.h: $(DL_DIR)/$(TINYLOGIN_SOURCE) + bzcat $(DL_DIR)/$(TINYLOGIN_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(SED) "s/\`id -u\` -ne 0/0 == 1/" \ + $(TINYLOGIN_DIR)/install.sh + $(SED) "s/4755 --owner=root --group=root/755/" \ + $(TINYLOGIN_DIR)/install.sh + $(SED) "s/^DOSTATIC.*/DOSTATIC=false/g;" $(TINYLOGIN_DIR)/Makefile + $(SED) "s/^DODEBUG.*/DODEBUG=false/g;" $(TINYLOGIN_DIR)/Makefile + # date test this one + touch $(TINYLOGIN_DIR)/Config.h + +$(TINYLOGIN_DIR)/tinylogin: $(TINYLOGIN_DIR)/Config.h + $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" \ + CFLAGS_EXTRA="$(TARGET_CFLAGS)" -C $(TINYLOGIN_DIR) + +$(TARGET_DIR)/bin/tinylogin: $(TINYLOGIN_DIR)/tinylogin + $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" \ + PREFIX="$(TARGET_DIR)" -C $(TINYLOGIN_DIR) \ + CFLAGS_EXTRA="$(TARGET_CFLAGS)" install + +tinylogin: uclibc $(TARGET_DIR)/bin/tinylogin + +tinylogin-clean: + rm -f $(TARGET_DIR)/bin/tinylogin + -$(MAKE) -C $(TINYLOGIN_DIR) clean + +tinylogin-dirclean: + rm -rf $(TINYLOGIN_DIR) diff --git a/obsolete-buildroot/make/tinyx.mk b/obsolete-buildroot/make/tinyx.mk new file mode 100644 index 0000000000..6c57e881fb --- /dev/null +++ b/obsolete-buildroot/make/tinyx.mk @@ -0,0 +1,127 @@ +############################################################# +# +# tinyx - a small footprint X-server for the TuxScreen +# +############################################################# +# Copyright (C) 2002 by Tom Walsh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 +# +############################################################# +# You may want to change these. +############################################################# + +TINYX_APPS:=xlsfonts/xlsfonts xmodmap/xmodmap +#xset/xset xdpyinfo/xdpyinfo xsetroot/xsetroot \ +# xrdb/xrdb xrandr/xrandr \ +# xhost/xhost xauth/xauth oclock/oclock xeyes/xeyes +# + +TINYX_LIBS:=ICE X11 Xext Xpm +# Xaw SM Xt Xmu + +############################################################# +# Stuff below this line shouldn't need changes. +# if you do change, look in rxvt & matchbox for the impact! +############################################################# +# +# Where resources are found. +# +TINYX_DIR:=$(BUILD_DIR)/xc-011010 +TINYX_LDIR:=$(TINYX_DIR)/lib +TINYX_PROGS:=$(TINYX_DIR)/programs +TINYX_PATCH:=$(SOURCE_DIR)/tinyx-011010.patch +TINYX_SOURCE:=xc-011010.tar.bz2 +TINYX_SITE:= http://intimate.handhelds.org/jacques/ +TINYX_CF:=$(TINYX_DIR)/config/cf +# +# Some things that you may want to change. +# +TINYX_XFBDEV:=$(TINYX_DIR)/programs/Xserver/Xfbdev +TINYX_CAT:=bzcat +TINYX_BINX:=$(TARGET_DIR)/usr/X11R6/bin/ +TINYX_LIBX:=$(TARGET_DIR)/usr/lib/ + +# +# These rules fetch various tinyx source files. +# +$(DL_DIR)/$(TINYX_SOURCE): + $(WGET) -P $(DL_DIR) $(TINYX_SITE)/$(TINYX_SOURCE) + +$(DL_DIR)/cross.def: + $(WGET) -P $(DL_DIR) $(TINYX_SITE)/xcompile/tuxscreen/cross.def + +$(DL_DIR)/host.def: + $(WGET) -P $(DL_DIR) $(TINYX_SITE)/xcompile/tuxscreen/host.def + +# +# rule to make sure that we have the source, and it is configured. +# +$(TINYX_DIR)/.configure: $(DL_DIR)/$(TINYX_SOURCE) $(DL_DIR)/cross.def $(DL_DIR)/host.def + $(TINYX_CAT) $(DL_DIR)/$(TINYX_SOURCE) | tar -C $(BUILD_DIR) -xvf - + cat $(TINYX_PATCH) | patch -d $(TINYX_DIR) -p1 + cp $(DL_DIR)/host.def $(TINYX_CF)/host.def + cp $(DL_DIR)/cross.def $(TINYX_CF)/cross.def + $(SED) 's:REPLACE_STAGING_DIR:$(STAGING_DIR):g' \ + $(TINYX_CF)/cross.def \ + $(TINYX_LDIR)/X11/Xlib.h + touch $(TINYX_DIR)/.configure + +# +# Now that we have the source, build it... +# +$(TINYX_XFBDEV): $(TINYX_DIR)/.configure + rm -f $(TINYX_BINX)/Xfbdev + ( cd $(TINYX_DIR) ; $(MAKE) World ; cd $(BUILDROOT) ) + +# +# Once Frame Buffer is built, we install executables. +# +$(TINYX_BINX)/Xfbdev: $(TINYX_XFBDEV) + -mkdir $(TARGET_DIR)/usr/X11R6 + -mkdir $(TINYX_BINX) + for file in $(TINYX_APPS) ; do \ + cp -f $(TINYX_DIR)/programs/$$file $(TINYX_BINX) ; \ + $(STRIP) $(TINYX_PROGS)/$$file ; \ + done + cp $(TINYX_DIR)/programs/Xserver/Xfbdev $(TINYX_BINX) + $(STRIP) $(TINYX_BINX)/Xfbdev + cp -f $(TINYX_DIR)/startx $(TARGET_DIR)/bin + chmod a+x $(TARGET_DIR)/bin/startx + +# +# After we have executables installed, install the libraries. +# +$(TINYX_LIBX)/libX11.so.6.2: $(TINYX_XFBDEV) + for dirs in $(TINYX_LIBS) ; do \ + file=`find $(TINYX_LDIR)/$$dirs -type f -iname "lib$$dirs.so*"` ; \ + $(STRIP) --strip-unneeded $$file ; \ + cp -f $$file $(TINYX_LIBX) ; \ + file=`find $(TINYX_LDIR)/$$dirs -type l -iname "lib$$dirs.so*"` ; \ + cp -pRf $$file $(TINYX_LIBX) ; \ + done + +tinyx: zlib $(TINYX_LIBX)/libX11.so.6.2 $(TINYX_BINX)/Xfbdev + +tinyx-source: $(DL_DIR)/$(TINYX_SOURCE) + +tinyx-clean: + -rm -rf $(TARGET_DIR)/usr/X11R6 + -$(MAKE) -C $(TINYX_DIR) clean + +tinyx-dirclean: + -rm -rf $(TINYX_DIR) + -rm -rf $(TARGET_DIR)/usr/X11R6 diff --git a/obsolete-buildroot/make/tn5250.mk b/obsolete-buildroot/make/tn5250.mk new file mode 100644 index 0000000000..6fcc160d6c --- /dev/null +++ b/obsolete-buildroot/make/tn5250.mk @@ -0,0 +1,51 @@ +TN5250_SITE:=http://aleron.dl.sourceforge.net/sourceforge/tn5250 +TN5250_DIR:=$(BUILD_DIR)/tn5250-0.16.4 +TN5250_SOURCE:=tn5250-0.16.4.tar.gz + +$(DL_DIR)/$(TN5250_SOURCE): + $(WGET) -P $(DL_DIR) $(TN5250_SITE)/$(TN5250_SOURCE) + +$(TN5250_DIR)/.dist: $(DL_DIR)/$(TN5250_SOURCE) + gunzip -c $(DL_DIR)/$(TN5250_SOURCE) | tar -C $(BUILD_DIR) -xvf - + -touch $(TN5250_DIR)/.dist + +$(TN5250_DIR)/.configured: $(TN5250_DIR)/.dist + (cd $(TN5250_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --with-slang --without-x --without-ssl \ + ); + touch $(TN5250_DIR)/.configured + +$(TN5250_DIR)/tn5250: $(TN5250_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(TN5250_DIR) + +$(TARGET_DIR)/usr/bin/tn5250: $(TN5250_DIR)/tn5250 + install -c $(TN5250_DIR)/tn5250 $(TARGET_DIR)/usr/bin/tn5250 + +tn5250: uclibc slang $(TARGET_DIR)/usr/bin/tn5250 + +tn5250-source: $(DL_DIR)/$(TN5250_SOURCE) + +tn5250-clean: + $(MAKE) -C $(TN5250_DIR) clean + +tn5250-dirclean: + rm -rf $(TN5250_DIR) + + + diff --git a/obsolete-buildroot/make/ttcp.mk b/obsolete-buildroot/make/ttcp.mk new file mode 100644 index 0000000000..7ff5f63158 --- /dev/null +++ b/obsolete-buildroot/make/ttcp.mk @@ -0,0 +1,37 @@ +############################################################# +# +# ttcp +# +############################################################# +# +TTCP_SOURCE_URL=http://ftp.sunet.se/ftp/pub/network/monitoring/ttcp +TTCP_SOURCE=ttcp.c +TTCP_BUILD_DIR=$(BUILD_DIR)/ttcp + +$(DL_DIR)/$(TTCP_SOURCE): + $(WGET) -P $(DL_DIR) $(TTCP_SOURCE_URL)/$(TTCP_SOURCE) + +$(TTCP_BUILD_DIR)/.unpacked: $(DL_DIR)/$(TTCP_SOURCE) + -mkdir $(TTCP_BUILD_DIR) + cp -af $(DL_DIR)/$(TTCP_SOURCE) $(TTCP_BUILD_DIR) + touch $(TTCP_BUILD_DIR)/.unpacked + +$(TTCP_BUILD_DIR)/.configured: $(TTCP_BUILD_DIR)/.unpacked + touch $(TTCP_BUILD_DIR)/.configured + +$(TTCP_BUILD_DIR)/ttcp: $(TTCP_BUILD_DIR)/.configured + $(TARGET_CC) -O2 -o $(TTCP_BUILD_DIR)/ttcp $(TTCP_BUILD_DIR)/$(TTCP_SOURCE) + +$(TARGET_DIR)/usr/bin/ttcp: $(TTCP_BUILD_DIR)/ttcp + cp -af $(TTCP_BUILD_DIR)/ttcp $(TARGET_DIR)/usr/bin/ + +ttcp: $(TARGET_DIR)/usr/bin/ttcp + +ttcp-source: $(DL_DIR)/$(TTCP_SOURCE) + +ttcp-clean: + rm -f $(TTCP_BUILD_DIR)/*.o $(TTCP_BUILD_DIR)/ttcp + +ttcp-dirclean: + rm -rf $(TTCP_BUILD_DIR) + diff --git a/obsolete-buildroot/make/uclibc.mk b/obsolete-buildroot/make/uclibc.mk new file mode 100644 index 0000000000..1e18d6894b --- /dev/null +++ b/obsolete-buildroot/make/uclibc.mk @@ -0,0 +1,184 @@ +############################################################# +# +# uClibc (the C library) +# +############################################################# +ifneq ($(strip $(USE_UCLIBC_SNAPSHOT)),) +# Be aware that this changes daily.... +UCLIBC_DIR:=$(BUILD_DIR)/uClibc +UCLIBC_SOURCE:=uClibc-$(strip $(USE_UCLIBC_SNAPSHOT)).tar.bz2 +UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots +else +UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.26 +UCLIBC_SOURCE:=uClibc-0.9.26.tar.bz2 +UCLIBC_SITE:=http://www.uclibc.org/downloads +endif + +UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \ + -e 's/i.86/i386/' \ + -e 's/sparc.*/sparc/' \ + -e 's/arm.*/arm/g' \ + -e 's/m68k.*/m68k/' \ + -e 's/ppc/powerpc/g' \ + -e 's/v850.*/v850/g' \ + -e 's/sh64/sh/' \ + -e 's/sh[234]/sh/' \ + -e 's/mips.*/mips/' \ + -e 's/mipsel.*/mips/' \ + -e 's/cris.*/cris/' \ +) + + +$(DL_DIR)/$(UCLIBC_SOURCE): + $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE) + +$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) +ifeq ($(SOFT_FLOAT),true) + # Make sure we have a soft float specs file for this arch + if [ ! -f $(SOURCE_DIR)/specs-$(ARCH)-soft-float ] ; then \ + echo soft float configured but no specs file for this arch ; \ + /bin/false ; \ + fi; +endif + bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf - + #(cd $(BUILD_DIR) ; ln -s $(DL_DIR)/uClibc) + #-mkdir $(UCLIBC_DIR) + #(cd $(DL_DIR)/uClibc && tar cf - .) | (cd $(UCLIBC_DIR) && tar xvfp - ) +ifeq ($(strip $(USE_UCLIBC_LDSO_0_9_24)),true) + $(SOURCE_DIR)/patch-kernel.sh $(UCLIBC_DIR) $(SOURCE_DIR) uClibc-ldso-0.9.24.patch +endif + touch $(UCLIBC_DIR)/.unpacked + +$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(LINUX_DIR)/.configured + $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak +ifeq ($(ENABLE_LOCALE),true) + cp $(SOURCE_DIR)/uClibc.config-locale $(UCLIBC_DIR)/.config +else + cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config +endif + $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \ + $(UCLIBC_DIR)/.config + $(SED) 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config + $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \ + $(UCLIBC_DIR)/.config + $(SED) 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \ + $(UCLIBC_DIR)/.config + $(SED) 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \ + $(UCLIBC_DIR)/.config + $(SED) 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \ + $(UCLIBC_DIR)/.config +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) + $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config +else + $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config +endif + $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config +ifeq ($(strip $(SOFT_FLOAT)),true) + $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config +endif + mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include + mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib + mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \ + DEVEL_PREFIX=/usr/ \ + RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \ + HOSTCC="$(HOSTCC)" \ + pregen install_dev; + touch $(UCLIBC_DIR)/.configured + +$(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET) + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX= \ + DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \ + RUNTIME_PREFIX=/ \ + HOSTCC="$(HOSTCC)" \ + all +ifeq ($(strip $(USE_UCLIBC_LDSO_0_9_24)),true) + #rm -rf $(UCLIBC_DIR)/ld-uClibc* $(UCLIBC_DIR)/libdl* + $(MAKE) -C $(UCLIBC_DIR)/ldso-0.9.24 \ + PREFIX= \ + DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \ + RUNTIME_PREFIX=/ \ + HOSTCC="$(HOSTCC)" \ + all shared +endif + +$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX=$(STAGING_DIR)/ \ + DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \ + RUNTIME_PREFIX=$(REAL_GNU_TARGET_NAME)/ \ + install_runtime + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX=$(STAGING_DIR)/ \ + DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \ + RUNTIME_PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/ \ + install_dev + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX=$(STAGING_DIR) \ + HOSTCC="$(HOSTCC)" \ + utils install_utils + # Clean up the host compiled utils... + $(MAKE) -C $(UCLIBC_DIR)/utils clean + +ifneq ($(TARGET_DIR),) +$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX=$(TARGET_DIR) \ + DEVEL_PREFIX=/usr/ \ + RUNTIME_PREFIX=/ \ + install_runtime + +$(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0 + $(MAKE) -C $(UCLIBC_DIR) $(TARGET_CONFIGURE_OPTS) \ + PREFIX=$(TARGET_DIR) utils install_utils + +UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd +endif + +uclibc-configured: $(UCLIBC_DIR)/.configured + +uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a \ + $(UCLIBC_TARGETS) + +uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE) + +uclibc-configured-source: uclibc-source + +uclibc-clean: + -$(MAKE) -C $(UCLIBC_DIR) clean + rm -f $(UCLIBC_DIR)/.config + +uclibc-dirclean: + rm -rf $(UCLIBC_DIR) + + + + +############################################################# +# +# uClibc for the target just needs its header files +# and whatnot installed. +# +############################################################# + +$(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a + $(MAKE) -C $(UCLIBC_DIR) \ + PREFIX=$(TARGET_DIR) \ + DEVEL_PREFIX=/usr/ \ + RUNTIME_PREFIX=/ \ + install_dev + +ifeq ($(GCC_2_95_TOOLCHAIN),true) +uclibc_target: gcc2_95 uclibc $(TARGET_DIR)/usr/lib/libc.a +else +uclibc_target: gcc3_3 uclibc $(TARGET_DIR)/usr/lib/libc.a +endif + +uclibc_target-clean: + rm -f $(TARGET_DIR)/include + +uclibc_target-dirclean: + rm -f $(TARGET_DIR)/include + diff --git a/obsolete-buildroot/make/udhcp.mk b/obsolete-buildroot/make/udhcp.mk new file mode 100644 index 0000000000..46cb203d0f --- /dev/null +++ b/obsolete-buildroot/make/udhcp.mk @@ -0,0 +1,64 @@ +############################################################# +# +# uchdp DHCP client and/or server +# +############################################################# +# Copyright (C) 2001-2003 by Erik Andersen +# Copyright (C) 2002 by Tim Riker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library 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 + +UDHCP_SOURCE:=udhcp-0.9.8.tar.gz +UDHCP_SITE:=http://udhcp.busybox.net/downloads/ +UDHCP_DIR:=$(BUILD_DIR)/udhcp-0.9.8 + +$(DL_DIR)/$(UDHCP_SOURCE): + $(WGET) -P $(DL_DIR) $(UDHCP_SITE)/$(UDHCP_SOURCE) + +udhcp-source: $(DL_DIR)/$(UDHCP_SOURCE) + +$(UDHCP_DIR)/.unpacked: $(DL_DIR)/$(UDHCP_SOURCE) + zcat $(DL_DIR)/$(UDHCP_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(UDHCP_DIR)/.unpacked + +#$(UDHCP_DIR)/.unpacked: +# (cd $(BUILD_DIR); \ +# CVS_PASSFILE=$(CVS_PASSFILE) \ +# cvs -z3 -d:pserver:anonymous@busybox.net:/var/cvs co udhcp ) +# touch $(UDHCP_DIR)/.unpacked + +$(UDHCP_DIR)/udhcpc: $(UDHCP_DIR)/.unpacked + $(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" prefix="$(TARGET_DIR)" -C $(UDHCP_DIR) + +$(TARGET_DIR)/sbin/udhcpc: $(UDHCP_DIR)/udhcpc + $(SED) 's/pump/udhcpc/' $(TARGET_DIR)/etc/pcmcia/network* + $(SED) 's/PUMP/UDHCPC/' $(TARGET_DIR)/etc/pcmcia/network* + $(SED) 's/DHCP="n"/DHCP="y"/' $(TARGET_DIR)/etc/pcmcia/network* + mkdir -p $(TARGET_DIR)/sbin + rm -f $(TARGET_DIR)/sbin/udhcpc + cp $(UDHCP_DIR)/udhcpc $(TARGET_DIR)/sbin/ + mkdir -p $(TARGET_DIR)/usr/share/udhcpc + cp $(UDHCP_DIR)/samples/simple.script $(TARGET_DIR)/usr/share/udhcpc/default.script + chmod a+x $(TARGET_DIR)/sbin/udhcpc $(TARGET_DIR)/usr/share/udhcpc/default.script + +udhcp: uclibc $(TARGET_DIR)/sbin/udhcpc + +udhcp-clean: + rm -f $(TARGET_DIR)/sbin/udhcpc + -$(MAKE) -C $(UDHCP_DIR) clean + +udhcp-dirclean: + rm -rf $(UDHCP_DIR) diff --git a/obsolete-buildroot/make/util-linux.mk b/obsolete-buildroot/make/util-linux.mk new file mode 100644 index 0000000000..c29a8403b7 --- /dev/null +++ b/obsolete-buildroot/make/util-linux.mk @@ -0,0 +1,69 @@ +############################################################# +# +# util-linux +# +############################################################# +UTIL-LINUX_SOURCE:=util-linux_2.12.orig.tar.gz +UTIL-LINUX_SITE:=http://ftp.debian.org/debian/pool/main/u/util-linux/ +UTIL-LINUX_PATCH:=util-linux_2.12-6.diff.gz +UTIL-LINUX_CAT:=zcat +UTIL-LINUX_DIR:=$(BUILD_DIR)/util-linux-2.12 +UTIL-LINUX_BINARY:=$(UTIL-LINUX_DIR)/misc-utils/mcookie +UTIL-LINUX_TARGET_BINARY:=$(TARGET_DIR)/usr/bin/mcookie + +$(DL_DIR)/$(UTIL-LINUX_SOURCE): + $(WGET) -P $(DL_DIR) $(UTIL-LINUX_SITE)/$(UTIL-LINUX_SOURCE) + +$(DL_DIR)/$(UTIL-LINUX_PATCH): + $(WGET) -P $(DL_DIR) $(UTIL-LINUX_SITE)/$(UTIL-LINUX_PATCH) + +$(UTIL-LINUX_DIR)/.unpacked: $(DL_DIR)/$(UTIL-LINUX_SOURCE) $(DL_DIR)/$(UTIL-LINUX_PATCH) + $(UTIL-LINUX_CAT) $(DL_DIR)/$(UTIL-LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(UTIL-LINUX_CAT) $(DL_DIR)/$(UTIL-LINUX_PATCH) | patch -p1 -d $(UTIL-LINUX_DIR) + cat $(SOURCE_DIR)/util-linux.patch | patch -p1 -d $(UTIL-LINUX_DIR) + touch $(UTIL-LINUX_DIR)/.unpacked + +$(UTIL-LINUX_DIR)/.configured: $(UTIL-LINUX_DIR)/.unpacked + (cd $(UTIL-LINUX_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + ARCH=$(ARCH) \ + ); + $(SED) "s,^INSTALLSUID=.*,INSTALLSUID=\\$$\(INSTALL\) -m \\$$\(BINMODE\)," \ + $(UTIL-LINUX_DIR)/MCONFIG + $(SED) "s,^USE_TTY_GROUP=.*,USE_TTY_GROUP=no," $(UTIL-LINUX_DIR)/MCONFIG + touch $(UTIL-LINUX_DIR)/.configured + +$(UTIL-LINUX_BINARY): $(UTIL-LINUX_DIR)/.configured + $(MAKE) ARCH=$(ARCH) CC=$(TARGET_CC) -C $(UTIL-LINUX_DIR) + +$(UTIL-LINUX_TARGET_BINARY): $(UTIL-LINUX_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) USE_TTY_GROUP=no -C $(UTIL-LINUX_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +util-linux: uclibc $(UTIL-LINUX_TARGET_BINARY) + +util-linux-source: $(DL_DIR)/$(UTIL-LINUX_SOURCE) + +util-linux-clean: + #There is no working 'uninstall' target. Just skip it... + #$(MAKE) DESTDIR=$(TARGET_DIR) -C $(UTIL-LINUX_DIR) uninstall + -$(MAKE) -C $(UTIL-LINUX_DIR) clean + +util-linux-dirclean: + rm -rf $(UTIL-LINUX_DIR) + + diff --git a/obsolete-buildroot/make/valgrind.mk b/obsolete-buildroot/make/valgrind.mk new file mode 100644 index 0000000000..ed295a3cfb --- /dev/null +++ b/obsolete-buildroot/make/valgrind.mk @@ -0,0 +1,88 @@ +############################################################# +# +# valgrind +# +############################################################# + +VALGRIND_SITE:=http://developer.kde.org/~sewardj/ +VALGRIND_DIR:=$(BUILD_DIR)/valgrind-2.1.1 +VALGRIND_SOURCE:=valgrind-2.1.1.tar.bz2 +VALGRIND_PATCH:=$(SOURCE_DIR)/valgrind.patch + +$(DL_DIR)/$(VALGRIND_SOURCE): + $(WGET) -P $(DL_DIR) $(VALGRIND_SITE)/$(VALGRIND_SOURCE) + +$(VALGRIND_DIR)/.unpacked: $(DL_DIR)/$(VALGRIND_SOURCE) + bzcat $(DL_DIR)/$(VALGRIND_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(VALGRIND_DIR)/.unpacked + +$(VALGRIND_DIR)/.patched: $(VALGRIND_DIR)/.unpacked + cat $(VALGRIND_PATCH) | patch -d $(VALGRIND_DIR) -p1 + touch $(VALGRIND_DIR)/.patched + +$(VALGRIND_DIR)/.configured: $(VALGRIND_DIR)/.patched + (cd $(VALGRIND_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + --without-uiout --disable-valgrindmi \ + --disable-tui --disable-valgrindtk \ + --without-x --without-included-gettext \ + ); + touch $(VALGRIND_DIR)/.configured + +$(VALGRIND_DIR)/coregrind/valgrind.so: $(VALGRIND_DIR)/.configured + $(MAKE) -C $(VALGRIND_DIR) + -$(STRIP) --strip-unneeded $(VALGRIND_DIR)/*.so* + touch -c $(VALGRIND_DIR)/coregrind/valgrind.so + +$(TARGET_DIR)/usr/bin/valgrind: $(VALGRIND_DIR)/coregrind/valgrind.so + $(MAKE) \ + prefix=$(TARGET_DIR)/usr \ + exec_prefix=$(TARGET_DIR)/usr \ + bindir=$(TARGET_DIR)/usr/bin \ + sbindir=$(TARGET_DIR)/usr/sbin \ + libexecdir=$(TARGET_DIR)/usr/lib \ + datadir=$(TARGET_DIR)/usr/share \ + sysconfdir=$(TARGET_DIR)/etc \ + sharedstatedir=$(TARGET_DIR)/usr/com \ + localstatedir=$(TARGET_DIR)/var \ + libdir=$(TARGET_DIR)/usr/lib \ + infodir=$(TARGET_DIR)/usr/info \ + mandir=$(TARGET_DIR)/usr/man \ + includedir=$(TARGET_DIR)/usr/include \ + -C $(VALGRIND_DIR) install; + rm -rf $(TARGET_DIR)/usr/share/doc/valgrind + #mkdir -p $(TARGET_DIR)/etc/default + #cp $(VALGRIND_DIR)/valgrind.default $(TARGET_DIR)/etc/default/valgrind + #mkdir -p $(TARGET_DIR)/usr/lib/valgrind + #cp $(VALGRIND_DIR)/woody.supp $(TARGET_DIR)/usr/lib/valgrind/ + touch -c $(TARGET_DIR)/usr/bin/valgrind + +ifeq ($(ARCH),i386) +valgrind: $(TARGET_DIR)/usr/bin/valgrind +else +valgrind: +endif + +valgrind-source: $(DL_DIR)/$(VALGRIND_SOURCE) + +valgrind-clean: + $(MAKE) -C $(VALGRIND_DIR) clean + +valgrind-dirclean: + rm -rf $(VALGRIND_DIR) + diff --git a/obsolete-buildroot/make/vtun.mk b/obsolete-buildroot/make/vtun.mk new file mode 100644 index 0000000000..595a6f82b2 --- /dev/null +++ b/obsolete-buildroot/make/vtun.mk @@ -0,0 +1,66 @@ +############################################################# +# +# vtun +# +# NOTE: Uses start-stop-daemon in init script, so be sure +# to enable that within busybox +# +############################################################# +VTUN_SOURCE:=vtun-2.6.tar.gz +VTUN_SITE:=http://aleron.dl.sourceforge.net/sourceforge/vtun/ +VTUN_DIR:=$(BUILD_DIR)/vtun-2.6 +VTUN_CAT:=zcat +VTUN_BINARY:=vtund +VTUN_TARGET_BINARY:=usr/sbin/vtund +VTUN_PATCH:=$(SOURCE_DIR)/vtun.patch + +$(DL_DIR)/$(VTUN_SOURCE): + $(WGET) -P $(DL_DIR) $(VTUN_SITE)/$(VTUN_SOURCE) + +vtun-source: $(DL_DIR)/$(VTUN_SOURCE) + +$(VTUN_DIR)/.unpacked: $(DL_DIR)/$(VTUN_SOURCE) + $(VTUN_CAT) $(DL_DIR)/$(VTUN_SOURCE) | tar -C $(BUILD_DIR) -xvf - + mv $(BUILD_DIR)/vtun $(VTUN_DIR) + cat $(VTUN_PATCH) | patch -p1 -d $(VTUN_DIR) + touch $(VTUN_DIR)/.unpacked + +$(VTUN_DIR)/.configured: $(VTUN_DIR)/.unpacked zlib lzo openssl + (cd $(VTUN_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --with-ssl-headers=$(STAGING_DIR)/include/openssl \ + --with-lzo-headers=$(STAGING_DIR)/include \ + ); + touch $(VTUN_DIR)/.configured + +$(VTUN_DIR)/$(VTUN_BINARY): $(VTUN_DIR)/.configured + $(MAKE) -C $(VTUN_DIR) + +$(TARGET_DIR)/$(VTUN_TARGET_BINARY): $(VTUN_DIR)/$(VTUN_BINARY) + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(VTUN_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + +vtun: uclibc $(TARGET_DIR)/$(VTUN_TARGET_BINARY) + +vtun-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) -C $(VTUN_DIR) uninstall + -$(MAKE) -C $(VTUN_DIR) clean + +vtun-dirclean: + rm -rf $(VTUN_DIR) + diff --git a/obsolete-buildroot/make/wtools.mk b/obsolete-buildroot/make/wtools.mk new file mode 100644 index 0000000000..53ed4ff574 --- /dev/null +++ b/obsolete-buildroot/make/wtools.mk @@ -0,0 +1,50 @@ +############################################################# +# +# wtools - Wireless Tools +# +############################################################# +# +WTOOLS_SOURCE_URL=http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux +WTOOLS_SOURCE=wireless_tools.26.tar.gz +WTOOLS_BUILD_DIR=$(BUILD_DIR)/wireless_tools.26 + +$(DL_DIR)/$(WTOOLS_SOURCE): + $(WGET) -P $(DL_DIR) $(WTOOLS_SOURCE_URL)/$(WTOOLS_SOURCE) + +$(WTOOLS_BUILD_DIR)/.unpacked: $(DL_DIR)/$(WTOOLS_SOURCE) + zcat $(DL_DIR)/$(WTOOLS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(WTOOLS_BUILD_DIR)/.unpacked + +$(WTOOLS_BUILD_DIR)/.configured: $(WTOOLS_BUILD_DIR)/.unpacked + touch $(WTOOLS_BUILD_DIR)/.configured + +$(WTOOLS_BUILD_DIR)/iwconfig: $(WTOOLS_BUILD_DIR)/.configured + $(MAKE) -C $(WTOOLS_BUILD_DIR) \ + CC=$(TARGET_CC) CFLAGS="$(TARGET_CFLAGS)" \ + BUILD_SHARED=y # may want to make this an option + +$(TARGET_DIR)/sbin/iwconfig: $(WTOOLS_BUILD_DIR)/iwconfig + # Copy The Wireless Tools + cp -af $(WTOOLS_BUILD_DIR)/iwconfig $(TARGET_DIR)/sbin/ + cp -af $(WTOOLS_BUILD_DIR)/iwevent $(TARGET_DIR)/sbin/ + cp -af $(WTOOLS_BUILD_DIR)/iwgetid $(TARGET_DIR)/sbin/ + cp -af $(WTOOLS_BUILD_DIR)/iwlist $(TARGET_DIR)/sbin/ + cp -af $(WTOOLS_BUILD_DIR)/iwpriv $(TARGET_DIR)/sbin/ + cp -af $(WTOOLS_BUILD_DIR)/iwspy $(TARGET_DIR)/sbin/ + cp -af $(WTOOLS_BUILD_DIR)/libiw.so.26 $(TARGET_DIR)/lib + $(STRIP) $(TARGET_DIR)/sbin/iwconfig $(TARGET_DIR)/sbin/iwevent \ + $(TARGET_DIR)/sbin/iwgetid $(TARGET_DIR)/sbin/iwlist \ + $(TARGET_DIR)/sbin/iwpriv $(TARGET_DIR)/sbin/iwspy \ + $(TARGET_DIR)/lib/libiw.so.26 + +wtools: $(TARGET_DIR)/sbin/iwconfig + +wtools-source: $(DL_DIR)/$(WTOOLS_SOURCE) + +wtools-clean: + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(WTOOLS_BUILD_DIR) uninstall + -$(MAKE) -C $(WTOOLS_BUILD_DIR) clean + +wtools-dirclean: + rm -rf $(WTOOLS_BUILD_DIR) + diff --git a/obsolete-buildroot/make/zlib.mk b/obsolete-buildroot/make/zlib.mk new file mode 100644 index 0000000000..90c6915aa1 --- /dev/null +++ b/obsolete-buildroot/make/zlib.mk @@ -0,0 +1,72 @@ +############################################################# +# +# zlib +# +############################################################# +ZLIB_SOURCE=zlib-1.1.4.tar.bz2 +ZLIB_SITE=http://aleron.dl.sourceforge.net/sourceforge/libpng +ZLIB_DIR=$(BUILD_DIR)/zlib-1.1.4 +ZLIB_CFLAGS= $(TARGET_CFLAGS) -fPIC +ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) +ZLIB_CFLAGS+= -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +endif + +$(DL_DIR)/$(ZLIB_SOURCE): + $(WGET) -P $(DL_DIR) $(ZLIB_SITE)/$(ZLIB_SOURCE) + +$(ZLIB_DIR)/.source: $(DL_DIR)/$(ZLIB_SOURCE) + bzcat $(DL_DIR)/$(ZLIB_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(ZLIB_DIR)/.source + +$(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.source + (cd $(ZLIB_DIR); \ + ./configure \ + --shared \ + --prefix=/usr \ + --exec-prefix=$(STAGING_DIR)/usr/bin \ + --libdir=$(STAGING_DIR)/lib \ + --includedir=$(STAGING_DIR)/include \ + ); + touch $(ZLIB_DIR)/.configured; + +$(ZLIB_DIR)/libz.so.1.1.4: $(ZLIB_DIR)/.configured + $(MAKE) LDSHARED="$(TARGET_CROSS)ld -shared -soname,libz.so.1" \ + CFLAGS="$(ZLIB_CFLAGS)" CC=$(TARGET_CC) -C $(ZLIB_DIR) all libz.a; + touch -c $(ZLIB_DIR)/libz.so.1.1.4 + +$(STAGING_DIR)/lib/libz.so.1.1.4: $(ZLIB_DIR)/libz.so.1.1.4 + cp -dpf $(ZLIB_DIR)/libz.a $(STAGING_DIR)/lib; + cp -dpf $(ZLIB_DIR)/zlib.h $(STAGING_DIR)/include; + cp -dpf $(ZLIB_DIR)/zconf.h $(STAGING_DIR)/include; + cp -dpf $(ZLIB_DIR)/libz.so* $(STAGING_DIR)/lib; + (cd $(STAGING_DIR)/lib; ln -fs libz.so.1.1.4 libz.so.1); + chmod a-x $(STAGING_DIR)/lib/libz.so.1.1.4 + touch -c $(STAGING_DIR)/lib/libz.so.1.1.4 + +$(TARGET_DIR)/lib/libz.so.1.1.4: $(STAGING_DIR)/lib/libz.so.1.1.4 + cp -dpf $(STAGING_DIR)/lib/libz.so* $(TARGET_DIR)/lib; + -$(STRIP) --strip-unneeded $(TARGET_DIR)/lib/libz.so* + touch -c $(TARGET_DIR)/lib/libz.so.1.1.4 + +$(TARGET_DIR)/usr/lib/libz.a: $(STAGING_DIR)/lib/libz.so.1.1.4 + mkdir -p $(TARGET_DIR)/usr/include + cp -dpf $(STAGING_DIR)/include/zlib.h $(TARGET_DIR)/usr/include/ + cp -dpf $(STAGING_DIR)/include/zconf.h $(TARGET_DIR)/usr/include/ + cp -dpf $(STAGING_DIR)/lib/libz.a $(TARGET_DIR)/usr/lib/ + rm -f $(TARGET_DIR)/lib/libz.so + (cd $(TARGET_DIR)/usr/lib; ln -fs /lib/libz.so.1.1.4 libz.so) + touch -c $(TARGET_DIR)/usr/lib/libz.a + +zlib-headers: $(TARGET_DIR)/usr/lib/libz.a + +zlib: uclibc $(TARGET_DIR)/lib/libz.so.1.1.4 + +zlib-source: $(DL_DIR)/$(ZLIB_SOURCE) + +zlib-clean: + rm -f $(TARGET_DIR)/lib/libz.so* + -$(MAKE) -C $(ZLIB_DIR) clean + +zlib-dirclean: + rm -rf $(ZLIB_DIR) + diff --git a/obsolete-buildroot/sources/.cvsignore b/obsolete-buildroot/sources/.cvsignore new file mode 100644 index 0000000000..5c488628e4 --- /dev/null +++ b/obsolete-buildroot/sources/.cvsignore @@ -0,0 +1 @@ +dl diff --git a/obsolete-buildroot/sources/STLport-4.5.3.patch b/obsolete-buildroot/sources/STLport-4.5.3.patch new file mode 100644 index 0000000000..fee65f9200 --- /dev/null +++ b/obsolete-buildroot/sources/STLport-4.5.3.patch @@ -0,0 +1,407 @@ +diff -urN STLport-4.5.3/Makefile STLport-4.5.3-devel/Makefile +--- STLport-4.5.3/Makefile Wed Dec 31 17:00:00 1969 ++++ STLport-4.5.3-devel/Makefile Tue Jan 7 15:28:08 2003 +@@ -0,0 +1,44 @@ ++# Makefile to compile stlport with uClibc ++# ++# Copyright (C) 2002 Erik Andersen ++# ++# 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 ++ ++ARCH:=i386 ++PREFIX:=/usr/$(ARCH)-linux-uclibc ++CROSS:= $(PREFIX)/../bin/$(ARCH)-linux-uclibc- ++CC=$(CROSS)gcc ++CXX=$(CROSS)g++ ++AR = $(CROSS)ar ++STRIP = $(CROSS)strip --remove-section=.comment --remove-section=.note --strip-unneeded ++.EXPORT_ALL_VARIABLES: ++ ++all: ++ rm -f lib/lib* ++ make -C src -f gcc-uClibc.mak all ++ (cd lib; rm -f libstdc++_debug.so; \ ++ ln -fs libstdc++.so.4.5 libstdc++.so; \ ++ ln -fs libstdc++.so.4.5 libstdc++.so.0;) ++ $(STRIP) lib/libstdc++.so.4.5; ++ ++clean: ++ make -C src -f gcc-uClibc.mak clean ++ rm -rf lib/* ++ ++install: ++ (cd lib; \ ++ cp -a libstdc++.a $(PREFIX)/lib; \ ++ cp -a libstdc++.so libstdc++.so.0 libstdc++.so.4.5 $(PREFIX)/lib;) ++ cp -a stlport $(PREFIX)/include/c++ +diff -urN STLport-4.5.3/src/dll_main.cpp STLport-4.5.3-devel/src/dll_main.cpp +--- STLport-4.5.3/src/dll_main.cpp Sat Feb 2 16:11:56 2002 ++++ STLport-4.5.3-devel/src/dll_main.cpp Tue Jan 7 15:28:08 2003 +@@ -52,7 +52,7 @@ + # include + # endif + +-# if defined (_STLP_UNIX) ++# if defined (_STLP_UNIX) && defined (_STLP_PTHREADS) && ! defined (_STLP_USE_UCLIBC) + # define _STLP_HAS_PERTHREAD_ALLOCATOR + # include + # endif +diff -urN STLport-4.5.3/src/gcc-uClibc.mak STLport-4.5.3-devel/src/gcc-uClibc.mak +--- STLport-4.5.3/src/gcc-uClibc.mak Wed Dec 31 17:00:00 1969 ++++ STLport-4.5.3-devel/src/gcc-uClibc.mak Tue Jan 7 15:28:08 2003 +@@ -0,0 +1,61 @@ ++# ++# Basename for libraries ++# ++LIB_BASENAME:=libstdc++ ++LIB_SHAREDNAME:=$(LIB_BASENAME).so ++LIB_SHAREDNAME_FULL:=$(LIB_SHAREDNAME).0 ++ ++# ++# guts for common stuff ++# ++# ++LINK:=$(AR) -cr ++#DYN_LINK:=$(CC) -fno-exceptions -lpthread -lm -shared -Wl,-soname=$(LIB_SHAREDNAME_FULL) -o ++DYN_LINK:=$(CC) -fno-exceptions -shared -Wl,-soname=$(LIB_SHAREDNAME_FULL) -o ++ ++OBJEXT=o ++DYNEXT=so ++STEXT=a ++RM=rm -rf ++PATH_SEP=/ ++MKDIR=mkdir -p ++COMP=GCC$(ARCH) ++INSTALL_STEP = install_unix ++ ++all: release_dynamic release_static ++#all: all_dynamic all_static symbolic_links ++ ++include common_macros.mak ++STLDEBUG_NAME:=$(LIB_BASENAME).debug ++ ++# Lets disable exception support, since this saves over 200k... ++DEFINE_FLAGS:= -fno-exceptions ++#DEFINE_FLAGS:= -D_STLP_NO_EXCEPTIONS -fno-exceptions -DSTL_NO_EXCEPTIONS ++ ++#DEFINE_FLAGS+= -D_STLP_USE_UCLIBC -D_STLP_NO_WCHAR_T \ ++# -DUSE_SPRINTF_INSTEAD -D_ISOC99_SOURCE ++ ++WARNING_FLAGS:= -W -Wno-sign-compare -Wno-unused -Wno-uninitialized ++INCLUDE_FLAGS = -I${STLPORT_DIR} ++CXXFLAGS_COMMON = $(WARNING_FLAGS) $(DEFINE_FLAGS) $(INCLUDE_FLAGS) ++ ++CXXFLAGS_RELEASE_static = $(CXXFLAGS_COMMON) -Os ++CXXFLAGS_RELEASE_dynamic = $(CXXFLAGS_COMMON) -Os -fPIC ++ ++CXXFLAGS_DEBUG_static = $(CXXFLAGS_COMMON) -O -g ++CXXFLAGS_DEBUG_dynamic = $(CXXFLAGS_COMMON) -O -g -fPIC ++ ++CXXFLAGS_STLDEBUG_static = $(CXXFLAGS_DEBUG_static) -D_STLP_DEBUG ++CXXFLAGS_STLDEBUG_dynamic = $(CXXFLAGS_DEBUG_dynamic) -D_STLP_DEBUG -fPIC ++ ++include common_percent_rules.mak ++include common_rules.mak ++ ++ ++#install: all ++# cp -p $(LIB_TARGET) ${D_LIB_TARGET} ../lib ++ ++#%.s: %.cpp ++# $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ ++ ++ +diff -urN STLport-4.5.3/src/num_put_float.cpp STLport-4.5.3-devel/src/num_put_float.cpp +--- STLport-4.5.3/src/num_put_float.cpp Fri Jan 18 15:06:52 2002 ++++ STLport-4.5.3-devel/src/num_put_float.cpp Tue Jan 7 15:28:08 2003 +@@ -65,6 +65,12 @@ + + # endif + ++# if defined(_STLP_USE_UCLIBC) ++# define __USE_ISOC99 1 ++# include ++# include ++# endif ++ + # include + + #if defined (_MSC_VER) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) +@@ -209,7 +215,7 @@ + + #ifdef USE_SPRINTF_INSTEAD + +-#elif defined (__hpux) || defined (__DJGPP) || ( defined(_STLP_USE_GLIBC) && ! defined (__MSL__) ) ++#elif defined (__hpux) || defined (__DJGPP) || ( defined(_STLP_USE_GLIBC) && ! defined (__MSL__) ) || defined (_STLP_USE_UCLIBC) + # if defined (isfinite) + inline bool _Stl_is_nan_or_inf(double x) { return !isfinite(x); } + # else +@@ -238,7 +244,7 @@ + } + inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; } + inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; } +-#elif defined(__MRC__) || defined(__SC__) //*TY 02/24/2000 - added support for MPW ++#elif defined(__MRC__) || defined(__SC__) + bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); } + bool _Stl_is_inf(double x) { return !isfinite(x); } + bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); } +@@ -280,7 +286,7 @@ + inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf) + { return fcvtbuf(x, n, pt, sign, buf); } + # endif +-#elif defined (_STLP_USE_GLIBC) ++#elif defined (_STLP_USE_GLIBC) || defined(_STLP_USE_UCLIBC) + inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) + { return buf + ecvt_r(x, n, pt, sign, buf, NDIG+2); } + inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) +diff -urN STLport-4.5.3/src/stdio_streambuf.cpp STLport-4.5.3-devel/src/stdio_streambuf.cpp +--- STLport-4.5.3/src/stdio_streambuf.cpp Thu Jan 10 11:41:52 2002 ++++ STLport-4.5.3-devel/src/stdio_streambuf.cpp Tue Jan 7 15:28:08 2003 +@@ -82,7 +82,7 @@ + _STLP_VENDOR_CSTD::fgetpos(_M_file, &pos); + // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead + // of a primitive type +-#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) ++#if defined(_STLP_USE_UCLIBC) || (defined(__GLIBC__) && defined(_STLP_USE_GLIBC) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) + return pos_type((streamoff)pos.__pos); + #elif defined(__ISCPP__) || defined(__MVS__) || (__OS400__) + return pos_type(pos.__fpos_elem[ 0 ]); +@@ -101,13 +101,16 @@ + + // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead + // of a primitive type +-#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) ++#if (defined(__GLIBC__) && defined(_STLP_USE_GLIBC) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) + fpos_t p; + p.__pos = pos; + memset( &(p.__state), 0, sizeof(p.__state) ); + #elif defined(__MVS__) || (__OS400__) + fpos_t p; + p.__fpos_elem[0] = pos; ++#elif defined(_STLP_USE_UCLIBC) ++ fpos_t p; ++ p.__pos = pos; + #else + fpos_t p(pos); + #endif +diff -urN STLport-4.5.3/stlport/config/_prolog.h STLport-4.5.3-devel/stlport/config/_prolog.h +--- STLport-4.5.3/stlport/config/_prolog.h Sun Oct 28 13:26:44 2001 ++++ STLport-4.5.3-devel/stlport/config/_prolog.h Tue Jan 7 15:28:08 2003 +@@ -1,3 +1,8 @@ ++/* Evil hack to make sure everything behaves itself */ ++#define _STLP_USE_UCLIBC ++//#define _STLP_NO_WCHAR_T ++//#define _ISOC99_SOURCE ++//#define USE_SPRINTF_INSTEAD + + #if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__) + +diff -urN STLport-4.5.3/stlport/config/stl_gcc.h STLport-4.5.3-devel/stlport/config/stl_gcc.h +--- STLport-4.5.3/stlport/config/stl_gcc.h Thu Jan 10 11:41:58 2002 ++++ STLport-4.5.3-devel/stlport/config/stl_gcc.h Tue Jan 7 15:28:08 2003 +@@ -3,7 +3,7 @@ + */ + + /* Systems having GLIBC installed have different traits */ +-#if ! defined (_STLP_USE_GLIBC) && ( defined (__linux__) || defined (__CYGWIN__) ) ++#if ! defined (_STLP_USE_GLIBC) && ! defined (_STLP_USE_UCLIBC) && ( defined (__linux__) || defined (__CYGWIN__) ) + # define _STLP_USE_GLIBC + #endif + +diff -urN STLport-4.5.3/stlport/cstdlib STLport-4.5.3-devel/stlport/cstdlib +--- STLport-4.5.3/stlport/cstdlib Thu Aug 23 15:51:54 2001 ++++ STLport-4.5.3-devel/stlport/cstdlib Tue Jan 7 15:28:08 2003 +@@ -55,9 +55,11 @@ + using _STLP_VENDOR_CSTD::atof; + using _STLP_VENDOR_CSTD::atoi; + using _STLP_VENDOR_CSTD::atol; ++# ifndef _STLP_USE_UCLIBC + using _STLP_VENDOR_CSTD::mblen; + using _STLP_VENDOR_CSTD::mbstowcs; + using _STLP_VENDOR_CSTD::mbtowc; ++# endif + using _STLP_VENDOR_CSTD::strtod; + using _STLP_VENDOR_CSTD::strtol; + using _STLP_VENDOR_CSTD::strtoul; +diff -urN STLport-4.5.3/stlport/stl/_config.h STLport-4.5.3-devel/stlport/stl/_config.h +--- STLport-4.5.3/stlport/stl/_config.h Fri Jan 18 15:08:36 2002 ++++ STLport-4.5.3-devel/stlport/stl/_config.h Tue Jan 7 15:28:08 2003 +@@ -26,6 +26,16 @@ + #ifndef _STLP_CONFIG_H + # define _STLP_CONFIG_H + ++/* Make the STLport headers provide uClibc support by default */ ++#define _STLP_NO_EXCEPTIONS 1 ++#define STL_NO_EXCEPTIONS 1 ++#define _STLP_USE_UCLIBC 1 ++//#define _STLP_NO_WCHAR_T 1 ++#define _STLP_NO_LONG_DOUBLE 1 ++#define USE_SPRINTF_INSTEAD 1 ++#define _ISOC99_SOURCE 1 ++#define _STLP_NO_ANACHRONISMS 1 ++ + /* + * Purpose of this file : + * +@@ -164,7 +174,7 @@ + /* Operating system recognition (basic) */ + # if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined (__Lynx__) + # define _STLP_UNIX 1 +-# if defined (__linux__) && ! defined (_STLP_USE_GLIBC) ++# if defined (__linux__) && ! defined (_STLP_USE_GLIBC) && ! defined (_STLP_USE_UCLIBC) + # define _STLP_USE_GLIBC 1 + # endif + # elif defined(macintosh) || defined (_MAC) +diff -urN STLport-4.5.3/stlport/stl/_stdio_file.h STLport-4.5.3-devel/stlport/stl/_stdio_file.h +--- STLport-4.5.3/stlport/stl/_stdio_file.h Fri Jan 18 15:07:00 2002 ++++ STLport-4.5.3-devel/stlport/stl/_stdio_file.h Tue Jan 7 15:28:08 2003 +@@ -634,6 +634,112 @@ + } + # define _STLP_FILE_I_O_IDENTICAL + ++#elif defined(_STLP_USE_UCLIBC) ++ ++#if defined(__MASK_READING) ++ ++inline int _FILE_fd(const FILE *__f) { return __f->__filedes; } ++ ++// Returns a pointer to the beginning of the buffer. ++inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->__bufstart; } ++ ++// Returns the current read/write position within the buffer. ++inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->__bufpos; } ++ ++// Returns a pointer immediately past the end of the buffer. ++inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->__bufend; } ++ ++// Returns the number of characters remaining in the buffer, i.e. ++// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f). ++inline ptrdiff_t _FILE_I_avail(const FILE *__f) ++ { return __f->__bufgetc_u - __f->__bufpos; } ++ ++// Increments the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_preincr(FILE *__f) { return *(char*)(++__f->__bufpos); } ++ ++// Increments the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_postincr(FILE *__f) { return *(char*)(__f->__bufpos++); } ++ ++// Decrements the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_predecr(FILE *__f) { return *(char*)(--__f->__bufpos); } ++ ++// Decrements the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_postdecr(FILE *__f) { return *(char*)(__f->__bufpos--); } ++ ++// Increments the current read/write position by __n. ++inline void _FILE_I_bump(FILE *__f, int __n) { __f->__bufpos += __n; } ++ ++// Sets the beginning of the bufer to __begin, the current read/write ++// position to __next, and the buffer's past-the-end pointer to __end. ++// If any of those pointers is null, then all of them must be null. ++inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) ++{ ++ __f->__bufstart = (unsigned char*)__begin; ++ __f->__bufpos = (unsigned char*)__next; ++ __f->__bufend = (unsigned char*)__end; ++ __f->__bufgetc_u = (unsigned char*)__begin; ++ __f->__bufputc_u = (unsigned char*)__end; ++} ++ ++# define _STLP_FILE_I_O_IDENTICAL ++ ++#else // Support old stdio for a little while. ++ ++inline int _FILE_fd(const FILE *__f) { return __f->filedes; } ++ ++// Returns a pointer to the beginning of the buffer. ++inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->bufstart; } ++ ++// Returns the current read/write position within the buffer. ++inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->bufpos; } ++ ++// Returns a pointer immediately past the end of the buffer. ++inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->bufend; } ++ ++// Returns the number of characters remaining in the buffer, i.e. ++// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f). ++inline ptrdiff_t _FILE_I_avail(const FILE *__f) ++ { return __f->bufgetc - __f->bufpos; } ++ ++// Increments the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_preincr(FILE *__f) { return *(char*)(++__f->bufpos); } ++ ++// Increments the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_postincr(FILE *__f) { return *(char*)(__f->bufpos++); } ++ ++// Decrements the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_predecr(FILE *__f) { return *(char*)(--__f->bufpos); } ++ ++// Decrements the current read/write position by 1, returning the ++// character at the old position. ++inline char& _FILE_I_postdecr(FILE *__f) { return *(char*)(__f->bufpos--); } ++ ++// Increments the current read/write position by __n. ++inline void _FILE_I_bump(FILE *__f, int __n) { __f->bufpos += __n; } ++ ++// Sets the beginning of the bufer to __begin, the current read/write ++// position to __next, and the buffer's past-the-end pointer to __end. ++// If any of those pointers is null, then all of them must be null. ++inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) ++{ ++ __f->bufstart = (unsigned char*)__begin; ++ __f->bufpos = (unsigned char*)__next; ++ __f->bufend = (unsigned char*)__end; ++ __f->bufgetc = (unsigned char*)__begin; ++ __f->bufputc = (unsigned char*)__end; ++} ++ ++# define _STLP_FILE_I_O_IDENTICAL ++ ++#endif ++ + #else /* A C library that we don't have an implementation for. */ + + # error The C++ I/O library is not configured for this compiler +diff -urN STLport-4.5.3/stlport/stl/c_locale.h STLport-4.5.3-devel/stlport/stl/c_locale.h +--- STLport-4.5.3/stlport/stl/c_locale.h Fri Jan 18 15:07:00 2002 ++++ STLport-4.5.3-devel/stlport/stl/c_locale.h Wed Jan 8 10:58:10 2003 +@@ -401,6 +401,21 @@ + # define _Locale_SPACE _S + # define _Locale_PRINT (_P | _U | _L | _N | _B) + # define _Locale_ALPHA (_U | _L) ++ ++# elif defined(_STLP_USE_UCLIBC) /* linux, using the gnu compiler */ ++ ++# define _Locale_CNTRL _IScntrl ++# define _Locale_UPPER _ISupper ++# define _Locale_LOWER _ISlower ++# define _Locale_DIGIT _ISdigit ++# define _Locale_XDIGIT _ISxdigit ++# define _Locale_PUNCT _ISpunct ++# define _Locale_SPACE _ISspace ++# define _Locale_PRINT _ISprint ++# define _Locale_ALPHA _ISalpha ++ ++#else ++# error Unknown Locale + #endif + + # endif /* _STLP_C_LOCALE_H */ diff --git a/obsolete-buildroot/sources/binutils-uclibc-001-debian.patch b/obsolete-buildroot/sources/binutils-uclibc-001-debian.patch new file mode 100644 index 0000000000..1dd39a933d --- /dev/null +++ b/obsolete-buildroot/sources/binutils-uclibc-001-debian.patch @@ -0,0 +1,2394 @@ +diff -urN binutils-2.14.90.0.7.orig/bfd/ChangeLog binutils-2.14.90.0.7/bfd/ChangeLog +--- binutils-2.14.90.0.7.orig/bfd/ChangeLog 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/ChangeLog 2004-04-20 01:26:12.000000000 -0600 +@@ -1,3 +1,34 @@ ++2003-10-29 Daniel Jacobowitz ++ ++ * elf32-arm.h (elf32_arm_final_link_relocate): Move check for ++ SEC_ALLOC. ++ ++2003-10-29 Philip Blundell ++ ++ * elf32-arm.h (elf32_arm_plt0_entry, elf32_arm_plt_entry): New ++ code sequence. ++ (PLT_HEADER_SIZE): New. ++ (struct elf32_arm_pcrel_relocs_copied): Rename to ... ++ (struct elf32_arm_relocs_copied): ... this. Count both ++ pcrel and non-pcrel relocs. All uses updated. ++ (struct elf32_arm_link_hash_table): Add pointers to dynamic linker ++ sections and symbol/section mapping cache. ++ (create_got_section): New. ++ (elf32_arm_create_dynamic_sections): New. ++ (elf_backend_create_dynamic_sections): Use it. ++ (elf32_arm_final_link_relocate): Support garbage collection of relocs. ++ (elf32_arm_check_relocs): Likewise. ++ (elf32_arm_adjust_dynamic_symbol): Likewise. ++ (elf32_arm_copy_indirect_symbol): New. ++ (elf32_arm_link_hash_table_create): Initialise new fields. ++ (elf32_arm_gc_sweep_hook): Implement. ++ (elf32_arm_discard_copies): Delete. ++ (elf32_arm_finish_dynamic_symbol): Use new PLT code. ++ (elf32_arm_finish_dynamic_sections): Likewise. ++ (elf_backend_can_refcount): Define. ++ (elf_backend_copy_indirect_symbol): Likewise. ++ (elf_backend_plt_header_size): Set to PLT_HEADER_SIZE. ++ + 2003-10-29 Alan Modra + + * elf64-ppc.c (elf_backend_grok_prstatus): Define. +diff -urN binutils-2.14.90.0.7.orig/bfd/elf-bfd.h binutils-2.14.90.0.7/bfd/elf-bfd.h +--- binutils-2.14.90.0.7.orig/bfd/elf-bfd.h 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf-bfd.h 2004-04-20 01:26:12.000000000 -0600 +@@ -1303,7 +1303,7 @@ + extern enum elf_reloc_type_class _bfd_elf_reloc_type_class + (const Elf_Internal_Rela *); + extern bfd_vma _bfd_elf_rela_local_sym +- (bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *); ++ (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *); + extern bfd_vma _bfd_elf_rel_local_sym + (bfd *, Elf_Internal_Sym *, asection **, bfd_vma); + extern bfd_vma _bfd_elf_section_offset +diff -urN binutils-2.14.90.0.7.orig/bfd/elf-hppa.h binutils-2.14.90.0.7/bfd/elf-hppa.h +--- binutils-2.14.90.0.7.orig/bfd/elf-hppa.h 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf-hppa.h 2004-04-20 01:26:12.000000000 -0600 +@@ -1346,11 +1346,11 @@ + /* This is a local symbol. */ + sym = local_syms + r_symndx; + sym_sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); + + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ +- dyn_name = get_dyn_name (input_section, h, rel, ++ dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); +@@ -1373,7 +1373,7 @@ + + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ +- dyn_name = get_dyn_name (input_section, h, rel, ++ dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); +@@ -1410,7 +1410,7 @@ + + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ +- dyn_name = get_dyn_name (input_section, h, rel, ++ dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); +@@ -1426,7 +1426,7 @@ + } + else if (h->root.type == bfd_link_hash_undefweak) + { +- dyn_name = get_dyn_name (input_section, h, rel, ++ dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf-m10200.c binutils-2.14.90.0.7/bfd/elf-m10200.c +--- binutils-2.14.90.0.7.orig/bfd/elf-m10200.c 2003-07-23 09:08:08.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf-m10200.c 2004-04-20 01:26:12.000000000 -0600 +@@ -373,7 +373,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf-m10300.c binutils-2.14.90.0.7/bfd/elf-m10300.c +--- binutils-2.14.90.0.7.orig/bfd/elf-m10300.c 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf-m10300.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1574,7 +1574,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf.c binutils-2.14.90.0.7/bfd/elf.c +--- binutils-2.14.90.0.7.orig/bfd/elf.c 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf.c 2004-04-20 01:26:12.000000000 -0600 +@@ -7367,9 +7367,10 @@ + bfd_vma + _bfd_elf_rela_local_sym (bfd *abfd, + Elf_Internal_Sym *sym, +- asection *sec, ++ asection **psec, + Elf_Internal_Rela *rel) + { ++ asection *sec = *psec; + bfd_vma relocation; + + relocation = (sec->output_section->vma +@@ -7379,16 +7380,14 @@ + && ELF_ST_TYPE (sym->st_info) == STT_SECTION + && sec->sec_info_type == ELF_INFO_TYPE_MERGE) + { +- asection *msec; +- +- msec = sec; + rel->r_addend = +- _bfd_merged_section_offset (abfd, &msec, ++ _bfd_merged_section_offset (abfd, psec, + elf_section_data (sec)->sec_info, + sym->st_value + rel->r_addend, +- 0) +- - relocation; +- rel->r_addend += msec->output_section->vma + msec->output_offset; ++ 0); ++ sec = *psec; ++ rel->r_addend -= relocation; ++ rel->r_addend += sec->output_section->vma + sec->output_offset; + } + return relocation; + } +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-arm.h binutils-2.14.90.0.7/bfd/elf32-arm.h +--- binutils-2.14.90.0.7.orig/bfd/elf32-arm.h 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-arm.h 2004-04-20 01:26:12.000000000 -0600 +@@ -84,6 +84,12 @@ + static void arm_add_to_rel + PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma)); + #endif ++static bfd_boolean allocate_dynrelocs ++ PARAMS ((struct elf_link_hash_entry *h, PTR inf)); ++static bfd_boolean create_got_section ++ PARAMS ((bfd * dynobj, struct bfd_link_info * info)); ++static bfd_boolean elf32_arm_create_dynamic_sections ++ PARAMS ((bfd * dynobj, struct bfd_link_info * info)); + static enum elf_reloc_type_class elf32_arm_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); + static bfd_boolean elf32_arm_object_p +@@ -119,6 +125,12 @@ + section. */ + #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" + ++#ifdef FOUR_WORD_PLT ++ ++/* The size in bytes of the special first entry in the procedure ++ linkage table. */ ++#define PLT_HEADER_SIZE 16 ++ + /* The size in bytes of an entry in the procedure linkage table. */ + #define PLT_ENTRY_SIZE 16 + +@@ -126,23 +138,56 @@ + this. It is set up so that any shared library function that is + called before the relocation has been set up calls the dynamic + linker first. */ +-static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] = ++static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = + { +- 0xe52de004, /* str lr, [sp, #-4]! */ +- 0xe59fe010, /* ldr lr, [pc, #16] */ +- 0xe08fe00e, /* add lr, pc, lr */ +- 0xe5bef008 /* ldr pc, [lr, #8]! */ ++ 0xe52de004, /* str lr, [sp, #-4]! */ ++ 0xe59fe010, /* ldr lr, [pc, #16] */ ++ 0xe08fe00e, /* add lr, pc, lr */ ++ 0xe5bef008, /* ldr pc, [lr, #8]! */ + }; + + /* Subsequent entries in a procedure linkage table look like + this. */ + static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = +- { +- 0xe59fc004, /* ldr ip, [pc, #4] */ +- 0xe08fc00c, /* add ip, pc, ip */ +- 0xe59cf000, /* ldr pc, [ip] */ +- 0x00000000 /* offset to symbol in got */ +- }; ++ { ++ 0xe28fc600, /* add ip, pc, #NN */ ++ 0xe28cca00, /* add ip, ip, #NN */ ++ 0xe5bcf000, /* ldr pc, [ip, #NN]! */ ++ 0x00000000, /* unused */ ++ }; ++ ++#else ++ ++/* The size in bytes of the special first entry in the procedure ++ linkage table. */ ++#define PLT_HEADER_SIZE 20 ++ ++/* The size in bytes of an entry in the procedure linkage table. */ ++#define PLT_ENTRY_SIZE 12 ++ ++/* The first entry in a procedure linkage table looks like ++ this. It is set up so that any shared library function that is ++ called before the relocation has been set up calls the dynamic ++ linker first. */ ++static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = ++ { ++ 0xe52de004, /* str lr, [sp, #-4]! */ ++ 0xe59fe004, /* ldr lr, [pc, #4] */ ++ 0xe08fe00e, /* add lr, pc, lr */ ++ 0xe5bef008, /* ldr pc, [lr, #8]! */ ++ 0x00000000, /* &GOT[0] - . */ ++ }; ++ ++/* Subsequent entries in a procedure linkage table look like ++ this. */ ++static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = ++ { ++ 0xe28fc600, /* add ip, pc, #0xNN00000 */ ++ 0xe28cca00, /* add ip, ip, #0xNN000 */ ++ 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */ ++ }; ++ ++#endif + + /* The ARM linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that +@@ -152,14 +197,16 @@ + + /* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ +-struct elf32_arm_pcrel_relocs_copied ++struct elf32_arm_relocs_copied + { + /* Next section. */ +- struct elf32_arm_pcrel_relocs_copied * next; ++ struct elf32_arm_relocs_copied * next; + /* A section in dynobj. */ + asection * section; + /* Number of relocs copied in this section. */ + bfd_size_type count; ++ /* Number of relocs copied in this section. */ ++ bfd_size_type pc_count; + }; + + /* Arm ELF linker hash entry. */ +@@ -168,13 +215,9 @@ + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ +- struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied; ++ struct elf32_arm_relocs_copied * relocs_copied; + }; + +-/* Declare this now that the above structures are defined. */ +-static bfd_boolean elf32_arm_discard_copies +- PARAMS ((struct elf32_arm_link_hash_entry *, PTR)); +- + /* Traverse an arm ELF linker hash table. */ + #define elf32_arm_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ +@@ -204,6 +247,18 @@ + /* A boolean indicating whether knowledge of the ARM's pipeline + length should be applied by the linker. */ + int no_pipeline_knowledge; ++ ++ /* Short-cuts to get to dynamic linker sections. */ ++ asection *sgot; ++ asection *sgotplt; ++ asection *srelgot; ++ asection *splt; ++ asection *srelplt; ++ asection *sdynbss; ++ asection *srelbss; ++ ++ /* Small local sym to section mapping cache. */ ++ struct sym_sec_cache sym_sec; + }; + + /* Create an entry in an ARM ELF linker hash table. */ +@@ -231,11 +286,121 @@ + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf32_arm_link_hash_entry *) NULL) +- ret->pcrel_relocs_copied = NULL; ++ ret->relocs_copied = NULL; + + return (struct bfd_hash_entry *) ret; + } + ++/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up ++ shortcuts to them in our hash table. */ ++ ++static bfd_boolean ++create_got_section (dynobj, info) ++ bfd *dynobj; ++ struct bfd_link_info *info; ++{ ++ struct elf32_arm_link_hash_table *htab; ++ ++ if (! _bfd_elf_create_got_section (dynobj, info)) ++ return FALSE; ++ ++ htab = elf32_arm_hash_table (info); ++ htab->sgot = bfd_get_section_by_name (dynobj, ".got"); ++ htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); ++ if (!htab->sgot || !htab->sgotplt) ++ abort (); ++ ++ htab->srelgot = bfd_make_section (dynobj, ".rel.got"); ++ if (htab->srelgot == NULL ++ || ! bfd_set_section_flags (dynobj, htab->srelgot, ++ (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS ++ | SEC_IN_MEMORY | SEC_LINKER_CREATED ++ | SEC_READONLY)) ++ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) ++ return FALSE; ++ return TRUE; ++} ++ ++/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and ++ .rel.bss sections in DYNOBJ, and set up shortcuts to them in our ++ hash table. */ ++ ++static bfd_boolean ++elf32_arm_create_dynamic_sections (dynobj, info) ++ bfd *dynobj; ++ struct bfd_link_info *info; ++{ ++ struct elf32_arm_link_hash_table *htab; ++ ++ htab = elf32_arm_hash_table (info); ++ if (!htab->sgot && !create_got_section (dynobj, info)) ++ return FALSE; ++ ++ if (!_bfd_elf_create_dynamic_sections (dynobj, info)) ++ return FALSE; ++ ++ htab->splt = bfd_get_section_by_name (dynobj, ".plt"); ++ htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt"); ++ htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); ++ if (!info->shared) ++ htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss"); ++ ++ if (!htab->splt || !htab->srelplt || !htab->sdynbss ++ || (!info->shared && !htab->srelbss)) ++ abort (); ++ ++ return TRUE; ++} ++ ++/* Copy the extra info we tack onto an elf_link_hash_entry. */ ++ ++static void ++elf32_arm_copy_indirect_symbol (const struct elf_backend_data *bed, ++ struct elf_link_hash_entry *dir, ++ struct elf_link_hash_entry *ind) ++{ ++ struct elf32_arm_link_hash_entry *edir, *eind; ++ ++ edir = (struct elf32_arm_link_hash_entry *) dir; ++ eind = (struct elf32_arm_link_hash_entry *) ind; ++ ++ if (eind->relocs_copied != NULL) ++ { ++ if (edir->relocs_copied != NULL) ++ { ++ struct elf32_arm_relocs_copied **pp; ++ struct elf32_arm_relocs_copied *p; ++ ++ if (ind->root.type == bfd_link_hash_indirect) ++ abort (); ++ ++ /* Add reloc counts against the weak sym to the strong sym ++ list. Merge any entries against the same section. */ ++ for (pp = &eind->relocs_copied; (p = *pp) != NULL; ) ++ { ++ struct elf32_arm_relocs_copied *q; ++ ++ for (q = edir->relocs_copied; q != NULL; q = q->next) ++ if (q->section == p->section) ++ { ++ q->pc_count += p->pc_count; ++ q->count += p->count; ++ *pp = p->next; ++ break; ++ } ++ if (q == NULL) ++ pp = &p->next; ++ } ++ *pp = edir->relocs_copied; ++ } ++ ++ edir->relocs_copied = eind->relocs_copied; ++ eind->relocs_copied = NULL; ++ } ++ ++ _bfd_elf_link_hash_copy_indirect (bed, dir, ind); ++} ++ + /* Create an ARM elf linker hash table. */ + + static struct bfd_link_hash_table * +@@ -256,10 +421,18 @@ + return NULL; + } + ++ ret->sgot = NULL; ++ ret->sgotplt = NULL; ++ ret->srelgot = NULL; ++ ret->splt = NULL; ++ ret->srelplt = NULL; ++ ret->sdynbss = NULL; ++ ret->srelbss = NULL; + ret->thumb_glue_size = 0; + ret->arm_glue_size = 0; + ret->bfd_of_glue_owner = NULL; + ret->no_pipeline_knowledge = 0; ++ ret->sym_sec.abfd = NULL; + + return &ret->root.root; + } +@@ -1134,16 +1307,21 @@ + #ifndef OLD_ARM_ABI + case R_ARM_XPC25: + #endif ++ /* r_symndx will be zero only for relocs against symbols ++ from removed linkonce sections, or sections discarded by ++ a linker script. */ ++ if (r_symndx == 0) ++ return bfd_reloc_ok; ++ + /* When generating a shared object, these relocations are copied + into the output file to be resolved at run time. */ +- if (info->shared +- && r_symndx != 0 +- && (r_type != R_ARM_PC24 +- || (h != NULL +- && h->dynindx != -1 +- && (! info->symbolic +- || (h->elf_link_hash_flags +- & ELF_LINK_HASH_DEF_REGULAR) == 0)))) ++ if ((info->shared ++ && (input_section->flags & SEC_ALLOC) ++ && (h == NULL ++ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || h->root.type != bfd_link_hash_undefweak) ++ && (r_type != R_ARM_PC24 ++ || !SYMBOL_CALLS_LOCAL (info, h)))) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; +@@ -1184,30 +1362,19 @@ + + if (skip) + memset (&outrel, 0, sizeof outrel); +- else if (r_type == R_ARM_PC24) +- { +- BFD_ASSERT (h != NULL && h->dynindx != -1); +- if ((input_section->flags & SEC_ALLOC) == 0) +- relocate = TRUE; +- outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24); +- } ++ else if (h != NULL ++ && h->dynindx != -1 ++ && (r_type == R_ARM_PC24 ++ || !info->shared ++ || !info->symbolic ++ || (h->elf_link_hash_flags ++ & ELF_LINK_HASH_DEF_REGULAR) == 0)) ++ outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + else + { +- if (h == NULL +- || ((info->symbolic || h->dynindx == -1) +- && (h->elf_link_hash_flags +- & ELF_LINK_HASH_DEF_REGULAR) != 0)) +- { +- relocate = TRUE; +- outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); +- } +- else +- { +- BFD_ASSERT (h->dynindx != -1); +- if ((input_section->flags & SEC_ALLOC) == 0) +- relocate = TRUE; +- outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32); +- } ++ /* This symbol is local, or marked to become local. */ ++ relocate = TRUE; ++ outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); + } + + loc = sreloc->contents; +@@ -1617,16 +1784,17 @@ + if (h != NULL) + { + bfd_vma off; +- bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created; ++ bfd_boolean dyn; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); ++ dyn = globals->root.dynamic_sections_created; + +- if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) ++ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + || (info->shared +- && (info->symbolic || h->dynindx == -1 +- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) +- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) ++ && SYMBOL_REFERENCES_LOCAL (info, h)) ++ || (ELF_ST_VISIBILITY (h->other) ++ && h->root.type == bfd_link_hash_undefweak)) + { + /* This is actually a static link, or it is a -Bsymbolic link + and the symbol is defined locally. We must initialize this +@@ -1712,7 +1880,8 @@ + contents, rel->r_offset, value, + (bfd_vma) 0); + +- if (h->plt.offset == (bfd_vma) -1) ++ if (h->plt.offset == (bfd_vma) -1 ++ || globals->splt == NULL) + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ +@@ -1958,7 +2127,7 @@ + bfd_put_32 (input_bfd, value, contents + rel->r_offset); + } + #else +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + #endif + } + else +@@ -1983,9 +2152,10 @@ + case R_ARM_THM_PC22: + if (info->shared + && ( +- (!info->symbolic && h->dynindx != -1) ++ (!info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + ) ++ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_ARM_ABS32 relocations in its + sections against symbols defined externally +@@ -2603,7 +2773,82 @@ + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; + { +- /* We don't support garbage collection of GOT and PLT relocs yet. */ ++ Elf_Internal_Shdr *symtab_hdr; ++ struct elf_link_hash_entry **sym_hashes; ++ bfd_signed_vma *local_got_refcounts; ++ const Elf_Internal_Rela *rel, *relend; ++ unsigned long r_symndx; ++ struct elf_link_hash_entry *h; ++ ++ elf_section_data (sec)->local_dynrel = NULL; ++ ++ symtab_hdr = &elf_tdata (abfd)->symtab_hdr; ++ sym_hashes = elf_sym_hashes (abfd); ++ local_got_refcounts = elf_local_got_refcounts (abfd); ++ ++ relend = relocs + sec->reloc_count; ++ for (rel = relocs; rel < relend; rel++) ++ switch (ELF32_R_TYPE (rel->r_info)) ++ { ++ case R_ARM_GOT32: ++ r_symndx = ELF32_R_SYM (rel->r_info); ++ if (r_symndx >= symtab_hdr->sh_info) ++ { ++ h = sym_hashes[r_symndx - symtab_hdr->sh_info]; ++ if (h->got.refcount > 0) ++ h->got.refcount -= 1; ++ } ++ else if (local_got_refcounts != NULL) ++ { ++ if (local_got_refcounts[r_symndx] > 0) ++ local_got_refcounts[r_symndx] -= 1; ++ } ++ break; ++ ++ case R_ARM_ABS32: ++ case R_ARM_REL32: ++ case R_ARM_PC24: ++ r_symndx = ELF32_R_SYM (rel->r_info); ++ if (r_symndx >= symtab_hdr->sh_info) ++ { ++ struct elf32_arm_link_hash_entry *eh; ++ struct elf32_arm_relocs_copied **pp; ++ struct elf32_arm_relocs_copied *p; ++ ++ h = sym_hashes[r_symndx - symtab_hdr->sh_info]; ++ ++ if (!info->shared && h->plt.refcount > 0) ++ h->plt.refcount -= 1; ++ ++ eh = (struct elf32_arm_link_hash_entry *) h; ++ ++ for (pp = &eh->relocs_copied; (p = *pp) != NULL; pp = &p->next) ++ if (p->section == sec) ++ { ++ if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24) ++ p->pc_count -= 1; ++ p->count -= 1; ++ if (p->count == 0) ++ *pp = p->next; ++ break; ++ } ++ } ++ break; ++ ++ case R_ARM_PLT32: ++ r_symndx = ELF32_R_SYM (rel->r_info); ++ if (r_symndx >= symtab_hdr->sh_info) ++ { ++ h = sym_hashes[r_symndx - symtab_hdr->sh_info]; ++ if (h->plt.refcount > 0) ++ h->plt.refcount -= 1; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ + return TRUE; + } + +@@ -2622,13 +2867,15 @@ + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd *dynobj; +- asection *sgot, *srelgot, *sreloc; ++ asection *sreloc; + bfd_vma *local_got_offsets; ++ struct elf32_arm_link_hash_table *htab; + + if (info->relocatable) + return TRUE; + +- sgot = srelgot = sreloc = NULL; ++ htab = elf32_arm_hash_table (info); ++ sreloc = NULL; + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (abfd); +@@ -2653,126 +2900,82 @@ + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + +- /* Some relocs require a global offset table. */ +- if (dynobj == NULL) +- { +- switch (ELF32_R_TYPE (rel->r_info)) +- { +- case R_ARM_GOT32: +- case R_ARM_GOTOFF: +- case R_ARM_GOTPC: +- elf_hash_table (info)->dynobj = dynobj = abfd; +- if (! _bfd_elf_create_got_section (dynobj, info)) +- return FALSE; +- break; +- +- default: +- break; +- } +- } +- + switch (ELF32_R_TYPE (rel->r_info)) + { +- case R_ARM_GOT32: +- /* This symbol requires a global offset table entry. */ +- if (sgot == NULL) +- { +- sgot = bfd_get_section_by_name (dynobj, ".got"); +- BFD_ASSERT (sgot != NULL); +- } ++ case R_ARM_PLT32: ++ /* This symbol requires a procedure linkage table entry. We ++ actually build the entry in adjust_dynamic_symbol, ++ because this might be a case of linking PIC code which is ++ never referenced by a dynamic object, in which case we ++ don't need to generate a procedure linkage table entry ++ after all. */ + +- /* Get the got relocation section if necessary. */ +- if (srelgot == NULL +- && (h != NULL || info->shared)) +- { +- srelgot = bfd_get_section_by_name (dynobj, ".rel.got"); ++ /* If this is a local symbol, we resolve it directly without ++ creating a procedure linkage table entry. */ ++ if (h == NULL) ++ continue; + +- /* If no got relocation section, make one and initialize. */ +- if (srelgot == NULL) +- { +- srelgot = bfd_make_section (dynobj, ".rel.got"); +- if (srelgot == NULL +- || ! bfd_set_section_flags (dynobj, srelgot, +- (SEC_ALLOC +- | SEC_LOAD +- | SEC_HAS_CONTENTS +- | SEC_IN_MEMORY +- | SEC_LINKER_CREATED +- | SEC_READONLY)) +- || ! bfd_set_section_alignment (dynobj, srelgot, 2)) +- return FALSE; +- } +- } ++ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; ++ h->plt.refcount++; ++ break; + ++ case R_ARM_GOT32: ++ /* This symbol requires a global offset table entry. */ + if (h != NULL) + { +- if (h->got.offset != (bfd_vma) -1) +- /* We have already allocated space in the .got. */ +- break; +- +- h->got.offset = sgot->_raw_size; +- +- /* Make sure this symbol is output as a dynamic symbol. */ +- if (h->dynindx == -1) +- if (! bfd_elf32_link_record_dynamic_symbol (info, h)) +- return FALSE; +- +- srelgot->_raw_size += sizeof (Elf32_External_Rel); ++ h->got.refcount++; + } + else + { +- /* This is a global offset table entry for a local +- symbol. */ +- if (local_got_offsets == NULL) ++ bfd_signed_vma *local_got_refcounts; ++ ++ /* This is a global offset table entry for a local symbol. */ ++ local_got_refcounts = elf_local_got_refcounts (abfd); ++ if (local_got_refcounts == NULL) + { + bfd_size_type size; +- unsigned int i; + + size = symtab_hdr->sh_info; +- size *= sizeof (bfd_vma); +- local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); +- if (local_got_offsets == NULL) ++ size *= (sizeof (bfd_signed_vma) + sizeof(char)); ++ local_got_refcounts = ((bfd_signed_vma *) ++ bfd_zalloc (abfd, size)); ++ if (local_got_refcounts == NULL) + return FALSE; +- elf_local_got_offsets (abfd) = local_got_offsets; +- for (i = 0; i < symtab_hdr->sh_info; i++) +- local_got_offsets[i] = (bfd_vma) -1; ++ elf_local_got_refcounts (abfd) = local_got_refcounts; + } +- +- if (local_got_offsets[r_symndx] != (bfd_vma) -1) +- /* We have already allocated space in the .got. */ +- break; +- +- local_got_offsets[r_symndx] = sgot->_raw_size; +- +- if (info->shared) +- /* If we are generating a shared object, we need to +- output a R_ARM_RELATIVE reloc so that the dynamic +- linker can adjust this GOT entry. */ +- srelgot->_raw_size += sizeof (Elf32_External_Rel); ++ local_got_refcounts[r_symndx] += 1; + } +- +- sgot->_raw_size += 4; + break; + +- case R_ARM_PLT32: +- /* This symbol requires a procedure linkage table entry. We +- actually build the entry in adjust_dynamic_symbol, +- because this might be a case of linking PIC code which is +- never referenced by a dynamic object, in which case we +- don't need to generate a procedure linkage table entry +- after all. */ +- +- /* If this is a local symbol, we resolve it directly without +- creating a procedure linkage table entry. */ +- if (h == NULL) +- continue; +- +- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; ++ case R_ARM_GOTOFF: ++ case R_ARM_GOTPC: ++ if (htab->sgot == NULL) ++ { ++ if (htab->root.dynobj == NULL) ++ htab->root.dynobj = abfd; ++ if (!create_got_section (htab->root.dynobj, info)) ++ return FALSE; ++ } + break; + + case R_ARM_ABS32: + case R_ARM_REL32: + case R_ARM_PC24: ++ if (h != NULL && !info->shared) ++ { ++ /* If this reloc is in a read-only section, we might ++ need a copy reloc. We can't check reliably at this ++ stage whether the section is read-only, as input ++ sections have not yet been mapped to output sections. ++ Tentatively set the flag for now, and correct in ++ adjust_dynamic_symbol. */ ++ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; ++ ++ /* We may need a .plt entry if the function this reloc ++ refers to is in a shared lib. */ ++ h->plt.refcount += 1; ++ } ++ + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc +@@ -2784,14 +2987,17 @@ + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the +- pcrel_relocs_copied field of the hash table entry. */ ++ relocs_copied field of the hash table entry. */ + if (info->shared +- && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24 +- || (h != NULL +- && (! info->symbolic +- || (h->elf_link_hash_flags +- & ELF_LINK_HASH_DEF_REGULAR) == 0)))) ++ && (sec->flags & SEC_ALLOC) != 0 ++ && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24 ++ || (h != NULL ++ && (! info->symbolic ++ || (h->elf_link_hash_flags ++ & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { ++ struct elf32_arm_relocs_copied *p, **head; ++ + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ +@@ -2825,45 +3031,49 @@ + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } +- if (sec->flags & SEC_READONLY) +- info->flags |= DF_TEXTREL; ++ ++ elf_section_data (sec)->sreloc = sreloc; + } + +- sreloc->_raw_size += sizeof (Elf32_External_Rel); +- /* If we are linking with -Bsymbolic, and this is a +- global symbol, we count the number of PC relative +- relocations we have entered for this symbol, so that +- we can discard them again if the symbol is later +- defined by a regular object. Note that this function +- is only called if we are using an elf_i386 linker +- hash table, which means that h is really a pointer to +- an elf_i386_link_hash_entry. */ +- if (h != NULL && info->symbolic +- && ELF32_R_TYPE (rel->r_info) == R_ARM_PC24) ++ /* If this is a global symbol, we count the number of ++ relocations we need for this symbol. */ ++ if (h != NULL) + { +- struct elf32_arm_link_hash_entry * eh; +- struct elf32_arm_pcrel_relocs_copied * p; +- +- eh = (struct elf32_arm_link_hash_entry *) h; +- +- for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) +- if (p->section == sreloc) +- break; +- ++ head = &((struct elf32_arm_link_hash_entry *) h)->relocs_copied; ++ } ++ else ++ { ++ /* Track dynamic relocs needed for local syms too. ++ We really need local syms available to do this ++ easily. Oh well. */ ++ ++ asection *s; ++ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, ++ sec, r_symndx); ++ if (s == NULL) ++ return FALSE; ++ ++ head = ((struct elf32_arm_relocs_copied **) ++ &elf_section_data (s)->local_dynrel); ++ } ++ ++ p = *head; ++ if (p == NULL || p->section != sec) ++ { ++ bfd_size_type amt = sizeof *p; ++ p = bfd_alloc (htab->root.dynobj, amt); + if (p == NULL) +- { +- p = ((struct elf32_arm_pcrel_relocs_copied *) +- bfd_alloc (dynobj, (bfd_size_type) sizeof * p)); +- if (p == NULL) +- return FALSE; +- p->next = eh->pcrel_relocs_copied; +- eh->pcrel_relocs_copied = p; +- p->section = sreloc; +- p->count = 0; +- } +- +- ++p->count; ++ return FALSE; ++ p->next = *head; ++ *head = p; ++ p->section = sec; ++ p->count = 0; ++ p->pc_count = 0; + } ++ ++ p->count += 1; ++ if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24) ++ p->pc_count += 1; + } + break; + +@@ -3003,71 +3213,29 @@ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { +- /* If we link a program (not a DSO), we'll get rid of unnecessary +- PLT entries; we point to the actual symbols -- even for pic +- relocs, because a program built with -fpic should have the same +- result as one built without -fpic, specifically considering weak +- symbols. +- FIXME: m68k and i386 differ here, for unclear reasons. */ +- if (! info->shared +- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0) ++ if (h->plt.refcount <= 0 ++ || SYMBOL_CALLS_LOCAL (info, h) ++ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT ++ && h->root.type == bfd_link_hash_undefweak)) + { + /* This case can occur if we saw a PLT32 reloc in an input +- file, but the symbol was not defined by a dynamic object. +- In such a case, we don't actually need to build a +- procedure linkage table, and we can just do a PC32 reloc +- instead. */ +- BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); ++ file, but the symbol was never referred to by a dynamic ++ object, or if all references were garbage collected. In ++ such a case, we don't actually need to build a procedure ++ linkage table, and we can just do a PC24 reloc instead. */ ++ h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; +- return TRUE; +- } +- +- /* Make sure this symbol is output as a dynamic symbol. */ +- if (h->dynindx == -1) +- { +- if (! bfd_elf32_link_record_dynamic_symbol (info, h)) +- return FALSE; + } + +- s = bfd_get_section_by_name (dynobj, ".plt"); +- BFD_ASSERT (s != NULL); +- +- /* If this is the first .plt entry, make room for the special +- first entry. */ +- if (s->_raw_size == 0) +- s->_raw_size += PLT_ENTRY_SIZE; +- +- /* If this symbol is not defined in a regular file, and we are +- not generating a shared library, then set the symbol to this +- location in the .plt. This is required to make function +- pointers compare as equal between the normal executable and +- the shared library. */ +- if (! info->shared +- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) +- { +- h->root.u.def.section = s; +- h->root.u.def.value = s->_raw_size; +- } +- +- h->plt.offset = s->_raw_size; +- +- /* Make room for this entry. */ +- s->_raw_size += PLT_ENTRY_SIZE; +- +- /* We also need to make an entry in the .got.plt section, which +- will be placed in the .got section by the linker script. */ +- s = bfd_get_section_by_name (dynobj, ".got.plt"); +- BFD_ASSERT (s != NULL); +- s->_raw_size += 4; +- +- /* We also need to make an entry in the .rel.plt section. */ +- +- s = bfd_get_section_by_name (dynobj, ".rel.plt"); +- BFD_ASSERT (s != NULL); +- s->_raw_size += sizeof (Elf32_External_Rel); +- + return TRUE; + } ++ else ++ /* It's possible that we incorrectly decided a .plt reloc was ++ needed for an R_ARM_PC24 reloc to a non-function sym in ++ check_relocs. We can't decide accurately between function and ++ non-function syms in check-relocs; Objects loaded later in ++ the link may change h->type. So fix it now. */ ++ h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the +@@ -3142,6 +3310,198 @@ + return TRUE; + } + ++/* Allocate space in .plt, .got and associated reloc sections for ++ dynamic relocs. */ ++ ++static bfd_boolean ++allocate_dynrelocs (h, inf) ++ struct elf_link_hash_entry *h; ++ PTR inf; ++{ ++ struct bfd_link_info *info; ++ struct elf32_arm_link_hash_table *htab; ++ struct elf32_arm_link_hash_entry *eh; ++ struct elf32_arm_relocs_copied *p; ++ ++ if (h->root.type == bfd_link_hash_indirect) ++ return TRUE; ++ ++ if (h->root.type == bfd_link_hash_warning) ++ /* When warning symbols are created, they **replace** the "real" ++ entry in the hash table, thus we never get to see the real ++ symbol in a hash traversal. So look at it now. */ ++ h = (struct elf_link_hash_entry *) h->root.u.i.link; ++ ++ info = (struct bfd_link_info *) inf; ++ htab = elf32_arm_hash_table (info); ++ ++ if (htab->root.dynamic_sections_created ++ && h->plt.refcount > 0) ++ { ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (h->dynindx == -1 ++ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) ++ { ++ if (! bfd_elf32_link_record_dynamic_symbol (info, h)) ++ return FALSE; ++ } ++ ++ if (info->shared ++ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) ++ { ++ asection *s = htab->splt; ++ ++ /* If this is the first .plt entry, make room for the special ++ first entry. */ ++ if (s->_raw_size == 0) ++ s->_raw_size += PLT_HEADER_SIZE; ++ ++ h->plt.offset = s->_raw_size; ++ ++ /* If this symbol is not defined in a regular file, and we are ++ not generating a shared library, then set the symbol to this ++ location in the .plt. This is required to make function ++ pointers compare as equal between the normal executable and ++ the shared library. */ ++ if (! info->shared ++ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) ++ { ++ h->root.u.def.section = s; ++ h->root.u.def.value = h->plt.offset; ++ } ++ ++ /* Make room for this entry. */ ++ s->_raw_size += PLT_ENTRY_SIZE; ++ ++ /* We also need to make an entry in the .got.plt section, which ++ will be placed in the .got section by the linker script. */ ++ htab->sgotplt->_raw_size += 4; ++ ++ /* We also need to make an entry in the .rel.plt section. */ ++ htab->srelplt->_raw_size += sizeof (Elf32_External_Rel); ++ } ++ else ++ { ++ h->plt.offset = (bfd_vma) -1; ++ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; ++ } ++ } ++ else ++ { ++ h->plt.offset = (bfd_vma) -1; ++ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; ++ } ++ ++ if (h->got.refcount > 0) ++ { ++ asection *s; ++ bfd_boolean dyn; ++ ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (h->dynindx == -1 ++ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) ++ { ++ if (! bfd_elf32_link_record_dynamic_symbol (info, h)) ++ return FALSE; ++ } ++ ++ s = htab->sgot; ++ h->got.offset = s->_raw_size; ++ s->_raw_size += 4; ++ dyn = htab->root.dynamic_sections_created; ++ if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || h->root.type != bfd_link_hash_undefweak) ++ && (info->shared ++ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) ++ htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); ++ } ++ else ++ h->got.offset = (bfd_vma) -1; ++ ++ eh = (struct elf32_arm_link_hash_entry *) h; ++ if (eh->relocs_copied == NULL) ++ return TRUE; ++ ++ /* In the shared -Bsymbolic case, discard space allocated for ++ dynamic pc-relative relocs against symbols which turn out to be ++ defined in regular objects. For the normal shared case, discard ++ space for pc-relative relocs that have become local due to symbol ++ visibility changes. */ ++ ++ if (info->shared) ++ { ++ /* The only reloc that uses pc_count is R_ARM_PC24, which will ++ appear on a call or on something like ".long foo - .". We ++ want calls to protected symbols to resolve directly to the ++ function rather than going via the plt. If people want ++ function pointer comparisons to work as expected then they ++ should avoid writing assembly like ".long foo - .". */ ++ if (SYMBOL_CALLS_LOCAL (info, h)) ++ { ++ struct elf32_arm_relocs_copied **pp; ++ ++ for (pp = &eh->relocs_copied; (p = *pp) != NULL; ) ++ { ++ p->count -= p->pc_count; ++ p->pc_count = 0; ++ if (p->count == 0) ++ *pp = p->next; ++ else ++ pp = &p->next; ++ } ++ } ++ ++ /* Also discard relocs on undefined weak syms with non-default ++ visibility. */ ++ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT ++ && h->root.type == bfd_link_hash_undefweak) ++ eh->relocs_copied = NULL; ++ } ++ else ++ { ++ /* For the non-shared case, discard space for relocs against ++ symbols which turn out to need copy relocs or are not ++ dynamic. */ ++ ++ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 ++ && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 ++ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) ++ || (htab->root.dynamic_sections_created ++ && (h->root.type == bfd_link_hash_undefweak ++ || h->root.type == bfd_link_hash_undefined)))) ++ { ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (h->dynindx == -1 ++ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) ++ { ++ if (! bfd_elf32_link_record_dynamic_symbol (info, h)) ++ return FALSE; ++ } ++ ++ /* If that succeeded, we know we'll be keeping all the ++ relocs. */ ++ if (h->dynindx != -1) ++ goto keep; ++ } ++ ++ eh->relocs_copied = NULL; ++ ++ keep: ; ++ } ++ ++ /* Finally, allocate space. */ ++ for (p = eh->relocs_copied; p != NULL; p = p->next) ++ { ++ asection *sreloc = elf_section_data (p->section)->sreloc; ++ sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel); ++ } ++ ++ return TRUE; ++} ++ + /* Set the sizes of the dynamic sections. */ + + static bfd_boolean +@@ -3153,7 +3513,10 @@ + asection * s; + bfd_boolean plt; + bfd_boolean relocs; ++ bfd *ibfd; ++ struct elf32_arm_link_hash_table *htab; + ++ htab = elf32_arm_hash_table (info); + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + +@@ -3168,26 +3531,74 @@ + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } +- else +- { +- /* We may have created entries in the .rel.got section. +- However, if we are not creating the dynamic sections, we will +- not actually use these entries. Reset the size of .rel.got, +- which will cause it to get stripped from the output file +- below. */ +- s = bfd_get_section_by_name (dynobj, ".rel.got"); +- if (s != NULL) +- s->_raw_size = 0; +- } +- +- /* If this is a -Bsymbolic shared link, then we need to discard all +- PC relative relocs against symbols defined in a regular object. +- We allocated space for them in the check_relocs routine, but we +- will not fill them in in the relocate_section routine. */ +- if (info->shared && info->symbolic) +- elf32_arm_link_hash_traverse (elf32_arm_hash_table (info), +- elf32_arm_discard_copies, +- (PTR) NULL); ++ ++ /* Set up .got offsets for local syms, and space for local dynamic ++ relocs. */ ++ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) ++ { ++ bfd_signed_vma *local_got; ++ bfd_signed_vma *end_local_got; ++ char *local_tls_type; ++ bfd_size_type locsymcount; ++ Elf_Internal_Shdr *symtab_hdr; ++ asection *srel; ++ ++ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) ++ continue; ++ ++ for (s = ibfd->sections; s != NULL; s = s->next) ++ { ++ struct elf32_arm_relocs_copied *p; ++ ++ for (p = *((struct elf32_arm_relocs_copied **) ++ &elf_section_data (s)->local_dynrel); ++ p != NULL; ++ p = p->next) ++ { ++ if (!bfd_is_abs_section (p->section) ++ && bfd_is_abs_section (p->section->output_section)) ++ { ++ /* Input section has been discarded, either because ++ it is a copy of a linkonce section or due to ++ linker script /DISCARD/, so we'll be discarding ++ the relocs too. */ ++ } ++ else if (p->count != 0) ++ { ++ srel = elf_section_data (p->section)->sreloc; ++ srel->_raw_size += p->count * sizeof (Elf32_External_Rel); ++ if ((p->section->output_section->flags & SEC_READONLY) != 0) ++ info->flags |= DF_TEXTREL; ++ } ++ } ++ } ++ ++ local_got = elf_local_got_refcounts (ibfd); ++ if (!local_got) ++ continue; ++ ++ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; ++ locsymcount = symtab_hdr->sh_info; ++ end_local_got = local_got + locsymcount; ++ s = htab->sgot; ++ srel = htab->srelgot; ++ for (; local_got < end_local_got; ++local_got, ++local_tls_type) ++ { ++ if (*local_got > 0) ++ { ++ *local_got = s->_raw_size; ++ s->_raw_size += 4; ++ if (info->shared) ++ srel->_raw_size += sizeof (Elf32_External_Rel); ++ } ++ else ++ *local_got = (bfd_vma) -1; ++ } ++ } ++ ++ /* Allocate global sym .plt and .got entries, and space for global ++ sym dynamic relocs. */ ++ elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate +@@ -3312,33 +3723,6 @@ + return TRUE; + } + +-/* This function is called via elf32_arm_link_hash_traverse if we are +- creating a shared object with -Bsymbolic. It discards the space +- allocated to copy PC relative relocs against symbols which are +- defined in regular objects. We allocated space for them in the +- check_relocs routine, but we won't fill them in in the +- relocate_section routine. */ +- +-static bfd_boolean +-elf32_arm_discard_copies (h, ignore) +- struct elf32_arm_link_hash_entry * h; +- PTR ignore ATTRIBUTE_UNUSED; +-{ +- struct elf32_arm_pcrel_relocs_copied * s; +- +- if (h->root.root.type == bfd_link_hash_warning) +- h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link; +- +- /* We only discard relocs for symbols defined in a regular object. */ +- if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) +- return TRUE; +- +- for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) +- s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel); +- +- return TRUE; +-} +- + /* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +@@ -3362,6 +3746,7 @@ + bfd_vma got_offset; + Elf_Internal_Rela rel; + bfd_byte *loc; ++ bfd_vma got_displacement; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ +@@ -3377,35 +3762,43 @@ + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ +- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; ++ plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 4; + ++ /* Calculate the displacement between the PLT slot and the ++ entry in the GOT. */ ++ got_displacement = (sgot->output_section->vma ++ + sgot->output_offset ++ + got_offset ++ - splt->output_section->vma ++ - splt->output_offset ++ - h->plt.offset ++ - 8); ++ ++ BFD_ASSERT ((got_displacement & 0xf0000000) == 0); ++ + /* Fill in the entry in the procedure linkage table. */ +- bfd_put_32 (output_bfd, elf32_arm_plt_entry[0], ++ bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20), + splt->contents + h->plt.offset + 0); +- bfd_put_32 (output_bfd, elf32_arm_plt_entry[1], ++ bfd_put_32 (output_bfd, elf32_arm_plt_entry[1] | ((got_displacement & 0x000ff000) >> 12), + splt->contents + h->plt.offset + 4); +- bfd_put_32 (output_bfd, elf32_arm_plt_entry[2], ++ bfd_put_32 (output_bfd, elf32_arm_plt_entry[2] | (got_displacement & 0x00000fff), + splt->contents + h->plt.offset + 8); +- bfd_put_32 (output_bfd, +- (sgot->output_section->vma +- + sgot->output_offset +- + got_offset +- - splt->output_section->vma +- - splt->output_offset +- - h->plt.offset - 12), +- splt->contents + h->plt.offset + 12); ++#ifdef FOUR_WORD_PLT ++ bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], ++ splt->contents + h->plt.offset + 12); ++#endif + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset), + sgot->contents + got_offset); +- ++ + /* Fill in the entry in the .rel.plt section. */ + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset +@@ -3446,16 +3839,20 @@ + + sgot->output_offset + + (h->got.offset &~ (bfd_vma) 1)); + +- /* If this is a -Bsymbolic link, and the symbol is defined +- locally, we just want to emit a RELATIVE reloc. The entry in +- the global offset table will already have been initialized in +- the relocate_section function. */ ++ /* If this is a static link, or it is a -Bsymbolic link and the ++ symbol is defined locally or was forced to be local because ++ of a version file, we just want to emit a RELATIVE reloc. ++ The entry in the global offset table will already have been ++ initialized in the relocate_section function. */ + if (info->shared +- && (info->symbolic || h->dynindx == -1) +- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) +- rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); ++ && SYMBOL_REFERENCES_LOCAL (info, h)) ++ { ++ BFD_ASSERT((h->got.offset & 1) != 0); ++ rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); ++ } + else + { ++ BFD_ASSERT((h->got.offset & 1) == 0); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT); + } +@@ -3609,10 +4006,26 @@ + /* Fill in the first entry in the procedure linkage table. */ + if (splt->_raw_size > 0) + { ++ bfd_vma got_displacement; ++ ++ /* Calculate the displacement between the PLT slot and &GOT[0]. */ ++ got_displacement = (sgot->output_section->vma ++ + sgot->output_offset ++ - splt->output_section->vma ++ - splt->output_offset ++ - 16); ++ + bfd_put_32 (output_bfd, elf32_arm_plt0_entry[0], splt->contents + 0); + bfd_put_32 (output_bfd, elf32_arm_plt0_entry[1], splt->contents + 4); + bfd_put_32 (output_bfd, elf32_arm_plt0_entry[2], splt->contents + 8); + bfd_put_32 (output_bfd, elf32_arm_plt0_entry[3], splt->contents + 12); ++#ifdef FOUR_WORD_PLT ++ /* The displacement value goes in the otherwise-unused last word of ++ the second entry. */ ++ bfd_put_32 (output_bfd, got_displacement, splt->contents + 28); ++#else ++ bfd_put_32 (output_bfd, got_displacement, splt->contents + 16); ++#endif + } + + /* UnixWare sets the entsize of .plt to 4, although that doesn't +@@ -3714,7 +4127,7 @@ + #define elf_backend_check_relocs elf32_arm_check_relocs + #define elf_backend_relocate_section elf32_arm_relocate_section + #define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol +-#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections ++#define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections + #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol + #define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections + #define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections +@@ -3723,7 +4136,9 @@ + #define elf_backend_object_p elf32_arm_object_p + #define elf_backend_section_flags elf32_arm_section_flags + #define elf_backend_final_write_processing elf32_arm_final_write_processing ++#define elf_backend_copy_indirect_symbol elf32_arm_copy_indirect_symbol + ++#define elf_backend_can_refcount 1 + #define elf_backend_can_gc_sections 1 + #define elf_backend_plt_readonly 1 + #define elf_backend_want_got_plt 1 +@@ -3733,7 +4148,7 @@ + #endif + + #define elf_backend_got_header_size 12 +-#define elf_backend_plt_header_size PLT_ENTRY_SIZE ++#define elf_backend_plt_header_size PLT_HEADER_SIZE + + #include "elf32-target.h" + +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-avr.c binutils-2.14.90.0.7/bfd/elf32-avr.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-avr.c 2003-07-23 09:08:08.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-avr.c 2004-04-20 01:26:12.000000000 -0600 +@@ -750,7 +750,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-cris.c binutils-2.14.90.0.7/bfd/elf32-cris.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-cris.c 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-cris.c 2004-04-20 01:26:12.000000000 -0600 +@@ -847,7 +847,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + symname = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); +@@ -1292,16 +1292,7 @@ + { + long indx; + +- if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-fr30.c binutils-2.14.90.0.7/bfd/elf32-fr30.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-fr30.c 2003-07-23 09:08:08.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-fr30.c 2004-04-20 01:26:12.000000000 -0600 +@@ -552,7 +552,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-frv.c binutils-2.14.90.0.7/bfd/elf32-frv.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-frv.c 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-frv.c 2004-04-20 01:26:12.000000000 -0600 +@@ -724,7 +724,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-h8300.c binutils-2.14.90.0.7/bfd/elf32-h8300.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-h8300.c 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-h8300.c 2004-04-20 01:26:12.000000000 -0600 +@@ -435,7 +435,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-hppa.c binutils-2.14.90.0.7/bfd/elf32-hppa.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-hppa.c 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-hppa.c 2004-04-20 01:26:12.000000000 -0600 +@@ -3408,7 +3408,7 @@ + /* This is a local symbol, h defaults to NULL. */ + sym = local_syms + r_symndx; + sym_sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-i370.c binutils-2.14.90.0.7/bfd/elf32-i370.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-i370.c 2003-07-23 09:08:08.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-i370.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1210,7 +1210,7 @@ + sec = local_sections[r_symndx]; + sym_name = ""; + +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + } + else +@@ -1363,16 +1363,7 @@ + { + long indx; + +- if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-i860.c binutils-2.14.90.0.7/bfd/elf32-i860.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-i860.c 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-i860.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1104,7 +1104,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-m32r.c binutils-2.14.90.0.7/bfd/elf32-m32r.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-m32r.c 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-m32r.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1107,7 +1107,7 @@ + sec = local_sections[r_symndx]; + sym_name = ""; + #if !USE_REL +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + #else + /* FIXME: This won't handle local relocations against SEC_MERGE +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-m68k.c binutils-2.14.90.0.7/bfd/elf32-m68k.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-m68k.c 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-m68k.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1403,7 +1403,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +@@ -1657,16 +1657,7 @@ + { + long indx; + +- if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-mcore.c binutils-2.14.90.0.7/bfd/elf32-mcore.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-mcore.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-mcore.c 2004-04-20 01:26:12.000000000 -0600 +@@ -467,7 +467,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + } + else +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-msp430.c binutils-2.14.90.0.7/bfd/elf32-msp430.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-msp430.c 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-msp430.c 2004-04-20 01:26:12.000000000 -0600 +@@ -449,7 +449,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-openrisc.c binutils-2.14.90.0.7/bfd/elf32-openrisc.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-openrisc.c 2003-07-23 09:08:08.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-openrisc.c 2004-04-20 01:26:12.000000000 -0600 +@@ -375,7 +375,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-ppc.c binutils-2.14.90.0.7/bfd/elf32-ppc.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-ppc.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-ppc.c 2004-04-20 01:26:12.000000000 -0600 +@@ -4727,7 +4727,7 @@ + sec = local_sections[r_symndx]; + sym_name = bfd_elf_local_sym_name (input_bfd, sym); + +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +@@ -5455,44 +5455,9 @@ + break; + + case R_PPC_RELAX32: +- { +- unsigned long r_symndx; +- Elf_Internal_Sym *sym; +- asection *sym_sec; +- bfd_byte *hit_addr = 0; +- bfd_vma value = 0; +- +- r_symndx = ELF32_R_SYM (rel->r_info); +- +- if (r_symndx < symtab_hdr->sh_info) +- { +- sym = local_syms + r_symndx; +- sym_sec = local_sections[r_symndx]; +- +- value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); +- } +- else +- { +- bfd_boolean warned; +- bfd_boolean unresolved_reloc; +- +- RELOC_FOR_GLOBAL_SYMBOL (h, elf_sym_hashes (input_bfd), +- r_symndx, symtab_hdr, +- value, sym_sec, +- unresolved_reloc, info, +- warned); +- if (warned) +- continue; +- } +- hit_addr = contents + rel->r_offset; +- value += rel->r_addend; +- +- r = ppc_elf_install_value (output_bfd, hit_addr, value, r_type); +- if (r != bfd_reloc_ok) +- break; +- else +- continue; +- } ++ ppc_elf_install_value (output_bfd, contents + rel->r_offset, ++ relocation + addend, r_type); ++ continue; + + /* Indirect .sdata relocation. */ + case R_PPC_EMB_SDAI16: +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-s390.c binutils-2.14.90.0.7/bfd/elf32-s390.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-s390.c 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-s390.c 2004-04-20 01:26:12.000000000 -0600 +@@ -2327,7 +2327,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-sh.c binutils-2.14.90.0.7/bfd/elf32-sh.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-sh.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-sh.c 2004-04-20 01:26:12.000000000 -0600 +@@ -4805,7 +4805,7 @@ + } + else if (! howto->partial_inplace) + { +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + } + else if ((sec->flags & SEC_MERGE) +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-sparc.c binutils-2.14.90.0.7/bfd/elf32-sparc.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-sparc.c 2003-08-21 09:28:48.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-sparc.c 2004-04-20 01:26:12.000000000 -0600 +@@ -2182,7 +2182,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +@@ -2459,16 +2459,8 @@ + + if (is_plt) + sec = htab->splt; +- else if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ ++ if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-v850.c binutils-2.14.90.0.7/bfd/elf32-v850.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-v850.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-v850.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1681,7 +1681,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + #if 0 + { + char * name; +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-vax.c binutils-2.14.90.0.7/bfd/elf32-vax.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-vax.c 2003-08-21 09:28:48.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-vax.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1483,7 +1483,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +@@ -1737,16 +1737,7 @@ + { + long indx; + +- if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-xstormy16.c binutils-2.14.90.0.7/bfd/elf32-xstormy16.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-xstormy16.c 2003-07-23 09:08:09.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf32-xstormy16.c 2004-04-20 01:26:12.000000000 -0600 +@@ -845,7 +845,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-xtensa.c binutils-2.14.90.0.7/bfd/elf32-xtensa.c +--- binutils-2.14.90.0.7.orig/bfd/elf32-xtensa.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf32-xtensa.c 2004-04-20 01:26:12.000000000 -0600 +@@ -2004,7 +2004,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-alpha.c binutils-2.14.90.0.7/bfd/elf64-alpha.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-alpha.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf64-alpha.c 2004-04-20 01:26:12.000000000 -0600 +@@ -4394,9 +4394,11 @@ + + if (r_symndx < symtab_hdr->sh_info) + { ++ asection *msec; + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ msec = sec; ++ value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); + + /* If this is a tp-relative relocation against sym 0, + this is hackery from relax_section. Force the value to +@@ -4424,7 +4426,6 @@ + && !gotent->reloc_xlated) + { + struct alpha_elf_got_entry *ent; +- asection *msec; + + for (ent = gotent; ent; ent = ent->next) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-hppa.c binutils-2.14.90.0.7/bfd/elf64-hppa.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-hppa.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf64-hppa.c 2004-04-20 01:26:12.000000000 -0600 +@@ -173,7 +173,7 @@ + PTR info)); + + static const char *get_dyn_name +- PARAMS ((asection *, struct elf_link_hash_entry *, ++ PARAMS ((bfd *, struct elf_link_hash_entry *, + const Elf_Internal_Rela *, char **, size_t *)); + + /* This must follow the definitions of the various derived linker +@@ -446,13 +446,14 @@ + allocate memory as necessary, possibly reusing PBUF/PLEN. */ + + static const char * +-get_dyn_name (sec, h, rel, pbuf, plen) +- asection *sec; ++get_dyn_name (abfd, h, rel, pbuf, plen) ++ bfd *abfd; + struct elf_link_hash_entry *h; + const Elf_Internal_Rela *rel; + char **pbuf; + size_t *plen; + { ++ asection *sec = abfd->sections; + size_t nlen, tlen; + char *buf; + size_t len; +@@ -858,7 +859,7 @@ + continue; + + /* Collect a canonical name for this address. */ +- addr_name = get_dyn_name (sec, h, rel, &buf, &buf_len); ++ addr_name = get_dyn_name (abfd, h, rel, &buf, &buf_len); + + /* Collect the canonical entry data for this address. */ + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-mmix.c binutils-2.14.90.0.7/bfd/elf64-mmix.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-mmix.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf64-mmix.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1472,7 +1472,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-ppc.c binutils-2.14.90.0.7/bfd/elf64-ppc.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-ppc.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf64-ppc.c 2004-04-20 01:26:12.000000000 -0600 +@@ -7385,7 +7385,7 @@ + sec = local_sections[r_symndx]; + sym_name = bfd_elf_local_sym_name (input_bfd, sym); + sym_type = ELF64_ST_TYPE (sym->st_info); +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + if (elf_section_data (sec) != NULL) + { + long *opd_sym_adjust; +@@ -8178,7 +8178,9 @@ + relocation = TOCstart; + if (r_symndx == 0) + relocation += htab->stub_group[input_section->id].toc_off; +- else if (sec != NULL && !unresolved_reloc) ++ else if (unresolved_reloc) ++ ; ++ else if (sec != NULL && sec->id <= htab->top_id) + relocation += htab->stub_group[sec->id].toc_off; + else + unresolved_reloc = TRUE; +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-s390.c binutils-2.14.90.0.7/bfd/elf64-s390.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-s390.c 2003-08-21 09:28:48.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf64-s390.c 2004-04-20 01:26:12.000000000 -0600 +@@ -2297,7 +2297,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-sh64.c binutils-2.14.90.0.7/bfd/elf64-sh64.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-sh64.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elf64-sh64.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1582,7 +1582,7 @@ + } + else if (! howto->partial_inplace) + { +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation |= ((sym->st_other & STO_SH5_ISA32) != 0); + } + else if ((sec->flags & SEC_MERGE) +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-sparc.c binutils-2.14.90.0.7/bfd/elf64-sparc.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-sparc.c 2003-08-21 09:28:48.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf64-sparc.c 2004-04-20 01:26:12.000000000 -0600 +@@ -2070,7 +2070,7 @@ + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +@@ -2247,16 +2247,8 @@ + + if (is_plt) + sec = splt; +- else if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ ++ if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-x86-64.c binutils-2.14.90.0.7/bfd/elf64-x86-64.c +--- binutils-2.14.90.0.7.orig/bfd/elf64-x86-64.c 2003-08-21 09:28:48.000000000 -0600 ++++ binutils-2.14.90.0.7/bfd/elf64-x86-64.c 2004-04-20 01:26:12.000000000 -0600 +@@ -1823,7 +1823,7 @@ + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + +- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { +@@ -2048,16 +2048,7 @@ + { + long sindx; + +- if (h == NULL) +- sec = local_sections[r_symndx]; +- else +- { +- BFD_ASSERT (h->root.type == bfd_link_hash_defined +- || (h->root.type +- == bfd_link_hash_defweak)); +- sec = h->root.u.def.section; +- } +- if (sec != NULL && bfd_is_abs_section (sec)) ++ if (bfd_is_abs_section (sec)) + sindx = 0; + else if (sec == NULL || sec->owner == NULL) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/elfxx-ia64.c binutils-2.14.90.0.7/bfd/elfxx-ia64.c +--- binutils-2.14.90.0.7.orig/bfd/elfxx-ia64.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/elfxx-ia64.c 2004-04-20 01:26:12.000000000 -0600 +@@ -3849,9 +3849,11 @@ + if (r_symndx < symtab_hdr->sh_info) + { + /* Reloc against local symbol. */ ++ asection *msec; + sym = local_syms + r_symndx; + sym_sec = local_sections[r_symndx]; +- value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); ++ msec = sym_sec; ++ value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); + if ((sym_sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION + && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE) +@@ -3862,7 +3864,6 @@ + if (loc_h && ! loc_h->sec_merge_done) + { + struct elfNN_ia64_dyn_sym_info *dynent; +- asection *msec; + + for (dynent = loc_h->info; dynent; dynent = dynent->next) + { +diff -urN binutils-2.14.90.0.7.orig/bfd/opncls.c binutils-2.14.90.0.7/bfd/opncls.c +--- binutils-2.14.90.0.7.orig/bfd/opncls.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/opncls.c 2004-04-20 01:26:11.000000000 -0600 +@@ -150,6 +150,13 @@ + { + bfd *nbfd; + const bfd_target *target_vec; ++ struct stat s; ++ ++ if (stat (filename, &s) == 0) ++ if (S_ISDIR(s.st_mode)) { ++ bfd_set_error (bfd_error_file_not_recognized); ++ return NULL; ++ } + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) +diff -urN binutils-2.14.90.0.7.orig/binutils/objcopy.c binutils-2.14.90.0.7/binutils/objcopy.c +--- binutils-2.14.90.0.7.orig/binutils/objcopy.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/binutils/objcopy.c 2004-04-20 01:26:12.000000000 -0600 +@@ -27,6 +27,7 @@ + #include "libiberty.h" + #include "budbg.h" + #include "filenames.h" ++#include "elf-bfd.h" + #include + + /* A list of symbols to explicitly strip out, or to keep. A linked +@@ -385,6 +386,7 @@ + -g --strip-debug Remove all debugging symbols & sections\n\ + --strip-unneeded Remove all symbols not needed by relocations\n\ + -N --strip-symbol Do not copy symbol \n\ ++ --only-keep-debug Strip everything but the debug information\n\ + -K --keep-symbol Only copy symbol \n\ + -L --localize-symbol Force symbol to be marked as a local\n\ + -G --keep-global-symbol Localize all symbols except \n\ +@@ -457,6 +459,7 @@ + -s --strip-all Remove all symbol and relocation information\n\ + -g -S -d --strip-debug Remove all debugging symbols & sections\n\ + --strip-unneeded Remove all symbols not needed by relocations\n\ ++ --only-keep-debug Strip everything but the debug information\n\ + -N --strip-symbol= Do not copy symbol \n\ + -K --keep-symbol= Only copy symbol \n\ + -x --discard-all Remove all non-global symbols\n\ +@@ -734,7 +737,7 @@ + return FALSE; + } + +- return strip_symbols == STRIP_NONDEBUG ? TRUE : FALSE; ++ return FALSE; + } + + /* Choose which symbol entries to copy; put the result in OSYMS. +@@ -1806,6 +1809,13 @@ + + if (p != NULL && p->set_flags) + flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC)); ++ else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0) ++ { ++ flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD); ++ if (obfd->xvec->flavour == bfd_target_elf_flavour) ++ elf_section_type (osection) = SHT_NOBITS; ++ } ++ + if (!bfd_set_section_flags (obfd, osection, flags)) + { + err = _("flags"); +@@ -1926,6 +1936,8 @@ + } + + bfd_set_reloc (obfd, osection, relcount == 0 ? NULL : relpp, relcount); ++ if (relcount == 0) ++ free (relpp); + } + + isection->_cooked_size = isection->_raw_size; +diff -urN binutils-2.14.90.0.7.orig/binutils/readelf.c binutils-2.14.90.0.7/binutils/readelf.c +--- binutils-2.14.90.0.7.orig/binutils/readelf.c 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/binutils/readelf.c 2004-04-20 01:26:12.000000000 -0600 +@@ -6055,7 +6055,7 @@ + + bytes = section->sh_size; + +- if (bytes == 0) ++ if (bytes == 0 || section->sh_type == SHT_NOBITS) + { + printf (_("\nSection '%s' has no data to dump.\n"), + SECTION_NAME (section)); +diff -urN binutils-2.14.90.0.7.orig/gprof/gprof.texi binutils-2.14.90.0.7/gprof/gprof.texi +--- binutils-2.14.90.0.7.orig/gprof/gprof.texi 2002-08-01 18:49:32.000000000 -0600 ++++ binutils-2.14.90.0.7/gprof/gprof.texi 2004-04-20 01:26:11.000000000 -0600 +@@ -137,6 +137,10 @@ + If more than one profile file is specified, the @code{gprof} + output shows the sum of the profile information in the given profile files. + ++If you use gcc 2.95.x or 3.0 to compile your binaries, you may need ++to add the @samp{-fprofile-arcs} to the compile command line in order ++for the call graphs to be properly stored in gmon.out. ++ + @code{Gprof} calculates the amount of time spent in each routine. + Next, these times are propagated along the edges of the call graph. + Cycles are discovered, and calls into a cycle are made to share the time +@@ -181,7 +185,7 @@ + @c man end + + @c man begin SEEALSO +-monitor(3), profil(2), cc(1), prof(1), and the Info entry for @file{gprof}. ++profil(2), cc(1), prof(1), and the Info entry for @file{gprof}. + + ``An Execution Profiler for Modular Programs'', + by S. Graham, P. Kessler, M. McKusick; +@@ -267,6 +271,11 @@ + options. The same option, @samp{-pg}, alters either compilation or linking + to do what is necessary for profiling. Here are examples: + ++If you use gcc 2.95.x or 3.0.x, you may need to add the ++@samp{-fprofile-arcs} option to the compile line along with @samp{-pg} ++in order to allow the call-graphs to be properly included in the gmon.out ++file. ++ + @example + cc -g -c myprog.c utils.c -pg + cc -o myprog myprog.o utils.o -pg +diff -urN binutils-2.14.90.0.7.orig/ld/Makefile.am binutils-2.14.90.0.7/ld/Makefile.am +--- binutils-2.14.90.0.7.orig/ld/Makefile.am 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/ld/Makefile.am 2004-04-20 01:26:11.000000000 -0600 +@@ -19,7 +19,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -urN binutils-2.14.90.0.7.orig/ld/Makefile.in binutils-2.14.90.0.7/ld/Makefile.in +--- binutils-2.14.90.0.7.orig/ld/Makefile.in 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/ld/Makefile.in 2004-04-20 01:26:11.000000000 -0600 +@@ -128,7 +128,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -urN binutils-2.14.90.0.7.orig/ld/emultempl/elf32.em binutils-2.14.90.0.7/ld/emultempl/elf32.em +--- binutils-2.14.90.0.7.orig/ld/emultempl/elf32.em 2003-08-21 09:28:48.000000000 -0600 ++++ binutils-2.14.90.0.7/ld/emultempl/elf32.em 2004-04-20 01:26:11.000000000 -0600 +@@ -679,6 +679,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, + force)) + break; +@@ -855,6 +857,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf${ELFSIZE}_size_dynamic_sections + (output_bfd, command_line.soname, rpath, + command_line.filter_shlib, +diff -urN binutils-2.14.90.0.7.orig/ltmain.sh binutils-2.14.90.0.7/ltmain.sh +--- binutils-2.14.90.0.7.orig/ltmain.sh 2002-03-22 15:06:16.000000000 -0700 ++++ binutils-2.14.90.0.7/ltmain.sh 2004-04-20 01:26:12.000000000 -0600 +@@ -4413,6 +4413,10 @@ + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ++ if test -n "$linkname"; then ++ $show "(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)" ++ $run eval '(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)' || exit $? ++ fi + ;; + esac + exit 0 +diff -urN binutils-2.14.90.0.7.orig/opcodes/Makefile.am binutils-2.14.90.0.7/opcodes/Makefile.am +--- binutils-2.14.90.0.7.orig/opcodes/Makefile.am 2003-10-29 10:37:49.000000000 -0700 ++++ binutils-2.14.90.0.7/opcodes/Makefile.am 2004-04-20 01:26:12.000000000 -0600 +@@ -284,7 +284,7 @@ + + libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c + libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la +-libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la ++libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd + libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ + + # libtool will build .libs/libopcodes.a. We create libopcodes.a in +diff -urN binutils-2.14.90.0.7.orig/opcodes/Makefile.in binutils-2.14.90.0.7/opcodes/Makefile.in +--- binutils-2.14.90.0.7.orig/opcodes/Makefile.in 2003-10-29 10:37:49.000000000 -0700 ++++ binutils-2.14.90.0.7/opcodes/Makefile.in 2004-04-20 01:26:12.000000000 -0600 +@@ -394,7 +394,7 @@ + + libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c + libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la +-libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la ++libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd + libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ + + # libtool will build .libs/libopcodes.a. We create libopcodes.a in +@@ -593,7 +593,7 @@ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ + check-recursive installcheck-recursive info-recursive dvi-recursive: +- @set fnord $(MAKEFLAGS); amf=$$2; \ ++ @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ +@@ -613,7 +613,7 @@ + + mostlyclean-recursive clean-recursive distclean-recursive \ + maintainer-clean-recursive: +- @set fnord $(MAKEFLAGS); amf=$$2; \ ++ @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ +diff -urN binutils-2.14.90.0.7.orig/opcodes/alpha-opc.c binutils-2.14.90.0.7/opcodes/alpha-opc.c +--- binutils-2.14.90.0.7.orig/opcodes/alpha-opc.c 2003-01-21 11:21:34.000000000 -0700 ++++ binutils-2.14.90.0.7/opcodes/alpha-opc.c 2004-04-20 01:26:11.000000000 -0600 +@@ -1105,7 +1105,8 @@ + { "wmb", MFC(0x18,0x4400), BASE, ARG_NONE }, + { "fetch", MFC(0x18,0x8000), BASE, { ZA, PRB } }, + { "fetch_m", MFC(0x18,0xA000), BASE, { ZA, PRB } }, +- { "rpcc", MFC(0x18,0xC000), BASE, { RA } }, ++ { "rpcc", MFC(0x18,0xC000), BASE, { RA, ZB } }, ++ { "rpcc", MFC(0x18,0xC000), BASE, { RA, RB } }, /* ev6 una */ + { "rc", MFC(0x18,0xE000), BASE, { RA } }, + { "ecb", MFC(0x18,0xE800), BASE, { ZA, PRB } }, /* ev56 una */ + { "rs", MFC(0x18,0xF000), BASE, { RA } }, +diff -urN binutils-2.14.90.0.7.orig/opcodes/m68k-opc.c binutils-2.14.90.0.7/opcodes/m68k-opc.c +--- binutils-2.14.90.0.7.orig/opcodes/m68k-opc.c 2003-10-29 10:37:49.000000000 -0700 ++++ binutils-2.14.90.0.7/opcodes/m68k-opc.c 2004-04-20 01:26:12.000000000 -0600 +@@ -847,15 +847,15 @@ + {"fmoved", two(0xF000, 0x7400), two(0xF1C0, 0xFC7F), "IiF7ws", cfloat }, + {"fmovel", two(0xF000, 0x4000), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat }, + {"fmovel", two(0xF000, 0x6000), two(0xF1C0, 0xFC7F), "IiF7$l", mfloat }, ++/* FIXME: the next two variants should not permit moving an address ++ register to anything but the floating point instruction register. */ ++{"fmovel", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat }, ++{"fmovel", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ls8", mfloat }, + {"fmovel", two(0xF000, 0x4000), two(0xF1C0, 0xFC7F), "IibsF7", cfloat }, + {"fmovel", two(0xF000, 0x6000), two(0xF1C0, 0xFC7F), "IiF7bs", cfloat }, + /* Move the FP control registers */ + {"fmovel", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8ps", cfloat }, + {"fmovel", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Iibss8", cfloat }, +-/* FIXME: the next two variants should not permit moving an address +- register to anything but the floating point instruction register. */ +-{"fmovel", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat }, +-{"fmovel", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ls8", mfloat }, + {"fmovep", two(0xF000, 0x4C00), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat }, + {"fmovep", two(0xF000, 0x6C00), two(0xF1C0, 0xFC00), "IiF7~pkC", mfloat }, + {"fmovep", two(0xF000, 0x7C00), two(0xF1C0, 0xFC0F), "IiF7~pDk", mfloat }, diff --git a/obsolete-buildroot/sources/binutils-uclibc-100-conf.patch b/obsolete-buildroot/sources/binutils-uclibc-100-conf.patch new file mode 100644 index 0000000000..6e36af2298 --- /dev/null +++ b/obsolete-buildroot/sources/binutils-uclibc-100-conf.patch @@ -0,0 +1,646 @@ +diff -urN binutils-2.14.90.0.7.orig/bfd/config.bfd binutils-2.14.90.0.7/bfd/config.bfd +--- binutils-2.14.90.0.7.orig/bfd/config.bfd 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/config.bfd 2004-04-20 01:37:12.000000000 -0600 +@@ -121,7 +121,7 @@ + targ_defvec=ecoffalpha_little_vec + targ_selvecs=bfd_elf64_alpha_vec + ;; +- alpha*-*-linux-gnu* | alpha*-*-elf*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*) + targ_defvec=bfd_elf64_alpha_vec + targ_selvecs=ecoffalpha_little_vec + ;; +@@ -131,7 +131,7 @@ + alpha*-*-*) + targ_defvec=ecoffalpha_little_vec + ;; +- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) ++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-linux-uclibc* | ia64*-*-kfreebsd*-gnu) + targ_defvec=bfd_elf64_ia64_little_vec + targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" + ;; +@@ -214,7 +214,7 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- armeb-*-elf | arm*b-*-linux-gnu*) ++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) + targ_defvec=bfd_elf32_bigarm_vec + targ_selvecs=bfd_elf32_littlearm_vec + ;; +@@ -222,7 +222,7 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux* | arm-*-kfreebsd*-gnu) ++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux* | arm*-*-linux-uclibc* | arm-*-kfreebsd*-gnu) + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +@@ -355,7 +355,7 @@ + ;; + + #ifdef BFD64 +- hppa*64*-*-linux-gnu*) ++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) + targ_defvec=bfd_elf64_hppa_linux_vec + targ_selvecs=bfd_elf64_hppa_vec + ;; +@@ -366,7 +366,7 @@ + ;; + #endif + +- hppa*-*-linux-gnu* | hppa*-*-netbsd*) ++ hppa*-*-linux-gnu* | hppa*-*-netbsd* | hppa*-*-linux-uclibc*) + targ_defvec=bfd_elf32_hppa_linux_vec + targ_selvecs=bfd_elf32_hppa_vec + ;; +@@ -488,7 +488,7 @@ + targ_selvecs=bfd_elf32_i386_vec + targ_underscore=yes + ;; +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" + targ64_selvecs=bfd_elf64_x86_64_vec +@@ -502,7 +502,7 @@ + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" + ;; +- x86_64-*-linux-gnu*) ++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" + ;; +@@ -662,7 +662,7 @@ + targ_selvecs=bfd_elf32_m68k_vec + targ_underscore=yes + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + targ_defvec=bfd_elf32_m68k_vec + targ_selvecs=m68klinux_vec + ;; +@@ -929,7 +929,8 @@ + ;; + #endif + powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ +- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ ++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \ ++ powerpc-*-rtems* | \ + powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*) + targ_defvec=bfd_elf32_powerpc_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" +@@ -961,8 +962,8 @@ + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" + ;; + powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ +- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\ +- powerpcle-*-rtems*) ++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\ ++ powerpcle-*-vxworks* | powerpcle-*-rtems*) + targ_defvec=bfd_elf32_powerpcle_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" + targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" +@@ -1110,7 +1111,7 @@ + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + targ_underscore=yes + ;; +- sparc-*-linux-gnu*) ++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) + targ_defvec=bfd_elf32_sparc_vec + targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec" + ;; +@@ -1157,7 +1158,7 @@ + targ_defvec=sunos_big_vec + targ_underscore=yes + ;; +- sparc64-*-linux-gnu*) ++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) + targ_defvec=bfd_elf64_sparc_vec + targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" + ;; +diff -urN binutils-2.14.90.0.7.orig/bfd/configure binutils-2.14.90.0.7/bfd/configure +--- binutils-2.14.90.0.7.orig/bfd/configure 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/configure 2004-04-20 01:32:29.000000000 -0600 +@@ -1699,6 +1699,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5278,7 +5283,7 @@ + alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -5338,7 +5343,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386mach3.h"' + ;; +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' + ;; +@@ -5388,7 +5393,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/hp300bsd.h"' + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/m68klinux.h"' + ;; +diff -urN binutils-2.14.90.0.7.orig/bfd/configure.in binutils-2.14.90.0.7/bfd/configure.in +--- binutils-2.14.90.0.7.orig/bfd/configure.in 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/bfd/configure.in 2004-04-20 01:32:29.000000000 -0600 +@@ -178,7 +178,7 @@ + alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -259,7 +259,7 @@ + TRAD_HEADER='"hosts/i386mach3.h"' + ;; + changequote(,)dnl +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + changequote([,])dnl + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' +@@ -312,7 +312,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/hp300bsd.h"' + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/m68klinux.h"' + ;; +diff -urN binutils-2.14.90.0.7.orig/config.sub binutils-2.14.90.0.7/config.sub +--- binutils-2.14.90.0.7.orig/config.sub 2003-08-21 09:28:47.000000000 -0600 ++++ binutils-2.14.90.0.7/config.sub 2004-04-20 01:32:29.000000000 -0600 +@@ -118,7 +118,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) ++ nto-qnx* | linux-gnu* | linux-uclibc* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -1131,7 +1131,8 @@ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -mingw32* | -linux-gnu* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ +diff -urN binutils-2.14.90.0.7.orig/configure binutils-2.14.90.0.7/configure +--- binutils-2.14.90.0.7.orig/configure 2003-10-29 10:38:23.000000000 -0700 ++++ binutils-2.14.90.0.7/configure 2004-04-20 01:32:29.000000000 -0600 +@@ -1276,6 +1276,18 @@ + i[3456789]86-*-freebsd* | i[3456789]86-*-kfreebsd*-gnu) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; ++ i[3456789]86-*-linux-uclibc) ++ # This section makes it possible to build newlib natively on linux. ++ # If we are using a cross compiler then don't configure newlib. ++ if test x${is_cross_compiler} != xno ; then ++ noconfigdirs="$noconfigdirs target-newlib" ++ fi ++ noconfigdirs="$noconfigdirs target-libgloss" ++ # If we are not using a cross compiler, do configure newlib. ++ # Note however, that newlib will only be configured in this situation ++ # if the --with-newlib option has been given, because otherwise ++ # 'target-newlib' will appear in skipdirs. ++ ;; + i[3456789]86-*-linux*) + # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's + # not build java stuff by default. +diff -urN binutils-2.14.90.0.7.orig/configure.in binutils-2.14.90.0.7/configure.in +--- binutils-2.14.90.0.7.orig/configure.in 2003-10-29 10:38:20.000000000 -0700 ++++ binutils-2.14.90.0.7/configure.in 2004-04-20 01:32:29.000000000 -0600 +@@ -515,6 +515,19 @@ + i[[3456789]]86-*-freebsd* | i[[3456789]]86-*-kfreebsd*-gnu) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; ++ i[3456789]86-*-linux-uclibc) ++ # This section makes it possible to build newlib natively on linux. ++ # If we are using a cross compiler then don't configure newlib. ++ if test x${is_cross_compiler} != xno ; then ++ noconfigdirs="$noconfigdirs target-newlib" ++ fi ++ noconfigdirs="$noconfigdirs target-libgloss" ++ build_modules= ++ # If we are not using a cross compiler, do configure newlib. ++ # Note however, that newlib will only be configured in this situation ++ # if the --with-newlib option has been given, because otherwise ++ # 'target-newlib' will appear in skipdirs. ++ ;; + i[[3456789]]86-*-linux*) + # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's + # not build java stuff by default. +diff -urN binutils-2.14.90.0.7.orig/demangler/configure binutils-2.14.90.0.7/demangler/configure +--- binutils-2.14.90.0.7.orig/demangler/configure 2003-10-29 10:38:20.000000000 -0700 ++++ binutils-2.14.90.0.7/demangler/configure 2004-04-20 01:32:29.000000000 -0600 +@@ -1380,6 +1380,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +diff -urN binutils-2.14.90.0.7.orig/gas/configure binutils-2.14.90.0.7/gas/configure +--- binutils-2.14.90.0.7.orig/gas/configure 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/gas/configure 2004-04-20 01:37:58.000000000 -0600 +@@ -3215,6 +3215,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -4028,6 +4033,7 @@ + alpha*-*-osf*) fmt=ecoff ;; + alpha*-*-linuxecoff*) fmt=ecoff ;; + alpha*-*-linux-gnu*) fmt=elf em=linux ;; ++ alpha*-*-linux-uclibc*) fmt=elf em=linux ;; + alpha*-*-netbsd*) fmt=elf em=nbsd ;; + alpha*-*-openbsd*) fmt=elf em=obsd ;; + +@@ -4044,6 +4050,7 @@ + arm*-*-conix*) fmt=elf ;; + arm-*-linux*aout*) fmt=aout em=linux ;; + arm*-*-linux-gnu*) fmt=elf em=linux ;; ++ arm*-*-linux-uclibc*) fmt=elf em=linux ;; + arm*-*-uclinux*) fmt=elf em=linux ;; + arm-*-netbsdelf*) fmt=elf em=nbsd ;; + arm-*-*n*bsd*) fmt=aout em=nbsd ;; +@@ -4058,6 +4065,7 @@ + avr-*-*) fmt=elf ;; + + cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; ++ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;; + cris-*-*) fmt=multi bfd_gas=yes ;; + + d10v-*-*) fmt=elf ;; +@@ -4114,7 +4122,9 @@ + i386-*-linux*oldld) fmt=aout em=linux ;; + i386-*-linux*coff*) fmt=coff em=linux ;; + i386-*-linux-gnu*) fmt=elf em=linux ;; ++ i386-*-linux-uclibc*) fmt=elf em=linux ;; + x86_64-*-linux-gnu*) fmt=elf em=linux ;; ++ x86_64-*-linux-uclibc*) fmt=elf em=linux ;; + i386-*-lynxos*) fmt=coff em=lynx ;; + i386-*-sysv[45]*) fmt=elf ;; + i386-*-solaris*) fmt=elf ;; +@@ -4175,6 +4185,7 @@ + ia64-*-elf*) fmt=elf ;; + ia64-*-aix*) fmt=elf em=ia64aix ;; + ia64-*-linux-gnu*) fmt=elf em=linux ;; ++ ia64-*-linux-uclibc*) fmt=elf em=linux ;; + ia64-*-hpux*) fmt=elf em=hpux ;; + ia64-*-netbsd*) fmt=elf em=nbsd ;; + +@@ -4201,6 +4212,7 @@ + m68k-*-hpux*) fmt=hp300 em=hp300 ;; + m68k-*-linux*aout*) fmt=aout em=linux ;; + m68k-*-linux-gnu*) fmt=elf em=linux ;; ++ m68k-*-linux-uclibc*) fmt=elf em=linux ;; + m68k-*-gnu*) fmt=elf ;; + m68k-*-lynxos*) fmt=coff em=lynx ;; + m68k-*-netbsdelf*) fmt=elf em=nbsd ;; +@@ -4257,7 +4269,7 @@ + ppc-*-beos*) fmt=coff ;; + ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; + ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; +- ppc-*-linux-gnu*) fmt=elf em=linux ++ ppc-*-linux-uclibc* | ppc-*-linux-gnu*) fmt=elf em=linux + case "$endian" in + big) ;; + *) { { echo "$as_me:$LINENO: error: GNU/Linux must be configured big endian" >&5 +@@ -4286,7 +4298,9 @@ + ppc-*-kaos*) fmt=elf ;; + + s390x-*-linux-gnu*) fmt=elf em=linux ;; ++ s390x-*-linux-uclibc*) fmt=elf em=linux ;; + s390-*-linux-gnu*) fmt=elf em=linux ;; ++ s390-*-linux-uclibc*) fmt=elf em=linux ;; + + sh*-*-linux*) fmt=elf em=linux + case ${cpu} in +@@ -4319,6 +4333,7 @@ + sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; + sparc-*-linux-gnu*) fmt=elf em=linux ;; ++ sparc-*-linux-uclibc*) fmt=elf em=linux ;; + sparc-*-lynxos*) fmt=coff em=lynx ;; + sparc-fujitsu-none) fmt=aout ;; + sparc-*-elf) fmt=elf ;; +diff -urN binutils-2.14.90.0.7.orig/gas/configure.in binutils-2.14.90.0.7/gas/configure.in +--- binutils-2.14.90.0.7.orig/gas/configure.in 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/gas/configure.in 2004-04-20 01:38:23.000000000 -0600 +@@ -192,6 +192,7 @@ + alpha*-*-osf*) fmt=ecoff ;; + alpha*-*-linuxecoff*) fmt=ecoff ;; + alpha*-*-linux-gnu*) fmt=elf em=linux ;; ++ alpha*-*-linux-uclibc*) fmt=elf em=linux ;; + alpha*-*-netbsd*) fmt=elf em=nbsd ;; + alpha*-*-openbsd*) fmt=elf em=obsd ;; + +@@ -208,6 +209,7 @@ + arm*-*-conix*) fmt=elf ;; + arm-*-linux*aout*) fmt=aout em=linux ;; + arm*-*-linux-gnu*) fmt=elf em=linux ;; ++ arm*-*-linux-uclibc*) fmt=elf em=linux ;; + arm*-*-uclinux*) fmt=elf em=linux ;; + arm-*-netbsdelf*) fmt=elf em=nbsd ;; + arm-*-*n*bsd*) fmt=aout em=nbsd ;; +@@ -222,6 +224,7 @@ + avr-*-*) fmt=elf ;; + + cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; ++ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;; + cris-*-*) fmt=multi bfd_gas=yes ;; + + d10v-*-*) fmt=elf ;; +@@ -278,7 +281,9 @@ + i386-*-linux*oldld) fmt=aout em=linux ;; + i386-*-linux*coff*) fmt=coff em=linux ;; + i386-*-linux-gnu*) fmt=elf em=linux ;; ++ i386-*-linux-uclibc*) fmt=elf em=linux ;; + x86_64-*-linux-gnu*) fmt=elf em=linux ;; ++ x86_64-*-linux-uclibc*) fmt=elf em=linux ;; + i386-*-lynxos*) fmt=coff em=lynx ;; + changequote(,)dnl + i386-*-sysv[45]*) fmt=elf ;; +@@ -332,6 +337,7 @@ + ia64-*-elf*) fmt=elf ;; + ia64-*-aix*) fmt=elf em=ia64aix ;; + ia64-*-linux-gnu*) fmt=elf em=linux ;; ++ ia64-*-linux-uclibc*) fmt=elf em=linux ;; + ia64-*-hpux*) fmt=elf em=hpux ;; + ia64-*-netbsd*) fmt=elf em=nbsd ;; + +@@ -358,6 +364,7 @@ + m68k-*-hpux*) fmt=hp300 em=hp300 ;; + m68k-*-linux*aout*) fmt=aout em=linux ;; + m68k-*-linux-gnu*) fmt=elf em=linux ;; ++ m68k-*-linux-uclibc*) fmt=elf em=linux ;; + m68k-*-gnu*) fmt=elf ;; + m68k-*-lynxos*) fmt=coff em=lynx ;; + m68k-*-netbsdelf*) fmt=elf em=nbsd ;; +@@ -412,7 +419,7 @@ + ppc-*-beos*) fmt=coff ;; + ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; + ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; +- ppc-*-linux-gnu*) fmt=elf em=linux ++ ppc-*-linux-uclibc* | ppc-*-linux-gnu*) fmt=elf em=linux + case "$endian" in + big) ;; + *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; +@@ -434,7 +441,9 @@ + ppc-*-kaos*) fmt=elf ;; + + s390x-*-linux-gnu*) fmt=elf em=linux ;; ++ s390x-*-linux-uclibc*) fmt=elf em=linux ;; + s390-*-linux-gnu*) fmt=elf em=linux ;; ++ s390-*-linux-uclibc*) fmt=elf em=linux ;; + + sh*-*-linux*) fmt=elf em=linux + case ${cpu} in +@@ -467,6 +476,7 @@ + sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; + sparc-*-linux-gnu*) fmt=elf em=linux ;; ++ sparc-*-linux-uclibc*) fmt=elf em=linux ;; + sparc-*-lynxos*) fmt=coff em=lynx ;; + sparc-fujitsu-none) fmt=aout ;; + sparc-*-elf) fmt=elf ;; +diff -urN binutils-2.14.90.0.7.orig/ld/configure binutils-2.14.90.0.7/ld/configure +--- binutils-2.14.90.0.7.orig/ld/configure 2003-05-05 15:46:49.000000000 -0600 ++++ binutils-2.14.90.0.7/ld/configure 2004-04-20 01:32:29.000000000 -0600 +@@ -1578,6 +1578,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +diff -urN binutils-2.14.90.0.7.orig/ld/configure.tgt binutils-2.14.90.0.7/ld/configure.tgt +--- binutils-2.14.90.0.7.orig/ld/configure.tgt 2003-10-29 10:37:48.000000000 -0700 ++++ binutils-2.14.90.0.7/ld/configure.tgt 2004-04-20 01:32:29.000000000 -0600 +@@ -30,6 +30,7 @@ + targ_extra_emuls="criself crislinux" + targ_extra_libpath=$targ_extra_emuls ;; + cris-*-linux-gnu*) targ_emul=crislinux ;; ++cris-*-linux-uclibc*) targ_emul=crislinux ;; + cris-*-*) targ_emul=criself + targ_extra_emuls="crisaout crislinux" + targ_extra_libpath=$targ_extra_emuls ;; +@@ -59,14 +60,16 @@ + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'` + tdir_sun4=sparc-sun-sunos4 + ;; +-sparc64-*-linux-gnu*) targ_emul=elf64_sparc ++sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) \ ++ targ_emul=elf64_sparc + targ_extra_emuls="elf32_sparc sparclinux sun4" + targ_extra_libpath=elf32_sparc + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` + tdir_sparclinux=${tdir_elf32_sparc}aout + tdir_sun4=sparc-sun-sunos4 + ;; +-sparc*-*-linux-gnu*) targ_emul=elf32_sparc ++sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) \ ++ targ_emul=elf32_sparc + targ_extra_emuls="sparclinux elf64_sparc sun4" + targ_extra_libpath=elf64_sparc + tdir_sparclinux=${targ_alias}aout +@@ -125,7 +128,7 @@ + m68*-ericsson-ose) targ_emul=sun3 ;; + m68*-apple-aux*) targ_emul=m68kaux ;; + *-tandem-none) targ_emul=st2000 ;; +-i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;; ++i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;; + i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;; + i[3-7]86-*-vsta) targ_emul=vsta ;; + i[3-7]86-go32-rtems*) targ_emul=i386go32 ;; +@@ -149,14 +152,16 @@ + tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` + ;; + i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; +-i[3-7]86-*-linux-gnu*) targ_emul=elf_i386 ++i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) \ ++ targ_emul=elf_i386 + targ_extra_emuls=i386linux + if test x${want64} = xtrue; then + targ_extra_emuls="$targ_extra_emuls elf_x86_64" + fi + tdir_i386linux=${targ_alias}aout + ;; +-x86_64-*-linux-gnu*) targ_emul=elf_x86_64 ++x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) \ ++ targ_emul=elf_x86_64 + targ_extra_emuls="elf_i386 i386linux" + targ_extra_libpath=elf_i386 + tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'` +@@ -256,10 +261,13 @@ + arm9e-*-elf) targ_emul=armelf ;; + arm-*-oabi) targ_emul=armelf_oabi ;; + arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; ++arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; + arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + arm*-*-conix*) targ_emul=armelf ;; +-thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) \ ++ targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + strongarm-*-coff) targ_emul=armcoff ;; + strongarm-*-elf) targ_emul=armelf ;; + strongarm-*-kaos*) targ_emul=armelf ;; +@@ -360,7 +368,8 @@ + targ_extra_emuls=m68kelf + tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'` + ;; +-m68k-*-linux-gnu*) targ_emul=m68kelf ++m68k-*-linux-gnu* | m68k-*-linux-uclibc*) \ ++ targ_emul=m68kelf + targ_extra_emuls=m68klinux + tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` + ;; +@@ -376,9 +385,9 @@ + m68*-*-psos*) targ_emul=m68kpsos ;; + m68*-*-rtemscoff*) targ_emul=m68kcoff ;; + m68*-*-rtems*) targ_emul=m68kelf ;; +-hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;; ++hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;; + hppa*64*-*) targ_emul=elf64hppa ;; +-hppa*-*-linux-gnu*) targ_emul=hppalinux ;; ++hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;; + hppa*-*-*elf*) targ_emul=hppaelf ;; + hppa*-*-lites*) targ_emul=hppaelf ;; + hppa*-*-netbsd*) targ_emul=hppanbsd ;; +@@ -422,16 +431,20 @@ + mips*-*-rtems*) targ_emul=elf32ebmip ;; + mips*el-*-vxworks*) targ_emul=elf32elmip ;; + mips*-*-vxworks*) targ_emul=elf32ebmip ;; +-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32 ++mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) \ ++ targ_emul=elf32ltsmipn32 + targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" + ;; +-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32 ++mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) \ ++ targ_emul=elf32btsmipn32 + targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" + ;; +-mips*el-*-linux-gnu*) targ_emul=elf32ltsmip ++mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) \ ++ targ_emul=elf32ltsmip + targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" + ;; +-mips*-*-linux-gnu*) targ_emul=elf32btsmip ++mips*-*-linux-gnu* | mips*-*-linux-uclibc*) \ ++ targ_emul=elf32btsmip + targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" + ;; + mips*-*-lnews*) targ_emul=mipslnews ;; +@@ -454,6 +467,10 @@ + alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha + tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` + ;; ++alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha ++ # The following needs to be checked... ++ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` ++ ;; + alpha*-*-osf*) targ_emul=alpha ;; + alpha*-*-gnu*) targ_emul=elf64alpha ;; + alpha*-*-netware*) targ_emul=alpha ;; +diff -urN binutils-2.14.90.0.7.orig/libtool.m4 binutils-2.14.90.0.7/libtool.m4 +--- binutils-2.14.90.0.7.orig/libtool.m4 2003-05-05 15:46:46.000000000 -0600 ++++ binutils-2.14.90.0.7/libtool.m4 2004-04-20 01:32:29.000000000 -0600 +@@ -645,6 +645,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] +diff -urN binutils-2.14.90.0.7.orig/ltconfig binutils-2.14.90.0.7/ltconfig +--- binutils-2.14.90.0.7.orig/ltconfig 2003-10-29 10:37:47.000000000 -0700 ++++ binutils-2.14.90.0.7/ltconfig 2004-04-20 01:32:29.000000000 -0600 +@@ -603,6 +603,7 @@ + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in + linux-gnu*) ;; ++linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1259,6 +1260,24 @@ + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ # Note: copied from linux-gnu, and may not be appropriate. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no diff --git a/obsolete-buildroot/sources/binutils-uclibc-200-build_modules.patch b/obsolete-buildroot/sources/binutils-uclibc-200-build_modules.patch new file mode 100644 index 0000000000..e9f8e75a89 --- /dev/null +++ b/obsolete-buildroot/sources/binutils-uclibc-200-build_modules.patch @@ -0,0 +1,31 @@ +Get around an odd build failure. +diff -urN binutils-2.14.90.0.6/configure binutils-2.14.90.0.6-uClibc/configure +--- binutils-2.14.90.0.6/configure 2003-08-21 10:29:32.000000000 -0500 ++++ binutils-2.14.90.0.6-uClibc/configure 2004-01-07 05:43:40.000000000 -0600 +@@ -906,6 +906,11 @@ + fi + + ++case "$target" in ++ *-*-*-uclibc*) ++ build_modules= ++ ;; ++esac + ################################################################################ + + srcname="gnu development package" +diff -urN binutils-2.14.90.0.6/configure.in binutils-2.14.90.0.6-uClibc/configure.in +--- binutils-2.14.90.0.6/configure.in 2003-08-21 10:29:30.000000000 -0500 ++++ binutils-2.14.90.0.6-uClibc/configure.in 2004-01-07 05:44:02.000000000 -0600 +@@ -178,6 +178,11 @@ + fi + + ++case "$target" in ++ *-*-*-uclibc*) ++ build_modules= ++ ;; ++esac + ################################################################################ + + srcname="gnu development package" diff --git a/obsolete-buildroot/sources/binutils-uclibc-210-cflags.patch b/obsolete-buildroot/sources/binutils-uclibc-210-cflags.patch new file mode 100644 index 0000000000..dc67d3c4e3 --- /dev/null +++ b/obsolete-buildroot/sources/binutils-uclibc-210-cflags.patch @@ -0,0 +1,32 @@ +diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.am binutils-2.14.90.0.6.new/bfd/doc/Makefile.am +--- binutils-2.14.90.0.6/bfd/doc/Makefile.am 2003-07-23 10:08:09.000000000 -0500 ++++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.am 2004-03-01 16:05:16.000000000 -0600 +@@ -55,10 +55,10 @@ + MKDOC = chew$(EXEEXT_FOR_BUILD) + + $(MKDOC): chew.o +- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) ++ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS) + + chew.o: chew.c +- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c ++ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c + + protos: libbfd.h libcoff.h bfd.h + +diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.in binutils-2.14.90.0.6.new/bfd/doc/Makefile.in +--- binutils-2.14.90.0.6/bfd/doc/Makefile.in 2003-07-23 10:08:09.000000000 -0500 ++++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.in 2004-03-01 16:05:03.000000000 -0600 +@@ -469,10 +469,10 @@ + + + $(MKDOC): chew.o +- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) ++ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS) + + chew.o: chew.c +- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c ++ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c + + protos: libbfd.h libcoff.h bfd.h + diff --git a/obsolete-buildroot/sources/boa-config.site-i386 b/obsolete-buildroot/sources/boa-config.site-i386 new file mode 100644 index 0000000000..425d948c41 --- /dev/null +++ b/obsolete-buildroot/sources/boa-config.site-i386 @@ -0,0 +1 @@ +ac_cv_func_setvbuf_reversed=no diff --git a/obsolete-buildroot/sources/boa.conf b/obsolete-buildroot/sources/boa.conf new file mode 100644 index 0000000000..91653e5505 --- /dev/null +++ b/obsolete-buildroot/sources/boa.conf @@ -0,0 +1,187 @@ +# Boa v0.94 configuration file +# File format has not changed from 0.93 +# File format has changed little from 0.92 +# version changes are noted in the comments +# +# The Boa configuration file is parsed with a lex/yacc or flex/bison +# generated parser. If it reports an error, the line number will be +# provided; it should be easy to spot. The syntax of each of these +# rules is very simple, and they can occur in any order. Where possible +# these directives mimic those of NCSA httpd 1.3; I saw no reason to +# introduce gratuitous differences. + +# $Id$ + +# The "ServerRoot" is not in this configuration file. It can be compiled +# into the server (see defines.h) or specified on the command line with +# the -c option, for example: +# +# boa -c /usr/local/boa + + +# Port: The port Boa runs on. The default port for http servers is 80. +# If it is less than 1024, the server must be started as root. + +Port 80 + +# Listen: the Internet address to bind(2) to. If you leave it out, +# it takes the behavior before 0.93.17.2, which is to bind to all +# addresses (INADDR_ANY). You only get one "Listen" directive, +# if you want service on multiple IP addresses, you have three choices: +# 1. Run boa without a "Listen" directive +# a. All addresses are treated the same; makes sense if the addresses +# are localhost, ppp, and eth0. +# b. Use the VirtualHost directive below to point requests to different +# files. Should be good for a very large number of addresses (web +# hosting clients). +# 2. Run one copy of boa per IP address, each has its own configuration +# with a "Listen" directive. No big deal up to a few tens of addresses. +# Nice separation between clients. +# The name you provide gets run through inet_aton(3), so you have to use dotted +# quad notation. This configuration is too important to trust some DNS. + +#Listen 192.68.0.5 + +# User: The name or UID the server should run as. +# Group: The group name or GID the server should run as. + +User nobody +Group nobody + +# ServerAdmin: The email address where server problems should be sent. +# Note: this is not currently used, except as an environment variable +# for CGIs. + +#ServerAdmin root@localhost + +# ErrorLog: The location of the error log file. If this does not start +# with /, it is considered relative to the server root. +# Set to /dev/null if you don't want errors logged. +# If unset, defaults to /dev/stderr + +ErrorLog /var/log/boa/error_log +# Please NOTE: Sending the logs to a pipe ('|'), as shown below, +# is somewhat experimental and might fail under heavy load. +# "Usual libc implementations of printf will stall the whole +# process if the receiving end of a pipe stops reading." +#ErrorLog "|/usr/sbin/cronolog --symlink=/var/log/boa/error_log /var/log/boa/error-%Y%m%d.log" + +# AccessLog: The location of the access log file. If this does not +# start with /, it is considered relative to the server root. +# Comment out or set to /dev/null (less effective) to disable +# Access logging. + +AccessLog /var/log/boa/access_log +# Please NOTE: Sending the logs to a pipe ('|'), as shown below, +# is somewhat experimental and might fail under heavy load. +# "Usual libc implementations of printf will stall the whole +# process if the receiving end of a pipe stops reading." +#AccessLog "|/usr/sbin/cronolog --symlink=/var/log/boa/access_log /var/log/boa/access-%Y%m%d.log" + +# UseLocaltime: Logical switch. Uncomment to use localtime +# instead of UTC time +#UseLocaltime + +# VerboseCGILogs: this is just a logical switch. +# It simply notes the start and stop times of cgis in the error log +# Comment out to disable. + +#VerboseCGILogs + +# ServerName: the name of this server that should be sent back to +# clients if different than that returned by gethostname + gethostbyname + +#ServerName www.your.org.here + +# VirtualHost: a logical switch. +# Comment out to disable. +# Given DocumentRoot /var/www, requests on interface 'A' or IP 'IP-A' +# become /var/www/IP-A. +# Example: http://localhost/ becomes /var/www/127.0.0.1 +# +# Not used until version 0.93.17.2. This "feature" also breaks commonlog +# output rules, it prepends the interface number to each access_log line. +# You are expected to fix that problem with a postprocessing script. + +#VirtualHost + +# DocumentRoot: The root directory of the HTML documents. +# Comment out to disable server non user files. + +DocumentRoot /var/www + +# UserDir: The name of the directory which is appended onto a user's home +# directory if a ~user request is recieved. + +UserDir public_html + +# DirectoryIndex: Name of the file to use as a pre-written HTML +# directory index. Please MAKE AND USE THESE FILES. On the +# fly creation of directory indexes can be _slow_. +# Comment out to always use DirectoryMaker + +DirectoryIndex index.html + +# DirectoryMaker: Name of program used to create a directory listing. +# Comment out to disable directory listings. If both this and +# DirectoryIndex are commented out, accessing a directory will give +# an error (though accessing files in the directory are still ok). + +DirectoryMaker /usr/lib/boa/boa_indexer + +# DirectoryCache: If DirectoryIndex doesn't exist, and DirectoryMaker +# has been commented out, the the on-the-fly indexing of Boa can be used +# to generate indexes of directories. Be warned that the output is +# extremely minimal and can cause delays when slow disks are used. +# Note: The DirectoryCache must be writable by the same user/group that +# Boa runs as. + +# DirectoryCache /var/spool/boa/dircache + +# KeepAliveMax: Number of KeepAlive requests to allow per connection +# Comment out, or set to 0 to disable keepalive processing + +KeepAliveMax 1000 + +# KeepAliveTimeout: seconds to wait before keepalive connection times out + +KeepAliveTimeout 10 + +# MimeTypes: This is the file that is used to generate mime type pairs +# and Content-Type fields for boa. +# Set to /dev/null if you do not want to load a mime types file. +# Do *not* comment out (better use AddType!) + +MimeTypes /etc/mime.types + +# DefaultType: MIME type used if the file extension is unknown, or there +# is no file extension. + +DefaultType text/plain + +# AddType: adds types without editing mime.types +# Example: AddType type extension [extension ...] + +# Uncomment the next line if you want .cgi files to execute from anywhere +#AddType application/x-httpd-cgi cgi + +# Redirect, Alias, and ScriptAlias all have the same semantics -- they +# match the beginning of a request and take appropriate action. Use +# Redirect for other servers, Alias for the same server, and ScriptAlias +# to enable directories for script execution. + +# Redirect allows you to tell clients about documents which used to exist in +# your server's namespace, but do not anymore. This allows you to tell the +# clients where to look for the relocated document. +# Example: Redirect /bar http://elsewhere/feh/bar + +# Aliases: Aliases one path to another. +# Example: Alias /path1/bar /path2/foo + +# Alias /doc /usr/doc + +# ScriptAlias: Maps a virtual path to a directory for serving scripts +# Example: ScriptAlias /htbin/ /www/htbin/ + +ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ + diff --git a/obsolete-buildroot/sources/bridge.patch b/obsolete-buildroot/sources/bridge.patch new file mode 100644 index 0000000000..f44737750b --- /dev/null +++ b/obsolete-buildroot/sources/bridge.patch @@ -0,0 +1,11 @@ +--- bridge-utils-0.9.6/libbridge/Makefile.in.dist 2004-03-01 20:55:52.000000000 -0600 ++++ bridge-utils-0.9.6/libbridge/Makefile.in 2004-03-01 20:56:23.000000000 -0600 +@@ -5,7 +5,7 @@ + RANLIB=@RANLIB@ + + CC=@CC@ +-CFLAGS = -Wall -g $(KERNEL_HEADERS) ++CFLAGS = -Wall -g @CFLAGS@ $(KERNEL_HEADERS) + + prefix=@prefix@ + exec_prefix=@exec_prefix@ diff --git a/obsolete-buildroot/sources/busybox-openwrt-100-killall5.patch b/obsolete-buildroot/sources/busybox-openwrt-100-killall5.patch new file mode 100644 index 0000000000..161b7e6f25 --- /dev/null +++ b/obsolete-buildroot/sources/busybox-openwrt-100-killall5.patch @@ -0,0 +1,87 @@ +diff -urN busybox-dist/include/applets.h busybox/include/applets.h +--- busybox-dist/include/applets.h 2004-03-13 02:33:09.000000000 -0600 ++++ busybox/include/applets.h 2004-03-16 09:45:29.000000000 -0600 +@@ -313,6 +313,9 @@ + #ifdef CONFIG_KILLALL + APPLET(killall, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) + #endif ++#ifdef CONFIG_KILLALL5 ++ APPLET(killall5, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) ++#endif + #ifdef CONFIG_KLOGD + APPLET(klogd, klogd_main, _BB_DIR_SBIN, _BB_SUID_NEVER) + #endif +diff -urN busybox-dist/include/usage.h busybox/include/usage.h +--- busybox-dist/include/usage.h 2004-03-13 02:33:09.000000000 -0600 ++++ busybox/include/usage.h 2004-03-16 09:45:29.000000000 -0600 +@@ -1389,6 +1389,13 @@ + #define killall_example_usage \ + "$ killall apache\n" + ++#define killall5_trivial_usage \ ++ "" ++#define killall5_full_usage \ ++ "" ++#define killall5_example_usage \ ++ "" ++ + #define klogd_trivial_usage \ + "[-c n] [-n]" + #define klogd_full_usage \ +diff -urN busybox-dist/procps/Config.in busybox/procps/Config.in +--- busybox-dist/procps/Config.in 2003-12-24 00:02:11.000000000 -0600 ++++ busybox/procps/Config.in 2004-03-16 09:45:29.000000000 -0600 +@@ -30,6 +30,11 @@ + specified commands. If no signal name is specified, SIGTERM is + sent. + ++config CONFIG_KILLALL5 ++ bool "killall5" ++ default n ++ depends on CONFIG_KILL ++ + config CONFIG_PIDOF + bool "pidof" + default n +diff -urN busybox-dist/procps/kill.c busybox/procps/kill.c +--- busybox-dist/procps/kill.c 2004-03-15 02:29:03.000000000 -0600 ++++ busybox/procps/kill.c 2004-03-16 09:45:29.000000000 -0600 +@@ -34,6 +34,7 @@ + + #define KILL 0 + #define KILLALL 1 ++#define KILLALL5 2 + + extern int kill_main(int argc, char **argv) + { +@@ -47,6 +48,9 @@ + #else + whichApp = KILL; + #endif ++#ifdef CONFIG_KILLALL5 ++ whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp; ++#endif + + /* Parse any options */ + if (argc < 2) +@@ -119,6 +123,20 @@ + } + + } ++#ifdef CONFIG_KILLALL5 ++ else if (whichApp == KILLALL5) { ++ procps_status_t * p; ++ pid_t myPid=getpid(); ++ while ((p = procps_scan(0)) != 0) { ++ if (p->pid != 1 && p->pid != myPid && p->pid != p->ppid) { ++ if (kill(p->pid, signo) != 0) { ++ bb_perror_msg( "Could not kill pid '%d'", p->pid); ++ errors++; ++ } ++ } ++ } ++ } ++#endif + #ifdef CONFIG_KILLALL + else { + pid_t myPid=getpid(); diff --git a/obsolete-buildroot/sources/busybox-openwrt-110-telnetd.patch b/obsolete-buildroot/sources/busybox-openwrt-110-telnetd.patch new file mode 100644 index 0000000000..e95757ee4e --- /dev/null +++ b/obsolete-buildroot/sources/busybox-openwrt-110-telnetd.patch @@ -0,0 +1,53 @@ +diff -urN busybox-1.00-pre8/networking/telnetd.c busybox-1.00-pre8-openwrt/networking/telnetd.c +--- busybox-1.00-pre8/networking/telnetd.c 2004-02-22 03:45:57.000000000 -0600 ++++ busybox-1.00-pre8-openwrt/networking/telnetd.c 2004-03-05 01:32:57.000000000 -0600 +@@ -44,6 +44,8 @@ + #include + #include + #include ++#include ++ + + #include "busybox.h" + +@@ -384,11 +386,13 @@ + int portnbr = 23; + #endif /* CONFIG_FEATURE_TELNETD_INETD */ + int c; ++ char *interface_name = NULL; ++ struct ifreq interface; + static const char options[] = + #ifdef CONFIG_FEATURE_TELNETD_INETD +- "f:l:"; +-#else /* CONFIG_EATURE_TELNETD_INETD */ +- "f:l:p:"; ++ "i:f:l:"; ++#else /* CONFIG_FEATURE_TELNETD_INETD */ ++ "i:f:l:p:"; + #endif /* CONFIG_FEATURE_TELNETD_INETD */ + int maxlen, w, r; + +@@ -403,6 +407,9 @@ + case 'f': + issuefile = strdup (optarg); + break; ++ case 'i': ++ interface_name = strdup(optarg); ++ break; + case 'l': + loginpath = strdup (optarg); + break; +@@ -442,6 +449,13 @@ + sa.sin_family = AF_INET; + sa.sin_port = htons(portnbr); + ++ /* Set it to listen on the specified interface */ ++ if (interface_name) { ++ strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ); ++ (void)setsockopt(master_fd, SOL_SOCKET, ++ SO_BINDTODEVICE, &interface, sizeof(interface)); ++ } ++ + if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { + bb_perror_msg_and_die("bind"); + } diff --git a/obsolete-buildroot/sources/busybox-openwrt-120-udhcp.patch b/obsolete-buildroot/sources/busybox-openwrt-120-udhcp.patch new file mode 100644 index 0000000000..f8e8d33b3a --- /dev/null +++ b/obsolete-buildroot/sources/busybox-openwrt-120-udhcp.patch @@ -0,0 +1,129 @@ +diff -urN busybox-dist/networking/udhcp/dumpleases.c busybox/networking/udhcp/dumpleases.c +--- busybox-dist/networking/udhcp/dumpleases.c 2004-03-15 02:29:00.000000000 -0600 ++++ busybox/networking/udhcp/dumpleases.c 2004-03-16 09:52:32.000000000 -0600 +@@ -42,7 +42,7 @@ + #endif + { + FILE *fp; +- int i, c, mode = REMAINING; ++ int i, c, mode = ABSOLUTE; + long expires; + const char *file = LEASES_FILE; + struct dhcpOfferedAddr lease; +@@ -73,7 +73,7 @@ + + fp = xfopen(file, "r"); + +- printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at"); ++ printf("Mac Address IP-Address Hostname Expires %s\n", mode == REMAINING ? "in" : "at"); + /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */ + while (fread(&lease, sizeof(lease), 1, fp)) { + +@@ -84,7 +84,8 @@ + addr.s_addr = lease.yiaddr; + printf(" %-15s", inet_ntoa(addr)); + expires = ntohl(lease.expires); +- printf(" "); ++ //expires = lease.expires; ++ printf(" %-15s ",lease.hostname); + if (mode == REMAINING) { + if (!expires) printf("expired\n"); + else { +diff -urN busybox-dist/networking/udhcp/files.c busybox/networking/udhcp/files.c +--- busybox-dist/networking/udhcp/files.c 2004-03-15 02:29:00.000000000 -0600 ++++ busybox/networking/udhcp/files.c 2004-03-16 09:50:04.000000000 -0600 +@@ -281,7 +281,7 @@ + if (lease.yiaddr >= server_config.start && lease.yiaddr <= server_config.end) { + lease.expires = ntohl(lease.expires); + if (!server_config.remaining) lease.expires -= time(0); +- if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) { ++ if (!(add_lease(lease.hostname, lease.chaddr, lease.yiaddr, lease.expires))) { + LOG(LOG_WARNING, "Too many leases while loading %s\n", file); + break; + } +diff -urN busybox-dist/networking/udhcp/leases.c busybox/networking/udhcp/leases.c +--- busybox-dist/networking/udhcp/leases.c 2004-03-15 02:29:00.000000000 -0600 ++++ busybox/networking/udhcp/leases.c 2004-03-16 09:50:04.000000000 -0600 +@@ -35,7 +35,7 @@ + + + /* add a lease into the table, clearing out any old ones */ +-struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease) ++struct dhcpOfferedAddr *add_lease(uint8_t *hostname, uint8_t *chaddr, uint32_t yiaddr, unsigned long lease) + { + struct dhcpOfferedAddr *oldest; + +@@ -45,6 +45,13 @@ + oldest = oldest_expired_lease(); + + if (oldest) { ++ if (hostname) { ++ uint8_t length = *(hostname-1); ++ if (length>15) length=15; ++ memcpy(oldest->hostname,hostname,length); ++ oldest->hostname[length]=0; ++ } ++ + memcpy(oldest->chaddr, chaddr, 16); + oldest->yiaddr = yiaddr; + oldest->expires = time(0) + lease; +@@ -112,7 +119,7 @@ + temp.s_addr = addr; + LOG(LOG_INFO, "%s belongs to someone, reserving it for %ld seconds", + inet_ntoa(temp), server_config.conflict_time); +- add_lease(blank_chaddr, addr, server_config.conflict_time); ++ add_lease(blank_chaddr, blank_chaddr, addr, server_config.conflict_time); + return 1; + } else return 0; + } +diff -urN busybox-dist/networking/udhcp/leases.h busybox/networking/udhcp/leases.h +--- busybox-dist/networking/udhcp/leases.h 2004-01-30 17:45:12.000000000 -0600 ++++ busybox/networking/udhcp/leases.h 2004-03-16 09:50:04.000000000 -0600 +@@ -4,6 +4,7 @@ + + + struct dhcpOfferedAddr { ++ uint8_t hostname[16]; + uint8_t chaddr[16]; + uint32_t yiaddr; /* network order */ + uint32_t expires; /* host order */ +@@ -12,7 +13,7 @@ + extern uint8_t blank_chaddr[]; + + void clear_lease(uint8_t *chaddr, uint32_t yiaddr); +-struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease); ++struct dhcpOfferedAddr *add_lease(uint8_t *hostname, uint8_t *chaddr, uint32_t yiaddr, unsigned long lease); + int lease_expired(struct dhcpOfferedAddr *lease); + struct dhcpOfferedAddr *oldest_expired_lease(void); + struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr); +diff -urN busybox-dist/networking/udhcp/serverpacket.c busybox/networking/udhcp/serverpacket.c +--- busybox-dist/networking/udhcp/serverpacket.c 2004-03-15 02:29:01.000000000 -0600 ++++ busybox/networking/udhcp/serverpacket.c 2004-03-16 09:51:36.000000000 -0600 +@@ -29,6 +29,7 @@ + #include "dhcpd.h" + #include "options.h" + #include "common.h" ++#include "files.h" + + /* send a packet to giaddr using the kernel ip stack */ + static int send_packet_to_relay(struct dhcpMessage *payload) +@@ -152,7 +153,7 @@ + return -1; + } + +- if (!add_lease(packet.chaddr, packet.yiaddr, server_config.offer_time)) { ++ if (!add_lease(get_option(oldpacket, DHCP_HOST_NAME), packet.chaddr, packet.yiaddr, server_config.offer_time)) { + LOG(LOG_WARNING, "lease pool is full -- OFFER abandoned"); + return -1; + } +@@ -233,7 +234,9 @@ + if (send_packet(&packet, 0) < 0) + return -1; + +- add_lease(packet.chaddr, packet.yiaddr, lease_time_align); ++ add_lease(get_option(oldpacket, DHCP_HOST_NAME), packet.chaddr, packet.yiaddr, lease_time_align); ++ ++ write_leases(); + + return 0; + } diff --git a/obsolete-buildroot/sources/busybox-openwrt-130-resetmon.patch b/obsolete-buildroot/sources/busybox-openwrt-130-resetmon.patch new file mode 100644 index 0000000000..b41315e1f7 --- /dev/null +++ b/obsolete-buildroot/sources/busybox-openwrt-130-resetmon.patch @@ -0,0 +1,89 @@ +diff -urN busybox-dist/include/applets.h busybox/include/applets.h +--- busybox-dist/include/applets.h 2004-03-16 09:56:27.000000000 -0600 ++++ busybox/include/applets.h 2004-03-16 10:00:14.000000000 -0600 +@@ -484,6 +484,9 @@ + #ifdef CONFIG_RESET + APPLET(reset, reset_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) + #endif ++#ifdef CONFIG_RESETMON ++ APPLET(resetmon, resetmon_main, _BB_DIR_SBIN, _BB_SUID_NEVER) ++#endif + #ifdef CONFIG_RM + APPLET(rm, rm_main, _BB_DIR_BIN, _BB_SUID_NEVER) + #endif +diff -urN busybox-dist/include/usage.h busybox/include/usage.h +--- busybox-dist/include/usage.h 2004-03-16 09:56:27.000000000 -0600 ++++ busybox/include/usage.h 2004-03-16 10:00:14.000000000 -0600 +@@ -2024,6 +2024,11 @@ + #define reset_full_usage \ + "Resets the screen." + ++#define resetmon_trivial_usage \ ++ "" ++#define resetmon_full_usage \ ++ "Return an exit code of TRUE (0) if reset is NOT pressed." ++ + #define rm_trivial_usage \ + "[OPTION]... FILE..." + #define rm_full_usage \ +diff -urN busybox-dist/miscutils/Config.in busybox/miscutils/Config.in +--- busybox-dist/miscutils/Config.in 2004-03-15 02:28:46.000000000 -0600 ++++ busybox/miscutils/Config.in 2004-03-16 10:00:14.000000000 -0600 +@@ -156,6 +156,12 @@ + to advance or rewind a tape past a specified number of archive + files on the tape. + ++config CONFIG_RESETMON ++ bool "resetmon" ++ default y ++ help ++ Linksys wrt54g reset button monitor. Returns TRUE if NOT pressed. ++ + config CONFIG_RX + bool "rx" + default n +diff -urN busybox-dist/miscutils/Makefile.in busybox/miscutils/Makefile.in +--- busybox-dist/miscutils/Makefile.in 2004-03-15 02:28:46.000000000 -0600 ++++ busybox/miscutils/Makefile.in 2004-03-16 10:00:14.000000000 -0600 +@@ -33,6 +33,7 @@ + MISCUTILS-$(CONFIG_LAST) += last.o + MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o + MISCUTILS-$(CONFIG_MT) += mt.o ++MISCUTILS-$(CONFIG_RESETMON) += resetmon.o + MISCUTILS-$(CONFIG_RX) += rx.o + MISCUTILS-$(CONFIG_STRINGS) += strings.o + MISCUTILS-$(CONFIG_TIME) += time.o +diff -urN busybox-dist/miscutils/resetmon.c busybox/miscutils/resetmon.c +--- busybox-dist/miscutils/resetmon.c 1969-12-31 18:00:00.000000000 -0600 ++++ busybox/miscutils/resetmon.c 2004-03-16 10:00:14.000000000 -0600 +@@ -0,0 +1,30 @@ ++#include ++#include ++#include "busybox.h" ++ ++#define RESET (1<<6) ++ ++int resetmon_main(int argc, char **argv) { ++ int fd = -1; ++ unsigned int val=0; ++ ++#if 0 ++ if ((fd = open("/dev/gpio/control",O_RDWR))<0) goto error; ++ read(fd,&val,4); ++ val|=RESET; ++ write(fd,&val,4); ++ ++ if ((fd = open("/dev/gpio/outen",O_RDWR))<0) goto error; ++ read(fd,&val,4); ++ val&=~RESET; ++ write(fd,&val,4); ++#endif ++ ++ if ((fd = open("/dev/gpio/in",O_RDONLY))<0) goto error; ++ read(fd,&val,4); ++ ++ return !(val&RESET); ++ ++error: ++ return 1; ++} diff --git a/obsolete-buildroot/sources/busybox.config b/obsolete-buildroot/sources/busybox.config new file mode 100644 index 0000000000..a461e1fb57 --- /dev/null +++ b/obsolete-buildroot/sources/busybox.config @@ -0,0 +1,459 @@ +# +# Automatically generated make config: don't edit +# +HAVE_DOT_CONFIG=y + +# +# General Configuration +# +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_FEATURE_VERBOSE_USAGE=y +# CONFIG_FEATURE_INSTALLER is not set +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_FEATURE_DEVFS=y +CONFIG_FEATURE_DEVPTS=y +# CONFIG_FEATURE_CLEAN_UP is not set +# CONFIG_FEATURE_SUID is not set +# CONFIG_SELINUX is not set + +# +# Build Options +# +# CONFIG_STATIC is not set +CONFIG_LFS=y +USING_CROSS_COMPILER=y +CROSS_COMPILER_PREFIX="mipsel-uclibc-" +EXTRA_CFLAGS_OPTIONS="-Os " + +# +# Installation Options +# +# CONFIG_INSTALL_NO_USR is not set +PREFIX="./_install" + +# +# Archival Utilities +# +# CONFIG_AR is not set +CONFIG_BUNZIP2=y +# CONFIG_CPIO is not set +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +CONFIG_GUNZIP=y +CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y +CONFIG_GZIP=y +# CONFIG_RPM2CPIO is not set +# CONFIG_RPM is not set +CONFIG_TAR=y +CONFIG_FEATURE_TAR_CREATE=y +CONFIG_FEATURE_TAR_BZIP2=y +# CONFIG_FEATURE_TAR_FROM is not set +CONFIG_FEATURE_TAR_GZIP=y +# CONFIG_FEATURE_TAR_COMPRESS is not set +CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set +# CONFIG_UNCOMPRESS is not set +# CONFIG_UNZIP is not set + +# +# Common options for cpio and tar +# +# CONFIG_FEATURE_UNARCHIVE_TAPE is not set + +# +# Coreutils +# +CONFIG_BASENAME=y +# CONFIG_CAL is not set +CONFIG_CAT=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +CONFIG_CHROOT=y +# CONFIG_CMP is not set +CONFIG_CP=y +CONFIG_CUT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +CONFIG_DD=y +CONFIG_DF=y +# CONFIG_DIRNAME is not set +# CONFIG_DOS2UNIX is not set +# CONFIG_DU is not set +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +CONFIG_EXPR=y +CONFIG_FALSE=y +# CONFIG_FOLD is not set +CONFIG_HEAD=y +# CONFIG_FEATURE_FANCY_HEAD is not set +CONFIG_HOSTID=y +# CONFIG_ID is not set +CONFIG_INSTALL=y +CONFIG_LENGTH=y +CONFIG_LN=y +# CONFIG_LOGNAME is not set +CONFIG_LS=y +CONFIG_FEATURE_LS_FILETYPES=y +CONFIG_FEATURE_LS_FOLLOWLINKS=y +CONFIG_FEATURE_LS_RECURSIVE=y +CONFIG_FEATURE_LS_SORTFILES=y +CONFIG_FEATURE_LS_TIMESTAMPS=y +CONFIG_FEATURE_LS_USERNAME=y +CONFIG_FEATURE_LS_COLOR=y +CONFIG_MD5SUM=y +CONFIG_MKDIR=y +CONFIG_MKFIFO=y +# CONFIG_MKNOD is not set +CONFIG_MV=y +# CONFIG_OD is not set +# CONFIG_PRINTF is not set +CONFIG_PWD=y +# CONFIG_REALPATH is not set +CONFIG_RM=y +CONFIG_RMDIR=y +# CONFIG_SEQ is not set +# CONFIG_SHA1SUM is not set +CONFIG_SLEEP=y +CONFIG_FEATURE_FANCY_SLEEP=y +CONFIG_SORT=y +# CONFIG_STTY is not set +CONFIG_SYNC=y +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y +CONFIG_TEE=y +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TEST=y + +# +# test (forced enabled for use with shell) +# +CONFIG_TOUCH=y +# CONFIG_TR is not set +CONFIG_TRUE=y +# CONFIG_TTY is not set +CONFIG_UNAME=y +CONFIG_UNIQ=y +# CONFIG_USLEEP is not set +# CONFIG_UUDECODE is not set +# CONFIG_UUENCODE is not set +# CONFIG_WATCH is not set +CONFIG_WC=y +# CONFIG_WHO is not set +# CONFIG_WHOAMI is not set +CONFIG_YES=y + +# +# Common options for cp and mv +# +CONFIG_FEATURE_PRESERVE_HARDLINKS=y + +# +# Common options for ls and more +# +CONFIG_FEATURE_AUTOWIDTH=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y + +# +# Common options for md5sum, sha1sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y + +# +# Console Utilities +# +# CONFIG_CHVT is not set +CONFIG_CLEAR=y +# CONFIG_DEALLOCVT is not set +# CONFIG_DUMPKMAP is not set +# CONFIG_LOADFONT is not set +# CONFIG_LOADKMAP is not set +# CONFIG_OPENVT is not set +CONFIG_RESET=y +# CONFIG_SETKEYCODES is not set + +# +# Debian Utilities +# +CONFIG_MKTEMP=y +# CONFIG_PIPE_PROGRESS is not set +# CONFIG_READLINK is not set +CONFIG_RUN_PARTS=y +# CONFIG_START_STOP_DAEMON is not set +CONFIG_WHICH=y + +# +# Editors +# +CONFIG_AWK=y +CONFIG_FEATURE_AWK_MATH=y +CONFIG_PATCH=y +CONFIG_SED=y +CONFIG_VI=y +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_SEARCH=y +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y + +# +# Finding Utilities +# +CONFIG_FIND=y +# CONFIG_FEATURE_FIND_MTIME is not set +CONFIG_FEATURE_FIND_PERM=y +CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_XDEV=y +# CONFIG_FEATURE_FIND_NEWER is not set +# CONFIG_FEATURE_FIND_INUM is not set +CONFIG_GREP=y +CONFIG_FEATURE_GREP_EGREP_ALIAS=y +CONFIG_FEATURE_GREP_FGREP_ALIAS=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y +CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y + +# +# Init Utilities +# +CONFIG_INIT=y +CONFIG_FEATURE_USE_INITTAB=y +# CONFIG_FEATURE_INITRD is not set +# CONFIG_FEATURE_INIT_COREDUMPS is not set +# CONFIG_FEATURE_EXTRA_QUIET is not set +# CONFIG_HALT is not set +# CONFIG_POWEROFF is not set +CONFIG_REBOOT=y +CONFIG_MESG=y + +# +# Login/Password Management Utilities +# +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_ADDGROUP is not set +# CONFIG_DELGROUP is not set +# CONFIG_ADDUSER is not set +# CONFIG_DELUSER is not set +# CONFIG_GETTY is not set +# CONFIG_LOGIN is not set +CONFIG_PASSWD=y +# CONFIG_SU is not set +# CONFIG_SULOGIN is not set +# CONFIG_VLOCK is not set + +# +# Miscellaneous Utilities +# +# CONFIG_ADJTIMEX is not set +CONFIG_CROND=y +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +CONFIG_CRONTAB=y +# CONFIG_DC is not set +# CONFIG_DEVFSD is not set +# CONFIG_LAST is not set +# CONFIG_HDPARM is not set +# CONFIG_MAKEDEVS is not set +# CONFIG_MT is not set +CONFIG_RESETMON=y +# CONFIG_RX is not set +CONFIG_STRINGS=y +CONFIG_TIME=y +# CONFIG_WATCHDOG is not set + +# +# Linux Module Utilities +# +CONFIG_INSMOD=y +# CONFIG_FEATURE_2_2_MODULES is not set +CONFIG_FEATURE_2_4_MODULES=y +# CONFIG_FEATURE_2_6_MODULES is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +CONFIG_LSMOD=y +CONFIG_FEATURE_QUERY_MODULE_INTERFACE=y +# CONFIG_MODPROBE is not set +CONFIG_RMMOD=y +# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set + +# +# Networking Utilities +# +CONFIG_FEATURE_IPV6=y +CONFIG_ARPING=y +# CONFIG_FTPGET is not set +# CONFIG_FTPPUT is not set +# CONFIG_HOSTNAME is not set +CONFIG_HTTPD=y +# CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY is not set +CONFIG_FEATURE_HTTPD_BASIC_AUTH=y +CONFIG_FEATURE_HTTPD_AUTH_MD5=y +CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP=y +# CONFIG_FEATURE_HTTPD_SETUID is not set +CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES=y +CONFIG_FEATURE_HTTPD_CGI=y +CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y +CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +# CONFIG_FEATURE_IFCONFIG_SLIP is not set +# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set +CONFIG_FEATURE_IFCONFIG_HW=y +CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y +# CONFIG_IFUPDOWN is not set +# CONFIG_INETD is not set +# CONFIG_IP is not set +CONFIG_IPCALC=y +CONFIG_FEATURE_IPCALC_FANCY=y +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_IPTUNNEL is not set +# CONFIG_NAMEIF is not set +CONFIG_NC=y +CONFIG_NETSTAT=y +CONFIG_NSLOOKUP=y +CONFIG_PING=y +CONFIG_FEATURE_FANCY_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING6=y +CONFIG_ROUTE=y +# CONFIG_TELNET is not set +CONFIG_TELNETD=y +# CONFIG_FEATURE_TELNETD_INETD is not set +# CONFIG_TFTP is not set +CONFIG_TRACEROUTE=y +CONFIG_FEATURE_TRACEROUTE_VERBOSE=y +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_IP6_LITERAL=y + +# +# udhcp Server/Client +# +CONFIG_UDHCPD=y +CONFIG_UDHCPC=y +CONFIG_DUMPLEASES=y +# CONFIG_FEATURE_UDHCP_SYSLOG is not set +# CONFIG_FEATURE_UDHCP_DEBUG is not set + +# +# Process Utilities +# +CONFIG_FREE=y +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y +CONFIG_PIDOF=y +CONFIG_PS=y +# CONFIG_RENICE is not set +CONFIG_TOP=y +FEATURE_CPU_USAGE_PERCENTAGE=y +CONFIG_UPTIME=y +CONFIG_SYSCTL=y + +# +# Another Bourne-like Shell +# +CONFIG_FEATURE_SH_IS_ASH=y +# CONFIG_FEATURE_SH_IS_HUSH is not set +# CONFIG_FEATURE_SH_IS_LASH is not set +# CONFIG_FEATURE_SH_IS_MSH is not set +# CONFIG_FEATURE_SH_IS_NONE is not set +CONFIG_ASH=y + +# +# Ash Shell Options +# +CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_MATH_SUPPORT=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_CMDCMD=y +# CONFIG_ASH_MAIL is not set +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +# CONFIG_ASH_RANDOM_SUPPORT is not set +# CONFIG_HUSH is not set +# CONFIG_LASH is not set +# CONFIG_MSH is not set + +# +# Bourne Shell Options +# +# CONFIG_FEATURE_SH_EXTRA_QUIET is not set +# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set +CONFIG_FEATURE_COMMAND_EDITING=y +CONFIG_FEATURE_COMMAND_HISTORY=15 +# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set +CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y +# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set +CONFIG_FEATURE_SH_FANCY_PROMPT=y + +# +# System Logging Utilities +# +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +CONFIG_FEATURE_IPC_SYSLOG=y +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 +CONFIG_LOGREAD=y +# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set +CONFIG_KLOGD=y +CONFIG_LOGGER=y + +# +# Linux System Utilities +# +CONFIG_DMESG=y +# CONFIG_FBSET is not set +# CONFIG_FDFLUSH is not set +# CONFIG_FDFORMAT is not set +# CONFIG_FDISK is not set +# CONFIG_FREERAMDISK is not set +# CONFIG_FSCK_MINIX is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_GETOPT is not set +CONFIG_HEXDUMP=y +# CONFIG_HWCLOCK is not set +# CONFIG_LOSETUP is not set +# CONFIG_MKSWAP is not set +CONFIG_MORE=y +CONFIG_FEATURE_USE_TERMIOS=y +CONFIG_PIVOT_ROOT=y +CONFIG_RDATE=y +# CONFIG_SWAPONOFF is not set +CONFIG_MOUNT=y +CONFIG_NFSMOUNT=y +CONFIG_UMOUNT=y +CONFIG_FEATURE_MOUNT_FORCE=y + +# +# Common options for mount/umount +# +CONFIG_FEATURE_MOUNT_LOOP=y +# CONFIG_FEATURE_MTAB_SUPPORT is not set + +# +# Debugging Options +# +# CONFIG_DEBUG is not set diff --git a/obsolete-buildroot/sources/busybox.config-openwrt b/obsolete-buildroot/sources/busybox.config-openwrt new file mode 100644 index 0000000000..488e331e34 --- /dev/null +++ b/obsolete-buildroot/sources/busybox.config-openwrt @@ -0,0 +1,478 @@ +# +# Automatically generated make config: don't edit +# +HAVE_DOT_CONFIG=y + +# +# General Configuration +# +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_FEATURE_VERBOSE_USAGE=y +# CONFIG_FEATURE_INSTALLER is not set +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_FEATURE_DEVFS=y +CONFIG_FEATURE_DEVPTS=y +# CONFIG_FEATURE_CLEAN_UP is not set +# CONFIG_FEATURE_SUID is not set +# CONFIG_SELINUX is not set + +# +# Build Options +# +# CONFIG_STATIC is not set +CONFIG_LFS=y +USING_CROSS_COMPILER=y +CROSS_COMPILER_PREFIX="mipsel-uclibc-" +EXTRA_CFLAGS_OPTIONS="-Os " + +# +# Installation Options +# +# CONFIG_INSTALL_NO_USR is not set +PREFIX="./_install" + +# +# Archival Utilities +# +# CONFIG_AR is not set +CONFIG_BUNZIP2=y +# CONFIG_CPIO is not set +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +CONFIG_GUNZIP=y +CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y +CONFIG_GZIP=y +# CONFIG_RPM2CPIO is not set +# CONFIG_RPM is not set +CONFIG_TAR=y +CONFIG_FEATURE_TAR_CREATE=y +CONFIG_FEATURE_TAR_BZIP2=y +# CONFIG_FEATURE_TAR_FROM is not set +CONFIG_FEATURE_TAR_GZIP=y +# CONFIG_FEATURE_TAR_COMPRESS is not set +CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set +# CONFIG_UNCOMPRESS is not set +# CONFIG_UNZIP is not set + +# +# Common options for cpio and tar +# +# CONFIG_FEATURE_UNARCHIVE_TAPE is not set + +# +# Coreutils +# +CONFIG_BASENAME=y +# CONFIG_CAL is not set +CONFIG_CAT=y +# CONFIG_CHGRP is not set +CONFIG_CHMOD=y +# CONFIG_CHOWN is not set +CONFIG_CHROOT=y +# CONFIG_CMP is not set +CONFIG_CP=y +CONFIG_CUT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +CONFIG_DD=y +CONFIG_DF=y +# CONFIG_DIRNAME is not set +# CONFIG_DOS2UNIX is not set +# CONFIG_DU is not set +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +CONFIG_EXPR=y +CONFIG_FALSE=y +# CONFIG_FOLD is not set +CONFIG_HEAD=y +# CONFIG_FEATURE_FANCY_HEAD is not set +CONFIG_HOSTID=y +# CONFIG_ID is not set +CONFIG_INSTALL=y +CONFIG_LENGTH=y +CONFIG_LN=y +# CONFIG_LOGNAME is not set +CONFIG_LS=y +CONFIG_FEATURE_LS_FILETYPES=y +CONFIG_FEATURE_LS_FOLLOWLINKS=y +CONFIG_FEATURE_LS_RECURSIVE=y +CONFIG_FEATURE_LS_SORTFILES=y +CONFIG_FEATURE_LS_TIMESTAMPS=y +CONFIG_FEATURE_LS_USERNAME=y +CONFIG_FEATURE_LS_COLOR=y +CONFIG_MD5SUM=y +CONFIG_MKDIR=y +CONFIG_MKFIFO=y +# CONFIG_MKNOD is not set +CONFIG_MV=y +# CONFIG_OD is not set +# CONFIG_PRINTF is not set +CONFIG_PWD=y +# CONFIG_REALPATH is not set +CONFIG_RM=y +CONFIG_RMDIR=y +# CONFIG_SEQ is not set +# CONFIG_SHA1SUM is not set +CONFIG_SLEEP=y +CONFIG_FEATURE_FANCY_SLEEP=y +CONFIG_SORT=y +# CONFIG_STTY is not set +CONFIG_SYNC=y +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y +CONFIG_TEE=y +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TEST=y + +# +# test (forced enabled for use with shell) +# +CONFIG_TOUCH=y +# CONFIG_TR is not set +CONFIG_TRUE=y +# CONFIG_TTY is not set +CONFIG_UNAME=y +CONFIG_UNIQ=y +# CONFIG_USLEEP is not set +# CONFIG_UUDECODE is not set +# CONFIG_UUENCODE is not set +# CONFIG_WATCH is not set +CONFIG_WC=y +# CONFIG_WHO is not set +# CONFIG_WHOAMI is not set +CONFIG_YES=y + +# +# Common options for cp and mv +# +CONFIG_FEATURE_PRESERVE_HARDLINKS=y + +# +# Common options for ls and more +# +CONFIG_FEATURE_AUTOWIDTH=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y + +# +# Common options for md5sum, sha1sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y + +# +# Console Utilities +# +# CONFIG_CHVT is not set +CONFIG_CLEAR=y +# CONFIG_DEALLOCVT is not set +# CONFIG_DUMPKMAP is not set +# CONFIG_LOADFONT is not set +# CONFIG_LOADKMAP is not set +# CONFIG_OPENVT is not set +CONFIG_RESET=y +# CONFIG_SETKEYCODES is not set + +# +# Debian Utilities +# +CONFIG_MKTEMP=y +# CONFIG_PIPE_PROGRESS is not set +# CONFIG_READLINK is not set +CONFIG_RUN_PARTS=y +# CONFIG_START_STOP_DAEMON is not set +CONFIG_WHICH=y + +# +# Editors +# +CONFIG_AWK=y +CONFIG_FEATURE_AWK_MATH=y +CONFIG_PATCH=y +CONFIG_SED=y +CONFIG_VI=y +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_SEARCH=y +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y + +# +# Finding Utilities +# +CONFIG_FIND=y +# CONFIG_FEATURE_FIND_MTIME is not set +CONFIG_FEATURE_FIND_PERM=y +CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_XDEV=y +# CONFIG_FEATURE_FIND_NEWER is not set +# CONFIG_FEATURE_FIND_INUM is not set +CONFIG_GREP=y +CONFIG_FEATURE_GREP_EGREP_ALIAS=y +CONFIG_FEATURE_GREP_FGREP_ALIAS=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y +CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y + +# +# Init Utilities +# +CONFIG_INIT=y +CONFIG_FEATURE_USE_INITTAB=y +# CONFIG_FEATURE_INITRD is not set +# CONFIG_FEATURE_INIT_COREDUMPS is not set +# CONFIG_FEATURE_EXTRA_QUIET is not set +# CONFIG_HALT is not set +# CONFIG_POWEROFF is not set +CONFIG_REBOOT=y +CONFIG_MESG=y + +# +# Login/Password Management Utilities +# +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_ADDGROUP is not set +# CONFIG_DELGROUP is not set +# CONFIG_ADDUSER is not set +# CONFIG_DELUSER is not set +# CONFIG_GETTY is not set +# CONFIG_LOGIN is not set +CONFIG_PASSWD=y +# CONFIG_SU is not set +# CONFIG_SULOGIN is not set +# CONFIG_VLOCK is not set + +# +# Miscellaneous Utilities +# +# CONFIG_ADJTIMEX is not set +CONFIG_CROND=y +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +CONFIG_CRONTAB=y +# CONFIG_DC is not set +# CONFIG_DEVFSD is not set +# CONFIG_LAST is not set +# CONFIG_HDPARM is not set +# CONFIG_MAKEDEVS is not set +# CONFIG_MT is not set +CONFIG_RESETMON=y +# CONFIG_RX is not set +CONFIG_STRINGS=y +CONFIG_TIME=y +# CONFIG_WATCHDOG is not set + +# +# Linux Module Utilities +# +CONFIG_INSMOD=y +# CONFIG_FEATURE_2_2_MODULES is not set +CONFIG_FEATURE_2_4_MODULES=y +# CONFIG_FEATURE_2_6_MODULES is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +# CONFIG_LSMOD is not set +# CONFIG_MODPROBE is not set +CONFIG_RMMOD=y +# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set + +# +# Networking Utilities +# +CONFIG_FEATURE_IPV6=y +CONFIG_ARPING=y +# CONFIG_FTPGET is not set +# CONFIG_FTPPUT is not set +# CONFIG_HOSTNAME is not set +CONFIG_HTTPD=y +# CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY is not set +CONFIG_FEATURE_HTTPD_BASIC_AUTH=y +CONFIG_FEATURE_HTTPD_AUTH_MD5=y +CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP=y +# CONFIG_FEATURE_HTTPD_SETUID is not set +CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES=y +CONFIG_FEATURE_HTTPD_CGI=y +CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y +CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +# CONFIG_FEATURE_IFCONFIG_SLIP is not set +# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set +CONFIG_FEATURE_IFCONFIG_HW=y +CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y +# CONFIG_IFUPDOWN is not set +# CONFIG_INETD is not set +CONFIG_IP=y +CONFIG_FEATURE_IP_ADDRESS=y + +# +# address (forced enabled for ipaddr) +# +CONFIG_FEATURE_IP_LINK=y + +# +# link (forced enabled for iplink) +# +CONFIG_FEATURE_IP_ROUTE=y + +# +# route (forced enabled for iproute) +# +CONFIG_FEATURE_IP_TUNNEL=y + +# +# tunnel (forced enabled for iptunnel) +# +CONFIG_IPCALC=y +CONFIG_FEATURE_IPCALC_FANCY=y +CONFIG_IPADDR=y +CONFIG_IPLINK=y +CONFIG_IPROUTE=y +CONFIG_IPTUNNEL=y +CONFIG_NAMEIF=y +CONFIG_NC=y +CONFIG_NETSTAT=y +CONFIG_NSLOOKUP=y +CONFIG_PING=y +CONFIG_FEATURE_FANCY_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING6=y +CONFIG_ROUTE=y +# CONFIG_TELNET is not set +CONFIG_TELNETD=y +# CONFIG_FEATURE_TELNETD_INETD is not set +# CONFIG_TFTP is not set +CONFIG_TRACEROUTE=y +CONFIG_FEATURE_TRACEROUTE_VERBOSE=y +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_IP6_LITERAL=y + +# +# udhcp Server/Client +# +CONFIG_UDHCPD=y +CONFIG_UDHCPC=y +CONFIG_DUMPLEASES=y +# CONFIG_FEATURE_UDHCP_SYSLOG is not set +# CONFIG_FEATURE_UDHCP_DEBUG is not set + +# +# Process Utilities +# +CONFIG_FREE=y +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y +CONFIG_PIDOF=y +CONFIG_PS=y +# CONFIG_RENICE is not set +CONFIG_TOP=y +FEATURE_CPU_USAGE_PERCENTAGE=y +CONFIG_UPTIME=y +# CONFIG_SYSCTL is not set + +# +# Another Bourne-like Shell +# +CONFIG_FEATURE_SH_IS_ASH=y +# CONFIG_FEATURE_SH_IS_HUSH is not set +# CONFIG_FEATURE_SH_IS_LASH is not set +# CONFIG_FEATURE_SH_IS_MSH is not set +# CONFIG_FEATURE_SH_IS_NONE is not set +CONFIG_ASH=y + +# +# Ash Shell Options +# +CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_MATH_SUPPORT=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_CMDCMD=y +# CONFIG_ASH_MAIL is not set +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +# CONFIG_ASH_RANDOM_SUPPORT is not set +# CONFIG_HUSH is not set +# CONFIG_LASH is not set +# CONFIG_MSH is not set + +# +# Bourne Shell Options +# +CONFIG_FEATURE_SH_EXTRA_QUIET=y +# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set +CONFIG_FEATURE_COMMAND_EDITING=y +CONFIG_FEATURE_COMMAND_HISTORY=15 +# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set +CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y +# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set +CONFIG_FEATURE_SH_FANCY_PROMPT=y + +# +# System Logging Utilities +# +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +CONFIG_FEATURE_IPC_SYSLOG=y +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 +CONFIG_LOGREAD=y +# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set +CONFIG_KLOGD=y +CONFIG_LOGGER=y + +# +# Linux System Utilities +# +CONFIG_DMESG=y +# CONFIG_FBSET is not set +# CONFIG_FDFLUSH is not set +# CONFIG_FDFORMAT is not set +# CONFIG_FDISK is not set +# CONFIG_FREERAMDISK is not set +# CONFIG_FSCK_MINIX is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_GETOPT is not set +CONFIG_HEXDUMP=y +# CONFIG_HWCLOCK is not set +# CONFIG_LOSETUP is not set +# CONFIG_MKSWAP is not set +CONFIG_MORE=y +CONFIG_FEATURE_USE_TERMIOS=y +CONFIG_PIVOT_ROOT=y +CONFIG_RDATE=y +# CONFIG_SWAPONOFF is not set +CONFIG_MOUNT=y +CONFIG_NFSMOUNT=y +CONFIG_UMOUNT=y +CONFIG_FEATURE_MOUNT_FORCE=y + +# +# Common options for mount/umount +# +CONFIG_FEATURE_MOUNT_LOOP=y +# CONFIG_FEATURE_MTAB_SUPPORT is not set + +# +# Debugging Options +# +# CONFIG_DEBUG is not set diff --git a/obsolete-buildroot/sources/cramfs.patch b/obsolete-buildroot/sources/cramfs.patch new file mode 100644 index 0000000000..884eb8cb83 --- /dev/null +++ b/obsolete-buildroot/sources/cramfs.patch @@ -0,0 +1,1269 @@ +--- cramfs-1.1.orig/cramfsck.c 2002-02-22 17:00:42.000000000 -0700 ++++ cramfs-1.1/cramfsck.c 2002-12-21 01:25:17.000000000 -0700 +@@ -51,10 +51,11 @@ + #include + #include + #define _LINUX_STRING_H_ +-#include +-#include ++#include "linux/cramfs_fs.h" + #include + ++#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ ++ + /* Exit codes used by fsck-type programs */ + #define FSCK_OK 0 /* No errors */ + #define FSCK_NONDESTRUCT 1 /* File system errors corrected */ +@@ -75,7 +76,7 @@ + static int opt_verbose = 0; /* 1 = verbose (-v), 2+ = very verbose (-vv) */ + #ifdef INCLUDE_FS_TESTS + static int opt_extract = 0; /* extract cramfs (-x) */ +-static char *extract_dir = "root"; /* extraction directory (-x) */ ++static char *extract_dir = "/"; /* extraction directory (-x) */ + static uid_t euid; /* effective UID */ + + /* (cramfs_super + start) <= start_dir < end_dir <= start_data <= end_data */ +@@ -155,7 +156,7 @@ + } + + if (*length < sizeof(struct cramfs_super)) { +- die(FSCK_UNCORRECTED, 0, "file length too short"); ++ die(FSCK_UNCORRECTED, 0, "filesystem smaller than a cramfs superblock!"); + } + + /* find superblock */ +@@ -190,7 +191,8 @@ + die(FSCK_UNCORRECTED, 0, "zero file count"); + } + if (*length < super.size) { +- die(FSCK_UNCORRECTED, 0, "file length too short"); ++ die(FSCK_UNCORRECTED, 0, "file length too short, %lu is smaller than %lu", ++ *length, super.size); + } + else if (*length > super.size) { + fprintf(stderr, "warning: file extends past end of filesystem\n"); +@@ -267,11 +269,11 @@ + #ifdef INCLUDE_FS_TESTS + static void print_node(char type, struct cramfs_inode *i, char *name) + { +- char info[10]; ++ char info[11]; + + if (S_ISCHR(i->mode) || (S_ISBLK(i->mode))) { + /* major/minor numbers can be as high as 2^12 or 4096 */ +- snprintf(info, 10, "%4d,%4d", major(i->size), minor(i->size)); ++ snprintf(info, 11, "%4d,%4d", major(i->size), minor(i->size)); + } + else { + /* size be as high as 2^24 or 16777216 */ +@@ -445,8 +447,10 @@ + } + /* TODO: Do we need to check end_dir for empty case? */ + memcpy(newpath, path, pathlen); +- newpath[pathlen] = '/'; +- pathlen++; ++ if (pathlen > 1) { ++ newpath[pathlen] = '/'; ++ pathlen++; ++ } + if (opt_verbose) { + print_node('d', i, path); + } +--- cramfs-1.1.orig/device_table.txt 1969-12-31 17:00:00.000000000 -0700 ++++ cramfs-1.1/device_table.txt 2003-01-01 05:13:44.000000000 -0700 +@@ -0,0 +1,129 @@ ++# When building a target filesystem, it is desirable to not have to ++# become root and then run 'mknod' a thousand times. Using a device ++# table you can create device nodes and directories "on the fly". ++# ++# This is a sample device table file for use with mkcramfs. You can ++# do all sorts of interesting things with a device table file. For ++# example, if you want to adjust the permissions on a particular file ++# you can just add an entry like: ++# /sbin/foobar f 2755 0 0 - - - - - ++# and (assuming the file /sbin/foobar exists) it will be made setuid ++# root (regardless of what its permissions are on the host filesystem. ++# Furthermore, you can use a single table entry to create a many device ++# minors. For example, if I wanted to create /dev/hda and /dev/hda[0-15] ++# I could just use the following two table entries: ++# /dev/hda b 640 0 0 3 0 0 0 - ++# /dev/hda b 640 0 0 3 1 1 1 15 ++# ++# Device table entries take the form of: ++# ++# where name is the file name, type can be one of: ++# f A regular file ++# d Directory ++# c Character special device file ++# b Block special device file ++# p Fifo (named pipe) ++# uid is the user id for the target file, gid is the group id for the ++# target file. The rest of the entries (major, minor, etc) apply only ++# to device special files. ++ ++# Have fun ++# -Erik Andersen ++# ++ ++# ++/dev d 755 0 0 - - - - - ++/dev/mem c 640 0 0 1 1 0 0 - ++/dev/kmem c 640 0 0 1 2 0 0 - ++/dev/null c 640 0 0 1 3 0 0 - ++/dev/zero c 640 0 0 1 5 0 0 - ++/dev/random c 640 0 0 1 8 0 0 - ++/dev/urandom c 640 0 0 1 9 0 0 - ++/dev/tty c 666 0 0 5 0 0 0 - ++/dev/tty c 666 0 0 4 0 0 1 6 ++/dev/console c 640 0 0 5 1 0 0 - ++/dev/ram b 640 0 0 1 1 0 0 - ++/dev/ram b 640 0 0 1 0 0 1 4 ++/dev/loop b 640 0 0 7 0 0 1 2 ++/dev/ptmx c 666 0 0 5 2 0 0 - ++#/dev/ttyS c 640 0 0 4 64 0 1 4 ++#/dev/psaux c 640 0 0 10 1 0 0 - ++#/dev/rtc c 640 0 0 10 135 0 0 - ++ ++# Adjust permissions on some normal files ++#/etc/shadow f 600 0 0 - - - - - ++#/bin/tinylogin f 4755 0 0 - - - - - ++ ++# User-mode Linux stuff ++/dev/ubda b 640 0 0 98 0 0 0 - ++/dev/ubda b 640 0 0 98 1 1 1 15 ++ ++# IDE Devices ++/dev/hda b 640 0 0 3 0 0 0 - ++/dev/hda b 640 0 0 3 1 1 1 15 ++/dev/hdb b 640 0 0 3 64 0 0 - ++/dev/hdb b 640 0 0 3 65 1 1 15 ++#/dev/hdc b 640 0 0 22 0 0 0 - ++#/dev/hdc b 640 0 0 22 1 1 1 15 ++#/dev/hdd b 640 0 0 22 64 0 0 - ++#/dev/hdd b 640 0 0 22 65 1 1 15 ++#/dev/hde b 640 0 0 33 0 0 0 - ++#/dev/hde b 640 0 0 33 1 1 1 15 ++#/dev/hdf b 640 0 0 33 64 0 0 - ++#/dev/hdf b 640 0 0 33 65 1 1 15 ++#/dev/hdg b 640 0 0 34 0 0 0 - ++#/dev/hdg b 640 0 0 34 1 1 1 15 ++#/dev/hdh b 640 0 0 34 64 0 0 - ++#/dev/hdh b 640 0 0 34 65 1 1 15 ++ ++# SCSI Devices ++#/dev/sda b 640 0 0 8 0 0 0 - ++#/dev/sda b 640 0 0 8 1 1 1 15 ++#/dev/sdb b 640 0 0 8 16 0 0 - ++#/dev/sdb b 640 0 0 8 17 1 1 15 ++#/dev/sdc b 640 0 0 8 32 0 0 - ++#/dev/sdc b 640 0 0 8 33 1 1 15 ++#/dev/sdd b 640 0 0 8 48 0 0 - ++#/dev/sdd b 640 0 0 8 49 1 1 15 ++#/dev/sde b 640 0 0 8 64 0 0 - ++#/dev/sde b 640 0 0 8 65 1 1 15 ++#/dev/sdf b 640 0 0 8 80 0 0 - ++#/dev/sdf b 640 0 0 8 81 1 1 15 ++#/dev/sdg b 640 0 0 8 96 0 0 - ++#/dev/sdg b 640 0 0 8 97 1 1 15 ++#/dev/sdh b 640 0 0 8 112 0 0 - ++#/dev/sdh b 640 0 0 8 113 1 1 15 ++#/dev/sg c 640 0 0 21 0 0 1 15 ++#/dev/scd b 640 0 0 11 0 0 1 15 ++#/dev/st c 640 0 0 9 0 0 1 8 ++#/dev/nst c 640 0 0 9 128 0 1 8 ++#/dev/st c 640 0 0 9 32 1 1 4 ++#/dev/st c 640 0 0 9 64 1 1 4 ++#/dev/st c 640 0 0 9 96 1 1 4 ++ ++# Floppy disk devices ++#/dev/fd b 640 0 0 2 0 0 1 2 ++#/dev/fd0d360 b 640 0 0 2 4 0 0 - ++#/dev/fd1d360 b 640 0 0 2 5 0 0 - ++#/dev/fd0h1200 b 640 0 0 2 8 0 0 - ++#/dev/fd1h1200 b 640 0 0 2 9 0 0 - ++#/dev/fd0u1440 b 640 0 0 2 28 0 0 - ++#/dev/fd1u1440 b 640 0 0 2 29 0 0 - ++#/dev/fd0u2880 b 640 0 0 2 32 0 0 - ++#/dev/fd1u2880 b 640 0 0 2 33 0 0 - ++ ++# All the proprietary cdrom devices in the world ++#/dev/aztcd b 640 0 0 29 0 0 0 - ++#/dev/bpcd b 640 0 0 41 0 0 0 - ++#/dev/capi20 c 640 0 0 68 0 0 1 2 ++#/dev/cdu31a b 640 0 0 15 0 0 0 - ++#/dev/cdu535 b 640 0 0 24 0 0 0 - ++#/dev/cm206cd b 640 0 0 32 0 0 0 - ++#/dev/sjcd b 640 0 0 18 0 0 0 - ++#/dev/sonycd b 640 0 0 15 0 0 0 - ++#/dev/gscd b 640 0 0 16 0 0 0 - ++#/dev/sbpcd b 640 0 0 25 0 0 0 - ++#/dev/sbpcd b 640 0 0 25 0 0 1 4 ++#/dev/mcd b 640 0 0 23 0 0 0 - ++#/dev/optcd b 640 0 0 17 0 0 0 - ++ +--- cramfs-1.1.orig/mkcramfs.c 2002-02-20 01:03:32.000000000 -0700 ++++ cramfs-1.1/mkcramfs.c 2002-12-21 01:25:17.000000000 -0700 +@@ -1,3 +1,4 @@ ++/* vi: set sw=8 ts=8: */ + /* + * mkcramfs - make a cramfs file system + * +@@ -16,12 +17,21 @@ + * 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 ++ * ++ * Added device table support (code taken from mkfs.jffs2.c, credit to ++ * Erik Andersen ) as well as an option to squash ++ * permissions. - Russ Dill September 2002 ++ * ++ * Reworked, cleaned up, and updated for cramfs-1.1, December 2002 ++ * - Erik Andersen ++ * + */ + + /* + * If you change the disk format of cramfs, please update fs/cramfs/README. + */ + ++#define _GNU_SOURCE + #include + #include + #include +@@ -33,8 +43,15 @@ + #include + #include + #include ++#include ++#include ++#include ++#include + #include + #include ++#ifdef DMALLOC ++#include ++#endif + + /* Exit codes used by mkfs-type programs */ + #define MKFS_OK 0 /* No errors */ +@@ -71,11 +88,17 @@ + + (1 << CRAMFS_SIZE_WIDTH) - 1 /* filesize */ \ + + (1 << CRAMFS_SIZE_WIDTH) * 4 / PAGE_CACHE_SIZE /* block pointers */ ) + ++ ++/* The kernel assumes PAGE_CACHE_SIZE as block size. */ ++#define PAGE_CACHE_SIZE (4096) ++ ++ + static const char *progname = "mkcramfs"; + static unsigned int blksize = PAGE_CACHE_SIZE; + static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */ + static int image_length = 0; + ++ + /* + * If opt_holes is set, then mkcramfs can create explicit holes in the + * data, which saves 26 bytes per hole (which is a lot smaller a +@@ -91,10 +114,12 @@ + static int opt_holes = 0; + static int opt_pad = 0; + static int opt_verbose = 0; ++static int opt_squash = 0; + static char *opt_image = NULL; + static char *opt_name = NULL; + + static int warn_dev, warn_gid, warn_namelen, warn_skip, warn_size, warn_uid; ++static const char *const memory_exhausted = "memory exhausted"; + + /* In-core version of inode / directory entry. */ + struct entry { +@@ -123,7 +148,7 @@ + { + FILE *stream = status ? stderr : stdout; + +- fprintf(stream, "usage: %s [-h] [-e edition] [-i file] [-n name] dirname outfile\n" ++ fprintf(stream, "usage: %s [-h] [-e edition] [-i file] [-n name] [-D file] dirname outfile\n" + " -h print this help\n" + " -E make all warnings errors (non-zero exit status)\n" + " -e edition set edition number (part of fsid)\n" +@@ -133,39 +158,157 @@ + " -s sort directory entries (old option, ignored)\n" + " -v be more verbose\n" + " -z make explicit holes (requires >= 2.3.39)\n" +- " dirname root of the directory tree to be compressed\n" ++ " -D Use the named FILE as a device table file\n" ++ " -q squash permissions (make everything owned by root)\n" ++ " dirname root of the filesystem to be compressed\n" + " outfile output file\n", progname, PAD_SIZE); + + exit(status); + } + +-static void die(int status, int syserr, const char *fmt, ...) ++static void verror_msg(const char *s, va_list p) ++{ ++ fflush(stdout); ++ fprintf(stderr, "mkcramfs: "); ++ vfprintf(stderr, s, p); ++} ++ ++static void vperror_msg(const char *s, va_list p) ++{ ++ int err = errno; ++ ++ if (s == 0) ++ s = ""; ++ verror_msg(s, p); ++ if (*s) ++ s = ": "; ++ fprintf(stderr, "%s%s\n", s, strerror(err)); ++} ++ ++static void perror_msg(const char *s, ...) ++{ ++ va_list p; ++ ++ va_start(p, s); ++ vperror_msg(s, p); ++ va_end(p); ++} ++ ++static void error_msg_and_die(const char *s, ...) ++{ ++ va_list p; ++ ++ va_start(p, s); ++ verror_msg(s, p); ++ va_end(p); ++ putc('\n', stderr); ++ exit(MKFS_ERROR); ++} ++ ++static void perror_msg_and_die(const char *s, ...) ++{ ++ va_list p; ++ ++ va_start(p, s); ++ vperror_msg(s, p); ++ va_end(p); ++ exit(MKFS_ERROR); ++} ++#ifndef DMALLOC ++extern char *xstrdup(const char *s) ++{ ++ char *t; ++ ++ if (s == NULL) ++ return NULL; ++ t = strdup(s); ++ if (t == NULL) ++ error_msg_and_die(memory_exhausted); ++ return t; ++} ++ ++extern void *xmalloc(size_t size) ++{ ++ void *ptr = malloc(size); ++ ++ if (ptr == NULL && size != 0) ++ error_msg_and_die(memory_exhausted); ++ return ptr; ++} ++ ++extern void *xcalloc(size_t nmemb, size_t size) ++{ ++ void *ptr = calloc(nmemb, size); ++ ++ if (ptr == NULL && nmemb != 0 && size != 0) ++ error_msg_and_die(memory_exhausted); ++ return ptr; ++} ++ ++extern void *xrealloc(void *ptr, size_t size) ++{ ++ ptr = realloc(ptr, size); ++ if (ptr == NULL && size != 0) ++ error_msg_and_die(memory_exhausted); ++ return ptr; ++} ++#endif ++ ++static FILE *xfopen(const char *path, const char *mode) + { +- va_list arg_ptr; +- int save = errno; ++ FILE *fp; ++ ++ if ((fp = fopen(path, mode)) == NULL) ++ perror_msg_and_die("%s", path); ++ return fp; ++} + +- fflush(0); +- va_start(arg_ptr, fmt); +- fprintf(stderr, "%s: ", progname); +- vfprintf(stderr, fmt, arg_ptr); +- if (syserr) { +- fprintf(stderr, ": %s", strerror(save)); ++extern int xopen(const char *pathname, int flags, mode_t mode) ++{ ++ int ret; ++ ++ if (flags & O_CREAT) ++ ret = open(pathname, flags, mode); ++ else ++ ret = open(pathname, flags); ++ if (ret == -1) { ++ perror_msg_and_die("%s", pathname); + } +- fprintf(stderr, "\n"); +- va_end(arg_ptr); +- exit(status); ++ return ret; + } + ++extern char *xreadlink(const char *path) ++{ ++ static const int GROWBY = 80; /* how large we will grow strings by */ ++ ++ char *buf = NULL; ++ int bufsize = 0, readsize = 0; ++ ++ do { ++ buf = xrealloc(buf, bufsize += GROWBY); ++ readsize = readlink(path, buf, bufsize); /* 1st try */ ++ if (readsize == -1) { ++ perror_msg("%s:%s", progname, path); ++ return NULL; ++ } ++ } ++ while (bufsize < readsize + 1); ++ ++ buf[readsize] = '\0'; ++ ++ return buf; ++} ++ + static void map_entry(struct entry *entry) + { + if (entry->path) { + entry->fd = open(entry->path, O_RDONLY); + if (entry->fd < 0) { +- die(MKFS_ERROR, 1, "open failed: %s", entry->path); ++ error_msg_and_die("open failed: %s", entry->path); + } + entry->uncompressed = mmap(NULL, entry->size, PROT_READ, MAP_PRIVATE, entry->fd, 0); + if (entry->uncompressed == MAP_FAILED) { +- die(MKFS_ERROR, 1, "mmap failed: %s", entry->path); ++ error_msg_and_die("mmap failed: %s", entry->path); + } + } + } +@@ -174,8 +317,9 @@ + { + if (entry->path) { + if (munmap(entry->uncompressed, entry->size) < 0) { +- die(MKFS_ERROR, 1, "munmap failed: %s", entry->path); ++ error_msg_and_die("munmap failed: %s", entry->path); + } ++ entry->uncompressed=NULL; + close(entry->fd); + } + } +@@ -204,7 +348,8 @@ + find_identical_file(orig->next, newfile)); + } + +-static void eliminate_doubles(struct entry *root, struct entry *orig) { ++static void eliminate_doubles(struct entry *root, struct entry *orig) ++{ + if (orig) { + if (orig->size && (orig->path || orig->uncompressed)) + find_identical_file(root, orig); +@@ -232,10 +377,7 @@ + + /* Set up the path. */ + /* TODO: Reuse the parent's buffer to save memcpy'ing and duplication. */ +- path = malloc(len + 1 + MAX_INPUT_NAMELEN + 1); +- if (!path) { +- die(MKFS_ERROR, 1, "malloc failed"); +- } ++ path = xmalloc(len + 1 + MAX_INPUT_NAMELEN + 1); + memcpy(path, name, len); + endpath = path + len; + *endpath = '/'; +@@ -245,7 +387,7 @@ + dircount = scandir(name, &dirlist, 0, cramsort); + + if (dircount < 0) { +- die(MKFS_ERROR, 1, "scandir failed: %s", name); ++ error_msg_and_die("scandir failed: %s", name); + } + + /* process directory */ +@@ -269,25 +411,20 @@ + } + namelen = strlen(dirent->d_name); + if (namelen > MAX_INPUT_NAMELEN) { +- die(MKFS_ERROR, 0, +- "very long (%u bytes) filename found: %s\n" +- "please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile", ++ error_msg_and_die( ++ "Very long (%u bytes) filename `%s' found.\n" ++ " Please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile. Exiting.\n", + namelen, dirent->d_name); + } + memcpy(endpath, dirent->d_name, namelen + 1); + + if (lstat(path, &st) < 0) { ++ perror(endpath); + warn_skip = 1; + continue; + } +- entry = calloc(1, sizeof(struct entry)); +- if (!entry) { +- die(MKFS_ERROR, 1, "calloc failed"); +- } +- entry->name = strdup(dirent->d_name); +- if (!entry->name) { +- die(MKFS_ERROR, 1, "strdup failed"); +- } ++ entry = xcalloc(1, sizeof(struct entry)); ++ entry->name = xstrdup(dirent->d_name); + /* truncate multi-byte UTF-8 filenames on character boundary */ + if (namelen > CRAMFS_MAXPATHLEN) { + namelen = CRAMFS_MAXPATHLEN; +@@ -297,24 +434,25 @@ + namelen--; + /* are we reasonably certain it was UTF-8 ? */ + if (entry->name[namelen] < 0x80 || !namelen) { +- die(MKFS_ERROR, 0, "cannot truncate filenames not encoded in UTF-8"); ++ error_msg_and_die("cannot truncate filenames not encoded in UTF-8"); + } + } + entry->name[namelen] = '\0'; + } + entry->mode = st.st_mode; + entry->size = st.st_size; +- entry->uid = st.st_uid; ++ entry->uid = opt_squash ? 0 : st.st_uid; + if (entry->uid >= 1 << CRAMFS_UID_WIDTH) + warn_uid = 1; +- entry->gid = st.st_gid; +- if (entry->gid >= 1 << CRAMFS_GID_WIDTH) ++ entry->gid = opt_squash ? 0 : st.st_gid; ++ if (entry->gid >= 1 << CRAMFS_GID_WIDTH) { + /* TODO: We ought to replace with a default + gid instead of truncating; otherwise there + are security problems. Maybe mode should + be &= ~070. Same goes for uid once Linux + supports >16-bit uids. */ + warn_gid = 1; ++ } + size = sizeof(struct cramfs_inode) + ((namelen + 3) & ~3); + *fslen_ub += size; + if (S_ISDIR(st.st_mode)) { +@@ -325,21 +463,15 @@ + warn_skip = 1; + continue; + } +- entry->path = strdup(path); +- if (!entry->path) { +- die(MKFS_ERROR, 1, "strdup failed"); +- } ++ entry->path = xstrdup(path); + if ((entry->size >= 1 << CRAMFS_SIZE_WIDTH)) { + warn_size = 1; + entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1; + } + } + } else if (S_ISLNK(st.st_mode)) { +- entry->uncompressed = malloc(entry->size); ++ entry->uncompressed = xreadlink(path); + if (!entry->uncompressed) { +- die(MKFS_ERROR, 1, "malloc failed"); +- } +- if (readlink(path, entry->uncompressed, entry->size) < 0) { + warn_skip = 1; + continue; + } +@@ -351,7 +483,7 @@ + if (entry->size & -(1<name); ++ error_msg_and_die("bogus file type: %s", entry->name); + } + + if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { +@@ -378,7 +510,9 @@ + struct cramfs_super *super = (struct cramfs_super *) base; + unsigned int offset = sizeof(struct cramfs_super) + image_length; + +- offset += opt_pad; /* 0 if no padding */ ++ if (opt_pad) { ++ offset += opt_pad; /* 0 if no padding */ ++ } + + super->magic = CRAMFS_MAGIC; + super->flags = CRAMFS_FLAG_FSID_VERSION_2 | CRAMFS_FLAG_SORTED_DIRS; +@@ -414,10 +548,10 @@ + struct cramfs_inode *inode = (struct cramfs_inode *) (base + entry->dir_offset); + + if ((offset & 3) != 0) { +- die(MKFS_ERROR, 0, "illegal offset of %lu bytes", offset); ++ error_msg_and_die("illegal offset of %lu bytes", offset); + } + if (offset >= (1 << (2 + CRAMFS_OFFSET_WIDTH))) { +- die(MKFS_ERROR, 0, "filesystem too big"); ++ error_msg_and_die("filesystem too big"); + } + inode->offset = (offset >> 2); + } +@@ -429,7 +563,7 @@ + */ + static void print_node(struct entry *e) + { +- char info[10]; ++ char info[12]; + char type = '?'; + + if (S_ISREG(e->mode)) type = 'f'; +@@ -442,11 +576,11 @@ + + if (S_ISCHR(e->mode) || (S_ISBLK(e->mode))) { + /* major/minor numbers can be as high as 2^12 or 4096 */ +- snprintf(info, 10, "%4d,%4d", major(e->size), minor(e->size)); ++ snprintf(info, 11, "%4d,%4d", major(e->size), minor(e->size)); + } + else { + /* size be as high as 2^24 or 16777216 */ +- snprintf(info, 10, "%9d", e->size); ++ snprintf(info, 11, "%9d", e->size); + } + + printf("%c %04o %s %5d:%-3d %s\n", +@@ -462,17 +596,9 @@ + { + int stack_entries = 0; + int stack_size = 64; +- struct entry **entry_stack; +- +- entry_stack = malloc(stack_size * sizeof(struct entry *)); +- if (!entry_stack) { +- die(MKFS_ERROR, 1, "malloc failed"); +- } +- +- if (opt_verbose) { +- printf("root:\n"); +- } ++ struct entry **entry_stack = NULL; + ++ entry_stack = xmalloc(stack_size * sizeof(struct entry *)); + for (;;) { + int dir_start = stack_entries; + while (entry) { +@@ -506,10 +632,7 @@ + if (entry->child) { + if (stack_entries >= stack_size) { + stack_size *= 2; +- entry_stack = realloc(entry_stack, stack_size * sizeof(struct entry *)); +- if (!entry_stack) { +- die(MKFS_ERROR, 1, "realloc failed"); +- } ++ entry_stack = xrealloc(entry_stack, stack_size * sizeof(struct entry *)); + } + entry_stack[stack_entries] = entry; + stack_entries++; +@@ -543,7 +666,7 @@ + + set_data_offset(entry, base, offset); + if (opt_verbose) { +- printf("%s:\n", entry->name); ++ printf("'%s':\n", entry->name); + } + entry = entry->child; + } +@@ -553,16 +676,21 @@ + + static int is_zero(char const *begin, unsigned len) + { +- /* Returns non-zero iff the first LEN bytes from BEGIN are all NULs. */ +- return (len-- == 0 || +- (begin[0] == '\0' && +- (len-- == 0 || +- (begin[1] == '\0' && +- (len-- == 0 || +- (begin[2] == '\0' && +- (len-- == 0 || +- (begin[3] == '\0' && +- memcmp(begin, begin + 4, len) == 0)))))))); ++ if (opt_holes) ++ /* Returns non-zero iff the first LEN bytes from BEGIN are ++ all NULs. */ ++ return (len-- == 0 || ++ (begin[0] == '\0' && ++ (len-- == 0 || ++ (begin[1] == '\0' && ++ (len-- == 0 || ++ (begin[2] == '\0' && ++ (len-- == 0 || ++ (begin[3] == '\0' && ++ memcmp(begin, begin + 4, len) == 0)))))))); ++ else ++ /* Never create holes. */ ++ return 0; + } + + /* +@@ -575,37 +703,34 @@ + * Note that size > 0, as a zero-sized file wouldn't ever + * have gotten here in the first place. + */ +-static unsigned int do_compress(char *base, unsigned int offset, char const *name, char *uncompressed, unsigned int size) ++static unsigned int do_compress(char *base, unsigned int offset, struct entry *entry) + { ++ unsigned int size = entry->size; + unsigned long original_size = size; + unsigned long original_offset = offset; + unsigned long new_size; + unsigned long blocks = (size - 1) / blksize + 1; + unsigned long curr = offset + 4 * blocks; + int change; ++ char *uncompressed = entry->uncompressed; + +- total_blocks += blocks; ++ total_blocks += blocks; + + do { + unsigned long len = 2 * blksize; + unsigned int input = size; +- int err; +- + if (input > blksize) + input = blksize; + size -= input; +- if (!(opt_holes && is_zero (uncompressed, input))) { +- err = compress2(base + curr, &len, uncompressed, input, Z_BEST_COMPRESSION); +- if (err != Z_OK) { +- die(MKFS_ERROR, 0, "compression error: %s", zError(err)); +- } ++ if (!is_zero (uncompressed, input)) { ++ compress(base + curr, &len, uncompressed, input); + curr += len; + } + uncompressed += input; + + if (len > blksize*2) { + /* (I don't think this can happen with zlib.) */ +- die(MKFS_ERROR, 0, "AIEEE: block \"compressed\" to > 2*blocklength (%ld)", len); ++ error_msg_and_die("AIEEE: block \"compressed\" to > 2*blocklength (%ld)\n", len); + } + + *(u32 *) (base + offset) = curr; +@@ -618,10 +743,12 @@ + st_blocks * 512. But if you say that then perhaps + administrative data should also be included in both. */ + change = new_size - original_size; +- if (opt_verbose > 1) { +- printf("%6.2f%% (%+d bytes)\t%s\n", +- (change * 100) / (double) original_size, change, name); ++#if 0 ++ if (opt_verbose) { ++ printf("%6.2f%% (%+d bytes)\t%s\n", ++ (change * 100) / (double) original_size, change, entry->name); + } ++#endif + + return curr; + } +@@ -644,7 +771,7 @@ + set_data_offset(entry, base, offset); + entry->offset = offset; + map_entry(entry); +- offset = do_compress(base, offset, entry->name, entry->uncompressed, entry->size); ++ offset = do_compress(base, offset, entry); + unmap_entry(entry); + } + } +@@ -660,13 +787,10 @@ + int fd; + char *buf; + +- fd = open(file, O_RDONLY); +- if (fd < 0) { +- die(MKFS_ERROR, 1, "open failed: %s", file); +- } ++ fd = xopen(file, O_RDONLY, 0); + buf = mmap(NULL, image_length, PROT_READ, MAP_PRIVATE, fd, 0); + if (buf == MAP_FAILED) { +- die(MKFS_ERROR, 1, "mmap failed"); ++ error_msg_and_die("mmap failed"); + } + memcpy(base + offset, buf, image_length); + munmap(buf, image_length); +@@ -679,6 +803,328 @@ + return (offset + image_length); + } + ++static struct entry *find_filesystem_entry(struct entry *dir, char *name, mode_t type) ++{ ++ struct entry *e = dir; ++ ++ if (S_ISDIR(dir->mode)) { ++ e = dir->child; ++ } ++ while (e) { ++ /* Only bother to do the expensive strcmp on matching file types */ ++ if (type == (e->mode & S_IFMT) && e->name) { ++ if (S_ISDIR(e->mode)) { ++ int len = strlen(e->name); ++ ++ /* Check if we are a parent of the correct path */ ++ if (strncmp(e->name, name, len) == 0) { ++ /* Is this an _exact_ match? */ ++ if (strcmp(name, e->name) == 0) { ++ return (e); ++ } ++ /* Looks like we found a parent of the correct path */ ++ if (name[len] == '/') { ++ if (e->child) { ++ return (find_filesystem_entry (e, name + len + 1, type)); ++ } else { ++ return NULL; ++ } ++ } ++ } ++ } else { ++ if (strcmp(name, e->name) == 0) { ++ return (e); ++ } ++ } ++ } ++ e = e->next; ++ } ++ return (NULL); ++} ++ ++void modify_entry(char *full_path, unsigned long uid, unsigned long gid, ++ unsigned long mode, unsigned long rdev, struct entry *root, loff_t *fslen_ub) ++{ ++ char *name, *path, *full; ++ struct entry *curr, *parent, *entry, *prev; ++ ++ full = xstrdup(full_path); ++ path = xstrdup(dirname(full)); ++ name = full_path + strlen(path) + 1; ++ free(full); ++ if (strcmp(path, "/") == 0) { ++ parent = root; ++ name = full_path + 1; ++ } else { ++ if (!(parent = find_filesystem_entry(root, path+1, S_IFDIR))) ++ error_msg_and_die("%s/%s: could not find parent\n", path, name); ++ } ++ if ((entry = find_filesystem_entry(parent, name, (mode & S_IFMT)))) { ++ /* its there, just modify permissions */ ++ entry->mode = mode; ++ entry->uid = uid; ++ entry->gid = gid; ++ } else { /* make a new entry */ ++ ++ /* code partially replicated from parse_directory() */ ++ size_t namelen; ++ if (S_ISREG(mode)) { ++ error_msg_and_die("%s: regular file from device_table file must exist on disk!", full_path); ++ } ++ ++ namelen = strlen(name); ++ if (namelen > MAX_INPUT_NAMELEN) { ++ error_msg_and_die( ++ "Very long (%u bytes) filename `%s' found.\n" ++ " Please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile. Exiting.\n", ++ namelen, name); ++ } ++ entry = xcalloc(1, sizeof(struct entry)); ++ entry->name = xstrdup(name); ++ /* truncate multi-byte UTF-8 filenames on character boundary */ ++ if (namelen > CRAMFS_MAXPATHLEN) { ++ namelen = CRAMFS_MAXPATHLEN; ++ warn_namelen = 1; ++ /* the first lost byte must not be a trail byte */ ++ while ((entry->name[namelen] & 0xc0) == 0x80) { ++ namelen--; ++ /* are we reasonably certain it was UTF-8 ? */ ++ if (entry->name[namelen] < 0x80 || !namelen) { ++ error_msg_and_die("cannot truncate filenames not encoded in UTF-8"); ++ } ++ } ++ entry->name[namelen] = '\0'; ++ } ++ entry->mode = mode; ++ entry->uid = uid; ++ entry->gid = gid; ++ entry->size = 0; ++ if (S_ISBLK(mode) || S_ISCHR(mode)) { ++ entry->size = rdev; ++ if (entry->size & -(1<size += sizeof(struct cramfs_inode) + ((namelen + 3) & ~3); ++ ++ /* alright, time to link us in */ ++ curr = parent->child; ++ prev = NULL; ++ while (curr && strcmp(name, curr->name) > 0) { ++ prev = curr; ++ curr = curr->next; ++ } ++ if (!prev) parent->child = entry; ++ else prev->next = entry; ++ entry->next = curr; ++ entry->child = NULL; ++ } ++ if (entry->uid >= 1 << CRAMFS_UID_WIDTH) ++ warn_uid = 1; ++ if (entry->gid >= 1 << CRAMFS_GID_WIDTH) { ++ /* TODO: We ought to replace with a default ++ gid instead of truncating; otherwise there ++ are security problems. Maybe mode should ++ be &= ~070. Same goes for uid once Linux ++ supports >16-bit uids. */ ++ warn_gid = 1; ++ } ++ free(path); ++} ++ ++/* the GNU C library has a wonderful scanf("%as", string) which will ++ allocate the string with the right size, good to avoid buffer overruns. ++ the following macros use it if available or use a hacky workaround... ++ */ ++ ++#ifdef __GNUC__ ++#define SCANF_PREFIX "a" ++#define SCANF_STRING(s) (&s) ++#define GETCWD_SIZE 0 ++#else ++#define SCANF_PREFIX "511" ++#define SCANF_STRING(s) (s = xmalloc(512)) ++#define GETCWD_SIZE -1 ++inline int snprintf(char *str, size_t n, const char *fmt, ...) ++{ ++ int ret; ++ va_list ap; ++ ++ va_start(ap, fmt); ++ ret = vsprintf(str, fmt, ap); ++ va_end(ap); ++ return ret; ++} ++#endif ++ ++/* device table entries take the form of: ++ ++ /dev/mem c 640 0 0 1 1 0 0 - ++ ++ type can be one of: ++ f A regular file ++ d Directory ++ c Character special device file ++ b Block special device file ++ p Fifo (named pipe) ++ ++ I don't bother with symlinks (permissions are irrelevant), hard ++ links (special cases of regular files), or sockets (why bother). ++ ++ Regular files must exist in the target root directory. If a char, ++ block, fifo, or directory does not exist, it will be created. ++*/ ++ ++static int interpret_table_entry(char *line, struct entry *root, loff_t *fslen_ub) ++{ ++ char type, *name = NULL; ++ unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; ++ unsigned long start = 0, increment = 1, count = 0; ++ ++ if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu", ++ SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor, ++ &start, &increment, &count) < 0) ++ { ++ return 1; ++ } ++ ++ if (!strcmp(name, "/")) { ++ error_msg_and_die("Device table entries require absolute paths"); ++ } ++ ++ switch (type) { ++ case 'd': ++ mode |= S_IFDIR; ++ modify_entry(name, uid, gid, mode, 0, root, fslen_ub); ++ break; ++ case 'f': ++ mode |= S_IFREG; ++ modify_entry(name, uid, gid, mode, 0, root, fslen_ub); ++ break; ++ case 'p': ++ mode |= S_IFIFO; ++ modify_entry(name, uid, gid, mode, 0, root, fslen_ub); ++ break; ++ case 'c': ++ case 'b': ++ mode |= (type == 'c') ? S_IFCHR : S_IFBLK; ++ if (count > 0) { ++ char *buf; ++ unsigned long i; ++ dev_t rdev; ++ ++ for (i = start; i < count; i++) { ++ asprintf(&buf, "%s%lu", name, i); ++ rdev = makedev(major, minor + (i * increment - start)); ++ modify_entry(buf, uid, gid, mode, rdev, root, fslen_ub); ++ free(buf); ++ } ++ } else { ++ dev_t rdev = makedev(major, minor); ++ modify_entry(name, uid, gid, mode, rdev, root, fslen_ub); ++ } ++ break; ++ default: ++ error_msg_and_die("Unsupported file type"); ++ } ++ free(name); ++ return 0; ++} ++ ++static int parse_device_table(FILE *file, struct entry *root, loff_t *fslen_ub) ++{ ++ char *line; ++ int status = 0; ++ size_t length = 0; ++ ++ /* Turn off squash, since we must ensure that values ++ * entered via the device table are not squashed */ ++ opt_squash = 0; ++ ++ /* Looks ok so far. The general plan now is to read in one ++ * line at a time, check for leading comment delimiters ('#'), ++ * then try and parse the line as a device table. If we fail ++ * to parse things, try and help the poor fool to fix their ++ * device table with a useful error msg... */ ++ line = NULL; ++ while (getline(&line, &length, file) != -1) { ++ /* First trim off any whitespace */ ++ int len = strlen(line); ++ ++ /* trim trailing whitespace */ ++ while (len > 0 && isspace(line[len - 1])) ++ line[--len] = '\0'; ++ /* trim leading whitespace */ ++ memmove(line, &line[strspn(line, " \n\r\t\v")], len); ++ ++ /* How long are we after trimming? */ ++ len = strlen(line); ++ ++ /* If this is NOT a comment line, try to interpret it */ ++ if (len && *line != '#') { ++ if (interpret_table_entry(line, root, fslen_ub)) ++ status = 1; ++ } ++ ++ free(line); ++ line = NULL; ++ } ++ free(line); ++ fclose(file); ++ ++ return status; ++} ++ ++void traverse(struct entry *entry, int depth) ++{ ++ struct entry *curr = entry; ++ int i; ++ ++ while (curr) { ++ for (i = 0; i < depth; i++) putchar(' '); ++ printf("%s: size=%d mode=%d same=%p\n", ++ (curr->name)? (char*)curr->name : "/", ++ curr->size, curr->mode, curr->same); ++ if (curr->child) traverse(curr->child, depth + 4); ++ curr = curr->next; ++ } ++} ++ ++static void free_filesystem_entry(struct entry *dir) ++{ ++ struct entry *e = dir, *last; ++ ++ if (S_ISDIR(dir->mode)) { ++ e = dir->child; ++ } ++ while (e) { ++ if (e->name) ++ free(e->name); ++ if (e->path) ++ free(e->path); ++ if (e->uncompressed) ++ free(e->uncompressed); ++ last = e; ++ if (e->child) { ++ free_filesystem_entry(e); ++ } ++ e = e->next; ++ free(last); ++ } ++} ++ ++ ++/* ++ * Usage: ++ * ++ * mkcramfs directory-name outfile ++ * ++ * where "directory-name" is simply the root of the directory ++ * tree that we want to generate a compressed filesystem out ++ * of. ++ */ + int main(int argc, char **argv) + { + struct stat st; /* used twice... */ +@@ -692,6 +1138,7 @@ + u32 crc; + int c; /* for getopt */ + char *ep; /* for strtoul */ ++ FILE *devtable = NULL; + + total_blocks = 0; + +@@ -699,7 +1146,7 @@ + progname = argv[0]; + + /* command line options */ +- while ((c = getopt(argc, argv, "hEe:i:n:psvz")) != EOF) { ++ while ((c = getopt(argc, argv, "hEe:i:n:psvzD:q")) != EOF) { + switch (c) { + case 'h': + usage(MKFS_OK); +@@ -715,7 +1162,7 @@ + case 'i': + opt_image = optarg; + if (lstat(opt_image, &st) < 0) { +- die(MKFS_ERROR, 1, "lstat failed: %s", opt_image); ++ error_msg_and_die("lstat failed: %s", opt_image); + } + image_length = st.st_size; /* may be padded later */ + fslen_ub += (image_length + 3); /* 3 is for padding */ +@@ -736,6 +1183,16 @@ + case 'z': + opt_holes = 1; + break; ++ case 'q': ++ opt_squash = 1; ++ break; ++ case 'D': ++ devtable = xfopen(optarg, "r"); ++ if (fstat(fileno(devtable), &st) < 0) ++ perror_msg_and_die(optarg); ++ if (st.st_size < 10) ++ error_msg_and_die("%s: not a proper device table file\n", optarg); ++ break; + } + } + +@@ -745,25 +1202,23 @@ + outfile = argv[optind + 1]; + + if (stat(dirname, &st) < 0) { +- die(MKFS_USAGE, 1, "stat failed: %s", dirname); +- } +- fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); +- if (fd < 0) { +- die(MKFS_USAGE, 1, "open failed: %s", outfile); ++ error_msg_and_die("stat failed: %s", dirname); + } ++ fd = xopen(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); + +- root_entry = calloc(1, sizeof(struct entry)); +- if (!root_entry) { +- die(MKFS_ERROR, 1, "calloc failed"); +- } ++ root_entry = xcalloc(1, sizeof(struct entry)); + root_entry->mode = st.st_mode; + root_entry->uid = st.st_uid; + root_entry->gid = st.st_gid; + + root_entry->size = parse_directory(root_entry, dirname, &root_entry->child, &fslen_ub); + ++ if (devtable) { ++ parse_device_table(devtable, root_entry, &fslen_ub); ++ } ++ + /* always allocate a multiple of blksize bytes because that's +- what we're going to write later on */ ++ what we're going to write later on */ + fslen_ub = ((fslen_ub - 1) | (blksize - 1)) + 1; + + if (fslen_ub > MAXFSLEN) { +@@ -790,7 +1245,7 @@ + rom_image = mmap(NULL, fslen_ub?fslen_ub:1, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + if (rom_image == MAP_FAILED) { +- die(MKFS_ERROR, 1, "mmap failed"); ++ error_msg_and_die("mmap failed"); + } + + /* Skip the first opt_pad bytes for boot loader code */ +@@ -807,6 +1262,7 @@ + } + + offset = write_directory_structure(root_entry->child, rom_image, offset); ++ if (opt_verbose) + printf("Directory data: %d bytes\n", offset); + + offset = write_data(root_entry, rom_image, offset); +@@ -814,30 +1270,38 @@ + /* We always write a multiple of blksize bytes, so that + losetup works. */ + offset = ((offset - 1) | (blksize - 1)) + 1; ++ if (opt_verbose) + printf("Everything: %d kilobytes\n", offset >> 10); + + /* Write the superblock now that we can fill in all of the fields. */ + write_superblock(root_entry, rom_image+opt_pad, offset); ++ if (opt_verbose) + printf("Super block: %d bytes\n", sizeof(struct cramfs_super)); + + /* Put the checksum in. */ + crc = crc32(0L, Z_NULL, 0); + crc = crc32(crc, (rom_image+opt_pad), (offset-opt_pad)); + ((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = crc; ++ if (opt_verbose) + printf("CRC: %x\n", crc); + + /* Check to make sure we allocated enough space. */ + if (fslen_ub < offset) { +- die(MKFS_ERROR, 0, "not enough space allocated for ROM image (%Ld allocated, %d used)", fslen_ub, offset); ++ error_msg_and_die("not enough space allocated for ROM " ++ "image (%Ld allocated, %d used)", fslen_ub, offset); + } + + written = write(fd, rom_image, offset); + if (written < 0) { +- die(MKFS_ERROR, 1, "write failed"); ++ error_msg_and_die("write failed"); + } + if (offset != written) { +- die(MKFS_ERROR, 0, "ROM image write failed (wrote %d of %d bytes)", written, offset); ++ error_msg_and_die("ROM image write failed (wrote %d of %d bytes)", written, offset); + } ++ ++ /* Free up memory */ ++ free_filesystem_entry(root_entry); ++ free(root_entry); + + /* (These warnings used to come at the start, but they scroll off the + screen too quickly.) */ diff --git a/obsolete-buildroot/sources/device_table.txt b/obsolete-buildroot/sources/device_table.txt new file mode 100644 index 0000000000..75d8068354 --- /dev/null +++ b/obsolete-buildroot/sources/device_table.txt @@ -0,0 +1,163 @@ +# When building a target filesystem, it is desirable to not have to +# become root and then run 'mknod' a thousand times. Using a device +# table you can create device nodes and directories "on the fly". +# +# This is a sample device table file for use with genext2fs. You can +# do all sorts of interesting things with a device table file. For +# example, if you want to adjust the permissions on a particular file +# you can just add an entry like: +# /sbin/foobar f 2755 0 0 - - - - - +# and (assuming the file /sbin/foobar exists) it will be made setuid +# root (regardless of what its permissions are on the host filesystem. +# Furthermore, you can use a single table entry to create a many device +# minors. For example, if I wanted to create /dev/hda and /dev/hda[0-15] +# I could just use the following two table entries: +# /dev/hda b 640 0 0 3 0 0 0 - +# /dev/hda b 640 0 0 3 1 1 1 15 +# +# Device table entries take the form of: +# +# where name is the file name, type can be one of: +# f A regular file +# d Directory +# c Character special device file +# b Block special device file +# p Fifo (named pipe) +# uid is the user id for the target file, gid is the group id for the +# target file. The rest of the entries (major, minor, etc) apply only +# to device special files. + +# Have fun +# -Erik Andersen +# + +# +/dev d 755 0 0 - - - - - +/dev d 755 0 0 - - - - - +/dev/pts d 755 0 0 - - - - - +/tmp d 1777 0 0 - - - - - +/etc d 755 0 0 - - - - - +/home/default d 2755 1000 1000 - - - - - +/etc/network/if-up.d d 755 0 0 - - - - - +/etc/network/if-pre-up.d d 755 0 0 - - - - - +/etc/network/if-down.d d 755 0 0 - - - - - +/etc/network/if-post-down.d d 755 0 0 - - - - - +# Adjust permissions on some normal files +/etc/shadow f 600 0 0 - - - - - +/etc/passwd f 644 0 0 - - - - - +/bin/busybox f 4755 0 0 - - - - - +# uncomment this to allow starting x as non-root +#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - - + +# Normal system devices +/dev/mem c 640 0 0 1 1 0 0 - +/dev/kmem c 640 0 0 1 2 0 0 - +/dev/null c 666 0 0 1 3 0 0 - +/dev/zero c 666 0 0 1 5 0 0 - +/dev/random c 666 0 0 1 8 0 0 - +/dev/urandom c 666 0 0 1 9 0 0 - +/dev/ram b 640 0 0 1 1 0 0 - +/dev/ram b 640 0 0 1 0 0 1 4 +/dev/loop b 640 0 0 7 0 0 1 2 +/dev/rtc c 640 0 0 10 135 - - - +/dev/console c 666 0 0 5 1 - - - +/dev/tty c 666 0 0 5 0 - - - +/dev/tty c 666 0 0 4 0 0 1 8 +/dev/ttyp c 666 0 0 3 0 0 1 10 +/dev/ptyp c 666 0 0 2 0 0 1 10 +/dev/ptmx c 666 0 0 5 2 - - - +/dev/ttyP c 666 0 0 57 0 0 1 4 +/dev/ttyS c 666 0 0 4 64 0 1 4 +/dev/fb c 640 0 5 29 0 0 32 4 +#/dev/ttySA c 666 0 0 204 5 0 1 3 +/dev/psaux c 666 0 0 10 1 0 0 - +#/dev/ppp c 666 0 0 108 0 - - - + +# MTD stuff +/dev/mtd c 640 0 0 90 0 0 2 4 +/dev/mtdblock b 640 0 0 31 0 0 1 4 + +#Tun/tap driver +/dev/net d 755 0 0 - - - - - +/dev/net/tun c 660 0 0 10 200 - - - + +# Audio stuff +#/dev/audio c 666 0 29 14 4 - - - +#/dev/audio1 c 666 0 29 14 20 - - - +#/dev/dsp c 666 0 29 14 3 - - - +#/dev/dsp1 c 666 0 29 14 19 - - - +#/dev/sndstat c 666 0 29 14 6 - - - + +# User-mode Linux stuff +/dev/ubda b 640 0 0 98 0 0 0 - +/dev/ubda b 640 0 0 98 1 1 1 15 + +# IDE Devices +/dev/hda b 640 0 0 3 0 0 0 - +/dev/hda b 640 0 0 3 1 1 1 15 +/dev/hdb b 640 0 0 3 64 0 0 - +/dev/hdb b 640 0 0 3 65 1 1 15 +#/dev/hdc b 640 0 0 22 0 0 0 - +#/dev/hdc b 640 0 0 22 1 1 1 15 +#/dev/hdd b 640 0 0 22 64 0 0 - +#/dev/hdd b 640 0 0 22 65 1 1 15 +#/dev/hde b 640 0 0 33 0 0 0 - +#/dev/hde b 640 0 0 33 1 1 1 15 +#/dev/hdf b 640 0 0 33 64 0 0 - +#/dev/hdf b 640 0 0 33 65 1 1 15 +#/dev/hdg b 640 0 0 34 0 0 0 - +#/dev/hdg b 640 0 0 34 1 1 1 15 +#/dev/hdh b 640 0 0 34 64 0 0 - +#/dev/hdh b 640 0 0 34 65 1 1 15 + +# SCSI Devices +#/dev/sda b 640 0 0 8 0 0 0 - +#/dev/sda b 640 0 0 8 1 1 1 15 +#/dev/sdb b 640 0 0 8 16 0 0 - +#/dev/sdb b 640 0 0 8 17 1 1 15 +#/dev/sdc b 640 0 0 8 32 0 0 - +#/dev/sdc b 640 0 0 8 33 1 1 15 +#/dev/sdd b 640 0 0 8 48 0 0 - +#/dev/sdd b 640 0 0 8 49 1 1 15 +#/dev/sde b 640 0 0 8 64 0 0 - +#/dev/sde b 640 0 0 8 65 1 1 15 +#/dev/sdf b 640 0 0 8 80 0 0 - +#/dev/sdf b 640 0 0 8 81 1 1 15 +#/dev/sdg b 640 0 0 8 96 0 0 - +#/dev/sdg b 640 0 0 8 97 1 1 15 +#/dev/sdh b 640 0 0 8 112 0 0 - +#/dev/sdh b 640 0 0 8 113 1 1 15 +#/dev/sg c 640 0 0 21 0 0 1 15 +#/dev/scd b 640 0 0 11 0 0 1 15 +#/dev/st c 640 0 0 9 0 0 1 8 +#/dev/nst c 640 0 0 9 128 0 1 8 +#/dev/st c 640 0 0 9 32 1 1 4 +#/dev/st c 640 0 0 9 64 1 1 4 +#/dev/st c 640 0 0 9 96 1 1 4 + +# Floppy disk devices +#/dev/fd b 640 0 0 2 0 0 1 2 +#/dev/fd0d360 b 640 0 0 2 4 0 0 - +#/dev/fd1d360 b 640 0 0 2 5 0 0 - +#/dev/fd0h1200 b 640 0 0 2 8 0 0 - +#/dev/fd1h1200 b 640 0 0 2 9 0 0 - +#/dev/fd0u1440 b 640 0 0 2 28 0 0 - +#/dev/fd1u1440 b 640 0 0 2 29 0 0 - +#/dev/fd0u2880 b 640 0 0 2 32 0 0 - +#/dev/fd1u2880 b 640 0 0 2 33 0 0 - + +# All the proprietary cdrom devices in the world +#/dev/aztcd b 640 0 0 29 0 0 0 - +#/dev/bpcd b 640 0 0 41 0 0 0 - +#/dev/capi20 c 640 0 0 68 0 0 1 2 +#/dev/cdu31a b 640 0 0 15 0 0 0 - +#/dev/cdu535 b 640 0 0 24 0 0 0 - +#/dev/cm206cd b 640 0 0 32 0 0 0 - +#/dev/sjcd b 640 0 0 18 0 0 0 - +#/dev/sonycd b 640 0 0 15 0 0 0 - +#/dev/gscd b 640 0 0 16 0 0 0 - +#/dev/sbpcd b 640 0 0 25 0 0 0 - +#/dev/sbpcd b 640 0 0 25 0 0 1 4 +#/dev/mcd b 640 0 0 23 0 0 0 - +#/dev/optcd b 640 0 0 17 0 0 0 - + diff --git a/obsolete-buildroot/sources/dnsmasq1-100-bugfix.patch b/obsolete-buildroot/sources/dnsmasq1-100-bugfix.patch new file mode 100644 index 0000000000..c676a1a398 --- /dev/null +++ b/obsolete-buildroot/sources/dnsmasq1-100-bugfix.patch @@ -0,0 +1,25 @@ +--- dnsmasq-1.18/config.h.dist 2004-03-01 22:25:12.000000000 -0600 ++++ dnsmasq-1.18/config.h 2004-03-01 22:26:50.000000000 -0600 +@@ -126,7 +126,9 @@ + + /* Must preceed __linux__ since uClinux defines __linux__ too. */ + #if defined(__uClinux__) || defined(__UCLIBC__) ++#ifndef __UCLIBC_HAS_IPV6__ + #undef HAVE_LINUX_IPV6_PROC ++#endif + #define HAVE_GETOPT_LONG + #undef HAVE_ARC4RANDOM + #define HAVE_RANDOM +diff -x CVS -urN dnsmasq-1.18/option.c dnsmasq.old/option.c +--- dnsmasq-1.18/option.c 2003-11-05 08:22:18.000000000 -0600 ++++ dnsmasq.old/option.c 2004-01-05 23:40:11.000000000 -0600 +@@ -578,8 +578,8 @@ + #ifdef HAVE_IPV6 + else if (tmp->source_addr.sa.sa_family == AF_INET6) + tmp->source_addr.in6.sin6_port = htons(*query_port); +- } + #endif ++ } + } + + if (*if_addrs) diff --git a/obsolete-buildroot/sources/dnsmasq1-openwrt.patch b/obsolete-buildroot/sources/dnsmasq1-openwrt.patch new file mode 100644 index 0000000000..e1741a28a2 --- /dev/null +++ b/obsolete-buildroot/sources/dnsmasq1-openwrt.patch @@ -0,0 +1,219 @@ +diff -x CVS -urN dnsmasq-1.18/dhcp.c dnsmasq.old/dhcp.c +--- dnsmasq-1.18/dhcp.c 2003-11-05 08:30:20.000000000 -0600 ++++ dnsmasq.old/dhcp.c 2004-01-05 23:40:11.000000000 -0600 +@@ -15,14 +15,20 @@ + + #include "dnsmasq.h" + +-static int next_token (char *token, int buffsize, FILE * fp); ++struct dhcpOfferedAddr { ++ u_int8_t hostname[16]; ++ u_int8_t chaddr[16]; ++ u_int32_t yiaddr; /* network order */ ++ u_int32_t expires; /* host order */ ++}; + + void load_dhcp(char *file, char *suffix, time_t now, char *hostname) + { +- char token[MAXTOK], *dot; ++ char *dot; + struct all_addr host_address; +- time_t ttd, tts; ++ time_t ttd; + FILE *fp = fopen (file, "r"); ++ struct dhcpOfferedAddr lease; + + if (!fp) + { +@@ -34,154 +40,45 @@ + + /* remove all existing DHCP cache entries */ + cache_unhash_dhcp(); +- +- while ((next_token(token, MAXTOK, fp))) +- { +- if (strcmp(token, "lease") == 0) +- { +- hostname[0] = '\0'; +- ttd = tts = (time_t)(-1); +-#ifdef HAVE_IPV6 +- if (next_token(token, MAXTOK, fp) && +- inet_pton(AF_INET, token, &host_address)) +-#else +- if (next_token(token, MAXTOK, fp) && +- (host_address.addr4.s_addr = inet_addr(token)) != (in_addr_t) -1) +-#endif +- { +- if (next_token(token, MAXTOK, fp) && *token == '{') +- { +- while (next_token(token, MAXTOK, fp) && *token != '}') ++ ++ while (fread(&lease, sizeof(lease), 1, fp)) { ++ host_address.addr.addr4.s_addr = lease.yiaddr; ++ ++ strcpy(hostname,lease.hostname); ++ if (lease.expires>(unsigned)now) ++ ttd = lease.expires; ++ else ++ ttd = -1; ++ dot = strchr(hostname, '.'); ++ if (suffix) + { +- if ((strcmp(token, "client-hostname") == 0) || +- (strcmp(token, "hostname") == 0)) +- { +- if (next_token(hostname, MAXDNAME, fp)) +- if (!canonicalise(hostname)) +- { +- *hostname = 0; +- syslog(LOG_ERR, "bad name in %s", file); +- } +- } +- else if ((strcmp(token, "ends") == 0) || +- (strcmp(token, "starts") == 0)) +- { +- struct tm lease_time; +- int is_ends = (strcmp(token, "ends") == 0); +- if (next_token(token, MAXTOK, fp) && /* skip weekday */ +- next_token(token, MAXTOK, fp) && /* Get date from lease file */ +- sscanf (token, "%d/%d/%d", +- &lease_time.tm_year, +- &lease_time.tm_mon, +- &lease_time.tm_mday) == 3 && +- next_token(token, MAXTOK, fp) && +- sscanf (token, "%d:%d:%d:", +- &lease_time.tm_hour, +- &lease_time.tm_min, +- &lease_time.tm_sec) == 3) +- { +- /* There doesn't seem to be a universally available library function +- which converts broken-down _GMT_ time to seconds-in-epoch. +- The following was borrowed from ISC dhcpd sources, where +- it is noted that it might not be entirely accurate for odd seconds. +- Since we're trying to get the same answer as dhcpd, that's just +- fine here. */ +- static int months [11] = { 31, 59, 90, 120, 151, 181, +- 212, 243, 273, 304, 334 }; +- time_t time = ((((((365 * (lease_time.tm_year - 1970) + /* Days in years since '70 */ +- (lease_time.tm_year - 1969) / 4 + /* Leap days since '70 */ +- (lease_time.tm_mon > 1 /* Days in months this year */ +- ? months [lease_time.tm_mon - 2] +- : 0) + +- (lease_time.tm_mon > 2 && /* Leap day this year */ +- !((lease_time.tm_year - 1972) & 3)) + +- lease_time.tm_mday - 1) * 24) + /* Day of month */ +- lease_time.tm_hour) * 60) + +- lease_time.tm_min) * 60) + lease_time.tm_sec; +- if (is_ends) +- ttd = time; +- else +- tts = time; } ++ if (dot) ++ { /* suffix and lease has ending: must match */ ++ if (strcmp(dot+1, suffix) != 0) ++ syslog(LOG_WARNING, ++ "Ignoring DHCP lease for %s because it has an illegal domain part", hostname); ++ else ++ cache_add_dhcp_entry(hostname, &host_address, ttd, F_REVERSE); + } +- } +- +- /* missing info? */ +- if (!*hostname) +- continue; +- if (ttd == (time_t)(-1)) +- continue; +- +- /* infinite lease to is represented by -1 */ +- /* This makes is to the lease file as +- start time one less than end time. */ +- /* We use -1 as infinite in ttd */ +- if ((tts != -1) && (ttd == tts - 1)) +- ttd = (time_t)(-1); +- else if (ttd < now) +- continue; +- +- dot = strchr(hostname, '.'); +- if (suffix) +- { +- if (dot) +- { /* suffix and lease has ending: must match */ +- if (strcmp(dot+1, suffix) != 0) +- syslog(LOG_WARNING, +- "Ignoring DHCP lease for %s because it has an illegal domain part", hostname); +- else +- cache_add_dhcp_entry(hostname, &host_address, ttd, F_REVERSE); +- } +- else +- { /* suffix exists but lease has no ending - add lease and lease.suffix */ +- cache_add_dhcp_entry(hostname, &host_address, ttd, 0); +- strncat(hostname, ".", MAXDNAME); +- strncat(hostname, suffix, MAXDNAME); +- hostname[MAXDNAME-1] = 0; /* in case strncat hit limit */ +- /* Make FQDN canonical for reverse lookups */ +- cache_add_dhcp_entry(hostname, &host_address, ttd, F_REVERSE); +- } +- } +- else +- { /* no suffix */ +- if (dot) /* no lease ending allowed */ +- syslog(LOG_WARNING, +- "Ignoring DHCP lease for %s because it has a domain part", hostname); +- else +- cache_add_dhcp_entry(hostname, &host_address, ttd, F_REVERSE); +- } +- } +- } +- } +- } ++ else ++ { /* suffix exists but lease has no ending - add lease and lease.suffix */ ++ cache_add_dhcp_entry(hostname, &host_address, ttd, 0); ++ strncat(hostname, ".", MAXDNAME); ++ strncat(hostname, suffix, MAXDNAME); ++ hostname[MAXDNAME-1] = 0; /* in case strncat hit limit */ ++ /* Make FQDN canonical for reverse lookups */ ++ cache_add_dhcp_entry(hostname, &host_address, ttd, F_REVERSE); ++ } ++ } ++ else ++ { /* no suffix */ ++ if (dot) /* no lease ending allowed */ ++ syslog(LOG_WARNING, ++ "Ignoring DHCP lease for %s because it has a domain part", hostname); ++ else ++ cache_add_dhcp_entry(hostname, &host_address, ttd, F_REVERSE); ++ } ++ } + fclose(fp); + + } +- +-static int next_token (char *token, int buffsize, FILE * fp) +-{ +- int c, count = 0; +- char *cp = token; +- +- while((c = getc(fp)) != EOF) +- { +- if (c == '#') +- do { c = getc(fp); } while (c != '\n' && c != EOF); +- +- if (c == ' ' || c == '\t' || c == '\n' || c == ';') +- { +- if (count) +- break; +- } +- else if ((c != '"') && (count> $@ + + magic.mgc: magic +- $(top_builddir)/src/file -C -m magic ++ /usr/bin/file -C -m magic + + magic.mime.mgc: magic.mime +- $(top_builddir)/src/file -C -m magic.mime ++ /usr/bin/file -C -m magic.mime + + magic_FRAGMENTS = \ + Magdir/acorn \ +--- file-4.04/magic/Makefile.in.orig 2003-10-02 13:52:23.000000000 -0600 ++++ file-4.04/magic/Makefile.in 2003-10-02 13:52:53.000000000 -0600 +@@ -477,10 +477,10 @@ + done >> $@ + + magic.mgc: magic +- $(top_builddir)/src/file -C -m magic ++ /usr/bin/file -C -m magic + + magic.mime.mgc: magic.mime +- $(top_builddir)/src/file -C -m magic.mime ++ /usr/bin/file -C -m magic.mime + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/obsolete-buildroot/sources/gcc-uclibc-3.3-100-conf.patch b/obsolete-buildroot/sources/gcc-uclibc-3.3-100-conf.patch new file mode 100644 index 0000000000..213b4fbbd6 --- /dev/null +++ b/obsolete-buildroot/sources/gcc-uclibc-3.3-100-conf.patch @@ -0,0 +1,1593 @@ +diff -urN gcc-3.3.3/boehm-gc/config.sub gcc-3.3.3-new/boehm-gc/config.sub +--- gcc-3.3.3/boehm-gc/config.sub 2002-02-11 22:37:53.000000000 -0600 ++++ gcc-3.3.3-new/boehm-gc/config.sub 2004-02-16 21:12:16.000000000 -0600 +@@ -118,7 +118,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) ++ nto-qnx* | linux-gnu* | linux-uclibc* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -1089,7 +1089,8 @@ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -mingw32* | -linux-gnu* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ +diff -urN gcc-3.3.3/config.sub gcc-3.3.3-new/config.sub +--- gcc-3.3.3/config.sub 2003-01-30 17:25:36.000000000 -0600 ++++ gcc-3.3.3-new/config.sub 2004-02-16 21:12:16.000000000 -0600 +@@ -118,7 +118,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) ++ nto-qnx* | linux-gnu* | linux-uclibc* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -1112,7 +1112,8 @@ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -mingw32* | -linux-gnu* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ +diff -urN gcc-3.3.3/gcc/config/arm/linux-elf.h gcc-3.3.3-new/gcc/config/arm/linux-elf.h +--- gcc-3.3.3/gcc/config/arm/linux-elf.h 2003-09-16 10:39:23.000000000 -0500 ++++ gcc-3.3.3-new/gcc/config/arm/linux-elf.h 2004-02-16 21:12:16.000000000 -0600 +@@ -78,6 +78,18 @@ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define LINK_SPEC "%{h*} %{version:-v} \ ++ %{b} %{Wl,*:%*} \ ++ %{static:-Bstatic} \ ++ %{shared:-shared} \ ++ %{symbolic:-Bsymbolic} \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \ ++ -X \ ++ %{mbig-endian:-EB}" \ ++ SUBTARGET_EXTRA_LINK_SPEC ++#else + #define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ +@@ -88,6 +100,7 @@ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC ++#endif + + #define TARGET_OS_CPP_BUILTINS() \ + do { \ +diff -urN gcc-3.3.3/gcc/config/cris/linux.h gcc-3.3.3-new/gcc/config/cris/linux.h +--- gcc-3.3.3/gcc/config/cris/linux.h 2003-03-10 21:01:35.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/cris/linux.h 2004-02-16 21:12:16.000000000 -0600 +@@ -81,6 +81,25 @@ + #undef CRIS_DEFAULT_CPU_VERSION + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + ++#ifdef USE_UCLIBC ++ ++#undef CRIS_SUBTARGET_VERSION ++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++ ++#undef CRIS_LINK_SUBTARGET_SPEC ++#define CRIS_LINK_SUBTARGET_SPEC \ ++ "-mcrislinux\ ++ -rpath-link include/asm/../..%s\ ++ %{shared} %{static}\ ++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ ++ %{!r:%{O2|O3: --gc-sections}}" ++ ++#else /* USE_UCLIBC */ ++ + #undef CRIS_SUBTARGET_VERSION + #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" + +@@ -95,6 +114,8 @@ + %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ + %{!r:%{O2|O3: --gc-sections}}" + ++#endif /* USE_UCLIBC */ ++ + + /* Node: Run-time Target */ + +diff -urN gcc-3.3.3/gcc/config/cris/t-linux-uclibc gcc-3.3.3-new/gcc/config/cris/t-linux-uclibc +--- gcc-3.3.3/gcc/config/cris/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/cris/t-linux-uclibc 2004-02-16 21:12:16.000000000 -0600 +@@ -0,0 +1,3 @@ ++T_CFLAGS = -DUSE_UCLIBC ++TARGET_LIBGCC2_CFLAGS += -fPIC ++CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS) +diff -urN gcc-3.3.3/gcc/config/i386/linux.h gcc-3.3.3-new/gcc/config/i386/linux.h +--- gcc-3.3.3/gcc/config/i386/linux.h 2003-11-14 00:46:12.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/i386/linux.h 2004-02-16 21:12:16.000000000 -0600 +@@ -136,6 +136,15 @@ + %{static:-static}}}" + #endif + #else ++#if defined USE_UCLIBC ++#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ ++ %{!shared: \ ++ %{!ibcs: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}}" ++#else + #define LINK_SPEC "-m elf_i386 %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ +@@ -144,6 +153,7 @@ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}}}" + #endif ++#endif + + /* A C statement (sans semicolon) to output to the stdio stream + FILE the assembler definition of uninitialized global DECL named +diff -urN gcc-3.3.3/gcc/config/mips/linux.h gcc-3.3.3-new/gcc/config/mips/linux.h +--- gcc-3.3.3/gcc/config/mips/linux.h 2003-12-23 02:58:00.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/mips/linux.h 2004-02-16 21:12:16.000000000 -0600 +@@ -175,6 +175,17 @@ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define LINK_SPEC \ ++ "%(endian_spec) \ ++ %{shared:-shared} \ ++ %{!shared: \ ++ %{!ibcs: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}}" ++#else + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ +@@ -184,6 +195,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ + %{static:-static}}}" ++#endif + + #undef SUBTARGET_ASM_SPEC + #define SUBTARGET_ASM_SPEC "\ +diff -urN gcc-3.3.3/gcc/config/sh/linux.h gcc-3.3.3-new/gcc/config/sh/linux.h +--- gcc-3.3.3/gcc/config/sh/linux.h 2003-11-06 17:13:33.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/sh/linux.h 2004-02-16 21:12:16.000000000 -0600 +@@ -44,12 +44,21 @@ + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" + #undef SUBTARGET_LINK_SPEC ++#ifdef USE_UCLIBC ++#define SUBTARGET_LINK_SPEC \ ++ "%{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}" ++#else + #define SUBTARGET_LINK_SPEC \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}" ++#endif + + /* The GNU C++ standard library requires that these macros be defined. */ + #undef CPLUSPLUS_CPP_SPEC +diff -urN gcc-3.3.3/gcc/config/sh/t-linux-uclibc gcc-3.3.3-new/gcc/config/sh/t-linux-uclibc +--- gcc-3.3.3/gcc/config/sh/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/sh/t-linux-uclibc 2004-02-16 21:12:16.000000000 -0600 +@@ -0,0 +1,16 @@ ++T_CFLAGS = -DUSE_UCLIBC ++ ++# Don't run fixproto ++STMP_FIXPROTO = ++ ++TARGET_LIBGCC2_CFLAGS = -fpic ++LIB1ASMFUNCS_CACHE = _ic_invalidate ++ ++LIB2FUNCS_EXTRA= ++ ++MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4 ++MULTILIB_DIRNAMES= ++MULTILIB_MATCHES = ++MULTILIB_EXCEPTIONS= ++ ++EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o +diff -urN gcc-3.3.3/gcc/config/sh/t-sh64-uclibc gcc-3.3.3-new/gcc/config/sh/t-sh64-uclibc +--- gcc-3.3.3/gcc/config/sh/t-sh64-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/sh/t-sh64-uclibc 2004-02-16 21:12:16.000000000 -0600 +@@ -0,0 +1,13 @@ ++EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o ++ ++LIB1ASMFUNCS = \ ++ _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \ ++ _shcompact_call_trampoline _shcompact_return_trampoline \ ++ _shcompact_incoming_args _ic_invalidate _nested_trampoline \ ++ _push_pop_shmedia_regs \ ++ _udivdi3 _divdi3 _umoddi3 _moddi3 ++ ++MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu ++MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64 ++MULTILIB_MATCHES= ++MULTILIB_EXCEPTIONS= +diff -urN gcc-3.3.3/gcc/config/t-linux-uclibc gcc-3.3.3-new/gcc/config/t-linux-uclibc +--- gcc-3.3.3/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/t-linux-uclibc 2004-02-16 21:12:16.000000000 -0600 +@@ -0,0 +1,23 @@ ++T_CFLAGS = -DUSE_UCLIBC ++ ++# Don't run fixproto ++STMP_FIXPROTO = ++ ++# Compile crtbeginS.o and crtendS.o with pic. ++CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC ++# Compile libgcc2.a with pic. ++TARGET_LIBGCC2_CFLAGS = -fPIC ++ ++# Override t-slibgcc-elf-ver to export some libgcc symbols with ++# the symbol versions that glibc used. ++SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver ++ ++# Use unwind-dw2-fde-glibc ++#LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \ ++# $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c ++#LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c ++ ++# Use unwind-dw2-fde ++LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ ++ $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c ++LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h +diff -urN gcc-3.3.3/gcc/config.gcc gcc-3.3.3-new/gcc/config.gcc +--- gcc-3.3.3/gcc/config.gcc 2004-01-21 00:06:00.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config.gcc 2004-02-16 21:12:16.000000000 -0600 +@@ -697,6 +697,17 @@ + extra_parts="" + use_collect2=yes + ;; ++arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc ++ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h" ++ tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux" ++ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++ gnu_ld=yes ++ case x${enable_threads} in ++ x | xyes | xpthreads | xposix) ++ thread_file='posix' ++ ;; ++ esac ++ ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h" + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" +@@ -772,6 +783,10 @@ + tmake_file="cris/t-cris cris/t-elfmulti" + gas=yes + ;; ++cris-*-linux-uclibc*) ++ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h" ++ tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc" ++ ;; + cris-*-linux*) + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h" + tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux" +@@ -1173,6 +1188,11 @@ + thread_file='single' + fi + ;; ++i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux ++ # with ELF format using uClibc ++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h" ++ tmake_file="t-slibgcc-elf-ver t-linux-uclibc i386/t-crtstuff" ++ ;; + i[34567]86-*-linux*) # Intel 80386's running GNU/Linux + # with ELF format using glibc 2 + # aka GNU/Linux C library 6 +@@ -1883,6 +1903,16 @@ + tm_file="elfos.h ${tm_file} mips/netbsd.h" + tmake_file="${tmake_file} mips/t-netbsd" + ;; ++mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc ++ tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h" ++ case $machine in ++ mipsisa32*-*) ++ target_cpu_default="MASK_SOFT_FLOAT" ++ tm_defines="MIPS_ISA_DEFAULT=32" ++ ;; ++ esac ++ tmake_file="t-slibgcc-elf-ver t-linux-uclibc mips/t-linux" ++ ;; + mips*-*-linux*) # Linux MIPS, either endian. + tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h" + case $machine in +@@ -2129,6 +2159,11 @@ + out_file=rs6000/rs6000.c + tmake_file="rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm" + ;; ++powerpc-*-linux-uclibc*) ++ tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h" ++ out_file=rs6000/rs6000.c ++ tmake_file="rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm" ++ ;; + powerpc-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h" + out_file=rs6000/rs6000.c +@@ -2313,10 +2348,18 @@ + tmake_file="${tmake_file} sh/t-le" + ;; + esac +- tmake_file="${tmake_file} sh/t-linux" ++ case $machine in ++ *-*-linux-uclibc*) tmake_file="${tmake_file} sh/t-linux-uclibc" ;; ++ *) tmake_file="${tmake_file} sh/t-linux" ;; ++ esac + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h" + gas=yes gnu_ld=yes + case $machine in ++ sh64*-*-linux-uclibc*) ++ tmake_file="${tmake_file} sh/t-sh64-uclibc" ++ tm_file="${tm_file} sh/sh64.h" ++ extra_headers="shmedia.h ushmedia.h sshmedia.h" ++ ;; + sh64*) + tmake_file="${tmake_file} sh/t-sh64" + tm_file="${tm_file} sh/sh64.h" +diff -urN gcc-3.3.3/libstdc++-v3/aclocal.m4 gcc-3.3.3-new/libstdc++-v3/aclocal.m4 +--- gcc-3.3.3/libstdc++-v3/aclocal.m4 2004-01-12 10:18:44.000000000 -0600 ++++ gcc-3.3.3-new/libstdc++-v3/aclocal.m4 2004-02-16 21:12:16.000000000 -0600 +@@ -1216,6 +1216,9 @@ + dnl Default to "generic" + if test x$enable_clocale_flag = xno; then + case x${target_os} in ++ xlinux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + xlinux* | xgnu*) + AC_EGREP_CPP([_GLIBCPP_ok], [ + #include +@@ -1339,6 +1342,41 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ xuclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \ ++ glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcpp_MOFILES) ++ AC_SUBST(glibcpp_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_H=config/locale/uclibc/codecvt_specializations.h ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + *) + echo "$enable_clocale is an unknown locale package" 1>&2 + exit 1 +diff -urN gcc-3.3.3/libstdc++-v3/configure gcc-3.3.3-new/libstdc++-v3/configure +--- gcc-3.3.3/libstdc++-v3/configure 2004-01-12 10:18:45.000000000 -0600 ++++ gcc-3.3.3-new/libstdc++-v3/configure 2004-02-17 00:21:12.000000000 -0600 +@@ -2996,6 +2996,9 @@ + + if test x$enable_clocale_flag = xno; then + case x${target_os} in ++ xlinux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + xlinux* | xgnu*) + cat > conftest.$ac_ext <&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ++echo "configure:3117: checking for $ac_word" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_check_msgfmt'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ++ ac_dummy="$PATH" ++ for ac_dir in $ac_dummy; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/$ac_word; then ++ ac_cv_prog_check_msgfmt="yes" ++ break ++ fi ++ done ++ IFS="$ac_save_ifs" ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt="$ac_cv_prog_check_msgfmt" ++if test -n "$check_msgfmt"; then ++ echo "$ac_t""$check_msgfmt" 1>&6 ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \ ++ glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_H=config/locale/uclibc/codecvt_specializations.h ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + *) + echo "$enable_clocale is an unknown locale package" 1>&2 + exit 1 +@@ -4212,6 +4279,968 @@ + # GLIBCPP_CHECK_MATH_SUPPORT + + case "$target" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ for ac_hdr in nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h locale.h float.h inttypes.h ++do ++ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ++echo "configure:4224: checking for $ac_hdr" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:4234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ++ cat >> confdefs.h <&6 ++fi ++done ++ ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ ++ ++ # If we're not using GNU ld, then there's no point in even trying these ++ # tests. Check for that first. We should have already tested for gld ++ # by now (in libtool), but require it now just to be safe... ++ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' ++ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' ++ ++ ++ # The name set by libtool depends on the version of libtool. Shame on us ++ # for depending on an impl detail, but c'est la vie. Older versions used ++ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on ++ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually ++ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't ++ # set (hence we're using an older libtool), then set it. ++ if test x${with_gnu_ld+set} != xset; then ++ if test x${ac_cv_prog_gnu_ld+set} != xset; then ++ # We got through "ac_require(ac_prog_ld)" and still not set? Huh? ++ with_gnu_ld=no ++ else ++ with_gnu_ld=$ac_cv_prog_gnu_ld ++ fi ++ fi ++ ++ # Start by getting the version number. I think the libtool test already ++ # does some of this, but throws away the result. ++ ++ ldver=`$LD --version 2>/dev/null | head -1 | \ ++ sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'` ++ ++ glibcpp_gnu_ld_version=`echo $ldver | \ ++ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` ++ ++ # Set --gc-sections. ++ if test "$with_gnu_ld" = "notbroken"; then ++ # GNU ld it is! Joy and bunny rabbits! ++ ++ # All these tests are for C++; save the language and the compiler flags. ++ # Need to do this so that g++ won't try to link in libstdc++ ++ ac_test_CFLAGS="${CFLAGS+set}" ++ ac_save_CFLAGS="$CFLAGS" ++ CFLAGS='-x c++ -Wl,--gc-sections' ++ ++ # Check for -Wl,--gc-sections ++ # XXX This test is broken at the moment, as symbols required for ++ # linking are now in libsupc++ (not built yet.....). In addition, ++ # this test has cored on solaris in the past. In addition, ++ # --gc-sections doesn't really work at the moment (keeps on discarding ++ # used sections, first .eh_frame and now some of the glibc sections for ++ # iconv). Bzzzzt. Thanks for playing, maybe next time. ++ echo $ac_n "checking for ld that supports -Wl,--gc-sections""... $ac_c" 1>&6 ++echo "configure:4312: checking for ld that supports -Wl,--gc-sections" >&5 ++ if test "$cross_compiling" = yes; then ++ ac_sectionLDflags=yes ++else ++ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ++then ++ ac_sectionLDflags=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -fr conftest* ++ ac_sectionLDflags=no ++fi ++rm -fr conftest* ++fi ++ ++ if test "$ac_test_CFLAGS" = set; then ++ CFLAGS="$ac_save_CFLAGS" ++ else ++ # this is the suspicious part ++ CFLAGS='' ++ fi ++ if test "$ac_sectionLDflags" = "yes"; then ++ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" ++ fi ++ echo "$ac_t""$ac_sectionLDflags" 1>&6 ++ fi ++ ++ # Set linker optimization flags. ++ if test x"$with_gnu_ld" = x"yes"; then ++ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" ++ fi ++ ++ ++ ++ ++ ++ echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 ++echo "configure:4362: checking for main in -lm" >&5 ++ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lm $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ for ac_func in nan copysignf ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:4407: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:4435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo" ++fi ++done ++ ++ ++ for ac_func in __signbit ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:4464: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:4492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++LIBMATHOBJS="$LIBMATHOBJS signbit.lo" ++fi ++done ++ ++ for ac_func in __signbitf ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:4520: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:4548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++LIBMATHOBJS="$LIBMATHOBJS signbitf.lo" ++fi ++done ++ ++ ++ if test x$ac_cv_func_copysignl = x"yes"; then ++ for ac_func in __signbitl ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:4578: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:4606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++LIBMATHOBJS="$LIBMATHOBJS signbitl.lo" ++fi ++done ++ ++ fi ++ ++ if test -n "$LIBMATHOBJS"; then ++ need_libmath=yes ++ fi ++ ++ ++ ++if test "$need_libmath" = yes; then ++ GLIBCPP_BUILD_LIBMATH_TRUE= ++ GLIBCPP_BUILD_LIBMATH_FALSE='#' ++else ++ GLIBCPP_BUILD_LIBMATH_TRUE='#' ++ GLIBCPP_BUILD_LIBMATH_FALSE= ++fi ++ ++ ++ enable_wchar_t=no ++ ++ echo $ac_n "checking for mbstate_t""... $ac_c" 1>&6 ++echo "configure:4651: checking for mbstate_t" >&5 ++ cat > conftest.$ac_ext < ++int main() { ++mbstate_t teststate; ++; return 0; } ++EOF ++if { (eval echo configure:4660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ have_mbstate_t=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ have_mbstate_t=no ++fi ++rm -f conftest* ++ echo "$ac_t""$have_mbstate_t" 1>&6 ++ if test x"$have_mbstate_t" = xyes; then ++ cat >> confdefs.h <<\EOF ++#define HAVE_MBSTATE_T 1 ++EOF ++ ++ fi ++ ++ for ac_hdr in wchar.h ++do ++ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ++echo "configure:4682: checking for $ac_hdr" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:4692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ++ cat >> confdefs.h <&6 ++ac_has_wchar_h=no ++fi ++done ++ ++ for ac_hdr in wctype.h ++do ++ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ++echo "configure:4723: checking for $ac_hdr" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:4733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ++ cat >> confdefs.h <&6 ++ac_has_wctype_h=no ++fi ++done ++ ++ ++ if test x"$ac_has_wchar_h" = xyes && ++ test x"$ac_has_wctype_h" = xyes && ++ test x"$enable_c_mbchar" != xno; then ++ ++ echo $ac_n "checking for WCHAR_MIN and WCHAR_MAX""... $ac_c" 1>&6 ++echo "configure:4766: checking for WCHAR_MIN and WCHAR_MAX" >&5 ++ cat > conftest.$ac_ext < ++int main() { ++int i = WCHAR_MIN; int j = WCHAR_MAX; ++; return 0; } ++EOF ++if { (eval echo configure:4775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ has_wchar_minmax=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ has_wchar_minmax=no ++fi ++rm -f conftest* ++ echo "$ac_t""$has_wchar_minmax" 1>&6 ++ ++ echo $ac_n "checking for WEOF""... $ac_c" 1>&6 ++echo "configure:4788: checking for WEOF" >&5 ++ cat > conftest.$ac_ext < ++ #include ++int main() { ++wint_t i = WEOF; ++; return 0; } ++EOF ++if { (eval echo configure:4799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ has_weof=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ has_weof=no ++fi ++rm -f conftest* ++ echo "$ac_t""$has_weof" 1>&6 ++ ++ ac_wfuncs=yes ++ for ac_func in wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:4815: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:4843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++\ ++ ac_wfuncs=no ++fi ++done ++ ++ ++ for ac_func in btowc wctob fgetwc fgetws fputwc fputws fwide \ ++ fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \ ++ vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \ ++ mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \ ++ wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \ ++ wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:4878: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:4906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++\ ++ ac_wfuncs=no ++fi ++done ++ ++ ++ echo $ac_n "checking for ISO C99 wchar_t support""... $ac_c" 1>&6 ++echo "configure:4934: checking for ISO C99 wchar_t support" >&5 ++ if test x"$has_weof" = xyes && ++ test x"$has_wchar_minmax" = xyes && ++ test x"$ac_wfuncs" = xyes; then ++ ac_isoC99_wchar_t=yes ++ else ++ ac_isoC99_wchar_t=no ++ fi ++ echo "$ac_t""$ac_isoC99_wchar_t" 1>&6 ++ ++ ac_safe=`echo "iconv.h" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for iconv.h""... $ac_c" 1>&6 ++echo "configure:4946: checking for iconv.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:4956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_has_iconv_h=yes ++else ++ echo "$ac_t""no" 1>&6 ++ac_has_iconv_h=no ++fi ++ ++ ac_safe=`echo "langinfo.h" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for langinfo.h""... $ac_c" 1>&6 ++echo "configure:4980: checking for langinfo.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:4990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_has_langinfo_h=yes ++else ++ echo "$ac_t""no" 1>&6 ++ac_has_langinfo_h=no ++fi ++ ++ ++ echo $ac_n "checking for iconv in -liconv""... $ac_c" 1>&6 ++echo "configure:5014: checking for iconv in -liconv" >&5 ++ac_lib_var=`echo iconv'_'iconv | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-liconv $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ libiconv="-liconv" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ ac_save_LIBS="$LIBS" ++ LIBS="$LIBS $libiconv" ++ ++ for ac_func in iconv_open iconv_close iconv nl_langinfo ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:5059: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:5087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++ac_XPG2funcs=no ++fi ++done ++ ++ ++ LIBS="$ac_save_LIBS" ++ ++ echo $ac_n "checking for XPG2 wchar_t support""... $ac_c" 1>&6 ++echo "configure:5117: checking for XPG2 wchar_t support" >&5 ++ if test x"$ac_has_iconv_h" = xyes && ++ test x"$ac_has_langinfo_h" = xyes && ++ test x"$ac_XPG2funcs" = xyes; then ++ ac_XPG2_wchar_t=yes ++ else ++ ac_XPG2_wchar_t=no ++ fi ++ echo "$ac_t""$ac_XPG2_wchar_t" 1>&6 ++ ++ if test x"$ac_isoC99_wchar_t" = xyes && ++ test x"$ac_XPG2_wchar_t" = xyes; then ++ cat >> confdefs.h <<\EOF ++#define _GLIBCPP_USE_WCHAR_T 1 ++EOF ++ ++ enable_wchar_t=yes ++ fi ++ fi ++ echo $ac_n "checking for enabled wchar_t specializations""... $ac_c" 1>&6 ++echo "configure:5137: checking for enabled wchar_t specializations" >&5 ++ echo "$ac_t""$enable_wchar_t" 1>&6 ++ ++ ++if test "$enable_wchar_t" = yes; then ++ GLIBCPP_TEST_WCHAR_T_TRUE= ++ GLIBCPP_TEST_WCHAR_T_FALSE='#' ++else ++ GLIBCPP_TEST_WCHAR_T_TRUE='#' ++ GLIBCPP_TEST_WCHAR_T_FALSE= ++fi ++ ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_COPYSIGN 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_FINITE 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_FINITEF 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_ISINF 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_ISINFF 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_ISNAN 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define HAVE_ISNANF 1 ++EOF ++ ;; + *-linux*) + os_include_dir="os/gnu-linux" + for ac_hdr in nan.h ieeefp.h endian.h sys/isa_defs.h \ +diff -urN gcc-3.3.3/libstdc++-v3/configure.in gcc-3.3.3-new/libstdc++-v3/configure.in +--- gcc-3.3.3/libstdc++-v3/configure.in 2004-01-12 10:19:22.000000000 -0600 ++++ gcc-3.3.3-new/libstdc++-v3/configure.in 2004-02-16 23:13:45.000000000 -0600 +@@ -117,6 +117,36 @@ + # GLIBCPP_CHECK_MATH_SUPPORT + + case "$target" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h locale.h float.h inttypes.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCPP_CHECK_LINKER_FEATURES ++ GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCPP_CHECK_WCHAR_T_SUPPORT ++ ++ AC_DEFINE(HAVE_COPYSIGN) ++ #AC_DEFINE(HAVE_COPYSIGNF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ #AC_DEFINE(HAVE_FREXPF) ++ #AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++ #AC_DEFINE(HAVE_SINCOS) ++ #AC_DEFINE(HAVE_SINCOSF) ++ #if test x"long_double_math_on_this_cpu" = x"yes"; then ++ #AC_DEFINE(HAVE_FINITEL) ++ #AC_DEFINE(HAVE_HYPOTL) ++ #AC_DEFINE(HAVE_ISINFL) ++ #AC_DEFINE(HAVE_ISNANL) ++ #fi ++ ;; + *-linux*) + os_include_dir="os/gnu-linux" + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ +diff -urN gcc-3.3.3/libstdc++-v3/configure.target gcc-3.3.3-new/libstdc++-v3/configure.target +--- gcc-3.3.3/libstdc++-v3/configure.target 2003-10-01 14:07:07.000000000 -0500 ++++ gcc-3.3.3-new/libstdc++-v3/configure.target 2004-02-16 21:12:16.000000000 -0600 +@@ -133,6 +133,9 @@ + freebsd*) + os_include_dir="os/bsd/freebsd" + ;; ++ linux-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; + gnu* | linux*) + os_include_dir="os/gnu-linux" + ;; +diff -urN gcc-3.3.3/libstdc++-v3/include/c_std/std_cstdlib.h gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cstdlib.h +--- gcc-3.3.3/libstdc++-v3/include/c_std/std_cstdlib.h 2003-04-18 05:08:05.000000000 -0500 ++++ gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cstdlib.h 2004-02-16 21:12:16.000000000 -0600 +@@ -101,9 +101,11 @@ + using ::labs; + using ::ldiv; + using ::malloc; ++#if _GLIBCPP_USE_WCHAR_T + using ::mblen; + using ::mbstowcs; + using ::mbtowc; ++#endif + using ::qsort; + using ::rand; + using ::realloc; +@@ -112,8 +114,10 @@ + using ::strtol; + using ::strtoul; + using ::system; ++#if _GLIBCPP_USE_WCHAR_T + using ::wcstombs; + using ::wctomb; ++#endif + + inline long + abs(long __i) { return labs(__i); } +diff -urN gcc-3.3.3/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-3.3.3/libstdc++-v3/include/c_std/std_cwchar.h 2003-04-18 05:08:05.000000000 -0500 ++++ gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cwchar.h 2004-02-16 21:12:16.000000000 -0600 +@@ -165,7 +165,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#ifdef HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; +diff -urN gcc-3.3.3/ltconfig gcc-3.3.3-new/ltconfig +--- gcc-3.3.3/ltconfig 2003-02-19 20:10:02.000000000 -0600 ++++ gcc-3.3.3-new/ltconfig 2004-02-16 21:12:16.000000000 -0600 +@@ -603,6 +603,7 @@ + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in + linux-gnu*) ;; ++linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1247,6 +1248,24 @@ + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ # Note: copied from linux-gnu, and may not be appropriate. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no diff --git a/obsolete-buildroot/sources/gcc-uclibc-3.3-110-conf.patch b/obsolete-buildroot/sources/gcc-uclibc-3.3-110-conf.patch new file mode 100644 index 0000000000..f297c3283f --- /dev/null +++ b/obsolete-buildroot/sources/gcc-uclibc-3.3-110-conf.patch @@ -0,0 +1,55 @@ +Use the patch by Carl Miller for powerpc, with +some minor modifications. Changed *os_uclibc to *os_linux_uclibc since +at some point we might support other platforms. Also updated to 3.3.3. +diff -urN gcc-3.3.3/gcc/config/rs6000/linux.h gcc-3.3.3-new/gcc/config/rs6000/linux.h +--- gcc-3.3.3/gcc/config/rs6000/linux.h 2003-11-14 00:46:10.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/rs6000/linux.h 2004-02-16 21:13:40.000000000 -0600 +@@ -64,7 +64,11 @@ + #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" + + #undef LINK_OS_DEFAULT_SPEC ++#ifdef USE_UCLIBC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" ++#else + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" ++#endif + + #undef TARGET_VERSION + #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)"); +diff -urN gcc-3.3.3/gcc/config/rs6000/sysv4.h gcc-3.3.3-new/gcc/config/rs6000/sysv4.h +--- gcc-3.3.3/gcc/config/rs6000/sysv4.h 2003-10-28 13:55:41.000000000 -0600 ++++ gcc-3.3.3-new/gcc/config/rs6000/sysv4.h 2004-02-16 21:13:40.000000000 -0600 +@@ -968,9 +968,11 @@ + %{mcall-linux: %(link_os_linux) } \ + %{mcall-gnu: %(link_os_gnu) } \ + %{mcall-netbsd: %(link_os_netbsd) } \ ++%{mcall-uclibc: %(link_os_linux_uclibc) } \ + %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ + %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \ +- %{!mcall-netbsd: %(link_os_default) }}}}}}}}}" ++ %{!mcall-netbsd: %{!mcall-uclibc: \ ++ %(link_os_default) }}}}}}}}}}" + + #define LINK_OS_DEFAULT_SPEC "" + +@@ -1307,6 +1309,12 @@ + + #define LINK_OS_WINDISS_SPEC "" + ++/* uClibc support for Linux. */ ++ ++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" ++ + /* Define any extra SPECS that the compiler needs to generate. */ + /* Override rs6000.h definition. */ + #undef SUBTARGET_EXTRA_SPECS +@@ -1372,6 +1380,7 @@ + { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \ + { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \ ++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ + { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \ + { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \ diff --git a/obsolete-buildroot/sources/gcc-uclibc-3.3-120-softfloat.patch b/obsolete-buildroot/sources/gcc-uclibc-3.3-120-softfloat.patch new file mode 100644 index 0000000000..f2431896cf --- /dev/null +++ b/obsolete-buildroot/sources/gcc-uclibc-3.3-120-softfloat.patch @@ -0,0 +1,14 @@ +--- gcc-3.3.2-old/configure.in 2003-08-09 01:57:21.000000000 -0500 ++++ gcc-3.3.2/configure.in 2004-01-15 12:46:29.000000000 -0600 +@@ -1418,6 +1418,11 @@ + fi + + FLAGS_FOR_TARGET= ++case " $targargs " in ++ *" --nfp "* | *" --without-float "*) ++ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -msoft-float' ++ ;; ++esac + case " $target_configdirs " in + *" newlib "*) + case " $targargs " in diff --git a/obsolete-buildroot/sources/gcc-uclibc-3.3-200-code.patch b/obsolete-buildroot/sources/gcc-uclibc-3.3-200-code.patch new file mode 100644 index 0000000000..5880d834b4 --- /dev/null +++ b/obsolete-buildroot/sources/gcc-uclibc-3.3-200-code.patch @@ -0,0 +1,3021 @@ +Warning! This patch is not finished. The wide char time-related stuff +is broken or non-functional. But it serves as a starting point to get +things building while I continue to work on the uClibc locale internals. +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2004-01-09 07:55:02.000000000 -0600 +@@ -0,0 +1,63 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek ++ ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strtol_l) __strtol_l; ++extern "C" __typeof(strtoll_l) __strtoll_l; ++extern "C" __typeof(strtoul_l) __strtoul_l; ++extern "C" __typeof(strtoull_l) __strtoull_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#endif // GLIBC 2.3 and later +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2004-01-09 08:37:55.000000000 -0600 +@@ -0,0 +1,231 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++#include ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, long& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc, int __base) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long __l = __strtol_l(__s, &__sanity, __base, __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __l; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, unsigned long& __v, ++ ios_base::iostate& __err, const __c_locale& __cloc, ++ int __base) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ unsigned long __ul = __strtoul_l(__s, &__sanity, __base, __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __ul; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++#ifdef _GLIBCPP_USE_LONG_LONG ++ template<> ++ void ++ __convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc, int __base) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long long __ll = __strtoll_l(__s, &__sanity, __base, __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __ll; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, unsigned long long& __v, ++ ios_base::iostate& __err, const __c_locale& __cloc, ++ int __base) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ unsigned long long __ull = __strtoull_l(__s, &__sanity, __base, ++ __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __ull; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++#endif ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc, int) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc, int) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc, int) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error("attempt to create locale from unknown name"); ++ } ++#else ++ __cloc = NULL; ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (_S_c_locale != __cloc) ++ __freelocale(__cloc); ++#else ++ __cloc = NULL; ++#endif ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ { return __duplocale(__cloc); } ++#else ++ { return __c_locale(); } ++#endif ++ ++ const char* locale::_S_categories[_S_categories_size ++ + _S_extra_categories_size] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES" ++#if _GLIBCPP_NUM_CATEGORIES != 0 ++ , ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} // namespace std +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.h 2004-01-09 07:51:06.000000000 -0600 +@@ -0,0 +1,118 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#ifndef _CPP_BITS_C_LOCALE_H ++#define _CPP_BITS_C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // For messages ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning what is _GLIBCPP_C_LOCALE_GNU for ++#endif ++#define _GLIBCPP_C_LOCALE_GNU 1 ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix categories ++#endif ++// #define _GLIBCPP_NUM_CATEGORIES 6 ++#define _GLIBCPP_NUM_CATEGORIES 0 ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++namespace __gnu_cxx ++{ ++ extern "C" __typeof(uselocale) __uselocale; ++} ++#endif ++ ++namespace std ++{ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ typedef __locale_t __c_locale; ++#else ++ typedef int* __c_locale; ++#endif ++ ++ // Convert numeric value of type _Tv to string and return length of ++ // string. If snprintf is available use it, otherwise fall back to ++ // the unsafe sprintf which, in general, can be dangerous and should ++ // be avoided. ++ template ++ int ++ __convert_from_v(char* __out, const int __size, const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec = -1) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec = -1) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = setlocale(LC_ALL, NULL); ++ char* __sav = static_cast(malloc(strlen(__old) + 1)); ++ if (__sav) ++ strcpy(__sav, __old); ++ setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ int __ret; ++ if (__prec >= 0) ++ __ret = snprintf(__out, __size, __fmt, __prec, __v); ++ else ++ __ret = snprintf(__out, __size, __fmt, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ setlocale(LC_ALL, __sav); ++ free(__sav); ++#endif ++ return __ret; ++ } ++} ++ ++#endif +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2004-01-09 04:04:34.000000000 -0600 +@@ -0,0 +1,113 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCPP_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = error; ++ size_t __len = min(__from_end - __from, __to_end - __to); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_S_c_locale); ++#endif ++ size_t __conv = wcsrtombs(__to, &__from, __len, &__state); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ if (__conv == __len) ++ { ++ __from_next = __from; ++ __to_next = __to + __conv; ++ __ret = ok; ++ } ++ else if (__conv > 0 && __conv < __len) ++ { ++ __from_next = __from; ++ __to_next = __to + __conv; ++ __ret = partial; ++ } ++ else ++ __ret = error; ++ ++ return __ret; ++ } ++ ++ codecvt_base::result ++ codecvt:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = error; ++ size_t __len = min(__from_end - __from, __to_end - __to); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_S_c_locale); ++#endif ++ size_t __conv = mbsrtowcs(__to, &__from, __len, &__state); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ if (__conv == __len) ++ { ++ __from_next = __from; ++ __to_next = __to + __conv; ++ __ret = ok; ++ } ++ else if (__conv > 0 && __conv < __len) ++ { ++ __from_next = __from; ++ __to_next = __to + __conv; ++ __ret = partial; ++ } ++ else ++ __ret = error; ++ ++ return __ret; ++ } ++#endif ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h 2004-01-09 01:53:51.000000000 -0600 +@@ -0,0 +1,461 @@ ++// Locale support (codecvt) -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 Template class codecvt ++// ++ ++// Warning: this file is not meant for user inclusion. Use . ++ ++// Written by Benjamin Kosnik ++ ++ // XXX ++ // Define this here to codecvt.cc can have _S_max_size definition. ++#define _GLIBCPP_USE___ENC_TRAITS 1 ++ ++ // Extension to use icov for dealing with character encodings, ++ // including conversions and comparisons between various character ++ // sets. This object encapsulates data that may need to be shared between ++ // char_traits, codecvt and ctype. ++ class __enc_traits ++ { ++ public: ++ // Types: ++ // NB: A conversion descriptor subsumes and enhances the ++ // functionality of a simple state type such as mbstate_t. ++ typedef iconv_t __desc_type; ++ ++ protected: ++ // Data Members: ++ // Max size of charset encoding name ++ static const int _S_max_size = 32; ++ // Name of internal character set encoding. ++ char _M_int_enc[_S_max_size]; ++ // Name of external character set encoding. ++ char _M_ext_enc[_S_max_size]; ++ ++ // Conversion descriptor between external encoding to internal encoding. ++ __desc_type _M_in_desc; ++ // Conversion descriptor between internal encoding to external encoding. ++ __desc_type _M_out_desc; ++ ++ // Details the byte-order marker for the external encoding, if necessary. ++ int _M_ext_bom; ++ ++ // Details the byte-order marker for the internal encoding, if necessary. ++ int _M_int_bom; ++ ++ public: ++ explicit __enc_traits() ++ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0) ++ { ++ memset(_M_int_enc, 0, _S_max_size); ++ memset(_M_ext_enc, 0, _S_max_size); ++ } ++ ++ explicit __enc_traits(const char* __int, const char* __ext, ++ int __ibom = 0, int __ebom = 0) ++ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0) ++ { ++ strncpy(_M_int_enc, __int, _S_max_size); ++ strncpy(_M_ext_enc, __ext, _S_max_size); ++ } ++ ++ // 21.1.2 traits typedefs ++ // p4 ++ // typedef STATE_T state_type ++ // requires: state_type shall meet the requirements of ++ // CopyConstructible types (20.1.3) ++ __enc_traits(const __enc_traits& __obj): _M_in_desc(0), _M_out_desc(0) ++ { ++ strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size); ++ strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size); ++ _M_ext_bom = __obj._M_ext_bom; ++ _M_int_bom = __obj._M_int_bom; ++ } ++ ++ // Need assignment operator as well. ++ __enc_traits& ++ operator=(const __enc_traits& __obj) ++ { ++ strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size); ++ strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size); ++ _M_in_desc = 0; ++ _M_out_desc = 0; ++ _M_ext_bom = __obj._M_ext_bom; ++ _M_int_bom = __obj._M_int_bom; ++ return *this; ++ } ++ ++ ~__enc_traits() ++ { ++ __desc_type __err = reinterpret_cast(-1); ++ if (_M_in_desc && _M_in_desc != __err) ++ iconv_close(_M_in_desc); ++ if (_M_out_desc && _M_out_desc != __err) ++ iconv_close(_M_out_desc); ++ } ++ ++ void ++ _M_init() ++ { ++ const __desc_type __err = reinterpret_cast(-1); ++ if (!_M_in_desc) ++ { ++ _M_in_desc = iconv_open(_M_int_enc, _M_ext_enc); ++ if (_M_in_desc == __err) ++ __throw_runtime_error("creating iconv input descriptor failed."); ++ } ++ if (!_M_out_desc) ++ { ++ _M_out_desc = iconv_open(_M_ext_enc, _M_int_enc); ++ if (_M_out_desc == __err) ++ __throw_runtime_error("creating iconv output descriptor failed."); ++ } ++ } ++ ++ bool ++ _M_good() ++ { ++ const __desc_type __err = reinterpret_cast(-1); ++ bool __test = _M_in_desc && _M_in_desc != __err; ++ __test &= _M_out_desc && _M_out_desc != __err; ++ return __test; ++ } ++ ++ const __desc_type* ++ _M_get_in_descriptor() ++ { return &_M_in_desc; } ++ ++ const __desc_type* ++ _M_get_out_descriptor() ++ { return &_M_out_desc; } ++ ++ int ++ _M_get_external_bom() ++ { return _M_ext_bom; } ++ ++ int ++ _M_get_internal_bom() ++ { return _M_int_bom; } ++ ++ const char* ++ _M_get_internal_enc() ++ { return _M_int_enc; } ++ ++ const char* ++ _M_get_external_enc() ++ { return _M_ext_enc; } ++ }; ++ ++ // Partial specialization ++ // This specialization takes advantage of iconv to provide code ++ // conversions between a large number of character encodings. ++ template ++ class codecvt<_InternT, _ExternT, __enc_traits> ++ : public __codecvt_abstract_base<_InternT, _ExternT, __enc_traits> ++ { ++ public: ++ // Types: ++ typedef codecvt_base::result result; ++ typedef _InternT intern_type; ++ typedef _ExternT extern_type; ++ typedef __enc_traits state_type; ++ typedef __enc_traits::__desc_type __desc_type; ++ typedef __enc_traits __enc_type; ++ ++ // Data Members: ++ static locale::id id; ++ ++ explicit ++ codecvt(size_t __refs = 0) ++ : __codecvt_abstract_base(__refs) ++ { } ++ ++ explicit ++ codecvt(__enc_type* __enc, size_t __refs = 0) ++ : __codecvt_abstract_base(__refs) ++ { } ++ ++ protected: ++ virtual ++ ~codecvt() { } ++ ++ virtual result ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const; ++ ++ virtual result ++ do_unshift(state_type& __state, extern_type* __to, ++ extern_type* __to_end, extern_type*& __to_next) const; ++ ++ virtual result ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const; ++ ++ virtual int ++ do_encoding() const throw(); ++ ++ virtual bool ++ do_always_noconv() const throw(); ++ ++ virtual int ++ do_length(const state_type&, const extern_type* __from, ++ const extern_type* __end, size_t __max) const; ++ ++ virtual int ++ do_max_length() const throw(); ++ }; ++ ++ template ++ locale::id ++ codecvt<_InternT, _ExternT, __enc_traits>::id; ++ ++ // This adaptor works around the signature problems of the second ++ // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2 ++ // uses 'char**', which matches the POSIX 1003.1-2001 standard. ++ // Using this adaptor, g++ will do the work for us. ++ template ++ inline size_t ++ __iconv_adaptor(size_t(*__func)(iconv_t, _T, size_t*, char**, size_t*), ++ iconv_t __cd, char** __inbuf, size_t* __inbytes, ++ char** __outbuf, size_t* __outbytes) ++ { return __func(__cd, (_T)__inbuf, __inbytes, __outbuf, __outbytes); } ++ ++ template ++ codecvt_base::result ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = codecvt_base::error; ++ if (__state._M_good()) ++ { ++ typedef state_type::__desc_type __desc_type; ++ const __desc_type* __desc = __state._M_get_out_descriptor(); ++ const size_t __fmultiple = sizeof(intern_type); ++ size_t __fbytes = __fmultiple * (__from_end - __from); ++ const size_t __tmultiple = sizeof(extern_type); ++ size_t __tbytes = __tmultiple * (__to_end - __to); ++ ++ // Argument list for iconv specifies a byte sequence. Thus, ++ // all to/from arrays must be brutally casted to char*. ++ char* __cto = reinterpret_cast(__to); ++ char* __cfrom; ++ size_t __conv; ++ ++ // Some encodings need a byte order marker as the first item ++ // in the byte stream, to designate endian-ness. The default ++ // value for the byte order marker is NULL, so if this is ++ // the case, it's not necessary and we can just go on our ++ // merry way. ++ int __int_bom = __state._M_get_internal_bom(); ++ if (__int_bom) ++ { ++ size_t __size = __from_end - __from; ++ intern_type* __cfixed = static_cast(__builtin_alloca(sizeof(intern_type) * (__size + 1))); ++ __cfixed[0] = static_cast(__int_bom); ++ char_traits::copy(__cfixed + 1, __from, __size); ++ __cfrom = reinterpret_cast(__cfixed); ++ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, ++ &__fbytes, &__cto, &__tbytes); ++ } ++ else ++ { ++ intern_type* __cfixed = const_cast(__from); ++ __cfrom = reinterpret_cast(__cfixed); ++ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, &__fbytes, ++ &__cto, &__tbytes); ++ } ++ ++ if (__conv != size_t(-1)) ++ { ++ __from_next = reinterpret_cast(__cfrom); ++ __to_next = reinterpret_cast(__cto); ++ __ret = codecvt_base::ok; ++ } ++ else ++ { ++ if (__fbytes < __fmultiple * (__from_end - __from)) ++ { ++ __from_next = reinterpret_cast(__cfrom); ++ __to_next = reinterpret_cast(__cto); ++ __ret = codecvt_base::partial; ++ } ++ else ++ __ret = codecvt_base::error; ++ } ++ } ++ return __ret; ++ } ++ ++ template ++ codecvt_base::result ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_unshift(state_type& __state, extern_type* __to, ++ extern_type* __to_end, extern_type*& __to_next) const ++ { ++ result __ret = codecvt_base::error; ++ if (__state._M_good()) ++ { ++ typedef state_type::__desc_type __desc_type; ++ const __desc_type* __desc = __state._M_get_in_descriptor(); ++ const size_t __tmultiple = sizeof(intern_type); ++ size_t __tlen = __tmultiple * (__to_end - __to); ++ ++ // Argument list for iconv specifies a byte sequence. Thus, ++ // all to/from arrays must be brutally casted to char*. ++ char* __cto = reinterpret_cast(__to); ++ size_t __conv = __iconv_adaptor(iconv,*__desc, NULL, NULL, ++ &__cto, &__tlen); ++ ++ if (__conv != size_t(-1)) ++ { ++ __to_next = reinterpret_cast(__cto); ++ if (__tlen == __tmultiple * (__to_end - __to)) ++ __ret = codecvt_base::noconv; ++ else if (__tlen == 0) ++ __ret = codecvt_base::ok; ++ else ++ __ret = codecvt_base::partial; ++ } ++ else ++ __ret = codecvt_base::error; ++ } ++ return __ret; ++ } ++ ++ template ++ codecvt_base::result ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = codecvt_base::error; ++ if (__state._M_good()) ++ { ++ typedef state_type::__desc_type __desc_type; ++ const __desc_type* __desc = __state._M_get_in_descriptor(); ++ const size_t __fmultiple = sizeof(extern_type); ++ size_t __flen = __fmultiple * (__from_end - __from); ++ const size_t __tmultiple = sizeof(intern_type); ++ size_t __tlen = __tmultiple * (__to_end - __to); ++ ++ // Argument list for iconv specifies a byte sequence. Thus, ++ // all to/from arrays must be brutally casted to char*. ++ char* __cto = reinterpret_cast(__to); ++ char* __cfrom; ++ size_t __conv; ++ ++ // Some encodings need a byte order marker as the first item ++ // in the byte stream, to designate endian-ness. The default ++ // value for the byte order marker is NULL, so if this is ++ // the case, it's not necessary and we can just go on our ++ // merry way. ++ int __ext_bom = __state._M_get_external_bom(); ++ if (__ext_bom) ++ { ++ size_t __size = __from_end - __from; ++ extern_type* __cfixed = static_cast(__builtin_alloca(sizeof(extern_type) * (__size + 1))); ++ __cfixed[0] = static_cast(__ext_bom); ++ char_traits::copy(__cfixed + 1, __from, __size); ++ __cfrom = reinterpret_cast(__cfixed); ++ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, ++ &__flen, &__cto, &__tlen); ++ } ++ else ++ { ++ extern_type* __cfixed = const_cast(__from); ++ __cfrom = reinterpret_cast(__cfixed); ++ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, ++ &__flen, &__cto, &__tlen); ++ } ++ ++ ++ if (__conv != size_t(-1)) ++ { ++ __from_next = reinterpret_cast(__cfrom); ++ __to_next = reinterpret_cast(__cto); ++ __ret = codecvt_base::ok; ++ } ++ else ++ { ++ if (__flen < static_cast(__from_end - __from)) ++ { ++ __from_next = reinterpret_cast(__cfrom); ++ __to_next = reinterpret_cast(__cto); ++ __ret = codecvt_base::partial; ++ } ++ else ++ __ret = codecvt_base::error; ++ } ++ } ++ return __ret; ++ } ++ ++ template ++ int ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_encoding() const throw() ++ { ++ int __ret = 0; ++ if (sizeof(_ExternT) <= sizeof(_InternT)) ++ __ret = sizeof(_InternT)/sizeof(_ExternT); ++ return __ret; ++ } ++ ++ template ++ bool ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_always_noconv() const throw() ++ { return false; } ++ ++ template ++ int ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_length(const state_type&, const extern_type* __from, ++ const extern_type* __end, size_t __max) const ++ { return min(__max, static_cast(__end - __from)); } ++ ++#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS ++// 74. Garbled text for codecvt::do_max_length ++ template ++ int ++ codecvt<_InternT, _ExternT, __enc_traits>:: ++ do_max_length() const throw() ++ { return 1; } ++#endif +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/collate_members.cc 2004-01-09 08:06:24.000000000 -0600 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++#endif ++ ++namespace std ++{ ++ // These are basically extensions to char_traits, and perhaps should ++ // be put there instead of here. ++ template<> ++ int ++ collate::_M_compare(const char* __one, const char* __two) const ++ { ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate::_M_transform(char* __to, const char* __from, ++ size_t __n) const ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++ ++#ifdef _GLIBCPP_USE_WCHAR_T ++ template<> ++ int ++ collate::_M_compare(const wchar_t* __one, ++ const wchar_t* __two) const ++ { ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2004-01-09 08:15:41.000000000 -0600 +@@ -0,0 +1,274 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __wctype_l(S, L) wctype((S)) ++#define __towupper_l(C, L) towupper((C)) ++#define __towlower_l(C, L) towlower((C)) ++#define __iswctype_l(C, M, L) iswctype((C), (M)) ++#endif ++ ++namespace std ++{ ++ // NB: The other ctype specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(0, false, __refs) ++ { ++ _S_destroy_c_locale(_M_c_locale_ctype); ++ _S_create_c_locale(_M_c_locale_ctype, __s); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_toupper = _M_c_locale_ctype->__ctype_toupper; ++ _M_tolower = _M_c_locale_ctype->__ctype_tolower; ++ _M_table = _M_c_locale_ctype->__ctype_b; ++#endif ++ } ++ ++#ifdef _GLIBCPP_USE_WCHAR_T ++ ctype::__wmask_type ++ ctype::_M_convert_to_wmask(const mask __m) const ++ { ++ __wmask_type __ret; ++ switch (__m) ++ { ++ case space: ++ __ret = __wctype_l("space", _M_c_locale_ctype); ++ break; ++ case print: ++ __ret = __wctype_l("print", _M_c_locale_ctype); ++ break; ++ case cntrl: ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype); ++ break; ++ case upper: ++ __ret = __wctype_l("upper", _M_c_locale_ctype); ++ break; ++ case lower: ++ __ret = __wctype_l("lower", _M_c_locale_ctype); ++ break; ++ case alpha: ++ __ret = __wctype_l("alpha", _M_c_locale_ctype); ++ break; ++ case digit: ++ __ret = __wctype_l("digit", _M_c_locale_ctype); ++ break; ++ case punct: ++ __ret = __wctype_l("punct", _M_c_locale_ctype); ++ break; ++ case xdigit: ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype); ++ break; ++ case alnum: ++ __ret = __wctype_l("alnum", _M_c_locale_ctype); ++ break; ++ case graph: ++ __ret = __wctype_l("graph", _M_c_locale_ctype); ++ break; ++ default: ++ __ret = 0; ++ } ++ return __ret; ++ }; ++ ++ wchar_t ++ ctype::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::do_toupper(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ wchar_t ++ ctype::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::do_tolower(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ bool ++ ctype:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ bool __ret = false; ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ { ++ const mask __bit = static_cast(_ISbit(__bitcur)); ++ if (__m & __bit) ++ __ret |= __iswctype_l(__c, _M_convert_to_wmask(__bit), ++ _M_c_locale_ctype); ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype:: ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const ++ { ++ for (;__lo < __hi; ++__vec, ++__lo) ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ mask __m = 0; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ { ++ const mask __bit = static_cast(_ISbit(__bitcur)); ++ if (__iswctype_l(*__lo, _M_convert_to_wmask(__bit), ++ _M_c_locale_ctype)) ++ __m |= __bit; ++ } ++ *__vec = __m; ++ } ++ return __hi; ++ } ++ ++ const wchar_t* ++ ctype:: ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi && !this->do_is(__m, *__lo)) ++ ++__lo; ++ return __lo; ++ } ++ ++ const wchar_t* ++ ctype:: ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const ++ { ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0) ++ ++__lo; ++ return __lo; ++ } ++ ++ wchar_t ++ ctype:: ++ do_widen(char __c) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ wchar_t __ret = btowc(__c); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ mbstate_t __state; ++ memset(static_cast(&__state), 0, sizeof(mbstate_t)); ++ mbsrtowcs(__dest, &__lo, __hi - __lo, &__state); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ do_narrow(wchar_t __wc, char __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ int __c = wctob(__wc); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return (__c == EOF ? __dfault : static_cast(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, ++ char* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ size_t __offset = 0; ++ while (true) ++ { ++ const wchar_t* __start = __lo + __offset; ++ size_t __len = __hi - __start; ++ ++ mbstate_t __state; ++ memset(static_cast(&__state), 0, sizeof(mbstate_t)); ++ size_t __con = wcsrtombs(__dest + __offset, &__start, __len, &__state); ++ if (__con != __len && __start != 0) ++ { ++ __offset = __start - __lo; ++ __dest[__offset++] = __dfault; ++ } ++ else ++ break; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++#endif // _GLIBCPP_USE_WCHAR_T ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.cc 2004-01-09 08:46:16.000000000 -0600 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix gettext stuff ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__dcgettext(const char *domainname, ++ const char *msgid, int category); ++#undef gettext ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) ++#else ++#undef gettext ++#define gettext(msgid) (msgid) ++#endif ++ ++namespace std ++{ ++ // Specializations. ++ template<> ++ string ++ messages::do_get(catalog, int, int, const string& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ const char* __msg = const_cast(gettext(__dfault.c_str())); ++ __uselocale(__old); ++ return string(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ const char* __msg = gettext(__dfault.c_str()); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return string(__msg); ++#else ++ const char* __msg = gettext(__dfault.c_str()); ++ return string(__msg); ++#endif ++ } ++ ++#ifdef _GLIBCPP_USE_WCHAR_T ++ template<> ++ wstring ++ messages::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.h 2004-01-09 08:52:48.000000000 -0600 +@@ -0,0 +1,122 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix prototypes for *textdomain funcs ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__textdomain(const char *domainname); ++extern "C" char *__bindtextdomain(const char *domainname, ++ const char *dirname); ++#else ++#undef __textdomain ++#undef __bindtextdomain ++#define __textdomain(D) ((void)0) ++#define __bindtextdomain(D,P) ((void)0) ++#endif ++ ++ // Non-virtual member functions. ++ template ++ messages<_CharT>::messages(size_t __refs) ++ : locale::facet(__refs) ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ _M_name_messages = _S_c_name; ++#endif ++ _M_c_locale_messages = _S_c_locale; ++ } ++ ++ template ++ messages<_CharT>::messages(__c_locale __cloc, ++ const char* __s, size_t __refs) ++ : locale::facet(__refs) ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ _M_name_messages = new char[strlen(__s) + 1]; ++ strcpy(_M_name_messages, __s); ++#endif ++ _M_c_locale_messages = _S_clone_c_locale(__cloc); ++ } ++ ++ template ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ messages<_CharT>::~messages() ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ if (_S_c_name != _M_name_messages) ++ delete [] _M_name_messages; ++#endif ++ _S_destroy_c_locale(_M_c_locale_messages); ++ } ++ ++ template ++ typename messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ if (_S_c_name != _M_name_messages) ++ delete [] _M_name_messages; ++ _M_name_messages = new char[strlen(__s) + 1]; ++ strcpy(_M_name_messages, __s); ++#endif ++ _S_destroy_c_locale(_M_c_locale_messages); ++ _S_create_c_locale(_M_c_locale_messages, __s); ++ } +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2004-01-09 18:20:23.000000000 -0600 +@@ -0,0 +1,578 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = space; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[0] = sign; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[0] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = space; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__space) ++ { ++ // Have space. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ } ++ else ++ { ++ // Have none. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__space) ++ { ++ // Have space. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ } ++ else ++ { ++ // Have none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ default: ++ ; ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_decimal_point = '.'; ++ _M_thousands_sep = ','; ++ _M_grouping = ""; ++ _M_curr_symbol = ""; ++ _M_positive_sign = ""; ++ _M_negative_sign = ""; ++ _M_frac_digits = 0; ++ _M_pos_format = money_base::_S_default_pattern; ++ _M_neg_format = money_base::_S_default_pattern; ++ } ++ else ++ { ++ // Named locale. ++ _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc)); ++ _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc)); ++ _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_negative_sign = "()"; ++ else ++ _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ ++ // _Intl == true ++ _M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); ++ } ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_decimal_point = '.'; ++ _M_thousands_sep = ','; ++ _M_grouping = ""; ++ _M_curr_symbol = ""; ++ _M_positive_sign = ""; ++ _M_negative_sign = ""; ++ _M_frac_digits = 0; ++ _M_pos_format = money_base::_S_default_pattern; ++ _M_neg_format = money_base::_S_default_pattern; ++ } ++ else ++ { ++ // Named locale. ++ _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc)); ++ _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc)); ++ _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_negative_sign = "()"; ++ else ++ _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ ++ // _Intl == false ++ _M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); ++ } ++ } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { } ++ ++#ifdef _GLIBCPP_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_decimal_point = L'.'; ++ _M_thousands_sep = L','; ++ _M_grouping = ""; ++ _M_curr_symbol = L""; ++ _M_positive_sign = L""; ++ _M_negative_sign = L""; ++ _M_frac_digits = 0; ++ _M_pos_format = money_base::_S_default_pattern; ++ _M_neg_format = money_base::_S_default_pattern; ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_decimal_point = __cloc->decimal_point_wc; ++ _M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_decimal_point = __global_locale->decimal_point_wc; ++ _M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ _M_decimal_point = static_cast(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); ++ ++ _M_thousands_sep = static_cast(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); ++#endif ++ _M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__cpossign, __len, &__state); ++ _M_positive_sign = __wcs; ++ } ++ else ++ _M_positive_sign = L""; ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__cnegsign, __len, &__state); ++ _M_negative_sign = __wcs; ++ } ++ else ++ _M_negative_sign = L""; ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_curr_symbol = __wcs; ++ } ++ else ++ _M_curr_symbol = L""; ++ ++ _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_decimal_point = L'.'; ++ _M_thousands_sep = L','; ++ _M_grouping = ""; ++ _M_curr_symbol = L""; ++ _M_positive_sign = L""; ++ _M_negative_sign = L""; ++ _M_frac_digits = 0; ++ _M_pos_format = money_base::_S_default_pattern; ++ _M_neg_format = money_base::_S_default_pattern; ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_decimal_point = __cloc->decimal_point_wc; ++ _M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_decimal_point = __global_locale->decimal_point_wc; ++ _M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ _M_decimal_point = static_cast(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); ++ _M_thousands_sep = static_cast(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); ++#endif ++ _M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__cpossign, __len, &__state); ++ _M_positive_sign = __wcs; ++ } ++ else ++ _M_positive_sign = L""; ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__cnegsign, __len, &__state); ++ _M_negative_sign = __wcs; ++ } ++ else ++ _M_negative_sign = L""; ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_curr_symbol = __wcs; ++ } ++ else ++ _M_curr_symbol = L""; ++ ++ _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { ++ if (wcslen(_M_positive_sign)) ++ delete [] _M_positive_sign; ++ if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0)) ++ delete [] _M_negative_sign; ++ if (wcslen(_M_curr_symbol)) ++ delete [] _M_curr_symbol; ++ } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { ++ if (wcslen(_M_positive_sign)) ++ delete [] _M_positive_sign; ++ if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0)) ++ delete [] _M_negative_sign; ++ if (wcslen(_M_curr_symbol)) ++ delete [] _M_curr_symbol; ++ } ++#endif ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2004-01-09 18:20:59.000000000 -0600 +@@ -0,0 +1,129 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_decimal_point = '.'; ++ _M_thousands_sep = ','; ++ _M_grouping = ""; ++ } ++ else ++ { ++ // Named locale. ++ _M_decimal_point = *(__nl_langinfo_l(RADIXCHAR, __cloc)); ++ _M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc)); ++ // Check for NUL, which implies no grouping. ++ if (_M_thousands_sep == '\0') ++ _M_grouping = ""; ++ else ++ _M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ } ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_truename = "true"; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_falsename = "false"; ++ } ++ ++ template<> ++ numpunct::~numpunct() ++ { } ++ ++#ifdef _GLIBCPP_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_decimal_point = L'.'; ++ _M_thousands_sep = L','; ++ _M_grouping = ""; ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_decimal_point = __cloc->decimal_point_wc; ++ _M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_decimal_point = __global_locale->decimal_point_wc; ++ _M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ _M_decimal_point = static_cast(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); ++ _M_thousands_sep = static_cast(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); ++#endif ++ if (_M_thousands_sep == L'\0') ++ _M_grouping = ""; ++ else ++ _M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ } ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_truename = L"true"; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_falsename = L"false"; ++ } ++ ++ template<> ++ numpunct::~numpunct() ++ { } ++ #endif ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.cc 2004-01-09 08:25:03.000000000 -0600 +@@ -0,0 +1,341 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __timepunct:: ++ _M_put(char* __s, size_t __maxlen, const char* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __strftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ strftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ ++ template<> ++ void ++ __timepunct::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_c_locale; ++ ++ _M_date_format = "%m/%d/%y"; ++ _M_date_era_format = "%m/%d/%y"; ++ _M_time_format = "%H:%M:%S"; ++ _M_time_era_format = "%H:%M:%S"; ++ _M_date_time_format = ""; ++ _M_date_time_era_format = ""; ++ _M_am = "AM"; ++ _M_pm = "PM"; ++ _M_am_pm_format = ""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_day1 = "Sunday"; ++ _M_day2 = "Monday"; ++ _M_day3 = "Tuesday"; ++ _M_day4 = "Wednesday"; ++ _M_day5 = "Thursday"; ++ _M_day6 = "Friday"; ++ _M_day7 = "Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_day_a1 = "Sun"; ++ _M_day_a2 = "Mon"; ++ _M_day_a3 = "Tue"; ++ _M_day_a4 = "Wed"; ++ _M_day_a5 = "Thu"; ++ _M_day_a6 = "Fri"; ++ _M_day_a7 = "Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_month01 = "January"; ++ _M_month02 = "February"; ++ _M_month03 = "March"; ++ _M_month04 = "April"; ++ _M_month05 = "May"; ++ _M_month06 = "June"; ++ _M_month07 = "July"; ++ _M_month08 = "August"; ++ _M_month09 = "September"; ++ _M_month10 = "October"; ++ _M_month11 = "November"; ++ _M_month12 = "December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_month_a01 = "Jan"; ++ _M_month_a02 = "Feb"; ++ _M_month_a03 = "Mar"; ++ _M_month_a04 = "Apr"; ++ _M_month_a05 = "May"; ++ _M_month_a06 = "Jun"; ++ _M_month_a07 = "July"; ++ _M_month_a08 = "Aug"; ++ _M_month_a09 = "Sep"; ++ _M_month_a10 = "Oct"; ++ _M_month_a11 = "Nov"; ++ _M_month_a12 = "Dec"; ++ } ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_date_format = __nl_langinfo_l(D_FMT, __cloc); ++ _M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); ++ _M_time_format = __nl_langinfo_l(T_FMT, __cloc); ++ _M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); ++ _M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); ++ _M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc); ++ _M_am = __nl_langinfo_l(AM_STR, __cloc); ++ _M_pm = __nl_langinfo_l(PM_STR, __cloc); ++ _M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_day1 = __nl_langinfo_l(DAY_1, __cloc); ++ _M_day2 = __nl_langinfo_l(DAY_2, __cloc); ++ _M_day3 = __nl_langinfo_l(DAY_3, __cloc); ++ _M_day4 = __nl_langinfo_l(DAY_4, __cloc); ++ _M_day5 = __nl_langinfo_l(DAY_5, __cloc); ++ _M_day6 = __nl_langinfo_l(DAY_6, __cloc); ++ _M_day7 = __nl_langinfo_l(DAY_7, __cloc); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_day_a1 = __nl_langinfo_l(ABDAY_1, __cloc); ++ _M_day_a2 = __nl_langinfo_l(ABDAY_2, __cloc); ++ _M_day_a3 = __nl_langinfo_l(ABDAY_3, __cloc); ++ _M_day_a4 = __nl_langinfo_l(ABDAY_4, __cloc); ++ _M_day_a5 = __nl_langinfo_l(ABDAY_5, __cloc); ++ _M_day_a6 = __nl_langinfo_l(ABDAY_6, __cloc); ++ _M_day_a7 = __nl_langinfo_l(ABDAY_7, __cloc); ++ ++ // Month names, starting with "C"'s January. ++ _M_month01 = __nl_langinfo_l(MON_1, __cloc); ++ _M_month02 = __nl_langinfo_l(MON_2, __cloc); ++ _M_month03 = __nl_langinfo_l(MON_3, __cloc); ++ _M_month04 = __nl_langinfo_l(MON_4, __cloc); ++ _M_month05 = __nl_langinfo_l(MON_5, __cloc); ++ _M_month06 = __nl_langinfo_l(MON_6, __cloc); ++ _M_month07 = __nl_langinfo_l(MON_7, __cloc); ++ _M_month08 = __nl_langinfo_l(MON_8, __cloc); ++ _M_month09 = __nl_langinfo_l(MON_9, __cloc); ++ _M_month10 = __nl_langinfo_l(MON_10, __cloc); ++ _M_month11 = __nl_langinfo_l(MON_11, __cloc); ++ _M_month12 = __nl_langinfo_l(MON_12, __cloc); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_month_a01 = __nl_langinfo_l(ABMON_1, __cloc); ++ _M_month_a02 = __nl_langinfo_l(ABMON_2, __cloc); ++ _M_month_a03 = __nl_langinfo_l(ABMON_3, __cloc); ++ _M_month_a04 = __nl_langinfo_l(ABMON_4, __cloc); ++ _M_month_a05 = __nl_langinfo_l(ABMON_5, __cloc); ++ _M_month_a06 = __nl_langinfo_l(ABMON_6, __cloc); ++ _M_month_a07 = __nl_langinfo_l(ABMON_7, __cloc); ++ _M_month_a08 = __nl_langinfo_l(ABMON_8, __cloc); ++ _M_month_a09 = __nl_langinfo_l(ABMON_9, __cloc); ++ _M_month_a10 = __nl_langinfo_l(ABMON_10, __cloc); ++ _M_month_a11 = __nl_langinfo_l(ABMON_11, __cloc); ++ _M_month_a12 = __nl_langinfo_l(ABMON_12, __cloc); ++ } ++ } ++ ++#ifdef _GLIBCPP_USE_WCHAR_T ++ template<> ++ void ++ __timepunct:: ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ wcsftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ ++ template<> ++ void ++ __timepunct::_M_initialize_timepunct(__c_locale __cloc) ++ { ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_c_locale; ++ ++ _M_date_format = L"%m/%d/%y"; ++ _M_date_era_format = L"%m/%d/%y"; ++ _M_time_format = L"%H:%M:%S"; ++ _M_time_era_format = L"%H:%M:%S"; ++ _M_date_time_format = L""; ++ _M_date_time_era_format = L""; ++ _M_am = L"AM"; ++ _M_pm = L"PM"; ++ _M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_day1 = L"Sunday"; ++ _M_day2 = L"Monday"; ++ _M_day3 = L"Tuesday"; ++ _M_day4 = L"Wednesday"; ++ _M_day5 = L"Thursday"; ++ _M_day6 = L"Friday"; ++ _M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_day_a1 = L"Sun"; ++ _M_day_a2 = L"Mon"; ++ _M_day_a3 = L"Tue"; ++ _M_day_a4 = L"Wed"; ++ _M_day_a5 = L"Thu"; ++ _M_day_a6 = L"Fri"; ++ _M_day_a7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_month01 = L"January"; ++ _M_month02 = L"February"; ++ _M_month03 = L"March"; ++ _M_month04 = L"April"; ++ _M_month05 = L"May"; ++ _M_month06 = L"June"; ++ _M_month07 = L"July"; ++ _M_month08 = L"August"; ++ _M_month09 = L"September"; ++ _M_month10 = L"October"; ++ _M_month11 = L"November"; ++ _M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_month_a01 = L"Jan"; ++ _M_month_a02 = L"Feb"; ++ _M_month_a03 = L"Mar"; ++ _M_month_a04 = L"Apr"; ++ _M_month_a05 = L"May"; ++ _M_month_a06 = L"Jun"; ++ _M_month_a07 = L"July"; ++ _M_month_a08 = L"Aug"; ++ _M_month_a09 = L"Sep"; ++ _M_month_a10 = L"Oct"; ++ _M_month_a11 = L"Nov"; ++ _M_month_a12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_date_format = reinterpret_cast(__nl_langinfo_l(_NL_WD_FMT, __cloc)); ++ _M_date_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc)); ++ _M_time_format = reinterpret_cast(__nl_langinfo_l(_NL_WT_FMT, __cloc)); ++ _M_time_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc)); ++ _M_date_time_format = reinterpret_cast(__nl_langinfo_l(_NL_WD_T_FMT, __cloc)); ++ _M_date_time_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc)); ++ _M_am = reinterpret_cast(__nl_langinfo_l(_NL_WAM_STR, __cloc)); ++ _M_pm = reinterpret_cast(__nl_langinfo_l(_NL_WPM_STR, __cloc)); ++ _M_am_pm_format = reinterpret_cast(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc)); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_day1 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_1, __cloc)); ++ _M_day2 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_2, __cloc)); ++ _M_day3 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_3, __cloc)); ++ _M_day4 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_4, __cloc)); ++ _M_day5 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_5, __cloc)); ++ _M_day6 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_6, __cloc)); ++ _M_day7 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_7, __cloc)); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_day_a1 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_1, __cloc)); ++ _M_day_a2 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_2, __cloc)); ++ _M_day_a3 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_3, __cloc)); ++ _M_day_a4 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_4, __cloc)); ++ _M_day_a5 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_5, __cloc)); ++ _M_day_a6 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_6, __cloc)); ++ _M_day_a7 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_7, __cloc)); ++ ++ // Month names, starting with "C"'s January. ++ _M_month01 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_1, __cloc)); ++ _M_month02 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_2, __cloc)); ++ _M_month03 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_3, __cloc)); ++ _M_month04 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_4, __cloc)); ++ _M_month05 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_5, __cloc)); ++ _M_month06 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_6, __cloc)); ++ _M_month07 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_7, __cloc)); ++ _M_month08 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_8, __cloc)); ++ _M_month09 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_9, __cloc)); ++ _M_month10 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_10, __cloc)); ++ _M_month11 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_11, __cloc)); ++ _M_month12 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_12, __cloc)); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_month_a01 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_1, __cloc)); ++ _M_month_a02 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_2, __cloc)); ++ _M_month_a03 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_3, __cloc)); ++ _M_month_a04 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_4, __cloc)); ++ _M_month_a05 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_5, __cloc)); ++ _M_month_a06 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_6, __cloc)); ++ _M_month_a07 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_7, __cloc)); ++ _M_month_a08 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_8, __cloc)); ++ _M_month_a09 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_9, __cloc)); ++ _M_month_a10 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_10, __cloc)); ++ _M_month_a11 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_11, __cloc)); ++ _M_month_a12 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_12, __cloc)); ++ } ++#endif // 0 ++ } ++#endif ++} +diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.h 2004-01-09 04:26:21.000000000 -0600 +@@ -0,0 +1,68 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik ++ ++ template ++ __timepunct<_CharT>::__timepunct(size_t __refs) ++ : locale::facet(__refs) ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ _M_name_timepunct = _S_c_name; ++#endif ++ _M_initialize_timepunct(); ++ } ++ ++ template ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, ++ const char* __s, ++ size_t __refs) ++ : locale::facet(__refs) ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ _M_name_timepunct = new char[strlen(__s) + 1]; ++ strcpy(_M_name_timepunct, __s); ++#endif ++ _M_initialize_timepunct(__cloc); ++ } ++ ++ template ++ __timepunct<_CharT>::~__timepunct() ++ { ++#ifndef __UCLIBC_HAS_XLOCALE__ ++ if (_S_c_name != _M_name_timepunct) ++ delete [] _M_name_timepunct; ++#endif ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_base.h +--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_base.h 2004-01-09 02:54:54.000000000 -0600 +@@ -0,0 +1,57 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ // NB: Offsets into ctype::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISgraph; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalnum; ++ }; +diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_inline.h +--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast(__c)] & __m; } ++ ++ const char* ++ ctype:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_noninline.h +--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2004-01-09 03:34:53.000000000 -0600 +@@ -0,0 +1,90 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype::classic_table() throw() ++ { ++ return __C_ctype_b; ++ } ++ ++ ctype::ctype(__c_locale, const mask* __table, bool __del, ++ size_t __refs) ++ : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ _M_c_locale_ctype = _S_c_locale; ++ } ++ ++ ctype::ctype(const mask* __table, bool __del, size_t __refs) : ++ __ctype_abstract_base(__refs), _M_del(__table != 0 && __del) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ _M_c_locale_ctype = _S_c_locale; ++ } ++ ++ char ++ ctype::do_toupper(char __c) const ++ { return _M_toupper[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype::do_tolower(char __c) const ++ { return _M_tolower[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/os_defines.h +--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/os_defines.h 2004-01-09 04:56:13.000000000 -0600 +@@ -0,0 +1,56 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) ++// any later version. ++ ++// This library 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 library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCPP_OS_DEFINES ++#define _GLIBCPP_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include ++ ++// These systems have declarations mismatching those in libio.h by ++// omitting throw qualifiers. Cleanest way out is to not provide ++// throw-qualifiers at all. Defining it as empty here will make libio.h ++// not define it. ++#undef __THROW ++#define __THROW ++ ++// Tell Glibc not to try to provide its own inline versions of ++// some math functions. Those cause assembly-time clashes with ++// our definitions. ++#define __NO_MATH_INLINES ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif diff --git a/obsolete-buildroot/sources/gcc-uclibc-3.3-loop.patch b/obsolete-buildroot/sources/gcc-uclibc-3.3-loop.patch new file mode 100644 index 0000000000..476f84b377 --- /dev/null +++ b/obsolete-buildroot/sources/gcc-uclibc-3.3-loop.patch @@ -0,0 +1,10 @@ +--- gcc/gcc/loop.c 14 Feb 2004 14:46:03 -0000 1.488.2.3 ++++ gcc/gcc/loop.c 28 Apr 2004 22:02:53 -0000 +@@ -929,6 +929,7 @@ + || (! (GET_CODE (SET_SRC (set)) == REG + && (REGNO (SET_SRC (set)) + < FIRST_PSEUDO_REGISTER)))) ++ && regno >= FIRST_PSEUDO_REGISTER + /* This test is not redundant; SET_SRC (set) might be + a call-clobbered register and the life of REGNO + might span a call. */ diff --git a/obsolete-buildroot/sources/gcc2.95-mega.patch.bz2 b/obsolete-buildroot/sources/gcc2.95-mega.patch.bz2 new file mode 100644 index 0000000000..4dffd849b6 Binary files /dev/null and b/obsolete-buildroot/sources/gcc2.95-mega.patch.bz2 differ diff --git a/obsolete-buildroot/sources/gcc2.95-uclibc-conf.patch b/obsolete-buildroot/sources/gcc2.95-uclibc-conf.patch new file mode 100644 index 0000000000..f244387cc9 --- /dev/null +++ b/obsolete-buildroot/sources/gcc2.95-uclibc-conf.patch @@ -0,0 +1,291 @@ +Warning! The powerpc patch (rs6000/linux.h) is hack-ish and would +definitely need to be improved to be acceptable upstream. Also, +this patch isn't complete as it only supports i386, arm, mips, and +powerpc (rs6000). +diff -urN gcc-20011006/config.sub gcc-20011006-new/config.sub +--- gcc-20011006/config.sub 2004-01-13 06:15:28.000000000 -0600 ++++ gcc-20011006-new/config.sub 2004-01-10 11:09:35.000000000 -0600 +@@ -68,7 +68,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- linux-gnu*) ++ linux-gnu* | linux-uclibc*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -936,7 +936,8 @@ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -mingw32* | -linux-gnu* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* ) + # Remember, each alternative MUST END IN *, to match a version number. + ;; +diff -urN gcc-20011006/gcc/config/arm/linux-elf.h gcc-20011006-new/gcc/config/arm/linux-elf.h +--- gcc-20011006/gcc/config/arm/linux-elf.h 2004-01-13 06:15:28.000000000 -0600 ++++ gcc-20011006-new/gcc/config/arm/linux-elf.h 2004-01-10 11:12:11.000000000 -0600 +@@ -90,6 +90,18 @@ + #define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + ++#ifdef USE_UCLIBC ++#define LINK_SPEC "%{h*} %{version:-v} \ ++ %{b} %{Wl,*:%*} \ ++ %{static:-Bstatic} \ ++ %{shared:-shared} \ ++ %{symbolic:-Bsymbolic} \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \ ++ -X \ ++ %{mbig-endian:-EB}" \ ++ SUBTARGET_EXTRA_LINK_SPEC ++#else + #define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ +@@ -100,6 +112,7 @@ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC ++#endif + + #undef CPP_PREDEFINES + #define CPP_PREDEFINES \ +diff -urN gcc-20011006/gcc/config/i386/linux.h gcc-20011006-new/gcc/config/i386/linux.h +--- gcc-20011006/gcc/config/i386/linux.h 2001-04-03 17:38:59.000000000 -0500 ++++ gcc-20011006-new/gcc/config/i386/linux.h 2004-01-10 11:15:38.000000000 -0600 +@@ -199,6 +199,15 @@ + %{static:-static}}}" + #endif + #else ++#if defined USE_UCLIBC ++#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ ++ %{!shared: \ ++ %{!ibcs: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}}" ++#else + #define LINK_SPEC "-m elf_i386 %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ +@@ -207,6 +216,7 @@ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}}}" + #endif ++#endif + + /* Get perform_* macros to build libgcc.a. */ + #include "i386/perform.h" +diff -urN gcc-20011006/gcc/config/mips/linux.h gcc-20011006-new/gcc/config/mips/linux.h +--- gcc-20011006/gcc/config/mips/linux.h 2004-01-13 06:15:28.000000000 -0600 ++++ gcc-20011006-new/gcc/config/mips/linux.h 2004-01-10 11:16:39.000000000 -0600 +@@ -154,6 +154,17 @@ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define LINK_SPEC \ ++ "%(endian_spec) \ ++ %{shared:-shared} \ ++ %{!shared: \ ++ %{!ibcs: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}}" ++#else + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ +@@ -163,6 +174,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ + %{static:-static}}}" ++#endif + + + #undef SUBTARGET_ASM_SPEC +diff -urN old/gcc-20011006/gcc/config/mips/t-linux-uclibc gcc-20011006/gcc/config/mips/t-linux-uclibc +--- old/gcc-20011006/gcc/config/mips/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-20011006/gcc/config/mips/t-linux-uclibc 2004-01-14 02:51:10.000000000 -0600 +@@ -0,0 +1 @@ ++T_CFLAGS = -DUSE_UCLIBC +diff -urN gcc-20011006/gcc/config/rs6000/linux.h gcc-20011006-new/gcc/config/rs6000/linux.h +--- gcc-20011006/gcc/config/rs6000/linux.h 2001-04-03 17:38:59.000000000 -0500 ++++ gcc-20011006-new/gcc/config/rs6000/linux.h 2004-01-10 11:15:38.000000000 -0600 +@@ -36,12 +36,21 @@ + #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" + + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define LINK_SPEC "-m elf32ppclinux %{G*} %{shared:-shared} \ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}" ++#else + #define LINK_SPEC "-m elf32ppclinux %{G*} %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ + %{static:-static}}" ++#endif + + #undef LIB_DEFAULT_SPEC + #define LIB_DEFAULT_SPEC "%(lib_linux)" +diff -urN gcc-20011006/gcc/config/t-linux-uclibc gcc-20011006-new/gcc/config/t-linux-uclibc +--- gcc-20011006/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-20011006-new/gcc/config/t-linux-uclibc 2004-01-10 11:18:46.000000000 -0600 +@@ -0,0 +1,18 @@ ++T_CFLAGS = -DUSE_UCLIBC ++ ++# Don't run fixproto ++STMP_FIXPROTO = ++ ++# Don't install "assert.h" in gcc. We use the one in glibc. ++INSTALL_ASSERT_H = ++ ++# Compile crtbeginS.o and crtendS.o with pic. ++CRTSTUFF_T_CFLAGS_S = -fPIC ++# Compile libgcc2.a with pic. ++TARGET_LIBGCC2_CFLAGS = -fPIC ++ ++# Do not build libgcc1. Let gcc generate those functions. The GNU/Linux ++# C library can handle them. ++LIBGCC1 = ++CROSS_LIBGCC1 = ++LIBGCC1_TEST = +diff -urN gcc-20011006/gcc/configure gcc-20011006-new/gcc/configure +--- gcc-20011006/gcc/configure 2004-01-13 06:15:28.000000000 -0600 ++++ gcc-20011006-new/gcc/configure 2004-01-10 11:28:54.000000000 -0600 +@@ -3219,6 +3219,24 @@ + ;; + esac + ;; ++ arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc ++ xm_file=arm/xm-linux.h ++ xmake_file=x-linux ++ tm_file="arm/linux-elf.h" ++ case $machine in ++ armv2*-*-*) ++ tm_file="arm/linux-elf26.h $tm_file" ++ ;; ++ esac ++ tmake_file="t-linux-uclibc arm/t-linux" ++ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++ gnu_ld=yes ++ case x${enable_threads} in ++ x | xyes | xpthreads | xposix) ++ thread_file='posix' ++ ;; ++ esac ++ ;; + arm*-*-aout) + tm_file=arm/aout.h + tmake_file=arm/t-bare +@@ -3631,6 +3649,18 @@ + thread_file='single' + fi + ;; ++ i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux ++ # with ELF format using uClibc ++ xmake_file=x-linux ++ tm_file=i386/linux.h ++ tmake_file="t-linux-uclibc i386/t-crtstuff" ++ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++ gnu_ld=yes ++ float_format=i386 ++ if test x$enable_threads = xyes; then ++ thread_file='posix' ++ fi ++ ;; + i[34567]86-*-linux-gnu*) # Intel 80386's running GNU/Linux + # aka GNU/Linux C library 6 + xmake_file=x-linux +@@ -4696,7 +4726,19 @@ + # On NetBSD, the headers are already okay, except for math.h. + tmake_file=t-netbsd + ;; +- mips*-*-linux*) # Linux MIPS, either endian. ++ mips*-*-linux-uclibc*) # Linux (uclibc) MIPS, either endian. ++ tmake_file=mips/t-linux-uclibc ++ xmake_file=x-linux ++ xm_file="xm-siglist.h ${xm_file}" ++ case $machine in ++ mipsel-*) tm_file="mips/elfl.h mips/linux.h" ;; ++ *) tm_file="mips/elf.h mips/linux.h" ;; ++ esac ++ extra_parts="crtbegin.o crtend.o" ++ gnu_ld=yes ++ gas=yes ++ ;; ++ mips*-*-linux*) # Linux MIPS, either endian. + xmake_file=x-linux + xm_file="xm-siglist.h ${xm_file}" + case $machine in +@@ -5159,6 +5201,24 @@ + thread_file='posix' + fi + ;; ++ powerpc-*-linux-uclibc*) ++ tm_file=rs6000/linux.h ++ xm_file="xm-siglist.h rs6000/xm-sysv4.h" ++ xm_defines="USG ${xm_defines}" ++ out_file=rs6000/rs6000.c ++ if test x$gas = xyes ++ then ++ tmake_file="rs6000/t-ppcos t-linux-uclibc rs6000/t-ppccomm" ++ else ++ tmake_file="rs6000/t-ppc t-linux-uclibc rs6000/t-ppccomm" ++ fi ++ xmake_file=x-linux ++ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++ extra_headers=ppc-asm.h ++ if test x$enable_threads = xyes; then ++ thread_file='posix' ++ fi ++ ;; + powerpc-wrs-vxworks*) + cpu_type=rs6000 + xm_file="xm-siglist.h rs6000/xm-sysv4.h" +diff -urN gcc-20011006/ltconfig gcc-20011006-new/ltconfig +--- gcc-20011006/ltconfig 1999-06-21 21:35:12.000000000 -0500 ++++ gcc-20011006-new/ltconfig 2004-01-10 11:34:23.000000000 -0600 +@@ -436,6 +436,7 @@ + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case "$host_os" in + linux-gnu*) ;; ++linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1773,6 +1774,22 @@ + fi + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ++ file_magic_cmd=/usr/bin/file ++ file_magic_test_file=`echo /lib/libuClibc-*.so` ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then diff --git a/obsolete-buildroot/sources/gcc3.3-mega.patch.bz2 b/obsolete-buildroot/sources/gcc3.3-mega.patch.bz2 new file mode 100644 index 0000000000..adfda5f1a2 Binary files /dev/null and b/obsolete-buildroot/sources/gcc3.3-mega.patch.bz2 differ diff --git a/obsolete-buildroot/sources/gdb-5.3-uclibc.patch b/obsolete-buildroot/sources/gdb-5.3-uclibc.patch new file mode 100644 index 0000000000..f9853035e3 --- /dev/null +++ b/obsolete-buildroot/sources/gdb-5.3-uclibc.patch @@ -0,0 +1,154 @@ +diff -urN gdb-5.3/bfd/config.bfd gdb-5.3-new/bfd/config.bfd +--- gdb-5.3/bfd/config.bfd 2002-09-05 15:34:35.000000000 -0500 ++++ gdb-5.3-new/bfd/config.bfd 2004-01-11 06:25:31.000000000 -0600 +@@ -83,7 +83,7 @@ + targ_defvec=ecoffalpha_little_vec + targ_selvecs=bfd_elf64_alpha_vec + ;; +- alpha*-*-linux-gnu* | alpha*-*-elf*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*) + targ_defvec=bfd_elf64_alpha_vec + targ_selvecs=ecoffalpha_little_vec + ;; +@@ -97,7 +97,8 @@ + targ_defvec=bfd_elf64_ia64_aix_little_vec + targ_selvecs="bfd_elf64_ia64_aix_big_vec bfd_efi_app_ia64_vec" + ;; +- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf*) ++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | \ ++ ia64*-*-linux-uclibc* | ia64*-*-elf*) + targ_defvec=bfd_elf64_ia64_little_vec + targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" + ;; +@@ -176,11 +177,12 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- armeb-*-elf | arm*b-*-linux-gnu*) ++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) + targ_defvec=bfd_elf32_bigarm_vec + targ_selvecs=bfd_elf32_littlearm_vec + ;; +- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux*) ++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | \ ++ arm*-*-conix* | arm*-*-uclinux*) + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +@@ -313,7 +315,7 @@ + ;; + + #ifdef BFD64 +- hppa*64*-*-linux-gnu*) ++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) + targ_defvec=bfd_elf64_hppa_linux_vec + targ_selvecs=bfd_elf64_hppa_vec + ;; +@@ -324,7 +326,7 @@ + ;; + #endif + +- hppa*-*-linux-gnu*) ++ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) + targ_defvec=bfd_elf32_hppa_linux_vec + targ_selvecs=bfd_elf32_hppa_vec + ;; +@@ -424,7 +426,7 @@ + targ_selvecs=bfd_elf32_i386_vec + targ_underscore=yes + ;; +- i[3456]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" + targ64_selvecs=bfd_elf64_x86_64_vec +@@ -438,7 +440,7 @@ + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" + ;; +- x86_64-*-linux-gnu*) ++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" + ;; +@@ -589,7 +591,7 @@ + targ_defvec=hp300hpux_vec + targ_underscore=yes + ;; +- m68*-*-linux*aout*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + targ_defvec=m68klinux_vec + targ_selvecs=bfd_elf32_m68k_vec + targ_underscore=yes +@@ -865,7 +867,8 @@ + ;; + #endif + powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ +- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ ++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \ ++ powerpc-*-rtems* | \ + powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*) + targ_defvec=bfd_elf32_powerpc_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" +@@ -887,8 +890,8 @@ + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcqnx_vec ppcboot_vec" + ;; + powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ +- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\ +- powerpcle-*-rtems*) ++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\ ++ powerpcle-*-vxworks* | powerpcle-*-rtems*) + targ_defvec=bfd_elf32_powerpcle_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" + targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" +@@ -1038,7 +1041,7 @@ + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + targ_underscore=yes + ;; +- sparc-*-linux-gnu*) ++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) + targ_defvec=bfd_elf32_sparc_vec + targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec" + ;; +@@ -1081,7 +1084,7 @@ + targ_defvec=sunos_big_vec + targ_underscore=yes + ;; +- sparc64-*-linux-gnu*) ++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) + targ_defvec=bfd_elf64_sparc_vec + targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" + ;; +diff -urN gdb-5.3/bfd/configure gdb-5.3-new/bfd/configure +--- gdb-5.3/bfd/configure 2002-08-28 05:38:44.000000000 -0500 ++++ gdb-5.3-new/bfd/configure 2004-01-11 06:27:15.000000000 -0600 +@@ -1677,6 +1677,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5067,7 +5072,7 @@ + alpha*-*-freebsd*) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -5126,7 +5131,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386mach3.h"' + ;; +- i[3456]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' + ;; diff --git a/obsolete-buildroot/sources/gdb.patch b/obsolete-buildroot/sources/gdb.patch new file mode 100644 index 0000000000..e44b15ccdf --- /dev/null +++ b/obsolete-buildroot/sources/gdb.patch @@ -0,0 +1,633 @@ +Patch pending upstream, probably acceptable. +-------------------------------------------- + + + +Daniel Jacobowitz writes: +> I like this. The way func_frame_chain_valid should really be used is +> by something like: +> +> /* NOTE: tm-i386nw.h and tm-i386v4.h override this. */ +> set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); +> +> (copied from i386-tdep.c). +> +> Does this patch work for you? + +Yes, thanks. I've included a revised version of my patch below. + +> I'm curious as to why we can't just set this universally, or at least a +> little more globally. Most things that have a main () use it as a +> normal main (). I'd propose that we set it as the default frame chain, +> and provide/document an option to ignore inside_main_func. + +Well, gdbarch is never supposed to change the default behavior of +macros; this helps us convert pre-gdbarch targets incrementally. +Simply turning on gdbarch for one's target ideally wouldn't change its +behavior at all. + + +[Patch revised for Debian snapshot] +--- snap/gdb/i386-linux-tdep.c.orig 2002-08-18 19:53:57.000000000 -0400 ++++ snap/gdb/i386-linux-tdep.c 2002-08-18 19:54:31.000000000 -0400 +@@ -452,6 +452,9 @@ + + set_solib_svr4_fetch_link_map_offsets (gdbarch, + i386_linux_svr4_fetch_link_map_offsets); ++ ++ set_gdbarch_frame_chain_valid (gdbarch, ++ generic_func_frame_chain_valid); + } + + /* Provide a prototype to silence -Wmissing-prototypes. */ +[Hurd needs 6. Take 8, since it does no real harm.] + + +Package: gdb +Severity: normal +Tags: patch, sid + +Hello, + +GDB will crash on the Hurd after issuing the 'show' and hitting enter +a few times: + +../../gdb/ui-out.c:130: gdb-internal-error: push_level: Assertion +`uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS' failed. + +the problem is that MAX_UI_OUT_LEVELS is not high enough for the extra +option we have on the Hurd, it should be rised to 6 then, which works +fine: + +--- gdb-5.2.cvs20020401/gdb/ui-out.c~ Fri May 3 02:19:20 2002 ++++ gdb-5.2.cvs20020401/gdb/ui-out.c Fri May 3 02:19:32 2002 +@@ -45,7 +45,7 @@ + is always available. Stack/nested level 0 is reserved for the + top-level result. */ + +-enum { MAX_UI_OUT_LEVELS = 5 }; ++enum { MAX_UI_OUT_LEVELS = 8 }; + + struct ui_out_level + { + +-- +Robert Millan + +"5 years from now everyone will be running +free GNU on their 200 MIPS, 64M SPARCstation-5" + + Andrew S. Tanenbaum, 30 Jan 1992 + + +Submitted upstream, not liked very much. It's a hack, but it will do for +now. + +2002-07-31 Daniel Jacobowitz + + Fix PR gdb/568 + * thread-db.c (lwp_from_thread): Only warn if unable to find + the thread. + +Index: thread-db.c +=================================================================== +RCS file: /cvs/src/src/gdb/thread-db.c,v +retrieving revision 1.22 +diff -u -p -r1.22 thread-db.c +--- gdb/gdb/thread-db.c 23 Mar 2002 17:38:13 -0000 1.22 ++++ gdb/gdb/thread-db.c 31 Jul 2002 16:29:52 -0000 +@@ -260,6 +260,12 @@ lwp_from_thread (ptid_t ptid) + return ptid; + + err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th); ++ if (err == TD_ERR) ++ { ++ warning ("Cannot find thread %ld: %s", ++ (long) GET_THREAD (ptid), thread_db_err_str (err)); ++ return ptid; ++ } + if (err != TD_OK) + error ("Cannot find thread %ld: %s", + (long) GET_THREAD (ptid), thread_db_err_str (err)); +From Michael Fedrowitz . Not submitted to FSF yet. + + Hi, + +gdb fails to build from source on m68k because some definitions have +been removed from tm-m68k.h. The patch below readds them. + +-Michael + + +diff -urN gdb-5.2.cvs20020818.orig/gdb/config/m68k/tm-m68k.h gdb-5.2.cvs20020818/gdb/config/m68k/tm-m68k.h +--- gdb-5.2.cvs20020818.orig/gdb/config/m68k/tm-m68k.h 2002-07-10 19:01:38.000000000 +0200 ++++ gdb-5.2.cvs20020818/gdb/config/m68k/tm-m68k.h 2002-10-06 18:01:59.000000000 +0200 +@@ -26,8 +26,11 @@ + /* Generic 68000 stuff, to be included by other tm-*.h files. */ + + /* D0_REGNM and A0_REGNUM must be defined here because they are +- used by the monitor. */ ++ used by the monitor. FPC_REGNUM, FPS_REGNUM and FPI_REGNUM are ++ defined here because they are used by m68klinux-nat.c. */ + + #define D0_REGNUM 0 + #define A0_REGNUM 8 +- ++#define FPC_REGNUM 26 ++#define FPS_REGNUM 27 ++#define FPI_REGNUM 28 + + +2002-11-24 Daniel Jacobowitz + + * doublest.c (convert_floatformat_to_doublest): Cast exp_bias to int. + * config/alpha/alpha-linux.mh (MH_CFLAGS): Add -mieee. + +--- gdb-5.2.debian90.cvs20021120/gdb/doublest.c.orig 2002-11-24 17:48:16.000000000 -0500 ++++ gdb-5.2.debian90.cvs20021120/gdb/doublest.c 2002-11-24 17:48:25.000000000 -0500 +@@ -177,7 +177,7 @@ + if (!special_exponent) + exponent -= fmt->exp_bias; + else if (exponent == 0) +- exponent = 1 - fmt->exp_bias; ++ exponent = 1 - (int)fmt->exp_bias; + + /* Build the result algebraically. Might go infinite, underflow, etc; + who cares. */ +--- gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh.orig 2002-11-24 17:50:30.000000000 -0500 ++++ gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh 2002-11-24 17:50:41.000000000 -0500 +@@ -8,3 +8,5 @@ + + MMALLOC = + MMALLOC_CFLAGS = -DNO_MMALLOC ++ ++MH_CFLAGS = -mieee +In CVS but not in 5.3 branch... + +2002-10-23 Daniel Jacobowitz + + * lin-lwp.c (lin_lwp_resume): Remove resume_all test for !step. + +Index: lin-lwp.c +=================================================================== +RCS file: /cvs/src/src/gdb/lin-lwp.c,v +retrieving revision 1.35 +diff -u -p -r1.35 lin-lwp.c +--- gdb-5.2.90/gdb/lin-lwp.c 27 Aug 2002 22:37:06 -0000 1.35 ++++ gdb-5.2.90/gdb/lin-lwp.c 23 Oct 2002 04:23:13 -0000 +@@ -579,11 +579,8 @@ lin_lwp_resume (ptid_t ptid, int step, e + struct lwp_info *lp; + int resume_all; + +- /* Apparently the interpretation of PID is dependent on STEP: If +- STEP is non-zero, a specific PID means `step only this process +- id'. But if STEP is zero, then PID means `continue *all* +- processes, but give the signal only to this one'. */ +- resume_all = (PIDGET (ptid) == -1) || !step; ++ /* A specific PTID means `step only this process id'. */ ++ resume_all = (PIDGET (ptid) == -1); + + if (resume_all) + iterate_over_lwps (resume_set_callback, NULL); + +Not submitted yet, testing. + +--- gdb-5.2.90/gdb/alpha-tdep.c.orig Sun Nov 24 21:42:53 2002 ++++ gdb-5.2.90/gdb/alpha-tdep.c Sun Nov 24 21:48:26 2002 +@@ -99,10 +99,12 @@ + + static alpha_extra_func_info_t heuristic_proc_desc (CORE_ADDR, + CORE_ADDR, +- struct frame_info *); ++ struct frame_info *, ++ int); + + static alpha_extra_func_info_t find_proc_desc (CORE_ADDR, +- struct frame_info *); ++ struct frame_info *, ++ int); + + #if 0 + static int alpha_in_lenient_prologue (CORE_ADDR, CORE_ADDR); +@@ -512,7 +514,7 @@ + if (tmp != 0) + pc = tmp; + +- proc_desc = find_proc_desc (pc, frame->next); ++ proc_desc = find_proc_desc (pc, frame->next, 1); + pcreg = proc_desc ? PROC_PC_REG (proc_desc) : ALPHA_RA_REGNUM; + + if (frame->signal_handler_caller) +@@ -596,10 +598,10 @@ + + static alpha_extra_func_info_t + heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc, +- struct frame_info *next_frame) ++ struct frame_info *next_frame, int read_sp_p) + { +- CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM); +- CORE_ADDR vfp = sp; ++ CORE_ADDR sp; ++ CORE_ADDR vfp; + CORE_ADDR cur_pc; + int frame_size; + int has_frame_reg = 0; +@@ -607,6 +609,11 @@ + int pcreg = -1; + int regno; + ++ if (read_sp_p) ++ vfp = sp = read_next_frame_reg (next_frame, SP_REGNUM); ++ else ++ vfp = sp = 0; ++ + if (start_pc == 0) + return NULL; + memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc)); +@@ -761,7 +768,7 @@ + CORE_ADDR func_addr, func_end; + + if (!proc_desc) +- proc_desc = find_proc_desc (pc, NULL); ++ proc_desc = find_proc_desc (pc, NULL, 0); + + if (proc_desc) + { +@@ -807,7 +814,7 @@ + } + + static alpha_extra_func_info_t +-find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame) ++find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int read_sp_p) + { + alpha_extra_func_info_t proc_desc; + struct block *b; +@@ -879,7 +886,7 @@ + { + alpha_extra_func_info_t found_heuristic = + heuristic_proc_desc (PROC_LOW_ADDR (proc_desc), +- pc, next_frame); ++ pc, next_frame, read_sp_p); + if (found_heuristic) + { + PROC_LOCALOFF (found_heuristic) = +@@ -921,7 +928,7 @@ + startaddr = heuristic_proc_start (pc); + + proc_desc = +- heuristic_proc_desc (startaddr, pc, next_frame); ++ heuristic_proc_desc (startaddr, pc, next_frame, read_sp_p); + } + return proc_desc; + } +@@ -937,7 +944,7 @@ + if (saved_pc == 0 || inside_entry_file (saved_pc)) + return 0; + +- proc_desc = find_proc_desc (saved_pc, frame); ++ proc_desc = find_proc_desc (saved_pc, frame, 1); + if (!proc_desc) + return 0; + +@@ -979,7 +986,7 @@ + { + /* Use proc_desc calculated in frame_chain */ + alpha_extra_func_info_t proc_desc = +- frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next); ++ frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next, 1); + + frame->extra_info = (struct frame_extra_info *) + frame_obstack_alloc (sizeof (struct frame_extra_info)); +@@ -1291,7 +1298,7 @@ + /* we need proc_desc to know how to restore the registers; + if it is NULL, construct (a temporary) one */ + if (proc_desc == NULL) +- proc_desc = find_proc_desc (frame->pc, frame->next); ++ proc_desc = find_proc_desc (frame->pc, frame->next, 1); + + /* Question: should we copy this proc_desc and save it in + frame->proc_desc? If we do, who will free it? +Not yet submitted upstream. This requires some serious thinking about. +If the target stack worked in any logical way, this wouldn't be necessary... +ending up with roughly: + thread_stratum: thread-db (silent reference to lin-lwp) + core_stratum: corelow + exec_stratum: exec + dummy_stratum: dummy +just makes no sense. + +This patch fixes debugging threaded applications which are statically linked +without breaking debugging threaded core files. It also fixes the PIDs in +generate-core-file'd corefiles. Mostly. + +diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c gdb-5.2.debian90.cvs20021120/gdb/corelow.c +--- o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c 2002-09-18 13:23:15.000000000 -0400 ++++ gdb-5.2.debian90.cvs20021120/gdb/corelow.c 2002-12-03 14:03:32.000000000 -0500 +@@ -350,7 +350,7 @@ + bfd_map_over_sections (core_bfd, add_to_thread_list, + bfd_get_section_by_name (core_bfd, ".reg")); + +- if (ontop) ++ if (ontop || 1) + { + /* Fetch all registers from core file. */ + target_fetch_registers (-1); +diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c +--- o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c 2002-12-03 14:13:52.000000000 -0500 ++++ gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c 2002-12-03 13:56:34.000000000 -0500 +@@ -177,7 +177,7 @@ + #ifdef FILL_FPXREGSET + gdb_fpxregset_t fpxregs; + #endif +- unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid); ++ unsigned long merged_pid = ptid_get_tid (ptid) << 16; /* | ptid_get_pid (ptid); */ + + fill_gregset (&gregs, -1); + note_data = (char *) elfcore_write_prstatus (obfd, +diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/target.c gdb-5.2.debian90.cvs20021120/gdb/target.c +--- o/gdb-5.2.debian90.cvs20021120/gdb/target.c 2002-09-18 13:23:22.000000000 -0400 ++++ gdb-5.2.debian90.cvs20021120/gdb/target.c 2002-12-03 14:06:07.000000000 -0500 +@@ -1589,6 +1589,7 @@ + dummy_target.to_find_memory_regions = dummy_find_memory_regions; + dummy_target.to_make_corefile_notes = dummy_make_corefile_notes; + dummy_target.to_magic = OPS_MAGIC; ++ cleanup_target (&dummy_target); + } + + +diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c gdb-5.2.debian90.cvs20021120/gdb/thread-db.c +--- o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c 2002-12-03 14:13:50.000000000 -0500 ++++ gdb-5.2.debian90.cvs20021120/gdb/thread-db.c 2002-12-03 13:39:54.000000000 -0500 +@@ -57,6 +57,31 @@ + /* Non-zero if we're using this module's target vector. */ + static int using_thread_db; + ++/* Macros to pass an event to the next target if we should not be handling it ++ here in the thread_stratum. */ ++#define FIND_NEXT_TARGET(METHOD_NAME) \ ++ struct target_ops *next_target = &thread_db_ops; \ ++ while (1) \ ++ { \ ++ next_target = find_target_beneath (next_target); \ ++ if (next_target->METHOD_NAME != NULL) \ ++ break; \ ++ } ++ ++#define MAYBE_HAND_DOWN(METHOD_NAME,ARGS) \ ++ if (proc_handle.pid == 0) \ ++ { \ ++ FIND_NEXT_TARGET (METHOD_NAME); \ ++ (*next_target->METHOD_NAME) ARGS; \ ++ return; \ ++ } ++#define MAYBE_HAND_DOWN_RETURN(METHOD_NAME,ARGS) \ ++ if (proc_handle.pid == 0) \ ++ { \ ++ FIND_NEXT_TARGET (METHOD_NAME); \ ++ return (*next_target->METHOD_NAME) ARGS; \ ++ } ++ + /* Non-zero if we have to keep this module's target vector active + across re-runs. */ + static int keep_thread_db; +@@ -489,9 +514,7 @@ + { + td_err_e err; + +- /* Don't attempt to use thread_db on targets which can not run +- (core files). */ +- if (objfile == NULL || !target_has_execution) ++ if (objfile == NULL) + { + /* All symbols have been discarded. If the thread_db target is + active, deactivate it now. */ +@@ -515,7 +538,10 @@ + /* Initialize the structure that identifies the child process. Note + that at this point there is no guarantee that we actually have a + child process. */ +- proc_handle.pid = GET_PID (inferior_ptid); ++ if (target_has_execution) ++ proc_handle.pid = GET_PID (inferior_ptid); ++ else ++ proc_handle.pid = 0; + + /* Now attempt to open a connection to the thread library. */ + err = td_ta_new_p (&proc_handle, &thread_agent); +@@ -758,6 +784,9 @@ + struct cleanup *old_chain = save_inferior_ptid (); + int xfer; + ++ MAYBE_HAND_DOWN_RETURN (to_xfer_memory, (memaddr, myaddr, len, write, ++ attrib, target)); ++ + if (is_thread (inferior_ptid)) + { + /* FIXME: This seems to be necessary to make sure breakpoints +@@ -782,6 +811,8 @@ + gdb_prfpregset_t fpregset; + td_err_e err; + ++ MAYBE_HAND_DOWN (to_fetch_registers, (regno)); ++ + if (!is_thread (inferior_ptid)) + { + /* Pass the request to the target beneath us. */ +@@ -819,6 +850,8 @@ + gdb_prfpregset_t fpregset; + td_err_e err; + ++ MAYBE_HAND_DOWN (to_store_registers, (regno)); ++ + if (!is_thread (inferior_ptid)) + { + /* Pass the request to the target beneath us. */ +@@ -908,6 +941,8 @@ + td_thrinfo_t ti; + td_err_e err; + ++ MAYBE_HAND_DOWN_RETURN (to_thread_alive, (ptid)); ++ + if (is_thread (ptid)) + { + err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th); +@@ -961,6 +996,8 @@ + { + td_err_e err; + ++ MAYBE_HAND_DOWN (to_find_new_threads, ()); ++ + /* Iterate over all user-space threads to discover new threads. */ + err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL, + TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, +@@ -972,6 +1009,8 @@ + static char * + thread_db_pid_to_str (ptid_t ptid) + { ++ MAYBE_HAND_DOWN_RETURN (to_pid_to_str, (ptid)); ++ + if (is_thread (ptid)) + { + static char buf[64]; +Trivial. Need to submit this. + +--- gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c.orig 2002-12-03 14:35:44.000000000 -0500 ++++ gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c 2002-12-03 14:43:02.000000000 -0500 +@@ -861,6 +861,8 @@ + else + line = gdb_readline (0); + ++ if (line == NULL || *line == EOF) ++ break; + linetype = validate_actionline (&line, t); + if (linetype == BADLINE) + continue; /* already warned -- collect another line */ +Fix build on Sparc. + +--- gdb-5.3/gdb/sparc-nat.c.orig 2003-01-04 00:11:28.000000000 -0500 ++++ gdb-5.3/gdb/sparc-nat.c 2003-01-04 00:12:42.000000000 -0500 +@@ -33,6 +33,13 @@ + #include + #include + #ifdef __linux__ ++/* Sadly, conflicts with on Linux. And ++ -D_GNU_SOURCE brings in implicitly with . ++ Hack around this. */ ++#undef FPU_REGS_TYPE ++#define fpu asm_reg_fpu ++#define fq asm_reg_fq ++#define fpq asm_reg_fpq + #include + #else + #include +diff -urN gdb-5.3/gdb/gdbserver.orig/gdbreplay.c gdb-5.3/gdb/gdbserver/gdbreplay.c +--- gdb-5.3/gdb/gdbserver.orig/gdbreplay.c 2002-07-09 11:38:58.000000000 -0600 ++++ gdb-5.3/gdb/gdbserver/gdbreplay.c 2003-08-20 08:44:20.000000000 -0600 +@@ -54,14 +54,15 @@ + perror_with_name (char *string) + { + #ifndef STDC_HEADERS +- extern int sys_nerr; + extern char *sys_errlist[]; + extern int errno; + #endif + const char *err; + char *combined; + +- err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error"; ++ err = strerror (errno); ++ if (err == NULL) ++ err = "unknown error"; + combined = (char *) alloca (strlen (err) + strlen (string) + 3); + strcpy (combined, string); + strcat (combined, ": "); +diff -urN gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c gdb-5.3/gdb/gdbserver/low-hppabsd.c +--- gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c 2002-01-17 14:13:49.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-hppabsd.c 2003-08-20 08:46:04.000000000 -0600 +@@ -61,7 +61,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-lynx.c gdb-5.3/gdb/gdbserver/low-lynx.c +--- gdb-5.3/gdb/gdbserver.orig/low-lynx.c 2002-01-17 14:13:49.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-lynx.c 2003-08-20 08:46:18.000000000 -0600 +@@ -79,7 +79,7 @@ + + fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n", + getpid (), program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-nbsd.c gdb-5.3/gdb/gdbserver/low-nbsd.c +--- gdb-5.3/gdb/gdbserver.orig/low-nbsd.c 2002-01-17 14:13:49.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-nbsd.c 2003-08-20 08:46:27.000000000 -0600 +@@ -137,7 +137,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-sparc.c gdb-5.3/gdb/gdbserver/low-sparc.c +--- gdb-5.3/gdb/gdbserver.orig/low-sparc.c 2002-01-17 14:13:50.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-sparc.c 2003-08-20 08:46:38.000000000 -0600 +@@ -44,7 +44,6 @@ + #include + #include + +-extern int sys_nerr; + extern char **sys_errlist; + extern int errno; + +@@ -67,7 +66,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-sun3.c gdb-5.3/gdb/gdbserver/low-sun3.c +--- gdb-5.3/gdb/gdbserver.orig/low-sun3.c 2002-01-17 14:13:50.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-sun3.c 2003-08-20 08:46:51.000000000 -0600 +@@ -41,7 +41,6 @@ + #include + #include + +-extern int sys_nerr; + extern char **sys_errlist; + extern int errno; + +@@ -64,7 +63,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/utils.c gdb-5.3/gdb/gdbserver/utils.c +--- gdb-5.3/gdb/gdbserver.orig/utils.c 2003-08-20 08:47:56.000000000 -0600 ++++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:48:15.000000000 -0600 +@@ -33,16 +33,13 @@ + perror_with_name (char *string) + { + #ifndef STDC_HEADERS +- extern int sys_nerr; +- extern char *sys_errlist[]; + extern int errno; + #endif + const char *err; + char *combined; + +- if (errno < sys_nerr) +- err = sys_errlist[errno]; +- else ++ err = strerror (errno); ++ if (err == NULL) + err = "unknown error"; + + combined = (char *) alloca (strlen (err) + strlen (string) + 3); +diff -urN gdb-5.3/gdb/gdbserver.orig/linux-low.c.orig gdb-5.3/gdb/gdbserver/linux-low.c.orig +--- gdb-5.3/gdb/gdbserver.orig/linux-low.c 2003-08-20 08:40:27.000000000 -0600 ++++ gdb-5.3/gdb/gdbserver/linux-low.c 2003-08-20 08:44:54.000000000 -0600 +@@ -175,8 +175,7 @@ + if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0) + { + fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error", +- errno); ++ strerror (errno), errno); + fflush (stderr); + + /* If we fail to attach to an LWP, just return. */ + diff --git a/obsolete-buildroot/sources/genext2fs.patch b/obsolete-buildroot/sources/genext2fs.patch new file mode 100644 index 0000000000..73e5ce0aaa --- /dev/null +++ b/obsolete-buildroot/sources/genext2fs.patch @@ -0,0 +1,2457 @@ +diff -urN genext2fs-1.3.orig/Makefile genext2fs-1.3/Makefile +--- genext2fs-1.3.orig/Makefile 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/Makefile 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,46 @@ ++CC=gcc ++CFLAGS=-Wall -O0 -g ++ ++SRC=genext2fs.c ++OBJS=$(patsubst %.c,%.o, $(SRC)) ++ ++all: genext2fs ++INSTALL=install ++ ++genext2fs: $(OBJS) ++ $(CC) $(CFLAGS) -o $@ $(OBJS) -o $@ ++ ++$(OBJS): %.o : %.c ++ $(CC) $(CFLAGS) -c $< -o $@ ++ ++$(OBJS): Makefile ++ ++install: ++ $(INSTALL) -d $(DESTDIR)/usr/bin/ ++ $(INSTALL) -m 755 genext2fs $(DESTDIR)/usr/bin/ ++ $(INSTALL) -d $(DESTDIR)/usr/share/man/man8/ ++ $(INSTALL) -m 644 genext2fs.8 $(DESTDIR)/usr/share/man/man8/ ++ ++clean: ++ rm -rf *.o *.a core genext2fs ++ rm -rf test ext2.img ++ ++check: all ++ mkdir -p test ++ dd if=/dev/zero of=test/zero count=1 ++ ./genext2fs -b 4096 -d test ext2.img ++ ++ md5=`md5sum ext2.img | cut -f 1 -d " "`; \ ++ if [ "$$md5" != "89471302d95f96a76fbb2cff98182cde" ] ; then \ ++ echo "test failed."; \ ++ else \ ++ echo "test succeeded."; \ ++ fi ++ ++# test genext2fs by creating the image and comparing checksums ++test: all ++ sh ./test.sh ++ ++# test genext2fs by actually mounting the created image. ++test-mount: all ++ sudo sh ./test-mount.sh +diff -urN genext2fs-1.3.orig/debian/changelog genext2fs-1.3/debian/changelog +--- genext2fs-1.3.orig/debian/changelog 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/debian/changelog 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,17 @@ ++genext2fs (1.3-2) unstable; urgency=low ++ ++ * apply fix from upstream cvs that appears to fix endian bug ++ (closes: #122411) ++ * mention filesystem size limit in manpage (closes: #122729) ++ * mention that hard links are not supported in manpage ++ (closes: #155464) ++ * add sanity check at the end of the build ++ ++ -- David Kimdon Fri, 8 Mar 2002 23:17:36 -0800 ++ ++genext2fs (1.3-1) unstable; urgency=low ++ ++ * Initial Release. (closes: #105263) ++ ++ -- David Kimdon Sat, 14 Jul 2001 13:24:49 -0700 ++ +diff -urN genext2fs-1.3.orig/debian/control genext2fs-1.3/debian/control +--- genext2fs-1.3.orig/debian/control 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/debian/control 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,19 @@ ++Source: genext2fs ++Section: admin ++Priority: optional ++Maintainer: David Kimdon ++Build-Depends: debhelper (>> 3.0.0) ++Standards-Version: 3.5.2 ++ ++Package: genext2fs ++Architecture: any ++Depends: ${shlibs:Depends} ++Description: ext2 filesystem generator for embedded systems ++ `genext2fs' is meant to generate an ext2 filesystem ++ as a normal (non-root) user. It doesn't require you to mount ++ the image file to copy files on it. It doesn't even require ++ you to be the superuser to make device nodes. ++ . ++ Warning ! `genext2fs' has been designed for embedded ++ systems. As such, it will generate a filesystem for single-user ++ usage: all files/directories/etc... will belong to UID/GID 0 +diff -urN genext2fs-1.3.orig/debian/copyright genext2fs-1.3/debian/copyright +--- genext2fs-1.3.orig/debian/copyright 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/debian/copyright 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,15 @@ ++This package was debianized by David Kimdon on ++Sat, 14 Jul 2001 13:24:49 -0700. ++ ++It was downloaded from http://freshmeat.net/projects/genext2fs/ ++Upstream Author(s): Xavier Bestel ++ ++Copyright (C) 2000 Xavier Bestel ++ ++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; version ++2 of the License. ++ ++On Debian systems, the complete text of the GNU General Public ++License can be found in /usr/share/common-licenses/GPL file. +diff -urN genext2fs-1.3.orig/debian/rules genext2fs-1.3/debian/rules +--- genext2fs-1.3.orig/debian/rules 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/debian/rules 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,70 @@ ++#!/usr/bin/make -f ++# Sample debian/rules that uses debhelper. ++# GNU copyright 1997 to 1999 by Joey Hess. ++ ++# Uncomment this to turn on verbose mode. ++#export DH_VERBOSE=1 ++ ++# This is the debhelper compatability version to use. ++export DH_COMPAT=2 ++ ++configure: configure-stamp ++configure-stamp: ++ dh_testdir ++ # Add here commands to configure the package. ++ # ./configure --prefix=/usr --mandir=/usr/share/man/ ++ ++ touch configure-stamp ++ ++build: configure-stamp build-stamp ++build-stamp: ++ dh_testdir ++ ++ # Add here commands to compile the package. ++ $(MAKE) ++ $(MAKE) check ++ ++ touch build-stamp ++ ++clean: ++ dh_testdir ++ dh_testroot ++ rm -f build-stamp configure-stamp ++ ++ # Add here commands to clean up after the build process. ++ -$(MAKE) clean ++ ++ dh_clean ++ ++install: build ++ dh_testdir ++ dh_testroot ++ dh_clean -k ++ dh_installdirs ++ ++ # Add here commands to install the package into debian/genext2fs. ++ $(MAKE) install DESTDIR=`pwd`/debian/genext2fs ++ ++ ++# Build architecture-independent files here. ++binary-indep: build install ++# We have nothing to do by default. ++ ++# Build architecture-dependent files here. ++binary-arch: build install ++ dh_testdir ++ dh_testroot ++ dh_installdocs ++ dh_installchangelogs ++ dh_link ++ dh_strip ++ dh_compress ++ dh_fixperms ++ dh_installdeb ++ dh_shlibdeps ++ dh_gencontrol ++ dh_md5sums ++ dh_builddeb ++ ++binary: binary-indep binary-arch ++.PHONY: build clean binary-indep binary-arch binary install configure +diff -urN genext2fs-1.3.orig/dev.txt genext2fs-1.3/dev.txt +--- genext2fs-1.3.orig/dev.txt 2000-09-28 09:03:19.000000000 -0600 ++++ genext2fs-1.3/dev.txt 1969-12-31 17:00:00.000000000 -0700 +@@ -1,94 +0,0 @@ +-drwx /dev +-crw- 10,190 /dev/lcd +-crw- 10,191 /dev/splc781 +-crw- 4,0 /dev/console +-crw- 5,64 /dev/cua0 +-crw- 5,65 /dev/cua1 +-crw- 5,66 /dev/cua2 +-crw- 5,70 /dev/cua6 +-crw- 5,71 /dev/cua7 +-crw- 5,72 /dev/cua8 +-crw- 5,73 /dev/cua9 +-crw- 29,0 /dev/fb0 +-crw- 29,32 /dev/fb1 +-crw- 1,2 /dev/kmem +-crw- 1,1 /dev/mem +-crw- 1,3 /dev/null +-crw- 2,2 /dev/ptyp2 +-crw- 2,3 /dev/ptyp3 +-crw- 2,5 /dev/ptyp5 +-crw- 2,4 /dev/ptyp4 +-crw- 10,178 /dev/triokb +-crw- 2,0 /dev/ptyp0 +-crw- 2,6 /dev/ptyp6 +-crw- 2,7 /dev/ptyp7 +-crw- 2,8 /dev/ptyp8 +-crw- 2,9 /dev/ptyp9 +-crw- 2,10 /dev/ptypa +-crw- 2,11 /dev/ptypb +-crw- 2,12 /dev/ptypc +-crw- 2,13 /dev/ptypd +-crw- 2,14 /dev/ptype +-crw- 2,15 /dev/ptypf +-brw- 1,0 /dev/ram0 +-brw- 1,1 /dev/ram1 +-brw- 1,2 /dev/ram2 +-brw- 1,3 /dev/ram3 +-br-- 31,0 /dev/rom0 +-brw- 31,1 /dev/rom1 +-brw- 31,2 /dev/rom2 +-brw- 31,3 /dev/rom3 +-crw- 5,0 /dev/tty +-crw- 4,0 /dev/tty0 +-crwx 4,1 /dev/tty1 +-crwx 4,2 /dev/tty2 +-crwx 4,3 /dev/tty3 +-crwx 4,4 /dev/tty4 +-crw- 4,5 /dev/tty5 +-crwx 4,6 /dev/tty6 +-crw- 4,7 /dev/tty7 +-crw- 4,8 /dev/tty8 +-crw- 4,9 /dev/tty9 +-crw- 4,64 /dev/ttyS0 +-crw- 4,65 /dev/ttyS1 +-crw- 4,66 /dev/ttyS2 +-crw- 4,67 /dev/ttyS3 +-crw- 4,68 /dev/ttyS4 +-crw- 4,69 /dev/ttyS5 +-crw- 4,70 /dev/ttyS6 +-crw- 4,71 /dev/ttyS7 +-crw- 4,72 /dev/ttyS8 +-crw- 4,73 /dev/ttyS9 +-crw- 3,0 /dev/ttyp0 +-crw- 3,1 /dev/ttyp1 +-crw- 3,2 /dev/ttyp2 +-crw- 3,3 /dev/ttyp3 +-crw- 3,4 /dev/ttyp4 +-crw- 3,5 /dev/ttyp5 +-crw- 3,6 /dev/ttyp6 +-crw- 3,7 /dev/ttyp7 +-crw- 3,8 /dev/ttyp8 +-crw- 3,9 /dev/ttyp9 +-crw- 3,10 /dev/ttypa +-crw- 3,11 /dev/ttypb +-crw- 3,12 /dev/ttypc +-crw- 3,13 /dev/ttypd +-crw- 3,14 /dev/ttype +-crw- 3,15 /dev/ttypf +-crw- 1,5 /dev/zero +-crwx 10,111 /dev/dtedrv +-crwx 4,110 /dev/ttyM +-crw- 77,1 /dev/tssnd +-crw- 77,2 /dev/tstone +-crw- 2,1 /dev/ptyp1 +-crwx 10,180 /dev/triohook +-crw- 90,0 /dev/mtd0 +-brw- 44,0 /dev/ftl0 +-crw- 10,175 /dev/tporta +-crw- 10,176 /dev/tportb +-crwx 10,100 /dev/softmodem +-crwx 10,101 /dev/softmodem_signals +-crwx 10,181 /dev/triovoice +-crw- 5,67 /dev/cua3 +-crw- 5,68 /dev/cua4 +-crw- 5,69 /dev/cua5 +diff -urN genext2fs-1.3.orig/device_table.txt genext2fs-1.3/device_table.txt +--- genext2fs-1.3.orig/device_table.txt 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/device_table.txt 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,129 @@ ++# When building a target filesystem, it is desirable to not have to ++# become root and then run 'mknod' a thousand times. Using a device ++# table you can create device nodes and directories "on the fly". ++# ++# This is a sample device table file for use with genext2fs. You can ++# do all sorts of interesting things with a device table file. For ++# example, if you want to adjust the permissions on a particular file ++# you can just add an entry like: ++# /sbin/foobar f 2755 0 0 - - - - - ++# and (assuming the file /sbin/foobar exists) it will be made setuid ++# root (regardless of what its permissions are on the host filesystem. ++# Furthermore, you can use a single table entry to create a many device ++# minors. For example, if I wanted to create /dev/hda and /dev/hda[0-15] ++# I could just use the following two table entries: ++# /dev/hda b 640 0 0 3 0 0 0 - ++# /dev/hda b 640 0 0 3 1 1 1 15 ++# ++# Device table entries take the form of: ++# ++# where name is the file name, type can be one of: ++# f A regular file ++# d Directory ++# c Character special device file ++# b Block special device file ++# p Fifo (named pipe) ++# uid is the user id for the target file, gid is the group id for the ++# target file. The rest of the entries (major, minor, etc) apply only ++# to device special files. ++ ++# Have fun ++# -Erik Andersen ++# ++ ++# ++/dev d 755 0 0 - - - - - ++/dev/mem c 640 0 0 1 1 0 0 - ++/dev/kmem c 640 0 0 1 2 0 0 - ++/dev/null c 640 0 0 1 3 0 0 - ++/dev/zero c 640 0 0 1 5 0 0 - ++/dev/random c 640 0 0 1 8 0 0 - ++/dev/urandom c 640 0 0 1 9 0 0 - ++/dev/tty c 666 0 0 5 0 0 0 - ++/dev/tty c 666 0 0 4 0 0 1 6 ++/dev/console c 640 0 0 5 1 0 0 - ++/dev/ram b 640 0 0 1 1 0 0 - ++/dev/ram b 640 0 0 1 0 0 1 4 ++/dev/loop b 640 0 0 7 0 0 1 2 ++/dev/ptmx c 666 0 0 5 2 0 0 - ++#/dev/ttyS c 640 0 0 4 64 0 1 4 ++#/dev/psaux c 640 0 0 10 1 0 0 - ++#/dev/rtc c 640 0 0 10 135 0 0 - ++ ++# Adjust permissions on some normal files ++#/etc/shadow f 600 0 0 - - - - - ++#/bin/tinylogin f 4755 0 0 - - - - - ++ ++# User-mode Linux stuff ++/dev/ubda b 640 0 0 98 0 0 0 - ++/dev/ubda b 640 0 0 98 1 1 1 15 ++ ++# IDE Devices ++/dev/hda b 640 0 0 3 0 0 0 - ++/dev/hda b 640 0 0 3 1 1 1 15 ++/dev/hdb b 640 0 0 3 64 0 0 - ++/dev/hdb b 640 0 0 3 65 1 1 15 ++#/dev/hdc b 640 0 0 22 0 0 0 - ++#/dev/hdc b 640 0 0 22 1 1 1 15 ++#/dev/hdd b 640 0 0 22 64 0 0 - ++#/dev/hdd b 640 0 0 22 65 1 1 15 ++#/dev/hde b 640 0 0 33 0 0 0 - ++#/dev/hde b 640 0 0 33 1 1 1 15 ++#/dev/hdf b 640 0 0 33 64 0 0 - ++#/dev/hdf b 640 0 0 33 65 1 1 15 ++#/dev/hdg b 640 0 0 34 0 0 0 - ++#/dev/hdg b 640 0 0 34 1 1 1 15 ++#/dev/hdh b 640 0 0 34 64 0 0 - ++#/dev/hdh b 640 0 0 34 65 1 1 15 ++ ++# SCSI Devices ++#/dev/sda b 640 0 0 8 0 0 0 - ++#/dev/sda b 640 0 0 8 1 1 1 15 ++#/dev/sdb b 640 0 0 8 16 0 0 - ++#/dev/sdb b 640 0 0 8 17 1 1 15 ++#/dev/sdc b 640 0 0 8 32 0 0 - ++#/dev/sdc b 640 0 0 8 33 1 1 15 ++#/dev/sdd b 640 0 0 8 48 0 0 - ++#/dev/sdd b 640 0 0 8 49 1 1 15 ++#/dev/sde b 640 0 0 8 64 0 0 - ++#/dev/sde b 640 0 0 8 65 1 1 15 ++#/dev/sdf b 640 0 0 8 80 0 0 - ++#/dev/sdf b 640 0 0 8 81 1 1 15 ++#/dev/sdg b 640 0 0 8 96 0 0 - ++#/dev/sdg b 640 0 0 8 97 1 1 15 ++#/dev/sdh b 640 0 0 8 112 0 0 - ++#/dev/sdh b 640 0 0 8 113 1 1 15 ++#/dev/sg c 640 0 0 21 0 0 1 15 ++#/dev/scd b 640 0 0 11 0 0 1 15 ++#/dev/st c 640 0 0 9 0 0 1 8 ++#/dev/nst c 640 0 0 9 128 0 1 8 ++#/dev/st c 640 0 0 9 32 1 1 4 ++#/dev/st c 640 0 0 9 64 1 1 4 ++#/dev/st c 640 0 0 9 96 1 1 4 ++ ++# Floppy disk devices ++#/dev/fd b 640 0 0 2 0 0 1 2 ++#/dev/fd0d360 b 640 0 0 2 4 0 0 - ++#/dev/fd1d360 b 640 0 0 2 5 0 0 - ++#/dev/fd0h1200 b 640 0 0 2 8 0 0 - ++#/dev/fd1h1200 b 640 0 0 2 9 0 0 - ++#/dev/fd0u1440 b 640 0 0 2 28 0 0 - ++#/dev/fd1u1440 b 640 0 0 2 29 0 0 - ++#/dev/fd0u2880 b 640 0 0 2 32 0 0 - ++#/dev/fd1u2880 b 640 0 0 2 33 0 0 - ++ ++# All the proprietary cdrom devices in the world ++#/dev/aztcd b 640 0 0 29 0 0 0 - ++#/dev/bpcd b 640 0 0 41 0 0 0 - ++#/dev/capi20 c 640 0 0 68 0 0 1 2 ++#/dev/cdu31a b 640 0 0 15 0 0 0 - ++#/dev/cdu535 b 640 0 0 24 0 0 0 - ++#/dev/cm206cd b 640 0 0 32 0 0 0 - ++#/dev/sjcd b 640 0 0 18 0 0 0 - ++#/dev/sonycd b 640 0 0 15 0 0 0 - ++#/dev/gscd b 640 0 0 16 0 0 0 - ++#/dev/sbpcd b 640 0 0 25 0 0 0 - ++#/dev/sbpcd b 640 0 0 25 0 0 1 4 ++#/dev/mcd b 640 0 0 23 0 0 0 - ++#/dev/optcd b 640 0 0 17 0 0 0 - ++ +diff -urN genext2fs-1.3.orig/genext2fs.8 genext2fs-1.3/genext2fs.8 +--- genext2fs-1.3.orig/genext2fs.8 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/genext2fs.8 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,125 @@ ++.\" Hey, EMACS: -*- nroff -*- ++.\" First parameter, NAME, should be all caps ++.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection ++.\" other parameters are allowed: see man(7), man(1) ++.TH GENEXT2FS 8 "July 14, 2001" ++.\" Please adjust this date whenever revising the manpage. ++.\" ++.\" Some roff macros, for reference: ++.\" .nh disable hyphenation ++.\" .hy enable hyphenation ++.\" .ad l left justify ++.\" .ad b justify to both left and right margins ++.\" .nf disable filling ++.\" .fi enable filling ++.\" .br insert line break ++.\" .sp insert n+1 empty lines ++.\" for manpage-specific macros, see man(7) ++.SH NAME ++genext2fs \- ext2 filesystem generator for embedded systems ++.SH SYNOPSIS ++.B genext2fs ++.RI [ options ] " image" ++.SH DESCRIPTION ++\fBgenext2fs\fP generates an ext2 filesystem ++as a normal (non-root) user. It doesn't require you to mount ++the image file to copy files on it. It doesn't even require ++you to be the superuser to make device nodes. ++.SH OPTIONS ++.TP ++.BI -x \ image ++Use this image as a starting point ++.TP ++.BI -d \ directory ++Add this directory as source ++.TP ++.BI -f \ FILE ++.TP ++.BI -D \ FILE ++Uses the named FILE as a device table file, to create device ++nodes and directories "on the fly". ++.TP ++.BI -b \ blocks ++Size in blocks ++.TP ++.BI -i \ inodes ++Number of inodes ++.TP ++.BI -r \ reserved ++Number of reserved blocks ++.TP ++.BI -g \ path ++Generate a block map file for this path ++.TP ++.BI -e \ value ++Fill unallocated blocks with value ++.TP ++.BI -z ++Make files with holes ++.TP ++.BI -U ++Squash owners making all files be owned by root ++.TP ++.BI -P ++Squash permissions on all files ++.TP ++.BI -q ++Squash permissions and owners (same as -P -U) ++.TP ++.BI -v ++Print resulting filesystem structure ++.TP ++.BI -h ++Display help ++.TP ++.SH EXAMPLES ++ ++.EX ++.B ++ genext2fs -b 1440 -d src /dev/fd0 ++.EE ++ ++All files in the ++.I src ++directory will be written to ++.B /dev/fd0 ++as a new ext2 filesystem image. You can then mount the floppy as ++usual. ++ ++.EX ++.B ++ genext2fs -b 1024 -d src -D device_table.txt flashdisk.img ++.EE ++ ++This example builds a filesystem from all the files in ++.I src ++, then device nodes are created based on the content the device_table file ++.I dev.txt. ++An example device file follows: ++ ++.EX ++ # ++ /dev d 755 0 0 - - - - - ++ /dev/mem c 640 0 0 1 1 0 0 - ++ /dev/tty c 666 0 0 5 0 0 0 - ++ /dev/tty c 666 0 0 4 0 0 1 6 ++ /dev/loop b 640 0 0 7 0 0 1 2 ++ /dev/hda b 640 0 0 3 0 0 0 - ++ /dev/hda b 640 0 0 3 1 1 1 16 ++.EE ++ ++This device table creates the /dev directory, a character device ++node /dev/mem (major 1, minor 1), it also creates /dev/tty, ++/dev/tty[0-5], /dev/loop[0-1], /dev/hda, and /dev/hda0 to /dev/hda15 ++.SH BUGS ++\fBgenext2fs\fP does not support hard links. Hard links present in the input ++tree will be represented as separate files in the ext2 image. ++ ++.SH SEE ALSO ++.BR mkfs (8), ++.BR genromfs (8), ++.BR mkisofs (8). ++.br ++.SH AUTHOR ++This manual page was written by David Kimdon , ++for the Debian GNU/Linux system (but may be used by others). +diff -urN genext2fs-1.3.orig/genext2fs.c genext2fs-1.3/genext2fs.c +--- genext2fs-1.3.orig/genext2fs.c 2001-06-18 02:11:32.000000000 -0600 ++++ genext2fs-1.3/genext2fs.c 2003-04-21 01:48:35.000000000 -0600 +@@ -1,3 +1,4 @@ ++/* vi: set sw=8 ts=8: */ + // genext2fs.c + // + // ext2 filesystem generator for embedded systems +@@ -26,6 +27,22 @@ + // Bugfix: getcwd values for Solaris xavier.gueguen@col.bsf.alcatel.fr + // Bugfix: ANSI scanf for non-GNU C xavier.gueguen@col.bsf.alcatel.fr + // 28 Jun 2001 Bugfix: getcwd differs for Solaris/GNU mike@sowbug.com ++// 23 Mar 2002 Bugfix: test for IFCHR or IFBLK was flawed ++// 10 Oct 2002 Added comments,makefile targets, vsundar@ixiacom.com ++// endianess swap assert check. ++// Copyright (C) 2002 Ixia communications ++// 12 Oct 2002 Added support for triple indirection vsundar@ixiacom.com ++// Copyright (C) 2002 Ixia communications ++// 14 Oct 2002 Added support for groups vsundar@ixiacom.com ++// Copyright (C) 2002 Ixia communications ++// 5 Jan 2003 Bugfixes: reserved inodes should be set vsundar@usc.edu ++// only in the first group; directory names ++// need to be null padded at the end; and ++// number of blocks per group should be a ++// multiple of 8. Updated md5 values. ++// 6 Jan 2003 Erik Andersen added ++// mkfs.jffs2 compatible device table support, ++// along with -q, -P, -U + + + // `genext2fs' is a mean to generate an ext2 filesystem +@@ -33,10 +50,6 @@ + // the image file to copy files on it. It doesn't even require + // you to be the superuser to make device nodes. + // +-// Warning ! `genext2fs' has been designed for embedded +-// systems. As such, it will generate a filesystem for single-user +-// usage: all files/directories/etc... will belong to UID/GID 0 +-// + // Example usage: + // + // # genext2fs -b 1440 -d srcdir /dev/fd0 +@@ -45,21 +58,15 @@ + // a new ext2 filesystem image. You can then mount the floppy as + // usual. + // +-// # genext2fs -b 1024 -d builddir -f devices.txt flashdisk.img ++// # genext2fs -b 1024 -d builddir -D device_table.txt flashdisk.img + // + // This one would build a filesystem from all the files in builddir, +-// then would read a devices list and make apropriate nodes. The +-// format for the device list is: +-// +-// drwx /dev +-// crw- 10,190 /dev/lcd +-// brw- 1,0 /dev/ram0 +-// +-// This device list builds the /dev directory, a character device +-// node /dev/lcd (major 10, minor 190) and a block device node +-// /dev/ram0 (major 1, minor 0) ++// then would read the device_table.txt file and make apropriate nodes. ++// The format for the device table file is covered in detail in the sample ++// device_table.txt file provided with the genext2fs source. + + ++#define _GNU_SOURCE + #include + #include + #include +@@ -67,6 +74,11 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include + + + +@@ -76,10 +88,14 @@ + #define BLOCKSIZE 1024 + #define BLOCKS_PER_GROUP 8192 + #define BYTES_PER_INODE (8*BLOCKSIZE) ++/* Percentage of blocks that are reserved.*/ + #define RESERVED_INODES 5/100 + + + // inode block size (why is it != BLOCKSIZE ?!?) ++/* The field i_blocks in the ext2 inode stores the number of data blocks ++ but in terms of 512 bytes. That is what INODE_BLOCKSIZE represents. ++ INOBLK is the number of such blocks in an actual disk block */ + + #define INODE_BLOCKSIZE 512 + #define INOBLK (BLOCKSIZE / INODE_BLOCKSIZE) +@@ -147,6 +163,39 @@ + + #define OP_HOLES 0x01 // make files with holes + ++/* Defines for accessing group details */ ++ ++// Number of groups in the filesystem ++#define GRP_NBGROUPS(fs) ( ((fs)->sb.s_blocks_count-1)/(fs)->sb.s_blocks_per_group ) ++ ++// Get group block bitmap (bbm) given the group number ++#define GRP_GET_GROUP_BBM(fs,grp) ( get_blk((fs),(fs)->gd[(grp)].bg_block_bitmap) ) ++ ++// Get group inode bitmap (ibm) given the group number ++#define GRP_GET_GROUP_IBM(fs,grp) ( get_blk((fs),(fs)->gd[(grp)].bg_inode_bitmap) ) ++ ++// Given an inode number find the group it belongs to ++#define GRP_GROUP_OF_INODE(fs,nod) ( ((nod)-1) / (fs)->sb.s_inodes_per_group) ++ ++//Given an inode number get the inode bitmap that covers it ++#define GRP_GET_INODE_BITMAP(fs,nod) \ ++ ( GRP_GET_GROUP_IBM((fs),GRP_GROUP_OF_INODE((fs),(nod))) ) ++ ++//Given an inode number find its offset within the inode bitmap that covers it ++#define GRP_IBM_OFFSET(fs,nod) \ ++ ( (nod) - GRP_GROUP_OF_INODE((fs),(nod))*(fs)->sb.s_inodes_per_group ) ++ ++// Given a block number find the group it belongs to ++#define GRP_GROUP_OF_BLOCK(fs,blk) ( ((blk)-1) / (fs)->sb.s_blocks_per_group) ++ ++//Given a block number get the block bitmap that covers it ++#define GRP_GET_BLOCK_BITMAP(fs,blk) \ ++ ( GRP_GET_GROUP_BBM((fs),GRP_GROUP_OF_BLOCK((fs),(blk))) ) ++ ++//Given a block number find its offset within the block bitmap that covers it ++#define GRP_BBM_OFFSET(fs,blk) \ ++ ( (blk) - GRP_GROUP_OF_BLOCK((fs),(blk))*(fs)->sb.s_blocks_per_group ) ++ + + // used types + +@@ -287,7 +336,6 @@ + { + groupdescriptor_decl + uint32 bg_reserved[3]; +- uint32 bg_pad_to_bk[(BLOCKSIZE-32)/sizeof(uint32)]; + } groupdescriptor; + + typedef struct +@@ -304,6 +352,32 @@ + + typedef uint8 block[BLOCKSIZE]; + ++/* blockwalker fields: ++ The blockwalker is used to access all the blocks of a file (including ++ the indirection blocks) through repeated calls to walk_bw. ++ ++ bpdir -> index into the inode->i_block[]. Indicates level of indirection. ++ bnum -> total number of blocks so far accessed. including indirection ++ blocks. ++ bpind,bpdind,bptind -> index into indirection blocks. ++ ++ bpind, bpdind, bptind do *NOT* index into single, double and triple ++ indirect blocks resp. as you might expect from their names. Instead ++ they are in order the 1st, 2nd & 3rd index to be used ++ ++ As an example.. ++ To access data block number 70000: ++ bpdir: 15 (we are doing triple indirection) ++ bpind: 0 ( index into the triple indirection block) ++ bpdind: 16 ( index into the double indirection block) ++ bptind: 99 ( index into the single indirection block) ++ 70000 = 12 + 256 + 256*256 + 16*256 + 100 (indexing starts from zero) ++ ++ So,for double indirection bpind will index into the double indirection ++ block and bpdind into the single indirection block. For single indirection ++ only bpind will be used. ++*/ ++ + typedef struct + { + uint32 bnum; +@@ -313,15 +387,14 @@ + uint32 bptind; + } blockwalker; + ++ ++/* Filesystem structure that support groups */ + #if BLOCKSIZE == 1024 + typedef struct + { + block zero; // The famous block 0 + superblock sb; // The superblock +- groupdescriptor gd; // The group desciptor +- block bbm; // The block bitmap +- block ibm; // The inode bitmap +- inode itab[0]; // The inode table ++ groupdescriptor gd[0]; // The group descriptors + } filesystem; + #else + #error UNHANDLED BLOCKSIZE +@@ -389,25 +462,113 @@ + #undef udecl32 + #undef utdecl32 + +-char * argv0; ++static char * app_name; ++static int squash_uids = 0; ++static int squash_perms = 0; ++static const char *const memory_exhausted = "memory exhausted"; + + // error (un)handling +-inline void errexit(const char *fmt, ...) ++static void verror_msg(const char *s, va_list p) + { +- va_list ap; +- fprintf(stderr, "%s: ", argv0); +- va_start(ap, fmt); +- vfprintf(stderr, fmt, ap); +- va_end(ap); +- fprintf(stderr, "\n"); +- exit(1); ++ fflush(stdout); ++ fprintf(stderr, "%s: ", app_name); ++ vfprintf(stderr, s, p); ++} ++static void error_msg(const char *s, ...) ++{ ++ va_list p; ++ va_start(p, s); ++ verror_msg(s, p); ++ va_end(p); ++ putc('\n', stderr); ++} ++ ++static void error_msg_and_die(const char *s, ...) ++{ ++ va_list p; ++ va_start(p, s); ++ verror_msg(s, p); ++ va_end(p); ++ putc('\n', stderr); ++ exit(EXIT_FAILURE); ++} ++ ++static void vperror_msg(const char *s, va_list p) ++{ ++ int err = errno; ++ if (s == 0) ++ s = ""; ++ verror_msg(s, p); ++ if (*s) ++ s = ": "; ++ fprintf(stderr, "%s%s\n", s, strerror(err)); ++} ++ ++#if 0 ++static void perror_msg(const char *s, ...) ++{ ++ va_list p; ++ va_start(p, s); ++ vperror_msg(s, p); ++ va_end(p); ++} ++#endif ++static void perror_msg_and_die(const char *s, ...) ++{ ++ va_list p; ++ va_start(p, s); ++ vperror_msg(s, p); ++ va_end(p); ++ exit(EXIT_FAILURE); + } + +-inline void pexit(const char * fname) ++static FILE *xfopen(const char *path, const char *mode) + { +- fprintf(stderr, "%s: ", argv0); +- perror(fname); +- exit(1); ++ FILE *fp; ++ if ((fp = fopen(path, mode)) == NULL) ++ perror_msg_and_die("%s", path); ++ return fp; ++} ++ ++static char *xstrdup(const char *s) ++{ ++ char *t; ++ ++ if (s == NULL) ++ return NULL; ++ t = strdup(s); ++ if (t == NULL) ++ error_msg_and_die(memory_exhausted); ++ return t; ++} ++ ++extern void *xrealloc(void *ptr, size_t size) ++{ ++ ptr = realloc(ptr, size); ++ if (ptr == NULL && size != 0) ++ error_msg_and_die(memory_exhausted); ++ return ptr; ++} ++ ++static char *xreadlink(const char *path) ++{ ++ static const int GROWBY = 80; /* how large we will grow strings by */ ++ ++ char *buf = NULL; ++ int bufsize = 0, readsize = 0; ++ ++ do { ++ buf = xrealloc(buf, bufsize += GROWBY); ++ readsize = readlink(path, buf, bufsize); /* 1st try */ ++ if (readsize == -1) { ++ perror_msg_and_die("%s:%s", app_name, path); ++ } ++ } ++ while (bufsize < readsize + 1); ++ ++ buf[readsize] = '\0'; ++ ++ return buf; + } + + // printf helper macro +@@ -423,7 +584,7 @@ + { + } + +-// rounds a quantity up to a blocksize ++/* Rounds qty upto a multiple of siz. siz should be a power of 2 */ + uint32 rndup(uint32 qty, uint32 siz) + { + return (qty + (siz - 1)) & ~(siz - 1); +@@ -444,7 +605,13 @@ + // return a given inode from a filesystem + inline inode * get_nod(filesystem *fs, uint32 nod) + { +- return &fs->itab[nod-1]; ++ int grp,offset; ++ inode *itab; ++ ++ offset = GRP_IBM_OFFSET(fs,nod); ++ grp = GRP_GROUP_OF_INODE(fs,nod); ++ itab = (inode *)get_blk(fs, fs->gd[grp].bg_inode_table); ++ return itab+offset-1; + } + + // allocate a given block/inode in the bitmap +@@ -479,29 +646,57 @@ + } + + // allocate a block +-uint32 alloc_blk(filesystem *fs) ++uint32 alloc_blk(filesystem *fs, uint32 nod) + { +- uint32 bk; +- if(!(bk = allocate(fs->bbm, 0))) +- errexit("couldn't allocate a block (no free space)"); +- if(!(fs->gd.bg_free_blocks_count--)) +- errexit("group descr. free blocks count == 0 (corrupted fs?)"); ++ uint32 bk=0; ++ uint32 grp,nbgroups; ++ ++ grp = nod/fs->sb.s_inodes_per_group; ++ nbgroups = ( fs->sb.s_blocks_count - fs->sb.s_first_data_block + fs->sb.s_blocks_per_group -1 ) / ++ fs->sb.s_blocks_per_group; ++ if(!(bk = allocate(get_blk(fs,fs->gd[grp].bg_block_bitmap), 0))) { ++ for(grp=0;grpgd[grp].bg_block_bitmap),0); ++ grp--; ++ } ++ if (!bk) ++ error_msg_and_die("couldn't allocate a block (no free space)"); ++ if(!(fs->gd[grp].bg_free_blocks_count--)) ++ error_msg_and_die("group descr %d. free blocks count == 0 (corrupted fs?)",grp); + if(!(fs->sb.s_free_blocks_count--)) +- errexit("superblock free blocks count == 0 (corrupted fs?)"); +- return bk; ++ error_msg_and_die("superblock free blocks count == 0 (corrupted fs?)"); ++ return fs->sb.s_blocks_per_group*grp + bk; + } + + // allocate an inode + uint32 alloc_nod(filesystem *fs) + { +- uint32 nod; +- if(!(nod = allocate(fs->ibm, 0))) +- errexit("couldn't allocate an inode (no free inode)"); +- if(!(fs->gd.bg_free_inodes_count--)) +- errexit("group descr. free blocks count == 0 (corrupted fs?)"); ++ uint32 nod=0,best_group=0; ++ uint32 grp,nbgroups,avefreei; ++ ++ nbgroups = ( fs->sb.s_blocks_count - fs->sb.s_first_data_block + fs->sb.s_blocks_per_group -1 ) / ++ fs->sb.s_blocks_per_group; ++ ++ /* Distribute inodes amongst all the blocks */ ++ /* For every block group with more than average number of free inodes */ ++ /* find the one with the most free blocks and allocate node there */ ++ /* Idea from find_group_dir in fs/ext2/ialloc.c in 2.4.19 kernel */ ++ /* We do it for all inodes. */ ++ avefreei = fs->sb.s_free_inodes_count / nbgroups; ++ for(grp=0;grpgd[grp].bg_free_inodes_count < avefreei) ++ continue; ++ if (!best_group || ++ fs->gd[grp].bg_free_blocks_count > fs->gd[best_group].bg_free_blocks_count) ++ best_group = grp; ++ } ++ if (!(nod = allocate(get_blk(fs,fs->gd[best_group].bg_inode_bitmap),0))) ++ error_msg_and_die("couldn't allocate an inode (no free inode)"); ++ if(!(fs->gd[best_group].bg_free_inodes_count--)) ++ error_msg_and_die("group descr. free blocks count == 0 (corrupted fs?)"); + if(!(fs->sb.s_free_inodes_count--)) +- errexit("superblock free blocks count == 0 (corrupted fs?)"); +- return nod; ++ error_msg_and_die("superblock free blocks count == 0 (corrupted fs?)"); ++ return fs->sb.s_inodes_per_group*best_group+nod; + } + + // print a bitmap allocation +@@ -546,14 +741,14 @@ + { + bkref = &get_nod(fs, nod)->i_block[bw->bpdir = 0]; + if(extend) // allocate first block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } + // direct block + else if(bw->bpdir < EXT2_NDIR_BLOCKS) + { + bkref = &get_nod(fs, nod)->i_block[++bw->bpdir]; + if(extend) // allocate block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } + // first block in indirect block + else if(bw->bpdir == EXT2_NDIR_BLOCKS) +@@ -562,11 +757,11 @@ + bw->bpdir = EXT2_IND_BLOCK; + bw->bpind = 0; + if(extend) // allocate indirect block +- get_nod(fs, nod)->i_block[bw->bpdir] = alloc_blk(fs); ++ get_nod(fs, nod)->i_block[bw->bpdir] = alloc_blk(fs,nod); + b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); + bkref = &b[bw->bpind]; + if(extend) // allocate first block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } + // block in indirect block + else if((bw->bpdir == EXT2_IND_BLOCK) && (bw->bpind < BLOCKSIZE/4 - 1)) +@@ -575,7 +770,7 @@ + b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); + bkref = &b[bw->bpind]; + if(extend) // allocate block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } + // first block in first indirect block in first double indirect block + else if(bw->bpdir == EXT2_IND_BLOCK) +@@ -585,14 +780,14 @@ + bw->bpind = 0; + bw->bpdind = 0; + if(extend) // allocate double indirect block +- get_nod(fs, nod)->i_block[bw->bpdir] = alloc_blk(fs); ++ get_nod(fs, nod)->i_block[bw->bpdir] = alloc_blk(fs,nod); + b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); + if(extend) // allocate first indirect block +- b[bw->bpind] = alloc_blk(fs); ++ b[bw->bpind] = alloc_blk(fs,nod); + b = (uint32*)get_blk(fs, b[bw->bpind]); + bkref = &b[bw->bpdind]; + if(extend) // allocate first block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } + // block in indirect block in double indirect block + else if((bw->bpdir == EXT2_DIND_BLOCK) && (bw->bpdind < BLOCKSIZE/4 - 1)) +@@ -602,7 +797,7 @@ + b = (uint32*)get_blk(fs, b[bw->bpind]); + bkref = &b[bw->bpdind]; + if(extend) // allocate block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } + // first block in indirect block in double indirect block + else if((bw->bpdir == EXT2_DIND_BLOCK) && (bw->bpind < BLOCKSIZE/4 - 1)) +@@ -612,20 +807,100 @@ + bw->bpind++; + b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); + if(extend) // allocate indirect block +- b[bw->bpind] = alloc_blk(fs); ++ b[bw->bpind] = alloc_blk(fs,nod); + b = (uint32*)get_blk(fs, b[bw->bpind]); + bkref = &b[bw->bpdind]; + if(extend) // allocate first block +- *bkref = hole ? 0 : alloc_blk(fs); ++ *bkref = hole ? 0 : alloc_blk(fs,nod); ++ } ++ ++ /* Adding support for triple indirection */ ++ /* Just starting triple indirection. Allocate the indirection ++ blocks and the first data block ++ */ ++ else if (bw->bpdir == EXT2_DIND_BLOCK) ++ { ++ bw->bnum += 3; ++ bw->bpdir = EXT2_TIND_BLOCK; ++ bw->bpind = 0; ++ bw->bpdind = 0; ++ bw->bptind = 0; ++ if(extend) // allocate triple indirect block ++ get_nod(fs, nod)->i_block[bw->bpdir] = alloc_blk(fs,nod); ++ b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); ++ if(extend) // allocate first double indirect block ++ b[bw->bpind] = alloc_blk(fs,nod); ++ b = (uint32*)get_blk(fs, b[bw->bpind]); ++ if(extend) // allocate first indirect block ++ b[bw->bpdind] = alloc_blk(fs,nod); ++ b = (uint32*)get_blk(fs, b[bw->bpdind]); ++ bkref = &b[bw->bptind]; ++ if(extend) // allocate first data block ++ *bkref = hole ? 0 : alloc_blk(fs,nod); ++ } ++ /* Still processing a single indirect block down the indirection ++ chain.Allocate a data block for it ++ */ ++ else if ( (bw->bpdir == EXT2_TIND_BLOCK) && ++ (bw->bptind < BLOCKSIZE/4 -1) ) ++ { ++ bw->bptind++; ++ b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); ++ b = (uint32*)get_blk(fs, b[bw->bpind]); ++ b = (uint32*)get_blk(fs, b[bw->bpdind]); ++ bkref = &b[bw->bptind]; ++ if(extend) // allocate data block ++ *bkref = hole ? 0 : alloc_blk(fs,nod); ++ } ++ /* Finished processing a single indirect block. But still in the ++ same double indirect block. Allocate new single indirect block ++ for it and a data block ++ */ ++ else if ( (bw->bpdir == EXT2_TIND_BLOCK) && ++ (bw->bpdind < BLOCKSIZE/4 -1) ) ++ { ++ bw->bnum++; ++ bw->bptind = 0; ++ bw->bpdind++; ++ b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); ++ b = (uint32*)get_blk(fs, b[bw->bpind]); ++ if (extend) // allocate single indirect block ++ b[bw->bpdind] = alloc_blk(fs,nod); ++ b = (uint32*)get_blk(fs, b[bw->bpdind]); ++ bkref = &b[bw->bptind]; ++ if(extend) // allocate first data block ++ *bkref = hole ? 0 : alloc_blk(fs,nod); ++ } ++ /* Finished processing a double indirect block. Allocate the next ++ double indirect block and the single,data blocks for it ++ */ ++ else if ( (bw->bpdir == EXT2_TIND_BLOCK) && ++ (bw->bpind < BLOCKSIZE/4 - 1) ) ++ { ++ bw->bnum += 2; ++ bw->bpdind = 0; ++ bw->bptind = 0; ++ bw->bpind++; ++ b = (uint32*)get_blk(fs, get_nod(fs, nod)->i_block[bw->bpdir]); ++ if(extend) // allocate double indirect block ++ b[bw->bpind] = alloc_blk(fs,nod); ++ b = (uint32*)get_blk(fs, b[bw->bpind]); ++ if(extend) // allocate single indirect block ++ b[bw->bpdind] = alloc_blk(fs,nod); ++ b = (uint32*)get_blk(fs, b[bw->bpdind]); ++ bkref = &b[bw->bptind]; ++ if(extend) // allocate first block ++ *bkref = hole ? 0 : alloc_blk(fs,nod); + } +- // I don't do triple indirect - it's such a small filesystem ... + else +- errexit("file too big ! blocks list for inode %d extends past double indirect blocks!", nod); ++ error_msg_and_die("file too big !"); ++ /* End change for walking triple indirection */ ++ + if(*bkref) + { + bw->bnum++; +- if(!allocated(fs->bbm, *bkref)) +- errexit("[block %d of inode %d is unallocated !]", *bkref, nod); ++ if(!allocated(GRP_GET_BLOCK_BITMAP(fs,*bkref), GRP_BBM_OFFSET(fs,*bkref))) ++ error_msg_and_die("[block %d of inode %d is unallocated !]", *bkref, nod); + } + if(extend) + get_nod(fs, nod)->i_blocks = bw->bnum * INOBLK; +@@ -663,23 +938,40 @@ + } + + // link an entry (inode #) to a directory +-void add2dir(filesystem *fs, uint32 dnod, uint32 nod, const char* name) ++void add2dir(filesystem *fs, uint32 dnod, uint32 nod, const char* name, uint32 mode, uid_t uid, gid_t gid, time_t ctime) + { + blockwalker bw; + uint32 bk; + uint8 *b; + directory *d; + int reclen, nlen; +- if((get_nod(fs, dnod)->i_mode & FM_IFMT) != FM_IFDIR) +- errexit("can't add '%s' to a non-directory", name); ++ inode *node; ++ inode *pnode; ++ ++ /* Squash all permissions so files are owned by root ++ * and file permissions have group/other perms removed */ ++ if (squash_uids) { ++ uid = gid = 0; ++ } ++ if (squash_perms) { ++ if (!S_ISLNK(mode)) { ++ mode &= ~(S_IWGRP | S_IWOTH); ++ mode &= ~(S_ISUID | S_ISGID); ++ } ++ } ++ ++ pnode = get_nod(fs, dnod); ++ ++ if(!S_ISDIR(pnode->i_mode)) ++ error_msg_and_die("can't add '%s' to a non-directory", name); + if(!*name) +- errexit("bad name '%s' (not meaningful)", name); ++ error_msg_and_die("bad name '%s' (not meaningful)", name); + if(strchr(name, '/')) +- errexit("bad name '%s' (contains a slash)", name); ++ error_msg_and_die("bad name '%s' (contains a slash)", name); + nlen = strlen(name); + reclen = sizeof(directory) + rndup(nlen, 4); + if(reclen > BLOCKSIZE) +- errexit("bad name '%s' (too long)", name); ++ error_msg_and_die("bad name '%s' (too long)", name); + init_bw(fs, dnod, &bw); + while((bk = walk_bw(fs, dnod, &bw, 0, 0)) != WALK_END) // for all blocks in dir + { +@@ -691,9 +983,16 @@ + if((!d->d_inode) && (d->d_rec_len >= reclen)) + { + d->d_inode = nod; +- get_nod(fs, nod)->i_links_count++; ++ node = get_nod(fs, nod); ++ node->i_links_count++; + d->d_name_len = nlen; +- strncpy(d->d_name, name, nlen); ++ strncpy(d->d_name, name, rndup(nlen,4)); ++ node->i_mode = mode; ++ node->i_uid = uid; ++ node->i_gid = gid; ++ node->i_atime = ctime; ++ node->i_ctime = ctime; ++ node->i_mtime = ctime; + return; + } + // if entry with enough room (last one?), shrink it & use it +@@ -705,9 +1004,16 @@ + d = (directory*) (((int8*)d) + d->d_rec_len); + d->d_rec_len = reclen; + d->d_inode = nod; +- get_nod(fs, nod)->i_links_count++; ++ node = get_nod(fs, nod); ++ node->i_links_count++; + d->d_name_len = nlen; +- strncpy(d->d_name, name, nlen); ++ strncpy(d->d_name, name, rndup(nlen,4)); ++ node->i_mode = mode; ++ node->i_uid = uid; ++ node->i_gid = gid; ++ node->i_atime = ctime; ++ node->i_ctime = ctime; ++ node->i_mtime = ctime; + return; + } + } +@@ -716,10 +1022,17 @@ + b = get_workblk(); + d = (directory*)b; + d->d_inode = nod; +- get_nod(fs, nod)->i_links_count++; ++ node = get_nod(fs, nod); ++ node->i_links_count++; + d->d_rec_len = BLOCKSIZE; + d->d_name_len = nlen; +- strncpy(d->d_name, name, nlen); ++ strncpy(d->d_name, name, rndup(nlen,4)); ++ node->i_mode = mode; ++ node->i_uid = uid; ++ node->i_gid = gid; ++ node->i_atime = ctime; ++ node->i_ctime = ctime; ++ node->i_mtime = ctime; + extend_blk(fs, dnod, b, 1); + get_nod(fs, dnod)->i_size += BLOCKSIZE; + free_workblk(b); +@@ -747,7 +1060,7 @@ + // find the inode of a full path + uint32 find_path(filesystem *fs, uint32 nod, const char * name) + { +- char *p, *n, *n2 = strdup(name); ++ char *p, *n, *n2 = xstrdup(name); + n = n2; + while(*n == '/') + { +@@ -770,27 +1083,32 @@ + } + + // make a full-fledged directory (i.e. with "." & "..") +-uint32 mkdir_fs(filesystem *fs, uint32 parent_nod, const char *name, uint32 mode) ++uint32 mkdir_fs(filesystem *fs, uint32 parent_nod, const char *name, uint32 mode, ++ uid_t uid, gid_t gid, time_t ctime) + { + uint32 nod; + if((nod = find_dir(fs, parent_nod, name))) + return nod; + nod = alloc_nod(fs); +- get_nod(fs, nod)->i_mode = FM_IFDIR | mode; +- add2dir(fs, parent_nod, nod, name); +- add2dir(fs, nod, nod, "."); +- add2dir(fs, nod, parent_nod, ".."); +- fs->gd.bg_used_dirs_count++; ++ if (!(mode & FM_IFDIR)) ++ mode |= FM_IFDIR; ++ add2dir(fs, parent_nod, nod, name, mode, uid, gid, ctime); ++ add2dir(fs, nod, nod, ".", mode, uid, gid, ctime); ++ add2dir(fs, nod, parent_nod, "..", mode, uid, gid, ctime); ++ fs->gd[GRP_GROUP_OF_INODE(fs,nod)].bg_used_dirs_count++; + return nod; + } + + // make a symlink +-uint32 mklink_fs(filesystem *fs, uint32 parent_nod, const char *name, size_t size, uint8 * b) ++uint32 mklink_fs(filesystem *fs, uint32 parent_nod, const char *name, size_t size, ++ uint8 * b, uid_t uid, gid_t gid, time_t ctime) + { ++ uint32 mode; + uint32 nod = alloc_nod(fs); ++ mode = FM_IFLNK | FM_IRWXU | FM_IRWXG | FM_IRWXO; + get_nod(fs, nod)->i_mode = FM_IFLNK | FM_IRWXU | FM_IRWXG | FM_IRWXO; + get_nod(fs, nod)->i_size = size; +- add2dir(fs, parent_nod, nod, name); ++ add2dir(fs, parent_nod, nod, name, mode, uid, gid, ctime); + if(size <= 4 * (EXT2_TIND_BLOCK+1)) + { + strncpy((char*)get_nod(fs, nod)->i_block, (char*)b, size); +@@ -801,15 +1119,15 @@ + } + + // make a file from a FILE* +-uint32 mkfile_fs(filesystem *fs, uint32 parent_nod, const char *name, uint32 mode, size_t size, FILE *f) ++uint32 mkfile_fs(filesystem *fs, uint32 parent_nod, const char *name, uint32 mode, size_t size, FILE *f, uid_t uid, gid_t gid, time_t ctime) + { + uint8 * b; + uint32 nod = alloc_nod(fs); +- get_nod(fs, nod)->i_mode = FM_IFREG | mode; ++ mode |= FM_IFREG; + get_nod(fs, nod)->i_size = size; +- add2dir(fs, parent_nod, nod, name); ++ add2dir(fs, parent_nod, nod, name, mode, uid, gid, ctime); + if(!(b = (uint8*)malloc(rndup(size, BLOCKSIZE)))) +- errexit("not enough mem to read file '%s'", name); ++ error_msg_and_die("not enough mem to read file '%s'", name); + memset(b, 0,rndup(size, BLOCKSIZE)); + if(f) + fread(b, size, 1, f); +@@ -824,6 +1142,15 @@ + uint32 get_mode(struct stat *st) + { + uint32 mode = 0; ++ ++ /* Squash file permissions as needed */ ++ if (squash_perms) { ++ if (!S_ISLNK(mode)) { ++ st->st_mode &= ~(S_IWGRP | S_IWOTH); ++ st->st_mode &= ~(S_ISUID | S_ISGID); ++ } ++ } ++ + if(st->st_mode & S_IRUSR) + mode |= FM_IRUSR | FM_IRGRP | FM_IROTH; + if(st->st_mode & S_IWUSR) +@@ -833,30 +1160,17 @@ + return mode; + } + +-// retrieves a mode info from a string +-uint32 get_modestr(const char *p) +-{ +- uint32 mode = 0; +- if(p[0] == 'r') +- mode |= FM_IRUSR | FM_IRGRP | FM_IROTH; +- if(p[1] == 'w') +- mode |= FM_IWUSR | FM_IWGRP | FM_IWOTH; +- if(p[2] == 'x' || p[2] == 's') +- mode |= FM_IXUSR | FM_IXGRP | FM_IXOTH; +- return mode; +-} +- + // basename of a path - free me + char * basename(const char * fullpath) + { + char * p = strrchr(fullpath, '/'); +- return strdup(p ? p + 1 : fullpath); ++ return xstrdup(p ? p + 1 : fullpath); + } + + // dirname of a path - free me + char * dirname(const char * fullpath) + { +- char * p, * n = strdup(fullpath); ++ char * p, * n = xstrdup(fullpath); + if((p = strrchr(n, '/'))) + *(p+1) = 0; + else +@@ -864,66 +1178,6 @@ + return n; + } + +-// adds entries to the filesystem from a text file +-void add2fs_from_file(filesystem *fs, uint32 this_nod, FILE * fh) +-{ +- uint32 mode; +- uint32 nod, nod2; +- char cmod[11], *path, *name, *dir; +- int major, minor; +- while(fscanf(fh, "%10s", cmod)) +- { +- if(feof(fh)) +- break; +- mode = get_modestr(cmod + 1); +- switch(*cmod) +- { +- case 'd': +- fscanf(fh, "%" SCANF_PREFIX "s\n", SCANF_STRING(path)); +- break; +- case 'c': +- mode |= FM_IFCHR; +- fscanf(fh, "%i, %i %" SCANF_PREFIX "s\n", &major, &minor, SCANF_STRING(path)); +- break; +- case 'b': +- mode |= FM_IFBLK; +- fscanf(fh, "%i, %i %" SCANF_PREFIX "s\n", &major, &minor, SCANF_STRING(path)); +- break; +- case '#': +- while(fgetc(fh) != '\n'); +- continue; +- default: +- errexit("malformed text input file"); +- } +- name = basename(path); +- dir = dirname(path); +- free(path); +- if(!(nod = find_path(fs, this_nod, dir))) +- errexit("can't find directory '%s' to create '%s''", dir, name); +- free(dir); +- if((!strcmp(name, ".")) || (!strcmp(name, ".."))) +- { +- free(name); +- continue; +- } +- switch(*cmod) +- { +- case 'd': +- mkdir_fs(fs, nod, name, mode); +- break; +- case 'c': +- case 'b': +- nod2 = alloc_nod(fs); +- get_nod(fs, nod2)->i_mode = mode; +- ((uint8*)get_nod(fs, nod2)->i_block)[0] = minor; +- ((uint8*)get_nod(fs, nod2)->i_block)[1] = major; +- add2dir(fs, nod, nod2, name); +- break; +- } +- free(name); +- } +-} +- + // adds a tree of entries to the filesystem from current dir + void add2fs_from_dir(filesystem *fs, uint32 this_nod) + { +@@ -934,7 +1188,7 @@ + struct stat st; + uint8 *b; + if(!(dh = opendir("."))) +- pexit("."); ++ perror_msg_and_die("."); + while((dent = readdir(dh))) + { + if((!strcmp(dent->d_name, ".")) || (!strcmp(dent->d_name, ".."))) +@@ -948,31 +1202,27 @@ + get_nod(fs, nod)->i_mode = (((st.st_mode & S_IFMT) == S_IFCHR) ? FM_IFCHR : FM_IFBLK) | get_mode(&st); + ((uint8*)get_nod(fs, nod)->i_block)[0] = (st.st_rdev & 0xff); + ((uint8*)get_nod(fs, nod)->i_block)[1] = (st.st_rdev >> 8); +- add2dir(fs, this_nod, nod, dent->d_name); ++ add2dir(fs, this_nod, nod, dent->d_name, st.st_mode, st.st_uid, st.st_gid, st.st_ctime); + break; + case S_IFLNK: +- if(!(b = (uint8*)malloc(rndup(st.st_size, BLOCKSIZE)))) +- errexit("out of memory"); +- if(readlink(dent->d_name, (char*)b, st.st_size) < 0) +- pexit(dent->d_name); +- mklink_fs(fs, this_nod, dent->d_name, st.st_size, b); ++ b = xreadlink(dent->d_name); ++ mklink_fs(fs, this_nod, dent->d_name, st.st_size, b, st.st_uid, st.st_gid, st.st_ctime); + free(b); + break; + case S_IFREG: +- if(!(fh = fopen(dent->d_name, "r"))) +- pexit(dent->d_name); +- mkfile_fs(fs, this_nod, dent->d_name, get_mode(&st), st.st_size, fh); ++ fh = xfopen(dent->d_name, "r"); ++ mkfile_fs(fs, this_nod, dent->d_name, st.st_mode, st.st_size, fh, st.st_uid, st.st_gid, st.st_ctime); + fclose(fh); + break; + case S_IFDIR: +- nod = mkdir_fs(fs, this_nod, dent->d_name, get_mode(&st)); ++ nod = mkdir_fs(fs, this_nod, dent->d_name, st.st_mode, st.st_uid, st.st_gid, st.st_ctime); + if(chdir(dent->d_name) < 0) +- pexit(dent->d_name); ++ perror_msg_and_die(dent->d_name); + add2fs_from_dir(fs, nod); + chdir(".."); + break; + default: +- fprintf(stderr, "ignoring entry %s", dent->d_name); ++ error_msg("ignoring entry %s", dent->d_name); + } + } + closedir(dh); +@@ -981,9 +1231,11 @@ + // endianness swap of x-indirect blocks + void swap_goodblocks(filesystem *fs, inode *nod) + { +- int i; ++ int i,j,done=0; ++ uint32 *b,*b2; ++ + int nblk = nod->i_blocks / INOBLK; +- if((nod->i_size && !nblk) || (nod->i_mode & (FM_IFBLK | FM_IFCHR))) ++ if((nod->i_size && !nblk) || ((nod->i_mode & FM_IFBLK) == FM_IFBLK) || ((nod->i_mode & FM_IFCHR) == FM_IFCHR)) + for(i = 0; i <= EXT2_TIND_BLOCK; i++) + nod->i_block[i] = swab32(nod->i_block[i]); + if(nblk <= EXT2_IND_BLOCK) +@@ -991,20 +1243,55 @@ + swap_block(get_blk(fs, nod->i_block[EXT2_IND_BLOCK])); + if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4) + return; ++ /* Currently this will fail b'cos the number of blocks as stored ++ in i_blocks also includes the indirection blocks (see ++ walk_bw). But this function assumes that i_blocks only ++ stores the count of data blocks ( Actually according to ++ "Understanding the Linux Kernel" (Table 17-3 p502 1st Ed) ++ i_blocks IS supposed to store the count of data blocks). so ++ with a file of size 268K nblk would be 269.The above check ++ will be false even though double indirection hasn't been ++ started.This is benign as 0 means block 0 which has been ++ zeroed out and therefore points back to itself from any offset ++ */ ++ assert(nod->i_block[EXT2_DIND_BLOCK] != 0); + for(i = 0; i < BLOCKSIZE/4; i++) ++ /* Should this be... ++ if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i ) ++ */ + if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + i) + swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])); + swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK])); + if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4) + return; +- errexit("too big file on the filesystem"); ++ /* Adding support for triple indirection */ ++ b = (uint32*)get_blk(fs,nod->i_block[EXT2_TIND_BLOCK]); ++ for(i=0;i < BLOCKSIZE/4 && !done ; i++) { ++ b2 = (uint32*)get_blk(fs,b[i]); ++ for(j=0; j ( EXT2_IND_BLOCK + BLOCKSIZE/4 + ++ (BLOCKSIZE/4)*(BLOCKSIZE/4) + ++ i*(BLOCKSIZE/4)*(BLOCKSIZE/4) + ++ j*(BLOCKSIZE/4)) ) ++ swap_block(get_blk(fs,b2[j])); ++ else { ++ done = 1; ++ break; ++ } ++ } ++ swap_block((uint8 *)b2); ++ } ++ swap_block((uint8 *)b); ++ return; + } + + void swap_badblocks(filesystem *fs, inode *nod) + { +- int i; ++ int i,j,done=0; ++ uint32 *b,*b2; ++ + int nblk = nod->i_blocks / INOBLK; +- if((nod->i_size && !nblk) || (nod->i_mode & (FM_IFBLK | FM_IFCHR))) ++ if((nod->i_size && !nblk) || ((nod->i_mode & FM_IFBLK) == FM_IFBLK) || ((nod->i_mode & FM_IFCHR) == FM_IFCHR)) + for(i = 0; i <= EXT2_TIND_BLOCK; i++) + nod->i_block[i] = swab32(nod->i_block[i]); + if(nblk <= EXT2_IND_BLOCK) +@@ -1012,13 +1299,34 @@ + swap_block(get_blk(fs, nod->i_block[EXT2_IND_BLOCK])); + if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4) + return; ++ /* See comment in swap_goodblocks */ ++ assert(nod->i_block[EXT2_DIND_BLOCK] != 0); + swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK])); + for(i = 0; i < BLOCKSIZE/4; i++) ++ /* See comment in swap_goodblocks */ + if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + i) + swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])); + if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4) + return; +- errexit("too big file on the filesystem"); ++ /* Adding support for triple indirection */ ++ b = (uint32*)get_blk(fs,nod->i_block[EXT2_TIND_BLOCK]); ++ swap_block((uint8 *)b); ++ for(i=0;i < BLOCKSIZE/4 && !done ; i++) { ++ b2 = (uint32*)get_blk(fs,b[i]); ++ swap_block((uint8 *)b2); ++ for(j=0; j ( EXT2_IND_BLOCK + BLOCKSIZE/4 + ++ (BLOCKSIZE/4)*(BLOCKSIZE/4) + ++ i*(BLOCKSIZE/4)*(BLOCKSIZE/4) + ++ j*(BLOCKSIZE/4)) ) ++ swap_block(get_blk(fs,b2[j])); ++ else { ++ done = 1; ++ break; ++ } ++ } ++ } ++ return; + } + + // endianness swap of the whole filesystem +@@ -1045,7 +1353,8 @@ + swap_goodblocks(fs, nod); + swap_nod(nod); + } +- swap_gd(&fs->gd); ++ for(i=0;igd[i])); + swap_sb(&fs->sb); + } + +@@ -1053,7 +1362,8 @@ + { + int i; + swap_sb(&fs->sb); +- swap_gd(&fs->gd); ++ for(i=0;igd[i])); + for(i = 1; i < fs->sb.s_inodes_count; i++) + { + inode *nod = get_nod(fs, i); +@@ -1084,53 +1394,118 @@ + directory *d; + uint8 * b; + uint32 nod; ++ uint32 nbgroups,nbinodes_per_group,overhead_per_group,free_blocks, ++ free_blocks_per_group,nbblocks_per_group; ++ uint32 gd,itbl,ibmpos,bbmpos,itblpos; ++ int j; ++ uint8 *bbm,*ibm; ++ inode *itab0; + + if(nbblocks < 16) // totally arbitrary +- errexit("too small filesystem"); +- if(nbblocks >BLOCKS_PER_GROUP) // I build only one group +- errexit("too big filesystem"); ++ error_msg_and_die("too small filesystem"); ++ ++ /* nbblocks is the total number of blocks in the system. First ++ * calculate how much overhead blocks - inode table blocks,bitmap ++ * blocks,group descriptor blocks etc. - are needed assuming each ++ * group has BLOCKS_PER_GROUP blocks.Then recalculate nbblocks with ++ * this figure. Each group has the same number of blocks. So the fs ++ * has a size atleast the given value but usually rounded off to a i ++ * higher number. ++ */ ++ nbgroups = rndup(nbblocks,BLOCKS_PER_GROUP)/ BLOCKS_PER_GROUP; ++ nbinodes_per_group = nbinodes/nbgroups +1; ++ nbinodes_per_group = rndup(nbinodes_per_group, BLOCKSIZE/sizeof(inode)); ++ if (nbinodes_per_group < 16) ++ nbinodes_per_group = 16; //minimum number b'cos the first 10 are reserved ++ overhead_per_group = 3 /*super block,ibm,bbm*/ ++ + /* No. of blocks that the inodes occupy */ ++ nbinodes_per_group *sizeof(inode)/BLOCKSIZE ++ + /* No. of blocks that group descriptors occupy */ ++ rndup(nbgroups*sizeof(groupdescriptor),BLOCKSIZE)/BLOCKSIZE; ++ free_blocks = nbblocks - overhead_per_group * nbgroups - 1 /*boot block */; ++ free_blocks_per_group = free_blocks/nbgroups; ++ if (free_blocks > free_blocks_per_group * nbgroups) ++ free_blocks_per_group++; ++ nbblocks_per_group = free_blocks_per_group + overhead_per_group; ++ /* e2fsck complains if nbblocks_per_group is not a multiple of 8 */ ++ nbblocks_per_group = rndup(nbblocks_per_group,8); ++ free_blocks_per_group = nbblocks_per_group - overhead_per_group; ++ if (nbblocks_per_group > BLOCKS_PER_GROUP) { ++ /* Can this happen ? */ ++ nbblocks_per_group = BLOCKS_PER_GROUP; ++ free_blocks_per_group = nbblocks_per_group - overhead_per_group; ++ } ++ nbblocks = nbblocks_per_group * nbgroups + 1; ++ ++ + if(!(fs = (filesystem*)calloc(nbblocks, BLOCKSIZE))) +- errexit("not enough memory for filesystem"); ++ error_msg_and_die("not enough memory for filesystem"); + + // create the superblock for an empty filesystem +- fs->sb.s_inodes_count = rndup(nbinodes, BLOCKSIZE/sizeof(inode)); ++ fs->sb.s_inodes_count = nbinodes_per_group * nbgroups; + fs->sb.s_blocks_count = nbblocks; + fs->sb.s_r_blocks_count = nbresrvd; +- fs->sb.s_free_blocks_count = nbblocks; ++ fs->sb.s_free_blocks_count = free_blocks_per_group*nbgroups; + fs->sb.s_free_inodes_count = fs->sb.s_inodes_count - EXT2_FIRST_INO + 1; + fs->sb.s_first_data_block = (BLOCKSIZE == 1024); + fs->sb.s_log_block_size = BLOCKSIZE >> 11; + fs->sb.s_log_frag_size = BLOCKSIZE >> 11; +- fs->sb.s_blocks_per_group = BLOCKS_PER_GROUP; +- fs->sb.s_frags_per_group = BLOCKS_PER_GROUP; +- fs->sb.s_inodes_per_group = fs->sb.s_inodes_count; ++ fs->sb.s_blocks_per_group = nbblocks_per_group; ++ fs->sb.s_frags_per_group = nbblocks_per_group; ++ fs->sb.s_inodes_per_group = nbinodes_per_group; + fs->sb.s_magic = EXT2_MAGIC_NUMBER; + + // set up groupdescriptors +- fs->sb.s_free_blocks_count -= 5 + fs->sb.s_inodes_count * sizeof(inode) / BLOCKSIZE; +- fs->gd.bg_free_blocks_count = fs->sb.s_free_blocks_count; +- fs->gd.bg_free_inodes_count = fs->sb.s_free_inodes_count; +- fs->gd.bg_used_dirs_count = 1; +- fs->gd.bg_block_bitmap = 3; +- fs->gd.bg_inode_bitmap = 4; +- fs->gd.bg_inode_table = 5; +- +- // mark non-filesystem blocks and inodes as allocated +- for(i = fs->sb.s_blocks_count; i <= BLOCKSIZE * 8; i++) +- allocate(fs->bbm, i); +- for(i = fs->sb.s_inodes_count + 1; i <= BLOCKSIZE * 8; i++) +- allocate(fs->ibm, i); +- +- // mark system blocsk and inodes as allocated +- for(i = 1; i <= 4 + fs->sb.s_inodes_count * sizeof(inode) / BLOCKSIZE; i++) +- allocate(fs->bbm, i); +- for(i = 1; i < EXT2_FIRST_INO; i++) +- allocate(fs->ibm, i); +- +- // make root inode and directory +- fs->itab[EXT2_ROOT_INO-1].i_mode = FM_IFDIR | FM_IRWXU | FM_IRWXG | FM_IRWXO; +- fs->itab[EXT2_ROOT_INO-1].i_size = BLOCKSIZE; +- fs->itab[EXT2_ROOT_INO-1].i_links_count = 2; ++ gd = rndup(nbgroups*sizeof(groupdescriptor),BLOCKSIZE)/BLOCKSIZE; ++ itbl = nbinodes_per_group*sizeof(inode)/BLOCKSIZE; ++ for(i = 0,bbmpos=2+gd,ibmpos=3+gd,itblpos =4+gd; ++ igd[i].bg_free_blocks_count = free_blocks_per_group; ++ fs->gd[i].bg_free_inodes_count = nbinodes_per_group; ++ fs->gd[i].bg_used_dirs_count = 0; ++ fs->gd[i].bg_block_bitmap = bbmpos; ++ fs->gd[i].bg_inode_bitmap = ibmpos; ++ fs->gd[i].bg_inode_table = itblpos; ++ } ++ ++ /* Mark non-filesystem blocks and inodes as allocated */ ++ /* Mark system blocks and inodes as allocated */ ++ for(i = 0; igd[i].bg_block_bitmap); ++ //non-filesystem blocks. ++ for(j=fs->sb.s_blocks_per_group + 1; j <= BLOCKSIZE * 8; j++) ++ allocate(bbm, j); ++ //system blocks ++ for(j = 1; j <= 3+gd+itbl; j++) ++ allocate(bbm, j); ++ ++ /* Inode bitmap */ ++ ibm = get_blk(fs,fs->gd[i].bg_inode_bitmap); ++ //non-filesystem inodes ++ for(j = fs->sb.s_inodes_per_group+1; j <= BLOCKSIZE * 8; j++) ++ allocate(ibm, j); ++ } ++ ++ /* We have groups now. Add the root filesystem in group 0 */ ++ /* Also allocate the system inodes in group 0 and update */ ++ /* directory count and inode count for group 0 */ ++ ++ ibm = get_blk(fs,fs->gd[0].bg_inode_bitmap); ++ for(j = 1; j < EXT2_FIRST_INO; j++) { ++ allocate(ibm, j); ++ fs->gd[0].bg_free_inodes_count--; ++ } ++ fs->gd[0].bg_used_dirs_count = 1; ++ itab0 = (inode *)get_blk(fs,fs->gd[0].bg_inode_table); ++ itab0[EXT2_ROOT_INO-1].i_mode = FM_IFDIR | FM_IRWXU | FM_IRWXG | FM_IRWXO; ++ itab0[EXT2_ROOT_INO-1].i_size = BLOCKSIZE; ++ itab0[EXT2_ROOT_INO-1].i_links_count = 2; ++ + b = get_workblk(); + d = (directory*)b; + d->d_inode = EXT2_ROOT_INO; +@@ -1147,9 +1522,14 @@ + // make lost+found directory and reserve blocks + if(fs->sb.s_r_blocks_count) + { +- nod = mkdir_fs(fs, EXT2_ROOT_INO, "lost+found", FM_IRWXU | FM_IRWXG | FM_IRWXO); ++ nod = mkdir_fs(fs, EXT2_ROOT_INO, "lost+found", S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, 0, 0, time(NULL)); + memset(b, 0, BLOCKSIZE); + ((directory*)b)->d_rec_len = BLOCKSIZE; ++ /* We run into problems with e2fsck if directory lost+found grows ++ * bigger than this. Need to find out why this happens - sundar ++ */ ++ if (fs->sb.s_r_blocks_count > 2049 ) ++ fs->sb.s_r_blocks_count=2049; + for(i = 1; i < fs->sb.s_r_blocks_count; i++) + extend_blk(fs, nod, b, 1); + get_nod(fs, nod)->i_size = fs->sb.s_r_blocks_count * BLOCKSIZE; +@@ -1170,24 +1550,24 @@ + // loads a filesystem from disk + filesystem * load_fs(FILE * fh, int swapit) + { +- size_t fssize; ++ size_t fssize = 0; + filesystem *fs; + if((fseek(fh, 0, SEEK_END) < 0) || ((fssize = ftell(fh)) < 0)) +- pexit("input filesystem image"); ++ perror_msg_and_die("input filesystem image"); + rewind(fh); + fssize = (fssize + BLOCKSIZE - 1) / BLOCKSIZE; + if(fssize < 16) // totally arbitrary +- errexit("too small filesystem"); +- if(fssize > BLOCKS_PER_GROUP) // I build only one group +- errexit("too big filesystem"); ++ error_msg_and_die("too small filesystem"); ++/* if(fssize > BLOCKS_PER_GROUP) // I build only one group ++ error_msg_and_die("too big filesystem"); */ + if(!(fs = (filesystem*)calloc(fssize, BLOCKSIZE))) +- errexit("not enough memory for filesystem"); ++ error_msg_and_die("not enough memory for filesystem"); + if(fread(fs, BLOCKSIZE, fssize, fh) != fssize) +- pexit("input filesystem image"); ++ perror_msg_and_die("input filesystem image"); + if(swapit) + swap_badfs(fs); + if(fs->sb.s_rev_level || (fs->sb.s_magic != EXT2_MAGIC_NUMBER)) +- errexit("not a suitable ext2 filesystem"); ++ error_msg_and_die("not a suitable ext2 filesystem"); + return fs; + } + +@@ -1230,9 +1610,9 @@ + while((bk = walk_bw(fs, nod, &bw, 0, 0)) != WALK_END) + { + if(fsize <= 0) +- errexit("wrong size while saving inode %d", nod); ++ error_msg_and_die("wrong size while saving inode %d", nod); + if(fwrite(get_blk(fs, bk), (fsize > BLOCKSIZE) ? BLOCKSIZE : fsize, 1, f) != 1) +- errexit("error while saving inode %d", nod); ++ error_msg_and_die("error while saving inode %d", nod); + fsize -= BLOCKSIZE; + } + } +@@ -1250,7 +1630,7 @@ + { + int i, j; + if(fsize <= 0) +- errexit("wrong size while saving inode %d", nod); ++ error_msg_and_die("wrong size while saving inode %d", nod); + b = get_blk(fs, bk); + for(i = 0; i < 64; i++) + { +@@ -1406,7 +1786,7 @@ + s = (nod >= EXT2_FIRST_INO) ? "normal" : "unknown reserved"; + } + printf("inode %d (%s, %d links): ", nod, s, get_nod(fs, nod)->i_links_count); +- if(!allocated(fs->ibm, nod)) ++ if(!allocated(GRP_GET_INODE_BITMAP(fs,nod), GRP_IBM_OFFSET(fs,nod))) + { + printf("unallocated\n"); + return; +@@ -1440,24 +1820,46 @@ + default: + list_blocks(fs, nod); + } ++ printf("Done with inode %d\n",nod); + } + + // describes various fields in a filesystem + void print_fs(filesystem *fs) + { +- int i; +- printf("%d blocks (%d free, %d reserved), first data block: %d\n", fs->sb.s_blocks_count, fs->sb.s_free_blocks_count, fs->sb.s_r_blocks_count, fs->sb.s_first_data_block); +- printf("%d inodes (%d free)\n", fs->sb.s_inodes_count, fs->sb.s_free_inodes_count); +- printf("block size = %d, frag size = %d\n", fs->sb.s_log_block_size ? (fs->sb.s_log_block_size << 11) : 1024, fs->sb.s_log_frag_size ? (fs->sb.s_log_frag_size << 11) : 1024); +- printf("%d blocks per group, %d frags per group, %d inodes per group\n", fs->sb.s_blocks_per_group, fs->sb.s_frags_per_group, fs->sb.s_inodes_per_group); +- printf("block bitmap: block %d, inode bitmap: block %d, inode table: block %d\n", fs->gd.bg_block_bitmap, fs->gd.bg_inode_bitmap, fs->gd.bg_inode_table); +- printf("block bitmap allocation:\n"); +- print_bm(fs->bbm, fs->sb.s_blocks_count); +- printf("inode bitmap allocation:\n"); +- print_bm(fs->ibm, fs->sb.s_inodes_count); +- for(i=1; i<=fs->sb.s_inodes_count; i++) +- if(allocated(fs->ibm, i)) +- print_inode(fs, i); ++ int i,j; ++ uint8 *ibm; ++ ++ printf("%d blocks (%d free, %d reserved), first data block: %d\n", ++ fs->sb.s_blocks_count, fs->sb.s_free_blocks_count, ++ fs->sb.s_r_blocks_count, fs->sb.s_first_data_block); ++ printf("%d inodes (%d free)\n", fs->sb.s_inodes_count, ++ fs->sb.s_free_inodes_count); ++ printf("block size = %d, frag size = %d\n", ++ fs->sb.s_log_block_size ? (fs->sb.s_log_block_size << 11) : 1024, ++ fs->sb.s_log_frag_size ? (fs->sb.s_log_frag_size << 11) : 1024); ++ printf("Number of groups: %d\n",GRP_NBGROUPS(fs)); ++ printf("%d blocks per group,%d frags per group,%d inodes per group\n", ++ fs->sb.s_blocks_per_group, fs->sb.s_frags_per_group, ++ fs->sb.s_inodes_per_group); ++ printf("Size of inode table: %d blocks\n", ++ fs->sb.s_inodes_per_group * sizeof(inode)/BLOCKSIZE); ++ for (i = 0; i < GRP_NBGROUPS(fs); i++) { ++ printf("Group No: %d\n", i); ++ printf("block bitmap: block %d,inode bitmap: block %d, inode table: block %d\n", ++ fs->gd[i].bg_block_bitmap, fs->gd[i].bg_inode_bitmap, ++ fs->gd[i].bg_inode_table); ++ printf("Free blocks count: %d\n",fs->gd[i].bg_free_blocks_count); ++ printf("Free inodes count: %d\n",fs->gd[i].bg_free_inodes_count); ++ printf("Used dir count: %d\n",fs->gd[i].bg_used_dirs_count); ++ printf("block bitmap allocation:\n"); ++ print_bm(GRP_GET_GROUP_BBM(fs, i),fs->sb.s_blocks_per_group); ++ printf("inode bitmap allocation:\n"); ++ ibm = GRP_GET_GROUP_IBM(fs, i); ++ print_bm(ibm, fs->sb.s_inodes_per_group); ++ for (j = 1; j <= fs->sb.s_inodes_per_group; j++) ++ if (allocated(ibm, j)) ++ print_inode(fs, i*fs->sb.s_inodes_per_group + j); ++ } + } + + void dump_fs(filesystem *fs, FILE * fh, int swapit) +@@ -1467,31 +1869,234 @@ + if(swapit) + swap_goodfs(fs); + if(fwrite(fs, BLOCKSIZE, nbblocks, fh) < nbblocks) +- pexit("output filesystem image"); ++ perror_msg_and_die("output filesystem image"); + if(swapit) + swap_badfs(fs); + } + ++/* device table entries take the form of: ++ ++ /dev/mem c 640 0 0 1 1 0 0 - ++ ++ type can be one of: ++ f A regular file ++ d Directory ++ c Character special device file ++ b Block special device file ++ p Fifo (named pipe) ++ ++ I don't bother with symlinks (permissions are irrelevant), hard ++ links (special cases of regular files), or sockets (why bother). ++ ++ Regular files must exist in the target root directory. If a char, ++ block, fifo, or directory does not exist, it will be created. ++*/ ++static int interpret_table_entry(filesystem *fs, char *line) ++{ ++ char type, *name = NULL, *tmp, *dir, *bname; ++ unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; ++ unsigned long start = 0, increment = 1, count = 0; ++ inode *entry; ++ uint32 nod, parent; ++ ++ if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu", ++ SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor, ++ &start, &increment, &count) < 0) ++ { ++ return 1; ++ } ++ ++ if (!strcmp(name, "/")) { ++ error_msg_and_die("Device table entries require absolute paths"); ++ } ++ ++ /* Check if this file already exists... */ ++ switch (type) { ++ case 'd': ++ mode |= S_IFDIR; ++ break; ++ case 'f': ++ mode |= S_IFREG; ++ break; ++ case 'p': ++ mode |= S_IFIFO; ++ break; ++ case 'c': ++ mode |= S_IFCHR; ++ break; ++ case 'b': ++ mode |= S_IFBLK; ++ break; ++ default: ++ error_msg_and_die("Unsupported file type"); ++ } ++ nod = 0; ++ if (count==0) ++ nod = find_path(fs, EXT2_ROOT_INO, name); ++ if (nod) { ++ /* Ok, we just need to fixup an existing entry ++ * and we will be all done... */ ++ entry = get_nod(fs, nod); ++ entry->i_uid = uid; ++ entry->i_gid = gid; ++ entry->i_mode = mode; ++ if (major) { ++ dev_t rdev = makedev(major, minor); ++ ((uint8*)entry->i_block)[0] = (rdev & 0xff); ++ ((uint8*)entry->i_block)[1] = (rdev >> 8); ++ } ++ } else { ++ /* Try and find our parent now */ ++ tmp = xstrdup(name); ++ dir = dirname(tmp); ++ parent = find_path(fs, EXT2_ROOT_INO, dir); ++ free(tmp); ++ if (!parent) { ++ error_msg ("skipping device_table entry '%s': no parent directory!", name); ++ free(name); ++ return 1; ++ } ++ ++ tmp = xstrdup(name); ++ bname = xstrdup(basename(tmp)); ++ free(tmp); ++ switch (type) { ++ case 'd': ++ mkdir_fs(fs, parent, bname, mode|FM_IFDIR, uid, gid, time(NULL)); ++ break; ++ case 'f': ++#if 0 ++ { ++ // This is a bit odd.. This will try to include ++ // the file of the same name from your _build_ ++ // system... Probably a very bad idea.... ++ struct stat st; ++ FILE *fh = xfopen(name, "r"); ++ lstat(name, &st); ++ mkfile_fs(fs, parent, bname, mode|FM_IFREG, st.st_size, fh, uid, gid, st.st_ctime); ++ fclose(fh); ++ } ++#else ++ error_msg("ignoring entry %s", name); ++#endif ++ break; ++ case 'p': ++ error_msg("ignoring entry %s", name); ++ break; ++ case 'c': ++ case 'b': ++ if (count > 0) { ++ dev_t rdev; ++ char *dname; ++ unsigned long i; ++ for (i = start; i < count; i++) { ++ asprintf(&dname, "%s%lu", bname, i); ++ nod = find_path(fs, EXT2_ROOT_INO, dname); ++ if (nod) { ++ /* We just need to fixup an existing entry */ ++ entry = get_nod(fs, nod); ++ } else { ++ nod = alloc_nod(fs); ++ add2dir(fs, parent, nod, dname, mode, uid, gid, time(NULL)); ++ entry = get_nod(fs, nod); ++ } ++ entry->i_uid = uid; ++ entry->i_gid = gid; ++ entry->i_mode = mode; ++ rdev = makedev(major, minor + (i * increment - start)); ++ ((uint8*)entry->i_block)[0] = (rdev & 0xff); ++ ((uint8*)entry->i_block)[1] = (rdev >> 8); ++ free(dname); ++ } ++ } else { ++ dev_t rdev = makedev(major, minor); ++ nod = alloc_nod(fs); ++ add2dir(fs, parent, nod, bname, mode, uid, gid, time(NULL)); ++ entry = get_nod(fs, nod); ++ ((uint8*)entry->i_block)[0] = (rdev & 0xff); ++ ((uint8*)entry->i_block)[1] = (rdev >> 8); ++ } ++ break; ++ default: ++ error_msg_and_die("Unsupported file type"); ++ } ++ free(bname); ++ } ++ free(name); ++ return 0; ++} ++ ++static int parse_device_table(filesystem *root, FILE * file) ++{ ++ char *line; ++ int status = 0; ++ size_t length = 0; ++ ++ /* Turn off squash, since we must ensure that values ++ * entered via the device table are not squashed */ ++ squash_uids = 0; ++ squash_perms = 0; ++ ++ /* Looks ok so far. The general plan now is to read in one ++ * line at a time, check for leading comment delimiters ('#'), ++ * then try and parse the line as a device table. If we fail ++ * to parse things, try and help the poor fool to fix their ++ * device table with a useful error msg... */ ++ line = NULL; ++ while (getline(&line, &length, file) != -1) { ++ /* First trim off any whitespace */ ++ int len = strlen(line); ++ ++ /* trim trailing whitespace */ ++ while (len > 0 && isspace(line[len - 1])) ++ line[--len] = '\0'; ++ /* trim leading whitespace */ ++ memmove(line, &line[strspn(line, " \n\r\t\v")], len); ++ ++ /* How long are we after trimming? */ ++ len = strlen(line); ++ ++ /* If this is NOT a comment line, try to interpret it */ ++ if (len && *line != '#') { ++ if (interpret_table_entry(root, line)) ++ status = 1; ++ } ++ ++ free(line); ++ line = NULL; ++ } ++ fclose(file); ++ ++ return status; ++} ++ ++/* ++Local Variables: ++c-file-style: "linux" ++c-basic-offset: 4 ++tab-width: 4 ++End: ++*/ ++ + void showhelp(void) + { + fprintf(stderr, "Usage: %s [options] image\n" + "Create an ext2 filesystem image from directories/files\n\n" +- " -x image Use this image as a starting point\n" +- " -d directory Add this directory as source\n" +- " -f file Add nodes (e.g. devices) from this spec file\n" +- " -b blocks Size in blocks\n" +- " -i inodes Number of inodes\n" +- " -r reserved Number of reserved blocks\n" +- " -g path Generate a block map file for this path\n" +- " -e value Fill unallocated blocks with value\n" +- " -z Make files with holes\n" +- " -v Print resulting filesystem structure\n" +- " -h Show this help\n\n" +- "Example of spec file:\n" +- "drwx /dev\n" +- "crw- 10,190 /dev/lcd\n" +- "brw- 1,0 /dev/ram0\n\n" +- "Report bugs to xavier.bestel@free.fr\n", argv0); ++ " -x image Use this image as a starting point\n" ++ " -d directory Add this directory as source\n" ++ " -b blocks Size in blocks\n" ++ " -i inodes Number of inodes\n" ++ " -r reserved Number of reserved blocks\n" ++ " -g path Generate a block map file for this path\n" ++ " -e value Fill unallocated blocks with value\n" ++ " -z Make files with holes\n" ++ " -D,-f Use the named FILE as a device table file\n" ++ " -q Squash permissions and owners making all files be owned by root\n" ++ " -U Squash owners making all files be owned by root\n" ++ " -P Squash permissions on all files\n" ++ " -v Print resulting filesystem structure\n" ++ " -h Show this help\n\n" ++ "Report bugs to xavier.bestel@free.fr\n", app_name); + } + + #define MAX_DOPT 128 +@@ -1521,21 +2126,17 @@ + filesystem *fs; + int i; + int c; ++ struct stat sb; ++ FILE *devtable = NULL; + +- argv0 = argv[0]; +- if(argc <= 1) +- { +- showhelp(); +- exit(1); +- } +- while((c = getopt(argc, argv, "x:f:d:b:i:r:g:e:zvh")) != EOF) ++ app_name = argv[0]; ++ while((c = getopt(argc, argv, "x:d:b:i:r:g:e:zvhD:f:qUP")) != EOF) + switch(c) + { + case 'x': + fsin = optarg; + break; + case 'd': +- case 'f': + dopt[didx++] = optarg; + break; + case 'b': +@@ -1556,6 +2157,24 @@ + case 'z': + holes = 1; + break; ++ case 'f': ++ case 'D': ++ devtable = xfopen(optarg, "r"); ++ if (fstat(fileno(devtable), &sb) < 0) ++ perror_msg_and_die(optarg); ++ if (sb.st_size < 10) ++ error_msg_and_die("%s: not a proper device table file", optarg); ++ break; ++ case 'q': ++ squash_uids = 1; ++ squash_perms = 1; ++ break; ++ case 'U': ++ squash_uids = 1; ++ break; ++ case 'P': ++ squash_perms = 1; ++ break; + case 'v': + verbose = 1; + break; +@@ -1566,16 +2185,14 @@ + exit(1); + } + if(optind < (argc - 1)) +- errexit("too many arguments"); ++ error_msg_and_die("too many arguments"); + if(optind == (argc - 1)) + fsout = argv[optind]; + if(fsin) + { + if(strcmp(fsin, "-")) + { +- FILE * fh = fopen(fsin, "r"); +- if(!fh) +- pexit(fsin); ++ FILE * fh = xfopen(fsin, "r"); + fs = load_fs(fh, bigendian); + fclose(fh); + } +@@ -1585,7 +2202,7 @@ + else + { + if(nbblocks == -1) +- errexit("filesystem size unspecified"); ++ error_msg_and_die("filesystem size unspecified"); + if(nbinodes == -1) + nbinodes = nbblocks * BLOCKSIZE / rndup(BYTES_PER_INODE, BLOCKSIZE); + if(nbresrvd == -1) +@@ -1595,35 +2212,30 @@ + for(i = 0; i < didx; i++) + { + struct stat st; +- FILE *fh; + char *pdir; + stat(dopt[i], &st); + switch(st.st_mode & S_IFMT) + { +- case S_IFREG: +- if(!(fh = fopen(dopt[i], "r"))) +- pexit(dopt[i]); +- add2fs_from_file(fs, EXT2_ROOT_INO, fh); +- fclose(fh); +- break; + case S_IFDIR: + if(!(pdir = getcwd(0, GETCWD_SIZE))) +- pexit(dopt[i]); ++ perror_msg_and_die(dopt[i]); + if(chdir(dopt[i]) < 0) +- pexit(dopt[i]); ++ perror_msg_and_die(dopt[i]); + add2fs_from_dir(fs, EXT2_ROOT_INO); + if(chdir(pdir) < 0) +- pexit(pdir); ++ perror_msg_and_die(pdir); + free(pdir); + break; + default: +- errexit("%s in neither a file nor a directory", dopt[i]); ++ error_msg_and_die("%s is neither a file nor a directory", dopt[i]); + } + } + if(emptyval) + for(i = 1; i < fs->sb.s_blocks_count; i++) +- if(!allocated(fs->bbm, i)) ++ if(!allocated(GRP_GET_BLOCK_BITMAP(fs,i),GRP_BBM_OFFSET(fs,i))) + memset(get_blk(fs, i), emptyval, BLOCKSIZE); ++ if(devtable) ++ parse_device_table(fs, devtable); + if(verbose) + print_fs(fs); + for(i = 0; i < gidx; i++) +@@ -1633,21 +2245,18 @@ + char *p; + FILE *fh; + if(!(nod = find_path(fs, EXT2_ROOT_INO, gopt[i]))) +- errexit("path %s not found in filesystem", gopt[i]); ++ error_msg_and_die("path %s not found in filesystem", gopt[i]); + while((p = strchr(gopt[i], '/'))) + *p = '_'; + snprintf(fname, MAX_FILENAME-1, "%s.blk", gopt[i]); +- if(!(fh = fopen(fname, "w"))) +- pexit(fname); ++ fh = xfopen(fname, "w"); + fprintf(fh, "%d:", get_nod(fs, nod)->i_size); + flist_blocks(fs, nod, fh); + fclose(fh); + } + if(strcmp(fsout, "-")) + { +- FILE * fh = fopen(fsout, "w"); +- if(!fh) +- pexit(fsout); ++ FILE * fh = xfopen(fsout, "w"); + dump_fs(fs, fh, bigendian); + fclose(fh); + } +diff -urN genext2fs-1.3.orig/test-mount.sh genext2fs-1.3/test-mount.sh +--- genext2fs-1.3.orig/test-mount.sh 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/test-mount.sh 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,96 @@ ++#!/bin/sh ++set -e ++ ++cleanup () { ++ set +e ++ umount mnt 2>/dev/null ++ rm -rf mnt ext2.img lsout fout test 2>/dev/null ++} ++ ++# dtest - Uses the -d directory option of genext2fs ++# Creates an image with a file of given size and verifies it ++# Usage: dtest file-size number-of-blocks ++dtest () { ++ size=$1; blocks=$2;fname=$size ++ echo "Testing with file of size $size " ++ mkdir -p test ++ cd test ++ dd if=/dev/zero of=file.$1 bs=1 count=$size ++ cd .. ++ ./genext2fs -b $blocks -d test ext2.img ++ md5=`md5sum ext2.img | cut -f1 -d " "` ++ if ! /sbin/e2fsck -fn ext2.img ; then ++ echo "fsck failed" ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ mkdir -p mnt ++ if ! mount -t ext2 -o loop ext2.img mnt; then ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ if (! [ -f mnt/file.$fname ]) || \ ++ [ $fname != "`ls -al mnt | grep file.$fname |awk '{print $5}'`" ] ; then ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ echo PASSED "(md5 checksum for the image: $md5)" ++ cleanup ++} ++ ++# ftest - Uses the -f spec-file option of genext2fs ++# Creates an image with the devices mentioned in the given spec ++# file and verifies it ++# Usage: ftest spec-file number-of-blocks ++ftest () { ++ fname=$1; blocks=$2; ++ echo "Testing with devices file $fname" ++ ./genext2fs -b $blocks -f $fname ext2.img ++ md5=`md5sum ext2.img | cut -f 1 -d " "` ++ if ! /sbin/e2fsck -fn ext2.img ; then ++ echo "fsck failed" ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ mkdir -p mnt ++ if ! mount -t ext2 -o loop ext2.img mnt; then ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ if ! [ -d mnt/dev ] ; then ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ cat dev.txt | grep ^[bc] | \ ++ awk '{print $1substr($1,2)substr($1,2),$2,$3}'| \ ++ sort -d -k3.6 > fout ++ ls -al mnt/dev | grep ^[bc] | \ ++ awk '{ print $1,$5$6,"/dev/"$10}' | \ ++ sort -d -k3.6 > lsout ++ if ! diff fout lsout ; then ++ echo FAILED ++ cleanup ++ exit 1 ++ fi ++ echo PASSED "(md5 checksum for the image: $md5)" ++ cleanup ++} ++ ++dtest 0 4096 ++dtest 0 8193 ++dtest 0 8194 ++dtest 1 4096 ++dtest 12288 4096 ++dtest 274432 4096 ++dtest 8388608 9000 ++dtest 16777216 20000 ++ ++ftest dev.txt 4096 ++ ++exit 0 +diff -urN genext2fs-1.3.orig/test.sh genext2fs-1.3/test.sh +--- genext2fs-1.3.orig/test.sh 1969-12-31 17:00:00.000000000 -0700 ++++ genext2fs-1.3/test.sh 2003-04-21 01:41:42.000000000 -0600 +@@ -0,0 +1,53 @@ ++#!/bin/sh ++set -e ++ ++# dtest - Uses the -d directory option of genext2fs ++# Creates an image with a file of given size and verifies it ++# Usage: dtest file-size number-of-blocks correct-checksum ++dtest () { ++ size=$1; blocks=$2; checksum=$3 ++ echo "Testing with file of size $size " ++ mkdir -p test ++ cd test ++ dd if=/dev/zero of=file.$1 bs=1 count=$size ++ cd .. ++ ./genext2fs -b $blocks -d test ext2.img ++ md5=`md5sum ext2.img | cut -d" " -f1` ++ rm -rf ext2.img test ++ if [ $md5 == $checksum ] ; then ++ echo PASSED ++ else ++ echo FAILED ++ exit 1 ++ fi ++} ++ ++# ftest - Uses the -f spec-file option of genext2fs ++# Creates an image with the devices mentioned in the given spec ++# file and verifies it ++# Usage: ftest spec-file number-of-blocks correct-checksum ++ftest () { ++ fname=$1; blocks=$2; checksum=$3 ++ echo "Testing with devices file $fname" ++ ./genext2fs -b $blocks -f $fname ext2.img ++ md5=`md5sum ext2.img | cut -d" " -f1` ++ rm -rf ext2.img ++ if [ $md5 == $checksum ] ; then ++ echo PASSED ++ else ++ echo FAILED ++ exit 1 ++ fi ++} ++ ++dtest 0 4096 491a43ab93c2e5c186c9f1f72d88e5c5 ++dtest 0 8193 6289224f0b7f151994479ba156c43505 ++dtest 0 8194 3272c43c25e8d0c3768935861a643a65 ++dtest 1 4096 5ee24486d33af88c63080b09d8cadfb5 ++dtest 12288 4096 494498364defdc27b2770d1f9c1e3387 ++dtest 274432 4096 65c4bd8d30bf563fa5434119a12abff1 ++dtest 8388608 9000 9a49b0461ee236b7fd7c452fb6a1f2dc ++dtest 16777216 20000 91e16429c901b68d30f783263f0611b7 ++ ++ftest dev.txt 4096 921ee9343b0759e16ad8d979d7dd16ec ++exit 0 diff --git a/obsolete-buildroot/sources/hotplug.patch b/obsolete-buildroot/sources/hotplug.patch new file mode 100644 index 0000000000..22c356b227 --- /dev/null +++ b/obsolete-buildroot/sources/hotplug.patch @@ -0,0 +1,33 @@ +diff -urN diethotplug-0.4.orig/pci.c diethotplug-0.4/pci.c +--- diethotplug-0.4.orig/pci.c Wed Jan 9 13:57:29 2002 ++++ diethotplug-0.4/pci.c Wed Jan 30 22:35:24 2002 +@@ -68,8 +68,8 @@ + } + + /* check that the class matches */ +- class_temp = pci_module_map[i].class_mask & pci_class; +- if (pci_module_map[i].class != class_temp) { ++ class_temp = (pci_module_map[i].class ^ pci_class) & pci_module_map[i].class_mask; ++ if (class_temp != 0) { + dbg ("class mask check failed %x != %x", + pci_module_map[i].class, class_temp); + continue; +--- diethotplug-0.4/Makefile.orig Wed Jan 9 14:28:05 2002 ++++ diethotplug-0.4/Makefile Mon Jul 8 07:29:00 2002 +@@ -135,13 +135,13 @@ + + # Rules on how to create the generated header files + usb_modules.h: +- perl convert_usb.pl < /lib/modules/$(KERNEL_VERSION)/modules.usbmap > $@ ++ perl convert_usb.pl < $(TARGET_DIR)/lib/modules/$(KERNEL_VERSION)/modules.usbmap > $@ + + pci_modules.h: +- perl convert_pci.pl < /lib/modules/$(KERNEL_VERSION)/modules.pcimap > $@ ++ perl convert_pci.pl < $(TARGET_DIR)/lib/modules/$(KERNEL_VERSION)/modules.pcimap > $@ + + ieee1394_modules.h: +- perl convert_ieee1394.pl < /lib/modules/$(KERNEL_VERSION)/modules.ieee1394map > $@ ++ perl convert_ieee1394.pl < $(TARGET_DIR)/lib/modules/$(KERNEL_VERSION)/modules.ieee1394map > $@ + + hotplug_version.h: + @echo \#define HOTPLUG_VERSION \"$(VERSION)\" > $@ diff --git a/obsolete-buildroot/sources/i386-gcc-soft-float.patch b/obsolete-buildroot/sources/i386-gcc-soft-float.patch new file mode 100644 index 0000000000..97501087e2 --- /dev/null +++ b/obsolete-buildroot/sources/i386-gcc-soft-float.patch @@ -0,0 +1,61 @@ +diff -urN gcc-3.3.2-orig/gcc/config/i386/i386.h gcc-3.3.2/gcc/config/i386/i386.h +--- gcc-3.3.2-orig/gcc/config/i386/i386.h 2003-06-25 16:18:31.000000000 -0500 ++++ gcc-3.3.2/gcc/config/i386/i386.h 2003-10-22 01:46:57.000000000 -0500 +@@ -653,6 +653,7 @@ + /* Define for XFmode or TFmode extended real floating point support. + The XFmode is specified by i386 ABI, while TFmode may be faster + due to alignment and simplifications in the address calculations. */ ++#if 0 + #define LONG_DOUBLE_TYPE_SIZE (TARGET_128BIT_LONG_DOUBLE ? 128 : 96) + #define MAX_LONG_DOUBLE_TYPE_SIZE 128 + #ifdef __x86_64__ +@@ -660,6 +661,17 @@ + #else + #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 96 + #endif ++#else ++ /* Set up for x86 soft float with 64-bit long doubles, since that's ++ * all the soft float emulation supports. */ ++#define LONG_DOUBLE_TYPE_SIZE (TARGET_128BIT_LONG_DOUBLE ? 128 : (TARGET_80387 ? 96 : 64)) ++#define MAX_LONG_DOUBLE_TYPE_SIZE 128 ++#ifdef __x86_64__ ++#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 ++#else ++#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE (TARGET_80387 ? 96 : 64) ++#endif ++#endif + + /* Set the value of FLT_EVAL_METHOD in float.h. When using only the + FPU, assume that the fpcw is set to extended precision; when using +diff -urN gcc-3.3.2-orig/gcc/config/t-linux gcc-3.3.2/gcc/config/t-linux +--- gcc-3.3.2-orig/gcc/config/t-linux-uclibc 2003-06-04 11:56:11.000000000 -0500 ++++ gcc-3.3.2/gcc/config/t-linux-uclibc 2003-10-22 01:46:39.000000000 -0500 +@@ -21,3 +21,28 @@ + LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ + $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c + LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h ++ ++############################################## ++# We want fine grained libraries, so use the new code to build the ++# floating point emulation libraries. ++FPBIT = fp-bit.c ++DPBIT = dp-bit.c ++ ++#LIB2FUNCS_EXTRA = xp-bit.c ++ ++dp-bit.c: $(srcdir)/config/fp-bit.c ++ echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c ++ echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c ++ echo '#endif' >> dp-bit.c ++ cat $(srcdir)/config/fp-bit.c >> dp-bit.c ++ ++fp-bit.c: $(srcdir)/config/fp-bit.c ++ echo '#define FLOAT' > fp-bit.c ++ echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c ++ echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c ++ echo '#endif' >> fp-bit.c ++ cat $(srcdir)/config/fp-bit.c >> fp-bit.c ++ ++#MULTILIB_OPTIONS = msoft-float ++#MULTILIB_DIRNAMES = soft-float ++ diff --git a/obsolete-buildroot/sources/iptables-openwrt-extensions.patch b/obsolete-buildroot/sources/iptables-openwrt-extensions.patch new file mode 100644 index 0000000000..717db7d70c --- /dev/null +++ b/obsolete-buildroot/sources/iptables-openwrt-extensions.patch @@ -0,0 +1,21 @@ +--- iptables-1.2.9/extensions/Makefile 2003-10-16 02:34:36.000000000 -0500 ++++ iptables-openwrt/extensions/Makefile 2004-01-29 12:03:41.000000000 -0600 +@@ -5,12 +5,14 @@ + # header files are present in the include/linux directory of this iptables + # package (HW) + # +-PF_EXT_SLIB:=ah connlimit connmark conntrack dscp ecn esp helper icmp iprange length limit mac mark multiport owner physdev pkttype realm rpc standard state tcp tcpmss tos ttl udp unclean CLASSIFY CONNMARK DNAT DSCP ECN LOG MARK MASQUERADE MIRROR NETMAP NOTRACK REDIRECT REJECT SAME SNAT TARPIT TCPMSS TOS TRACE TTL ULOG +-PF6_EXT_SLIB:=eui64 hl icmpv6 length limit mac mark multiport owner standard tcp udp HL LOG MARK TRACE ++#PF_EXT_SLIB:=ah connlimit connmark conntrack dscp ecn esp helper icmp iprange length limit mac mark multiport owner physdev pkttype realm rpc standard state tcp tcpmss tos ttl udp unclean CLASSIFY CONNMARK DNAT DSCP ECN LOG MARK MASQUERADE MIRROR NETMAP NOTRACK REDIRECT REJECT SAME SNAT TARPIT TCPMSS TOS TRACE TTL ULOG ++PF_EXT_SLIB:=icmp iprange mark multiport standard state tcp udp DNAT LOG MARK MASQUERADE REDIRECT REJECT SNAT TCPMSS ++#PF6_EXT_SLIB:=eui64 hl icmpv6 length limit mac mark multiport owner standard tcp udp HL LOG MARK TRACE ++#PF6_EXT_SLIB:=eui64 icmpv6 mark standard tcp udp LOG + + # Optionals +-PF_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T))) +-PF6_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test6),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T))) ++# PF_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T))) ++# PF6_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test6),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T))) + + PF_EXT_SLIB+=$(PF_EXT_SLIB_OPTS) + PF6_EXT_SLIB+=$(PF6_EXT_SLIB_OPTS) diff --git a/obsolete-buildroot/sources/kernel-patches/001-patch-2.4.26-pre5.bz2 b/obsolete-buildroot/sources/kernel-patches/001-patch-2.4.26-pre5.bz2 new file mode 100644 index 0000000000..aa934c5a7c Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/001-patch-2.4.26-pre5.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/006-ieee1394-hotplug.bz2 b/obsolete-buildroot/sources/kernel-patches/006-ieee1394-hotplug.bz2 new file mode 100644 index 0000000000..b8361ba35b Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/006-ieee1394-hotplug.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/007-scsi_add_remove_single.bz2 b/obsolete-buildroot/sources/kernel-patches/007-scsi_add_remove_single.bz2 new file mode 100644 index 0000000000..0d2ee20a93 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/007-scsi_add_remove_single.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/008-ieee1394-fix.bz2 b/obsolete-buildroot/sources/kernel-patches/008-ieee1394-fix.bz2 new file mode 100644 index 0000000000..d88f251349 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/008-ieee1394-fix.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/009-always-inline.bz2 b/obsolete-buildroot/sources/kernel-patches/009-always-inline.bz2 new file mode 100644 index 0000000000..0838fedd6d Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/009-always-inline.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/010-optimize-for-size.bz2 b/obsolete-buildroot/sources/kernel-patches/010-optimize-for-size.bz2 new file mode 100644 index 0000000000..68c19d4bbb Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/010-optimize-for-size.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/012-x86-check_gcc.bz2 b/obsolete-buildroot/sources/kernel-patches/012-x86-check_gcc.bz2 new file mode 100644 index 0000000000..f645dc1aa9 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/012-x86-check_gcc.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/017-printk.bz2 b/obsolete-buildroot/sources/kernel-patches/017-printk.bz2 new file mode 100644 index 0000000000..da99976164 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/017-printk.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/018-slab-loop-init.bz2 b/obsolete-buildroot/sources/kernel-patches/018-slab-loop-init.bz2 new file mode 100644 index 0000000000..dfba2bae58 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/018-slab-loop-init.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/041-changeloop.patch.bz2 b/obsolete-buildroot/sources/kernel-patches/041-changeloop.patch.bz2 new file mode 100644 index 0000000000..9e64eca6b5 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/041-changeloop.patch.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/042-loopfixes.patch.bz2 b/obsolete-buildroot/sources/kernel-patches/042-loopfixes.patch.bz2 new file mode 100644 index 0000000000..456ee6145a Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/042-loopfixes.patch.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/044-streaming_io.bz2 b/obsolete-buildroot/sources/kernel-patches/044-streaming_io.bz2 new file mode 100644 index 0000000000..4f453e1820 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/044-streaming_io.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/062-silence-blk-queue.bz2 b/obsolete-buildroot/sources/kernel-patches/062-silence-blk-queue.bz2 new file mode 100644 index 0000000000..84a9a05c79 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/062-silence-blk-queue.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/063-silence.kbd.patch.bz2 b/obsolete-buildroot/sources/kernel-patches/063-silence.kbd.patch.bz2 new file mode 100644 index 0000000000..04c56d62bc Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/063-silence.kbd.patch.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/064-shutup-md.bz2 b/obsolete-buildroot/sources/kernel-patches/064-shutup-md.bz2 new file mode 100644 index 0000000000..944b12acef Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/064-shutup-md.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/077-orinoco-0.13e.bz2 b/obsolete-buildroot/sources/kernel-patches/077-orinoco-0.13e.bz2 new file mode 100644 index 0000000000..b181185281 Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/077-orinoco-0.13e.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/078-hostap.bz2 b/obsolete-buildroot/sources/kernel-patches/078-hostap.bz2 new file mode 100644 index 0000000000..f9ce7aaade Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/078-hostap.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/079-jiffies64.bz2 b/obsolete-buildroot/sources/kernel-patches/079-jiffies64.bz2 new file mode 100644 index 0000000000..1b6873d3ec Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/079-jiffies64.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/089-no-touch-makedep.bz2 b/obsolete-buildroot/sources/kernel-patches/089-no-touch-makedep.bz2 new file mode 100644 index 0000000000..2e413ccafc Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/089-no-touch-makedep.bz2 differ diff --git a/obsolete-buildroot/sources/kernel-patches/100_VERSION.bz2 b/obsolete-buildroot/sources/kernel-patches/100_VERSION.bz2 new file mode 100644 index 0000000000..54d2e6571e Binary files /dev/null and b/obsolete-buildroot/sources/kernel-patches/100_VERSION.bz2 differ diff --git a/obsolete-buildroot/sources/libfloat.patch b/obsolete-buildroot/sources/libfloat.patch new file mode 100644 index 0000000000..90459a89e6 --- /dev/null +++ b/obsolete-buildroot/sources/libfloat.patch @@ -0,0 +1,45 @@ +diff -urN libfloat-dist/Makefile libfloat/Makefile +--- libfloat-dist/Makefile 2003-10-26 00:33:45.000000000 -0500 ++++ libfloat/Makefile 2003-10-26 01:07:26.000000000 -0500 +@@ -1,7 +1,7 @@ + # Makefile for the Linux soft-float library + +-CC=gcc -O2 -freg-struct-return -fomit-frame-pointer -D__LIBFLOAT__ +-#CC=gcc -g -O2 -freg-struct-return -D__LIBFLOAT__ ++CFLAGS= -O2 -freg-struct-return -fomit-frame-pointer -D__LIBFLOAT__ -msoft-float ++LIBGCC=$(shell $(CC) -print-libgcc-file-name) + AR=ar + + all: libfloat.a libfloat.so.1 +@@ -12,24 +11,24 @@ + + libfloat.so.1: softfloat.os fplib_glue.os + rm -f libfloat.so.1 +- gcc -shared -Wl,-soname,libfloat.so.1 softfloat.os fplib_glue.os -o libfloat.so.1 ++ $(LD) -shared -soname=libfloat.so.1 softfloat.os fplib_glue.os -o libfloat.so.1 $(LIBGCC) + + softfloat.o: softfloat/bits64/softfloat.c +- $(CC) -c -o softfloat.o -Isoftfloat/bits64/ARM-gcc softfloat/bits64/softfloat.c ++ $(CC) $(CFLAGS) -c -o softfloat.o -Isoftfloat/bits64/ARM-gcc softfloat/bits64/softfloat.c + + fplib_glue.o: fplib_glue.S +- $(CC) -c -o fplib_glue.o fplib_glue.S ++ $(CC) $(CFLAGS) -c -o fplib_glue.o fplib_glue.S + + softfloat.os: softfloat/bits64/softfloat.c +- $(CC) -fpic -c -o softfloat.os -Isoftfloat/bits64/ARM-gcc softfloat/bits64/softfloat.c ++ $(CC) $(CFLAGS) -fpic -c -o softfloat.os -Isoftfloat/bits64/ARM-gcc softfloat/bits64/softfloat.c + + fplib_glue.os: fplib_glue.S +- $(CC) -fpic -c -o fplib_glue.os fplib_glue.S ++ $(CC) $(CFLAGS) -fpic -c -o fplib_glue.os fplib_glue.S + + install: libfloat.a libfloat.so.1 + cp -a libfloat.a $(DESTDIR)/usr/lib +- cp -a libfloat.so.1 $(DESTDIR)/usr/lib +- cd $(DESTDIR)/usr/lib; ln -s libfloat.so.1 libfloat.so ++ cp -a libfloat.so.1 $(DESTDIR)/lib ++ cd $(DESTDIR)/lib; ln -s libfloat.so.1 libfloat.so + #ldconfig + + clean: diff --git a/obsolete-buildroot/sources/libglib_configure_1.2.10.bz2 b/obsolete-buildroot/sources/libglib_configure_1.2.10.bz2 new file mode 100644 index 0000000000..883a8009d4 Binary files /dev/null and b/obsolete-buildroot/sources/libglib_configure_1.2.10.bz2 differ diff --git a/obsolete-buildroot/sources/linux.config b/obsolete-buildroot/sources/linux.config new file mode 100644 index 0000000000..e33656a9ff --- /dev/null +++ b/obsolete-buildroot/sources/linux.config @@ -0,0 +1,877 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_X86=y +# CONFIG_SBUS is not set +CONFIG_UID16=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y + +# +# Loadable module support +# +CONFIG_MODULES=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_M386 is not set +# CONFIG_M486 is not set +# CONFIG_M586 is not set +# CONFIG_M586TSC is not set +# CONFIG_M586MMX is not set +# CONFIG_M686 is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUM4 is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +CONFIG_MELAN=y +# CONFIG_MCRUSOE is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_MWINCHIP2 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MVIAC3_2 is not set +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_INVLPG=y +CONFIG_X86_CMPXCHG=y +CONFIG_X86_XADD=y +CONFIG_X86_BSWAP=y +CONFIG_X86_POPAD_OK=y +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_X86_L1_CACHE_SHIFT=4 +CONFIG_X86_USE_STRING_486=y +CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_F00F_WORKS_OK=y +# CONFIG_X86_MCE is not set +# CONFIG_TOSHIBA is not set +# CONFIG_I8K is not set +# CONFIG_MICROCODE is not set +# CONFIG_X86_MSR is not set +# CONFIG_X86_CPUID is not set +# CONFIG_EDD is not set +CONFIG_NOHIGHMEM=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HIGHMEM is not set +CONFIG_MATH_EMULATION=y +CONFIG_MTRR=y +# CONFIG_SMP is not set +# CONFIG_X86_UP_APIC is not set +# CONFIG_X86_UP_IOAPIC is not set +# CONFIG_X86_TSC_DISABLE is not set + +# +# General setup +# +CONFIG_NET=y +CONFIG_PCI=y +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +CONFIG_PCI_GOANY=y +CONFIG_PCI_BIOS=y +CONFIG_PCI_DIRECT=y +CONFIG_ISA=y +CONFIG_PCI_NAMES=y +CONFIG_EISA=y +CONFIG_MCA=y +CONFIG_HOTPLUG=y + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=m +CONFIG_CARDBUS=y +CONFIG_TCIC=y +CONFIG_I82092=y +CONFIG_I82365=y + +# +# PCI Hotplug Support +# +CONFIG_HOTPLUG_PCI=y +# CONFIG_HOTPLUG_PCI_COMPAQ is not set +# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set +CONFIG_SYSVIPC=y +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set +# CONFIG_OOM_KILLER is not set +CONFIG_PM=y +CONFIG_APM=y +# CONFIG_APM_IGNORE_USER_SUSPEND is not set +CONFIG_APM_DO_ENABLE=y +# CONFIG_APM_CPU_IDLE is not set +# CONFIG_APM_DISPLAY_BLANK is not set +CONFIG_APM_RTC_IS_GMT=y +CONFIG_APM_ALLOW_INTS=y +CONFIG_APM_REAL_MODE_POWER_OFF=y + +# +# ACPI Support +# +# CONFIG_ACPI is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play configuration +# +# CONFIG_PNP is not set +# CONFIG_ISAPNP is not set + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_PS2 is not set +# CONFIG_BLK_DEV_XD is not set +# CONFIG_PARIDE is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_CISS_SCSI_TAPE is not set +# CONFIG_CISS_MONITOR_THREAD is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_NBD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=8192 +CONFIG_BLK_DEV_INITRD=y +# CONFIG_BLK_STATS is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set +# CONFIG_BLK_DEV_MD is not set +# CONFIG_MD_LINEAR is not set +# CONFIG_MD_RAID0 is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set +# CONFIG_MD_MULTIPATH is not set +# CONFIG_BLK_DEV_LVM is not set + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +CONFIG_NETLINK_DEV=y +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_FILTER=y +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_FWMARK=y +CONFIG_IP_ROUTE_NAT=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_TOS=y +# CONFIG_IP_ROUTE_VERBOSE is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +CONFIG_INET_ECN=y +# CONFIG_SYN_COOKIES is not set + +# +# IP: Netfilter Configuration +# +CONFIG_IP_NF_CONNTRACK=y +CONFIG_IP_NF_FTP=y +# CONFIG_IP_NF_AMANDA is not set +CONFIG_IP_NF_TFTP=y +CONFIG_IP_NF_IRC=y +CONFIG_IP_NF_QUEUE=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_MATCH_LIMIT=y +CONFIG_IP_NF_MATCH_MAC=y +CONFIG_IP_NF_MATCH_PKTTYPE=y +CONFIG_IP_NF_MATCH_MARK=y +CONFIG_IP_NF_MATCH_MULTIPORT=y +CONFIG_IP_NF_MATCH_TOS=y +CONFIG_IP_NF_MATCH_RECENT=y +CONFIG_IP_NF_MATCH_ECN=y +CONFIG_IP_NF_MATCH_DSCP=y +CONFIG_IP_NF_MATCH_AH_ESP=y +CONFIG_IP_NF_MATCH_LENGTH=y +CONFIG_IP_NF_MATCH_TTL=y +CONFIG_IP_NF_MATCH_TCPMSS=y +CONFIG_IP_NF_MATCH_HELPER=y +CONFIG_IP_NF_MATCH_STATE=y +CONFIG_IP_NF_MATCH_CONNTRACK=y +CONFIG_IP_NF_MATCH_UNCLEAN=y +CONFIG_IP_NF_MATCH_OWNER=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_TARGET_MIRROR=y +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_NAT_NEEDED=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_IP_NF_NAT_LOCAL=y +CONFIG_IP_NF_NAT_SNMP_BASIC=y +CONFIG_IP_NF_NAT_IRC=y +CONFIG_IP_NF_NAT_FTP=y +CONFIG_IP_NF_NAT_TFTP=y +CONFIG_IP_NF_MANGLE=y +CONFIG_IP_NF_TARGET_TOS=y +CONFIG_IP_NF_TARGET_ECN=y +CONFIG_IP_NF_TARGET_DSCP=y +CONFIG_IP_NF_TARGET_MARK=y +CONFIG_IP_NF_TARGET_LOG=y +CONFIG_IP_NF_TARGET_ULOG=y +CONFIG_IP_NF_TARGET_TCPMSS=y +CONFIG_IP_NF_ARPTABLES=y +CONFIG_IP_NF_ARPFILTER=y +CONFIG_IP_NF_ARP_MANGLE=y + +# +# IP: Virtual Server Configuration +# +# CONFIG_IP_VS is not set +# CONFIG_IPV6 is not set +# CONFIG_KHTTPD is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +CONFIG_IPV6_SCTP__=y +# CONFIG_IP_SCTP is not set +# CONFIG_SCTP_HMAC_NONE is not set +CONFIG_SCTP_HMAC_SHA1=y +# CONFIG_SCTP_HMAC_MD5 is not set +# CONFIG_ATM is not set +# CONFIG_VLAN_8021Q is not set + +# +# +# +# CONFIG_IPX is not set +# CONFIG_ATALK is not set + +# +# Appletalk devices +# +# CONFIG_DEV_APPLETALK is not set +# CONFIG_DECNET is not set +CONFIG_BRIDGE=y +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_LLC is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_FASTROUTE is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_CBQ=y +CONFIG_NET_SCH_HTB=y +CONFIG_NET_SCH_CSZ=y +CONFIG_NET_SCH_HFSC=y +CONFIG_NET_SCH_PRIO=y +CONFIG_NET_SCH_RED=y +CONFIG_NET_SCH_SFQ=y +CONFIG_NET_SCH_TEQL=y +CONFIG_NET_SCH_TBF=y +CONFIG_NET_SCH_GRED=y +CONFIG_NET_SCH_DSMARK=y +CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_QOS=y +CONFIG_NET_ESTIMATOR=y +CONFIG_NET_CLS=y +CONFIG_NET_CLS_TCINDEX=y +CONFIG_NET_CLS_ROUTE4=y +CONFIG_NET_CLS_ROUTE=y +CONFIG_NET_CLS_FW=y +CONFIG_NET_CLS_U32=y +CONFIG_NET_CLS_RSVP=y +CONFIG_NET_CLS_RSVP6=y +CONFIG_NET_CLS_POLICE=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set +# CONFIG_PHONE_IXJ is not set +# CONFIG_PHONE_IXJ_PCMCIA is not set + +# +# ATA/IDE/MFM/RLL support +# +CONFIG_IDE=y + +# +# IDE, ATA and ATAPI Block devices +# +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_HD_IDE is not set +# CONFIG_BLK_DEV_HD is not set +CONFIG_BLK_DEV_IDEDISK=y +CONFIG_IDEDISK_MULTI_MODE=y +CONFIG_IDEDISK_STROKE=y +CONFIG_BLK_DEV_IDECS=m +# CONFIG_BLK_DEV_IDECD is not set +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set + +# +# IDE chipset support/bugfixes +# +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_CMD640_ENHANCED is not set +# CONFIG_BLK_DEV_ISAPNP is not set +CONFIG_BLK_DEV_IDEPCI=y +CONFIG_BLK_DEV_GENERIC=y +CONFIG_IDEPCI_SHARE_IRQ=y +CONFIG_BLK_DEV_IDEDMA_PCI=y +# CONFIG_BLK_DEV_OFFBOARD is not set +# CONFIG_BLK_DEV_IDEDMA_FORCED is not set +CONFIG_IDEDMA_PCI_AUTO=y +# CONFIG_IDEDMA_ONLYDISK is not set +CONFIG_BLK_DEV_IDEDMA=y +CONFIG_IDEDMA_PCI_WIP=y +# CONFIG_BLK_DEV_ADMA100 is not set +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_BLK_DEV_ALI15X3 is not set +# CONFIG_WDC_ALI15X3 is not set +# CONFIG_BLK_DEV_AMD74XX is not set +# CONFIG_AMD74XX_OVERRIDE is not set +# CONFIG_BLK_DEV_CMD64X is not set +# CONFIG_BLK_DEV_TRIFLEX is not set +# CONFIG_BLK_DEV_CY82C693 is not set +# CONFIG_BLK_DEV_CS5530 is not set +# CONFIG_BLK_DEV_HPT34X is not set +# CONFIG_HPT34X_AUTODMA is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_PIIX is not set +# CONFIG_BLK_DEV_NS87415 is not set +# CONFIG_BLK_DEV_OPTI621 is not set +# CONFIG_BLK_DEV_PDC202XX_OLD is not set +# CONFIG_PDC202XX_BURST is not set +# CONFIG_BLK_DEV_PDC202XX_NEW is not set +# CONFIG_BLK_DEV_RZ1000 is not set +# CONFIG_BLK_DEV_SC1200 is not set +# CONFIG_BLK_DEV_SVWKS is not set +# CONFIG_BLK_DEV_SIIMAGE is not set +# CONFIG_BLK_DEV_SIS5513 is not set +# CONFIG_BLK_DEV_SLC90E66 is not set +# CONFIG_BLK_DEV_TRM290 is not set +# CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_IDE_CHIPSETS is not set +CONFIG_IDEDMA_AUTO=y +# CONFIG_IDEDMA_IVB is not set +# CONFIG_DMA_NONPCI is not set +# CONFIG_BLK_DEV_ATARAID is not set +# CONFIG_BLK_DEV_ATARAID_PDC is not set +# CONFIG_BLK_DEV_ATARAID_HPT is not set +# CONFIG_BLK_DEV_ATARAID_MEDLEY is not set +# CONFIG_BLK_DEV_ATARAID_SII is not set + +# +# SCSI support +# +# CONFIG_SCSI is not set + +# +# Fusion MPT device support +# +# CONFIG_FUSION is not set +# CONFIG_FUSION_BOOT is not set +# CONFIG_FUSION_ISENSE is not set +# CONFIG_FUSION_CTL is not set +# CONFIG_FUSION_LAN is not set + +# +# IEEE 1394 (FireWire) support (EXPERIMENTAL) +# +# CONFIG_IEEE1394 is not set + +# +# I2O device support +# +# CONFIG_I2O is not set +# CONFIG_I2O_PCI is not set +# CONFIG_I2O_BLOCK is not set +# CONFIG_I2O_LAN is not set +# CONFIG_I2O_SCSI is not set +# CONFIG_I2O_PROC is not set + +# +# Network device support +# +CONFIG_NETDEVICES=y + +# +# ARCnet devices +# +# CONFIG_ARCNET is not set +CONFIG_DUMMY=m +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +CONFIG_TUN=y +# CONFIG_ETHERTAP is not set + +# +# Ethernet (10 or 100Mbit) +# +CONFIG_NET_ETHERNET=y +# CONFIG_SUNLANCE is not set +# CONFIG_HAPPYMEAL is not set +# CONFIG_SUNBMAC is not set +# CONFIG_SUNQE is not set +# CONFIG_SUNGEM is not set +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_AT1700 is not set +# CONFIG_DEPCA is not set +# CONFIG_HP100 is not set +# CONFIG_NET_ISA is not set +# CONFIG_SKMC is not set +# CONFIG_NE2_MCA is not set +# CONFIG_IBMLANA is not set +CONFIG_NET_PCI=y +# CONFIG_PCNET32 is not set +# CONFIG_AMD8111_ETH is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_AC3200 is not set +# CONFIG_APRICOT is not set +# CONFIG_B44 is not set +# CONFIG_CS89x0 is not set +# CONFIG_TULIP is not set +# CONFIG_DE4X5 is not set +# CONFIG_DGRS is not set +# CONFIG_DM9102 is not set +# CONFIG_EEPRO100 is not set +# CONFIG_EEPRO100_PIO is not set +# CONFIG_E100 is not set +# CONFIG_LNE390 is not set +# CONFIG_FEALNX is not set +CONFIG_NATSEMI=y +# CONFIG_NE2K_PCI is not set +# CONFIG_FORCEDETH is not set +# CONFIG_NE3210 is not set +# CONFIG_ES3210 is not set +# CONFIG_8139CP is not set +# CONFIG_8139TOO is not set +# CONFIG_8139TOO_PIO is not set +# CONFIG_8139TOO_TUNE_TWISTER is not set +# CONFIG_8139TOO_8129 is not set +# CONFIG_8139_OLD_RX_RESET is not set +# CONFIG_SIS900 is not set +# CONFIG_EPIC100 is not set +# CONFIG_SUNDANCE is not set +# CONFIG_SUNDANCE_MMIO is not set +# CONFIG_TLAN is not set +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_RHINE_MMIO is not set +# CONFIG_WINBOND_840 is not set +# CONFIG_NET_POCKET is not set + +# +# Ethernet (1000 Mbit) +# +# CONFIG_ACENIC is not set +# CONFIG_DL2K is not set +# CONFIG_E1000 is not set +# CONFIG_MYRI_SBUS is not set +# CONFIG_NS83820 is not set +# CONFIG_HAMACHI is not set +# CONFIG_YELLOWFIN is not set +# CONFIG_R8169 is not set +# CONFIG_SK98LIN is not set +# CONFIG_TIGON3 is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PLIP is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set + +# +# Wireless LAN (non-hamradio) +# +CONFIG_NET_RADIO=y +# CONFIG_STRIP is not set +# CONFIG_WAVELAN is not set +# CONFIG_ARLAN is not set +# CONFIG_AIRONET4500 is not set +# CONFIG_AIRONET4500_NONCS is not set +# CONFIG_AIRONET4500_PROC is not set +# CONFIG_AIRO is not set +CONFIG_HERMES=m +CONFIG_HOSTAP=m +# CONFIG_PLX_HERMES is not set +# CONFIG_TMD_HERMES is not set +# CONFIG_PCI_HERMES is not set +# CONFIG_HOSTAP_PLX is not set +# CONFIG_HOSTAP_PCI is not set + +# +# Wireless Pcmcia cards support +# +CONFIG_PCMCIA_HERMES=m +CONFIG_HOSTAP_CS=m +# CONFIG_AIRO_CS is not set +# CONFIG_PCMCIA_ATMEL is not set +CONFIG_NET_WIRELESS=y + +# +# Token Ring devices +# +# CONFIG_TR is not set +# CONFIG_NET_FC is not set +# CONFIG_RCPCI is not set +# CONFIG_SHAPER is not set + +# +# Wan interfaces +# +# CONFIG_WAN is not set + +# +# PCMCIA network device support +# +# CONFIG_NET_PCMCIA is not set + +# +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Old CD-ROM drivers (not SCSI, not IDE) +# +# CONFIG_CD_NO_IDESCSI is not set + +# +# Input core support +# +# CONFIG_INPUT is not set +# CONFIG_INPUT_KEYBDEV is not set +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_UINPUT is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_SERIAL_CONSOLE=y +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +CONFIG_UNIX98_PTYS=y +CONFIG_UNIX98_PTY_COUNT=256 + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +# CONFIG_MOUSE is not set + +# +# Joysticks +# +# CONFIG_INPUT_GAMEPORT is not set + +# +# Input core support is needed for gameports +# + +# +# Input core support is needed for joysticks +# +# CONFIG_QIC02_TAPE is not set +# CONFIG_IPMI_HANDLER is not set +# CONFIG_IPMI_PANIC_EVENT is not set +# CONFIG_IPMI_DEVICE_INTERFACE is not set +# CONFIG_IPMI_KCS is not set +# CONFIG_IPMI_WATCHDOG is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_SCx200 is not set +# CONFIG_SCx200_GPIO is not set +CONFIG_AMD_RNG=y +# CONFIG_INTEL_RNG is not set +CONFIG_HW_RANDOM=y +# CONFIG_AMD_PM768 is not set +# CONFIG_NVRAM is not set +CONFIG_RTC=y +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set +# CONFIG_SONYPI is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_AGP is not set + +# +# Direct Rendering Manager (XFree86 DRI support) +# +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_PCMCIA_SERIAL_CS is not set +# CONFIG_SYNCLINK_CS is not set +# CONFIG_MWAVE is not set +# CONFIG_OBMOUSE is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# File systems +# +# CONFIG_QUOTA is not set +# CONFIG_QFMT_V2 is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADFS_FS_RW is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BEFS_DEBUG is not set +# CONFIG_BFS_FS is not set +CONFIG_EXT3_FS=y +CONFIG_JBD=y +# CONFIG_JBD_DEBUG is not set +CONFIG_FAT_FS=y +CONFIG_MSDOS_FS=y +# CONFIG_UMSDOS_FS is not set +CONFIG_VFAT_FS=y +# CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set +# CONFIG_JFFS2_FS is not set +# CONFIG_CRAMFS is not set +CONFIG_TMPFS=y +CONFIG_RAMFS=y +# CONFIG_ISO9660_FS is not set +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_JFS_FS is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +# CONFIG_HPFS_FS is not set +CONFIG_PROC_FS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVFS_MOUNT is not set +# CONFIG_DEVFS_DEBUG is not set +CONFIG_DEVPTS_FS=y +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_EXT2_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set +# CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set +# CONFIG_XFS_FS is not set +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_TRACE is not set +# CONFIG_XFS_DEBUG is not set + +# +# Network File Systems +# +# CONFIG_CODA_FS is not set +# CONFIG_INTERMEZZO_FS is not set +# CONFIG_NFS_FS is not set +# CONFIG_NFS_V3 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_ROOT_NFS is not set +# CONFIG_NFSD is not set +# CONFIG_NFSD_V3 is not set +# CONFIG_NFSD_TCP is not set +# CONFIG_SUNRPC is not set +# CONFIG_LOCKD is not set +# CONFIG_SMB_FS is not set +# CONFIG_NCP_FS is not set +# CONFIG_NCPFS_PACKET_SIGNING is not set +# CONFIG_NCPFS_IOCTL_LOCKING is not set +# CONFIG_NCPFS_STRONG is not set +# CONFIG_NCPFS_NFS_NS is not set +# CONFIG_NCPFS_OS2_NS is not set +# CONFIG_NCPFS_SMALLDOS is not set +# CONFIG_NCPFS_NLS is not set +# CONFIG_NCPFS_EXTRAS is not set +# CONFIG_ZISOFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_SMB_NLS is not set +CONFIG_NLS=y + +# +# Native Language Support +# +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Console drivers +# +# CONFIG_VGA_CONSOLE is not set +# CONFIG_VIDEO_SELECT is not set +# CONFIG_MDA_CONSOLE is not set + +# +# Frame-buffer support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# +# CONFIG_USB is not set + +# +# Support for USB gadgets +# +# CONFIG_USB_GADGET is not set + +# +# Bluetooth support +# +# CONFIG_BLUEZ is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +CONFIG_LOG_BUF_SHIFT=0 + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +CONFIG_OPTIMIZE_FOR_SIZE=y +CONFIG_CRC32=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +# CONFIG_FW_LOADER is not set diff --git a/obsolete-buildroot/sources/ltp-testsuite.patch b/obsolete-buildroot/sources/ltp-testsuite.patch new file mode 100644 index 0000000000..fed728e97f --- /dev/null +++ b/obsolete-buildroot/sources/ltp-testsuite.patch @@ -0,0 +1,59 @@ +--- ltp-full-20031002/testcases/kernel/syscalls/fmtmsg/Makefile.orig 2003-10-02 19:18:10.000000000 -0600 ++++ ltp-full-20031002/testcases/kernel/syscalls/fmtmsg/Makefile 2003-10-02 19:18:32.000000000 -0600 +@@ -24,7 +24,7 @@ + LOADLIBES+= -L../../../../lib -lltp + + SRCS=$(wildcard *.c) +-TARGETS=$(patsubst %.c,%,$(SRCS)) ++TARGETS=#$(patsubst %.c,%,$(SRCS)) + + all: $(TARGETS) + +--- ltp-full-20031002/testcases/kernel/syscalls/profil/Makefile.orig 2003-10-02 19:27:53.000000000 -0600 ++++ ltp-full-20031002/testcases/kernel/syscalls/profil/Makefile 2003-10-02 19:28:02.000000000 -0600 +@@ -23,7 +23,7 @@ + LOADLIBES+= -L../../../../lib -lltp + + SRCS=$(wildcard *.c) +-TARGETS=$(patsubst %.c,%,$(SRCS)) ++TARGETS=#$(patsubst %.c,%,$(SRCS)) + + all: $(TARGETS) + +--- ltp-full-20031002/testcases/network/rpc/rpc01/Makefile.orig 2003-10-02 19:36:51.000000000 -0600 ++++ ltp-full-20031002/testcases/network/rpc/rpc01/Makefile 2003-10-02 19:37:03.000000000 -0600 +@@ -2,7 +2,7 @@ + LDLIBS += + + SRCS=$(wildcard *.c) +-TARGETS=$(patsubst %.c,%,$(SRCS)) ++TARGETS=#$(patsubst %.c,%,$(SRCS)) + + all: $(TARGETS) + +--- ltp-full-20031002/tools/netpipe-2.4-ipv6/Makefile.orig 2003-11-07 16:41:39.000000000 -0700 ++++ ltp-full-20031002/tools/netpipe-2.4-ipv6/Makefile 2003-11-07 16:42:41.000000000 -0700 +@@ -10,7 +10,7 @@ + DRIV_OBJ = netpipe.o + INCLUDES = netpipe.h + # Default target is just TCP +-TARGETS = NPtcp-ipv6 ++TARGETS = #NPtcp-ipv6 + # If you have TCP, MPI and PVM + #TARGETS = NPtcp NPmpi NPpvm + CFLAGS += -O -Wall +@@ -28,12 +28,12 @@ + targets: $(TARGETS) + + install: +- @ln -f NPtcp-ipv6 ../../testcases/bin ++ #@ln -f NPtcp-ipv6 ../../testcases/bin + # + # This section of the Makefile is for compiling the binaries + # + +-TCP: NPtcp-ipv6 ++TCP: #NPtcp-ipv6 + @echo 'NPtcp has been built.' + + NPtcp-ipv6: NPtcp.o TCP.o diff --git a/obsolete-buildroot/sources/lzo-cross-compile.patch b/obsolete-buildroot/sources/lzo-cross-compile.patch new file mode 100644 index 0000000000..68a3d0449e --- /dev/null +++ b/obsolete-buildroot/sources/lzo-cross-compile.patch @@ -0,0 +1,43 @@ +For some reason the lzo autoconf script uses a local macro that does +a test for cross-compiles, and assumes that if the build target name +and the host target name are the same that --host was not specified to +the configure script. In the uClibc buildroot, this is not the case. + +--- lzo-1.08/aclocal.m4 2002-07-12 18:31:52.000000000 -0700 ++++ lzo-1.08/aclocal.m4.new 2004-03-10 15:32:42.000000000 -0700 +@@ -205,12 +205,6 @@ + [ + AC_REQUIRE([AC_PROG_CC]) + +-if test "X$cross_compiling" = Xyes; then +- if test "X$build" = "X$host"; then +- AC_MSG_ERROR([you are cross compiling - please use the \`--host=' option]) +- fi +-fi +- + ]) + + +--- lzo-1.08/configure-dist 2004-03-11 02:18:28.000000000 -0600 ++++ lzo-1.08/configure 2004-03-11 02:19:16.000000000 -0600 +@@ -2282,13 +2282,13 @@ + + + +-if test "X$cross_compiling" = Xyes; then +- if test "X$build" = "X$host"; then +- { { echo "$as_me:$LINENO: error: you are cross compiling - please use the \`--host=' option" >&5 +-echo "$as_me: error: you are cross compiling - please use the \`--host=' option" >&2;} +- { (exit 1); exit 1; }; } +- fi +-fi ++#if test "X$cross_compiling" = Xyes; then ++# if test "X$build" = "X$host"; then ++# { { echo "$as_me:$LINENO: error: you are cross compiling - please use the \`--host=' option" >&5 ++#echo "$as_me: error: you are cross compiling - please use the \`--host=' option" >&2;} ++# { (exit 1); exit 1; }; } ++# fi ++#fi + + + diff --git a/obsolete-buildroot/sources/mime.types b/obsolete-buildroot/sources/mime.types new file mode 100644 index 0000000000..53f6ea1011 --- /dev/null +++ b/obsolete-buildroot/sources/mime.types @@ -0,0 +1,205 @@ +############################################################################### +# +# MIME-TYPES and the extensions that represent them +# +# This file is part of the "mime-support" package. Please send email (not a +# bug report) to mime-support@packages.debian.org if you would like new types +# and/or extensions to be added. +# +# Note: Compression schemes like "gzip", "bzip", and "compress" are not +# actually "mime-types". They are "encodings" and hence must _not_ have +# entries in this file to map their extensions. The "mime-type" of an +# encoded file refers to the type of data that has been encoded, not the +# type of the encoding. +# +############################################################################### + + +application/activemessage +application/andrew-inset +application/applefile +application/atomicmail +application/cu-seeme csm cu +application/dca-rft +application/dec-dx +application/dsptype tsp +application/futuresplash spl +application/ghostview +application/mac-binhex40 hqx +application/macwriteii +application/msaccess mdb +application/msword doc dot +application/news-message-id +application/news-transmission +application/octet-stream bin +application/oda oda +application/pdf pdf +application/pgp-signature pgp +application/postscript ps ai eps +application/remote-printing +application/rtf rtf +application/slate +application/vnd.ms-excel xls xlb +application/vnd.ms-powerpoint ppt pps pot +application/vnd.wap.wmlc wmlc +application/vnd.wap.wmlscriptc wmlsc +application/wita +application/wordperfect5.1 wp5 +application/zip zip +application/x-123 wk +application/x-bcpio bcpio +application/x-chess-pgn pgn +application/x-core +application/x-cpio cpio +application/x-csh +application/x-debian-package deb +application/x-director dcr dir dxr +application/x-dms dms +application/x-dvi dvi +application/x-executable +application/x-font pfa pfb gsf pcf pcf.Z +application/x-gnumeric gnumeric +application/x-gtar gtar tgz +application/x-hdf hdf +application/x-httpd-php phtml pht php +application/x-httpd-php3 php3 +application/x-httpd-php3-source phps +application/x-httpd-php3-preprocessed php3p +application/x-httpd-php4 php4 +application/x-ica ica +application/x-java class +application/x-javascript js +application/x-kdelnk +application/x-kchart chrt +application/x-killustrator kil +application/x-kpresenter kpr kpt +application/x-kspread ksp +application/x-kword kwd kwt +application/x-latex latex +application/x-lha lha +application/x-lzh lzh +application/x-lzx lzx +application/x-maker frm maker frame fm fb book fbdoc +application/x-mif mif +application/x-msdos-program com exe bat dll +application/x-msi msi +application/x-netcdf nc cdf +application/x-ns-proxy-autoconfig pac +application/x-object o +application/x-ogg ogg +application/x-oz-application oza +application/x-perl pl pm +application/x-redhat-package-manager rpm +application/x-rx +application/x-sh +application/x-shar shar +application/x-shellscript +application/x-shockwave-flash swf swfl +application/x-stuffit sit +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-tar tar +application/x-tcl +application/x-tex +application/x-tex-gf gf +application/x-tex-pk pk PK +application/x-texinfo texinfo texi +application/x-trash ~ % bak old sik +application/x-troff t tr roff +application/x-troff-man man +application/x-troff-me me +application/x-troff-ms ms +application/x-ustar ustar +application/x-wais-source src +application/x-wingz wz + +audio/basic au snd +audio/midi mid midi +audio/mpeg mpga mpega mp2 mp3 +audio/mpegurl m3u +audio/prs.sid sid +audio/x-aiff aif aiff aifc +audio/x-gsm gsm +audio/x-pn-realaudio ra rm ram +audio/x-wav wav + +image/bitmap bmp +image/gif gif +image/ief ief +image/jpeg jpeg jpg jpe +image/pcx pcx +image/png png +image/tiff tiff tif +image/vnd.wap.wbmp wbmp +image/x-cmu-raster ras +image/x-coreldraw cdr +image/x-coreldrawpattern pat +image/x-coreldrawtemplate cdt +image/x-corelphotopaint cpt +image/x-jng jng +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-rgb rgb +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd + +inode/chardevice +inode/blockdevice +inode/directory-locked +inode/directory +inode/fifo +inode/socket + +message/external-body +message/news +message/partial +message/rfc822 + +multipart/alternative +multipart/appledouble +multipart/digest +multipart/mixed +multipart/parallel + +text/comma-separated-values csv +text/css css +text/english +text/html htm html xhtml +text/mathml mml +text/plain txt text diff +text/richtext rtx +text/tab-separated-values tsv +text/vnd.wap.wml wml +text/vnd.wap.wmlscript wmls +text/xml xml +text/x-c++hdr h++ hpp hxx hh +text/x-c++src c++ cpp cxx cc +text/x-chdr h +text/x-crontab +text/x-csh csh +text/x-csrc c +text/x-java java +text/x-makefile +text/x-moc moc +text/x-pascal p pas +text/x-setext etx +text/x-sh sh +text/x-tcl tcl tk +text/x-tex tex ltx sty cls +text/x-vcalendar vcs +text/x-vcard vcf + +video/dl dl +video/fli fli +video/gl gl +video/mpeg mpeg mpg mpe +video/quicktime qt mov +video/x-mng mng +video/x-ms-asf asf asx +video/x-msvideo avi +video/x-sgi-movie movie + +x-world/x-vrml vrm vrml wrl diff --git a/obsolete-buildroot/sources/mrouted-sys_errlist.patch b/obsolete-buildroot/sources/mrouted-sys_errlist.patch new file mode 100644 index 0000000000..8498dc743f --- /dev/null +++ b/obsolete-buildroot/sources/mrouted-sys_errlist.patch @@ -0,0 +1,44 @@ +Patches from Kevin P. Fleming . + +--- mrouted-3.9-beta3.orig/main.c~ 2004-03-10 19:00:38.000000000 -0700 ++++ mrouted-3.9-beta3.orig/main.c 2004-03-10 19:02:33.000000000 -0700 +@@ -1001,10 +1001,8 @@ + thyme->tm_min, thyme->tm_sec, now.tv_usec / 1000, msg); + if (syserr == 0) + fprintf(stderr, "\n"); +- else if (syserr < sys_nerr) +- fprintf(stderr, ": %s\n", sys_errlist[syserr]); + else +- fprintf(stderr, ": errno %d\n", syserr); ++ fprintf(stderr, ": %s\n", strerror(syserr)); + } + + /* +--- mrouted-3.9-beta3.orig/mrinfo.c~ 1998-02-28 20:05:20.000000000 -0700 ++++ mrouted-3.9-beta3.orig/mrinfo.c 2004-03-10 19:01:49.000000000 -0700 +@@ -159,10 +159,8 @@ + vfprintf(stderr, fmt, ap); + if (syserr == 0) + fprintf(stderr, "\n"); +- else if (syserr < sys_nerr) +- fprintf(stderr, ": %s\n", sys_errlist[syserr]); + else +- fprintf(stderr, ": errno %d\n", syserr); ++ fprintf(stderr, ": %s\n", strerror(syserr)); + } + + if (severity <= LOG_ERR) +--- mrouted-3.9-beta3.orig/mapper.c~ 1998-01-05 18:57:47.000000000 -0700 ++++ mrouted-3.9-beta3.orig/mapper.c 2004-03-10 19:02:04.000000000 -0700 +@@ -197,10 +197,8 @@ + vfprintf(stderr, fmt, ap); + if (syserr == 0) + fprintf(stderr, "\n"); +- else if (syserr < sys_nerr) +- fprintf(stderr, ": %s\n", sys_errlist[syserr]); + else +- fprintf(stderr, ": errno %d\n", syserr); ++ fprintf(stderr, ": %s\n", strerror(syserr)); + } + + if (severity <= LOG_ERR) diff --git a/obsolete-buildroot/sources/netkittelnet.patch b/obsolete-buildroot/sources/netkittelnet.patch new file mode 100644 index 0000000000..c894c2abd8 --- /dev/null +++ b/obsolete-buildroot/sources/netkittelnet.patch @@ -0,0 +1,171 @@ +--- netkit-telnet-0.17/configure Thu Apr 11 10:40:58 2002 ++++ FIXEDnetkittelnet/configure Thu Apr 11 10:39:59 2002 +@@ -78,7 +78,6 @@ + for TRY in egcs gcc g++ CC c++ cc; do + ( + $TRY __conftest.c -o __conftest || exit 1; +- ./__conftest || exit 1; + ) >/dev/null 2>&1 || continue; + CC=$TRY + break; +@@ -94,7 +93,6 @@ + echo -n 'Checking if C compiler works... ' + if ( + $CC __conftest.c -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'yes' + else +@@ -125,7 +123,6 @@ + for TRY in egcs gcc g++ CC c++ cc; do + ( + $TRY __conftest.cc -o __conftest || exit 1; +- ./__conftest || exit 1; + ) >/dev/null 2>&1 || continue; + CXX=$TRY + break; +@@ -141,7 +138,6 @@ + echo -n 'Checking if C++ compiler works... ' + if ( + $CXX __conftest.cc -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'yes' + else +@@ -278,13 +274,11 @@ + EOF + if ( + $CXX $CXXFLAGS __conftest.cc -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'yes' + else + if ( + $CXX $CXXFLAGS -D__USE_BSD_SIGNAL __conftest.cc -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-D__USE_BSD_SIGNAL' + CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL" +@@ -292,6 +286,7 @@ + else + echo 'no' + echo 'This package needs BSD signal semantics to run.' ++ echo "$CXX $CXXFLAGS -D__USE_BSD_SIGNAL __conftest.cc -o __conftest failed" + rm -f __conftest* + exit + fi +@@ -330,31 +325,6 @@ + echo 'no' + fi + fi +- +-if [ x$NCURSES != x ]; then +- LIBTERMCAP=-lncurses +-else +- echo -n 'Checking for traditional termcap... ' +-cat <__conftest.cc +-#include +-#include +-int main(void) { +- tgetent(NULL, NULL); return 0; +-} +- +-EOF +- if ( +- $CXX $CXXFLAGS __conftest.cc -ltermcap -o __conftest || exit 1 +- ) >/dev/null 2>&1; then +- echo '-ltermcap' +- LIBTERMCAP=-ltermcap +- else +- echo 'not found' +- echo 'This package needs termcap to run.' +- rm -f __conftest* +- exit +- fi +-fi + rm -f __conftest* + + ################################################## +@@ -468,7 +438,6 @@ + else + if ( + $CXX $CXXFLAGS -D_GNU_SOURCE __conftest.cc -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-D_GNU_SOURCE' + CFLAGS="$CFLAGS -D_GNU_SOURCE" +@@ -501,20 +470,17 @@ + EOF + if ( + $CXX $CXXFLAGS __conftest.cc $LIBBSD -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'ok' + else + if ( + $CXX $CXXFLAGS __conftest.cc -lsnprintf $LIBBSD -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-lsnprintf' + LIBS="$LIBS -lsnprintf" + else + if ( + $CXX $CXXFLAGS __conftest.cc -ldb $LIBBSD -o __conftest || exit 1 +- ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-ldb' + LIBS="$LIBS -ldb" +diff -urN netkit-telnet-0.17/telnetd/state.c netkit-telnet-0.17-dm/telnetd/state.c +--- netkit-telnet-0.17/telnetd/state.c 1999-12-12 11:41:44.000000000 -0800 ++++ netkit-telnet-0.17-dm/telnetd/state.c 2003-07-23 19:20:38.000000000 -0700 +@@ -43,10 +43,10 @@ + + static int envvarok(char *varp); + +-static unsigned char doopt[] = { IAC, DO, '%', 'c', 0 }; +-static unsigned char dont[] = { IAC, DONT, '%', 'c', 0 }; +-unsigned char will[] = { IAC, WILL, '%', 'c', 0 }; +-unsigned char wont[] = { IAC, WONT, '%', 'c', 0 }; ++//static unsigned char doopt[] = { IAC, DO, '%', 'c', 0 }; ++//static unsigned char dont[] = { IAC, DONT, '%', 'c', 0 }; ++//unsigned char will[] = { IAC, WILL, '%', 'c', 0 }; ++//unsigned char wont[] = { IAC, WONT, '%', 'c', 0 }; + + /* + * Buffer for sub-options, and macros +@@ -422,7 +422,7 @@ + set_his_want_state_will(option); + do_dont_resp[option]++; + } +- netoprintf((char *)doopt, option); ++ netoprintf( "%c%c%c", IAC, DO, option ); + + DIAG(TD_OPTIONS, printoption("td: send do", option)); + } +@@ -632,7 +632,7 @@ + set_his_want_state_wont(option); + do_dont_resp[option]++; + } +- netoprintf((char *) dont, option); ++ netoprintf ( "%c%c%c", IAC, DONT, option ); + + DIAG(TD_OPTIONS, printoption("td: send dont", option)); + } +@@ -769,7 +769,7 @@ + set_my_want_state_will(option); + will_wont_resp[option]++; + } +- netoprintf((char *) will, option); ++ netoprintf( "%c%c%c", IAC, WILL, option); + + DIAG(TD_OPTIONS, printoption("td: send will", option)); + } +@@ -917,7 +917,7 @@ + set_my_want_state_wont(option); + will_wont_resp[option]++; + } +- netoprintf((char *)wont, option); ++ netoprintf( "%c%c%c", IAC, WONT, option); + + DIAG(TD_OPTIONS, printoption("td: send wont", option)); + } diff --git a/obsolete-buildroot/sources/netsnmp.patch b/obsolete-buildroot/sources/netsnmp.patch new file mode 100644 index 0000000000..076592bd8e --- /dev/null +++ b/obsolete-buildroot/sources/netsnmp.patch @@ -0,0 +1,32 @@ +diff -urN net-snmp-5.1-dist/agent/mibgroup/host/hr_system.c net-snmp-5.1/agent/mibgroup/host/hr_system.c +--- net-snmp-5.1-dist/agent/mibgroup/host/hr_system.c 2003-02-28 22:35:13.000000000 -0600 ++++ net-snmp-5.1/agent/mibgroup/host/hr_system.c 2004-03-31 22:06:05.000000000 -0600 +@@ -286,7 +286,11 @@ + current user */ + if (kill(utmp_p->ut_pid, 0) == -1 && errno == ESRCH) { + utmp_p->ut_type = DEAD_PROCESS; ++#if HAVE_UTMPX_H + pututxline(utmp_p); ++#else ++ pututline(utmp_p); ++#endif + continue; + } + ++total; +diff -urN net-snmp-5.1-dist/configure.in net-snmp-5.1/configure.in +--- net-snmp-5.1-dist/configure.in 2004-03-31 21:59:14.000000000 -0600 ++++ net-snmp-5.1/configure.in 2004-03-31 22:06:05.000000000 -0600 +@@ -1865,13 +1865,8 @@ + if test $cross_compiling = yes; then + if test $with_endianness = "big"; then + AC_DEFINE(WORDS_BIGENDIAN) +- elif test -z $with_endianness; then +- AC_MSG_ERROR([You are cross-compiling, but you have not specified the target's endianness]) + fi + else +- if test $with_endianness; then +- AC_MSG_ERROR([Endianness has been specified, but you are not cross-compiling.]) +- fi + AC_C_BIGENDIAN + fi + diff --git a/obsolete-buildroot/sources/openssh.patch b/obsolete-buildroot/sources/openssh.patch new file mode 100644 index 0000000000..7d85a0400e --- /dev/null +++ b/obsolete-buildroot/sources/openssh.patch @@ -0,0 +1,289 @@ +--- openssh-3.6.1p1/Makefile.in.orig 2003-03-20 17:34:34.000000000 -0700 ++++ openssh-3.6.1p1/Makefile.in 2003-04-25 17:09:00.000000000 -0600 +@@ -27,7 +27,7 @@ + RAND_HELPER=$(libexecdir)/ssh-rand-helper + PRIVSEP_PATH=@PRIVSEP_PATH@ + SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ +-STRIP_OPT=@STRIP_OPT@ ++STRIP_OPT= + + PATHS= -DSSHDIR=\"$(sysconfdir)\" \ + -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \ +--- openssh-3.8p1/configure.ac.orig 2004-02-23 22:47:04.000000000 -0700 ++++ openssh-3.8p1/configure.ac 2004-03-19 01:41:47.000000000 -0700 +@@ -481,6 +481,9 @@ + [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***]) ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) + ] + ) + +@@ -632,6 +635,9 @@ + else + AC_MSG_WARN([zlib version may have security problems]) + fi ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) + ] + ) + +@@ -696,6 +702,9 @@ + [ + AC_MSG_RESULT(no) + AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) + ] + ) + +@@ -727,6 +736,9 @@ + [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([** Incomplete or missing s/key libraries.]) ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) + ]) + fi + ] +@@ -840,7 +852,11 @@ + ], + [AC_MSG_RESULT(yes)], + [AC_DEFINE(BROKEN_SETRESUID) +- AC_MSG_RESULT(not implemented)] ++ AC_MSG_RESULT(not implemented) ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) ++ ] + ) + ]) + +@@ -854,7 +870,11 @@ + ], + [AC_MSG_RESULT(yes)], + [AC_DEFINE(BROKEN_SETRESGID) +- AC_MSG_RESULT(not implemented)] ++ AC_MSG_RESULT(not implemented) ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) ++ ] + ) + ]) + +@@ -890,6 +910,9 @@ + AC_MSG_RESULT(no) + AC_DEFINE(BROKEN_SNPRINTF) + AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) + ] + ) + fi +@@ -963,7 +986,10 @@ + [ + AC_MSG_RESULT(no) + AC_DEFINE(SSHD_ACQUIRES_CTTY) +- ] ++ ], ++ [AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) ++ ] + ) + fi + +@@ -1096,6 +1122,10 @@ + [ + AC_MSG_RESULT(not found) + AC_MSG_ERROR(OpenSSL version header not found.) ++ ], ++ [ ++ ssl_header_ver="0x0090704fL (OpenSSL 0.9.7d 17 Mar 2004)" ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to $ssl_header_ver]) + ] + ) + +@@ -1129,6 +1159,10 @@ + [ + AC_MSG_RESULT(not found) + AC_MSG_ERROR(OpenSSL library not found.) ++ ], ++ [ ++ ssl_header_ver="0x0090704fL (OpenSSL 0.9.7d 17 Mar 2004)" ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to $ssl_library_ver]) + ] + ) + +@@ -1148,7 +1182,11 @@ + AC_MSG_ERROR([Your OpenSSL headers do not match your library. + Check config.log for details. + Also see contrib/findssl.sh for help identifying header/library mismatches.]) +- ] ++ ], ++ [ ++ AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) ++ ] + ) + + # Some systems want crypt() from libcrypt, *not* the version in OpenSSL, +@@ -1183,6 +1221,11 @@ + # Default to use of the rand helper if OpenSSL doesn't + # seed itself + USE_RAND_HELPER=yes ++ ], ++ [ ++ OPENSSL_SEEDS_ITSELF=yes ++ AC_MSG_RESULT(yes) ++ AC_MSG_WARN([Cannot run test when crosscompiling, defaulted to yes.]) + ] + ) + +@@ -1773,7 +1816,8 @@ + #else + main() { exit(0); } + #endif +- ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ] ++ ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ], ++ [ true ] + ) + fi + +@@ -1893,6 +1937,7 @@ + } + ], + [ ac_cv_have_accrights_in_msghdr="yes" ], ++ [ ac_cv_have_accrights_in_msghdr="no" ], + [ ac_cv_have_accrights_in_msghdr="no" ] + ) + ]) +@@ -1917,7 +1962,8 @@ + } + ], + [ ac_cv_have_control_in_msghdr="yes" ], +- [ ac_cv_have_control_in_msghdr="no" ] ++ [ ac_cv_have_control_in_msghdr="no" ], ++ [ ac_cv_have_control_in_msghdr="yes" ] + ) + ]) + if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then +@@ -2229,12 +2275,9 @@ + ) + fi + fi +-AC_CHECK_FILE("/dev/ptc", +- [ +- AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) +- have_dev_ptc=1 +- ] +-) ++AC_MSG_CHECKING([for "/dev/ptc"]) ++AC_MSG_RESULT(no) ++have_dev_ptc=0 + + # Options from here on. Some of these are preset by platform above + AC_ARG_WITH(mantype, +@@ -2329,15 +2372,8 @@ + fi + + # check for /etc/default/login and use it if present. +-AC_ARG_ENABLE(etc-default-login, +- [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],, +-[ +-AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ]) +- +-if test "x$external_path_file" = "x/etc/default/login"; then +- AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN) +-fi +-]) ++AC_MSG_CHECKING([for "/etc/default/login"]) ++AC_MSG_RESULT(no) + + dnl BSD systems use /etc/login.conf so --with-default-path= has no effect + if test $ac_cv_func_login_getcapbool = "yes" -a \ +--- openssh-3.8p1.orig/sshd_config Fri Sep 27 05:21:58 2002 ++++ openssh-3.8p1/sshd_config Mon Mar 17 14:55:00 2003 +@@ -89,5 +89,8 @@ + #Banner /some/path + #VerifyReverseMapping no + ++ClientAliveInterval 15 ++ClientAliveCountMax 4 ++ + # override default of no subsystems +-Subsystem sftp /usr/libexec/sftp-server ++Subsystem sftp /usr/sbin/sftp-server +--- openssh-3.6.1p1/S50sshd Fri Sep 27 05:21:58 2002 ++++ openssh-3.6.1p1/S50sshd Mon Mar 17 14:55:00 2003 +@@ -0,0 +1,64 @@ ++#!/bin/sh ++# ++# sshd Starts sshd. ++# ++ ++# Make sure the ssh-keygen progam exists ++[ -f /usr/bin/ssh-keygen ] || exit 0 ++ ++# Check for the SSH1 RSA key ++if [ ! -f /etc/ssh_host_key ] ; then ++ echo Generating RSA Key... ++ /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh_host_key -C '' -N '' ++fi ++ ++# Check for the SSH2 RSA key ++if [ ! -f /etc/ssh_host_rsa_key ] ; then ++ echo Generating RSA Key... ++ /usr/bin/ssh-keygen -t rsa -f /etc/ssh_host_rsa_key -C '' -N '' ++fi ++ ++# Check for the SSH2 DSA key ++if [ ! -f /etc/ssh_host_dsa_key ] ; then ++ echo Generating DSA Key... ++ echo THIS CAN TAKE A MINUTE OR TWO DEPENDING ON YOUR PROCESSOR! ++ echo ++ /usr/bin/ssh-keygen -t dsa -f /etc/ssh_host_dsa_key -C '' -N '' ++fi ++ ++umask 077 ++ ++start() { ++ echo -n "Starting sshd: " ++ /usr/sbin/sshd ++ touch /var/lock/sshd ++ echo "OK" ++} ++stop() { ++ echo -n "Stopping sshd: " ++ killall sshd ++ rm -f /var/lock/sshd ++ echo "OK" ++} ++restart() { ++ stop ++ start ++} ++ ++case "$1" in ++ start) ++ start ++ ;; ++ stop) ++ stop ++ ;; ++ restart|reload) ++ restart ++ ;; ++ *) ++ echo $"Usage: $0 {start|stop|restart}" ++ exit 1 ++esac ++ ++exit $? ++ diff --git a/obsolete-buildroot/sources/openssl.patch b/obsolete-buildroot/sources/openssl.patch new file mode 100644 index 0000000000..2e8d50f1cb --- /dev/null +++ b/obsolete-buildroot/sources/openssl.patch @@ -0,0 +1,238 @@ +--- openssl-0.9.7.orig/Configure ++++ openssl-0.9.7/Configure +@@ -1,4 +1,4 @@ +-: ++#!/usr/bin/perl + eval 'exec perl -S $0 ${1+"$@"}' + if $running_under_some_shell; + ## +@@ -373,6 +373,40 @@ + # assembler versions -- currently defunct: + ##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer:::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:${alpha_asm}", + ++# Sane Linux configuration values, stolen from the Debian package.... ++"linux-alpha","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-alpha-ev4","gcc:-DTERMIO -O3 -mcpu=ev4 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-alpha-ev5","gcc:-DTERMIO -O3 -mcpu=ev5 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-freebsd-alpha","gcc:-DTERMIOS -O -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-freebsd-i386", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::-pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-hppa","gcc:-DB_ENDIAN -DTERMIO -O2 -Wall::-D_REENTRANT::-ldl:BN_LLONG MD2_CHAR RC4_INDEX::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-hurd-i386","gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-ia64","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++#"linux-i386","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC", ++"linux-i386","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-i386-i486","gcc:-DL_ENDIAN -DTERMIO -O3 -march=i486 -mcpu=i486 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-i386-i586","gcc:-DL_ENDIAN -DTERMIO -O3 -march=i586 -mcpu=i586 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-i386-i686/cmov","gcc:-DL_ENDIAN -DTERMIO -O3 -march=i686 -mcpu=i686 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-m68k","gcc:-DB_ENDIAN -DTERMIO -O2 -Wall::-D_REENTRANT::-ldl:BN_LLONG MD2_CHAR RC4_INDEX::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-mipsel", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-netbsd-i386", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-netbsd-m68k", "gcc:-DB_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-netbsd-sparc", "gcc:-DB_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-openbsd-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-openbsd-i386", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-openbsd-mips","gcc:-O2 -DL_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR:::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-powerpc","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_UNROLL DES_RISC2 DES_PTR MD2_CHAR RC4_INDEX::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-s390","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sh3", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sh4", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sh3eb", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sh4eb", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sparc","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sparc-v8","gcc:-DB_ENDIAN -DTERMIO -O3 -mcpu=v8 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-sparc-v9","gcc:-DB_ENDIAN -DTERMIO -O3 -mcpu=v9 -Wa,-Av8plus -fomit-frame-pointer -Wall -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-cris", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + # The intel boxes :-), It would be worth seeing if bsdi-gcc can use the + # bn86-elf.o file file since it is hand tweaked assembler. + "linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +--- openssl-0.9.7.orig/crypto/md5/asm/md5-sparcv9.S ++++ openssl-0.9.7/crypto/md5/asm/md5-sparcv9.S +@@ -72,14 +72,14 @@ + #define Dval R8 + + #if defined(MD5_BLOCK_DATA_ORDER) +-# if defined(OPENSSL_SYSNAME_ULTRASPARC) ++/*# if defined(OPENSSL_SYSNAME_ULTRASPARC)*/ + # define LOAD lda + # define X(i) [%i1+i*4]%asi + # define md5_block md5_block_asm_data_order_aligned + # define ASI_PRIMARY_LITTLE 0x88 +-# else ++/*# else + # error "MD5_BLOCK_DATA_ORDER is supported only on UltraSPARC!" +-# endif ++# endif*/ + #else + # define LOAD ld + # define X(i) [%i1+i*4] +--- openssl-0.9.7.orig/crypto/opensslconf.h ++++ openssl-0.9.7/crypto/opensslconf.h +@@ -4,17 +4,38 @@ + /* OpenSSL was configured with the following options: */ + #ifndef OPENSSL_DOING_MAKEDEPEND + ++#ifndef OPENSSL_NO_IDEA ++# define OPENSSL_NO_IDEA ++#endif ++#ifndef OPENSSL_NO_MDC2 ++# define OPENSSL_NO_MDC2 ++#endif ++#ifndef OPENSSL_NO_RC5 ++# define OPENSSL_NO_RC5 ++#endif + #ifndef OPENSSL_NO_KRB5 + # define OPENSSL_NO_KRB5 + #endif + + #endif /* OPENSSL_DOING_MAKEDEPEND */ ++#ifndef OPENSSL_THREADS ++# define OPENSSL_THREADS ++#endif + + /* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ + #ifdef OPENSSL_ALGORITHM_DEFINES ++# if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA) ++# define NO_IDEA ++# endif ++# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) ++# define NO_MDC2 ++# endif ++# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) ++# define NO_RC5 ++# endif + # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) + # define NO_KRB5 + # endif +@@ -27,7 +48,7 @@ + + #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ + #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +-#define OPENSSLDIR "/usr/local/ssl" ++#define OPENSSLDIR "/usr/lib/ssl" + #endif + #endif + +@@ -79,7 +100,7 @@ + + #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) + #define CONFIG_HEADER_BN_H +-#undef BN_LLONG ++#define BN_LLONG + + /* Should we define BN_DIV2W here? */ + +@@ -98,7 +119,7 @@ + #define CONFIG_HEADER_RC4_LOCL_H + /* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +-#undef RC4_INDEX ++#define RC4_INDEX + #endif + + #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +@@ -112,14 +133,14 @@ + /* the following is tweaked from a config script, that is why it is a + * protected undef/define */ + #ifndef DES_PTR +-#undef DES_PTR ++#define DES_PTR + #endif + + /* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ + #ifndef DES_RISC1 +-#undef DES_RISC1 ++#define DES_RISC1 + #endif + + #ifndef DES_RISC2 +@@ -133,7 +154,7 @@ + /* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ + #ifndef DES_UNROLL +-#undef DES_UNROLL ++#define DES_UNROLL + #endif + + /* These default values were supplied by +--- openssl-0.9.7.orig/ssl/ssl_algs.c ++++ openssl-0.9.7/ssl/ssl_algs.c +@@ -109,3 +109,8 @@ + return(1); + } + ++#undef SSLeay_add_ssl_algorithms ++int SSLeay_add_ssl_algorithms(void) ++ { ++ return SSL_library_init(); ++ } +--- openssl-0.9.7.orig/tools/c_rehash.in ++++ openssl-0.9.7/tools/c_rehash.in +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl ++#!/usr/bin/perl + + + # Perl c_rehash script, scan all files in a directory +--- openssl-0.9.7.orig/util/clean-depend.pl ++++ openssl-0.9.7/util/clean-depend.pl +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + # Clean the dependency list in a makefile of standard includes... + # Written by Ben Laurie 19 Jan 1999 + +--- openssl-0.9.7.orig/util/extract-names.pl ++++ openssl-0.9.7/util/extract-names.pl +@@ -1,4 +1,4 @@ +-#!/usr/bin/perl ++#!/usr/bin/perl + + $/ = ""; # Eat a paragraph at once. + while() { +--- openssl-0.9.7.orig/util/mkdef.pl ++++ openssl-0.9.7/util/mkdef.pl +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + # + # generate a .def file + # +--- openssl-0.9.7.orig/util/mkerr.pl ++++ openssl-0.9.7/util/mkerr.pl +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + + my $config = "crypto/err/openssl.ec"; + my $debug = 0; +--- openssl-0.9.7.orig/util/mkstack.pl ++++ openssl-0.9.7/util/mkstack.pl +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + + # This is a utility that searches out "DECLARE_STACK_OF()" + # declarations in .h and .c files, and updates/creates/replaces +--- openssl-0.9.7.orig/util/pod2man.pl ++++ openssl-0.9.7/util/pod2man.pl +@@ -1,4 +1,4 @@ +-: #!/usr/bin/perl-5.005 ++#!/usr/bin/perl + eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' + if $running_under_some_shell; + +--- openssl-0.9.7.orig/util/selftest.pl ++++ openssl-0.9.7/util/selftest.pl +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + # + # Run the test suite and generate a report + # diff --git a/obsolete-buildroot/sources/openvpn b/obsolete-buildroot/sources/openvpn new file mode 100755 index 0000000000..94bdc600e0 --- /dev/null +++ b/obsolete-buildroot/sources/openvpn @@ -0,0 +1,103 @@ +#!/bin/sh -e +# +# Original version by Robert Leslie +# , edited by iwj and cs +# Modified for openvpn by Alberto Gonzalez Iniesta +# Modified for restarting / starting / stopping single tunnels by Richard Mueller + +test $DEBIAN_SCRIPT_DEBUG && set -v -x + +DAEMON=/usr/sbin/openvpn +CONFIG_DIR=/etc/openvpn +test -x $DAEMON || exit 0 +test -d $CONFIG_DIR || exit 0 + +start_vpn () { + $DAEMON --daemon --writepid /var/run/openvpn.$NAME.pid \ + --config $CONFIG_DIR/$NAME.conf --cd $CONFIG_DIR || echo -n " FAILED->" + echo -n " $NAME" +} +stop_vpn () { + kill `cat $PIDFILE` || true + rm $PIDFILE +} + +case "$1" in +start) + echo -n "Starting openvpn:" + + if test -z $2 ; then + for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do + NAME=${CONFIG%%.conf} + start_vpn + done + else + if test -e $CONFIG_DIR/$2.conf ; then + NAME=$2 + start_vpn + else + echo -n " No such VPN: $2" + fi + fi + echo "." + + ;; +stop) + echo -n "Stopping openvpn:" + + if test -z $2 ; then + for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do + NAME=`echo $PIDFILE | cut -c18-` + NAME=${NAME%%.pid} + stop_vpn + echo -n " $NAME" + done + else + if test -e /var/run/openvpn.$2.pid ; then + PIDFILE=`ls /var/run/openvpn.$2.pid 2> /dev/null` + NAME=`echo $PIDFILE | cut -c18-` + NAME=${NAME%%.pid} + stop_vpn + echo -n " $NAME" + else + echo -n " No such VPN: $2" + fi + fi + echo "." + ;; +# We only 'reload' for running VPNs. New ones will only start with 'start' or 'restart'. +reload|force-reload) + echo -n "Reloading openvpn:" + for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do + NAME=`echo $PIDFILE | cut -c18-` + NAME=${NAME%%.pid} +# If openvpn if running under a different user than root we'll need to restart + if egrep '^( |\t)*user' $CONFIG_DIR/$NAME.conf > /dev/null 2>&1 ; then + stop_vpn + sleep 1 + start_vpn + echo -n "(restarted)" + else + kill -HUP `cat $PIDFILE` || true +# start-stop-daemon --stop --signal HUP --quiet --oknodo \ +# --exec $DAEMON --pidfile $PIDFILE + echo -n " $NAME" + fi + done + echo "." + ;; + +restart) + $0 stop $2 + sleep 1 + $0 start $2 + ;; +*) + echo "Usage: $0 {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + +# vim:set ai et sts=2 sw=2 tw=0: diff --git a/obsolete-buildroot/sources/openwrt-diag.c b/obsolete-buildroot/sources/openwrt-diag.c new file mode 100644 index 0000000000..73bdac918e --- /dev/null +++ b/obsolete-buildroot/sources/openwrt-diag.c @@ -0,0 +1,137 @@ +// replacement diag module +// (c) 2004 openwrt +// mbm at alt dot org +// +// initial release 2004/03/28 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void *sbh; + +// v2.x - - - - - +#define DIAG_GPIO (1<<1) +#define DMZ_GPIO (1<<7) + +static void set_gpio(uint32 mask, uint32 value) { + sb_gpiocontrol(sbh,mask,0); + sb_gpioouten(sbh,mask,mask); + sb_gpioout(sbh,mask,value); +} + +static void v2_set_diag(u8 state) { + set_gpio(DIAG_GPIO,state); +} +static void v2_set_dmz(u8 state) { + set_gpio(DMZ_GPIO,state); +} + +// v1.x - - - - - +#define LED_DIAG 0x13 +#define LED_DMZ 0x12 + +static void v1_set_diag(u8 state) { + if (!state) { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG)=0xFF; + } else { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG); + } +} +static void v1_set_dmz(u8 state) { + if (!state) { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ)=0xFF; + } else { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ); + } +} + +// - - - - - +#define BIT_DMZ 0x01 +#define BIT_DIAG 0x04 + +void (*set_diag)(u8 state); +void (*set_dmz)(u8 state); + +static unsigned int diag = 0; +static struct timer_list timer; + +static void diag_change() +{ + printk(KERN_INFO "led -> %02x\n",diag); + + set_diag(0xFF); // off + set_dmz(0xFF); // off + + if(diag & BIT_DIAG) + set_diag(0x00); // on + if(diag & BIT_DMZ) + set_dmz(0x00); // on +} + +static int proc_diag(ctl_table *table, int write, struct file *filp, + void *buffer, size_t *lenp) +{ + int r; + r = proc_dointvec(table, write, filp, buffer, lenp); + if (write && !r) { + diag_change(); + } + return r; +} + +// - - - - - +static struct ctl_table_header *diag_sysctl_header; + +static ctl_table sys_diag[] = { + { + ctl_name: 2000, + procname: "diag", + data: &diag, + maxlen: sizeof(diag), + mode: 0644, + proc_handler: proc_diag + }, + { 0 } +}; + +static int __init diag_init() +{ + u32 board_type; + sbh = sb_kattach(); + sb_gpiosetcore(sbh); + + board_type = sb_boardtype(sbh); + printk(KERN_INFO "diag board_type: %08x\n",board_type); + + if (board_type & 0x400) { + board_type=1; + set_diag=v1_set_diag; + set_dmz=v1_set_dmz; + } else { + board_type=2; + set_diag=v2_set_diag; + set_dmz=v2_set_dmz; + } + printk(KERN_INFO "using v%d hardware\n",board_type); + + diag_sysctl_header = register_sysctl_table(sys_diag, 0); + diag_change(); + + return 0; +} + +static void __exit diag_exit() +{ + unregister_sysctl_table(diag_sysctl_header); + del_timer(&timer); +} + +module_init(diag_init); +module_exit(diag_exit); diff --git a/obsolete-buildroot/sources/openwrt-linux-netfilter.patch b/obsolete-buildroot/sources/openwrt-linux-netfilter.patch new file mode 100644 index 0000000000..4d8b0a1f62 --- /dev/null +++ b/obsolete-buildroot/sources/openwrt-linux-netfilter.patch @@ -0,0 +1,5823 @@ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack.h 2003-08-12 07:43:11.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack.h 2004-05-09 04:13:03.000000000 -0400 +@@ -45,39 +45,27 @@ + + #include + #include +-#include + + /* per conntrack: protocol private data */ + union ip_conntrack_proto { + /* insert conntrack proto private data here */ +- struct ip_ct_gre gre; + struct ip_ct_tcp tcp; + struct ip_ct_icmp icmp; + }; + + union ip_conntrack_expect_proto { + /* insert expect proto private data here */ +- struct ip_ct_gre_expect gre; + }; + + /* Add protocol helper include file here */ +-#include +-#include +-#include +- + #include + #include +-#include + + /* per expectation: application helper private data */ + union ip_conntrack_expect_help { + /* insert conntrack helper private data (expect) here */ +- struct ip_ct_pptp_expect exp_pptp_info; +- struct ip_ct_mms_expect exp_mms_info; +- struct ip_ct_h225_expect exp_h225_info; + struct ip_ct_ftp_expect exp_ftp_info; + struct ip_ct_irc_expect exp_irc_info; +- struct ip_autofw_expect exp_autofw_info; + + #ifdef CONFIG_IP_NF_NAT_NEEDED + union { +@@ -89,21 +77,16 @@ + /* per conntrack: application helper private data */ + union ip_conntrack_help { + /* insert conntrack helper private data (master) here */ +- struct ip_ct_pptp_master ct_pptp_info; +- struct ip_ct_mms_master ct_mms_info; +- struct ip_ct_h225_master ct_h225_info; + struct ip_ct_ftp_master ct_ftp_info; + struct ip_ct_irc_master ct_irc_info; + }; + + #ifdef CONFIG_IP_NF_NAT_NEEDED + #include +-#include + + /* per conntrack: nat application helper private data */ + union ip_conntrack_nat_help { + /* insert nat helper private data here */ +- struct ip_nat_pptp nat_pptp_info; + }; + #endif + +@@ -275,9 +258,5 @@ + } + + extern unsigned int ip_conntrack_htable_size; +- +-/* connection tracking time out variables. */ +-extern int sysctl_ip_conntrack_tcp_timeouts[10]; +-extern int sysctl_ip_conntrack_udp_timeouts[2]; + #endif /* __KERNEL__ */ + #endif /* _IP_CONNTRACK_H */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_h323.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_h323.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_h323.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_h323.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,30 +0,0 @@ +-#ifndef _IP_CONNTRACK_H323_H +-#define _IP_CONNTRACK_H323_H +-/* H.323 connection tracking. */ +- +-#ifdef __KERNEL__ +-/* Protects H.323 related data */ +-DECLARE_LOCK_EXTERN(ip_h323_lock); +-#endif +- +-/* Default H.225 port */ +-#define H225_PORT 1720 +- +-/* This structure is per expected connection */ +-struct ip_ct_h225_expect { +- u_int16_t port; /* Port of the H.225 helper/RTCP/RTP channel */ +- enum ip_conntrack_dir dir; /* Direction of the original connection */ +- unsigned int offset; /* offset of the address in the payload */ +-}; +- +-/* This structure exists only once per master */ +-struct ip_ct_h225_master { +- int is_h225; /* H.225 or H.245 connection */ +-#ifdef CONFIG_IP_NF_NAT_NEEDED +- enum ip_conntrack_dir dir; /* Direction of the original connection */ +- u_int32_t seq[IP_CT_DIR_MAX]; /* Exceptional packet mangling for signal addressess... */ +- unsigned int offset[IP_CT_DIR_MAX]; /* ...and the offset of the addresses in the payload */ +-#endif +-}; +- +-#endif /* _IP_CONNTRACK_H323_H */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_mms.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_mms.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_mms.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_mms.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,31 +0,0 @@ +-#ifndef _IP_CONNTRACK_MMS_H +-#define _IP_CONNTRACK_MMS_H +-/* MMS tracking. */ +- +-#ifdef __KERNEL__ +-#include +- +-DECLARE_LOCK_EXTERN(ip_mms_lock); +- +-#define MMS_PORT 1755 +-#define MMS_SRV_MSG_ID 196610 +- +-#define MMS_SRV_MSG_OFFSET 36 +-#define MMS_SRV_UNICODE_STRING_OFFSET 60 +-#define MMS_SRV_CHUNKLENLV_OFFSET 16 +-#define MMS_SRV_CHUNKLENLM_OFFSET 32 +-#define MMS_SRV_MESSAGELENGTH_OFFSET 8 +-#endif +- +-/* This structure is per expected connection */ +-struct ip_ct_mms_expect { +- u_int32_t len; +- u_int32_t padding; +- u_int16_t port; +-}; +- +-/* This structure exists only once per master */ +-struct ip_ct_mms_master { +-}; +- +-#endif /* _IP_CONNTRACK_MMS_H */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_pptp.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_pptp.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_pptp.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_pptp.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,313 +0,0 @@ +-/* PPTP constants and structs */ +-#ifndef _CONNTRACK_PPTP_H +-#define _CONNTRACK_PPTP_H +- +-/* state of the control session */ +-enum pptp_ctrlsess_state { +- PPTP_SESSION_NONE, /* no session present */ +- PPTP_SESSION_ERROR, /* some session error */ +- PPTP_SESSION_STOPREQ, /* stop_sess request seen */ +- PPTP_SESSION_REQUESTED, /* start_sess request seen */ +- PPTP_SESSION_CONFIRMED, /* session established */ +-}; +- +-/* state of the call inside the control session */ +-enum pptp_ctrlcall_state { +- PPTP_CALL_NONE, +- PPTP_CALL_ERROR, +- PPTP_CALL_OUT_REQ, +- PPTP_CALL_OUT_CONF, +- PPTP_CALL_IN_REQ, +- PPTP_CALL_IN_REP, +- PPTP_CALL_IN_CONF, +- PPTP_CALL_CLEAR_REQ, +-}; +- +- +-/* conntrack private data */ +-struct ip_ct_pptp_master { +- enum pptp_ctrlsess_state sstate; /* session state */ +- +- /* everything below is going to be per-expectation in newnat, +- * since there could be more than one call within one session */ +- enum pptp_ctrlcall_state cstate; /* call state */ +- u_int16_t pac_call_id; /* call id of PAC, host byte order */ +- u_int16_t pns_call_id; /* call id of PNS, host byte order */ +-}; +- +-/* conntrack_expect private member */ +-struct ip_ct_pptp_expect { +- enum pptp_ctrlcall_state cstate; /* call state */ +- u_int16_t pac_call_id; /* call id of PAC */ +- u_int16_t pns_call_id; /* call id of PNS */ +-}; +- +- +-#ifdef __KERNEL__ +- +-#include +-DECLARE_LOCK_EXTERN(ip_pptp_lock); +- +-#define IP_CONNTR_PPTP PPTP_CONTROL_PORT +- +-union pptp_ctrl_union { +- void *rawreq; +- struct PptpStartSessionRequest *sreq; +- struct PptpStartSessionReply *srep; +- struct PptpStopSessionReqest *streq; +- struct PptpStopSessionReply *strep; +- struct PptpOutCallRequest *ocreq; +- struct PptpOutCallReply *ocack; +- struct PptpInCallRequest *icreq; +- struct PptpInCallReply *icack; +- struct PptpInCallConnected *iccon; +- struct PptpClearCallRequest *clrreq; +- struct PptpCallDisconnectNotify *disc; +- struct PptpWanErrorNotify *wanerr; +- struct PptpSetLinkInfo *setlink; +-}; +- +- +- +-#define PPTP_CONTROL_PORT 1723 +- +-#define PPTP_PACKET_CONTROL 1 +-#define PPTP_PACKET_MGMT 2 +- +-#define PPTP_MAGIC_COOKIE 0x1a2b3c4d +- +-struct pptp_pkt_hdr { +- __u16 packetLength; +- __u16 packetType; +- __u32 magicCookie; +-}; +- +-/* PptpControlMessageType values */ +-#define PPTP_START_SESSION_REQUEST 1 +-#define PPTP_START_SESSION_REPLY 2 +-#define PPTP_STOP_SESSION_REQUEST 3 +-#define PPTP_STOP_SESSION_REPLY 4 +-#define PPTP_ECHO_REQUEST 5 +-#define PPTP_ECHO_REPLY 6 +-#define PPTP_OUT_CALL_REQUEST 7 +-#define PPTP_OUT_CALL_REPLY 8 +-#define PPTP_IN_CALL_REQUEST 9 +-#define PPTP_IN_CALL_REPLY 10 +-#define PPTP_IN_CALL_CONNECT 11 +-#define PPTP_CALL_CLEAR_REQUEST 12 +-#define PPTP_CALL_DISCONNECT_NOTIFY 13 +-#define PPTP_WAN_ERROR_NOTIFY 14 +-#define PPTP_SET_LINK_INFO 15 +- +-#define PPTP_MSG_MAX 15 +- +-/* PptpGeneralError values */ +-#define PPTP_ERROR_CODE_NONE 0 +-#define PPTP_NOT_CONNECTED 1 +-#define PPTP_BAD_FORMAT 2 +-#define PPTP_BAD_VALUE 3 +-#define PPTP_NO_RESOURCE 4 +-#define PPTP_BAD_CALLID 5 +-#define PPTP_REMOVE_DEVICE_ERROR 6 +- +-struct PptpControlHeader { +- __u16 messageType; +- __u16 reserved; +-}; +- +-/* FramingCapability Bitmap Values */ +-#define PPTP_FRAME_CAP_ASYNC 0x1 +-#define PPTP_FRAME_CAP_SYNC 0x2 +- +-/* BearerCapability Bitmap Values */ +-#define PPTP_BEARER_CAP_ANALOG 0x1 +-#define PPTP_BEARER_CAP_DIGITAL 0x2 +- +-struct PptpStartSessionRequest { +- __u16 protocolVersion; +- __u8 reserved1; +- __u8 reserved2; +- __u32 framingCapability; +- __u32 bearerCapability; +- __u16 maxChannels; +- __u16 firmwareRevision; +- __u8 hostName[64]; +- __u8 vendorString[64]; +-}; +- +-/* PptpStartSessionResultCode Values */ +-#define PPTP_START_OK 1 +-#define PPTP_START_GENERAL_ERROR 2 +-#define PPTP_START_ALREADY_CONNECTED 3 +-#define PPTP_START_NOT_AUTHORIZED 4 +-#define PPTP_START_UNKNOWN_PROTOCOL 5 +- +-struct PptpStartSessionReply { +- __u16 protocolVersion; +- __u8 resultCode; +- __u8 generalErrorCode; +- __u32 framingCapability; +- __u32 bearerCapability; +- __u16 maxChannels; +- __u16 firmwareRevision; +- __u8 hostName[64]; +- __u8 vendorString[64]; +-}; +- +-/* PptpStopReasons */ +-#define PPTP_STOP_NONE 1 +-#define PPTP_STOP_PROTOCOL 2 +-#define PPTP_STOP_LOCAL_SHUTDOWN 3 +- +-struct PptpStopSessionRequest { +- __u8 reason; +-}; +- +-/* PptpStopSessionResultCode */ +-#define PPTP_STOP_OK 1 +-#define PPTP_STOP_GENERAL_ERROR 2 +- +-struct PptpStopSessionReply { +- __u8 resultCode; +- __u8 generalErrorCode; +-}; +- +-struct PptpEchoRequest { +- __u32 identNumber; +-}; +- +-/* PptpEchoReplyResultCode */ +-#define PPTP_ECHO_OK 1 +-#define PPTP_ECHO_GENERAL_ERROR 2 +- +-struct PptpEchoReply { +- __u32 identNumber; +- __u8 resultCode; +- __u8 generalErrorCode; +- __u16 reserved; +-}; +- +-/* PptpFramingType */ +-#define PPTP_ASYNC_FRAMING 1 +-#define PPTP_SYNC_FRAMING 2 +-#define PPTP_DONT_CARE_FRAMING 3 +- +-/* PptpCallBearerType */ +-#define PPTP_ANALOG_TYPE 1 +-#define PPTP_DIGITAL_TYPE 2 +-#define PPTP_DONT_CARE_BEARER_TYPE 3 +- +-struct PptpOutCallRequest { +- __u16 callID; +- __u16 callSerialNumber; +- __u32 minBPS; +- __u32 maxBPS; +- __u32 bearerType; +- __u32 framingType; +- __u16 packetWindow; +- __u16 packetProcDelay; +- __u16 reserved1; +- __u16 phoneNumberLength; +- __u16 reserved2; +- __u8 phoneNumber[64]; +- __u8 subAddress[64]; +-}; +- +-/* PptpCallResultCode */ +-#define PPTP_OUTCALL_CONNECT 1 +-#define PPTP_OUTCALL_GENERAL_ERROR 2 +-#define PPTP_OUTCALL_NO_CARRIER 3 +-#define PPTP_OUTCALL_BUSY 4 +-#define PPTP_OUTCALL_NO_DIAL_TONE 5 +-#define PPTP_OUTCALL_TIMEOUT 6 +-#define PPTP_OUTCALL_DONT_ACCEPT 7 +- +-struct PptpOutCallReply { +- __u16 callID; +- __u16 peersCallID; +- __u8 resultCode; +- __u8 generalErrorCode; +- __u16 causeCode; +- __u32 connectSpeed; +- __u16 packetWindow; +- __u16 packetProcDelay; +- __u32 physChannelID; +-}; +- +-struct PptpInCallRequest { +- __u16 callID; +- __u16 callSerialNumber; +- __u32 callBearerType; +- __u32 physChannelID; +- __u16 dialedNumberLength; +- __u16 dialingNumberLength; +- __u8 dialedNumber[64]; +- __u8 dialingNumber[64]; +- __u8 subAddress[64]; +-}; +- +-/* PptpInCallResultCode */ +-#define PPTP_INCALL_ACCEPT 1 +-#define PPTP_INCALL_GENERAL_ERROR 2 +-#define PPTP_INCALL_DONT_ACCEPT 3 +- +-struct PptpInCallReply { +- __u16 callID; +- __u16 peersCallID; +- __u8 resultCode; +- __u8 generalErrorCode; +- __u16 packetWindow; +- __u16 packetProcDelay; +- __u16 reserved; +-}; +- +-struct PptpInCallConnected { +- __u16 peersCallID; +- __u16 reserved; +- __u32 connectSpeed; +- __u16 packetWindow; +- __u16 packetProcDelay; +- __u32 callFramingType; +-}; +- +-struct PptpClearCallRequest { +- __u16 callID; +- __u16 reserved; +-}; +- +-struct PptpCallDisconnectNotify { +- __u16 callID; +- __u8 resultCode; +- __u8 generalErrorCode; +- __u16 causeCode; +- __u16 reserved; +- __u8 callStatistics[128]; +-}; +- +-struct PptpWanErrorNotify { +- __u16 peersCallID; +- __u16 reserved; +- __u32 crcErrors; +- __u32 framingErrors; +- __u32 hardwareOverRuns; +- __u32 bufferOverRuns; +- __u32 timeoutErrors; +- __u32 alignmentErrors; +-}; +- +-struct PptpSetLinkInfo { +- __u16 peersCallID; +- __u16 reserved; +- __u32 sendAccm; +- __u32 recvAccm; +-}; +- +- +-struct pptp_priv_data { +- __u16 call_id; +- __u16 mcall_id; +- __u16 pcall_id; +-}; +- +-#endif /* __KERNEL__ */ +-#endif /* _CONNTRACK_PPTP_H */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,121 +0,0 @@ +-#ifndef _CONNTRACK_PROTO_GRE_H +-#define _CONNTRACK_PROTO_GRE_H +-#include +- +-/* GRE PROTOCOL HEADER */ +- +-/* GRE Version field */ +-#define GRE_VERSION_1701 0x0 +-#define GRE_VERSION_PPTP 0x1 +- +-/* GRE Protocol field */ +-#define GRE_PROTOCOL_PPTP 0x880B +- +-/* GRE Flags */ +-#define GRE_FLAG_C 0x80 +-#define GRE_FLAG_R 0x40 +-#define GRE_FLAG_K 0x20 +-#define GRE_FLAG_S 0x10 +-#define GRE_FLAG_A 0x80 +- +-#define GRE_IS_C(f) ((f)&GRE_FLAG_C) +-#define GRE_IS_R(f) ((f)&GRE_FLAG_R) +-#define GRE_IS_K(f) ((f)&GRE_FLAG_K) +-#define GRE_IS_S(f) ((f)&GRE_FLAG_S) +-#define GRE_IS_A(f) ((f)&GRE_FLAG_A) +- +-/* GRE is a mess: Four different standards */ +-struct gre_hdr { +-#if defined(__LITTLE_ENDIAN_BITFIELD) +- __u16 rec:3, +- srr:1, +- seq:1, +- key:1, +- routing:1, +- csum:1, +- version:3, +- reserved:4, +- ack:1; +-#elif defined(__BIG_ENDIAN_BITFIELD) +- __u16 csum:1, +- routing:1, +- key:1, +- seq:1, +- srr:1, +- rec:3, +- ack:1, +- reserved:4, +- version:3; +-#else +-#error "Adjust your defines" +-#endif +- __u16 protocol; +-}; +- +-/* modified GRE header for PPTP */ +-struct gre_hdr_pptp { +- __u8 flags; /* bitfield */ +- __u8 version; /* should be GRE_VERSION_PPTP */ +- __u16 protocol; /* should be GRE_PROTOCOL_PPTP */ +- __u16 payload_len; /* size of ppp payload, not inc. gre header */ +- __u16 call_id; /* peer's call_id for this session */ +- __u32 seq; /* sequence number. Present if S==1 */ +- __u32 ack; /* seq number of highest packet recieved by */ +- /* sender in this session */ +-}; +- +- +-/* this is part of ip_conntrack */ +-struct ip_ct_gre { +- unsigned int stream_timeout; +- unsigned int timeout; +-}; +- +-/* this is part of ip_conntrack_expect */ +-struct ip_ct_gre_expect { +- struct ip_ct_gre_keymap *keymap_orig, *keymap_reply; +-}; +- +-#ifdef __KERNEL__ +- +-/* structure for original <-> reply keymap */ +-struct ip_ct_gre_keymap { +- struct list_head list; +- +- struct ip_conntrack_tuple tuple; +- struct ip_conntrack_expect *master; +-}; +- +- +-/* add new tuple->key_reply pair to keymap */ +-int ip_ct_gre_keymap_add(struct ip_conntrack_expect *exp, +- struct ip_conntrack_tuple *t, +- int reply); +- +-/* change an existing keymap entry */ +-void ip_ct_gre_keymap_change(struct ip_ct_gre_keymap *km, +- struct ip_conntrack_tuple *t); +- +- +- +-/* get pointer to gre key, if present */ +-static inline u_int32_t *gre_key(struct gre_hdr *greh) +-{ +- if (!greh->key) +- return NULL; +- if (greh->csum || greh->routing) +- return (u_int32_t *) (greh+sizeof(*greh)+4); +- return (u_int32_t *) (greh+sizeof(*greh)); +-} +- +-/* get pointer ot gre csum, if present */ +-static inline u_int16_t *gre_csum(struct gre_hdr *greh) +-{ +- if (!greh->csum) +- return NULL; +- return (u_int16_t *) (greh+sizeof(*greh)); +-} +- +-#endif /* __KERNEL__ */ +- +-#endif /* _CONNTRACK_PROTO_GRE_H */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tftp.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_tftp.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tftp.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_tftp.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,13 +0,0 @@ +-#ifndef _IP_CT_TFTP +-#define _IP_CT_TFTP +- +-#define TFTP_PORT 69 +- +-struct tftphdr { +- u_int16_t opcode; +-}; +- +-#define TFTP_OPCODE_READ 1 +-#define TFTP_OPCODE_WRITE 2 +- +-#endif /* _IP_CT_TFTP */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tuple.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tuple.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_conntrack_tuple.h 2004-05-09 04:13:03.000000000 -0400 +@@ -14,7 +14,7 @@ + union ip_conntrack_manip_proto + { + /* Add other protocols here. */ +- u_int32_t all; ++ u_int16_t all; + + struct { + u_int16_t port; +@@ -25,9 +25,6 @@ + struct { + u_int16_t id; + } icmp; +- struct { +- u_int32_t key; +- } gre; + }; + + /* The manipulable part of the tuple. */ +@@ -47,7 +44,7 @@ + u_int32_t ip; + union { + /* Add other protocols here. */ +- u_int64_t all; ++ u_int16_t all; + + struct { + u_int16_t port; +@@ -58,11 +55,6 @@ + struct { + u_int8_t type, code; + } icmp; +- struct { +- u_int16_t protocol; +- u_int8_t version; +- u_int32_t key; +- } gre; + } u; + + /* The protocol. */ +@@ -80,16 +72,10 @@ + #ifdef __KERNEL__ + + #define DUMP_TUPLE(tp) \ +-DEBUGP("tuple %p: %u %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n", \ ++DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \ + (tp), (tp)->dst.protonum, \ +- NIPQUAD((tp)->src.ip), ntohl((tp)->src.u.all), \ +- NIPQUAD((tp)->dst.ip), ntohl((tp)->dst.u.all)) +- +-#define DUMP_TUPLE_RAW(x) \ +- DEBUGP("tuple %p: %u %u.%u.%u.%u:0x%08x -> %u.%u.%u.%u:0x%08x\n",\ +- (x), (x)->dst.protonum, \ +- NIPQUAD((x)->src.ip), ntohl((x)->src.u.all), \ +- NIPQUAD((x)->dst.ip), ntohl((x)->dst.u.all)) ++ NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \ ++ NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all)) + + #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) + +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_nat_pptp.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_nat_pptp.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_nat_pptp.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_nat_pptp.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,11 +0,0 @@ +-/* PPTP constants and structs */ +-#ifndef _NAT_PPTP_H +-#define _NAT_PPTP_H +- +-/* conntrack private data */ +-struct ip_nat_pptp { +- u_int16_t pns_call_id; /* NAT'ed PNS call id */ +- u_int16_t pac_call_id; /* NAT'ed PAC call id */ +-}; +- +-#endif /* _NAT_PPTP_H */ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ip_pool.h src/linux/linux.stock/include/linux/netfilter_ipv4/ip_pool.h +--- src/linux/linux/include/linux/netfilter_ipv4/ip_pool.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ip_pool.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,64 +0,0 @@ +-#ifndef _IP_POOL_H +-#define _IP_POOL_H +- +-/***************************************************************************/ +-/* 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*/ +-/***************************************************************************/ +- +-/* A sockopt of such quality has hardly ever been seen before on the open +- * market! This little beauty, hardly ever used: above 64, so it's +- * traditionally used for firewalling, not touched (even once!) by the +- * 2.0, 2.2 and 2.4 kernels! +- * +- * Comes with its own certificate of authenticity, valid anywhere in the +- * Free world! +- * +- * Rusty, 19.4.2000 +- */ +-#define SO_IP_POOL 81 +- +-typedef int ip_pool_t; /* pool index */ +-#define IP_POOL_NONE ((ip_pool_t)-1) +- +-struct ip_pool_request { +- int op; +- ip_pool_t index; +- u_int32_t addr; +- u_int32_t addr2; +-}; +- +-/* NOTE: I deliberately break the first cut ippool utility. Nobody uses it. */ +- +-#define IP_POOL_BAD001 0x00000010 +- +-#define IP_POOL_FLUSH 0x00000011 /* req.index, no arguments */ +-#define IP_POOL_INIT 0x00000012 /* from addr to addr2 incl. */ +-#define IP_POOL_DESTROY 0x00000013 /* req.index, no arguments */ +-#define IP_POOL_ADD_ADDR 0x00000014 /* add addr to pool */ +-#define IP_POOL_DEL_ADDR 0x00000015 /* del addr from pool */ +-#define IP_POOL_HIGH_NR 0x00000016 /* result in req.index */ +-#define IP_POOL_LOOKUP 0x00000017 /* result in addr and addr2 */ +-#define IP_POOL_USAGE 0x00000018 /* result in addr */ +-#define IP_POOL_TEST_ADDR 0x00000019 /* result (0/1) returned */ +- +-#ifdef __KERNEL__ +- +-/* NOTE: ip_pool_match() and ip_pool_mod() expect ADDR to be host byte order */ +-extern int ip_pool_match(ip_pool_t pool, u_int32_t addr); +-extern int ip_pool_mod(ip_pool_t pool, u_int32_t addr, int isdel); +- +-#endif +- +-#endif /*_IP_POOL_H*/ +diff -Nurb src/linux/linux/include/linux/netfilter_ipv4/ipt_pool.h src/linux/linux.stock/include/linux/netfilter_ipv4/ipt_pool.h +--- src/linux/linux/include/linux/netfilter_ipv4/ipt_pool.h 2003-07-04 04:12:27.000000000 -0400 ++++ src/linux/linux.stock/include/linux/netfilter_ipv4/ipt_pool.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,25 +0,0 @@ +-#ifndef _IPT_POOL_H +-#define _IPT_POOL_H +- +-#include +- +-#define IPT_POOL_INV_SRC 0x00000001 +-#define IPT_POOL_INV_DST 0x00000002 +-#define IPT_POOL_DEL_SRC 0x00000004 +-#define IPT_POOL_DEL_DST 0x00000008 +-#define IPT_POOL_INV_MOD_SRC 0x00000010 +-#define IPT_POOL_INV_MOD_DST 0x00000020 +-#define IPT_POOL_MOD_SRC_ACCEPT 0x00000040 +-#define IPT_POOL_MOD_DST_ACCEPT 0x00000080 +-#define IPT_POOL_MOD_SRC_DROP 0x00000100 +-#define IPT_POOL_MOD_DST_DROP 0x00000200 +- +-/* match info */ +-struct ipt_pool_info +-{ +- ip_pool_t src; +- ip_pool_t dst; +- unsigned flags; +-}; +- +-#endif /*_IPT_POOL_H*/ +diff -Nurb src/linux/linux/net/ipv4/netfilter/Config.in src/linux/linux.stock/net/ipv4/netfilter/Config.in +--- src/linux/linux/net/ipv4/netfilter/Config.in 2004-02-19 06:04:35.000000000 -0500 ++++ src/linux/linux.stock/net/ipv4/netfilter/Config.in 2004-05-09 04:13:03.000000000 -0400 +@@ -7,12 +7,7 @@ + tristate 'Connection tracking (required for masq/NAT)' CONFIG_IP_NF_CONNTRACK + if [ "$CONFIG_IP_NF_CONNTRACK" != "n" ]; then + dep_tristate ' FTP protocol support' CONFIG_IP_NF_FTP $CONFIG_IP_NF_CONNTRACK +- dep_tristate ' TFTP protocol support' CONFIG_IP_NF_TFTP $CONFIG_IP_NF_CONNTRACK +- dep_tristate ' H.323 (netmeeting) support' CONFIG_IP_NF_H323 $CONFIG_IP_NF_CONNTRACK + dep_tristate ' IRC protocol support' CONFIG_IP_NF_IRC $CONFIG_IP_NF_CONNTRACK +- dep_tristate ' MMS protocol support' CONFIG_IP_NF_MMS $CONFIG_IP_NF_CONNTRACK +- dep_tristate ' GRE protocol support' CONFIG_IP_NF_CT_PROTO_GRE $CONFIG_IP_NF_CONNTRACK +- dep_tristate ' PPTP protocol support' CONFIG_IP_NF_PPTP $CONFIG_IP_NF_CT_PROTO_GRE + fi + + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then +@@ -22,19 +17,11 @@ + if [ "$CONFIG_IP_NF_IPTABLES" != "n" ]; then + # The simple matches. + dep_tristate ' limit match support' CONFIG_IP_NF_MATCH_LIMIT $CONFIG_IP_NF_IPTABLES +- +- dep_tristate ' IP address pool support' CONFIG_IP_NF_POOL $CONFIG_IP_NF_IPTABLES +- if [ "$CONFIG_IP_NF_POOL" = "y" -o "$CONFIG_IP_NF_POOL" = "m" ]; then +- bool ' enable statistics on pool usage' CONFIG_IP_POOL_STATISTICS n +- fi +- + dep_tristate ' MAC address match support' CONFIG_IP_NF_MATCH_MAC $CONFIG_IP_NF_IPTABLES + dep_tristate ' Packet type match support' CONFIG_IP_NF_MATCH_PKTTYPE $CONFIG_IP_NF_IPTABLES + dep_tristate ' netfilter MARK match support' CONFIG_IP_NF_MATCH_MARK $CONFIG_IP_NF_IPTABLES + dep_tristate ' Multiple port match support' CONFIG_IP_NF_MATCH_MULTIPORT $CONFIG_IP_NF_IPTABLES +- dep_tristate ' Multiple port with ranges match support' CONFIG_IP_NF_MATCH_MPORT $CONFIG_IP_NF_IPTABLES + dep_tristate ' TOS match support' CONFIG_IP_NF_MATCH_TOS $CONFIG_IP_NF_IPTABLES +- dep_tristate ' TIME match support (EXPERIMENTAL)' CONFIG_IP_NF_MATCH_TIME $CONFIG_IP_NF_IPTABLES + dep_tristate ' ECN match support' CONFIG_IP_NF_MATCH_ECN $CONFIG_IP_NF_IPTABLES + + dep_tristate ' DSCP match support' CONFIG_IP_NF_MATCH_DSCP $CONFIG_IP_NF_IPTABLES +@@ -52,7 +39,6 @@ + fi + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' Unclean match support (EXPERIMENTAL)' CONFIG_IP_NF_MATCH_UNCLEAN $CONFIG_IP_NF_IPTABLES +- dep_tristate ' Webstr match support (EXPERIMENTAL)' CONFIG_IP_NF_MATCH_WEBSTR $CONFIG_IP_NF_IPTABLES + dep_tristate ' Owner match support (EXPERIMENTAL)' CONFIG_IP_NF_MATCH_OWNER $CONFIG_IP_NF_IPTABLES + fi + # The targets +@@ -70,29 +56,6 @@ + define_bool CONFIG_IP_NF_NAT_NEEDED y + dep_tristate ' MASQUERADE target support' CONFIG_IP_NF_TARGET_MASQUERADE $CONFIG_IP_NF_NAT + dep_tristate ' REDIRECT target support' CONFIG_IP_NF_TARGET_REDIRECT $CONFIG_IP_NF_NAT +- dep_tristate ' Automatic port forwarding (autofw) target support' CONFIG_IP_NF_AUTOFW $CONFIG_IP_NF_NAT +- dep_tristate ' TRIGGER target support (port-trigger)' CONFIG_IP_NF_TARGET_TRIGGER $CONFIG_IP_NF_NAT +- if [ "$CONFIG_IP_NF_H323" = "m" ]; then +- define_tristate CONFIG_IP_NF_NAT_H323 m +- else +- if [ "$CONFIG_IP_NF_H323" = "y" ]; then +- define_tristate CONFIG_IP_NF_NAT_H323 $CONFIG_IP_NF_NAT +- fi +- fi +- if [ "$CONFIG_IP_NF_PPTP" = "m" ]; then +- define_tristate CONFIG_IP_NF_NAT_PPTP m +- else +- if [ "$CONFIG_IP_NF_PPTP" = "y" ]; then +- define_tristate CONFIG_IP_NF_NAT_PPTP $CONFIG_IP_NF_NAT +- fi +- fi +- if [ "$CONFIG_IP_NF_CT_PROTO_GRE" = "m" ]; then +- define_tristate CONFIG_IP_NF_NAT_PROTO_GRE m +- else +- if [ "$CONFIG_IP_NF_CT_PROTO_GRE" = "y" ]; then +- define_tristate CONFIG_IP_NF_NAT_PROTO_GRE $CONFIG_IP_NF_NAT +- fi +- fi + bool ' NAT of local connections (READ HELP)' CONFIG_IP_NF_NAT_LOCAL + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' Basic SNMP-ALG support (EXPERIMENTAL)' CONFIG_IP_NF_NAT_SNMP_BASIC $CONFIG_IP_NF_NAT +@@ -104,13 +67,6 @@ + define_tristate CONFIG_IP_NF_NAT_IRC $CONFIG_IP_NF_NAT + fi + fi +- if [ "$CONFIG_IP_NF_MMS" = "m" ]; then +- define_tristate CONFIG_IP_NF_NAT_MMS m +- else +- if [ "$CONFIG_IP_NF_MMS" = "y" ]; then +- define_tristate CONFIG_IP_NF_NAT_MMS $CONFIG_IP_NF_NAT +- fi +- fi + # If they want FTP, set to $CONFIG_IP_NF_NAT (m or y), + # or $CONFIG_IP_NF_FTP (m or y), whichever is weaker. Argh. + if [ "$CONFIG_IP_NF_FTP" = "m" ]; then +@@ -120,13 +76,6 @@ + define_tristate CONFIG_IP_NF_NAT_FTP $CONFIG_IP_NF_NAT + fi + fi +- if [ "$CONFIG_IP_NF_TFTP" = "m" ]; then +- define_tristate CONFIG_IP_NF_NAT_TFTP m +- else +- if [ "$CONFIG_IP_NF_TFTP" = "y" ]; then +- define_tristate CONFIG_IP_NF_NAT_TFTP $CONFIG_IP_NF_NAT +- fi +- fi + fi + fi + +diff -Nurb src/linux/linux/net/ipv4/netfilter/Makefile src/linux/linux.stock/net/ipv4/netfilter/Makefile +--- src/linux/linux/net/ipv4/netfilter/Makefile 2004-02-19 06:04:35.000000000 -0500 ++++ src/linux/linux.stock/net/ipv4/netfilter/Makefile 2004-05-09 04:13:03.000000000 -0400 +@@ -31,48 +31,20 @@ + # connection tracking + obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o + +-# H.323 support +-obj-$(CONFIG_IP_NF_H323) += ip_conntrack_h323.o +-obj-$(CONFIG_IP_NF_NAT_H323) += ip_nat_h323.o +-ifdef CONFIG_IP_NF_NAT_H323 +- export-objs += ip_conntrack_h323.o +-endif +- +- +-# connection tracking protocol helpers +-obj-$(CONFIG_IP_NF_CT_PROTO_GRE) += ip_conntrack_proto_gre.o +-ifdef CONFIG_IP_NF_CT_PROTO_GRE +- export-objs += ip_conntrack_proto_gre.o +-endif +- +-# NAT protocol helpers +-obj-$(CONFIG_IP_NF_NAT_PROTO_GRE) += ip_nat_proto_gre.o +- + # connection tracking helpers +-obj-$(CONFIG_IP_NF_MMS) += ip_conntrack_mms.o +-ifdef CONFIG_IP_NF_NAT_MMS +- export-objs += ip_conntrack_mms.o +-endif +-obj-$(CONFIG_IP_NF_PPTP) += ip_conntrack_pptp.o +-ifdef CONFIG_IP_NF_NAT_PPTP +- export-objs += ip_conntrack_pptp.o +-endif +-obj-$(CONFIG_IP_NF_TFTP) += ip_conntrack_tftp.o + obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o + ifdef CONFIG_IP_NF_NAT_FTP + export-objs += ip_conntrack_ftp.o + endif ++ + obj-$(CONFIG_IP_NF_IRC) += ip_conntrack_irc.o + ifdef CONFIG_IP_NF_NAT_IRC + export-objs += ip_conntrack_irc.o + endif + + # NAT helpers +-obj-$(CONFIG_IP_NF_NAT_PPTP) += ip_nat_pptp.o +-obj-$(CONFIG_IP_NF_NAT_TFTP) += ip_nat_tftp.o + obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o + obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o +-obj-$(CONFIG_IP_NF_NAT_MMS) += ip_nat_mms.o + + # generic IP tables + obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o +@@ -86,19 +58,12 @@ + obj-$(CONFIG_IP_NF_MATCH_HELPER) += ipt_helper.o + obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o + obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o +-obj-$(CONFIG_IP_NF_POOL) += ipt_pool.o ip_pool.o + obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o + + obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o + obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o +- +-obj-$(CONFIG_IP_NF_MATCH_MPORT) += ipt_mport.o +- + obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o + obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o +- +-obj-$(CONFIG_IP_NF_MATCH_TIME) += ipt_time.o +- + obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o + obj-$(CONFIG_IP_NF_MATCH_DSCP) += ipt_dscp.o + obj-$(CONFIG_IP_NF_MATCH_AH_ESP) += ipt_ah.o ipt_esp.o +@@ -109,7 +74,6 @@ + obj-$(CONFIG_IP_NF_MATCH_STATE) += ipt_state.o + obj-$(CONFIG_IP_NF_MATCH_CONNTRACK) += ipt_conntrack.o + obj-$(CONFIG_IP_NF_MATCH_UNCLEAN) += ipt_unclean.o +-obj-$(CONFIG_IP_NF_MATCH_WEBSTR) += ipt_webstr.o + obj-$(CONFIG_IP_NF_MATCH_TCPMSS) += ipt_tcpmss.o + + # targets +@@ -125,8 +89,6 @@ + obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o + obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o + obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o +-obj-$(CONFIG_IP_NF_AUTOFW) += ip_autofw.o +-obj-$(CONFIG_IP_NF_TARGET_TRIGGER) += ipt_TRIGGER.o + + # generic ARP tables + obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_core.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_core.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_core.c 2003-08-12 07:33:45.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_core.c 2004-05-09 04:13:03.000000000 -0400 +@@ -47,7 +47,11 @@ + + #define IP_CONNTRACK_VERSION "2.1" + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + DECLARE_RWLOCK(ip_conntrack_lock); + DECLARE_RWLOCK(ip_conntrack_expect_tuple_lock); +@@ -62,29 +66,6 @@ + struct list_head *ip_conntrack_hash; + static kmem_cache_t *ip_conntrack_cachep; + +-#define SECS * HZ +-#define MINS * 60 SECS +-#define HOURS * 60 MINS +-#define DAYS * 24 HOURS +- +-int sysctl_ip_conntrack_tcp_timeouts[10] = { +- 30 MINS, /* TCP_CONNTRACK_NONE, */ +- 5 DAYS, /* TCP_CONNTRACK_ESTABLISHED, */ +- 2 MINS, /* TCP_CONNTRACK_SYN_SENT, */ +- 60 SECS, /* TCP_CONNTRACK_SYN_RECV, */ +- 2 MINS, /* TCP_CONNTRACK_FIN_WAIT, */ +- 2 MINS, /* TCP_CONNTRACK_TIME_WAIT, */ +- 10 SECS, /* TCP_CONNTRACK_CLOSE, */ +- 60 SECS, /* TCP_CONNTRACK_CLOSE_WAIT, */ +- 30 SECS, /* TCP_CONNTRACK_LAST_ACK, */ +- 2 MINS, /* TCP_CONNTRACK_LISTEN, */ +-}; +- +-int sysctl_ip_conntrack_udp_timeouts[2] = { +- 30 SECS, /* UNREPLIED */ +- 180 SECS /* ASSURED */ +-}; +- + extern struct ip_conntrack_protocol ip_conntrack_generic_protocol; + + static inline int proto_cmpfn(const struct ip_conntrack_protocol *curr, +@@ -129,6 +110,9 @@ + static inline u_int32_t + hash_conntrack(const struct ip_conntrack_tuple *tuple) + { ++#if 0 ++ dump_tuple(tuple); ++#endif + /* ntohl because more differences in low bits. */ + /* To ensure that halves of the same connection don't hash + clash, we add the source per-proto again. */ +@@ -160,8 +144,6 @@ + tuple->dst.ip = iph->daddr; + tuple->dst.protonum = iph->protocol; + +- tuple->src.u.all = tuple->dst.u.all = 0; +- + ret = protocol->pkt_to_tuple((u_int32_t *)iph + iph->ihl, + len - 4*iph->ihl, + tuple); +@@ -177,8 +159,6 @@ + inverse->dst.ip = orig->src.ip; + inverse->dst.protonum = orig->dst.protonum; + +- inverse->src.u.all = inverse->dst.u.all = 0; +- + return protocol->invert_tuple(inverse, orig); + } + +@@ -196,8 +176,8 @@ + static void + destroy_expect(struct ip_conntrack_expect *exp) + { +- DEBUGP("destroy_expect(%p) use=%d\n", exp, atomic_read(&exp->use)); +- IP_NF_ASSERT(atomic_read(&exp->use)); ++ DEBUGP("destroy_expect(%p) use=%d\n", exp, atomic_read(exp->use)); ++ IP_NF_ASSERT(atomic_read(exp->use)); + IP_NF_ASSERT(!timer_pending(&exp->timeout)); + + kfree(exp); +@@ -267,11 +247,11 @@ + static void unexpect_related(struct ip_conntrack_expect *expect) + { + IP_NF_ASSERT(expect->expectant); ++ IP_NF_ASSERT(expect->expectant->helper); + /* if we are supposed to have a timer, but we can't delete + * it: race condition. __unexpect_related will + * be calledd by timeout function */ +- if (expect->expectant->helper +- && expect->expectant->helper->timeout ++ if (expect->expectant->helper->timeout + && !del_timer(&expect->timeout)) + return; + +@@ -580,6 +560,7 @@ + if (!h) { + /* Locally generated ICMPs will match inverted if they + haven't been SNAT'ed yet */ ++ /* FIXME: NAT code has to handle half-done double NAT --RR */ + if (hooknum == NF_IP_LOCAL_OUT) + h = ip_conntrack_find_get(&origtuple, NULL); + +@@ -725,7 +706,6 @@ + + /* If the expectation is dying, then this is a looser. */ + if (expected +- && expected->expectant->helper + && expected->expectant->helper->timeout + && ! del_timer(&expected->timeout)) + expected = NULL; +@@ -744,7 +724,6 @@ + conntrack->master = expected; + expected->sibling = conntrack; + LIST_DELETE(&ip_conntrack_expect_list, expected); +- INIT_LIST_HEAD(&expected->list); + expected->expectant->expecting--; + nf_conntrack_get(&master_ct(conntrack)->infos[0]); + } +@@ -821,9 +800,23 @@ + int set_reply; + int ret; + ++ /* FIXME: Do this right please. --RR */ + (*pskb)->nfcache |= NFC_UNKNOWN; + + /* Doesn't cover locally-generated broadcast, so not worth it. */ ++#if 0 ++ /* Ignore broadcast: no `connection'. */ ++ if ((*pskb)->pkt_type == PACKET_BROADCAST) { ++ printk("Broadcast packet!\n"); ++ return NF_ACCEPT; ++ } else if (((*pskb)->nh.iph->daddr & htonl(0x000000FF)) ++ == htonl(0x000000FF)) { ++ printk("Should bcast: %u.%u.%u.%u->%u.%u.%u.%u (sk=%p, ptype=%u)\n", ++ NIPQUAD((*pskb)->nh.iph->saddr), ++ NIPQUAD((*pskb)->nh.iph->daddr), ++ (*pskb)->sk, (*pskb)->pkt_type); ++ } ++#endif + + /* Previously seen (loopback)? Ignore. Do this before + fragment check. */ +@@ -943,8 +936,8 @@ + * so there is no need to use the tuple lock too */ + + DEBUGP("ip_conntrack_expect_related %p\n", related_to); +- DEBUGP("tuple: "); DUMP_TUPLE_RAW(&expect->tuple); +- DEBUGP("mask: "); DUMP_TUPLE_RAW(&expect->mask); ++ DEBUGP("tuple: "); DUMP_TUPLE(&expect->tuple); ++ DEBUGP("mask: "); DUMP_TUPLE(&expect->mask); + + old = LIST_FIND(&ip_conntrack_expect_list, resent_expect, + struct ip_conntrack_expect *, &expect->tuple, +@@ -954,8 +947,7 @@ + pointing into the payload - otherwise we should have to copy + the data filled out by the helper over the old one */ + DEBUGP("expect_related: resent packet\n"); +- if (related_to->helper && +- related_to->helper->timeout) { ++ if (related_to->helper->timeout) { + if (!del_timer(&old->timeout)) { + /* expectation is dying. Fall through */ + old = NULL; +@@ -970,32 +962,26 @@ + WRITE_UNLOCK(&ip_conntrack_lock); + return -EEXIST; + } +- } else if (related_to->helper && +- related_to->helper->max_expected && ++ } else if (related_to->helper->max_expected && + related_to->expecting >= related_to->helper->max_expected) { + struct list_head *cur_item; + /* old == NULL */ +- if (!(related_to->helper->flags & +- IP_CT_HELPER_F_REUSE_EXPECT)) { +- WRITE_UNLOCK(&ip_conntrack_lock); + if (net_ratelimit()) + printk(KERN_WARNING + "ip_conntrack: max number of expected " + "connections %i of %s reached for " +- "%u.%u.%u.%u->%u.%u.%u.%u\n", ++ "%u.%u.%u.%u->%u.%u.%u.%u%s\n", + related_to->helper->max_expected, + related_to->helper->name, + NIPQUAD(related_to->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip), +- NIPQUAD(related_to->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip)); ++ NIPQUAD(related_to->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip), ++ related_to->helper->flags & IP_CT_HELPER_F_REUSE_EXPECT ? ++ ", reusing" : ""); ++ if (!(related_to->helper->flags & ++ IP_CT_HELPER_F_REUSE_EXPECT)) { ++ WRITE_UNLOCK(&ip_conntrack_lock); + return -EPERM; + } +- DEBUGP("ip_conntrack: max number of expected " +- "connections %i of %s reached for " +- "%u.%u.%u.%u->%u.%u.%u.%u, reusing\n", +- related_to->helper->max_expected, +- related_to->helper->name, +- NIPQUAD(related_to->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip), +- NIPQUAD(related_to->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip)); + + /* choose the the oldest expectation to evict */ + list_for_each(cur_item, &related_to->sibling_list) { +@@ -1055,8 +1041,7 @@ + /* add to global list of expectations */ + list_prepend(&ip_conntrack_expect_list, &new->list); + /* add and start timer if required */ +- if (related_to->helper && +- related_to->helper->timeout) { ++ if (related_to->helper->timeout) { + init_timer(&new->timeout); + new->timeout.data = (unsigned long)new; + new->timeout.function = expectation_timed_out; +@@ -1079,10 +1064,11 @@ + + MUST_BE_READ_LOCKED(&ip_conntrack_lock); + WRITE_LOCK(&ip_conntrack_expect_tuple_lock); ++ + DEBUGP("change_expect:\n"); +- DEBUGP("exp tuple: "); DUMP_TUPLE_RAW(&expect->tuple); +- DEBUGP("exp mask: "); DUMP_TUPLE_RAW(&expect->mask); +- DEBUGP("newtuple: "); DUMP_TUPLE_RAW(newtuple); ++ DEBUGP("exp tuple: "); DUMP_TUPLE(&expect->tuple); ++ DEBUGP("exp mask: "); DUMP_TUPLE(&expect->mask); ++ DEBUGP("newtuple: "); DUMP_TUPLE(newtuple); + if (expect->ct_tuple.dst.protonum == 0) { + /* Never seen before */ + DEBUGP("change expect: never seen before\n"); +@@ -1360,8 +1346,6 @@ + 0, NULL }; + + #define NET_IP_CONNTRACK_MAX 2089 +-#define NET_IP_CONNTRACK_TCP_TIMEOUTS 2090 +-#define NET_IP_CONNTRACK_UDP_TIMEOUTS 2091 + #define NET_IP_CONNTRACK_MAX_NAME "ip_conntrack_max" + + #ifdef CONFIG_SYSCTL +@@ -1370,14 +1354,6 @@ + static ctl_table ip_conntrack_table[] = { + { NET_IP_CONNTRACK_MAX, NET_IP_CONNTRACK_MAX_NAME, &ip_conntrack_max, + sizeof(ip_conntrack_max), 0644, NULL, proc_dointvec }, +- { NET_IP_CONNTRACK_TCP_TIMEOUTS, "ip_conntrack_tcp_timeouts", +- &sysctl_ip_conntrack_tcp_timeouts, +- sizeof(sysctl_ip_conntrack_tcp_timeouts), +- 0644, NULL, &proc_dointvec_jiffies, &sysctl_jiffies }, +- { NET_IP_CONNTRACK_UDP_TIMEOUTS, "ip_conntrack_udp_timeouts", +- &sysctl_ip_conntrack_udp_timeouts, +- sizeof(sysctl_ip_conntrack_udp_timeouts), +- 0644, NULL, &proc_dointvec_jiffies, &sysctl_jiffies }, + { 0 } + }; + +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_ftp.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_ftp.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_ftp.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_ftp.c 2004-05-09 04:13:03.000000000 -0400 +@@ -24,7 +24,11 @@ + static int loose = 0; + MODULE_PARM(loose, "i"); + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + static int try_rfc959(const char *, size_t, u_int32_t [], char); + static int try_eprt(const char *, size_t, u_int32_t [], char); +@@ -191,6 +195,16 @@ + } + + if (strnicmp(data, pattern, plen) != 0) { ++#if 0 ++ size_t i; ++ ++ DEBUGP("ftp: string mismatch\n"); ++ for (i = 0; i < plen; i++) { ++ DEBUGFTP("ftp:char %u `%c'(%u) vs `%c'(%u)\n", ++ i, data[i], data[i], ++ pattern[i], pattern[i]); ++ } ++#endif + return 0; + } + +@@ -214,6 +228,7 @@ + return 1; + } + ++/* FIXME: This should be in userspace. Later. */ + static int help(const struct iphdr *iph, size_t len, + struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo) +@@ -249,6 +264,7 @@ + } + + /* Checksum invalid? Ignore. */ ++ /* FIXME: Source route IP option packets --RR */ + if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, + csum_partial((char *)tcph, tcplen, 0))) { + DEBUGP("ftp_help: bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_h323.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_h323.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_h323.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_h323.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,302 +0,0 @@ +-/* +- * H.323 'brute force' extension for H.323 connection tracking. +- * Jozsef Kadlecsik +- * +- * Based on ip_masq_h323.c for 2.2 kernels from CoRiTel, Sofia project. +- * (http://www.coritel.it/projects/sofia/nat/) +- * Uses Sampsa Ranta's excellent idea on using expectfn to 'bind' +- * the unregistered helpers to the conntrack entries. +- */ +- +- +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-MODULE_AUTHOR("Jozsef Kadlecsik "); +-MODULE_DESCRIPTION("H.323 'brute force' connection tracking module"); +-MODULE_LICENSE("GPL"); +- +-DECLARE_LOCK(ip_h323_lock); +-struct module *ip_conntrack_h323 = THIS_MODULE; +- +-#define DEBUGP(format, args...) +- +-static int h245_help(const struct iphdr *iph, size_t len, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo) +-{ +- struct tcphdr *tcph = (void *)iph + iph->ihl * 4; +- unsigned char *data = (unsigned char *) tcph + tcph->doff * 4; +- unsigned char *data_limit; +- u_int32_t tcplen = len - iph->ihl * 4; +- u_int32_t datalen = tcplen - tcph->doff * 4; +- int dir = CTINFO2DIR(ctinfo); +- struct ip_ct_h225_master *info = &ct->help.ct_h225_info; +- struct ip_conntrack_expect expect, *exp = &expect; +- struct ip_ct_h225_expect *exp_info = &exp->help.exp_h225_info; +- u_int16_t data_port; +- u_int32_t data_ip; +- unsigned int i; +- +- DEBUGP("ct_h245_help: help entered %u.%u.%u.%u:%u->%u.%u.%u.%u:%u\n", +- NIPQUAD(iph->saddr), ntohs(tcph->source), +- NIPQUAD(iph->daddr), ntohs(tcph->dest)); +- +- /* Can't track connections formed before we registered */ +- if (!info) +- return NF_ACCEPT; +- +- /* Until there's been traffic both ways, don't look in packets. */ +- if (ctinfo != IP_CT_ESTABLISHED +- && ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { +- DEBUGP("ct_h245_help: Conntrackinfo = %u\n", ctinfo); +- return NF_ACCEPT; +- } +- +- /* Not whole TCP header or too short packet? */ +- if (tcplen < sizeof(struct tcphdr) || tcplen < tcph->doff * 4 + 5) { +- DEBUGP("ct_h245_help: tcplen = %u\n", (unsigned)tcplen); +- return NF_ACCEPT; +- } +- +- /* Checksum invalid? Ignore. */ +- if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, +- csum_partial((char *)tcph, tcplen, 0))) { +- DEBUGP("ct_h245_help: bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", +- tcph, tcplen, NIPQUAD(iph->saddr), +- NIPQUAD(iph->daddr)); +- return NF_ACCEPT; +- } +- +- data_limit = (unsigned char *) data + datalen; +- /* bytes: 0123 45 +- ipadrr port */ +- for (i = 0; data < (data_limit - 5); data++, i++) { +- memcpy(&data_ip, data, sizeof(u_int32_t)); +- if (data_ip == iph->saddr) { +- memcpy(&data_port, data + 4, sizeof(u_int16_t)); +- memset(&expect, 0, sizeof(expect)); +- /* update the H.225 info */ +- DEBUGP("ct_h245_help: new RTCP/RTP requested %u.%u.%u.%u:->%u.%u.%u.%u:%u\n", +- NIPQUAD(ct->tuplehash[!dir].tuple.src.ip), +- NIPQUAD(iph->saddr), ntohs(data_port)); +- LOCK_BH(&ip_h323_lock); +- info->is_h225 = H225_PORT + 1; +- exp_info->port = data_port; +- exp_info->dir = dir; +- exp_info->offset = i; +- +- exp->seq = ntohl(tcph->seq) + i; +- +- exp->tuple = ((struct ip_conntrack_tuple) +- { { ct->tuplehash[!dir].tuple.src.ip, +- { 0 } }, +- { data_ip, +- { data_port }, +- IPPROTO_UDP }}); +- exp->mask = ((struct ip_conntrack_tuple) +- { { 0xFFFFFFFF, { 0 } }, +- { 0xFFFFFFFF, { 0xFFFF }, 0xFFFF }}); +- +- exp->expectfn = NULL; +- +- /* Ignore failure; should only happen with NAT */ +- ip_conntrack_expect_related(ct, exp); +- +- UNLOCK_BH(&ip_h323_lock); +- } +- } +- +- return NF_ACCEPT; +- +-} +- +-/* H.245 helper is not registered! */ +-static struct ip_conntrack_helper h245 = +- { { NULL, NULL }, +- "H.245", /* name */ +- IP_CT_HELPER_F_REUSE_EXPECT, /* flags */ +- NULL, /* module */ +- 8, /* max_ expected */ +- 240, /* timeout */ +- { { 0, { 0 } }, /* tuple */ +- { 0, { 0 }, IPPROTO_TCP } }, +- { { 0, { 0xFFFF } }, /* mask */ +- { 0, { 0 }, 0xFFFF } }, +- h245_help /* helper */ +- }; +- +-static int h225_expect(struct ip_conntrack *ct) +-{ +- WRITE_LOCK(&ip_conntrack_lock); +- ct->helper = &h245; +- DEBUGP("h225_expect: helper for %p added\n", ct); +- WRITE_UNLOCK(&ip_conntrack_lock); +- +- return NF_ACCEPT; /* unused */ +-} +- +-static int h225_help(const struct iphdr *iph, size_t len, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo) +-{ +- struct tcphdr *tcph = (void *)iph + iph->ihl * 4; +- unsigned char *data = (unsigned char *) tcph + tcph->doff * 4; +- unsigned char *data_limit; +- u_int32_t tcplen = len - iph->ihl * 4; +- u_int32_t datalen = tcplen - tcph->doff * 4; +- int dir = CTINFO2DIR(ctinfo); +- struct ip_ct_h225_master *info = &ct->help.ct_h225_info; +- struct ip_conntrack_expect expect, *exp = &expect; +- struct ip_ct_h225_expect *exp_info = &exp->help.exp_h225_info; +- u_int16_t data_port; +- u_int32_t data_ip; +- unsigned int i; +- +- DEBUGP("ct_h225_help: help entered %u.%u.%u.%u:%u->%u.%u.%u.%u:%u\n", +- NIPQUAD(iph->saddr), ntohs(tcph->source), +- NIPQUAD(iph->daddr), ntohs(tcph->dest)); +- +- /* Can't track connections formed before we registered */ +- if (!info) +- return NF_ACCEPT; +- +- /* Until there's been traffic both ways, don't look in packets. */ +- if (ctinfo != IP_CT_ESTABLISHED +- && ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { +- DEBUGP("ct_h225_help: Conntrackinfo = %u\n", ctinfo); +- return NF_ACCEPT; +- } +- +- /* Not whole TCP header or too short packet? */ +- if (tcplen < sizeof(struct tcphdr) || tcplen < tcph->doff * 4 + 5) { +- DEBUGP("ct_h225_help: tcplen = %u\n", (unsigned)tcplen); +- return NF_ACCEPT; +- } +- +- /* Checksum invalid? Ignore. */ +- if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, +- csum_partial((char *)tcph, tcplen, 0))) { +- DEBUGP("ct_h225_help: bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", +- tcph, tcplen, NIPQUAD(iph->saddr), +- NIPQUAD(iph->daddr)); +- return NF_ACCEPT; +- } +- +- data_limit = (unsigned char *) data + datalen; +- /* bytes: 0123 45 +- ipadrr port */ +- for (i = 0; data < (data_limit - 5); data++, i++) { +- memcpy(&data_ip, data, sizeof(u_int32_t)); +- if (data_ip == iph->saddr) { +- memcpy(&data_port, data + 4, sizeof(u_int16_t)); +- if (data_port == tcph->source) { +- /* Signal address */ +- DEBUGP("ct_h225_help: sourceCallSignalAddress from %u.%u.%u.%u\n", +- NIPQUAD(iph->saddr)); +- /* Update the H.225 info so that NAT can mangle the address/port +- even when we have no expected connection! */ +-#ifdef CONFIG_IP_NF_NAT_NEEDED +- LOCK_BH(&ip_h323_lock); +- info->dir = dir; +- info->seq[IP_CT_DIR_ORIGINAL] = ntohl(tcph->seq) + i; +- info->offset[IP_CT_DIR_ORIGINAL] = i; +- UNLOCK_BH(&ip_h323_lock); +-#endif +- } else { +- memset(&expect, 0, sizeof(expect)); +- +- /* update the H.225 info */ +- LOCK_BH(&ip_h323_lock); +- info->is_h225 = H225_PORT; +- exp_info->port = data_port; +- exp_info->dir = dir; +- exp_info->offset = i; +- +- exp->seq = ntohl(tcph->seq) + i; +- +- exp->tuple = ((struct ip_conntrack_tuple) +- { { ct->tuplehash[!dir].tuple.src.ip, +- { 0 } }, +- { data_ip, +- { data_port }, +- IPPROTO_TCP }}); +- exp->mask = ((struct ip_conntrack_tuple) +- { { 0xFFFFFFFF, { 0 } }, +- { 0xFFFFFFFF, { 0xFFFF }, 0xFFFF }}); +- +- exp->expectfn = h225_expect; +- +- /* Ignore failure */ +- ip_conntrack_expect_related(ct, exp); +- +- DEBUGP("ct_h225_help: new H.245 requested %u.%u.%u.%u->%u.%u.%u.%u:%u\n", +- NIPQUAD(ct->tuplehash[!dir].tuple.src.ip), +- NIPQUAD(iph->saddr), ntohs(data_port)); +- +- UNLOCK_BH(&ip_h323_lock); +- } +-#ifdef CONFIG_IP_NF_NAT_NEEDED +- } else if (data_ip == iph->daddr) { +- memcpy(&data_port, data + 4, sizeof(u_int16_t)); +- if (data_port == tcph->dest) { +- /* Signal address */ +- DEBUGP("ct_h225_help: destCallSignalAddress %u.%u.%u.%u\n", +- NIPQUAD(iph->daddr)); +- /* Update the H.225 info so that NAT can mangle the address/port +- even when we have no expected connection! */ +- LOCK_BH(&ip_h323_lock); +- info->dir = dir; +- info->seq[IP_CT_DIR_REPLY] = ntohl(tcph->seq) + i; +- info->offset[IP_CT_DIR_REPLY] = i; +- UNLOCK_BH(&ip_h323_lock); +- } +-#endif +- } +- } +- +- return NF_ACCEPT; +- +-} +- +-static struct ip_conntrack_helper h225 = +- { { NULL, NULL }, +- "H.225", /* name */ +- IP_CT_HELPER_F_REUSE_EXPECT, /* flags */ +- THIS_MODULE, /* module */ +- 2, /* max_expected */ +- 240, /* timeout */ +- { { 0, { __constant_htons(H225_PORT) } }, /* tuple */ +- { 0, { 0 }, IPPROTO_TCP } }, +- { { 0, { 0xFFFF } }, /* mask */ +- { 0, { 0 }, 0xFFFF } }, +- h225_help /* helper */ +- }; +- +-static int __init init(void) +-{ +- return ip_conntrack_helper_register(&h225); +-} +- +-static void __exit fini(void) +-{ +- /* Unregister H.225 helper */ +- ip_conntrack_helper_unregister(&h225); +-} +- +-#ifdef CONFIG_IP_NF_NAT_NEEDED +-EXPORT_SYMBOL(ip_h323_lock); +-#endif +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_mms.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_mms.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_mms.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_mms.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,292 +0,0 @@ +-/* MMS extension for IP connection tracking +- * (C) 2002 by Filip Sneppe +- * based on ip_conntrack_ftp.c and ip_conntrack_irc.c +- * +- * ip_conntrack_mms.c v0.3 2002-09-22 +- * +- * 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. +- * +- * Module load syntax: +- * insmod ip_conntrack_mms.o ports=port1,port2,...port +- * +- * Please give the ports of all MMS servers You wish to connect to. +- * If you don't specify ports, the default will be TCP port 1755. +- * +- * More info on MMS protocol, firewalls and NAT: +- * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/MMSFirewall.asp +- * http://www.microsoft.com/windows/windowsmedia/serve/firewall.asp +- * +- * The SDP project people are reverse-engineering MMS: +- * http://get.to/sdp +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-DECLARE_LOCK(ip_mms_lock); +-struct module *ip_conntrack_mms = THIS_MODULE; +- +-#define MAX_PORTS 8 +-static int ports[MAX_PORTS]; +-static int ports_c; +-#ifdef MODULE_PARM +-MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); +-#endif +- +-#define DEBUGP(format, args...) +- +-#ifdef CONFIG_IP_NF_NAT_NEEDED +-EXPORT_SYMBOL(ip_mms_lock); +-#endif +- +-MODULE_AUTHOR("Filip Sneppe "); +-MODULE_DESCRIPTION("Microsoft Windows Media Services (MMS) connection tracking module"); +-MODULE_LICENSE("GPL"); +- +-/* #define isdigit(c) (c >= '0' && c <= '9') */ +- +-/* copied from drivers/usb/serial/io_edgeport.c - not perfect but will do the trick */ +-static void unicode_to_ascii (char *string, short *unicode, int unicode_size) +-{ +- int i; +- for (i = 0; i < unicode_size; ++i) { +- string[i] = (char)(unicode[i]); +- } +- string[unicode_size] = 0x00; +-} +- +-__inline static int atoi(char *s) +-{ +- int i=0; +- while (isdigit(*s)) { +- i = i*10 + *(s++) - '0'; +- } +- return i; +-} +- +-/* convert ip address string like "192.168.0.10" to unsigned int */ +-__inline static u_int32_t asciiiptoi(char *s) +-{ +- unsigned int i, j, k; +- +- for(i=k=0; k<3; ++k, ++s, i<<=8) { +- i+=atoi(s); +- for(j=0; (*(++s) != '.') && (j<3); ++j) +- ; +- } +- i+=atoi(s); +- return ntohl(i); +-} +- +-int parse_mms(const char *data, +- const unsigned int datalen, +- u_int32_t *mms_ip, +- u_int16_t *mms_proto, +- u_int16_t *mms_port, +- char **mms_string_b, +- char **mms_string_e, +- char **mms_padding_e) +-{ +- int unicode_size, i; +- char tempstring[28]; /* "\\255.255.255.255\UDP\65535" */ +- char getlengthstring[28]; +- +- for(unicode_size=0; +- (char) *(data+(MMS_SRV_UNICODE_STRING_OFFSET+unicode_size*2)) != (char)0; +- unicode_size++) +- if ((unicode_size == 28) || (MMS_SRV_UNICODE_STRING_OFFSET+unicode_size*2 >= datalen)) +- return -1; /* out of bounds - incomplete packet */ +- +- unicode_to_ascii(tempstring, (short *)(data+MMS_SRV_UNICODE_STRING_OFFSET), unicode_size); +- DEBUGP("ip_conntrack_mms: offset 60: %s\n", (const char *)(tempstring)); +- +- /* IP address ? */ +- *mms_ip = asciiiptoi(tempstring+2); +- +- i=sprintf(getlengthstring, "%u.%u.%u.%u", HIPQUAD(*mms_ip)); +- +- /* protocol ? */ +- if(strncmp(tempstring+3+i, "TCP", 3)==0) +- *mms_proto = IPPROTO_TCP; +- else if(strncmp(tempstring+3+i, "UDP", 3)==0) +- *mms_proto = IPPROTO_UDP; +- +- /* port ? */ +- *mms_port = atoi(tempstring+7+i); +- +- /* we store a pointer to the beginning of the "\\a.b.c.d\proto\port" +- unicode string, one to the end of the string, and one to the end +- of the packet, since we must keep track of the number of bytes +- between end of the unicode string and the end of packet (padding) */ +- *mms_string_b = (char *)(data + MMS_SRV_UNICODE_STRING_OFFSET); +- *mms_string_e = (char *)(data + MMS_SRV_UNICODE_STRING_OFFSET + unicode_size * 2); +- *mms_padding_e = (char *)(data + datalen); /* looks funny, doesn't it */ +- return 0; +-} +- +- +-static int help(const struct iphdr *iph, size_t len, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo) +-{ +- /* tcplen not negative guaranteed by ip_conntrack_tcp.c */ +- struct tcphdr *tcph = (void *)iph + iph->ihl * 4; +- const char *data = (const char *)tcph + tcph->doff * 4; +- unsigned int tcplen = len - iph->ihl * 4; +- unsigned int datalen = tcplen - tcph->doff * 4; +- int dir = CTINFO2DIR(ctinfo); +- struct ip_conntrack_expect expect, *exp = &expect; +- struct ip_ct_mms_expect *exp_mms_info = &exp->help.exp_mms_info; +- +- u_int32_t mms_ip; +- u_int16_t mms_proto; +- char mms_proto_string[8]; +- u_int16_t mms_port; +- char *mms_string_b, *mms_string_e, *mms_padding_e; +- +- /* Until there's been traffic both ways, don't look in packets. */ +- if (ctinfo != IP_CT_ESTABLISHED +- && ctinfo != IP_CT_ESTABLISHED+IP_CT_IS_REPLY) { +- DEBUGP("ip_conntrack_mms: Conntrackinfo = %u\n", ctinfo); +- return NF_ACCEPT; +- } +- +- /* Not whole TCP header? */ +- if (tcplen < sizeof(struct tcphdr) || tcplen < tcph->doff*4) { +- DEBUGP("ip_conntrack_mms: tcplen = %u\n", (unsigned)tcplen); +- return NF_ACCEPT; +- } +- +- /* Checksum invalid? Ignore. */ +- if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, +- csum_partial((char *)tcph, tcplen, 0))) { +- DEBUGP("mms_help: bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", +- tcph, tcplen, NIPQUAD(iph->saddr), +- NIPQUAD(iph->daddr)); +- return NF_ACCEPT; +- } +- +- /* Only look at packets with 0x00030002/196610 on bytes 36->39 of TCP payload */ +- if( (MMS_SRV_MSG_OFFSET < datalen) && +- ((*(u32 *)(data+MMS_SRV_MSG_OFFSET)) == MMS_SRV_MSG_ID)) { +- DEBUGP("ip_conntrack_mms: offset 37: %u %u %u %u, datalen:%u\n", +- (u8)*(data+36), (u8)*(data+37), +- (u8)*(data+38), (u8)*(data+39), +- datalen); +- if(parse_mms(data, datalen, &mms_ip, &mms_proto, &mms_port, +- &mms_string_b, &mms_string_e, &mms_padding_e)) +- if(net_ratelimit()) +- printk(KERN_WARNING +- "ip_conntrack_mms: Unable to parse data payload\n"); +- +- memset(&expect, 0, sizeof(expect)); +- +- sprintf(mms_proto_string, "(%u)", mms_proto); +- DEBUGP("ip_conntrack_mms: adding %s expectation %u.%u.%u.%u -> %u.%u.%u.%u:%u\n", +- mms_proto == IPPROTO_TCP ? "TCP" +- : mms_proto == IPPROTO_UDP ? "UDP":mms_proto_string, +- NIPQUAD(ct->tuplehash[!dir].tuple.src.ip), +- NIPQUAD(mms_ip), +- mms_port); +- +- /* it's possible that the client will just ask the server to tunnel +- the stream over the same TCP session (from port 1755): there's +- shouldn't be a need to add an expectation in that case, but it +- makes NAT packet mangling so much easier */ +- LOCK_BH(&ip_mms_lock); +- +- DEBUGP("ip_conntrack_mms: tcph->seq = %u\n", tcph->seq); +- +- exp->seq = ntohl(tcph->seq) + (mms_string_b - data); +- exp_mms_info->len = (mms_string_e - mms_string_b); +- exp_mms_info->padding = (mms_padding_e - mms_string_e); +- exp_mms_info->port = mms_port; +- +- DEBUGP("ip_conntrack_mms: wrote info seq=%u (ofs=%u), len=%d, padding=%u\n", +- exp->seq, (mms_string_e - data), exp_mms_info->len, exp_mms_info->padding); +- +- exp->tuple = ((struct ip_conntrack_tuple) +- { { ct->tuplehash[!dir].tuple.src.ip, { 0 } }, +- { mms_ip, +- { (__u16) ntohs(mms_port) }, +- mms_proto } } +- ); +- exp->mask = ((struct ip_conntrack_tuple) +- { { 0xFFFFFFFF, { 0 } }, +- { 0xFFFFFFFF, { 0xFFFF }, 0xFFFF }}); +- exp->expectfn = NULL; +- ip_conntrack_expect_related(ct, &expect); +- UNLOCK_BH(&ip_mms_lock); +- } +- +- return NF_ACCEPT; +-} +- +-static struct ip_conntrack_helper mms[MAX_PORTS]; +-static char mms_names[MAX_PORTS][10]; +- +-/* Not __exit: called from init() */ +-static void fini(void) +-{ +- int i; +- for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { +- DEBUGP("ip_conntrack_mms: unregistering helper for port %d\n", +- ports[i]); +- ip_conntrack_helper_unregister(&mms[i]); +- } +-} +- +-static int __init init(void) +-{ +- int i, ret; +- char *tmpname; +- +- if (ports[0] == 0) +- ports[0] = MMS_PORT; +- +- for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { +- memset(&mms[i], 0, sizeof(struct ip_conntrack_helper)); +- mms[i].tuple.src.u.tcp.port = htons(ports[i]); +- mms[i].tuple.dst.protonum = IPPROTO_TCP; +- mms[i].mask.src.u.tcp.port = 0xFFFF; +- mms[i].mask.dst.protonum = 0xFFFF; +- mms[i].max_expected = 1; +- mms[i].timeout = 0; +- mms[i].flags = IP_CT_HELPER_F_REUSE_EXPECT; +- mms[i].me = THIS_MODULE; +- mms[i].help = help; +- +- tmpname = &mms_names[i][0]; +- if (ports[i] == MMS_PORT) +- sprintf(tmpname, "mms"); +- else +- sprintf(tmpname, "mms-%d", ports[i]); +- mms[i].name = tmpname; +- +- DEBUGP("ip_conntrack_mms: registering helper for port %d\n", +- ports[i]); +- ret = ip_conntrack_helper_register(&mms[i]); +- +- if (ret) { +- fini(); +- return ret; +- } +- ports_c++; +- } +- return 0; +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_pptp.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_pptp.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_pptp.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_pptp.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,531 +0,0 @@ +-/* +- * ip_conntrack_pptp.c - Version 1.11 +- * +- * Connection tracking support for PPTP (Point to Point Tunneling Protocol). +- * PPTP is a a protocol for creating virtual private networks. +- * It is a specification defined by Microsoft and some vendors +- * working with Microsoft. PPTP is built on top of a modified +- * version of the Internet Generic Routing Encapsulation Protocol. +- * GRE is defined in RFC 1701 and RFC 1702. Documentation of +- * PPTP can be found in RFC 2637 +- * +- * (C) 2000-2002 by Harald Welte , +- * +- * Development of this code funded by Astaro AG (http://www.astaro.com/) +- * +- * Limitations: +- * - We blindly assume that control connections are always +- * established in PNS->PAC direction. This is a violation +- * of RFFC2673 +- * +- * TODO: - finish support for multiple calls within one session +- * (needs expect reservations in newnat) +- * - testing of incoming PPTP calls +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Harald Welte "); +-MODULE_DESCRIPTION("Netfilter connection tracking helper module for PPTP"); +- +-DECLARE_LOCK(ip_pptp_lock); +- +-#define DEBUGP(format, args...) +- +-#define SECS *HZ +-#define MINS * 60 SECS +-#define HOURS * 60 MINS +-#define DAYS * 24 HOURS +- +-#define PPTP_GRE_TIMEOUT (10 MINS) +-#define PPTP_GRE_STREAM_TIMEOUT (5 DAYS) +- +-static int pptp_expectfn(struct ip_conntrack *ct) +-{ +- struct ip_conntrack_expect *exp, *other_exp; +- struct ip_conntrack *master; +- +- DEBUGP("increasing timeouts\n"); +- /* increase timeout of GRE data channel conntrack entry */ +- ct->proto.gre.timeout = PPTP_GRE_TIMEOUT; +- ct->proto.gre.stream_timeout = PPTP_GRE_STREAM_TIMEOUT; +- +- master = master_ct(ct); +- if (!master) { +- DEBUGP(" no master!!!\n"); +- return 0; +- } +- +- DEBUGP("completing tuples with ct info\n"); +- /* we can do this, since we're unconfirmed */ +- if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.gre.key == +- htonl(master->help.ct_pptp_info.pac_call_id)) { +- /* assume PNS->PAC */ +- ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key = +- htonl(master->help.ct_pptp_info.pns_call_id); +- ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key = +- htonl(master->help.ct_pptp_info.pns_call_id); +- } else { +- /* assume PAC->PNS */ +- ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key = +- htonl(master->help.ct_pptp_info.pac_call_id); +- ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key = +- htonl(master->help.ct_pptp_info.pns_call_id); +- } +- +- return 0; +-} +- +-/* timeout GRE data connections */ +-static int pptp_timeout_related(struct ip_conntrack *ct) +-{ +- struct list_head *cur_item; +- struct ip_conntrack_expect *exp; +- +- list_for_each(cur_item, &ct->sibling_list) { +- exp = list_entry(cur_item, struct ip_conntrack_expect, +- expected_list); +- +- if (!exp->sibling) +- continue; +- +- DEBUGP("setting timeout of conntrack %p to 0\n", +- exp->sibling); +- exp->sibling->proto.gre.timeout = 0; +- exp->sibling->proto.gre.stream_timeout = 0; +- ip_ct_refresh(exp->sibling, 0); +- } +- +- return 0; +-} +- +-/* expect GRE connection in PNS->PAC direction */ +-static inline int +-exp_gre(struct ip_conntrack *master, +- u_int32_t seq, +- u_int16_t callid, +- u_int16_t peer_callid) +-{ +- struct ip_conntrack_expect exp; +- struct ip_conntrack_tuple inv_tuple; +- +- memset(&exp, 0, sizeof(exp)); +- /* tuple in original direction, PAC->PNS */ +- exp.tuple.src.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; +- exp.tuple.src.u.gre.key = htonl(ntohs(peer_callid)); +- exp.tuple.dst.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; +- exp.tuple.dst.u.gre.key = htonl(ntohs(callid)); +- exp.tuple.dst.u.gre.protocol = __constant_htons(GRE_PROTOCOL_PPTP); +- exp.tuple.dst.u.gre.version = GRE_VERSION_PPTP; +- exp.tuple.dst.protonum = IPPROTO_GRE; +- +- exp.mask.src.ip = 0xffffffff; +- exp.mask.src.u.all = 0; +- exp.mask.dst.u.all = 0; +- exp.mask.dst.u.gre.key = 0xffffffff; +- exp.mask.dst.u.gre.version = 0xff; +- exp.mask.dst.u.gre.protocol = 0xffff; +- exp.mask.dst.ip = 0xffffffff; +- exp.mask.dst.protonum = 0xffff; +- +- exp.seq = seq; +- exp.expectfn = pptp_expectfn; +- +- exp.help.exp_pptp_info.pac_call_id = ntohs(callid); +- exp.help.exp_pptp_info.pns_call_id = ntohs(peer_callid); +- +- DEBUGP("calling expect_related "); +- DUMP_TUPLE_RAW(&exp.tuple); +- +- /* Add GRE keymap entries */ +- ip_ct_gre_keymap_add(&exp, &exp.tuple, 0); +- invert_tuplepr(&inv_tuple, &exp.tuple); +- ip_ct_gre_keymap_add(&exp, &inv_tuple, 1); +- +- ip_conntrack_expect_related(master, &exp); +- +- return 0; +-} +- +-static inline int +-pptp_inbound_pkt(struct tcphdr *tcph, +- struct pptp_pkt_hdr *pptph, +- size_t datalen, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo) +-{ +- struct PptpControlHeader *ctlh; +- union pptp_ctrl_union pptpReq; +- +- struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; +- u_int16_t msg, *cid, *pcid; +- u_int32_t seq; +- +- ctlh = (struct PptpControlHeader *) +- ((char *) pptph + sizeof(struct pptp_pkt_hdr)); +- pptpReq.rawreq = (void *) +- ((char *) ctlh + sizeof(struct PptpControlHeader)); +- +- msg = ntohs(ctlh->messageType); +- DEBUGP("inbound control message %s\n", strMName[msg]); +- +- switch (msg) { +- case PPTP_START_SESSION_REPLY: +- /* server confirms new control session */ +- if (info->sstate < PPTP_SESSION_REQUESTED) { +- DEBUGP("%s without START_SESS_REQUEST\n", +- strMName[msg]); +- break; +- } +- if (pptpReq.srep->resultCode == PPTP_START_OK) +- info->sstate = PPTP_SESSION_CONFIRMED; +- else +- info->sstate = PPTP_SESSION_ERROR; +- break; +- +- case PPTP_STOP_SESSION_REPLY: +- /* server confirms end of control session */ +- if (info->sstate > PPTP_SESSION_STOPREQ) { +- DEBUGP("%s without STOP_SESS_REQUEST\n", +- strMName[msg]); +- break; +- } +- if (pptpReq.strep->resultCode == PPTP_STOP_OK) +- info->sstate = PPTP_SESSION_NONE; +- else +- info->sstate = PPTP_SESSION_ERROR; +- break; +- +- case PPTP_OUT_CALL_REPLY: +- /* server accepted call, we now expect GRE frames */ +- if (info->sstate != PPTP_SESSION_CONFIRMED) { +- DEBUGP("%s but no session\n", strMName[msg]); +- break; +- } +- if (info->cstate != PPTP_CALL_OUT_REQ && +- info->cstate != PPTP_CALL_OUT_CONF) { +- DEBUGP("%s without OUTCALL_REQ\n", strMName[msg]); +- break; +- } +- if (pptpReq.ocack->resultCode != PPTP_OUTCALL_CONNECT) { +- info->cstate = PPTP_CALL_NONE; +- break; +- } +- +- cid = &pptpReq.ocack->callID; +- pcid = &pptpReq.ocack->peersCallID; +- +- info->pac_call_id = ntohs(*cid); +- +- if (htons(info->pns_call_id) != *pcid) { +- DEBUGP("%s for unknown callid %u\n", +- strMName[msg], ntohs(*pcid)); +- break; +- } +- +- DEBUGP("%s, CID=%X, PCID=%X\n", strMName[msg], +- ntohs(*cid), ntohs(*pcid)); +- +- info->cstate = PPTP_CALL_OUT_CONF; +- +- seq = ntohl(tcph->seq) + ((void *)pcid - (void *)pptph); +- exp_gre(ct, seq, *cid, *pcid); +- break; +- +- case PPTP_IN_CALL_REQUEST: +- /* server tells us about incoming call request */ +- if (info->sstate != PPTP_SESSION_CONFIRMED) { +- DEBUGP("%s but no session\n", strMName[msg]); +- break; +- } +- pcid = &pptpReq.icack->peersCallID; +- DEBUGP("%s, PCID=%X\n", strMName[msg], ntohs(*pcid)); +- info->cstate = PPTP_CALL_IN_REQ; +- info->pac_call_id= ntohs(*pcid); +- break; +- +- case PPTP_IN_CALL_CONNECT: +- /* server tells us about incoming call established */ +- if (info->sstate != PPTP_SESSION_CONFIRMED) { +- DEBUGP("%s but no session\n", strMName[msg]); +- break; +- } +- if (info->sstate != PPTP_CALL_IN_REP +- && info->sstate != PPTP_CALL_IN_CONF) { +- DEBUGP("%s but never sent IN_CALL_REPLY\n", +- strMName[msg]); +- break; +- } +- +- pcid = &pptpReq.iccon->peersCallID; +- cid = &info->pac_call_id; +- +- if (info->pns_call_id != ntohs(*pcid)) { +- DEBUGP("%s for unknown CallID %u\n", +- strMName[msg], ntohs(*cid)); +- break; +- } +- +- DEBUGP("%s, PCID=%X\n", strMName[msg], ntohs(*pcid)); +- info->cstate = PPTP_CALL_IN_CONF; +- +- /* we expect a GRE connection from PAC to PNS */ +- seq = ntohl(tcph->seq) + ((void *)pcid - (void *)pptph); +- exp_gre(ct, seq, *cid, *pcid); +- +- break; +- +- case PPTP_CALL_DISCONNECT_NOTIFY: +- /* server confirms disconnect */ +- cid = &pptpReq.disc->callID; +- DEBUGP("%s, CID=%X\n", strMName[msg], ntohs(*cid)); +- info->cstate = PPTP_CALL_NONE; +- +- /* untrack this call id, unexpect GRE packets */ +- pptp_timeout_related(ct); +- /* NEWNAT: look up exp for call id and unexpct_related */ +- break; +- +- case PPTP_WAN_ERROR_NOTIFY: +- break; +- +- case PPTP_ECHO_REQUEST: +- case PPTP_ECHO_REPLY: +- /* I don't have to explain these ;) */ +- break; +- default: +- DEBUGP("invalid %s (TY=%d)\n", (msg <= PPTP_MSG_MAX) +- ? strMName[msg]:strMName[0], msg); +- break; +- } +- +- return NF_ACCEPT; +- +-} +- +-static inline int +-pptp_outbound_pkt(struct tcphdr *tcph, +- struct pptp_pkt_hdr *pptph, +- size_t datalen, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo) +-{ +- struct PptpControlHeader *ctlh; +- union pptp_ctrl_union pptpReq; +- struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; +- u_int16_t msg, *cid, *pcid; +- +- ctlh = (struct PptpControlHeader *) ((void *) pptph + sizeof(*pptph)); +- pptpReq.rawreq = (void *) ((void *) ctlh + sizeof(*ctlh)); +- +- msg = ntohs(ctlh->messageType); +- DEBUGP("outbound control message %s\n", strMName[msg]); +- +- switch (msg) { +- case PPTP_START_SESSION_REQUEST: +- /* client requests for new control session */ +- if (info->sstate != PPTP_SESSION_NONE) { +- DEBUGP("%s but we already have one", +- strMName[msg]); +- } +- info->sstate = PPTP_SESSION_REQUESTED; +- break; +- case PPTP_STOP_SESSION_REQUEST: +- /* client requests end of control session */ +- info->sstate = PPTP_SESSION_STOPREQ; +- break; +- +- case PPTP_OUT_CALL_REQUEST: +- /* client initiating connection to server */ +- if (info->sstate != PPTP_SESSION_CONFIRMED) { +- DEBUGP("%s but no session\n", +- strMName[msg]); +- break; +- } +- info->cstate = PPTP_CALL_OUT_REQ; +- /* track PNS call id */ +- cid = &pptpReq.ocreq->callID; +- DEBUGP("%s, CID=%X\n", strMName[msg], ntohs(*cid)); +- info->pns_call_id = ntohs(*cid); +- break; +- case PPTP_IN_CALL_REPLY: +- /* client answers incoming call */ +- if (info->cstate != PPTP_CALL_IN_REQ +- && info->cstate != PPTP_CALL_IN_REP) { +- DEBUGP("%s without incall_req\n", +- strMName[msg]); +- break; +- } +- if (pptpReq.icack->resultCode != PPTP_INCALL_ACCEPT) { +- info->cstate = PPTP_CALL_NONE; +- break; +- } +- pcid = &pptpReq.icack->peersCallID; +- if (info->pac_call_id != ntohs(*pcid)) { +- DEBUGP("%s for unknown call %u\n", +- strMName[msg], ntohs(*pcid)); +- break; +- } +- DEBUGP("%s, CID=%X\n", strMName[msg], ntohs(*pcid)); +- /* part two of the three-way handshake */ +- info->cstate = PPTP_CALL_IN_REP; +- info->pns_call_id = ntohs(pptpReq.icack->callID); +- break; +- +- case PPTP_CALL_CLEAR_REQUEST: +- /* client requests hangup of call */ +- if (info->sstate != PPTP_SESSION_CONFIRMED) { +- DEBUGP("CLEAR_CALL but no session\n"); +- break; +- } +- /* FUTURE: iterate over all calls and check if +- * call ID is valid. We don't do this without newnat, +- * because we only know about last call */ +- info->cstate = PPTP_CALL_CLEAR_REQ; +- break; +- case PPTP_SET_LINK_INFO: +- break; +- case PPTP_ECHO_REQUEST: +- case PPTP_ECHO_REPLY: +- /* I don't have to explain these ;) */ +- break; +- default: +- DEBUGP("invalid %s (TY=%d)\n", (msg <= PPTP_MSG_MAX)? +- strMName[msg]:strMName[0], msg); +- /* unknown: no need to create GRE masq table entry */ +- break; +- } +- +- return NF_ACCEPT; +-} +- +- +-/* track caller id inside control connection, call expect_related */ +-static int +-conntrack_pptp_help(const struct iphdr *iph, size_t len, +- struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) +- +-{ +- struct pptp_pkt_hdr *pptph; +- +- struct tcphdr *tcph = (void *) iph + iph->ihl * 4; +- u_int32_t tcplen = len - iph->ihl * 4; +- u_int32_t datalen = tcplen - tcph->doff * 4; +- void *datalimit; +- int dir = CTINFO2DIR(ctinfo); +- struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; +- +- int oldsstate, oldcstate; +- int ret; +- +- /* don't do any tracking before tcp handshake complete */ +- if (ctinfo != IP_CT_ESTABLISHED +- && ctinfo != IP_CT_ESTABLISHED+IP_CT_IS_REPLY) { +- DEBUGP("ctinfo = %u, skipping\n", ctinfo); +- return NF_ACCEPT; +- } +- +- /* not a complete TCP header? */ +- if (tcplen < sizeof(struct tcphdr) || tcplen < tcph->doff * 4) { +- DEBUGP("tcplen = %u\n", tcplen); +- return NF_ACCEPT; +- } +- +- /* checksum invalid? */ +- if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, +- csum_partial((char *) tcph, tcplen, 0))) { +- printk(KERN_NOTICE __FILE__ ": bad csum\n"); +-// return NF_ACCEPT; +- } +- +- if (tcph->fin || tcph->rst) { +- DEBUGP("RST/FIN received, timeouting GRE\n"); +- /* can't do this after real newnat */ +- info->cstate = PPTP_CALL_NONE; +- +- /* untrack this call id, unexpect GRE packets */ +- pptp_timeout_related(ct); +- /* no need to call unexpect_related since master conn +- * dies anyway */ +- } +- +- +- pptph = (struct pptp_pkt_hdr *) ((void *) tcph + tcph->doff * 4); +- datalimit = (void *) pptph + datalen; +- +- /* not a full pptp packet header? */ +- if ((void *) pptph+sizeof(*pptph) >= datalimit) { +- DEBUGP("no full PPTP header, can't track\n"); +- return NF_ACCEPT; +- } +- +- /* if it's not a control message we can't do anything with it */ +- if (ntohs(pptph->packetType) != PPTP_PACKET_CONTROL || +- ntohl(pptph->magicCookie) != PPTP_MAGIC_COOKIE) { +- DEBUGP("not a control packet\n"); +- return NF_ACCEPT; +- } +- +- oldsstate = info->sstate; +- oldcstate = info->cstate; +- +- LOCK_BH(&ip_pptp_lock); +- +- if (dir == IP_CT_DIR_ORIGINAL) +- /* client -> server (PNS -> PAC) */ +- ret = pptp_outbound_pkt(tcph, pptph, datalen, ct, ctinfo); +- else +- /* server -> client (PAC -> PNS) */ +- ret = pptp_inbound_pkt(tcph, pptph, datalen, ct, ctinfo); +- DEBUGP("sstate: %d->%d, cstate: %d->%d\n", +- oldsstate, info->sstate, oldcstate, info->cstate); +- UNLOCK_BH(&ip_pptp_lock); +- +- return ret; +-} +- +-/* control protocol helper */ +-static struct ip_conntrack_helper pptp = { +- { NULL, NULL }, +- "pptp", IP_CT_HELPER_F_REUSE_EXPECT, THIS_MODULE, 2, 0, +- { { 0, { tcp: { port: __constant_htons(PPTP_CONTROL_PORT) } } }, +- { 0, { 0 }, IPPROTO_TCP } }, +- { { 0, { tcp: { port: 0xffff } } }, +- { 0, { 0 }, 0xffff } }, +- conntrack_pptp_help }; +- +-/* ip_conntrack_pptp initialization */ +-static int __init init(void) +-{ +- int retcode; +- +- DEBUGP(__FILE__ ": registering helper\n"); +- if ((retcode = ip_conntrack_helper_register(&pptp))) { +- printk(KERN_ERR "Unable to register conntrack application " +- "helper for pptp: %d\n", retcode); +- return -EIO; +- } +- +- return 0; +-} +- +-static void __exit fini(void) +-{ +- ip_conntrack_helper_unregister(&pptp); +-} +- +-module_init(init); +-module_exit(fini); +- +-EXPORT_SYMBOL(ip_pptp_lock); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_pptp_priv.h src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_pptp_priv.h +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_pptp_priv.h 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_pptp_priv.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,24 +0,0 @@ +-#ifndef _IP_CT_PPTP_PRIV_H +-#define _IP_CT_PPTP_PRIV_H +- +-/* PptpControlMessageType names */ +-static const char *strMName[] = { +- "UNKNOWN_MESSAGE", +- "START_SESSION_REQUEST", +- "START_SESSION_REPLY", +- "STOP_SESSION_REQUEST", +- "STOP_SESSION_REPLY", +- "ECHO_REQUEST", +- "ECHO_REPLY", +- "OUT_CALL_REQUEST", +- "OUT_CALL_REPLY", +- "IN_CALL_REQUEST", +- "IN_CALL_REPLY", +- "IN_CALL_CONNECT", +- "CALL_CLEAR_REQUEST", +- "CALL_DISCONNECT_NOTIFY", +- "WAN_ERROR_NOTIFY", +- "SET_LINK_INFO" +-}; +- +-#endif +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_proto_gre.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_proto_gre.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_proto_gre.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_proto_gre.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,320 +0,0 @@ +-/* +- * ip_conntrack_proto_gre.c - Version 1.11 +- * +- * Connection tracking protocol helper module for GRE. +- * +- * GRE is a generic encapsulation protocol, which is generally not very +- * suited for NAT, as it has no protocol-specific part as port numbers. +- * +- * It has an optional key field, which may help us distinguishing two +- * connections between the same two hosts. +- * +- * GRE is defined in RFC 1701 and RFC 1702, as well as RFC 2784 +- * +- * PPTP is built on top of a modified version of GRE, and has a mandatory +- * field called "CallID", which serves us for the same purpose as the key +- * field in plain GRE. +- * +- * Documentation about PPTP can be found in RFC 2637 +- * +- * (C) 2000-2002 by Harald Welte +- * +- * Development of this code funded by Astaro AG (http://www.astaro.com/) +- * +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-DECLARE_RWLOCK(ip_ct_gre_lock); +-#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_ct_gre_lock) +-#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_ct_gre_lock) +- +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Harald Welte "); +-MODULE_DESCRIPTION("netfilter connection tracking protocol helper for GRE"); +- +-/* shamelessly stolen from ip_conntrack_proto_udp.c */ +-#define GRE_TIMEOUT (30*HZ) +-#define GRE_STREAM_TIMEOUT (180*HZ) +- +-#define DEBUGP(x, args...) +-#define DUMP_TUPLE_GRE(x) +- +-/* GRE KEYMAP HANDLING FUNCTIONS */ +-static LIST_HEAD(gre_keymap_list); +- +-static inline int gre_key_cmpfn(const struct ip_ct_gre_keymap *km, +- const struct ip_conntrack_tuple *t) +-{ +- return ((km->tuple.src.ip == t->src.ip) && +- (km->tuple.dst.ip == t->dst.ip) && +- (km->tuple.dst.protonum == t->dst.protonum) && +- (km->tuple.dst.u.all == t->dst.u.all)); +-} +- +-/* look up the source key for a given tuple */ +-static u_int32_t gre_keymap_lookup(struct ip_conntrack_tuple *t) +-{ +- struct ip_ct_gre_keymap *km; +- u_int32_t key; +- +- READ_LOCK(&ip_ct_gre_lock); +- km = LIST_FIND(&gre_keymap_list, gre_key_cmpfn, +- struct ip_ct_gre_keymap *, t); +- if (!km) { +- READ_UNLOCK(&ip_ct_gre_lock); +- return 0; +- } +- +- key = km->tuple.src.u.gre.key; +- READ_UNLOCK(&ip_ct_gre_lock); +- +- return key; +-} +- +-/* add a single keymap entry, associate with specified expect */ +-int ip_ct_gre_keymap_add(struct ip_conntrack_expect *exp, +- struct ip_conntrack_tuple *t, int reply) +-{ +- struct ip_ct_gre_keymap *km; +- +- km = kmalloc(sizeof(*km), GFP_ATOMIC); +- if (!km) +- return -1; +- +- /* initializing list head should be sufficient */ +- memset(km, 0, sizeof(*km)); +- +- memcpy(&km->tuple, t, sizeof(*t)); +- km->master = exp; +- +- if (!reply) +- exp->proto.gre.keymap_orig = km; +- else +- exp->proto.gre.keymap_reply = km; +- +- DEBUGP("adding new entry %p: ", km); +- DUMP_TUPLE_GRE(&km->tuple); +- +- WRITE_LOCK(&ip_ct_gre_lock); +- list_append(&gre_keymap_list, km); +- WRITE_UNLOCK(&ip_ct_gre_lock); +- +- return 0; +-} +- +-/* change the tuple of a keymap entry (used by nat helper) */ +-void ip_ct_gre_keymap_change(struct ip_ct_gre_keymap *km, +- struct ip_conntrack_tuple *t) +-{ +- DEBUGP("changing entry %p to: ", km); +- DUMP_TUPLE_GRE(t); +- +- WRITE_LOCK(&ip_ct_gre_lock); +- memcpy(&km->tuple, t, sizeof(km->tuple)); +- WRITE_UNLOCK(&ip_ct_gre_lock); +-} +- +- +-/* PUBLIC CONNTRACK PROTO HELPER FUNCTIONS */ +- +-/* invert gre part of tuple */ +-static int gre_invert_tuple(struct ip_conntrack_tuple *tuple, +- const struct ip_conntrack_tuple *orig) +-{ +- tuple->dst.u.gre.protocol = orig->dst.u.gre.protocol; +- tuple->dst.u.gre.version = orig->dst.u.gre.version; +- +- tuple->dst.u.gre.key = orig->src.u.gre.key; +- tuple->src.u.gre.key = orig->dst.u.gre.key; +- +- return 1; +-} +- +-/* gre hdr info to tuple */ +-static int gre_pkt_to_tuple(const void *datah, size_t datalen, +- struct ip_conntrack_tuple *tuple) +-{ +- struct gre_hdr *grehdr = (struct gre_hdr *) datah; +- struct gre_hdr_pptp *pgrehdr = (struct gre_hdr_pptp *) datah; +- u_int32_t srckey; +- +- /* core guarantees 8 protocol bytes, no need for size check */ +- +- tuple->dst.u.gre.version = grehdr->version; +- tuple->dst.u.gre.protocol = grehdr->protocol; +- +- switch (grehdr->version) { +- case GRE_VERSION_1701: +- if (!grehdr->key) { +- DEBUGP("Can't track GRE without key\n"); +- return 0; +- } +- tuple->dst.u.gre.key = *(gre_key(grehdr)); +- break; +- +- case GRE_VERSION_PPTP: +- if (ntohs(grehdr->protocol) != GRE_PROTOCOL_PPTP) { +- DEBUGP("GRE_VERSION_PPTP but unknown proto\n"); +- return 0; +- } +- tuple->dst.u.gre.key = htonl(ntohs(pgrehdr->call_id)); +- break; +- +- default: +- printk(KERN_WARNING "unknown GRE version %hu\n", +- tuple->dst.u.gre.version); +- return 0; +- } +- +- srckey = gre_keymap_lookup(tuple); +- +- tuple->src.u.gre.key = srckey; +- +- return 1; +-} +- +-/* print gre part of tuple */ +-static unsigned int gre_print_tuple(char *buffer, +- const struct ip_conntrack_tuple *tuple) +-{ +- return sprintf(buffer, "version=%d protocol=0x%04x srckey=0x%x dstkey=0x%x ", +- tuple->dst.u.gre.version, +- ntohs(tuple->dst.u.gre.protocol), +- ntohl(tuple->src.u.gre.key), +- ntohl(tuple->dst.u.gre.key)); +-} +- +-/* print private data for conntrack */ +-static unsigned int gre_print_conntrack(char *buffer, +- const struct ip_conntrack *ct) +-{ +- return sprintf(buffer, "timeout=%u, stream_timeout=%u ", +- (ct->proto.gre.timeout / HZ), +- (ct->proto.gre.stream_timeout / HZ)); +-} +- +-/* Returns verdict for packet, and may modify conntrack */ +-static int gre_packet(struct ip_conntrack *ct, +- struct iphdr *iph, size_t len, +- enum ip_conntrack_info conntrackinfo) +-{ +- /* If we've seen traffic both ways, this is a GRE connection. +- * Extend timeout. */ +- if (ct->status & IPS_SEEN_REPLY) { +- ip_ct_refresh(ct, ct->proto.gre.stream_timeout); +- /* Also, more likely to be important, and not a probe. */ +- set_bit(IPS_ASSURED_BIT, &ct->status); +- } else +- ip_ct_refresh(ct, ct->proto.gre.timeout); +- +- return NF_ACCEPT; +-} +- +-/* Called when a new connection for this protocol found. */ +-static int gre_new(struct ip_conntrack *ct, +- struct iphdr *iph, size_t len) +-{ +- DEBUGP(": "); +- DUMP_TUPLE_GRE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- +- /* initialize to sane value. Ideally a conntrack helper +- * (e.g. in case of pptp) is increasing them */ +- ct->proto.gre.stream_timeout = GRE_STREAM_TIMEOUT; +- ct->proto.gre.timeout = GRE_TIMEOUT; +- +- return 1; +-} +- +-/* Called when a conntrack entry has already been removed from the hashes +- * and is about to be deleted from memory */ +-static void gre_destroy(struct ip_conntrack *ct) +-{ +- struct ip_conntrack_expect *master = ct->master; +- +- DEBUGP(" entering\n"); +- +- if (!master) { +- DEBUGP("no master exp for ct %p\n", ct); +- return; +- } +- +- WRITE_LOCK(&ip_ct_gre_lock); +- if (master->proto.gre.keymap_orig) { +- DEBUGP("removing %p from list\n", master->proto.gre.keymap_orig); +- list_del(&master->proto.gre.keymap_orig->list); +- kfree(master->proto.gre.keymap_orig); +- } +- if (master->proto.gre.keymap_reply) { +- DEBUGP("removing %p from list\n", master->proto.gre.keymap_reply); +- list_del(&master->proto.gre.keymap_reply->list); +- kfree(master->proto.gre.keymap_reply); +- } +- WRITE_UNLOCK(&ip_ct_gre_lock); +-} +- +-/* protocol helper struct */ +-static struct ip_conntrack_protocol gre = { { NULL, NULL }, IPPROTO_GRE, +- "gre", +- gre_pkt_to_tuple, +- gre_invert_tuple, +- gre_print_tuple, +- gre_print_conntrack, +- gre_packet, +- gre_new, +- gre_destroy, +- NULL, +- THIS_MODULE }; +- +-/* ip_conntrack_proto_gre initialization */ +-static int __init init(void) +-{ +- int retcode; +- +- if ((retcode = ip_conntrack_protocol_register(&gre))) { +- printk(KERN_ERR "Unable to register conntrack protocol " +- "helper for gre: %d\n", retcode); +- return -EIO; +- } +- +- return 0; +-} +- +-static void __exit fini(void) +-{ +- struct list_head *pos, *n; +- +- /* delete all keymap entries */ +- WRITE_LOCK(&ip_ct_gre_lock); +- list_for_each_safe(pos, n, &gre_keymap_list) { +- DEBUGP("deleting keymap %p\n", pos); +- list_del(pos); +- kfree(pos); +- } +- WRITE_UNLOCK(&ip_ct_gre_lock); +- +- ip_conntrack_protocol_unregister(&gre); +-} +- +-EXPORT_SYMBOL(ip_ct_gre_keymap_add); +-EXPORT_SYMBOL(ip_ct_gre_keymap_change); +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_proto_tcp.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2003-08-12 07:33:45.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2004-05-09 04:13:03.000000000 -0400 +@@ -15,11 +15,17 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + /* Protects conntrack->proto.tcp */ + static DECLARE_RWLOCK(tcp_lock); + ++/* FIXME: Examine ipfilter's timeouts and conntrack transitions more ++ closely. They're more complex. --RR */ + + /* Actually, I believe that neither ipmasq (where this code is stolen + from) nor ipfilter do it exactly right. A new conntrack machine taking +@@ -39,6 +45,25 @@ + "LISTEN" + }; + ++#define SECS *HZ ++#define MINS * 60 SECS ++#define HOURS * 60 MINS ++#define DAYS * 24 HOURS ++ ++ ++static unsigned long tcp_timeouts[] ++= { 30 MINS, /* TCP_CONNTRACK_NONE, */ ++ 5 DAYS, /* TCP_CONNTRACK_ESTABLISHED, */ ++ 2 MINS, /* TCP_CONNTRACK_SYN_SENT, */ ++ 60 SECS, /* TCP_CONNTRACK_SYN_RECV, */ ++ 2 MINS, /* TCP_CONNTRACK_FIN_WAIT, */ ++ 2 MINS, /* TCP_CONNTRACK_TIME_WAIT, */ ++ 10 SECS, /* TCP_CONNTRACK_CLOSE, */ ++ 60 SECS, /* TCP_CONNTRACK_CLOSE_WAIT, */ ++ 30 SECS, /* TCP_CONNTRACK_LAST_ACK, */ ++ 2 MINS, /* TCP_CONNTRACK_LISTEN, */ ++}; ++ + #define sNO TCP_CONNTRACK_NONE + #define sES TCP_CONNTRACK_ESTABLISHED + #define sSS TCP_CONNTRACK_SYN_SENT +@@ -161,13 +186,13 @@ + && tcph->syn && tcph->ack) + conntrack->proto.tcp.handshake_ack + = htonl(ntohl(tcph->seq) + 1); ++ WRITE_UNLOCK(&tcp_lock); + + /* If only reply is a RST, we can consider ourselves not to + have an established connection: this is a fairly common + problem case, so we can delete the conntrack + immediately. --RR */ + if (!(conntrack->status & IPS_SEEN_REPLY) && tcph->rst) { +- WRITE_UNLOCK(&tcp_lock); + if (del_timer(&conntrack->timeout)) + conntrack->timeout.function((unsigned long)conntrack); + } else { +@@ -178,9 +203,7 @@ + && tcph->ack_seq == conntrack->proto.tcp.handshake_ack) + set_bit(IPS_ASSURED_BIT, &conntrack->status); + +- WRITE_UNLOCK(&tcp_lock); +- ip_ct_refresh(conntrack, +- sysctl_ip_conntrack_tcp_timeouts[newconntrack]); ++ ip_ct_refresh(conntrack, tcp_timeouts[newconntrack]); + } + + return NF_ACCEPT; +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_proto_udp.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_proto_udp.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2003-08-12 07:33:45.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2004-05-09 04:13:03.000000000 -0400 +@@ -5,7 +5,9 @@ + #include + #include + #include +-#include ++ ++#define UDP_TIMEOUT (30*HZ) ++#define UDP_STREAM_TIMEOUT (180*HZ) + + static int udp_pkt_to_tuple(const void *datah, size_t datalen, + struct ip_conntrack_tuple *tuple) +@@ -50,13 +52,11 @@ + /* If we've seen traffic both ways, this is some kind of UDP + stream. Extend timeout. */ + if (conntrack->status & IPS_SEEN_REPLY) { +- ip_ct_refresh(conntrack, +- sysctl_ip_conntrack_udp_timeouts[UDP_STREAM_TIMEOUT]); ++ ip_ct_refresh(conntrack, UDP_STREAM_TIMEOUT); + /* Also, more likely to be important, and not a probe */ + set_bit(IPS_ASSURED_BIT, &conntrack->status); + } else +- ip_ct_refresh(conntrack, +- sysctl_ip_conntrack_udp_timeouts[UDP_TIMEOUT]); ++ ip_ct_refresh(conntrack, UDP_TIMEOUT); + + return NF_ACCEPT; + } +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_standalone.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_standalone.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_standalone.c 2003-08-12 07:33:45.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_standalone.c 2004-05-09 04:13:03.000000000 -0400 +@@ -27,7 +27,11 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + struct module *ip_conntrack_module = THIS_MODULE; + MODULE_LICENSE("GPL"); +@@ -52,17 +56,12 @@ + return len; + } + ++/* FIXME: Don't print source proto part. --RR */ + static unsigned int + print_expect(char *buffer, const struct ip_conntrack_expect *expect) + { + unsigned int len; + +- if (!expect || !expect->expectant || !expect->expectant->helper) { +- DEBUGP("expect %x expect->expectant %x expect->expectant->helper %x\n", +- expect, expect->expectant, expect->expectant->helper); +- return 0; +- } +- + if (expect->expectant->helper->timeout) + len = sprintf(buffer, "EXPECTING: %lu ", + timer_pending(&expect->timeout) +@@ -294,6 +293,8 @@ + return ret; + } + ++/* FIXME: Allow NULL functions and sub in pointers to generic for ++ them. --RR */ + int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto) + { + int ret = 0; +@@ -362,8 +363,6 @@ + EXPORT_SYMBOL(ip_ct_find_proto); + EXPORT_SYMBOL(__ip_ct_find_proto); + EXPORT_SYMBOL(ip_ct_find_helper); +-EXPORT_SYMBOL(sysctl_ip_conntrack_tcp_timeouts); +-EXPORT_SYMBOL(sysctl_ip_conntrack_udp_timeouts); + EXPORT_SYMBOL(ip_conntrack_expect_related); + EXPORT_SYMBOL(ip_conntrack_change_expect); + EXPORT_SYMBOL(ip_conntrack_unexpect_related); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_conntrack_tftp.c src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_tftp.c +--- src/linux/linux/net/ipv4/netfilter/ip_conntrack_tftp.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_conntrack_tftp.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,126 +0,0 @@ +-/* +- * Licensed under GNU GPL version 2 Copyright Magnus Boden +- * Version: 0.0.7 +- * +- * Thu 21 Mar 2002 Harald Welte +- * - port to newnat API +- * +- */ +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-MODULE_AUTHOR("Magnus Boden "); +-MODULE_DESCRIPTION("Netfilter connection tracking module for tftp"); +-MODULE_LICENSE("GPL"); +- +-#define MAX_PORTS 8 +-static int ports[MAX_PORTS]; +-static int ports_c = 0; +-#ifdef MODULE_PARM +-MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); +-MODULE_PARM_DESC(ports, "port numbers of tftp servers"); +-#endif +- +-#define DEBUGP(format, args...) +- +-static int tftp_help(const struct iphdr *iph, size_t len, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo) +-{ +- struct udphdr *udph = (void *)iph + iph->ihl * 4; +- struct tftphdr *tftph = (void *)udph + 8; +- struct ip_conntrack_expect exp; +- +- switch (ntohs(tftph->opcode)) { +- /* RRQ and WRQ works the same way */ +- case TFTP_OPCODE_READ: +- case TFTP_OPCODE_WRITE: +- DEBUGP(""); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); +- memset(&exp, 0, sizeof(exp)); +- +- exp.tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; +- exp.mask.src.ip = 0xffffffff; +- exp.mask.dst.ip = 0xffffffff; +- exp.mask.dst.u.udp.port = 0xffff; +- exp.mask.dst.protonum = 0xffff; +- exp.expectfn = NULL; +- +- DEBUGP("expect: "); +- DUMP_TUPLE(&exp.tuple); +- DUMP_TUPLE(&exp.mask); +- ip_conntrack_expect_related(ct, &exp); +- break; +- default: +- DEBUGP("Unknown opcode\n"); +- } +- return NF_ACCEPT; +-} +- +-static struct ip_conntrack_helper tftp[MAX_PORTS]; +-static char tftp_names[MAX_PORTS][10]; +- +-static void fini(void) +-{ +- int i; +- +- for (i = 0 ; i < ports_c; i++) { +- DEBUGP("unregistering helper for port %d\n", +- ports[i]); +- ip_conntrack_helper_unregister(&tftp[i]); +- } +-} +- +-static int __init init(void) +-{ +- int i, ret; +- char *tmpname; +- +- if (!ports[0]) +- ports[0]=TFTP_PORT; +- +- for (i = 0 ; (i < MAX_PORTS) && ports[i] ; i++) { +- /* Create helper structure */ +- memset(&tftp[i], 0, sizeof(struct ip_conntrack_helper)); +- +- tftp[i].tuple.dst.protonum = IPPROTO_UDP; +- tftp[i].tuple.src.u.udp.port = htons(ports[i]); +- tftp[i].mask.dst.protonum = 0xFFFF; +- tftp[i].mask.src.u.udp.port = 0xFFFF; +- tftp[i].max_expected = 1; +- tftp[i].timeout = 0; +- tftp[i].flags = IP_CT_HELPER_F_REUSE_EXPECT; +- tftp[i].me = THIS_MODULE; +- tftp[i].help = tftp_help; +- +- tmpname = &tftp_names[i][0]; +- if (ports[i] == TFTP_PORT) +- sprintf(tmpname, "tftp"); +- else +- sprintf(tmpname, "tftp-%d", i); +- tftp[i].name = tmpname; +- +- DEBUGP("port #%d: %d\n", i, ports[i]); +- +- ret=ip_conntrack_helper_register(&tftp[i]); +- if (ret) { +- printk("ERROR registering helper for port %d\n", +- ports[i]); +- fini(); +- return(ret); +- } +- ports_c++; +- } +- return(0); +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_core.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_core.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_core.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_core.c 2004-05-09 04:13:03.000000000 -0400 +@@ -31,7 +31,11 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + DECLARE_RWLOCK(ip_nat_lock); + DECLARE_RWLOCK_EXTERN(ip_conntrack_lock); +@@ -207,6 +211,7 @@ + { + struct rtable *rt; + ++ /* FIXME: IPTOS_TOS(iph->tos) --RR */ + if (ip_route_output(&rt, var_ip, 0, 0, 0) != 0) { + DEBUGP("do_extra_mangle: Can't get route to %u.%u.%u.%u\n", + NIPQUAD(var_ip)); +@@ -429,7 +434,7 @@ + *tuple = *orig_tuple; + while ((rptr = find_best_ips_proto_fast(tuple, mr, conntrack, hooknum)) + != NULL) { +- DEBUGP("Found best for "); DUMP_TUPLE_RAW(tuple); ++ DEBUGP("Found best for "); DUMP_TUPLE(tuple); + /* 3) The per-protocol part of the manip is made to + map into the range to make a unique tuple. */ + +@@ -529,6 +534,31 @@ + invert_tuplepr(&orig_tp, + &conntrack->tuplehash[IP_CT_DIR_REPLY].tuple); + ++#if 0 ++ { ++ unsigned int i; ++ ++ DEBUGP("Hook %u (%s), ", hooknum, ++ HOOK2MANIP(hooknum)==IP_NAT_MANIP_SRC ? "SRC" : "DST"); ++ DUMP_TUPLE(&orig_tp); ++ DEBUGP("Range %p: ", mr); ++ for (i = 0; i < mr->rangesize; i++) { ++ DEBUGP("%u:%s%s%s %u.%u.%u.%u - %u.%u.%u.%u %u - %u\n", ++ i, ++ (mr->range[i].flags & IP_NAT_RANGE_MAP_IPS) ++ ? " MAP_IPS" : "", ++ (mr->range[i].flags ++ & IP_NAT_RANGE_PROTO_SPECIFIED) ++ ? " PROTO_SPECIFIED" : "", ++ (mr->range[i].flags & IP_NAT_RANGE_FULL) ++ ? " FULL" : "", ++ NIPQUAD(mr->range[i].min_ip), ++ NIPQUAD(mr->range[i].max_ip), ++ mr->range[i].min.all, ++ mr->range[i].max.all); ++ } ++ } ++#endif + + do { + if (!get_unique_tuple(&new_tuple, &orig_tp, mr, conntrack, +@@ -538,6 +568,15 @@ + return NF_DROP; + } + ++#if 0 ++ DEBUGP("Hook %u (%s) %p\n", hooknum, ++ HOOK2MANIP(hooknum)==IP_NAT_MANIP_SRC ? "SRC" : "DST", ++ conntrack); ++ DEBUGP("Original: "); ++ DUMP_TUPLE(&orig_tp); ++ DEBUGP("New: "); ++ DUMP_TUPLE(&new_tuple); ++#endif + + /* We now have two tuples (SRCIP/SRCPT/DSTIP/DSTPT): + the original (A/B/C/D') and the mangled one (E/F/G/H'). +@@ -554,6 +593,8 @@ + If fail this race (reply tuple now used), repeat. */ + } while (!ip_conntrack_alter_reply(conntrack, &reply)); + ++ /* FIXME: We can simply used existing conntrack reply tuple ++ here --RR */ + /* Create inverse of original: C/D/A/B' */ + invert_tuplepr(&inv_tuple, &orig_tp); + +@@ -678,6 +719,17 @@ + iph->check); + iph->daddr = manip->ip; + } ++#if 0 ++ if (ip_fast_csum((u8 *)iph, iph->ihl) != 0) ++ DEBUGP("IP: checksum on packet bad.\n"); ++ ++ if (proto == IPPROTO_TCP) { ++ void *th = (u_int32_t *)iph + iph->ihl; ++ if (tcp_v4_check(th, len - 4*iph->ihl, iph->saddr, iph->daddr, ++ csum_partial((char *)th, len-4*iph->ihl, 0))) ++ DEBUGP("TCP: checksum on packet bad\n"); ++ } ++#endif + } + + static inline int exp_for_packet(struct ip_conntrack_expect *exp, +@@ -765,6 +817,7 @@ + continue; + + if (exp_for_packet(exp, pskb)) { ++ /* FIXME: May be true multiple times in the case of UDP!! */ + DEBUGP("calling nat helper (exp=%p) for packet\n", + exp); + ret = helper->help(ct, exp, info, ctinfo, +@@ -926,6 +979,7 @@ + INIT_LIST_HEAD(&byipsproto[i]); + } + ++ /* FIXME: Man, this is a hack. */ + IP_NF_ASSERT(ip_conntrack_destroyed == NULL); + ip_conntrack_destroyed = &ip_nat_cleanup_conntrack; + +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_h323.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_h323.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_h323.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_h323.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,403 +0,0 @@ +-/* +- * H.323 'brute force' extension for NAT alteration. +- * Jozsef Kadlecsik +- * +- * Based on ip_masq_h323.c for 2.2 kernels from CoRiTel, Sofia project. +- * (http://www.coritel.it/projects/sofia/nat.html) +- * Uses Sampsa Ranta's excellent idea on using expectfn to 'bind' +- * the unregistered helpers to the conntrack entries. +- */ +- +- +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-MODULE_AUTHOR("Jozsef Kadlecsik "); +-MODULE_DESCRIPTION("H.323 'brute force' connection tracking module"); +-MODULE_LICENSE("GPL"); +- +-DECLARE_LOCK_EXTERN(ip_h323_lock); +-struct module *ip_nat_h323 = THIS_MODULE; +- +-#define DEBUGP(format, args...) +- +- +-static unsigned int +-h225_nat_expected(struct sk_buff **pskb, +- unsigned int hooknum, +- struct ip_conntrack *ct, +- struct ip_nat_info *info); +- +-static unsigned int h225_nat_help(struct ip_conntrack *ct, +- struct ip_conntrack_expect *exp, +- struct ip_nat_info *info, +- enum ip_conntrack_info ctinfo, +- unsigned int hooknum, +- struct sk_buff **pskb); +- +-static struct ip_nat_helper h245 = +- { { NULL, NULL }, +- "H.245", /* name */ +- 0, /* flags */ +- NULL, /* module */ +- { { 0, { 0 } }, /* tuple */ +- { 0, { 0 }, IPPROTO_TCP } }, +- { { 0, { 0xFFFF } }, /* mask */ +- { 0, { 0 }, 0xFFFF } }, +- h225_nat_help, /* helper */ +- h225_nat_expected /* expectfn */ +- }; +- +-static unsigned int +-h225_nat_expected(struct sk_buff **pskb, +- unsigned int hooknum, +- struct ip_conntrack *ct, +- struct ip_nat_info *info) +-{ +- struct ip_nat_multi_range mr; +- u_int32_t newdstip, newsrcip, newip; +- u_int16_t port; +- struct ip_ct_h225_expect *exp_info; +- struct ip_ct_h225_master *master_info; +- struct ip_conntrack *master = master_ct(ct); +- unsigned int is_h225, ret; +- +- IP_NF_ASSERT(info); +- IP_NF_ASSERT(master); +- +- IP_NF_ASSERT(!(info->initialized & (1<master->expectant->help.ct_h225_info; +- exp_info = &ct->master->help.exp_h225_info; +- +- LOCK_BH(&ip_h323_lock); +- +- DEBUGP("master: "); +- DUMP_TUPLE(&master->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- DUMP_TUPLE(&master->tuplehash[IP_CT_DIR_REPLY].tuple); +- DEBUGP("conntrack: "); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- if (exp_info->dir == IP_CT_DIR_ORIGINAL) { +- /* Make connection go to the client. */ +- newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; +- newsrcip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; +- DEBUGP("h225_nat_expected: %u.%u.%u.%u->%u.%u.%u.%u (to client)\n", +- NIPQUAD(newsrcip), NIPQUAD(newdstip)); +- } else { +- /* Make the connection go to the server */ +- newdstip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; +- newsrcip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- DEBUGP("h225_nat_expected: %u.%u.%u.%u->%u.%u.%u.%u (to server)\n", +- NIPQUAD(newsrcip), NIPQUAD(newdstip)); +- } +- port = exp_info->port; +- is_h225 = master_info->is_h225 == H225_PORT; +- UNLOCK_BH(&ip_h323_lock); +- +- if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) +- newip = newsrcip; +- else +- newip = newdstip; +- +- DEBUGP("h225_nat_expected: IP to %u.%u.%u.%u\n", NIPQUAD(newip)); +- +- mr.rangesize = 1; +- /* We don't want to manip the per-protocol, just the IPs... */ +- mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; +- mr.range[0].min_ip = mr.range[0].max_ip = newip; +- +- /* ... unless we're doing a MANIP_DST, in which case, make +- sure we map to the correct port */ +- if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_DST) { +- mr.range[0].flags |= IP_NAT_RANGE_PROTO_SPECIFIED; +- mr.range[0].min = mr.range[0].max +- = ((union ip_conntrack_manip_proto) +- { port }); +- } +- +- ret = ip_nat_setup_info(ct, &mr, hooknum); +- +- if (is_h225) { +- DEBUGP("h225_nat_expected: H.225, setting NAT helper for %p\n", ct); +- /* NAT expectfn called with ip_nat_lock write-locked */ +- info->helper = &h245; +- } +- return ret; +-} +- +-static int h323_signal_address_fixup(struct ip_conntrack *ct, +- struct sk_buff **pskb, +- enum ip_conntrack_info ctinfo) +-{ +- struct iphdr *iph = (*pskb)->nh.iph; +- struct tcphdr *tcph = (void *)iph + iph->ihl*4; +- unsigned char *data; +- u_int32_t tcplen = (*pskb)->len - iph->ihl*4; +- u_int32_t datalen = tcplen - tcph->doff*4; +- struct ip_ct_h225_master *info = &ct->help.ct_h225_info; +- u_int32_t newip; +- u_int16_t port; +- u_int8_t buffer[6]; +- int i; +- +- MUST_BE_LOCKED(&ip_h323_lock); +- +- DEBUGP("h323_signal_address_fixup: %s %s\n", +- between(info->seq[IP_CT_DIR_ORIGINAL], ntohl(tcph->seq), ntohl(tcph->seq) + datalen) +- ? "yes" : "no", +- between(info->seq[IP_CT_DIR_REPLY], ntohl(tcph->seq), ntohl(tcph->seq) + datalen) +- ? "yes" : "no"); +- if (!(between(info->seq[IP_CT_DIR_ORIGINAL], ntohl(tcph->seq), ntohl(tcph->seq) + datalen) +- || between(info->seq[IP_CT_DIR_REPLY], ntohl(tcph->seq), ntohl(tcph->seq) + datalen))) +- return 1; +- +- DEBUGP("h323_signal_address_fixup: offsets %u + 6 and %u + 6 in %u\n", +- info->offset[IP_CT_DIR_ORIGINAL], +- info->offset[IP_CT_DIR_REPLY], +- tcplen); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); +- +- for (i = 0; i < IP_CT_DIR_MAX; i++) { +- DEBUGP("h323_signal_address_fixup: %s %s\n", +- info->dir == IP_CT_DIR_ORIGINAL ? "original" : "reply", +- i == IP_CT_DIR_ORIGINAL ? "caller" : "callee"); +- if (!between(info->seq[i], ntohl(tcph->seq), +- ntohl(tcph->seq) + datalen)) +- continue; +- if (!between(info->seq[i] + 6, ntohl(tcph->seq), +- ntohl(tcph->seq) + datalen)) { +- /* Partial retransmisison. It's a cracker being funky. */ +- if (net_ratelimit()) { +- printk("H.323_NAT: partial packet %u/6 in %u/%u\n", +- info->seq[i], +- ntohl(tcph->seq), +- ntohl(tcph->seq) + datalen); +- } +- return 0; +- } +- +- /* Change address inside packet to match way we're mapping +- this connection. */ +- if (i == IP_CT_DIR_ORIGINAL) { +- newip = ct->tuplehash[!info->dir].tuple.dst.ip; +- port = ct->tuplehash[!info->dir].tuple.dst.u.tcp.port; +- } else { +- newip = ct->tuplehash[!info->dir].tuple.src.ip; +- port = ct->tuplehash[!info->dir].tuple.src.u.tcp.port; +- } +- +- data = (char *) tcph + tcph->doff * 4 + info->offset[i]; +- +- DEBUGP("h323_signal_address_fixup: orig %s IP:port %u.%u.%u.%u:%u\n", +- i == IP_CT_DIR_ORIGINAL ? "source" : "dest ", +- data[0], data[1], data[2], data[3], +- (data[4] << 8 | data[5])); +- +- /* Modify the packet */ +- memcpy(buffer, &newip, 4); +- memcpy(buffer + 4, &port, 2); +- if (!ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, info->offset[i], +- 6, buffer, 6)) +- return 0; +- +- DEBUGP("h323_signal_address_fixup: new %s IP:port %u.%u.%u.%u:%u\n", +- i == IP_CT_DIR_ORIGINAL ? "source" : "dest ", +- data[0], data[1], data[2], data[3], +- (data[4] << 8 | data[5])); +- } +- +- return 1; +-} +- +-static int h323_data_fixup(struct ip_ct_h225_expect *info, +- struct ip_conntrack *ct, +- struct sk_buff **pskb, +- enum ip_conntrack_info ctinfo, +- struct ip_conntrack_expect *expect) +-{ +- u_int32_t newip; +- u_int16_t port; +- u_int8_t buffer[6]; +- struct ip_conntrack_tuple newtuple; +- struct iphdr *iph = (*pskb)->nh.iph; +- struct tcphdr *tcph = (void *)iph + iph->ihl*4; +- unsigned char *data; +- u_int32_t tcplen = (*pskb)->len - iph->ihl*4; +- struct ip_ct_h225_master *master_info = &ct->help.ct_h225_info; +- int is_h225; +- +- MUST_BE_LOCKED(&ip_h323_lock); +- DEBUGP("h323_data_fixup: offset %u + 6 in %u\n", info->offset, tcplen); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); +- +- if (!between(expect->seq + 6, ntohl(tcph->seq), +- ntohl(tcph->seq) + tcplen - tcph->doff * 4)) { +- /* Partial retransmisison. It's a cracker being funky. */ +- if (net_ratelimit()) { +- printk("H.323_NAT: partial packet %u/6 in %u/%u\n", +- expect->seq, +- ntohl(tcph->seq), +- ntohl(tcph->seq) + tcplen - tcph->doff * 4); +- } +- return 0; +- } +- +- /* Change address inside packet to match way we're mapping +- this connection. */ +- if (info->dir == IP_CT_DIR_REPLY) { +- /* Must be where client thinks server is */ +- newip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; +- /* Expect something from client->server */ +- newtuple.src.ip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; +- newtuple.dst.ip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; +- } else { +- /* Must be where server thinks client is */ +- newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- /* Expect something from server->client */ +- newtuple.src.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; +- newtuple.dst.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- } +- +- is_h225 = (master_info->is_h225 == H225_PORT); +- +- if (is_h225) { +- newtuple.dst.protonum = IPPROTO_TCP; +- newtuple.src.u.tcp.port = expect->tuple.src.u.tcp.port; +- } else { +- newtuple.dst.protonum = IPPROTO_UDP; +- newtuple.src.u.udp.port = expect->tuple.src.u.udp.port; +- } +- +- /* Try to get same port: if not, try to change it. */ +- for (port = ntohs(info->port); port != 0; port++) { +- if (is_h225) +- newtuple.dst.u.tcp.port = htons(port); +- else +- newtuple.dst.u.udp.port = htons(port); +- +- if (ip_conntrack_change_expect(expect, &newtuple) == 0) +- break; +- } +- if (port == 0) { +- DEBUGP("h323_data_fixup: no free port found!\n"); +- return 0; +- } +- +- port = htons(port); +- +- data = (char *) tcph + tcph->doff * 4 + info->offset; +- +- DEBUGP("h323_data_fixup: orig IP:port %u.%u.%u.%u:%u\n", +- data[0], data[1], data[2], data[3], +- (data[4] << 8 | data[5])); +- +- /* Modify the packet */ +- memcpy(buffer, &newip, 4); +- memcpy(buffer + 4, &port, 2); +- if (!ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, info->offset, +- 6, buffer, 6)) +- return 0; +- +- DEBUGP("h323_data_fixup: new IP:port %u.%u.%u.%u:%u\n", +- data[0], data[1], data[2], data[3], +- (data[4] << 8 | data[5])); +- +- return 1; +-} +- +-static unsigned int h225_nat_help(struct ip_conntrack *ct, +- struct ip_conntrack_expect *exp, +- struct ip_nat_info *info, +- enum ip_conntrack_info ctinfo, +- unsigned int hooknum, +- struct sk_buff **pskb) +-{ +- int dir; +- struct ip_ct_h225_expect *exp_info; +- +- /* Only mangle things once: original direction in POST_ROUTING +- and reply direction on PRE_ROUTING. */ +- dir = CTINFO2DIR(ctinfo); +- DEBUGP("nat_h323: dir %s at hook %s\n", +- dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", +- hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" +- : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" +- : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???"); +- if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) +- || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) { +- DEBUGP("nat_h323: Not touching dir %s at hook %s\n", +- dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", +- hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" +- : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" +- : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???"); +- return NF_ACCEPT; +- } +- +- if (!exp) { +- LOCK_BH(&ip_h323_lock); +- if (!h323_signal_address_fixup(ct, pskb, ctinfo)) { +- UNLOCK_BH(&ip_h323_lock); +- return NF_DROP; +- } +- UNLOCK_BH(&ip_h323_lock); +- return NF_ACCEPT; +- } +- +- exp_info = &exp->help.exp_h225_info; +- +- LOCK_BH(&ip_h323_lock); +- if (!h323_data_fixup(exp_info, ct, pskb, ctinfo, exp)) { +- UNLOCK_BH(&ip_h323_lock); +- return NF_DROP; +- } +- UNLOCK_BH(&ip_h323_lock); +- +- return NF_ACCEPT; +-} +- +-static struct ip_nat_helper h225 = +- { { NULL, NULL }, +- "H.225", /* name */ +- IP_NAT_HELPER_F_ALWAYS, /* flags */ +- THIS_MODULE, /* module */ +- { { 0, { __constant_htons(H225_PORT) } }, /* tuple */ +- { 0, { 0 }, IPPROTO_TCP } }, +- { { 0, { 0xFFFF } }, /* mask */ +- { 0, { 0 }, 0xFFFF } }, +- h225_nat_help, /* helper */ +- h225_nat_expected /* expectfn */ +- }; +- +-static int __init init(void) +-{ +- int ret; +- +- ret = ip_nat_helper_register(&h225); +- +- if (ret != 0) +- printk("ip_nat_h323: cannot initialize the module!\n"); +- +- return ret; +-} +- +-static void __exit fini(void) +-{ +- ip_nat_helper_unregister(&h225); +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_helper.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_helper.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_helper.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_helper.c 2004-05-09 04:13:03.000000000 -0400 +@@ -8,9 +8,6 @@ + * - add support for SACK adjustment + * 14 Mar 2002 Harald Welte : + * - merge SACK support into newnat API +- * 16 Aug 2002 Brian J. Murrell : +- * - make ip_nat_resize_packet more generic (TCP and UDP) +- * - add ip_nat_mangle_udp_packet + */ + #include + #include +@@ -25,7 +22,6 @@ + #include + #include + #include +-#include + + #define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock) + #define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock) +@@ -38,8 +34,13 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#define DUMP_OFFSET(x) printk("offset_before=%d, offset_after=%d, correction_pos=%u\n", x->offset_before, x->offset_after, x->correction_pos); ++#else + #define DEBUGP(format, args...) + #define DUMP_OFFSET(x) ++#endif + + DECLARE_LOCK(ip_nat_seqofs_lock); + +@@ -50,12 +51,18 @@ + int new_size) + { + struct iphdr *iph; ++ struct tcphdr *tcph; ++ void *data; + int dir; + struct ip_nat_seq *this_way, *other_way; + + DEBUGP("ip_nat_resize_packet: old_size = %u, new_size = %u\n", + (*skb)->len, new_size); + ++ iph = (*skb)->nh.iph; ++ tcph = (void *)iph + iph->ihl*4; ++ data = (void *)tcph + tcph->doff*4; ++ + dir = CTINFO2DIR(ctinfo); + + this_way = &ct->nat.info.seq[dir]; +@@ -77,9 +84,8 @@ + } + + iph = (*skb)->nh.iph; +- if (iph->protocol == IPPROTO_TCP) { +- struct tcphdr *tcph = (void *)iph + iph->ihl*4; +- void *data = (void *)tcph + tcph->doff*4; ++ tcph = (void *)iph + iph->ihl*4; ++ data = (void *)tcph + tcph->doff*4; + + DEBUGP("ip_nat_resize_packet: Seq_offset before: "); + DUMP_OFFSET(this_way); +@@ -95,20 +101,25 @@ + this_way->correction_pos = ntohl(tcph->seq); + this_way->offset_before = this_way->offset_after; + this_way->offset_after = (int32_t) +- this_way->offset_before + new_size - +- (*skb)->len; ++ this_way->offset_before + new_size - (*skb)->len; + } + + UNLOCK_BH(&ip_nat_seqofs_lock); + + DEBUGP("ip_nat_resize_packet: Seq_offset after: "); + DUMP_OFFSET(this_way); +- } + + return 1; + } + + ++/* Generic function for mangling variable-length address changes inside ++ * NATed connections (like the PORT XXX,XXX,XXX,XXX,XXX,XXX command in FTP). ++ * ++ * Takes care about all the nasty sequence number changes, checksumming, ++ * skb enlargement, ... ++ * ++ * */ + int + ip_nat_mangle_tcp_packet(struct sk_buff **skb, + struct ip_conntrack *ct, +@@ -163,7 +174,6 @@ + tcph = (void *)iph + iph->ihl*4; + data = (void *)tcph + tcph->doff*4; + +- if (rep_len != match_len) + /* move post-replacement */ + memmove(data + match_offset + rep_len, + data + match_offset + match_len, +@@ -198,104 +208,6 @@ + return 1; + } + +-int +-ip_nat_mangle_udp_packet(struct sk_buff **skb, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo, +- unsigned int match_offset, +- unsigned int match_len, +- char *rep_buffer, +- unsigned int rep_len) +-{ +- struct iphdr *iph = (*skb)->nh.iph; +- struct udphdr *udph = (void *)iph + iph->ihl * 4; +- unsigned char *data; +- u_int32_t udplen, newlen, newudplen; +- +- udplen = (*skb)->len - iph->ihl*4; +- newudplen = udplen - match_len + rep_len; +- newlen = iph->ihl*4 + newudplen; +- +- if (newlen > 65535) { +- if (net_ratelimit()) +- printk("ip_nat_mangle_udp_packet: nat'ed packet " +- "exceeds maximum packet size\n"); +- return 0; +- } +- +- if ((*skb)->len != newlen) { +- if (!ip_nat_resize_packet(skb, ct, ctinfo, newlen)) { +- printk("resize_packet failed!!\n"); +- return 0; +- } +- } +- +- /* Alexey says: if a hook changes _data_ ... it can break +- original packet sitting in tcp queue and this is fatal */ +- if (skb_cloned(*skb)) { +- struct sk_buff *nskb = skb_copy(*skb, GFP_ATOMIC); +- if (!nskb) { +- if (net_ratelimit()) +- printk("Out of memory cloning TCP packet\n"); +- return 0; +- } +- /* Rest of kernel will get very unhappy if we pass it +- a suddenly-orphaned skbuff */ +- if ((*skb)->sk) +- skb_set_owner_w(nskb, (*skb)->sk); +- kfree_skb(*skb); +- *skb = nskb; +- } +- +- /* skb may be copied !! */ +- iph = (*skb)->nh.iph; +- udph = (void *)iph + iph->ihl*4; +- data = (void *)udph + sizeof(struct udphdr); +- +- if (rep_len != match_len) +- /* move post-replacement */ +- memmove(data + match_offset + rep_len, +- data + match_offset + match_len, +- (*skb)->tail - (data + match_offset + match_len)); +- +- /* insert data from buffer */ +- memcpy(data + match_offset, rep_buffer, rep_len); +- +- /* update skb info */ +- if (newlen > (*skb)->len) { +- DEBUGP("ip_nat_mangle_udp_packet: Extending packet by " +- "%u to %u bytes\n", newlen - (*skb)->len, newlen); +- skb_put(*skb, newlen - (*skb)->len); +- } else { +- DEBUGP("ip_nat_mangle_udp_packet: Shrinking packet from " +- "%u to %u bytes\n", (*skb)->len, newlen); +- skb_trim(*skb, newlen); +- } +- +- /* update the length of the UDP and IP packets to the new values*/ +- udph->len = htons((*skb)->len - iph->ihl*4); +- iph->tot_len = htons(newlen); +- +- /* fix udp checksum if udp checksum was previously calculated */ +- if ((*skb)->csum != 0) { +- (*skb)->csum = csum_partial((char *)udph + +- sizeof(struct udphdr), +- newudplen - sizeof(struct udphdr), +- 0); +- +- udph->check = 0; +- udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr, +- newudplen, IPPROTO_UDP, +- csum_partial((char *)udph, +- sizeof(struct udphdr), +- (*skb)->csum)); +- } +- +- ip_send_check(iph); +- +- return 1; +-} +- + /* Adjust one found SACK option including checksum correction */ + static void + sack_adjust(struct tcphdr *tcph, +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_mms.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_mms.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_mms.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_mms.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,330 +0,0 @@ +-/* MMS extension for TCP NAT alteration. +- * (C) 2002 by Filip Sneppe +- * based on ip_nat_ftp.c and ip_nat_irc.c +- * +- * ip_nat_mms.c v0.3 2002-09-22 +- * +- * 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. +- * +- * Module load syntax: +- * insmod ip_nat_mms.o ports=port1,port2,...port +- * +- * Please give the ports of all MMS servers You wish to connect to. +- * If you don't specify ports, the default will be TCP port 1755. +- * +- * More info on MMS protocol, firewalls and NAT: +- * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/MMSFirewall.asp +- * http://www.microsoft.com/windows/windowsmedia/serve/firewall.asp +- * +- * The SDP project people are reverse-engineering MMS: +- * http://get.to/sdp +- */ +- +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DEBUGP(format, args...) +-#define DUMP_BYTES(address, counter) +- +-#define MAX_PORTS 8 +-static int ports[MAX_PORTS]; +-static int ports_c = 0; +- +-#ifdef MODULE_PARM +-MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); +-#endif +- +-MODULE_AUTHOR("Filip Sneppe "); +-MODULE_DESCRIPTION("Microsoft Windows Media Services (MMS) NAT module"); +-MODULE_LICENSE("GPL"); +- +-DECLARE_LOCK_EXTERN(ip_mms_lock); +- +- +-static int mms_data_fixup(const struct ip_ct_mms_expect *ct_mms_info, +- struct ip_conntrack *ct, +- struct sk_buff **pskb, +- enum ip_conntrack_info ctinfo, +- struct ip_conntrack_expect *expect) +-{ +- u_int32_t newip; +- struct ip_conntrack_tuple t; +- struct iphdr *iph = (*pskb)->nh.iph; +- struct tcphdr *tcph = (void *) iph + iph->ihl * 4; +- char *data = (char *)tcph + tcph->doff * 4; +- int i, j, k, port; +- u_int16_t mms_proto; +- +- u_int32_t *mms_chunkLenLV = (u_int32_t *)(data + MMS_SRV_CHUNKLENLV_OFFSET); +- u_int32_t *mms_chunkLenLM = (u_int32_t *)(data + MMS_SRV_CHUNKLENLM_OFFSET); +- u_int32_t *mms_messageLength = (u_int32_t *)(data + MMS_SRV_MESSAGELENGTH_OFFSET); +- +- int zero_padding; +- +- char buffer[28]; /* "\\255.255.255.255\UDP\65635" * 2 (for unicode) */ +- char unicode_buffer[75]; /* 27*2 (unicode) + 20 + 1 */ +- char proto_string[6]; +- +- MUST_BE_LOCKED(&ip_mms_lock); +- +- /* what was the protocol again ? */ +- mms_proto = expect->tuple.dst.protonum; +- sprintf(proto_string, "%u", mms_proto); +- +- DEBUGP("ip_nat_mms: mms_data_fixup: info (seq %u + %u) in %u, proto %s\n", +- expect->seq, ct_mms_info->len, ntohl(tcph->seq), +- mms_proto == IPPROTO_UDP ? "UDP" +- : mms_proto == IPPROTO_TCP ? "TCP":proto_string); +- +- newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- +- /* Alter conntrack's expectations. */ +- t = expect->tuple; +- t.dst.ip = newip; +- for (port = ct_mms_info->port; port != 0; port++) { +- t.dst.u.tcp.port = htons(port); +- if (ip_conntrack_change_expect(expect, &t) == 0) { +- DEBUGP("ip_nat_mms: mms_data_fixup: using port %d\n", port); +- break; +- } +- } +- +- if(port == 0) +- return 0; +- +- sprintf(buffer, "\\\\%u.%u.%u.%u\\%s\\%u", +- NIPQUAD(newip), +- expect->tuple.dst.protonum == IPPROTO_UDP ? "UDP" +- : expect->tuple.dst.protonum == IPPROTO_TCP ? "TCP":proto_string, +- port); +- DEBUGP("ip_nat_mms: new unicode string=%s\n", buffer); +- +- memset(unicode_buffer, 0, sizeof(char)*75); +- +- for (i=0; ipadding, ct_mms_info->len); +- DEBUGP("ip_nat_mms: mms_data_fixup: offset: %u\n", MMS_SRV_UNICODE_STRING_OFFSET+ct_mms_info->len); +- DUMP_BYTES(data+MMS_SRV_UNICODE_STRING_OFFSET, 60); +- +- /* add end of packet to it */ +- for (j=0; jpadding; ++j) { +- DEBUGP("ip_nat_mms: mms_data_fixup: i=%u j=%u byte=%u\n", +- i, j, (u8)*(data+MMS_SRV_UNICODE_STRING_OFFSET+ct_mms_info->len+j)); +- *(unicode_buffer+i*2+j) = *(data+MMS_SRV_UNICODE_STRING_OFFSET+ct_mms_info->len+j); +- } +- +- /* pad with zeroes at the end ? see explanation of weird math below */ +- zero_padding = (8-(strlen(buffer)*2 + ct_mms_info->padding + 4)%8)%8; +- for (k=0; k chunkLenLV=%u chunkLenLM=%u messageLength=%u\n", +- *mms_chunkLenLV, *mms_chunkLenLM, *mms_messageLength); +- +- /* explanation, before I forget what I did: +- strlen(buffer)*2 + ct_mms_info->padding + 4 must be divisable by 8; +- divide by 8 and add 3 to compute the mms_chunkLenLM field, +- but note that things may have to be padded with zeroes to align by 8 +- bytes, hence we add 7 and divide by 8 to get the correct length */ +- *mms_chunkLenLM = (u_int32_t) (3+(strlen(buffer)*2+ct_mms_info->padding+11)/8); +- *mms_chunkLenLV = *mms_chunkLenLM+2; +- *mms_messageLength = *mms_chunkLenLV*8; +- +- DEBUGP("ip_nat_mms: modified=> chunkLenLV=%u chunkLenLM=%u messageLength=%u\n", +- *mms_chunkLenLV, *mms_chunkLenLM, *mms_messageLength); +- +- ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, +- expect->seq - ntohl(tcph->seq), +- ct_mms_info->len + ct_mms_info->padding, unicode_buffer, +- strlen(buffer)*2 + ct_mms_info->padding + zero_padding); +- DUMP_BYTES(unicode_buffer, 60); +- +- return 1; +-} +- +-static unsigned int +-mms_nat_expected(struct sk_buff **pskb, +- unsigned int hooknum, +- struct ip_conntrack *ct, +- struct ip_nat_info *info) +-{ +- struct ip_nat_multi_range mr; +- u_int32_t newdstip, newsrcip, newip; +- +- struct ip_conntrack *master = master_ct(ct); +- +- IP_NF_ASSERT(info); +- IP_NF_ASSERT(master); +- +- IP_NF_ASSERT(!(info->initialized & (1 << HOOK2MANIP(hooknum)))); +- +- DEBUGP("ip_nat_mms: mms_nat_expected: We have a connection!\n"); +- +- newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; +- newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; +- DEBUGP("ip_nat_mms: mms_nat_expected: hook %s: newsrc->newdst %u.%u.%u.%u->%u.%u.%u.%u\n", +- hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" +- : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" +- : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???", +- NIPQUAD(newsrcip), NIPQUAD(newdstip)); +- +- if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) +- newip = newsrcip; +- else +- newip = newdstip; +- +- DEBUGP("ip_nat_mms: mms_nat_expected: IP to %u.%u.%u.%u\n", NIPQUAD(newip)); +- +- mr.rangesize = 1; +- /* We don't want to manip the per-protocol, just the IPs. */ +- mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; +- mr.range[0].min_ip = mr.range[0].max_ip = newip; +- +- return ip_nat_setup_info(ct, &mr, hooknum); +-} +- +- +-static unsigned int mms_nat_help(struct ip_conntrack *ct, +- struct ip_conntrack_expect *exp, +- struct ip_nat_info *info, +- enum ip_conntrack_info ctinfo, +- unsigned int hooknum, +- struct sk_buff **pskb) +-{ +- struct iphdr *iph = (*pskb)->nh.iph; +- struct tcphdr *tcph = (void *) iph + iph->ihl * 4; +- unsigned int datalen; +- int dir; +- struct ip_ct_mms_expect *ct_mms_info; +- +- if (!exp) +- DEBUGP("ip_nat_mms: no exp!!"); +- +- ct_mms_info = &exp->help.exp_mms_info; +- +- /* Only mangle things once: original direction in POST_ROUTING +- and reply direction on PRE_ROUTING. */ +- dir = CTINFO2DIR(ctinfo); +- if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) +- ||(hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) { +- DEBUGP("ip_nat_mms: mms_nat_help: not touching dir %s at hook %s\n", +- dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", +- hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" +- : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" +- : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???"); +- return NF_ACCEPT; +- } +- DEBUGP("ip_nat_mms: mms_nat_help: beyond not touching (dir %s at hook %s)\n", +- dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", +- hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" +- : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" +- : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???"); +- +- datalen = (*pskb)->len - iph->ihl * 4 - tcph->doff * 4; +- +- DEBUGP("ip_nat_mms: mms_nat_help: %u+%u=%u %u %u\n", exp->seq, ct_mms_info->len, +- exp->seq + ct_mms_info->len, +- ntohl(tcph->seq), +- ntohl(tcph->seq) + datalen); +- +- LOCK_BH(&ip_mms_lock); +- /* Check wether the whole IP/proto/port pattern is carried in the payload */ +- if (between(exp->seq + ct_mms_info->len, +- ntohl(tcph->seq), +- ntohl(tcph->seq) + datalen)) { +- if (!mms_data_fixup(ct_mms_info, ct, pskb, ctinfo, exp)) { +- UNLOCK_BH(&ip_mms_lock); +- return NF_DROP; +- } +- } else { +- /* Half a match? This means a partial retransmisison. +- It's a cracker being funky. */ +- if (net_ratelimit()) { +- printk("ip_nat_mms: partial packet %u/%u in %u/%u\n", +- exp->seq, ct_mms_info->len, +- ntohl(tcph->seq), +- ntohl(tcph->seq) + datalen); +- } +- UNLOCK_BH(&ip_mms_lock); +- return NF_DROP; +- } +- UNLOCK_BH(&ip_mms_lock); +- +- return NF_ACCEPT; +-} +- +-static struct ip_nat_helper mms[MAX_PORTS]; +-static char mms_names[MAX_PORTS][10]; +- +-/* Not __exit: called from init() */ +-static void fini(void) +-{ +- int i; +- +- for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { +- DEBUGP("ip_nat_mms: unregistering helper for port %d\n", ports[i]); +- ip_nat_helper_unregister(&mms[i]); +- } +-} +- +-static int __init init(void) +-{ +- int i, ret = 0; +- char *tmpname; +- +- if (ports[0] == 0) +- ports[0] = MMS_PORT; +- +- for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { +- +- memset(&mms[i], 0, sizeof(struct ip_nat_helper)); +- +- mms[i].tuple.dst.protonum = IPPROTO_TCP; +- mms[i].tuple.src.u.tcp.port = htons(ports[i]); +- mms[i].mask.dst.protonum = 0xFFFF; +- mms[i].mask.src.u.tcp.port = 0xFFFF; +- mms[i].help = mms_nat_help; +- mms[i].me = THIS_MODULE; +- mms[i].flags = 0; +- mms[i].expect = mms_nat_expected; +- +- tmpname = &mms_names[i][0]; +- if (ports[i] == MMS_PORT) +- sprintf(tmpname, "mms"); +- else +- sprintf(tmpname, "mms-%d", i); +- mms[i].name = tmpname; +- +- DEBUGP("ip_nat_mms: register helper for port %d\n", +- ports[i]); +- ret = ip_nat_helper_register(&mms[i]); +- +- if (ret) { +- printk("ip_nat_mms: error registering " +- "helper for port %d\n", ports[i]); +- fini(); +- return ret; +- } +- ports_c++; +- } +- +- return ret; +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_pptp.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_pptp.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_pptp.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_pptp.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,412 +0,0 @@ +-/* +- * ip_nat_pptp.c - Version 1.11 +- * +- * NAT support for PPTP (Point to Point Tunneling Protocol). +- * PPTP is a a protocol for creating virtual private networks. +- * It is a specification defined by Microsoft and some vendors +- * working with Microsoft. PPTP is built on top of a modified +- * version of the Internet Generic Routing Encapsulation Protocol. +- * GRE is defined in RFC 1701 and RFC 1702. Documentation of +- * PPTP can be found in RFC 2637 +- * +- * (C) 2000-2002 by Harald Welte +- * +- * Development of this code funded by Astaro AG (http://www.astaro.com/) +- * +- * TODO: - Support for multiple calls within one session +- * (needs netfilter newnat code) +- * - NAT to a unique tuple, not to TCP source port +- * (needs netfilter tuple reservation) +- * - Support other NAT scenarios than SNAT of PNS +- * +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Harald Welte "); +-MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP"); +- +- +-#define DEBUGP(format, args...) +- +-static unsigned int +-pptp_nat_expected(struct sk_buff **pskb, +- unsigned int hooknum, +- struct ip_conntrack *ct, +- struct ip_nat_info *info) +-{ +- struct ip_conntrack *master = master_ct(ct); +- struct ip_nat_multi_range mr; +- struct ip_ct_pptp_master *ct_pptp_info; +- struct ip_nat_pptp *nat_pptp_info; +- u_int32_t newsrcip, newdstip, newcid; +- int ret; +- +- IP_NF_ASSERT(info); +- IP_NF_ASSERT(master); +- IP_NF_ASSERT(!(info->initialized & (1 << HOOK2MANIP(hooknum)))); +- +- DEBUGP("we have a connection!\n"); +- +- LOCK_BH(&ip_pptp_lock); +- ct_pptp_info = &master->help.ct_pptp_info; +- nat_pptp_info = &master->nat.help.nat_pptp_info; +- +- /* need to alter GRE tuple because conntrack expectfn() used 'wrong' +- * (unmanipulated) values */ +- if (hooknum == NF_IP_PRE_ROUTING) { +- DEBUGP("completing tuples with NAT info \n"); +- /* we can do this, since we're unconfirmed */ +- if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.gre.key == +- htonl(ct_pptp_info->pac_call_id)) { +- /* assume PNS->PAC */ +- ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key = +- htonl(nat_pptp_info->pns_call_id); +-// ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u.gre.key = +-// htonl(nat_pptp_info->pac_call_id); +- ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key = +- htonl(nat_pptp_info->pns_call_id); +- } else { +- /* assume PAC->PNS */ +- DEBUGP("WRONG DIRECTION\n"); +- ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key = +- htonl(nat_pptp_info->pac_call_id); +- ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key = +- htonl(nat_pptp_info->pns_call_id); +- } +- } +- +- if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_DST) { +- newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; +- newcid = htonl(master->nat.help.nat_pptp_info.pac_call_id); +- +- mr.rangesize = 1; +- mr.range[0].flags = IP_NAT_RANGE_MAP_IPS | IP_NAT_RANGE_PROTO_SPECIFIED; +- mr.range[0].min_ip = mr.range[0].max_ip = newdstip; +- mr.range[0].min = mr.range[0].max = +- ((union ip_conntrack_manip_proto ) { newcid }); +- DEBUGP("change dest ip to %u.%u.%u.%u\n", +- NIPQUAD(newdstip)); +- DEBUGP("change dest key to 0x%x\n", ntohl(newcid)); +- ret = ip_nat_setup_info(ct, &mr, hooknum); +- } else { +- newsrcip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- /* nat_multi_range is in network byte order, and GRE tuple +- * is 32 bits, not 16 like callID */ +- newcid = htonl(master->help.ct_pptp_info.pns_call_id); +- +- mr.rangesize = 1; +- mr.range[0].flags = IP_NAT_RANGE_MAP_IPS +- |IP_NAT_RANGE_PROTO_SPECIFIED; +- mr.range[0].min_ip = mr.range[0].max_ip = newsrcip; +- mr.range[0].min = mr.range[0].max = +- ((union ip_conntrack_manip_proto ) { newcid }); +- DEBUGP("change src ip to %u.%u.%u.%u\n", +- NIPQUAD(newsrcip)); +- DEBUGP("change 'src' key to 0x%x\n", ntohl(newcid)); +- ret = ip_nat_setup_info(ct, &mr, hooknum); +- } +- +- UNLOCK_BH(&ip_pptp_lock); +- +- return ret; +- +-} +- +-/* outbound packets == from PNS to PAC */ +-static inline unsigned int +-pptp_outbound_pkt(struct tcphdr *tcph, struct pptp_pkt_hdr *pptph, +- size_t datalen, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo, +- struct ip_conntrack_expect *exp) +- +-{ +- struct PptpControlHeader *ctlh; +- union pptp_ctrl_union pptpReq; +- struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info; +- struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info; +- +- u_int16_t msg, *cid = NULL, new_callid; +- +- ctlh = (struct PptpControlHeader *) ((void *) pptph + sizeof(*pptph)); +- pptpReq.rawreq = (void *) ((void *) ctlh + sizeof(*ctlh)); +- +- new_callid = htons(ct_pptp_info->pns_call_id); +- +- switch (msg = ntohs(ctlh->messageType)) { +- case PPTP_OUT_CALL_REQUEST: +- cid = &pptpReq.ocreq->callID; +- +- /* save original call ID in nat_info */ +- nat_pptp_info->pns_call_id = ct_pptp_info->pns_call_id; +- +- new_callid = tcph->source; +- /* save new call ID in ct info */ +- ct_pptp_info->pns_call_id = ntohs(new_callid); +- break; +- case PPTP_IN_CALL_REPLY: +- cid = &pptpReq.icreq->callID; +- break; +- case PPTP_CALL_CLEAR_REQUEST: +- cid = &pptpReq.clrreq->callID; +- break; +- case PPTP_CALL_DISCONNECT_NOTIFY: +- cid = &pptpReq.disc->callID; +- break; +- +- default: +- DEBUGP("unknown outbound packet 0x%04x:%s\n", msg, +- (msg <= PPTP_MSG_MAX)? strMName[msg]:strMName[0]); +- /* fall through */ +- +- case PPTP_SET_LINK_INFO: +- /* only need to NAT in case PAC is behind NAT box */ +- case PPTP_START_SESSION_REQUEST: +- case PPTP_START_SESSION_REPLY: +- case PPTP_STOP_SESSION_REQUEST: +- case PPTP_STOP_SESSION_REPLY: +- case PPTP_ECHO_REQUEST: +- case PPTP_ECHO_REPLY: +- /* no need to alter packet */ +- return NF_ACCEPT; +- } +- +- IP_NF_ASSERT(cid); +- +- DEBUGP("altering call id from 0x%04x to 0x%04x\n", +- ntohs(*cid), ntohs(new_callid)); +- /* mangle packet */ +- tcph->check = ip_nat_cheat_check(*cid^0xFFFF, +- new_callid, tcph->check); +- *cid = new_callid; +- +- return NF_ACCEPT; +-} +- +-/* inbound packets == from PAC to PNS */ +-static inline unsigned int +-pptp_inbound_pkt(struct tcphdr *tcph, struct pptp_pkt_hdr *pptph, +- size_t datalen, +- struct ip_conntrack *ct, +- enum ip_conntrack_info ctinfo, +- struct ip_conntrack_expect *oldexp) +-{ +- struct PptpControlHeader *ctlh; +- union pptp_ctrl_union pptpReq; +- struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info; +- struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info; +- +- u_int16_t msg, new_cid = 0, new_pcid, *pcid = NULL, *cid = NULL; +- u_int32_t old_dst_ip; +- +- struct ip_conntrack_tuple t; +- +- ctlh = (struct PptpControlHeader *) ((void *) pptph + sizeof(*pptph)); +- pptpReq.rawreq = (void *) ((void *) ctlh + sizeof(*ctlh)); +- +- new_pcid = htons(nat_pptp_info->pns_call_id); +- +- switch (msg = ntohs(ctlh->messageType)) { +- case PPTP_OUT_CALL_REPLY: +- pcid = &pptpReq.ocack->peersCallID; +- cid = &pptpReq.ocack->callID; +- if (!oldexp) { +- DEBUGP("outcall but no expectation\n"); +- break; +- } +- old_dst_ip = oldexp->tuple.dst.ip; +- t = oldexp->tuple; +- +- /* save original PAC call ID in nat_info */ +- nat_pptp_info->pac_call_id = ct_pptp_info->pac_call_id; +- +- /* store new callID in ct_info, so conntrack works */ +- //ct_pptp_info->pac_call_id = ntohs(tcph->source); +- //new_cid = htons(ct_pptp_info->pac_call_id); +- +- /* alter expectation */ +- if (t.dst.ip == ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip) { +- /* expectation for PNS->PAC direction */ +- t.dst.u.gre.key = htonl(ct_pptp_info->pac_call_id); +- t.src.u.gre.key = htonl(nat_pptp_info->pns_call_id); +- } else { +- /* expectation for PAC->PNS direction */ +- t.dst.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- DEBUGP("EXPECTATION IN WRONG DIRECTION!!!\n"); +- } +- +- if (!ip_conntrack_change_expect(oldexp, &t)) { +- DEBUGP("successfully changed expect\n"); +- } else { +- DEBUGP("can't change expect\n"); +- } +- ip_ct_gre_keymap_change(oldexp->proto.gre.keymap_orig, &t); +- /* reply keymap */ +- t.src.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; +- t.dst.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- t.src.u.gre.key = htonl(nat_pptp_info->pac_call_id); +- t.dst.u.gre.key = htonl(ct_pptp_info->pns_call_id); +- ip_ct_gre_keymap_change(oldexp->proto.gre.keymap_reply, &t); +- +- break; +- case PPTP_IN_CALL_CONNECT: +- pcid = &pptpReq.iccon->peersCallID; +- if (!oldexp) +- break; +- old_dst_ip = oldexp->tuple.dst.ip; +- t = oldexp->tuple; +- +- /* alter expectation, no need for callID */ +- if (t.dst.ip == ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip) { +- /* expectation for PNS->PAC direction */ +- t.src.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- } else { +- /* expectation for PAC->PNS direction */ +- t.dst.ip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; +- } +- +- if (!ip_conntrack_change_expect(oldexp, &t)) { +- DEBUGP("successfully changed expect\n"); +- } else { +- DEBUGP("can't change expect\n"); +- } +- break; +- case PPTP_IN_CALL_REQUEST: +- /* only need to nat in case PAC is behind NAT box */ +- break; +- case PPTP_WAN_ERROR_NOTIFY: +- pcid = &pptpReq.wanerr->peersCallID; +- break; +- default: +- DEBUGP("unknown inbound packet %s\n", +- (msg <= PPTP_MSG_MAX)? strMName[msg]:strMName[0]); +- /* fall through */ +- +- case PPTP_START_SESSION_REQUEST: +- case PPTP_START_SESSION_REPLY: +- case PPTP_STOP_SESSION_REQUEST: +- case PPTP_ECHO_REQUEST: +- case PPTP_ECHO_REPLY: +- /* no need to alter packet */ +- return NF_ACCEPT; +- } +- +- /* mangle packet */ +- IP_NF_ASSERT(pcid); +- DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", +- ntohs(*pcid), ntohs(new_pcid)); +- tcph->check = ip_nat_cheat_check(*pcid^0xFFFF, +- new_pcid, tcph->check); +- *pcid = new_pcid; +- +- if (new_cid) { +- IP_NF_ASSERT(cid); +- DEBUGP("altering call id from 0x%04x to 0x%04x\n", +- ntohs(*cid), ntohs(new_cid)); +- tcph->check = ip_nat_cheat_check(*cid^0xFFFF, +- new_cid, tcph->check); +- *cid = new_cid; +- } +- +- /* great, at least we don't need to resize packets */ +- return NF_ACCEPT; +-} +- +- +-static unsigned int tcp_help(struct ip_conntrack *ct, +- struct ip_conntrack_expect *exp, +- struct ip_nat_info *info, +- enum ip_conntrack_info ctinfo, +- unsigned int hooknum, struct sk_buff **pskb) +-{ +- struct iphdr *iph = (*pskb)->nh.iph; +- struct tcphdr *tcph = (void *) iph + iph->ihl*4; +- unsigned int datalen = (*pskb)->len - iph->ihl*4 - tcph->doff*4; +- struct pptp_pkt_hdr *pptph; +- void *datalimit; +- +- int dir; +- +- DEBUGP("entering\n"); +- +- /* Only mangle things once: original direction in POST_ROUTING +- and reply direction on PRE_ROUTING. */ +- dir = CTINFO2DIR(ctinfo); +- if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) +- || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) { +- DEBUGP("Not touching dir %s at hook %s\n", +- dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", +- hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" +- : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" +- : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???"); +- return NF_ACCEPT; +- } +- +- /* if packet is too small, just skip it */ +- if (datalen < sizeof(struct pptp_pkt_hdr)+ +- sizeof(struct PptpControlHeader)) { +- DEBUGP("pptp packet too short\n"); +- return NF_ACCEPT; +- } +- +- +- pptph = (struct pptp_pkt_hdr *) ((void *)tcph + tcph->doff*4); +- datalimit = (void *) pptph + datalen; +- +- LOCK_BH(&ip_pptp_lock); +- +- if (dir == IP_CT_DIR_ORIGINAL) { +- /* reuqests sent by client to server (PNS->PAC) */ +- pptp_outbound_pkt(tcph, pptph, datalen, ct, ctinfo, exp); +- } else { +- /* response from the server to the client (PAC->PNS) */ +- pptp_inbound_pkt(tcph, pptph, datalen, ct, ctinfo, exp); +- } +- +- UNLOCK_BH(&ip_pptp_lock); +- +- return NF_ACCEPT; +-} +- +-/* nat helper struct for control connection */ +-static struct ip_nat_helper pptp_tcp_helper = { +- { NULL, NULL }, +- "pptp", IP_NAT_HELPER_F_ALWAYS, THIS_MODULE, +- { { 0, { tcp: { port: __constant_htons(PPTP_CONTROL_PORT) } } }, +- { 0, { 0 }, IPPROTO_TCP } }, +- { { 0, { tcp: { port: 0xFFFF } } }, +- { 0, { 0 }, 0xFFFF } }, +- tcp_help, pptp_nat_expected }; +- +- +-static int __init init(void) +-{ +- DEBUGP("init_module\n" ); +- +- if (ip_nat_helper_register(&pptp_tcp_helper)) +- return -EIO; +- +- return 0; +-} +- +-static void __exit fini(void) +-{ +- DEBUGP("cleanup_module\n" ); +- ip_nat_helper_unregister(&pptp_tcp_helper); +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_proto_gre.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_proto_gre.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_proto_gre.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_proto_gre.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,212 +0,0 @@ +-/* +- * ip_nat_proto_gre.c - Version 1.11 +- * +- * NAT protocol helper module for GRE. +- * +- * GRE is a generic encapsulation protocol, which is generally not very +- * suited for NAT, as it has no protocol-specific part as port numbers. +- * +- * It has an optional key field, which may help us distinguishing two +- * connections between the same two hosts. +- * +- * GRE is defined in RFC 1701 and RFC 1702, as well as RFC 2784 +- * +- * PPTP is built on top of a modified version of GRE, and has a mandatory +- * field called "CallID", which serves us for the same purpose as the key +- * field in plain GRE. +- * +- * Documentation about PPTP can be found in RFC 2637 +- * +- * (C) 2000-2002 by Harald Welte +- * +- * Development of this code funded by Astaro AG (http://www.astaro.com/) +- * +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Harald Welte "); +-MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE"); +- +-#define DEBUGP(x, args...) +- +-/* is key in given range between min and max */ +-static int +-gre_in_range(const struct ip_conntrack_tuple *tuple, +- enum ip_nat_manip_type maniptype, +- const union ip_conntrack_manip_proto *min, +- const union ip_conntrack_manip_proto *max) +-{ +- return ntohl(tuple->src.u.gre.key) >= ntohl(min->gre.key) +- && ntohl(tuple->src.u.gre.key) <= ntohl(max->gre.key); +-} +- +-/* generate unique tuple ... */ +-static int +-gre_unique_tuple(struct ip_conntrack_tuple *tuple, +- const struct ip_nat_range *range, +- enum ip_nat_manip_type maniptype, +- const struct ip_conntrack *conntrack) +-{ +- u_int32_t min, i, range_size; +- u_int32_t key = 0, *keyptr; +- +- if (maniptype == IP_NAT_MANIP_SRC) +- keyptr = &tuple->src.u.gre.key; +- else +- keyptr = &tuple->dst.u.gre.key; +- +- if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) { +- +- switch (tuple->dst.u.gre.version) { +- case 0: +- DEBUGP("NATing GRE version 0 (ct=%p)\n", +- conntrack); +- min = 1; +- range_size = 0xffffffff; +- break; +- case GRE_VERSION_PPTP: +- DEBUGP("%p: NATing GRE PPTP\n", +- conntrack); +- min = 1; +- range_size = 0xffff; +- break; +- default: +- printk(KERN_WARNING "nat_gre: unknown GRE version\n"); +- return 0; +- break; +- } +- +- } else { +- min = ntohl(range->min.gre.key); +- range_size = ntohl(range->max.gre.key) - min + 1; +- } +- +- DEBUGP("min = %u, range_size = %u\n", min, range_size); +- +- for (i = 0; i < range_size; i++, key++) { +- *keyptr = htonl(min + key % range_size); +- if (!ip_nat_used_tuple(tuple, conntrack)) +- return 1; +- } +- +- DEBUGP("%p: no NAT mapping\n", conntrack); +- +- return 0; +-} +- +-/* manipulate a GRE packet according to maniptype */ +-static void +-gre_manip_pkt(struct iphdr *iph, size_t len, +- const struct ip_conntrack_manip *manip, +- enum ip_nat_manip_type maniptype) +-{ +- struct gre_hdr *greh = (struct gre_hdr *)((u_int32_t *)iph+iph->ihl); +- struct gre_hdr_pptp *pgreh = (struct gre_hdr_pptp *) greh; +- +- /* we only have destination manip of a packet, since 'source key' +- * is not present in the packet itself */ +- if (maniptype == IP_NAT_MANIP_DST) { +- /* key manipulation is always dest */ +- switch (greh->version) { +- case 0: +- if (!greh->key) { +- DEBUGP("can't nat GRE w/o key\n"); +- break; +- } +- if (greh->csum) { +- *(gre_csum(greh)) = +- ip_nat_cheat_check(~*(gre_key(greh)), +- manip->u.gre.key, +- *(gre_csum(greh))); +- } +- *(gre_key(greh)) = manip->u.gre.key; +- break; +- case GRE_VERSION_PPTP: +- DEBUGP("call_id -> 0x%04x\n", +- ntohl(manip->u.gre.key)); +- pgreh->call_id = htons(ntohl(manip->u.gre.key)); +- break; +- default: +- DEBUGP("can't nat unknown GRE version\n"); +- break; +- } +- } +-} +- +-/* print out a nat tuple */ +-static unsigned int +-gre_print(char *buffer, +- const struct ip_conntrack_tuple *match, +- const struct ip_conntrack_tuple *mask) +-{ +- unsigned int len = 0; +- +- if (mask->dst.u.gre.version) +- len += sprintf(buffer + len, "version=%d ", +- ntohs(match->dst.u.gre.version)); +- +- if (mask->dst.u.gre.protocol) +- len += sprintf(buffer + len, "protocol=0x%x ", +- ntohs(match->dst.u.gre.protocol)); +- +- if (mask->src.u.gre.key) +- len += sprintf(buffer + len, "srckey=0x%x ", +- ntohl(match->src.u.gre.key)); +- +- if (mask->dst.u.gre.key) +- len += sprintf(buffer + len, "dstkey=0x%x ", +- ntohl(match->src.u.gre.key)); +- +- return len; +-} +- +-/* print a range of keys */ +-static unsigned int +-gre_print_range(char *buffer, const struct ip_nat_range *range) +-{ +- if (range->min.gre.key != 0 +- || range->max.gre.key != 0xFFFF) { +- if (range->min.gre.key == range->max.gre.key) +- return sprintf(buffer, "key 0x%x ", +- ntohl(range->min.gre.key)); +- else +- return sprintf(buffer, "keys 0x%u-0x%u ", +- ntohl(range->min.gre.key), +- ntohl(range->max.gre.key)); +- } else +- return 0; +-} +- +-/* nat helper struct */ +-static struct ip_nat_protocol gre = +- { { NULL, NULL }, "GRE", IPPROTO_GRE, +- gre_manip_pkt, +- gre_in_range, +- gre_unique_tuple, +- gre_print, +- gre_print_range +- }; +- +-static int __init init(void) +-{ +- if (ip_nat_protocol_register(&gre)) +- return -EIO; +- +- return 0; +-} +- +-static void __exit fini(void) +-{ +- ip_nat_protocol_unregister(&gre); +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_standalone.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_standalone.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_standalone.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_standalone.c 2004-05-09 04:13:03.000000000 -0400 +@@ -37,7 +37,11 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + #define HOOKNAME(hooknum) ((hooknum) == NF_IP_POST_ROUTING ? "POST_ROUTING" \ + : ((hooknum) == NF_IP_PRE_ROUTING ? "PRE_ROUTING" \ +@@ -354,6 +358,5 @@ + EXPORT_SYMBOL(ip_nat_helper_unregister); + EXPORT_SYMBOL(ip_nat_cheat_check); + EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); +-EXPORT_SYMBOL(ip_nat_mangle_udp_packet); + EXPORT_SYMBOL(ip_nat_used_tuple); + MODULE_LICENSE("GPL"); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_nat_tftp.c src/linux/linux.stock/net/ipv4/netfilter/ip_nat_tftp.c +--- src/linux/linux/net/ipv4/netfilter/ip_nat_tftp.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_nat_tftp.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,186 +0,0 @@ +-/* +- * Licensed under GNU GPL version 2 Copyright Magnus Boden +- * Version: 0.0.7 +- * +- * Thu 21 Mar 2002 Harald Welte +- * - Port to newnat API +- * +- * This module currently supports DNAT: +- * iptables -t nat -A PREROUTING -d x.x.x.x -j DNAT --to-dest x.x.x.y +- * +- * and SNAT: +- * iptables -t nat -A POSTROUTING { -j MASQUERADE , -j SNAT --to-source x.x.x.x } +- * +- * It has not been tested with +- * -j SNAT --to-source x.x.x.x-x.x.x.y since I only have one external ip +- * If you do test this please let me know if it works or not. +- * +- */ +- +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-MODULE_AUTHOR("Magnus Boden "); +-MODULE_DESCRIPTION("Netfilter NAT helper for tftp"); +-MODULE_LICENSE("GPL"); +- +-#define MAX_PORTS 8 +- +-static int ports[MAX_PORTS]; +-static int ports_c = 0; +-#ifdef MODULE_PARM +-MODULE_PARM(ports,"1-" __MODULE_STRING(MAX_PORTS) "i"); +-MODULE_PARM_DESC(ports, "port numbers of tftp servers"); +-#endif +- +-#define DEBUGP(format, args...) +-static unsigned int +-tftp_nat_help(struct ip_conntrack *ct, +- struct ip_conntrack_expect *exp, +- struct ip_nat_info *info, +- enum ip_conntrack_info ctinfo, +- unsigned int hooknum, +- struct sk_buff **pskb) +-{ +- int dir = CTINFO2DIR(ctinfo); +- struct iphdr *iph = (*pskb)->nh.iph; +- struct udphdr *udph = (void *)iph + iph->ihl * 4; +- struct tftphdr *tftph = (void *)udph + 8; +- struct ip_conntrack_tuple repl; +- +- if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) +- || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) +- return NF_ACCEPT; +- +- if (!exp) { +- DEBUGP("no conntrack expectation to modify\n"); +- return NF_ACCEPT; +- } +- +- switch (ntohs(tftph->opcode)) { +- /* RRQ and WRQ works the same way */ +- case TFTP_OPCODE_READ: +- case TFTP_OPCODE_WRITE: +- repl = ct->tuplehash[IP_CT_DIR_REPLY].tuple; +- DEBUGP(""); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); +- DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); +- DEBUGP("expecting: "); +- DUMP_TUPLE_RAW(&repl); +- DUMP_TUPLE_RAW(&exp->mask); +- ip_conntrack_change_expect(exp, &repl); +- break; +- default: +- DEBUGP("Unknown opcode\n"); +- } +- +- return NF_ACCEPT; +-} +- +-static unsigned int +-tftp_nat_expected(struct sk_buff **pskb, +- unsigned int hooknum, +- struct ip_conntrack *ct, +- struct ip_nat_info *info) +-{ +- const struct ip_conntrack *master = ct->master->expectant; +- const struct ip_conntrack_tuple *orig = +- &master->tuplehash[IP_CT_DIR_ORIGINAL].tuple; +- struct ip_nat_multi_range mr; +- +- IP_NF_ASSERT(info); +- IP_NF_ASSERT(master); +- IP_NF_ASSERT(!(info->initialized & (1 << HOOK2MANIP(hooknum)))); +- +- mr.rangesize = 1; +- mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; +- +- if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) { +- mr.range[0].min_ip = mr.range[0].max_ip = orig->dst.ip; +- DEBUGP("orig: %u.%u.%u.%u:%u <-> %u.%u.%u.%u:%u " +- "newsrc: %u.%u.%u.%u\n", +- NIPQUAD((*pskb)->nh.iph->saddr), ntohs(udph->source), +- NIPQUAD((*pskb)->nh.iph->daddr), ntohs(udph->dest), +- NIPQUAD(orig->dst.ip)); +- } else { +- mr.range[0].min_ip = mr.range[0].max_ip = orig->src.ip; +- mr.range[0].min.udp.port = mr.range[0].max.udp.port = +- orig->src.u.udp.port; +- mr.range[0].flags |= IP_NAT_RANGE_PROTO_SPECIFIED; +- +- DEBUGP("orig: %u.%u.%u.%u:%u <-> %u.%u.%u.%u:%u " +- "newdst: %u.%u.%u.%u:%u\n", +- NIPQUAD((*pskb)->nh.iph->saddr), ntohs(udph->source), +- NIPQUAD((*pskb)->nh.iph->daddr), ntohs(udph->dest), +- NIPQUAD(orig->src.ip), ntohs(orig->src.u.udp.port)); +- } +- +- return ip_nat_setup_info(ct,&mr,hooknum); +-} +- +-static struct ip_nat_helper tftp[MAX_PORTS]; +-static char tftp_names[MAX_PORTS][10]; +- +-static void fini(void) +-{ +- int i; +- +- for (i = 0 ; i < ports_c; i++) { +- DEBUGP("unregistering helper for port %d\n", ports[i]); +- ip_nat_helper_unregister(&tftp[i]); +- } +-} +- +-static int __init init(void) +-{ +- int i, ret; +- char *tmpname; +- +- if (!ports[0]) +- ports[0] = TFTP_PORT; +- +- for (i = 0 ; (i < MAX_PORTS) && ports[i] ; i++) { +- memset(&tftp[i], 0, sizeof(struct ip_nat_helper)); +- +- tftp[i].tuple.dst.protonum = IPPROTO_UDP; +- tftp[i].tuple.src.u.udp.port = htons(ports[i]); +- tftp[i].mask.dst.protonum = 0xFFFF; +- tftp[i].mask.src.u.udp.port = 0xFFFF; +- tftp[i].help = tftp_nat_help; +- tftp[i].flags = 0; +- tftp[i].me = THIS_MODULE; +- tftp[i].expect = tftp_nat_expected; +- +- tmpname = &tftp_names[i][0]; +- if (ports[i] == TFTP_PORT) +- sprintf(tmpname, "tftp"); +- else +- sprintf(tmpname, "tftp-%d", i); +- tftp[i].name = tmpname; +- +- DEBUGP("ip_nat_tftp: registering for port %d: name %s\n", +- ports[i], tftp[i].name); +- ret = ip_nat_helper_register(&tftp[i]); +- +- if (ret) { +- printk("ip_nat_tftp: unable to register for port %d\n", +- ports[i]); +- fini(); +- return ret; +- } +- ports_c++; +- } +- return ret; +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ip_pool.c src/linux/linux.stock/net/ipv4/netfilter/ip_pool.c +--- src/linux/linux/net/ipv4/netfilter/ip_pool.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ip_pool.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,328 +0,0 @@ +-/* Kernel module for IP pool management */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DP(format, args...) +- +-MODULE_LICENSE("GPL"); +- +-#define NR_POOL 16 +-static int nr_pool = NR_POOL;/* overwrite this when loading module */ +- +-struct ip_pool { +- u_int32_t first_ip; /* host byte order, included in range */ +- u_int32_t last_ip; /* host byte order, included in range */ +- void *members; /* the bitmap proper */ +- int nr_use; /* total nr. of tests through this */ +- int nr_match; /* total nr. of matches through this */ +- rwlock_t lock; +-}; +- +-static struct ip_pool *POOL; +- +-static inline struct ip_pool *lookup(ip_pool_t index) +-{ +- if (index < 0 || index >= nr_pool) { +- DP("ip_pool:lookup: bad index %d\n", index); +- return 0; +- } +- return POOL+index; +-} +- +-int ip_pool_match(ip_pool_t index, u_int32_t addr) +-{ +- struct ip_pool *pool = lookup(index); +- int res = 0; +- +- if (!pool || !pool->members) +- return 0; +- read_lock_bh(&pool->lock); +- if (pool->members) { +- if (addr >= pool->first_ip && addr <= pool->last_ip) { +- addr -= pool->first_ip; +- if (test_bit(addr, pool->members)) { +- res = 1; +-#ifdef CONFIG_IP_POOL_STATISTICS +- pool->nr_match++; +-#endif +- } +- } +-#ifdef CONFIG_IP_POOL_STATISTICS +- pool->nr_use++; +-#endif +- } +- read_unlock_bh(&pool->lock); +- return res; +-} +- +-static int pool_change(ip_pool_t index, u_int32_t addr, int isdel) +-{ +- struct ip_pool *pool; +- int res = -1; +- +- pool = lookup(index); +- if ( !pool || !pool->members +- || addr < pool->first_ip || addr > pool->last_ip) +- return -1; +- read_lock_bh(&pool->lock); +- if (pool->members && addr >= pool->first_ip && addr <= pool->last_ip) { +- addr -= pool->first_ip; +- res = isdel +- ? (0 != test_and_clear_bit(addr, pool->members)) +- : (0 != test_and_set_bit(addr, pool->members)); +- } +- read_unlock_bh(&pool->lock); +- return res; +-} +- +-int ip_pool_mod(ip_pool_t index, u_int32_t addr, int isdel) +-{ +- int res = pool_change(index,addr,isdel); +- +- if (!isdel) res = !res; +- return res; +-} +- +-static inline int bitmap_bytes(u_int32_t a, u_int32_t b) +-{ +- return 4*((((b-a+8)/8)+3)/4); +-} +- +-static inline int poolbytes(ip_pool_t index) +-{ +- struct ip_pool *pool = lookup(index); +- +- return pool ? bitmap_bytes(pool->first_ip, pool->last_ip) : 0; +-} +- +-static int setpool( +- struct sock *sk, +- int optval, +- void *user, +- unsigned int len +-) { +- struct ip_pool_request req; +- +- DP("ip_pool:setpool: optval=%d, user=%p, len=%d\n", optval, user, len); +- if (!capable(CAP_NET_ADMIN)) +- return -EPERM; +- if (optval != SO_IP_POOL) +- return -EBADF; +- if (len != sizeof(req)) +- return -EINVAL; +- if (copy_from_user(&req, user, sizeof(req)) != 0) +- return -EFAULT; +- printk("obsolete op - upgrade your ippool(8) utility.\n"); +- return -EINVAL; +-} +- +-static int getpool( +- struct sock *sk, +- int optval, +- void *user, +- int *len +-) { +- struct ip_pool_request req; +- struct ip_pool *pool; +- ip_pool_t i; +- int newbytes; +- void *newmembers; +- int res; +- +- DP("ip_pool:getpool: optval=%d, user=%p\n", optval, user); +- if (!capable(CAP_NET_ADMIN)) +- return -EINVAL; +- if (optval != SO_IP_POOL) +- return -EINVAL; +- if (*len != sizeof(req)) { +- return -EFAULT; +- } +- if (copy_from_user(&req, user, sizeof(req)) != 0) +- return -EFAULT; +- DP("ip_pool:getpool op=%d, index=%d\n", req.op, req.index); +- if (req.op < IP_POOL_BAD001) { +- printk("obsolete op - upgrade your ippool(8) utility.\n"); +- return -EFAULT; +- } +- switch(req.op) { +- case IP_POOL_HIGH_NR: +- DP("ip_pool HIGH_NR\n"); +- req.index = IP_POOL_NONE; +- for (i=0; imembers) +- return -EBADF; +- req.addr = htonl(pool->first_ip); +- req.addr2 = htonl(pool->last_ip); +- return copy_to_user(user, &req, sizeof(req)); +- case IP_POOL_USAGE: +- DP("ip_pool USE\n"); +- pool = lookup(req.index); +- if (!pool) +- return -EINVAL; +- if (!pool->members) +- return -EBADF; +- req.addr = pool->nr_use; +- req.addr2 = pool->nr_match; +- return copy_to_user(user, &req, sizeof(req)); +- case IP_POOL_TEST_ADDR: +- DP("ip_pool TEST 0x%08x\n", req.addr); +- pool = lookup(req.index); +- if (!pool) +- return -EINVAL; +- res = 0; +- read_lock_bh(&pool->lock); +- if (!pool->members) { +- DP("ip_pool TEST_ADDR no members in pool\n"); +- res = -EBADF; +- goto unlock_and_return_res; +- } +- req.addr = ntohl(req.addr); +- if (req.addr < pool->first_ip) { +- DP("ip_pool TEST_ADDR address < pool bounds\n"); +- res = -ERANGE; +- goto unlock_and_return_res; +- } +- if (req.addr > pool->last_ip) { +- DP("ip_pool TEST_ADDR address > pool bounds\n"); +- res = -ERANGE; +- goto unlock_and_return_res; +- } +- req.addr = (0 != test_bit((req.addr - pool->first_ip), +- pool->members)); +- read_unlock_bh(&pool->lock); +- return copy_to_user(user, &req, sizeof(req)); +- case IP_POOL_FLUSH: +- DP("ip_pool FLUSH not yet implemented.\n"); +- return -EBUSY; +- case IP_POOL_DESTROY: +- DP("ip_pool DESTROY not yet implemented.\n"); +- return -EBUSY; +- case IP_POOL_INIT: +- DP("ip_pool INIT 0x%08x-0x%08x\n", req.addr, req.addr2); +- pool = lookup(req.index); +- if (!pool) +- return -EINVAL; +- req.addr = ntohl(req.addr); +- req.addr2 = ntohl(req.addr2); +- if (req.addr > req.addr2) { +- DP("ip_pool INIT bad ip range\n"); +- return -EINVAL; +- } +- newbytes = bitmap_bytes(req.addr, req.addr2); +- newmembers = kmalloc(newbytes, GFP_KERNEL); +- if (!newmembers) { +- DP("ip_pool INIT out of mem for %d bytes\n", newbytes); +- return -ENOMEM; +- } +- memset(newmembers, 0, newbytes); +- write_lock_bh(&pool->lock); +- if (pool->members) { +- DP("ip_pool INIT pool %d exists\n", req.index); +- kfree(newmembers); +- res = -EBUSY; +- goto unlock_and_return_res; +- } +- pool->first_ip = req.addr; +- pool->last_ip = req.addr2; +- pool->nr_use = 0; +- pool->nr_match = 0; +- pool->members = newmembers; +- write_unlock_bh(&pool->lock); +- return 0; +- case IP_POOL_ADD_ADDR: +- DP("ip_pool ADD_ADDR 0x%08x\n", req.addr); +- req.addr = pool_change(req.index, ntohl(req.addr), 0); +- return copy_to_user(user, &req, sizeof(req)); +- case IP_POOL_DEL_ADDR: +- DP("ip_pool DEL_ADDR 0x%08x\n", req.addr); +- req.addr = pool_change(req.index, ntohl(req.addr), 1); +- return copy_to_user(user, &req, sizeof(req)); +- default: +- DP("ip_pool:getpool bad op %d\n", req.op); +- return -EINVAL; +- } +- return -EINVAL; +- +-unlock_and_return_res: +- if (pool) +- read_unlock_bh(&pool->lock); +- return res; +-} +- +-static struct nf_sockopt_ops so_pool +-= { { NULL, NULL }, PF_INET, +- SO_IP_POOL, SO_IP_POOL+1, &setpool, +- SO_IP_POOL, SO_IP_POOL+1, &getpool, +- 0, NULL }; +- +-MODULE_PARM(nr_pool, "i"); +- +-static int __init init(void) +-{ +- ip_pool_t i; +- int res; +- +- if (nr_pool < 1) { +- printk("ip_pool module init: bad nr_pool %d\n", nr_pool); +- return -EINVAL; +- } +- POOL = kmalloc(nr_pool * sizeof(*POOL), GFP_KERNEL); +- if (!POOL) { +- printk("ip_pool module init: out of memory for nr_pool %d\n", +- nr_pool); +- return -ENOMEM; +- } +- for (i=0; i + #include + ++#if 0 ++/* All the better to debug you with... */ ++#define static ++#define inline ++#endif + + /* Locking is simple: we assume at worst case there will be one packet + in user context and one from bottom halves (or soft irq if Alexey's +@@ -83,6 +88,7 @@ + { + /* Size per table */ + unsigned int size; ++ /* Number of entries: FIXME. --RR */ + unsigned int number; + /* Initial number of entries. Needed for module usage count */ + unsigned int initial_entries; +@@ -106,6 +112,11 @@ + #define TABLE_OFFSET(t,p) 0 + #endif + ++#if 0 ++#define down(x) do { printk("DOWN:%u:" #x "\n", __LINE__); down(x); } while(0) ++#define down_interruptible(x) ({ int __r; printk("DOWNi:%u:" #x "\n", __LINE__); __r = down_interruptible(x); if (__r != 0) printk("ABORT-DOWNi:%u\n", __LINE__); __r; }) ++#define up(x) do { printk("UP:%u:" #x "\n", __LINE__); up(x); } while(0) ++#endif + + /* Returns whether matches rule or not. */ + static inline int +@@ -408,6 +419,12 @@ + { + void *ret; + ++#if 0 ++ duprintf("find_inlist: searching for `%s' in %s.\n", ++ name, head == &ipt_target ? "ipt_target" ++ : head == &ipt_match ? "ipt_match" ++ : head == &ipt_tables ? "ipt_tables" : "UNKNOWN"); ++#endif + + *error = down_interruptible(mutex); + if (*error != 0) +@@ -745,6 +762,8 @@ + newinfo->underflow[h] = underflows[h]; + } + ++ /* FIXME: underflows must be unconditional, standard verdicts ++ < 0 (not IPT_RETURN). --RR */ + + /* Clear counters and comefrom */ + e->counters = ((struct ipt_counters) { 0, 0 }); +@@ -957,6 +976,7 @@ + goto free_counters; + } + ++ /* FIXME: use iterator macros --RR */ + /* ... then go back and fix counters and names */ + for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){ + unsigned int i; +@@ -1134,6 +1154,14 @@ + const struct ipt_counters addme[], + unsigned int *i) + { ++#if 0 ++ duprintf("add_counter: Entry %u %lu/%lu + %lu/%lu\n", ++ *i, ++ (long unsigned int)e->counters.pcnt, ++ (long unsigned int)e->counters.bcnt, ++ (long unsigned int)addme[*i].pcnt, ++ (long unsigned int)addme[*i].bcnt); ++#endif + + ADD_COUNTER(e->counters, addme[*i].bcnt, addme[*i].pcnt); + +@@ -1495,6 +1523,7 @@ + return 0; + } + ++ /* FIXME: Try tcp doff >> packet len against various stacks --RR */ + + #define FWINVTCP(bool,invflg) ((bool) ^ !!(tcpinfo->invflags & invflg)) + +@@ -1670,15 +1699,14 @@ + = { { NULL, NULL }, "icmp", &icmp_match, &icmp_checkentry, NULL }; + + #ifdef CONFIG_PROC_FS +-static inline int print_name(const char *i, ++static inline int print_name(const struct ipt_table *t, + off_t start_offset, char *buffer, int length, + off_t *pos, unsigned int *count) + { + if ((*count)++ >= start_offset) { + unsigned int namelen; + +- namelen = sprintf(buffer + *pos, "%s\n", +- i + sizeof(struct list_head)); ++ namelen = sprintf(buffer + *pos, "%s\n", t->name); + if (*pos + namelen > length) { + /* Stop iterating */ + return 1; +@@ -1696,7 +1724,7 @@ + if (down_interruptible(&ipt_mutex) != 0) + return 0; + +- LIST_FIND(&ipt_tables, print_name, void *, ++ LIST_FIND(&ipt_tables, print_name, struct ipt_table *, + offset, buffer, length, &pos, &count); + + up(&ipt_mutex); +@@ -1705,46 +1733,6 @@ + *start=(char *)((unsigned long)count-offset); + return pos; + } +- +-static int ipt_get_targets(char *buffer, char **start, off_t offset, int length) +-{ +- off_t pos = 0; +- unsigned int count = 0; +- +- if (down_interruptible(&ipt_mutex) != 0) +- return 0; +- +- LIST_FIND(&ipt_target, print_name, void *, +- offset, buffer, length, &pos, &count); +- +- up(&ipt_mutex); +- +- *start = (char *)((unsigned long)count - offset); +- return pos; +-} +- +-static int ipt_get_matches(char *buffer, char **start, off_t offset, int length) +-{ +- off_t pos = 0; +- unsigned int count = 0; +- +- if (down_interruptible(&ipt_mutex) != 0) +- return 0; +- +- LIST_FIND(&ipt_match, print_name, void *, +- offset, buffer, length, &pos, &count); +- +- up(&ipt_mutex); +- +- *start = (char *)((unsigned long)count - offset); +- return pos; +-} +- +-static struct { char *name; get_info_t *get_info; } ipt_proc_entry[] = +-{ { "ip_tables_names", ipt_get_tables }, +- { "ip_tables_targets", ipt_get_targets }, +- { "ip_tables_matches", ipt_get_matches }, +- { NULL, NULL} }; + #endif /*CONFIG_PROC_FS*/ + + static int __init init(void) +@@ -1770,20 +1758,14 @@ + #ifdef CONFIG_PROC_FS + { + struct proc_dir_entry *proc; +- int i; + +- for (i = 0; ipt_proc_entry[i].name; i++) { +- proc = proc_net_create(ipt_proc_entry[i].name, 0, +- ipt_proc_entry[i].get_info); ++ proc = proc_net_create("ip_tables_names", 0, ipt_get_tables); + if (!proc) { +- while (--i >= 0) +- proc_net_remove(ipt_proc_entry[i].name); + nf_unregister_sockopt(&ipt_sockopts); + return -ENOMEM; + } + proc->owner = THIS_MODULE; + } +- } + #endif + + printk("ip_tables: (C) 2000-2002 Netfilter core team\n"); +@@ -1794,11 +1776,7 @@ + { + nf_unregister_sockopt(&ipt_sockopts); + #ifdef CONFIG_PROC_FS +- { +- int i; +- for (i = 0; ipt_proc_entry[i].name; i++) +- proc_net_remove(ipt_proc_entry[i].name); +- } ++ proc_net_remove("ip_tables_names"); + #endif + } + +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipchains_core.c src/linux/linux.stock/net/ipv4/netfilter/ipchains_core.c +--- src/linux/linux/net/ipv4/netfilter/ipchains_core.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipchains_core.c 2004-05-09 04:13:03.000000000 -0400 +@@ -977,10 +977,17 @@ + || ftmp->ipfw.fw_dst.s_addr!=frwl->ipfw.fw_dst.s_addr + || ftmp->ipfw.fw_smsk.s_addr!=frwl->ipfw.fw_smsk.s_addr + || ftmp->ipfw.fw_dmsk.s_addr!=frwl->ipfw.fw_dmsk.s_addr ++#if 0 ++ || ftmp->ipfw.fw_flg!=frwl->ipfw.fw_flg ++#else + || ((ftmp->ipfw.fw_flg & ~IP_FW_F_MARKABS) + != (frwl->ipfw.fw_flg & ~IP_FW_F_MARKABS)) ++#endif + || ftmp->ipfw.fw_invflg!=frwl->ipfw.fw_invflg + || ftmp->ipfw.fw_proto!=frwl->ipfw.fw_proto ++#if 0 ++ || ftmp->ipfw.fw_mark!=frwl->ipfw.fw_mark ++#endif + || ftmp->ipfw.fw_redirpt!=frwl->ipfw.fw_redirpt + || ftmp->ipfw.fw_spts[0]!=frwl->ipfw.fw_spts[0] + || ftmp->ipfw.fw_spts[1]!=frwl->ipfw.fw_spts[1] +@@ -1566,6 +1573,7 @@ + ) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29) ++ /* FIXME: No more `atomic' read and reset. Wonderful 8-( --RR */ + int reset = 0; + #endif + struct ip_chain *i; +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipfwadm_core.c src/linux/linux.stock/net/ipv4/netfilter/ipfwadm_core.c +--- src/linux/linux/net/ipv4/netfilter/ipfwadm_core.c 2003-10-14 04:09:33.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipfwadm_core.c 2004-05-09 04:13:03.000000000 -0400 +@@ -20,7 +20,7 @@ + * license in recognition of the original copyright. + * -- Alan Cox. + * +- * $Id: ipfwadm_core.c,v 1.1.1.4 2003/10/14 08:09:33 sparq Exp $ ++ * $Id: ipfwadm_core.c,v 1.9.2.2 2002/01/24 15:50:42 davem Exp $ + * + * Ported from BSD to Linux, + * Alan Cox 22/Nov/1994. +@@ -1205,6 +1205,7 @@ + ) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29) ++ /* FIXME: No more `atomic' read and reset. Wonderful 8-( --RR */ + int reset = 0; + #endif + return ip_chain_procinfo(IP_FW_ACCT, buffer,start, offset,length, +@@ -1223,6 +1224,7 @@ + ) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29) ++ /* FIXME: No more `atomic' read and reset. Wonderful 8-( --RR */ + int reset = 0; + #endif + return ip_chain_procinfo(IP_FW_IN, buffer,start,offset,length, +@@ -1237,6 +1239,7 @@ + ) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29) ++ /* FIXME: No more `atomic' read and reset. Wonderful 8-( --RR */ + int reset = 0; + #endif + return ip_chain_procinfo(IP_FW_OUT, buffer,start,offset,length, +@@ -1251,6 +1254,7 @@ + ) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29) ++ /* FIXME: No more `atomic' read and reset. Wonderful 8-( --RR */ + int reset = 0; + #endif + return ip_chain_procinfo(IP_FW_FWD, buffer,start,offset,length, +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipt_ECN.c src/linux/linux.stock/net/ipv4/netfilter/ipt_ECN.c +--- src/linux/linux/net/ipv4/netfilter/ipt_ECN.c 2003-10-14 04:02:57.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipt_ECN.c 2004-05-09 04:13:03.000000000 -0400 +@@ -87,8 +87,8 @@ + } + + if (diffs[0] != *tcpflags) { +- diffs[0] = diffs[0] ^ 0xFFFF; +- diffs[1] = *tcpflags; ++ diffs[0] = htons(diffs[0]) ^ 0xFFFF; ++ diffs[1] = htons(*tcpflags); + tcph->check = csum_fold(csum_partial((char *)diffs, + sizeof(diffs), + tcph->check^0xFFFF)); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipt_LOG.c src/linux/linux.stock/net/ipv4/netfilter/ipt_LOG.c +--- src/linux/linux/net/ipv4/netfilter/ipt_LOG.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipt_LOG.c 2004-05-09 04:13:03.000000000 -0400 +@@ -14,11 +14,15 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + struct esphdr { + __u32 spi; +-}; ++}; /* FIXME evil kludge */ + + /* Use lock to serialize, so printks don't overlap */ + static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipt_REJECT.c src/linux/linux.stock/net/ipv4/netfilter/ipt_REJECT.c +--- src/linux/linux/net/ipv4/netfilter/ipt_REJECT.c 2003-07-04 04:12:31.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipt_REJECT.c 2004-05-09 04:13:03.000000000 -0400 +@@ -6,8 +6,6 @@ + #include + #include + #include +-#include +-#include + #include + #include + #include +@@ -16,7 +14,11 @@ + #include + #include + ++#if 0 ++#define DEBUGP printk ++#else + #define DEBUGP(format, args...) ++#endif + + /* If the original packet is part of a connection, but the connection + is not confirmed, our manufactured reply will not be associated +@@ -155,7 +157,6 @@ + static void send_unreach(struct sk_buff *skb_in, int code) + { + struct iphdr *iph; +- struct udphdr *udph; + struct icmphdr *icmph; + struct sk_buff *nskb; + u32 saddr; +@@ -167,6 +168,7 @@ + if (!rt) + return; + ++ /* FIXME: Use sysctl number. --RR */ + if (!xrlim_allow(&rt->u.dst, 1*HZ)) + return; + +@@ -184,19 +186,6 @@ + if (iph->frag_off&htons(IP_OFFSET)) + return; + +- /* if UDP checksum is set, verify it's correct */ +- if (iph->protocol == IPPROTO_UDP +- && skb_in->tail-(u8*)iph >= sizeof(struct udphdr)) { +- int datalen = skb_in->len - (iph->ihl<<2); +- udph = (struct udphdr *)((char *)iph + (iph->ihl<<2)); +- if (udph->check +- && csum_tcpudp_magic(iph->saddr, iph->daddr, +- datalen, IPPROTO_UDP, +- csum_partial((char *)udph, datalen, +- 0)) != 0) +- return; +- } +- + /* If we send an ICMP error to an ICMP error a mess would result.. */ + if (iph->protocol == IPPROTO_ICMP + && skb_in->tail-(u8*)iph >= sizeof(struct icmphdr)) { +@@ -271,6 +260,7 @@ + /* Copy as much of original packet as will fit */ + data = skb_put(nskb, + length - sizeof(struct iphdr) - sizeof(struct icmphdr)); ++ /* FIXME: won't work with nonlinear skbs --RR */ + memcpy(data, skb_in->nh.iph, + length - sizeof(struct iphdr) - sizeof(struct icmphdr)); + icmph->checksum = ip_compute_csum((unsigned char *)icmph, +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipt_ULOG.c src/linux/linux.stock/net/ipv4/netfilter/ipt_ULOG.c +--- src/linux/linux/net/ipv4/netfilter/ipt_ULOG.c 2003-07-04 04:12:32.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipt_ULOG.c 2004-05-09 04:13:03.000000000 -0400 +@@ -12,7 +12,6 @@ + * module loadtime -HW + * 2002/07/07 remove broken nflog_rcv() function -HW + * 2002/08/29 fix shifted/unshifted nlgroup bug -HW +- * 2002/10/30 fix uninitialized mac_len field - + * + * Released under the terms of the GPL + * +@@ -32,7 +31,7 @@ + * Specify, after how many clock ticks (intel: 100 per second) the queue + * should be flushed even if it is not full yet. + * +- * ipt_ULOG.c,v 1.22 2002/10/30 09:07:31 laforge Exp ++ * ipt_ULOG.c,v 1.21 2002/08/29 10:54:34 laforge Exp + */ + + #include +@@ -60,7 +59,12 @@ + #define ULOG_NL_EVENT 111 /* Harald's favorite number */ + #define ULOG_MAXNLGROUPS 32 /* numer of nlgroups */ + ++#if 0 ++#define DEBUGP(format, args...) printk(__FILE__ ":" __FUNCTION__ ":" \ ++ format, ## args) ++#else + #define DEBUGP(format, args...) ++#endif + + #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format, ## args); } while (0) + +@@ -220,8 +224,7 @@ + && in->hard_header_len <= ULOG_MAC_LEN) { + memcpy(pm->mac, (*pskb)->mac.raw, in->hard_header_len); + pm->mac_len = in->hard_header_len; +- } else +- pm->mac_len = 0; ++ } + + if (in) + strncpy(pm->indev_name, in->name, sizeof(pm->indev_name)); +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipt_multiport.c src/linux/linux.stock/net/ipv4/netfilter/ipt_multiport.c +--- src/linux/linux/net/ipv4/netfilter/ipt_multiport.c 2003-07-04 04:12:32.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipt_multiport.c 2004-05-09 04:13:03.000000000 -0400 +@@ -8,7 +8,11 @@ + #include + #include + ++#if 0 ++#define duprintf(format, args...) printk(format , ## args) ++#else + #define duprintf(format, args...) ++#endif + + /* Returns 1 if the port is matched by the test, 0 otherwise. */ + static inline int +@@ -74,7 +78,7 @@ + + /* Must specify proto == TCP/UDP, no unknown flags or bad count */ + return (ip->proto == IPPROTO_TCP || ip->proto == IPPROTO_UDP) +- && !(ip->invflags & IPT_INV_PROTO) ++ && !(ip->flags & IPT_INV_PROTO) + && matchsize == IPT_ALIGN(sizeof(struct ipt_multiport)) + && (multiinfo->flags == IPT_MULTIPORT_SOURCE + || multiinfo->flags == IPT_MULTIPORT_DESTINATION +diff -Nurb src/linux/linux/net/ipv4/netfilter/ipt_pool.c src/linux/linux.stock/net/ipv4/netfilter/ipt_pool.c +--- src/linux/linux/net/ipv4/netfilter/ipt_pool.c 2003-07-04 04:12:32.000000000 -0400 ++++ src/linux/linux.stock/net/ipv4/netfilter/ipt_pool.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,71 +0,0 @@ +-/* Kernel module to match an IP address pool. */ +- +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-static inline int match_pool( +- ip_pool_t index, +- __u32 addr, +- int inv +-) { +- if (ip_pool_match(index, ntohl(addr))) +- inv = !inv; +- return inv; +-} +- +-static int match( +- const struct sk_buff *skb, +- const struct net_device *in, +- const struct net_device *out, +- const void *matchinfo, +- int offset, +- const void *hdr, +- u_int16_t datalen, +- int *hotdrop +-) { +- const struct ipt_pool_info *info = matchinfo; +- const struct iphdr *iph = skb->nh.iph; +- +- if (info->src != IP_POOL_NONE && !match_pool(info->src, iph->saddr, +- info->flags&IPT_POOL_INV_SRC)) +- return 0; +- +- if (info->dst != IP_POOL_NONE && !match_pool(info->dst, iph->daddr, +- info->flags&IPT_POOL_INV_DST)) +- return 0; +- +- return 1; +-} +- +-static int checkentry( +- const char *tablename, +- const struct ipt_ip *ip, +- void *matchinfo, +- unsigned int matchsize, +- unsigned int hook_mask +-) { +- if (matchsize != IPT_ALIGN(sizeof(struct ipt_pool_info))) +- return 0; +- return 1; +-} +- +-static struct ipt_match pool_match +-= { { NULL, NULL }, "pool", &match, &checkentry, NULL, THIS_MODULE }; +- +-static int __init init(void) +-{ +- return ipt_register_match(&pool_match); +-} +- +-static void __exit fini(void) +-{ +- ipt_unregister_match(&pool_match); +-} +- +-module_init(init); +-module_exit(fini); +diff -Nurb src/linux/linux/net/ipv6/mcast.c src/linux/linux.stock/net/ipv6/mcast.c +--- src/linux/linux/net/ipv6/mcast.c 2003-10-14 04:09:34.000000000 -0400 ++++ src/linux/linux.stock/net/ipv6/mcast.c 2004-05-09 04:13:22.000000000 -0400 +@@ -5,7 +5,7 @@ + * Authors: + * Pedro Roque + * +- * $Id: mcast.c,v 1.1.1.4 2003/10/14 08:09:34 sparq Exp $ ++ * $Id: mcast.c,v 1.38 2001/08/15 07:36:31 davem Exp $ + * + * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c + * diff --git a/obsolete-buildroot/sources/openwrt-wrt54g-linux.config b/obsolete-buildroot/sources/openwrt-wrt54g-linux.config new file mode 100644 index 0000000000..20256a05e6 --- /dev/null +++ b/obsolete-buildroot/sources/openwrt-wrt54g-linux.config @@ -0,0 +1,843 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_MIPS=y +CONFIG_MIPS32=y +# CONFIG_MIPS64 is not set + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y + +# +# Loadable module support +# +CONFIG_MODULES=y +# CONFIG_MODVERSIONS is not set +# CONFIG_KMOD is not set + +# +# Machine selection +# +# CONFIG_ACER_PICA_61 is not set +# CONFIG_MIPS_DB1000 is not set +# CONFIG_MIPS_DB1100 is not set +# CONFIG_MIPS_DB1500 is not set +# CONFIG_MIPS_PB1000 is not set +# CONFIG_MIPS_PB1100 is not set +# CONFIG_MIPS_PB1500 is not set +# CONFIG_BAGET_MIPS is not set +# CONFIG_CASIO_E55 is not set +# CONFIG_MIPS_COBALT is not set +# CONFIG_DECSTATION is not set +# CONFIG_MIPS_EV64120 is not set +# CONFIG_MIPS_EV96100 is not set +# CONFIG_MIPS_IVR is not set +# CONFIG_HP_LASERJET is not set +# CONFIG_IBM_WORKPAD is not set +# CONFIG_LASAT is not set +# CONFIG_MIPS_ITE8172 is not set +# CONFIG_MIPS_ATLAS is not set +# CONFIG_MIPS_MAGNUM_4000 is not set +# CONFIG_MIPS_MALTA is not set +# CONFIG_MIPS_SEAD is not set +# CONFIG_MOMENCO_OCELOT is not set +# CONFIG_MOMENCO_OCELOT_G is not set +# CONFIG_DDB5074 is not set +# CONFIG_DDB5476 is not set +# CONFIG_DDB5477 is not set +# CONFIG_NEC_OSPREY is not set +# CONFIG_NEC_EAGLE is not set +# CONFIG_OLIVETTI_M700 is not set +# CONFIG_NINO is not set +# CONFIG_SGI_IP22 is not set +# CONFIG_SGI_IP27 is not set +# CONFIG_SGI_IP32 is not set +# CONFIG_SIBYTE_SB1xxx_SOC is not set +CONFIG_MIPS_BRCM=y +CONFIG_BCM947XX=y +CONFIG_BCM4710=y +CONFIG_BCM4310=y +CONFIG_BCM4704=y +# CONFIG_BCM5365 is not set +# CONFIG_SNI_RM200_PCI is not set +# CONFIG_TOSHIBA_JMR3927 is not set +# CONFIG_VICTOR_MPC30X is not set +# CONFIG_ZAO_CAPCELLA is not set +# CONFIG_HIGHMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs init=/etc/preinit noinitrd console=ttyS0,115200" +CONFIG_PCI=y +CONFIG_NONCOHERENT_IO=y +CONFIG_NEW_TIME_C=y +CONFIG_NEW_IRQ=y +CONFIG_HND=y +# CONFIG_MIPS_AU1000 is not set + +# +# CPU selection +# +CONFIG_CPU_MIPS32=y +# CONFIG_CPU_MIPS64 is not set +# CONFIG_CPU_R3000 is not set +# CONFIG_CPU_TX39XX is not set +# CONFIG_CPU_VR41XX is not set +# CONFIG_CPU_R4300 is not set +# CONFIG_CPU_R4X00 is not set +# CONFIG_CPU_TX49XX is not set +# CONFIG_CPU_R5000 is not set +# CONFIG_CPU_R5432 is not set +# CONFIG_CPU_R6000 is not set +# CONFIG_CPU_NEVADA is not set +# CONFIG_CPU_R8000 is not set +# CONFIG_CPU_R10000 is not set +# CONFIG_CPU_RM7000 is not set +# CONFIG_CPU_SB1 is not set +CONFIG_CPU_HAS_PREFETCH=y +# CONFIG_VTAG_ICACHE is not set +# CONFIG_64BIT_PHYS_ADDR is not set +# CONFIG_CPU_ADVANCED is not set +CONFIG_CPU_HAS_LLSC=y +# CONFIG_CPU_HAS_LLDSCD is not set +# CONFIG_CPU_HAS_WB is not set +CONFIG_CPU_HAS_SYNC=y + +# +# General setup +# +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_NET=y +# CONFIG_PCI_NAMES is not set +# CONFIG_ISA is not set +# CONFIG_EISA is not set +# CONFIG_TC is not set +# CONFIG_MCA is not set +# CONFIG_SBUS is not set +CONFIG_HOTPLUG=y + +# +# PCMCIA/CardBus support +# +# CONFIG_PCMCIA is not set + +# +# PCI Hotplug Support +# +# CONFIG_HOTPLUG_PCI is not set +# CONFIG_HOTPLUG_PCI_COMPAQ is not set +# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set +# CONFIG_HOTPLUG_PCI_ACPI is not set +# CONFIG_SYSVIPC is not set +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +# CONFIG_PRINT_SYSCALLS is not set +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_MIPS32_COMPAT is not set +# CONFIG_MIPS32_O32 is not set +# CONFIG_MIPS32_N32 is not set +# CONFIG_BINFMT_ELF32 is not set +# CONFIG_BINFMT_MISC is not set +# CONFIG_PM is not set + +# +# Memory Technology Devices (MTD) +# +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_CONCAT is not set +# CONFIG_MTD_REDBOOT_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +# CONFIG_MTD_BLOCK is not set +CONFIG_MTD_BLOCK_RO=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_GEN_PROBE=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +CONFIG_MTD_CFI_NOSWAP=y +# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set +# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set +CONFIG_MTD_CFI_GEOMETRY=y +# CONFIG_MTD_CFI_B1 is not set +CONFIG_MTD_CFI_B2=y +# CONFIG_MTD_CFI_B4 is not set +CONFIG_MTD_CFI_I1=y +# CONFIG_MTD_CFI_I2 is not set +# CONFIG_MTD_CFI_I4 is not set +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_CFI_SSTSTD=y +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_OBSOLETE_CHIPS is not set +# CONFIG_MTD_AMDSTD is not set +# CONFIG_MTD_SHARP is not set +# CONFIG_MTD_JEDEC is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_PHYSMAP is not set +CONFIG_MTD_BCM947XX=y +# CONFIG_MTD_PB1000 is not set +# CONFIG_MTD_PB1500 is not set +# CONFIG_MTD_PB1100 is not set +# CONFIG_MTD_CSTM_MIPS_IXX is not set +# CONFIG_MTD_OCELOT is not set +# CONFIG_MTD_LASAT is not set +# CONFIG_MTD_PCI is not set + +# +# Self-contained MTD device drivers +# +CONFIG_MTD_SFLASH=y +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLKMTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOC1000 is not set +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOCPROBE is not set + +# +# NAND Flash Device Drivers +# +# CONFIG_MTD_NAND is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play configuration +# +# CONFIG_PNP is not set +# CONFIG_ISAPNP is not set + +# +# Block devices +# +# CONFIG_BLK_DEV_MSYS is not set +# CONFIG_NOROOT is not set +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_XD is not set +# CONFIG_PARIDE is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_CISS_SCSI_TAPE is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_NBD=m +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_BLK_DEV_INITRD is not set +# CONFIG_BLK_STATS is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set +# CONFIG_BLK_DEV_MD is not set +# CONFIG_MD_LINEAR is not set +# CONFIG_MD_RAID0 is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set +# CONFIG_MD_MULTIPATH is not set +# CONFIG_BLK_DEV_LVM is not set + +# +# Networking options +# +CONFIG_PACKET=y +CONFIG_PACKET_MMAP=y +CONFIG_NETLINK_DEV=m +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +# CONFIG_FILTER is not set +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_FWMARK=y +CONFIG_IP_ROUTE_NAT=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +CONFIG_IP_ROUTE_TOS=y +# CONFIG_IP_ROUTE_VERBOSE is not set +# CONFIG_IP_ROUTE_LARGE_TABLES is not set +# CONFIG_IP_PNP is not set +CONFIG_NET_IPIP=m +CONFIG_NET_IPGRE=m +# CONFIG_ARPD is not set +# CONFIG_INET_ECN is not set +# CONFIG_SYN_COOKIES is not set + +# +# IP: Netfilter Configuration +# +CONFIG_IP_NF_CONNTRACK=y +CONFIG_IP_NF_FTP=y +CONFIG_IP_NF_H323=y +CONFIG_IP_NF_CONNTRACK_MARK=y +# CONFIG_IP_NF_AMANDA is not set +CONFIG_IP_NF_TFTP=y +CONFIG_IP_NF_IRC=y +CONFIG_IP_NF_CT_PROTO_GRE=y +CONFIG_IP_NF_PPTP=y +CONFIG_IP_NF_MMS=y +CONFIG_IP_NF_QUEUE=m +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_MATCH_LIMIT=m +CONFIG_IP_NF_SET=m +CONFIG_IP_NF_SET_MAX=256 +CONFIG_IP_NF_SET_IPMAP=m +CONFIG_IP_NF_SET_PORTMAP=m +CONFIG_IP_NF_SET_MACIPMAP=m +CONFIG_IP_NF_SET_IPHASH=m +CONFIG_IP_NF_MATCH_QUOTA=m +CONFIG_IP_NF_POOL=m +CONFIG_IP_POOL_STATISTICS=y +CONFIG_IP_NF_MATCH_IPRANGE=m +CONFIG_IP_NF_MATCH_DSTLIMIT=m +CONFIG_IP_NF_MATCH_MAC=m +CONFIG_IP_NF_MATCH_PKTTYPE=m +CONFIG_IP_NF_MATCH_MARK=y +CONFIG_IP_NF_MATCH_MULTIPORT=m +CONFIG_IP_NF_MATCH_TOS=m +CONFIG_IP_NF_MATCH_CONDITION=m +# CONFIG_IP_NF_MATCH_RANDOM is not set +CONFIG_IP_NF_MATCH_PSD=m +# CONFIG_IP_NF_MATCH_OSF is not set +# CONFIG_IP_NF_MATCH_NTH is not set +CONFIG_IP_NF_MATCH_IPV4OPTIONS=m +# CONFIG_IP_NF_MATCH_FUZZY is not set +CONFIG_IP_NF_MATCH_RECENT=m +CONFIG_IP_NF_MATCH_ECN=m +CONFIG_IP_NF_MATCH_DSCP=m +CONFIG_IP_NF_MATCH_AH_ESP=m +CONFIG_IP_NF_MATCH_LENGTH=m +# CONFIG_IP_NF_MATCH_U32 is not set +CONFIG_IP_NF_MATCH_TTL=m +CONFIG_IP_NF_MATCH_TCPMSS=y +# CONFIG_IP_NF_MATCH_REALM is not set +CONFIG_IP_NF_MATCH_HELPER=m +CONFIG_IP_NF_MATCH_STATE=y +CONFIG_IP_NF_MATCH_CONNMARK=m +CONFIG_IP_NF_MATCH_CONNLIMIT=m +CONFIG_IP_NF_MATCH_CONNTRACK=m +CONFIG_IP_NF_MATCH_UNCLEAN=m +CONFIG_IP_NF_MATCH_STRING=m +# CONFIG_IP_NF_MATCH_OWNER is not set +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_TARGET_NETLINK=m +CONFIG_IP_NF_TARGET_IPV4OPTSSTRIP=m +CONFIG_IP_NF_TARGET_MIRROR=m +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_NAT_NEEDED=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_IP_NF_NAT_H323=y +# CONFIG_IP_NF_TARGET_SAME is not set +# CONFIG_IP_NF_TARGET_NETMAP is not set +CONFIG_IP_NF_NAT_PPTP=y +CONFIG_IP_NF_NAT_PROTO_GRE=y +# CONFIG_IP_NF_NAT_LOCAL is not set +CONFIG_IP_NF_NAT_SNMP_BASIC=m +CONFIG_IP_NF_NAT_IRC=y +CONFIG_IP_NF_NAT_MMS=y +CONFIG_IP_NF_NAT_FTP=y +CONFIG_IP_NF_NAT_TFTP=y +CONFIG_IP_NF_MANGLE=y +CONFIG_IP_NF_TARGET_TOS=m +CONFIG_IP_NF_TARGET_ECN=m +CONFIG_IP_NF_TARGET_DSCP=m +CONFIG_IP_NF_TARGET_MARK=y +CONFIG_IP_NF_TARGET_IPMARK=m +CONFIG_IP_NF_TARGET_CLASSIFY=m +CONFIG_IP_NF_TARGET_LOG=y +CONFIG_IP_NF_TARGET_CONNMARK=m +CONFIG_IP_NF_TARGET_TTL=m +CONFIG_IP_NF_TARGET_ULOG=m +CONFIG_IP_NF_TARGET_TCPMSS=y +# CONFIG_IP_NF_RAW is not set +CONFIG_IP_NF_ARPTABLES=m +CONFIG_IP_NF_ARPFILTER=m +CONFIG_IP_NF_ARP_MANGLE=m +CONFIG_IPV6=m + +# +# IPv6: Netfilter Configuration +# +CONFIG_IP6_NF_QUEUE=m +CONFIG_IP6_NF_IPTABLES=m +CONFIG_IP6_NF_MATCH_LIMIT=m +CONFIG_IP6_NF_MATCH_MAC=m +# CONFIG_IP6_NF_MATCH_RANDOM is not set +# CONFIG_IP6_NF_MATCH_NTH is not set +# CONFIG_IP6_NF_MATCH_FUZZY is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_HL is not set +CONFIG_IP6_NF_MATCH_MULTIPORT=m +CONFIG_IP6_NF_MATCH_OWNER=m +CONFIG_IP6_NF_MATCH_MARK=m +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_AHESP is not set +CONFIG_IP6_NF_MATCH_LENGTH=m +CONFIG_IP6_NF_MATCH_EUI64=m +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_TARGET_LOG=m +CONFIG_IP6_NF_MANGLE=m +CONFIG_IP6_NF_TARGET_MARK=m +# CONFIG_KHTTPD is not set +# CONFIG_ATM is not set +CONFIG_VLAN_8021Q=y + +# +# +# +# CONFIG_IPX is not set +# CONFIG_ATALK is not set + +# +# Appletalk devices +# +# CONFIG_DEV_APPLETALK is not set +# CONFIG_DECNET is not set +CONFIG_BRIDGE=y +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_LLC is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +CONFIG_WAN_ROUTER=m +# CONFIG_NET_FASTROUTE is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_CBQ=m +CONFIG_NET_SCH_HTB=m +CONFIG_NET_SCH_CSZ=m +CONFIG_NET_SCH_PRIO=m +CONFIG_NET_SCH_RED=m +CONFIG_NET_SCH_SFQ=m +CONFIG_NET_SCH_TEQL=m +CONFIG_NET_SCH_TBF=m +CONFIG_NET_SCH_GRED=m +CONFIG_NET_SCH_DSMARK=m +CONFIG_NET_SCH_INGRESS=m +CONFIG_NET_QOS=y +CONFIG_NET_ESTIMATOR=y +CONFIG_NET_CLS=y +CONFIG_NET_CLS_TCINDEX=m +CONFIG_NET_CLS_ROUTE4=m +CONFIG_NET_CLS_ROUTE=y +CONFIG_NET_CLS_FW=m +CONFIG_NET_CLS_U32=m +CONFIG_NET_CLS_RSVP=m +CONFIG_NET_CLS_RSVP6=m +CONFIG_NET_CLS_POLICE=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set +# CONFIG_PHONE_IXJ is not set +# CONFIG_PHONE_IXJ_PCMCIA is not set + +# +# ATA/IDE/MFM/RLL support +# +# CONFIG_IDE is not set +# CONFIG_BLK_DEV_IDE_MODES is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI support +# +# CONFIG_SCSI is not set + +# +# I2O device support +# +# CONFIG_I2O is not set +# CONFIG_I2O_PCI is not set +# CONFIG_I2O_BLOCK is not set +# CONFIG_I2O_LAN is not set +# CONFIG_I2O_SCSI is not set +# CONFIG_I2O_PROC is not set + +# +# Network device support +# +CONFIG_NETDEVICES=y + +# +# Broadcom HND network devices +# +CONFIG_HND=y +# CONFIG_IL is not set +CONFIG_ET=m +# CONFIG_ET_4413 is not set +CONFIG_ET_47XX=y +CONFIG_WL=m +CONFIG_WL_AP=y +CONFIG_WL_STA=y + +# +# ARCnet devices +# +# CONFIG_ARCNET is not set +# CONFIG_DUMMY is not set +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set +# CONFIG_ETHERTAP is not set + +# +# Ethernet (10 or 100Mbit) +# +CONFIG_NET_ETHERNET=y +# CONFIG_SUNLANCE is not set +# CONFIG_HAPPYMEAL is not set +# CONFIG_SUNBMAC is not set +# CONFIG_SUNQE is not set +# CONFIG_SUNGEM is not set +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_HP100 is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_PCI is not set +# CONFIG_NET_POCKET is not set + +# +# Ethernet (1000 Mbit) +# +# CONFIG_ACENIC is not set +# CONFIG_DL2K is not set +# CONFIG_E1000 is not set +# CONFIG_MYRI_SBUS is not set +# CONFIG_NS83820 is not set +# CONFIG_HAMACHI is not set +# CONFIG_YELLOWFIN is not set +# CONFIG_SK98LIN is not set +# CONFIG_TIGON3 is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PLIP is not set +CONFIG_PPP=y +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_ASYNC=y +# CONFIG_PPP_SYNC_TTY is not set +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPPOE=m +# CONFIG_SLIP is not set + +# +# Wireless LAN (non-hamradio) +# +CONFIG_NET_RADIO=y +# CONFIG_STRIP is not set +# CONFIG_WAVELAN is not set +# CONFIG_ARLAN is not set +# CONFIG_AIRONET4500 is not set +# CONFIG_AIRONET4500_NONCS is not set +# CONFIG_AIRONET4500_PROC is not set +# CONFIG_AIRO is not set +# CONFIG_HERMES is not set +# CONFIG_PLX_HERMES is not set +# CONFIG_PCI_HERMES is not set +CONFIG_NET_WIRELESS=y + +# +# Token Ring devices +# +# CONFIG_TR is not set +# CONFIG_NET_FC is not set +# CONFIG_RCPCI is not set +CONFIG_SHAPER=m + +# +# Wan interfaces +# +# CONFIG_WAN is not set + +# +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Input core support +# +# CONFIG_INPUT is not set +# CONFIG_INPUT_KEYBDEV is not set +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_EVDEV is not set + +# +# Character devices +# +# CONFIG_VT is not set +CONFIG_SERIAL=y +CONFIG_SERIAL_CONSOLE=y +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +CONFIG_UNIX98_PTYS=y +CONFIG_UNIX98_PTY_COUNT=128 + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +# CONFIG_MOUSE is not set + +# +# Joysticks +# +# CONFIG_INPUT_GAMEPORT is not set + +# +# Input core support is needed for gameports +# + +# +# Input core support is needed for joysticks +# +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_NOWAYOUT=y +# CONFIG_ACQUIRE_WDT is not set +# CONFIG_ADVANTECH_WDT is not set +# CONFIG_ALIM7101_WDT is not set +# CONFIG_SC520_WDT is not set +# CONFIG_PCWATCHDOG is not set +# CONFIG_EUROTECH_WDT is not set +# CONFIG_IB700_WDT is not set +# CONFIG_WAFER_WDT is not set +# CONFIG_I810_TCO is not set +# CONFIG_MIXCOMWD is not set +# CONFIG_60XX_WDT is not set +# CONFIG_SC1200_WDT is not set +CONFIG_SOFT_WATCHDOG=y +# CONFIG_W83877F_WDT is not set +# CONFIG_WDT is not set +# CONFIG_WDTPCI is not set +# CONFIG_MACHZ_WDT is not set +# CONFIG_INDYDOG is not set +# CONFIG_AMD7XX_TCO is not set +# CONFIG_AMD_PM768 is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# File systems +# +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADFS_FS_RW is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BEFS_DEBUG is not set +# CONFIG_BFS_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_JBD_DEBUG is not set +# CONFIG_FAT_FS is not set +# CONFIG_MSDOS_FS is not set +# CONFIG_UMSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_TMPFS is not set +CONFIG_RAMFS=y +# CONFIG_ISO9660_FS is not set +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_JFS_FS is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +# CONFIG_HPFS_FS is not set +CONFIG_PROC_FS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_EXT2_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set +# CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set + +# +# Network File Systems +# +# CONFIG_CODA_FS is not set +# CONFIG_INTERMEZZO_FS is not set +CONFIG_NFS_FS=m +CONFIG_NFS_V3=y +# CONFIG_ROOT_NFS is not set +# CONFIG_NFSD is not set +# CONFIG_NFSD_V3 is not set +# CONFIG_NFSD_TCP is not set +CONFIG_SUNRPC=m +CONFIG_LOCKD=m +CONFIG_LOCKD_V4=y +# CONFIG_SMB_FS is not set +# CONFIG_NCP_FS is not set +# CONFIG_NCPFS_PACKET_SIGNING is not set +# CONFIG_NCPFS_IOCTL_LOCKING is not set +# CONFIG_NCPFS_STRONG is not set +# CONFIG_NCPFS_NFS_NS is not set +# CONFIG_NCPFS_OS2_NS is not set +# CONFIG_NCPFS_SMALLDOS is not set +# CONFIG_NCPFS_NLS is not set +# CONFIG_NCPFS_EXTRAS is not set +# CONFIG_ZISOFS_FS is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_MAC_PARTITION is not set +# CONFIG_MSDOS_PARTITION is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_EFI_PARTITION is not set +# CONFIG_SMB_NLS is not set +# CONFIG_NLS is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# +# CONFIG_USB is not set + +# +# Support for USB gadgets +# +# CONFIG_USB_GADGET is not set + +# +# Bluetooth support +# +# CONFIG_BLUEZ is not set + +# +# Kernel hacking +# +CONFIG_CROSSCOMPILE=y +# CONFIG_KERNPROF is not set +# CONFIG_MCOUNT is not set +# CONFIG_DEBUG is not set +CONFIG_MAGIC_SYSRQ=y +# CONFIG_MIPS_UNCACHED is not set +# CONFIG_KTRACE is not set +# CONFIG_HWSIM is not set + +# +# Library routines +# +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y diff --git a/obsolete-buildroot/sources/openwrt-wrt54g-linux.patch b/obsolete-buildroot/sources/openwrt-wrt54g-linux.patch new file mode 100644 index 0000000000..67223f0128 --- /dev/null +++ b/obsolete-buildroot/sources/openwrt-wrt54g-linux.patch @@ -0,0 +1,1791 @@ +diff -urN src/linux-dist/linux/Makefile src/linux/linux/Makefile +--- src/linux-dist/linux/Makefile 2003-10-14 03:00:10.000000000 -0500 ++++ src/linux/linux/Makefile 2004-03-29 17:00:53.000000000 -0600 +@@ -17,7 +17,7 @@ + FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu + + HOSTCC = gcc +-HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer ++HOSTCFLAGS = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer + + CROSS_COMPILE = + +@@ -88,7 +88,7 @@ + + CPPFLAGS := -D__KERNEL__ -I$(HPATH) + +-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ ++CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ + -fno-strict-aliasing -fno-common + + # Turn on -pg to instrument the kernel with calls to mcount(). +diff -urN src/linux-dist/linux/arch/mips/brcm-boards/bcm947xx/setup.c src/linux/linux/arch/mips/brcm-boards/bcm947xx/setup.c +--- src/linux-dist/linux/arch/mips/brcm-boards/bcm947xx/setup.c 2003-11-11 08:08:46.000000000 -0600 ++++ src/linux/linux/arch/mips/brcm-boards/bcm947xx/setup.c 2004-03-29 17:00:53.000000000 -0600 +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #endif + + #include +@@ -160,37 +161,38 @@ + #ifdef CONFIG_MTD_PARTITIONS + + static struct mtd_partition bcm947xx_parts[] = { +- { name: "pmon", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, ++ { name: "pmon", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, }, + { name: "linux", offset: 0, size: 0, }, + { name: "rootfs", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, + { name: "nvram", offset: 0, size: 0, }, ++ { name: "OpenWrt", offset: 0, size: 0, }, + { name: NULL, }, + }; + +-struct mtd_partition * __init +-init_mtd_partitions(struct mtd_info *mtd, size_t size) ++ ++static int __init ++find_root(struct mtd_info *mtd, size_t size, struct mtd_partition *part) + { +- struct minix_super_block *minixsb; +- struct ext2_super_block *ext2sb; +- struct romfs_super_block *romfsb; + struct cramfs_super *cramfsb; ++ struct squashfs_super_block *squashfsb; + struct trx_header *trx; ++ + unsigned char buf[512]; + int off; + size_t len; + +- minixsb = (struct minix_super_block *) buf; +- ext2sb = (struct ext2_super_block *) buf; +- romfsb = (struct romfs_super_block *) buf; + cramfsb = (struct cramfs_super *) buf; ++ squashfsb = (struct squashfs_super_block *) buf; + trx = (struct trx_header *) buf; + +- /* Look at every 64 KB boundary */ +- for (off = 0; off < size; off += (64 * 1024)) { ++ part->offset = 0; ++ part->size = 0; ++ ++ for (off = 0; off < size; off += mtd->erasesize) { + memset(buf, 0xe5, sizeof(buf)); + + /* +- * Read block 0 to test for romfs and cramfs superblock ++ * Read block 0 to test for cramfs superblock + */ + if (MTD_READ(mtd, off, sizeof(buf), &len, buf) || + len != sizeof(buf)) +@@ -198,75 +200,105 @@ + + /* 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) + off = le32_to_cpu(trx->offsets[1]); + continue; + } + +- /* romfs is at block zero too */ +- if (romfsb->word0 == ROMSB_WORD0 && +- romfsb->word1 == ROMSB_WORD1) { +- printk(KERN_NOTICE +- "%s: romfs filesystem found at block %d\n", +- mtd->name, off / BLOCK_SIZE); +- goto done; +- } +- +- /* so is cramfs */ ++ /* need to find cramfs */ + if (cramfsb->magic == CRAMFS_MAGIC) { + printk(KERN_NOTICE + "%s: cramfs filesystem found at block %d\n", + mtd->name, off / BLOCK_SIZE); +- goto done; +- } +- +- /* +- * Read block 1 to test for minix and ext2 superblock +- */ +- if (MTD_READ(mtd, off + BLOCK_SIZE, sizeof(buf), &len, buf) || +- len != sizeof(buf)) +- continue; + +- /* Try minix */ +- if (minixsb->s_magic == MINIX_SUPER_MAGIC || +- minixsb->s_magic == MINIX_SUPER_MAGIC2) { +- printk(KERN_NOTICE +- "%s: Minix filesystem found at block %d\n", +- mtd->name, off / BLOCK_SIZE); ++ part->size = cramfsb->size; + goto done; + } + +- /* Try ext2 */ +- if (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) { ++ /* or squashfs */ ++ if (squashfsb->s_magic == SQUASHFS_MAGIC) { + printk(KERN_NOTICE +- "%s: ext2 filesystem found at block %d\n", ++ "%s: squashfs filesystem found at block %d\n", + mtd->name, off / BLOCK_SIZE); ++ part->size = squashfsb->bytes_used+2048; + goto done; + } +- } + ++ } + printk(KERN_NOTICE +- "%s: Couldn't find valid ROM disk image\n", ++ "%s: Couldn't find valid cramfs image\n", + mtd->name); ++ return -1; ++ ++done: ++ part->offset = off; ++ return 0; ++} ++ ++ ++struct mtd_partition * __init ++init_mtd_partitions(struct mtd_info *mtd, size_t size) ++{ ++ ++ bcm947xx_parts[0].offset=0; ++ bcm947xx_parts[0].size=256*1024; + +- done: + /* Find and size nvram */ + bcm947xx_parts[3].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize); + bcm947xx_parts[3].size = size - bcm947xx_parts[3].offset; + + /* Find and size rootfs */ +- if (off < size) { +- bcm947xx_parts[2].offset = off; +- bcm947xx_parts[2].size = bcm947xx_parts[3].offset - bcm947xx_parts[2].offset; +- } ++ //if (off < size) { ++ // bcm947xx_parts[2].offset = off; ++ // bcm947xx_parts[2].size = bcm947xx_parts[3].offset - bcm947xx_parts[2].offset; ++ //} ++ ++ /* Find and size rootfs */ ++ find_root(mtd,size,&bcm947xx_parts[2]); ++ ++ + + /* Size linux (kernel and rootfs) */ ++ bcm947xx_parts[1].offset = bcm947xx_parts[0].size; + bcm947xx_parts[1].size = bcm947xx_parts[3].offset - bcm947xx_parts[1].offset; + ++ ++ ++ /* calculate leftover flash, and assign it to the jffs partition */ ++ size_t spot; ++ size_t len; ++ size_t mask; ++ // get the offset to the end of the root_fs ++ spot=bcm947xx_parts[2].offset+bcm947xx_parts[2].size; ++ // round it up to an erase size boundary ++ spot+=mtd->erasesize-1; ++ // mask the number to the boundary ++ mask=mtd->erasesize; ++ mask=mask-1; ++ mask=mask^0xffffffff; ++ spot&=mask; ++ // length = flashsize - start position - nvram size ++ len=size-spot; ++ len=len-bcm947xx_parts[3].size; ++ ++ ++ bcm947xx_parts[4].offset = spot; ++ bcm947xx_parts[4].size = len; ++ ++ ++ ++ + /* Size pmon */ + bcm947xx_parts[0].size = bcm947xx_parts[1].offset - bcm947xx_parts[0].offset; + ++ //int x; ++ //for(x=0; x<5; x++) { ++ // printk(KERN_NOTICE ++ // "Partition %d mask_flags %08x\n", ++ // x,bcm947xx_parts[x].mask_flags); ++ //} ++ ++ + return bcm947xx_parts; + } + +diff -urN src/linux-dist/linux/drivers/mtd/maps/bcm947xx-flash.c src/linux/linux/drivers/mtd/maps/bcm947xx-flash.c +--- src/linux-dist/linux/drivers/mtd/maps/bcm947xx-flash.c 2003-11-08 03:35:52.000000000 -0600 ++++ src/linux/linux/drivers/mtd/maps/bcm947xx-flash.c 2004-03-29 17:00:53.000000000 -0600 +@@ -82,7 +82,21 @@ + + void bcm947xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) + { ++ //memcpy_fromio(to, map->map_priv_1 + from, len); ++ if (len==1) { + memcpy_fromio(to, map->map_priv_1 + from, len); ++ } else { ++ int i; ++ u16 *dest = (u16 *) to; ++ u16 *src = (u16 *) (map->map_priv_1 + from); ++ ++ for (i = 0; i < (len / 2); i++) { ++ dest[i] = src[i]; ++ } ++ ++ if (len & 1) ++ *((u8 *)dest+len-1) = src[i] & 0xff; ++ } + } + + void bcm947xx_map_write8(struct map_info *map, __u8 d, unsigned long adr) +diff -urN src/linux-dist/linux/drivers/net/Makefile src/linux/linux/drivers/net/Makefile +--- src/linux-dist/linux/drivers/net/Makefile 2004-02-12 20:35:15.000000000 -0600 ++++ src/linux/linux/drivers/net/Makefile 2004-03-29 17:00:53.000000000 -0600 +@@ -25,7 +25,7 @@ + list-multi := rcpci.o + rcpci-objs := rcpci45.o rclanmtl.o + +-subdir-m += mac ++# subdir-m += mac + subdir-m += diag + + ifeq ($(CONFIG_HW_QOS),y) +diff -urN src/linux-dist/linux/fs/Config.in src/linux/linux/fs/Config.in +--- src/linux-dist/linux/fs/Config.in 2003-07-04 03:12:05.000000000 -0500 ++++ src/linux/linux/fs/Config.in 2004-03-29 17:00:53.000000000 -0600 +@@ -47,6 +47,7 @@ + int 'JFFS2 debugging verbosity (0 = quiet, 2 = noisy)' CONFIG_JFFS2_FS_DEBUG 0 + fi + tristate 'Compressed ROM file system support' CONFIG_CRAMFS ++tristate 'Squashed file system support' CONFIG_SQUASHFS + bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS + define_bool CONFIG_RAMFS y + +diff -urN src/linux-dist/linux/fs/Makefile src/linux/linux/fs/Makefile +--- src/linux-dist/linux/fs/Makefile 2003-07-04 03:12:05.000000000 -0500 ++++ src/linux/linux/fs/Makefile 2004-03-29 17:00:53.000000000 -0600 +@@ -68,6 +68,7 @@ + subdir-$(CONFIG_SUN_OPENPROMFS) += openpromfs + subdir-$(CONFIG_BEFS_FS) += befs + subdir-$(CONFIG_JFS_FS) += jfs ++subdir-$(CONFIG_SQUASHFS) += squashfs + + + obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o +diff -urN src/linux-dist/linux/fs/squashfs/Makefile src/linux/linux/fs/squashfs/Makefile +--- src/linux-dist/linux/fs/squashfs/Makefile 1969-12-31 18:00:00.000000000 -0600 ++++ src/linux/linux/fs/squashfs/Makefile 2004-03-29 17:00:53.000000000 -0600 +@@ -0,0 +1,11 @@ ++# ++# Makefile for the linux squashfs routines. ++# ++ ++O_TARGET := squashfs.o ++ ++obj-y := inode.o ++ ++obj-m := $(O_TARGET) ++ ++include $(TOPDIR)/Rules.make +diff -urN src/linux-dist/linux/fs/squashfs/inode.c src/linux/linux/fs/squashfs/inode.c +--- src/linux-dist/linux/fs/squashfs/inode.c 1969-12-31 18:00:00.000000000 -0600 ++++ src/linux/linux/fs/squashfs/inode.c 2004-03-29 17:00:53.000000000 -0600 +@@ -0,0 +1,972 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002 Phillip Lougher ++ * ++ * 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. ++ * ++ * inode.c ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#ifdef SQUASHFS_TRACE ++#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args) ++#else ++#define TRACE(s, args...) {} ++#endif ++ ++#define ERROR(s, args...) printk(KERN_ERR "SQUASHFS error: "s, ## args) ++ ++#define SERROR(s, args...) if(!silent) printk(KERN_ERR "SQUASHFS error: "s, ## args) ++#define WARNING(s, args...) printk(KERN_WARNING "SQUASHFS: "s, ## args) ++ ++static struct super_block *squashfs_read_super(struct super_block *, void *, int); ++static void squashfs_put_super(struct super_block *); ++static int squashfs_statfs(struct super_block *, struct statfs *); ++static int squashfs_symlink_readpage(struct file *file, struct page *page); ++static int squashfs_readpage(struct file *file, struct page *page); ++static int squashfs_readdir(struct file *, void *, filldir_t); ++static struct dentry *squashfs_lookup(struct inode *, struct dentry *); ++static unsigned int read_data(struct super_block *s, char *buffer, ++ unsigned int index, int length, unsigned int *next_index); ++static int squashfs_get_cached_block(struct super_block *s, char *buffer, ++ unsigned int block, unsigned int offset, int length, ++ unsigned int *next_block, unsigned int *next_offset); ++static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode); ++static void squashfs_put_super(struct super_block *s); ++ ++DECLARE_MUTEX(read_data_mutex); ++ ++static z_stream stream; ++ ++static DECLARE_FSTYPE_DEV(squashfs_fs_type, "squashfs", squashfs_read_super); ++ ++static unsigned char squashfs_filetype_table[] = { ++ DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK ++}; ++ ++static struct super_operations squashfs_ops = { ++ statfs: squashfs_statfs, ++ put_super: squashfs_put_super, ++}; ++ ++static struct address_space_operations squashfs_symlink_aops = { ++ readpage: squashfs_symlink_readpage ++}; ++ ++static struct address_space_operations squashfs_aops = { ++ readpage: squashfs_readpage ++}; ++ ++static struct file_operations squashfs_dir_ops = { ++ read: generic_read_dir, ++ readdir: squashfs_readdir ++}; ++ ++static struct inode_operations squashfs_dir_inode_ops = { ++ lookup: squashfs_lookup ++}; ++ ++ ++static unsigned int read_data(struct super_block *s, char *buffer, ++ unsigned int index, int length, unsigned int *next_index) ++{ ++ squashfs_sb_info *msBlk = &s->u.squashfs_sb; ++ struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >> msBlk->devblksize_log2) + 2]; ++ unsigned short c_byte; ++ unsigned int offset = index & ((1 << msBlk->devblksize_log2) - 1); ++ unsigned int cur_index = index >> msBlk->devblksize_log2; ++ int bytes, avail_bytes, b, k; ++ char *c_buffer; ++ unsigned int compressed; ++ ++ if(!(bh[0] = sb_bread(s, cur_index))) ++ goto read_failure; ++ ++ if(length) ++ c_byte = length; ++ else { ++ if(msBlk->devblksize - offset == 1) { ++ if(msBlk->swap) ++ ((unsigned char *) &c_byte)[1] = *((unsigned char *) (bh[0]->b_data + offset)); ++ else ++ ((unsigned char *) &c_byte)[0] = *((unsigned char *) (bh[0]->b_data + offset)); ++ brelse(bh[0]); ++ if(!(bh[0] = sb_bread(s, ++cur_index))) ++ goto read_failure; ++ if(msBlk->swap) ++ ((unsigned char *) &c_byte)[0] = *((unsigned char *) bh[0]->b_data); ++ else ++ ((unsigned char *) &c_byte)[1] = *((unsigned char *) bh[0]->b_data); ++ offset = 1; ++ } ++ else { ++ if(msBlk->swap) { ++ ((unsigned char *) &c_byte)[1] = *((unsigned char *) (bh[0]->b_data + offset)); ++ ((unsigned char *) &c_byte)[0] = *((unsigned char *) (bh[0]->b_data + offset + 1)); ++ } else ++ c_byte = *((unsigned short *) (bh[0]->b_data + offset)); ++ offset += 2; ++ } ++ if(SQUASHFS_CHECK_DATA(msBlk->sBlk.flags)) { ++ if(offset == msBlk->devblksize) { ++ brelse(bh[0]); ++ if(!(bh[0] = sb_bread(s, ++cur_index))) ++ goto read_failure; ++ offset = 0; ++ } ++ if(*((unsigned char *) (bh[0]->b_data + offset)) != SQUASHFS_MARKER_BYTE) { ++ ERROR("Metadata block marker corrupt @ %x\n", index); ++ brelse(bh[0]); ++ return 0; ++ } ++ offset ++; ++ } ++ } ++ ++ bytes = msBlk->devblksize - offset; ++ c_buffer = (compressed = SQUASHFS_COMPRESSED(c_byte)) ? msBlk->read_data : buffer; ++ c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); ++ ++ TRACE("Block @ 0x%x, %scompressed size %d\n", index, compressed ? "" : "un", (unsigned int) c_byte); ++ ++ for(b = 1; bytes < c_byte; b++) { ++ if(!(bh[b] = sb_bread(s, ++cur_index))) ++ goto block_release; ++ bytes += msBlk->devblksize; ++ } ++ ++ if(compressed) ++ down(&read_data_mutex); ++ ++ for(bytes = 0, k = 0; k < b; k++) { ++ avail_bytes = (c_byte - bytes) > (msBlk->devblksize - offset) ? msBlk->devblksize - offset : c_byte - bytes; ++ memcpy(c_buffer + bytes, bh[k]->b_data + offset, avail_bytes); ++ bytes += avail_bytes; ++ offset = 0; ++ brelse(bh[k]); ++ } ++ ++ /* ++ * uncompress block ++ */ ++ if(compressed) { ++ int zlib_err; ++ ++ stream.next_in = c_buffer; ++ stream.avail_in = c_byte; ++ stream.next_out = buffer; ++ stream.avail_out = msBlk->read_size; ++ if(((zlib_err = zlib_inflateInit(&stream)) != Z_OK) || ++ ((zlib_err = zlib_inflate(&stream, Z_FINISH)) != Z_STREAM_END) || ++ ((zlib_err = zlib_inflateEnd(&stream)) != Z_OK)) { ++ ERROR("zlib_fs returned unexpected result 0x%x\n", zlib_err); ++ bytes = 0; ++ } else ++ bytes = stream.total_out; ++ up(&read_data_mutex); ++ } ++ ++ if(next_index) ++ *next_index = index + c_byte + (length ? 0 : (SQUASHFS_CHECK_DATA(msBlk->sBlk.flags) ? 3 : 2)); ++ ++ return bytes; ++ ++block_release: ++ while(--b >= 0) brelse(bh[b]); ++ ++read_failure: ++ ERROR("sb_bread failed reading block 0x%x\n", cur_index); ++ return 0; ++} ++ ++ ++static int squashfs_get_cached_block(struct super_block *s, char *buffer, ++ unsigned int block, unsigned int offset, int length, ++ unsigned int *next_block, unsigned int *next_offset) ++{ ++ squashfs_sb_info *msBlk = &s->u.squashfs_sb; ++ int n, i, bytes, return_length = length; ++ unsigned int next_index; ++ ++ TRACE("Entered squashfs_get_cached_block [%x:%x]\n", block, offset); ++ ++ for(;;) { ++ for(i = 0; i < SQUASHFS_CACHED_BLKS; i++) ++ if(msBlk->block_cache[i].block == block) ++ break; ++ ++ down(&msBlk->block_cache_mutex); ++ if(i == SQUASHFS_CACHED_BLKS) { ++ /* read inode header block */ ++ for(i = msBlk->next_cache, n = SQUASHFS_CACHED_BLKS; n ; n --, i = (i + 1) % SQUASHFS_CACHED_BLKS) ++ if(msBlk->block_cache[i].block != SQUASHFS_USED_BLK) ++ break; ++ if(n == 0) { ++ up(&msBlk->block_cache_mutex); ++ sleep_on(&msBlk->waitq); ++ continue; ++ } ++ msBlk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS; ++ ++ if(msBlk->block_cache[i].block == SQUASHFS_INVALID_BLK) { ++ if(!(msBlk->block_cache[i].data = (unsigned char *) ++ kmalloc(SQUASHFS_METADATA_SIZE, GFP_KERNEL))) { ++ ERROR("Failed to allocate cache block\n"); ++ up(&msBlk->block_cache_mutex); ++ return 0; ++ } ++ } ++ ++ msBlk->block_cache[i].block = SQUASHFS_USED_BLK; ++ up(&msBlk->block_cache_mutex); ++ if(!(msBlk->block_cache[i].length = read_data(s, msBlk->block_cache[i].data, block, 0, ++ &next_index))) { ++ ERROR("Unable to read cache block [%x:%x]\n", block, offset); ++ return 0; ++ } ++ down(&msBlk->block_cache_mutex); ++ wake_up(&msBlk->waitq); ++ msBlk->block_cache[i].block = block; ++ msBlk->block_cache[i].next_index = next_index; ++ TRACE("Read cache block [%x:%x]\n", block, offset); ++ } ++ ++ if(msBlk->block_cache[i].block != block) { ++ up(&msBlk->block_cache_mutex); ++ continue; ++ } ++ ++ if((bytes = msBlk->block_cache[i].length - offset) >= length) { ++ if(buffer) ++ memcpy(buffer, msBlk->block_cache[i].data + offset, length); ++ if(msBlk->block_cache[i].length - offset == length) { ++ *next_block = msBlk->block_cache[i].next_index; ++ *next_offset = 0; ++ } else { ++ *next_block = block; ++ *next_offset = offset + length; ++ } ++ ++ up(&msBlk->block_cache_mutex); ++ return return_length; ++ } else { ++ if(buffer) { ++ memcpy(buffer, msBlk->block_cache[i].data + offset, bytes); ++ buffer += bytes; ++ } ++ block = msBlk->block_cache[i].next_index; ++ up(&msBlk->block_cache_mutex); ++ length -= bytes; ++ offset = 0; ++ } ++ } ++} ++ ++ ++static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode) ++{ ++ struct inode *i = new_inode(s); ++ squashfs_sb_info *msBlk = &s->u.squashfs_sb; ++ squashfs_super_block *sBlk = &msBlk->sBlk; ++ unsigned int block = SQUASHFS_INODE_BLK(inode) + sBlk->inode_table_start; ++ unsigned int offset = SQUASHFS_INODE_OFFSET(inode); ++ unsigned int next_block, next_offset; ++ squashfs_base_inode_header inodeb; ++ ++ TRACE("Entered squashfs_iget\n"); ++ ++ if(msBlk->swap) { ++ squashfs_base_inode_header sinodeb; ++ ++ if(!squashfs_get_cached_block(s, (char *) &sinodeb, block, offset, ++ sizeof(sinodeb), &next_block, &next_offset)) ++ goto failed_read; ++ SQUASHFS_SWAP_BASE_INODE_HEADER(&inodeb, &sinodeb, sizeof(sinodeb)); ++ } else ++ if(!squashfs_get_cached_block(s, (char *) &inodeb, block, offset, ++ sizeof(inodeb), &next_block, &next_offset)) ++ goto failed_read; ++ ++ i->i_nlink = 1; ++ ++ i->i_mtime = sBlk->mkfs_time; ++ i->i_atime = sBlk->mkfs_time; ++ i->i_ctime = sBlk->mkfs_time; ++ ++ if(inodeb.inode_type != SQUASHFS_IPC_TYPE) ++ i->i_uid = msBlk->uid[((inodeb.inode_type - 1) / SQUASHFS_TYPES) * 16 + inodeb.uid]; ++ i->i_ino = SQUASHFS_MK_VFS_INODE(block - sBlk->inode_table_start, offset); ++ ++ i->i_mode = inodeb.mode; ++ ++ switch(inodeb.inode_type == SQUASHFS_IPC_TYPE ? SQUASHFS_IPC_TYPE : (inodeb.inode_type - 1) % SQUASHFS_TYPES + 1) { ++ case SQUASHFS_FILE_TYPE: { ++ squashfs_reg_inode_header inodep; ++ ++ if(msBlk->swap) { ++ squashfs_reg_inode_header sinodep; ++ ++ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ SQUASHFS_SWAP_REG_INODE_HEADER(&inodep, &sinodep); ++ } else ++ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ ++ i->i_size = inodep.file_size; ++ i->i_fop = &generic_ro_fops; ++ i->i_data.a_ops = &squashfs_aops; ++ i->i_mode |= S_IFREG; ++ i->i_mtime = inodep.mtime; ++ i->i_atime = inodep.mtime; ++ i->i_ctime = inodep.mtime; ++ i->i_blocks = ((i->i_size - 1) >> 9) + 1; ++ i->i_blksize = PAGE_CACHE_SIZE; ++ i->u.squashfs_i.start_block = inodep.start_block; ++ i->u.squashfs_i.block_list_start = next_block; ++ i->u.squashfs_i.offset = next_offset; ++ TRACE("File inode %x:%x, start_block %x, block_list_start %x, offset %x\n", ++ SQUASHFS_INODE_BLK(inode), offset, inodep.start_block, next_block, next_offset); ++ break; ++ } ++ case SQUASHFS_DIR_TYPE: { ++ squashfs_dir_inode_header inodep; ++ ++ if(msBlk->swap) { ++ squashfs_dir_inode_header sinodep; ++ ++ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ SQUASHFS_SWAP_DIR_INODE_HEADER(&inodep, &sinodep); ++ } else ++ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ ++ i->i_size = inodep.file_size; ++ i->i_op = &squashfs_dir_inode_ops; ++ i->i_fop = &squashfs_dir_ops; ++ i->i_mode |= S_IFDIR; ++ i->i_mtime = inodep.mtime; ++ i->i_atime = inodep.mtime; ++ i->i_ctime = inodep.mtime; ++ i->u.squashfs_i.start_block = inodep.start_block; ++ i->u.squashfs_i.offset = inodep.offset; ++ TRACE("Directory inode %x:%x, start_block %x, offset %x\n", SQUASHFS_INODE_BLK(inode), offset, ++ inodep.start_block, inodep.offset); ++ break; ++ } ++ case SQUASHFS_SYMLINK_TYPE: { ++ squashfs_symlink_inode_header inodep; ++ ++ if(msBlk->swap) { ++ squashfs_symlink_inode_header sinodep; ++ ++ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ SQUASHFS_SWAP_SYMLINK_INODE_HEADER(&inodep, &sinodep); ++ } else ++ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ ++ i->i_size = inodep.symlink_size; ++ i->i_op = &page_symlink_inode_operations; ++ i->i_data.a_ops = &squashfs_symlink_aops; ++ i->i_mode |= S_IFLNK; ++ i->u.squashfs_i.start_block = next_block; ++ i->u.squashfs_i.offset = next_offset; ++ TRACE("Symbolic link inode %x:%x, start_block %x, offset %x\n", ++ SQUASHFS_INODE_BLK(inode), offset, next_block, next_offset); ++ break; ++ } ++ case SQUASHFS_BLKDEV_TYPE: ++ case SQUASHFS_CHRDEV_TYPE: { ++ squashfs_dev_inode_header inodep; ++ ++ if(msBlk->swap) { ++ squashfs_dev_inode_header sinodep; ++ ++ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ SQUASHFS_SWAP_DEV_INODE_HEADER(&inodep, &sinodep); ++ } else ++ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ ++ i->i_size = 0; ++ i->i_mode |= (inodeb.inode_type == SQUASHFS_CHRDEV_TYPE) ? S_IFCHR : S_IFBLK; ++ init_special_inode(i, i->i_mode, inodep.rdev); ++ TRACE("Device inode %x:%x, rdev %x\n", SQUASHFS_INODE_BLK(inode), offset, inodep.rdev); ++ break; ++ } ++ case SQUASHFS_IPC_TYPE: { ++ squashfs_ipc_inode_header inodep; ++ ++ if(msBlk->swap) { ++ squashfs_ipc_inode_header sinodep; ++ ++ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ SQUASHFS_SWAP_IPC_INODE_HEADER(&inodep, &sinodep); ++ } else ++ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), ++ &next_block, &next_offset)) ++ goto failed_read; ++ ++ i->i_size = 0; ++ i->i_mode |= (inodep.type == SQUASHFS_FIFO_TYPE) ? S_IFIFO : S_IFSOCK; ++ i->i_uid = msBlk->uid[inodep.offset * 16 + inodeb.uid]; ++ init_special_inode(i, i->i_mode, 0); ++ break; ++ } ++ default: ++ ERROR("Unknown inode type %d in squashfs_iget!\n", inodeb.inode_type); ++ goto failed_read1; ++ } ++ ++ if(inodeb.guid == SQUASHFS_GUIDS) ++ i->i_gid = i->i_uid; ++ else ++ i->i_gid = msBlk->guid[inodeb.guid]; ++ ++ return i; ++ ++failed_read: ++ ERROR("Unable to read inode [%x:%x]\n", block, offset); ++ ++failed_read1: ++ return NULL; ++} ++ ++ ++static struct super_block *squashfs_read_super(struct super_block *s, ++ void *data, int silent) ++{ ++ kdev_t dev = s->s_dev; ++ squashfs_sb_info *msBlk = &s->u.squashfs_sb; ++ squashfs_super_block *sBlk = &msBlk->sBlk; ++ int i; ++ ++ TRACE("Entered squashfs_read_superblock\n"); ++ ++ msBlk->devblksize = get_hardsect_size(dev); ++ if(msBlk->devblksize < BLOCK_SIZE) ++ msBlk->devblksize = BLOCK_SIZE; ++ msBlk->devblksize_log2 = ffz(~msBlk->devblksize); ++ set_blocksize(dev, msBlk->devblksize); ++ s->s_blocksize = msBlk->devblksize; ++ s->s_blocksize_bits = msBlk->devblksize_log2; ++ ++ init_MUTEX(&msBlk->read_page_mutex); ++ init_MUTEX(&msBlk->block_cache_mutex); ++ ++ init_waitqueue_head(&msBlk->waitq); ++ ++ if(!read_data(s, (char *) sBlk, SQUASHFS_START, sizeof(squashfs_super_block) | SQUASHFS_COMPRESSED_BIT, NULL)) { ++ SERROR("unable to read superblock\n"); ++ goto failed_mount; ++ } ++ ++ /* Check it is a SQUASHFS superblock */ ++ msBlk->swap = 0; ++ if((s->s_magic = sBlk->s_magic) != SQUASHFS_MAGIC) { ++ if(sBlk->s_magic == SQUASHFS_MAGIC_SWAP) { ++ squashfs_super_block sblk; ++ WARNING("Mounting a different endian SQUASHFS filesystem on %s\n", bdevname(dev)); ++ SQUASHFS_SWAP_SUPER_BLOCK(&sblk, sBlk); ++ memcpy(sBlk, &sblk, sizeof(squashfs_super_block)); ++ msBlk->swap = 1; ++ } else { ++ SERROR("Can't find a SQUASHFS superblock on %s\n", bdevname(dev)); ++ goto failed_mount; ++ } ++ } ++ ++ /* Check the MAJOR & MINOR versions */ ++ if(sBlk->s_major != SQUASHFS_MAJOR || sBlk->s_minor > SQUASHFS_MINOR) { ++ SERROR("Major/Minor mismatch, filesystem is (%d:%d), I support (%d: <= %d)\n", ++ sBlk->s_major, sBlk->s_minor, SQUASHFS_MAJOR, SQUASHFS_MINOR); ++ goto failed_mount; ++ } ++ ++ TRACE("Found valid superblock on %s\n", bdevname(dev)); ++ TRACE("Inodes are %scompressed\n", SQUASHFS_UNCOMPRESSED_INODES(sBlk->flags) ? "un" : ""); ++ TRACE("Data is %scompressed\n", SQUASHFS_UNCOMPRESSED_DATA(sBlk->flags) ? "un" : ""); ++ TRACE("Check data is %s present in the filesystem\n", SQUASHFS_CHECK_DATA(sBlk->flags) ? "" : "not"); ++ TRACE("Filesystem size %d bytes\n", sBlk->bytes_used); ++ TRACE("Block size %d\n", sBlk->block_size); ++ TRACE("Number of inodes %d\n", sBlk->inodes); ++ TRACE("Number of uids %d\n", sBlk->no_uids); ++ TRACE("Number of gids %d\n", sBlk->no_guids); ++ TRACE("sBlk->inode_table_start %x\n", sBlk->inode_table_start); ++ TRACE("sBlk->directory_table_start %x\n", sBlk->directory_table_start); ++ TRACE("sBlk->uid_start %x\n", sBlk->uid_start); ++ ++ s->s_flags |= MS_RDONLY; ++ s->s_op = &squashfs_ops; ++ ++ /* Init inode_table block pointer array */ ++ if(!(msBlk->block_cache = (squashfs_cache *) kmalloc(sizeof(squashfs_cache) * SQUASHFS_CACHED_BLKS, GFP_KERNEL))) { ++ ERROR("Failed to allocate block cache\n"); ++ goto failed_mount; ++ } ++ ++ for(i = 0; i < SQUASHFS_CACHED_BLKS; i++) ++ msBlk->block_cache[i].block = SQUASHFS_INVALID_BLK; ++ ++ msBlk->next_cache = 0; ++ ++ /* Allocate read_data block */ ++ msBlk->read_size = (sBlk->block_size < SQUASHFS_METADATA_SIZE) ? SQUASHFS_METADATA_SIZE : sBlk->block_size; ++ if(!(msBlk->read_data = (char *) kmalloc(msBlk->read_size, GFP_KERNEL))) { ++ ERROR("Failed to allocate read_data block\n"); ++ goto failed_mount1; ++ } ++ ++ /* Allocate read_page block */ ++ if(sBlk->block_size > PAGE_CACHE_SIZE && ++ !(msBlk->read_page = (char *) kmalloc(sBlk->block_size, GFP_KERNEL))) { ++ ERROR("Failed to allocate read_page block\n"); ++ goto failed_mount2; ++ } ++ ++ /* Allocate uid and gid tables */ ++ if(!(msBlk->uid = (squashfs_uid *) kmalloc((sBlk->no_uids + ++ sBlk->no_guids) * sizeof(squashfs_uid), GFP_KERNEL))) { ++ ERROR("Failed to allocate uid/gid table\n"); ++ goto failed_mount3; ++ } ++ msBlk->guid = msBlk->uid + sBlk->no_uids; ++ ++ if(msBlk->swap) { ++ squashfs_uid suid[sBlk->no_uids + sBlk->no_guids]; ++ ++ if(!read_data(s, (char *) &suid, sBlk->uid_start, ((sBlk->no_uids + sBlk->no_guids) * ++ sizeof(squashfs_uid)) | SQUASHFS_COMPRESSED_BIT, NULL)) { ++ SERROR("unable to read uid/gid table\n"); ++ goto failed_mount4; ++ } ++ SQUASHFS_SWAP_DATA(msBlk->uid, suid, (sBlk->no_uids + sBlk->no_guids), (sizeof(squashfs_uid) * 8)); ++ } else ++ if(!read_data(s, (char *) msBlk->uid, sBlk->uid_start, ((sBlk->no_uids + sBlk->no_guids) * ++ sizeof(squashfs_uid)) | SQUASHFS_COMPRESSED_BIT, NULL)) { ++ SERROR("unable to read uid/gid table\n"); ++ goto failed_mount4; ++ } ++ ++ if(!(s->s_root = d_alloc_root(squashfs_iget(s, sBlk->root_inode)))) { ++ ERROR("Root inode create failed\n"); ++ goto failed_mount4; ++ } ++ ++ TRACE("Leaving squashfs_read_super\n"); ++ return s; ++ ++failed_mount4: ++ kfree(msBlk->uid); ++failed_mount3: ++ kfree(msBlk->read_page); ++failed_mount2: ++ kfree(msBlk->read_data); ++failed_mount1: ++ kfree(msBlk->block_cache); ++failed_mount: ++ return NULL; ++} ++ ++ ++static int squashfs_statfs(struct super_block *s, struct statfs *buf) ++{ ++ squashfs_super_block *sBlk = &s->u.squashfs_sb.sBlk; ++ ++ TRACE("Entered squashfs_statfs\n"); ++ buf->f_type = SQUASHFS_MAGIC; ++ buf->f_bsize = sBlk->block_size; ++ buf->f_blocks = ((sBlk->bytes_used - 1) >> sBlk->block_log) + 1; ++ buf->f_bfree = buf->f_bavail = 0; ++ buf->f_files = sBlk->inodes; ++ buf->f_ffree = 0; ++ buf->f_namelen = SQUASHFS_NAME_LEN; ++ return 0; ++} ++ ++ ++static int squashfs_symlink_readpage(struct file *file, struct page *page) ++{ ++ struct inode *inode = page->mapping->host; ++ int index = page->index << PAGE_CACHE_SHIFT, length, bytes; ++ int block = inode->u.squashfs_i.start_block; ++ int offset = inode->u.squashfs_i.offset; ++ ++ TRACE("Entered squashfs_symlink_readpage, page index %d, start block %x, offset %x\n", ++ page->index, inode->u.squashfs_i.start_block, inode->u.squashfs_i.offset); ++ ++ for(length = 0; length < index; length += bytes) { ++ if(!(bytes = squashfs_get_cached_block(inode->i_sb, NULL, block, offset, ++ PAGE_CACHE_SIZE, &block, &offset))) { ++ ERROR("Unable to read symbolic link [%x:%x]\n", block, offset); ++ goto skip_read; ++ } ++ } ++ ++ if(length != index) { ++ ERROR("(squashfs_symlink_readpage) length != index\n"); ++ return 0; ++ } ++ ++ bytes = (inode->i_size - length) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE : inode->i_size - length; ++ if(!(bytes = squashfs_get_cached_block(inode->i_sb, page_address(page), block, offset, bytes, &block, &offset))) ++ ERROR("Unable to read symbolic link [%x:%x]\n", block, offset); ++ ++skip_read: ++ memset(page_address(page) + bytes, 0, PAGE_CACHE_SIZE - bytes); ++ flush_dcache_page(page); ++ SetPageUptodate(page); ++ UnlockPage(page); ++ ++ return 0; ++} ++ ++ ++#define SIZE 256 ++static int squashfs_readpage(struct file *file, struct page *page) ++{ ++ struct inode *inode = page->mapping->host; ++ squashfs_sb_info *msBlk = &inode->i_sb->u.squashfs_sb; ++ squashfs_super_block *sBlk = &msBlk->sBlk; ++ unsigned char block_list[SIZE]; ++ unsigned short *block_listp; ++ int index = sBlk->block_log > PAGE_CACHE_SHIFT ? ++ page->index >> (sBlk->block_log - PAGE_CACHE_SHIFT) : ++ page->index << (PAGE_CACHE_SHIFT - sBlk->block_log); ++ int block = inode->u.squashfs_i.start_block, i = 0; ++ int bytes = 0, block_ptr = inode->u.squashfs_i.block_list_start; ++ int offset = inode->u.squashfs_i.offset; ++ int file_blocks = ((inode->i_size - 1) >> sBlk->block_log) + 1; ++ int readahead_blks = sBlk->block_log >= PAGE_CACHE_SHIFT ? 1 : 1 << (PAGE_CACHE_SHIFT - sBlk->block_log); ++ ++ TRACE("Entered squashfs_readpage, page index %d, start block %x\n", page->index, ++ inode->u.squashfs_i.start_block); ++ ++ if(index > file_blocks) ++ goto skip_read; ++ ++ for(;;) { ++ int blocks = (index + readahead_blks - i); ++ if(blocks > (SIZE >> 1)) { ++ if((index - i) <= (SIZE >> 1)) ++ blocks = index - i; ++ else ++ blocks = SIZE >> 1; ++ } ++ ++ if(msBlk->swap) { ++ unsigned char sblock_list[SIZE]; ++ if(!squashfs_get_cached_block(inode->i_sb, (char *) sblock_list, block_ptr, offset, blocks << 1, &block_ptr, &offset)) { ++ ERROR("Unable to read block list [%d:%x]\n", block_ptr, offset); ++ goto skip_read; ++ } ++ SQUASHFS_SWAP_SHORTS(((unsigned short *)block_list), ((unsigned short *)sblock_list), blocks); ++ } else ++ if(!squashfs_get_cached_block(inode->i_sb, (char *) block_list, block_ptr, offset, blocks << 1, &block_ptr, &offset)) { ++ ERROR("Unable to read block list [%d:%x]\n", block_ptr, offset); ++ goto skip_read; ++ } ++ for(block_listp = (unsigned short *) block_list; i < index && blocks; i ++, block_listp ++, blocks --) ++ block += SQUASHFS_COMPRESSED_SIZE(*block_listp); ++ if(blocks >= readahead_blks) ++ break; ++ } ++ ++ if(sBlk->block_log > PAGE_CACHE_SHIFT) { ++ int mask = (1 << (sBlk->block_log - PAGE_CACHE_SHIFT)) - 1; ++ int start_index = page->index & ~mask; ++ int end_index = start_index | mask; ++ int byte_offset = 0; ++ ++ down(&msBlk->read_page_mutex); ++ if(!(bytes = read_data(inode->i_sb, msBlk->read_page, block, *block_listp, NULL))) { ++ ERROR("Unable to read page, block %x, size %x\n", block, (int) *block_listp); ++ goto skip_read; ++ } ++ ++ for(i = start_index; i <= end_index && byte_offset < bytes; i++, byte_offset += PAGE_CACHE_SIZE) { ++ int available_bytes = (bytes - byte_offset) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE : bytes - byte_offset; ++ ++ TRACE("bytes %d, i %d, byte_offset %d, available_bytes %d\n", bytes, i, byte_offset, available_bytes); ++ ++ if(i == page->index) { ++ memcpy(page_address(page), msBlk->read_page + byte_offset, available_bytes); ++ memset(page_address(page) + available_bytes, 0, PAGE_CACHE_SIZE - available_bytes); ++ flush_dcache_page(page); ++ SetPageUptodate(page); ++ UnlockPage(page); ++ } else { ++ struct page *push_page; ++ ++ if((push_page = grab_cache_page_nowait(page->mapping, i))) { ++ memcpy(page_address(push_page), msBlk->read_page + byte_offset, available_bytes); ++ memset(page_address(push_page) + available_bytes, 0, PAGE_CACHE_SIZE - available_bytes); ++ flush_dcache_page(push_page); ++ SetPageUptodate(push_page); ++ UnlockPage(push_page); ++ page_cache_release(push_page); ++ } ++ } ++ } ++ up( &msBlk->read_page_mutex); ++ ++ return 0; ++ ++ } else if(sBlk->block_log == PAGE_CACHE_SHIFT) { ++ if(!(bytes = read_data(inode->i_sb, page_address(page), block, *block_listp, NULL))) ++ ERROR("Unable to read page, block %x, size %x\n", block, (int) *block_listp); ++ ++ } else { ++ int i_end = index + (1 << (PAGE_CACHE_SHIFT - sBlk->block_log)); ++ char *p = (char *) page_address(page); ++ int byte; ++ ++ if(i_end > file_blocks) ++ i_end = file_blocks; ++ ++ while(index < i_end) { ++ if(!(byte = read_data(inode->i_sb, p, block, *block_listp, NULL))) { ++ ERROR("Unable to read page, block %x, size %x\n", block, (int) *block_listp); ++ goto skip_read; ++ } ++ block += SQUASHFS_COMPRESSED_SIZE(*block_listp); ++ p += byte; ++ bytes += byte; ++ index ++; ++ block_listp ++; ++ } ++ } ++ ++skip_read: ++ memset(page_address(page) + bytes, 0, PAGE_CACHE_SIZE - bytes); ++ flush_dcache_page(page); ++ SetPageUptodate(page); ++ UnlockPage(page); ++ ++ return 0; ++} ++ ++ ++static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) ++{ ++ struct inode *i = file->f_dentry->d_inode; ++ squashfs_sb_info *msBlk = &i->i_sb->u.squashfs_sb; ++ squashfs_super_block *sBlk = &msBlk->sBlk; ++ int next_block = i->u.squashfs_i.start_block + sBlk->directory_table_start, next_offset = ++ i->u.squashfs_i.offset, length = 0, dirs_read = 0, dir_count; ++ squashfs_dir_header dirh; ++ char buffer[sizeof(squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1]; ++ squashfs_dir_entry *dire = (squashfs_dir_entry *) buffer; ++ ++ TRACE("Entered squashfs_readdir [%x:%x]\n", next_block, next_offset); ++ ++ while(length < i->i_size) { ++ /* read directory header */ ++ if(msBlk->swap) { ++ squashfs_dir_header sdirh; ++ if(!squashfs_get_cached_block(i->i_sb, (char *) &sdirh, next_block, ++ next_offset, sizeof(sdirh), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(sdirh); ++ SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh); ++ } else { ++ if(!squashfs_get_cached_block(i->i_sb, (char *) &dirh, next_block, ++ next_offset, sizeof(dirh), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(dirh); ++ } ++ ++ dir_count = dirh.count + 1; ++ while(dir_count--) { ++ if(msBlk->swap) { ++ squashfs_dir_entry sdire; ++ if(!squashfs_get_cached_block(i->i_sb, (char *) &sdire, next_block, ++ next_offset, sizeof(sdire), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(sdire); ++ SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire); ++ } else { ++ if(!squashfs_get_cached_block(i->i_sb, (char *) dire, next_block, ++ next_offset, sizeof(*dire), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(*dire); ++ } ++ ++ if(!squashfs_get_cached_block(i->i_sb, dire->name, next_block, ++ next_offset, dire->size + 1, &next_block, &next_offset)) ++ goto failed_read; ++ length += dire->size + 1; ++ ++ if(file->f_pos >= length) ++ continue; ++ ++ dire->name[dire->size + 1] = '\0'; ++ ++ TRACE("Calling filldir(%x, %s, %d, %d, %x:%x, %d)\n", dirent, ++ dire->name, dire->size + 1, (int) file->f_pos, ++ dirh.start_block, dire->offset, squashfs_filetype_table[dire->type]); ++ ++ if(filldir(dirent, dire->name, dire->size + 1, file->f_pos, SQUASHFS_MK_VFS_INODE(dirh.start_block, ++ dire->offset), squashfs_filetype_table[dire->type]) < 0) { ++ TRACE("Filldir returned less than 0\n"); ++ return dirs_read; ++ } ++ ++ file->f_pos = length; ++ dirs_read ++; ++ } ++ } ++ ++ return dirs_read; ++ ++failed_read: ++ ERROR("Unable to read directory block [%x:%x]\n", next_block, next_offset); ++ return 0; ++} ++ ++ ++static struct dentry *squashfs_lookup(struct inode *i, struct dentry *dentry) ++{ ++ const char *name =dentry->d_name.name; ++ int len = dentry->d_name.len; ++ struct inode *inode = NULL; ++ squashfs_sb_info *msBlk = &i->i_sb->u.squashfs_sb; ++ squashfs_super_block *sBlk = &msBlk->sBlk; ++ int next_block = i->u.squashfs_i.start_block + sBlk->directory_table_start, next_offset = ++ i->u.squashfs_i.offset, length = 0, dir_count; ++ squashfs_dir_header dirh; ++ char buffer[sizeof(squashfs_dir_entry) + SQUASHFS_NAME_LEN]; ++ squashfs_dir_entry *dire = (squashfs_dir_entry *) buffer; ++ ++ TRACE("Entered squashfs_lookup [%x:%x]\n", next_block, next_offset); ++ ++ while(length < i->i_size) { ++ /* read directory header */ ++ if(msBlk->swap) { ++ squashfs_dir_header sdirh; ++ if(!squashfs_get_cached_block(i->i_sb, (char *) &sdirh, next_block, next_offset, ++ sizeof(sdirh), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(sdirh); ++ SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh); ++ } else { ++ if(!squashfs_get_cached_block(i->i_sb, (char *) &dirh, next_block, next_offset, ++ sizeof(dirh), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(dirh); ++ } ++ ++ dir_count = dirh.count + 1; ++ while(dir_count--) { ++ if(msBlk->swap) { ++ squashfs_dir_entry sdire; ++ if(!squashfs_get_cached_block(i->i_sb, (char *) &sdire, ++ next_block,next_offset, sizeof(sdire), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(*dire); ++ SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire); ++ } else { ++ if(!squashfs_get_cached_block(i->i_sb, (char *) dire, ++ next_block,next_offset, sizeof(*dire), &next_block, &next_offset)) ++ goto failed_read; ++ length += sizeof(*dire); ++ } ++ ++ if(!squashfs_get_cached_block(i->i_sb, dire->name, ++ next_block, next_offset, dire->size + 1, &next_block, &next_offset)) ++ goto failed_read; ++ length += dire->size + 1; ++ ++ if((len == dire->size + 1) && !strncmp(name, dire->name, len)) { ++ squashfs_inode ino = SQUASHFS_MKINODE(dirh.start_block, dire->offset); ++ ++ TRACE("calling squashfs_iget for directory entry %s, inode %x:%x\n", ++ name, dirh.start_block, dire->offset); ++ ++ inode = squashfs_iget(i->i_sb, ino); ++ ++ goto exit_loop; ++ } ++ } ++ } ++ ++exit_loop: ++ d_add(dentry, inode); ++ return ERR_PTR(0); ++ ++failed_read: ++ ERROR("Unable to read directory block [%x:%x]\n", next_block, next_offset); ++ goto exit_loop; ++} ++ ++ ++static void squashfs_put_super(struct super_block *s) ++{ ++ if(s->u.squashfs_sb.block_cache) kfree(s->u.squashfs_sb.block_cache); ++ if(s->u.squashfs_sb.read_data) kfree(s->u.squashfs_sb.read_data); ++ if(s->u.squashfs_sb.read_page) kfree(s->u.squashfs_sb.read_page); ++ if(s->u.squashfs_sb.uid) kfree(s->u.squashfs_sb.uid); ++ s->u.squashfs_sb.block_cache = (void *) s->u.squashfs_sb.uid = ++ s->u.squashfs_sb.read_data = s->u.squashfs_sb.read_page = NULL; ++} ++ ++ ++static int __init init_squashfs_fs(void) ++{ ++ ++ if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) { ++ ERROR("Failed to allocate zlib workspace\n"); ++ return -ENOMEM; ++ } ++ return register_filesystem(&squashfs_fs_type); ++} ++ ++ ++static void __exit exit_squashfs_fs(void) ++{ ++ vfree(stream.workspace); ++ unregister_filesystem(&squashfs_fs_type); ++} ++ ++ ++EXPORT_NO_SYMBOLS; ++ ++module_init(init_squashfs_fs); ++module_exit(exit_squashfs_fs); ++MODULE_DESCRIPTION("squashfs, a compressed read-only filesystem"); ++MODULE_AUTHOR("Phillip Lougher "); ++MODULE_LICENSE("GPL"); +diff -urN src/linux-dist/linux/include/linux/fs.h src/linux/linux/include/linux/fs.h +--- src/linux-dist/linux/include/linux/fs.h 2003-07-04 03:12:25.000000000 -0500 ++++ src/linux/linux/include/linux/fs.h 2004-03-29 17:00:53.000000000 -0600 +@@ -313,6 +313,7 @@ + #include + #include + #include ++#include + + /* + * Attribute flags. These should be or-ed together to figure out what +@@ -503,6 +504,7 @@ + struct socket socket_i; + struct usbdev_inode_info usbdev_i; + struct jffs2_inode_info jffs2_i; ++ struct squashfs_inode_info squashfs_i; + void *generic_ip; + } u; + }; +@@ -697,6 +699,7 @@ + #include + #include + #include ++#include + + extern struct list_head super_blocks; + extern spinlock_t sb_lock; +@@ -755,6 +758,7 @@ + struct usbdev_sb_info usbdevfs_sb; + struct jffs2_sb_info jffs2_sb; + struct cramfs_sb_info cramfs_sb; ++ struct squashfs_sb_info squashfs_sb; + void *generic_sbp; + } u; + /* +diff -urN src/linux-dist/linux/include/linux/squashfs_fs.h src/linux/linux/include/linux/squashfs_fs.h +--- src/linux-dist/linux/include/linux/squashfs_fs.h 1969-12-31 18:00:00.000000000 -0600 ++++ src/linux/linux/include/linux/squashfs_fs.h 2004-03-29 17:00:53.000000000 -0600 +@@ -0,0 +1,323 @@ ++#ifndef SQUASHFS_FS ++#define SQUASHFS_FS ++/* ++ * Squashfs ++ * ++ * Copyright (c) 2002 Phillip Lougher ++ * ++ * 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. ++ * ++ * squashfs_fs.h ++ */ ++ ++#define SQUASHFS_MAJOR 1 ++#define SQUASHFS_MINOR 0 ++#define SQUASHFS_MAGIC 0x73717368 ++#define SQUASHFS_MAGIC_SWAP 0x68737173 ++#define SQUASHFS_START 0 ++ ++/* size of metadata (inode and directory) blocks */ ++#define SQUASHFS_METADATA_SIZE 8192 ++#define SQUASHFS_METADATA_LOG 13 ++ ++/* default size of data blocks */ ++#define SQUASHFS_FILE_SIZE 32768 ++#define SQUASHFS_FILE_LOG 15 ++ ++#define SQUASHFS_FILE_MAX_SIZE 32768 ++ ++/* Max number of uids and gids */ ++#define SQUASHFS_UIDS 48 ++#define SQUASHFS_GUIDS 15 ++ ++/* Max length of filename (not 255) */ ++#define SQUASHFS_NAME_LEN 256 ++ ++#define SQUASHFS_INVALID ((long long) 0xffffffffffff) ++#define SQUASHFS_INVALID_BLK ((long long) 0xffffffff) ++#define SQUASHFS_USED_BLK ((long long) 0xfffffffe) ++ ++/* Filesystem flags */ ++#define SQUASHFS_NOI 1 ++#define SQUASHFS_NOD 2 ++#define SQUASHFS_CHECK 4 ++#define SQUASHFS_UNCOMPRESSED_INODES(flags) (flags & SQUASHFS_NOI) ++#define SQUASHFS_UNCOMPRESSED_DATA(flags) (flags & SQUASHFS_NOD) ++#define SQUASHFS_CHECK_DATA(flags) (flags & SQUASHFS_CHECK) ++#define SQUASHFS_MKFLAGS(noi, nod, check_data) (noi | (nod << 1) | (check_data << 2)) ++ ++/* Max number of types and file types */ ++#define SQUASHFS_TYPES 5 ++#define SQUASHFS_DIR_TYPE 1 ++#define SQUASHFS_FILE_TYPE 2 ++#define SQUASHFS_SYMLINK_TYPE 3 ++#define SQUASHFS_BLKDEV_TYPE 4 ++#define SQUASHFS_CHRDEV_TYPE 5 ++ ++#define SQUASHFS_IPC_TYPE 0 ++#define SQUASHFS_FIFO_TYPE 6 ++#define SQUASHFS_SOCKET_TYPE 7 ++ ++/* Flag whether block is compressed or uncompressed, bit is set if block is uncompressed */ ++#define SQUASHFS_COMPRESSED_BIT (1 << 15) ++#define SQUASHFS_COMPRESSED_SIZE(B) (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \ ++ (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT) ++ ++#define SQUASHFS_COMPRESSED(B) (!((B) & SQUASHFS_COMPRESSED_BIT)) ++ ++/* ++ * Inode number ops. Inodes consist of a compressed block number, and an uncompressed ++ * offset within that block ++ */ ++#define SQUASHFS_INODE_BLK(a) ((unsigned int) ((a) >> 16)) ++#define SQUASHFS_INODE_OFFSET(a) ((unsigned int) ((a) & 0xffff)) ++#define SQUASHFS_MKINODE(A, B) ((squashfs_inode)(((squashfs_inode) (A) << 16)\ ++ + (B))) ++ ++/* Compute 32 bit VFS inode number from squashfs inode number */ ++#define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + ((b) >> 2) + 1)) ++ ++/* Translate between VFS mode and squashfs mode */ ++#define SQUASHFS_MODE(a) ((a) & 0xfff) ++ ++/* cached data constants for filesystem */ ++#define SQUASHFS_CACHED_BLKS 8 ++ ++#define SQUASHFS_MAX_FILE_SIZE_LOG 32 ++#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << (SQUASHFS_MAX_FILE_SIZE_LOG - 1)) ++ ++#define SQUASHFS_MARKER_BYTE 0xff ++ ++/* ++ * definitions for structures on disk ++ */ ++ ++typedef unsigned int squashfs_block; ++typedef long long squashfs_inode; ++ ++typedef unsigned int squashfs_uid; ++ ++typedef struct squashfs_super_block { ++ unsigned int s_magic; ++ unsigned int inodes; ++ unsigned int bytes_used; ++ unsigned int uid_start; ++ unsigned int guid_start; ++ unsigned int inode_table_start; ++ unsigned int directory_table_start; ++ unsigned int s_major:16; ++ unsigned int s_minor:16; ++ unsigned int block_size:16; ++ unsigned int block_log:16; ++ unsigned int flags:8; ++ unsigned int no_uids:8; ++ unsigned int no_guids:8; ++ time_t mkfs_time /* time of filesystem creation */; ++ squashfs_inode root_inode; ++} __attribute__ ((packed)) squashfs_super_block; ++ ++typedef struct { ++ unsigned int inode_type:4; ++ unsigned int mode:12; /* protection */ ++ unsigned int uid:4; /* index into uid table */ ++ unsigned int guid:4; /* index into guid table */ ++} __attribute__ ((packed)) squashfs_base_inode_header; ++ ++typedef struct { ++ unsigned int inode_type:4; ++ unsigned int mode:12; /* protection */ ++ unsigned int uid:4; /* index into uid table */ ++ unsigned int guid:4; /* index into guid table */ ++ unsigned int type:4; ++ unsigned int offset:4; ++} __attribute__ ((packed)) squashfs_ipc_inode_header; ++ ++typedef struct { ++ unsigned int inode_type:4; ++ unsigned int mode:12; /* protection */ ++ unsigned int uid:4; /* index into uid table */ ++ unsigned int guid:4; /* index into guid table */ ++ unsigned short rdev; ++} __attribute__ ((packed)) squashfs_dev_inode_header; ++ ++typedef struct { ++ unsigned int inode_type:4; ++ unsigned int mode:12; /* protection */ ++ unsigned int uid:4; /* index into uid table */ ++ unsigned int guid:4; /* index into guid table */ ++ unsigned short symlink_size; ++ char symlink[0]; ++} __attribute__ ((packed)) squashfs_symlink_inode_header; ++ ++typedef struct { ++ unsigned int inode_type:4; ++ unsigned int mode:12; /* protection */ ++ unsigned int uid:4; /* index into uid table */ ++ unsigned int guid:4; /* index into guid table */ ++ time_t mtime; ++ squashfs_block start_block; ++ unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG; ++ unsigned short block_list[0]; ++} __attribute__ ((packed)) squashfs_reg_inode_header; ++ ++typedef struct { ++ unsigned int inode_type:4; ++ unsigned int mode:12; /* protection */ ++ unsigned int uid:4; /* index into uid table */ ++ unsigned int guid:4; /* index into guid table */ ++ unsigned int file_size:19; ++ unsigned int offset:13; ++ time_t mtime; ++ unsigned int start_block:24; ++} __attribute__ ((packed)) squashfs_dir_inode_header; ++ ++typedef union { ++ squashfs_base_inode_header base; ++ squashfs_dev_inode_header dev; ++ squashfs_symlink_inode_header symlink; ++ squashfs_reg_inode_header reg; ++ squashfs_dir_inode_header dir; ++ squashfs_ipc_inode_header ipc; ++} squashfs_inode_header; ++ ++typedef struct { ++ unsigned int offset:13; ++ unsigned int type:3; ++ unsigned int size:8; ++ char name[0]; ++} __attribute__ ((packed)) squashfs_dir_entry; ++ ++typedef struct { ++ unsigned int count:8; ++ unsigned int start_block:24; ++} __attribute__ ((packed)) squashfs_dir_header; ++ ++ ++extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen); ++extern int squashfs_uncompress_init(void); ++extern int squashfs_uncompress_exit(void); ++ ++/* ++ * macros to convert each packed bitfield structure from little endian to big ++ * endian and vice versa. These are needed when creating or using a filesystem on a ++ * machine with different byte ordering to the target architecture. ++ * ++ */ ++ ++#define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\ ++ SQUASHFS_MEMSET(s, d, sizeof(squashfs_super_block));\ ++ SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\ ++ SQUASHFS_SWAP((s)->inodes, d, 32, 32);\ ++ SQUASHFS_SWAP((s)->bytes_used, d, 64, 32);\ ++ SQUASHFS_SWAP((s)->uid_start, d, 96, 32);\ ++ SQUASHFS_SWAP((s)->guid_start, d, 128, 32);\ ++ SQUASHFS_SWAP((s)->inode_table_start, d, 160, 32);\ ++ SQUASHFS_SWAP((s)->directory_table_start, d, 192, 32);\ ++ SQUASHFS_SWAP((s)->s_major, d, 224, 16);\ ++ SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\ ++ SQUASHFS_SWAP((s)->block_size, d, 256, 16);\ ++ SQUASHFS_SWAP((s)->block_log, d, 272, 16);\ ++ SQUASHFS_SWAP((s)->flags, d, 288, 8);\ ++ SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\ ++ SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\ ++ SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\ ++ SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\ ++} ++ ++#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\ ++ SQUASHFS_MEMSET(s, d, n);\ ++ SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ ++ SQUASHFS_SWAP((s)->mode, d, 4, 12);\ ++ SQUASHFS_SWAP((s)->uid, d, 16, 4);\ ++ SQUASHFS_SWAP((s)->guid, d, 20, 4);\ ++} ++ ++#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) {\ ++ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dev_inode_header));\ ++ SQUASHFS_SWAP((s)->type, d, 24, 4);\ ++ SQUASHFS_SWAP((s)->offset, d, 28, 4);\ ++} ++#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\ ++ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dev_inode_header));\ ++ SQUASHFS_SWAP((s)->rdev, d, 24, 16);\ ++} ++ ++#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\ ++ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header));\ ++ SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\ ++} ++ ++#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\ ++ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header));\ ++ SQUASHFS_SWAP((s)->mtime, d, 24, 32);\ ++ SQUASHFS_SWAP((s)->start_block, d, 56, 32);\ ++ SQUASHFS_SWAP((s)->file_size, d, 88, SQUASHFS_MAX_FILE_SIZE_LOG);\ ++} ++ ++#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\ ++ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header));\ ++ SQUASHFS_SWAP((s)->file_size, d, 24, 19);\ ++ SQUASHFS_SWAP((s)->offset, d, 43, 13);\ ++ SQUASHFS_SWAP((s)->mtime, d, 56, 32);\ ++ SQUASHFS_SWAP((s)->start_block, d, 88, 24);\ ++} ++ ++#define SQUASHFS_SWAP_DIR_HEADER(s, d) {\ ++ SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_header));\ ++ SQUASHFS_SWAP((s)->count, d, 0, 8);\ ++ SQUASHFS_SWAP((s)->start_block, d, 8, 24);\ ++} ++ ++#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\ ++ SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_entry));\ ++ SQUASHFS_SWAP((s)->offset, d, 0, 13);\ ++ SQUASHFS_SWAP((s)->type, d, 13, 3);\ ++ SQUASHFS_SWAP((s)->size, d, 16, 8);\ ++} ++ ++#define SQUASHFS_SWAP_SHORTS(s, d, n) {\ ++ int entry;\ ++ int bit_position;\ ++ SQUASHFS_MEMSET(s, d, n * 2);\ ++ for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += 16)\ ++ SQUASHFS_SWAP(s[entry], d, bit_position, 16);\ ++} ++ ++#define SQUASHFS_SWAP_DATA(s, d, n, bits) {\ ++ int entry;\ ++ int bit_position;\ ++ SQUASHFS_MEMSET(s, d, n * bits / 8);\ ++ for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += bits)\ ++ SQUASHFS_SWAP(s[entry], d, bit_position, bits);\ ++} ++ ++#ifdef __KERNEL__ ++/* ++ * macros used to swap each structure entry, taking into account ++ * bitfields and different bitfield placing conventions on differing architectures ++ */ ++#include ++#ifdef __BIG_ENDIAN ++ /* convert from little endian to big endian */ ++#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, b_pos) ++#else ++ /* convert from big endian to little endian */ ++#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, 64 - tbits - b_pos) ++#endif ++ ++#define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\ ++ int bits;\ ++ int b_pos = pos % 8;\ ++ unsigned long long val = 0;\ ++ unsigned char *s = (unsigned char *)p + (pos / 8);\ ++ unsigned char *d = ((unsigned char *) &val) + 7;\ ++ for(bits = 0; bits < (tbits + b_pos); bits += 8) \ ++ *d-- = *s++;\ ++ value = (val >> (SHIFT));\ ++} ++#define SQUASHFS_MEMSET(s, d, n) memset(s, 0, n); ++#endif ++#endif +diff -urN src/linux-dist/linux/include/linux/squashfs_fs_i.h src/linux/linux/include/linux/squashfs_fs_i.h +--- src/linux-dist/linux/include/linux/squashfs_fs_i.h 1969-12-31 18:00:00.000000000 -0600 ++++ src/linux/linux/include/linux/squashfs_fs_i.h 2004-03-29 17:00:53.000000000 -0600 +@@ -0,0 +1,21 @@ ++#ifndef SQUASHFS_FS_I ++#define SQUASHFS_FS_I ++/* ++ * Squashfs ++ * ++ * Copyright (c) 2002 Phillip Lougher ++ * ++ * 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. ++ * ++ * squashfs_fs_i.h ++ */ ++ ++typedef struct squashfs_inode_info { ++ unsigned int start_block; ++ unsigned int block_list_start; ++ unsigned int offset; ++ } squashfs_inode_info; ++#endif +diff -urN src/linux-dist/linux/include/linux/squashfs_fs_sb.h src/linux/linux/include/linux/squashfs_fs_sb.h +--- src/linux-dist/linux/include/linux/squashfs_fs_sb.h 1969-12-31 18:00:00.000000000 -0600 ++++ src/linux/linux/include/linux/squashfs_fs_sb.h 2004-03-29 17:00:53.000000000 -0600 +@@ -0,0 +1,41 @@ ++#ifndef SQUASHFS_FS_SB ++#define SQUASHFS_FS_SB ++/* ++ * Squashfs ++ * ++ * Copyright (c) 2002 Phillip Lougher ++ * ++ * 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. ++ * ++ * squashfs_fs_sb.h ++ */ ++ ++#include ++ ++typedef struct { ++ unsigned int block; ++ int length; ++ unsigned int next_index; ++ char *data; ++ } squashfs_cache; ++ ++typedef struct squashfs_sb_info { ++ squashfs_super_block sBlk; ++ int devblksize; ++ int devblksize_log2; ++ int swap; ++ squashfs_cache *block_cache; ++ int next_cache; ++ squashfs_uid *uid; ++ squashfs_uid *guid; ++ unsigned int read_size; ++ char *read_data; ++ char *read_page; ++ struct semaphore read_page_mutex; ++ struct semaphore block_cache_mutex; ++ wait_queue_head_t waitq; ++ } squashfs_sb_info; ++#endif +diff -urN src/linux-dist/linux/init/do_mounts.c src/linux/linux/init/do_mounts.c +--- src/linux-dist/linux/init/do_mounts.c 2003-11-08 02:13:20.000000000 -0600 ++++ src/linux/linux/init/do_mounts.c 2004-03-29 17:00:53.000000000 -0600 +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + #undef BUILD_CRAMDISK + +@@ -470,6 +471,7 @@ + * ext2 + * romfs + * gzip ++ * squashfs + */ + static int __init + identify_ramdisk_image(int fd, int start_block) +@@ -479,6 +481,7 @@ + struct ext2_super_block *ext2sb; + struct romfs_super_block *romfsb; + struct cramfs_super *cramfsb; ++ struct squashfs_super_block *squashfsb; + int nblocks = -1; + unsigned char *buf; + +@@ -490,6 +493,7 @@ + ext2sb = (struct ext2_super_block *) buf; + romfsb = (struct romfs_super_block *) buf; + cramfsb = (struct cramfs_super *) buf; ++ squashfsb = (struct squashfs_super_block *) buf; + memset(buf, 0xe5, size); + + /* +@@ -536,6 +540,15 @@ + goto done; + } + ++ /* squashfs is at block zero too */ ++ if (squashfsb->s_magic == SQUASHFS_MAGIC) { ++ printk(KERN_NOTICE ++ "RAMDISK: squashfs filesystem found at block %d\n", ++ start_block); ++ nblocks = (squashfsb->bytes_used+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS; ++ goto done; ++ } ++ + /* + * Read block 1 to test for minix and ext2 superblock + */ +diff -urN src/linux-dist/linux/kernel/ksyms.c src/linux/linux/kernel/ksyms.c +--- src/linux-dist/linux/kernel/ksyms.c 2003-07-04 03:12:28.000000000 -0500 ++++ src/linux/linux/kernel/ksyms.c 2004-03-29 17:00:53.000000000 -0600 +@@ -482,9 +483,9 @@ + EXPORT_SYMBOL(simple_strtoull); + EXPORT_SYMBOL(system_utsname); /* UTS data */ + EXPORT_SYMBOL(uts_sem); /* UTS semaphore */ +-#ifndef __mips__ ++//#ifndef __mips__ //bite me. -mbm. + EXPORT_SYMBOL(sys_call_table); +-#endif ++//#endif + EXPORT_SYMBOL(machine_restart); + EXPORT_SYMBOL(machine_halt); + EXPORT_SYMBOL(machine_power_off); +diff -urN src/linux-dist/linux/lib/Config.in src/linux/linux/lib/Config.in +--- src/linux-dist/linux/lib/Config.in 2003-07-04 03:12:29.000000000 -0500 ++++ src/linux/linux/lib/Config.in 2004-03-29 17:00:53.000000000 -0600 +@@ -8,12 +8,14 @@ + # Do we need the compression support? + # + if [ "$CONFIG_CRAMFS" = "y" -o \ ++ "$CONFIG_SQUASHFS" = "y" -o \ + "$CONFIG_PPP_DEFLATE" = "y" -o \ + "$CONFIG_JFFS2_FS" = "y" -o \ + "$CONFIG_ZISOFS_FS" = "y" ]; then + define_tristate CONFIG_ZLIB_INFLATE y + else + if [ "$CONFIG_CRAMFS" = "m" -o \ ++ "$CONFIG_SQUASHFS" = "m" -o \ + "$CONFIG_PPP_DEFLATE" = "m" -o \ + "$CONFIG_JFFS2_FS" = "m" -o \ + "$CONFIG_ZISOFS_FS" = "m" ]; then diff --git a/obsolete-buildroot/sources/openwrt-wrt54g-router.patch b/obsolete-buildroot/sources/openwrt-wrt54g-router.patch new file mode 100644 index 0000000000..4098f792e2 --- /dev/null +++ b/obsolete-buildroot/sources/openwrt-wrt54g-router.patch @@ -0,0 +1,240 @@ +diff -bBurN WRT54G/release/src/router/rc/Makefile-openwrt WRT54G.new/release/src/router/rc/Makefile-openwrt +--- WRT54G/release/src/router/rc/Makefile-openwrt 1969-12-31 18:00:00.000000000 -0600 ++++ WRT54G.new/release/src/router/rc/Makefile-openwrt 2004-03-03 16:23:40.000000000 -0600 +@@ -0,0 +1,44 @@ ++# 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 ++# ++ ++# ++# Router Wireless Interface Configuration Utility Makefile ++# ++# Copyright 2003, Broadcom Corporation ++# All Rights Reserved. ++# ++# ++# $Id: Makefile,v 1.2 2004/01/13 00:55:58 mbm Exp $ ++# ++ ++CFLAGS += -I. -I$(TOP)/shared -I$(SRCBASE)/include -Wall ++#CFLAGS += -g -DDEBUG ++CFLAGS += -s -Os ++LDFLAGS += -L$(TOP)/shared -lshared -L$(TOP)/nvram -lnvram ++ ++OBJS := mtd.o crc.o #http.o ++ ++vpath %.c $(TOP)/shared $(SRCBASE)/rts/src ++ ++all: mtd ++ ++clean: ++ rm -f *.o mtd ++ ++install: all ++ install -d $(INSTALLDIR)/sbin ++ install mtd $(INSTALLDIR)/sbin ++ $(STRIP) $(INSTALLDIR)/sbin/mtd ++ ++mtd.o: mtd.c ++ $(CC) -c $^ $(CFLAGS) $(CPPFLAGS) -DOPENWRT_MTD #-DOPENWRT_MTD_HTTP_GET ++ ++mtd: $(OBJS) ++ $(CC) -o $@ $^ $(LDFLAGS) +diff -bBurN WRT54G/release/src/router/rc/mtd.c WRT54G.new/release/src/router/rc/mtd.c +--- WRT54G/release/src/router/rc/mtd.c 2004-01-19 20:34:50.000000000 -0600 ++++ WRT54G.new/release/src/router/rc/mtd.c 2004-03-03 16:24:42.000000000 -0600 +@@ -37,6 +37,86 @@ + #include + #include + ++ ++#ifdef OPENWRT_MTD ++ ++extern int ++mtd_open(const char *mtd, int flags); ++extern int ++mtd_erase(const char *mtd); ++extern int ++mtd_write(const char *path, const char *mtd); ++ ++/* Slightly modified version of mtd_erase. */ ++int ++mtd_unlock(const char *mtd) ++{ ++ int mtd_fd; ++ mtd_info_t mtd_info; ++ erase_info_t erase_info; ++ ++ /* Open MTD device */ ++ if ((mtd_fd = mtd_open(mtd, O_RDWR)) < 0) { ++ perror(mtd); ++ return errno; ++ } ++ ++ /* Get sector size */ ++ if (ioctl(mtd_fd, MEMGETINFO, &mtd_info) != 0) { ++ perror(mtd); ++ close(mtd_fd); ++ return errno; ++ } ++ ++ erase_info.length = mtd_info.erasesize; ++ ++ for (erase_info.start = 0; ++ erase_info.start < mtd_info.size; ++ erase_info.start += mtd_info.erasesize) { ++ (void) ioctl(mtd_fd, MEMUNLOCK, &erase_info); ++/* if (ioctl(mtd_fd, MEMERASE, &erase_info) != 0) { */ ++/* perror(mtd); */ ++/* close(mtd_fd); */ ++/* return errno; */ ++/* } */ ++ } ++ ++ close(mtd_fd); ++ return 0; ++} ++ ++int main(int argc, char **argv) { ++ if(argc == 3 && strcasecmp(argv[1],"unlock")==0) { ++ printf("Unlocking %s\n",argv[2]); ++ return mtd_unlock(argv[2]); ++ } ++ if(argc == 3 && strcasecmp(argv[1],"erase")==0) { ++ printf("Erasing %s\n",argv[2]); ++ return mtd_erase(argv[2]); ++ } ++ if(argc == 4 && strcasecmp(argv[1],"write")==0) { ++ printf("writing %s to %s\n",argv[2],argv[3]); ++ return mtd_write(argv[2],argv[3]); ++ } ++ ++ printf("no valid command given\n"); ++ return -1; ++} ++ ++#ifndef OPENWRT_MTD_HTTP_GET ++/* Dummy routines when no http support. */ ++int ++http_get(const char *server, char *buf, size_t count, off_t offset) ++{ ++ printf("error opening %s\n",server); ++ exit(-1); ++} ++#endif ++ ++#define check_action() (fp ? ACT_IDLE : ACT_WEBS_UPGRADE) ++ ++#endif ++ + /* + * Open an MTD device + * @param mtd path to or partition name of MTD device +diff -bBurN WRT54G/release/src/router/shared/Makefile-openwrt WRT54G.new/release/src/router/shared/Makefile-openwrt +--- WRT54G/release/src/router/shared/Makefile-openwrt 1969-12-31 18:00:00.000000000 -0600 ++++ WRT54G.new/release/src/router/shared/Makefile-openwrt 2004-03-03 12:39:17.000000000 -0600 +@@ -0,0 +1,41 @@ ++# ++# Linux router shared code Makefile ++# ++# 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. ++# ++# $Id: Makefile,v 1.3 2004/01/13 00:51:09 mbm Exp $ ++# ++ifneq ($(wildcard $(SRCBASE)/cy_conf.mak),) ++ include $(SRCBASE)/cy_conf.mak ++endif ++ ++CFLAGS += -I. -I$(SRCBASE)/include -Wall -I$(SRCBASE)/ ++#CFLAGS += -g -DDEBUG ++CFLAGS += -s -Os ++LDFLAGS += -L. ++ ++all: libshared.so ++ ++install: all ++ install -d $(INSTALLDIR)/usr/lib ++ install -m 755 libshared.so $(INSTALLDIR)/usr/lib ++ $(STRIP) $(INSTALLDIR)/usr/lib/libshared.so ++ ++clean: ++ rm -f *.o *.so ++ ++libshared.so: shutils.o wl.o wl_linux.o defaults.o ++ $(LD) -shared -o $@ $^ ++ ++build_date.o: build_date.c ++ ++build_date: ++ echo "const char *builddate = \"`date`\";" > build_date.c ++ ++*.o: $(CY_DEPS) +diff -bBurN WRT54GS/release/src/router/nvram/nvram_linux.c-dist WRT54GS.new/release/src/router/nvram/nvram_linux.c +--- WRT54GS/release/src/router/nvram/nvram_linux.c-dist 2004-03-30 10:04:10.000000000 -0600 ++++ WRT54GS/release/src/router/nvram/nvram_linux.c 2004-03-30 10:10:09.000000000 -0600 +@@ -27,8 +27,10 @@ + #include + #include + #include ++#ifndef OPENWRT_NVRAM + #include + #include ++#endif + + #define PATH_DEV_NVRAM "/dev/nvram" + +@@ -182,6 +184,20 @@ + { + int ret; + ++#ifdef OPENWRT_NVRAM ++ fprintf(stderr, "nvram_commit(): start\n"); ++ ++ if (nvram_fd < 0) ++ if ((ret = nvram_init(NULL))) ++ return ret; ++ ++ ret = ioctl(nvram_fd, NVRAM_MAGIC, NULL); ++ ++ if (ret < 0) ++ perror(PATH_DEV_NVRAM); ++ ++ fprintf(stderr, "nvram_commit(): end\n"); ++#else + cprintf("nvram_commit(): start\n"); + + if((check_action() == ACT_IDLE) || +@@ -200,6 +216,7 @@ + } + else + cprintf("nvram_commit(): nothing to do...\n"); ++#endif + + return ret; + } +@@ -272,6 +289,7 @@ + return j; + } + ++#ifndef OPENWRT_NVRAM + int + check_action(void) + { +@@ -318,3 +336,5 @@ + + return 0; + } ++ ++#endif diff --git a/obsolete-buildroot/sources/openwrt-wrt54g-shared.patch b/obsolete-buildroot/sources/openwrt-wrt54g-shared.patch new file mode 100644 index 0000000000..f357885bcc --- /dev/null +++ b/obsolete-buildroot/sources/openwrt-wrt54g-shared.patch @@ -0,0 +1,11 @@ +--- WRT54G/release/src/shared/sbpci.c-dist 2004-03-15 13:13:37.000000000 -0600 ++++ WRT54G/release/src/shared/sbpci.c 2004-03-15 13:15:38.000000000 -0600 +@@ -269,7 +269,7 @@ + sb_core_reset(sbh, 0); + + /* In some board, */ +- if(nvram_match("boardtype", "bcm94710dev")) ++ if(nvram_match("boardtype", "bcm94710dev") || nvram_match("boardtype", "bcm94710ap")) + CT4712_WR = 0; + else + CT4712_WR = 1; diff --git a/obsolete-buildroot/sources/patch-kernel.sh b/obsolete-buildroot/sources/patch-kernel.sh new file mode 100755 index 0000000000..79401c2a74 --- /dev/null +++ b/obsolete-buildroot/sources/patch-kernel.sh @@ -0,0 +1,53 @@ +#! /bin/sh +# A little script I whipped up to make it easy to +# patch source trees and have sane error handling +# -Erik +# +# (c) 2002 Erik Andersen + +# Set directories from arguments, or use defaults. +targetdir=${1-.} +patchdir=${2-../kernel-patches} +patchpattern=${3-*} + +if [ ! -d "${targetdir}" ] ; then + echo "Aborting. '${targetdir}' is not a directory." + exit 1 +fi +if [ ! -d "${patchdir}" ] ; then + echo "Aborting. '${patchdir}' is not a directory." + exit 1 +fi + +for i in ${patchdir}/${patchpattern} ; do + case "$i" in + *.gz) + type="gzip"; uncomp="gunzip -dc"; ;; + *.bz) + type="bzip"; uncomp="bunzip -dc"; ;; + *.bz2) + type="bzip2"; uncomp="bunzip2 -dc"; ;; + *.zip) + type="zip"; uncomp="unzip -d"; ;; + *.Z) + type="compress"; uncomp="uncompress -c"; ;; + *) + type="plaintext"; uncomp="cat"; ;; + esac + echo "" + echo "Applying ${i} using ${type}: " + ${uncomp} ${i} | patch -p1 -E -d ${targetdir} + if [ $? != 0 ] ; then + echo "Patch failed! Please fix $i!" + exit 1 + fi +done + +# Check for rejects... +if [ "`find $targetdir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] ; then + echo "Aborting. Reject files found." + exit 1 +fi + +# Remove backup files +find $targetdir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \; diff --git a/obsolete-buildroot/sources/pcmcia.patch b/obsolete-buildroot/sources/pcmcia.patch new file mode 100644 index 0000000000..121435fc1b --- /dev/null +++ b/obsolete-buildroot/sources/pcmcia.patch @@ -0,0 +1,123 @@ +--- pcmcia-cs-3.1.34/etc/config.opts.orig Tue Jul 9 09:36:23 2002 ++++ pcmcia-cs-3.1.34/etc/config.opts Tue Jul 9 09:37:47 2002 +@@ -5,7 +5,7 @@ + + # System resources available for PCMCIA devices + +-include port 0x100-0x4ff, port 0x800-0x8ff, port 0xc00-0xcff ++include port 0x100-0x4ff, port 0xc00-0xcff + include memory 0xc0000-0xfffff + include memory 0xa0000000-0xa0ffffff, memory 0x60000000-0x60ffffff + +diff -urN pcmcia-cs-3.2.3.orig/etc/shared pcmcia-cs-3.2.3/etc/shared +--- pcmcia-cs-3.2.3.orig/etc/shared 2002-08-18 21:21:11.000000000 -0600 ++++ pcmcia-cs-3.2.3/etc/shared 2003-02-14 05:05:07.000000000 -0700 +@@ -2,6 +2,8 @@ + # shared 1.31 2002/08/19 03:21:11 (David Hinds) + # + ++umask 022 ++ + usage () + { + echo "usage: $0 [action] [device name]" +--- /dev/null 2003-01-21 22:14:35.000000000 -0700 ++++ pcmcia-cs-3.2.4/etc/pcmcia 2003-06-09 12:04:02.000000000 -0600 +@@ -0,0 +1,6 @@ ++# Defaults for pcmcia (sourced by /etc/init.d/S30pcmcia) ++PCMCIA=yes ++PCIC=yenta_socket ++PCIC_OPTS= ++CORE_OPTS= ++CARDMGR_OPTS= +--- pcmcia-cs-3.2.4/etc/rc.pcmcia.orig 2002-08-08 00:43:43.000000000 -0600 ++++ pcmcia-cs-3.2.4/etc/rc.pcmcia 2003-06-09 15:17:28.000000000 -0600 +@@ -4,6 +4,8 @@ + # + # This is designed to work in BSD as well as SysV init setups. See + # the HOWTO for customization instructions. ++# Modified to comply with Debian's standards by Brian Mays ++# . + + # Tags for Red Hat init configuration tools + # +@@ -26,9 +28,9 @@ + done + + # Source PCMCIA configuration, if available +-if [ -f /etc/pcmcia.conf ] ; then ++if [ -f /etc/default/pcmcia ] ; then + # Debian startup option file +- . /etc/pcmcia.conf ++ . /etc/default/pcmcia + elif [ -f /etc/sysconfig/pcmcia ] ; then + # Red Hat startup option file + . /etc/sysconfig/pcmcia +@@ -50,9 +52,22 @@ + done + if [ "$PCMCIA" -a "$PCMCIA" != "yes" ] ; then exit 0 ; fi + ++# Debian modification: Fix PCIC for stand-alone modules. ++# yenta_socket -> i82365 on these systems. ++# Existence of a standalone module implies that it is preferred. ++if [ -d /lib/modules/preferred ] ; then ++ PC=/lib/modules/preferred/pcmcia ++else ++ PC=/lib/modules/`uname -r`/pcmcia ++fi ++if [ "$PCIC" = yenta_socket -a -e $PC/i82365.o \ ++ -a ! -L $PC/i82365.o ]; then ++ PCIC=i82365 ++fi ++ + usage() + { +- echo "Usage: $0 {start|stop|status|restart|reload}" ++ echo "Usage: $0 {start|stop|status|restart|reload|force-reload}" + } + + cleanup() +@@ -84,7 +99,7 @@ + SC=/var/lib/pcmcia/scheme + RUN=/var/lib/pcmcia + else +- SC=/var/run/pcmcia-scheme ++ SC=/var/lib/misc/pcmcia-scheme + RUN=/var/run + fi + if [ -L $SC -o ! -O $SC ] ; then rm -f $SC ; fi +@@ -154,7 +172,7 @@ + ;; + + status) +- pid=`/sbin/pidof cardmgr` ++ pid=`/bin/pidof cardmgr` + if [ "$pid" != "" ] ; then + echo "cardmgr (pid $pid) is running..." + EXITCODE=0 +@@ -164,12 +182,18 @@ + fi + ;; + +- restart|reload) ++ restart) + $0 stop + $0 start + EXITCODE=$? + ;; + ++ reload|force-reload) ++ echo "Reloading $DESC configuration files." ++ kill -1 `cat /var/run/cardmgr.pid` 2>/dev/null ++ EXITCODE=0 ++ ;; ++ + *) + usage + ;; +@@ -179,4 +203,4 @@ + done + + # Only exit if we're in our own subshell +-case $0 in *rc.pcmcia) exit $EXITCODE ;; esac ++case $0 in *pcmcia) exit $EXITCODE ;; esac diff --git a/obsolete-buildroot/sources/perl-cross-0.1.tar.gz b/obsolete-buildroot/sources/perl-cross-0.1.tar.gz new file mode 100644 index 0000000000..d0c553dc8a Binary files /dev/null and b/obsolete-buildroot/sources/perl-cross-0.1.tar.gz differ diff --git a/obsolete-buildroot/sources/perl.patch b/obsolete-buildroot/sources/perl.patch new file mode 100644 index 0000000000..0e9ab19d4f --- /dev/null +++ b/obsolete-buildroot/sources/perl.patch @@ -0,0 +1,996 @@ +diff -urN cross.o/Makefile cross.x/Makefile +--- Makefile 2003-04-15 14:35:51.000000000 -0600 ++++ perl-5.8.0.uclibc/cross/Makefile 2003-06-27 16:38:23.000000000 -0600 +@@ -49,8 +49,8 @@ + @echo toolchain: $(CC), $(CXX), $(LD), $(STRIP), $(AR), $(RANLIB) + @echo Optimizations: $(FULL_OPTIMIZATION) + +- $(TOPDIR)/generate_config_sh config.sh-$(SYS) > $(TOPDIR)/../config.sh +- $(TOPDIR)/generate_config_sh config.sh-$(SYS) > $(TOPDIR)/../config.sh-arse ++ $(TOPDIR)/generate_config_sh config.sh.uclibc > $(TOPDIR)/../config.sh ++ $(TOPDIR)/generate_config_sh config.sh.uclibc > $(TOPDIR)/../config.sh-arse + cd $(TOPDIR)/.. ; ./Configure -S ; make depend ; make ; make more + cd $(TOPDIR)/.. ; mkdir -p fake_config_library ; cp lib/Config.pm fake_config_library + cd $(TOPDIR)/.. ; $(MAKE) more2 "PERLRUN=/usr/bin/perl -I$(TOPDIR)/../fake_config_library -MConfig" +diff -urN cross.o/config.sh.uclibc cross.x/config.sh.uclibc +--- /dev/null ++++ perl-5.8.0.uclibc/cross/config.sh.uclibc 2003-06-27 16:53:28.000000000 -0600 +@@ -0,0 +1,978 @@ ++#!/bin/sh ++# ++# This file was produced by running the Configure script. It holds all the ++# definitions figured out by Configure. Should you modify one of these values, ++# do not forget to propagate your changes by running "Configure -der". You may ++# instead choose to run each of the .SH files by yourself, or "Configure -S". ++# ++ ++# Package name : perl5 ++# Source directory : . ++# Configuration time: Fri Jun 27 16:41:22 MDT 2003 ++# Configured by : root ++# Target system : ++ ++Author='' ++Date='$Date' ++Header='' ++Id='$Id' ++Locker='' ++Log='$Log' ++Mcc='Mcc' ++RCSfile='$RCSfile' ++Revision='$Revision' ++Source='' ++State='' ++_a='.a' ++_exe='' ++_o='.o' ++afs='false' ++afsroot='/afs' ++alignbytes='4' ++ansi2knr='' ++aphostname='/bin/hostname' ++api_revision='5' ++api_subversion='0' ++api_version='8' ++api_versionstring='5.8.0' ++ar='TARGET_CROSSar' ++archlib='/usr/lib/perl/5.8.0/TARGET_ARCH-linux' ++archlibexp='/usr/lib/perl/5.8.0/TARGET_ARCH-linux' ++archname64='' ++archname='TARGET_ARCH-linux' ++archobjs='' ++asctime_r_proto='0' ++awk='awk' ++baserev='5.0' ++bash='' ++bin='/usr/bin' ++binexp='/usr/bin' ++bison='bison' ++byacc='byacc' ++byteorder='1234' ++c='' ++castflags='0' ++cat='cat' ++cc='TARGET_CROSScc' ++cccdlflags='-fpic' ++ccdlflags='-rdynamic' ++ccflags='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ++ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ++ccname='gcc' ++ccsymbols='__ARM_ARCH_4T__=1 __GNUC_MINOR__=3 __GNUC_PATCHLEVEL__=0' ++ccversion='' ++cf_by='root' ++charsize='1' ++chgrp='' ++chmod='chmod' ++chown='' ++clocktype='clock_t' ++comm='comm' ++compress='' ++contains='grep' ++cp='cp' ++cpio='' ++cpp='cpp' ++cpp_stuff='42' ++cppccsymbols='__GNUC__=3' ++cppflags='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ++cpplast='-' ++cppminus='-' ++cpprun='TARGET_CROSScc -E' ++cppstdin='TARGET_CROSScc -E' ++cppsymbols='BIG_ENDIAN=4321 __BIG_ENDIAN=4321 __ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC_MINOR__=3 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 LITTLE_ENDIAN=1234 __LITTLE_ENDIAN=1234 _POSIX_C_SOURCE=199506 _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' ++crypt_r_proto='0' ++cryptlib='' ++csh='csh' ++ctermid_r_proto='0' ++ctime_r_proto='0' ++d_Gconvert='gcvt((x),(n),(b))' ++d_PRIEUldbl='define' ++d_PRIFUldbl='define' ++d_PRIGUldbl='define' ++d_PRIXU64='define' ++d_PRId64='define' ++d_PRIeldbl='define' ++d_PRIfldbl='define' ++d_PRIgldbl='define' ++d_PRIi64='define' ++d_PRIo64='define' ++d_PRIu64='define' ++d_PRIx64='define' ++d_SCNfldbl='define' ++d__fwalk='undef' ++d_access='define' ++d_accessx='undef' ++d_alarm='define' ++d_archlib='define' ++d_asctime_r='undef' ++d_atolf='undef' ++d_atoll='define' ++d_attribut='define' ++d_bcmp='define' ++d_bcopy='define' ++d_bsd='undef' ++d_bsdgetpgrp='undef' ++d_bsdsetpgrp='undef' ++d_bzero='define' ++d_casti32='define' ++d_castneg='define' ++d_charvspr='define' ++d_chown='define' ++d_chroot='define' ++d_chsize='undef' ++d_class='undef' ++d_closedir='define' ++d_cmsghdr_s='define' ++d_const='define' ++d_crypt='define' ++d_crypt_r='undef' ++d_csh='undef' ++d_ctermid_r='undef' ++d_ctime_r='undef' ++d_cuserid='undef' ++d_dbl_dig='define' ++d_dbminitproto='undef' ++d_difftime='define' ++d_dirfd='define' ++d_dirnamlen='undef' ++d_dlerror='define' ++d_dlopen='define' ++d_dlsymun='undef' ++d_dosuid='undef' ++d_drand48_r='undef' ++d_drand48proto='define' ++d_dup2='define' ++d_eaccess='undef' ++d_endgrent='define' ++d_endgrent_r='undef' ++d_endhent='define' ++d_endhostent_r='undef' ++d_endnent='define' ++d_endnetent_r='undef' ++d_endpent='define' ++d_endprotoent_r='undef' ++d_endpwent='define' ++d_endpwent_r='undef' ++d_endsent='define' ++d_endservent_r='undef' ++d_eofnblk='define' ++d_eunice='undef' ++d_fchdir='define' ++d_fchmod='define' ++d_fchown='define' ++d_fcntl='define' ++d_fcntl_can_lock='define' ++d_fd_macros='define' ++d_fd_set='define' ++d_fds_bits='undef' ++d_fgetpos='define' ++d_finite='define' ++d_finitel='undef' ++d_flexfnam='define' ++d_flock='define' ++d_flockproto='define' ++d_fork='define' ++d_fp_class='undef' ++d_fpathconf='define' ++d_fpclass='undef' ++d_fpclassify='define' ++d_fpclassl='undef' ++d_fpos64_t='undef' ++d_frexpl='undef' ++d_fs_data_s='undef' ++d_fseeko='define' ++d_fsetpos='define' ++d_fstatfs='define' ++d_fstatvfs='define' ++d_fsync='define' ++d_ftello='define' ++d_ftime='undef' ++d_getcwd='define' ++d_getespwnam='undef' ++d_getfsstat='undef' ++d_getgrent='define' ++d_getgrent_r='undef' ++d_getgrgid_r='undef' ++d_getgrnam_r='undef' ++d_getgrps='define' ++d_gethbyaddr='define' ++d_gethbyname='define' ++d_gethent='define' ++d_gethname='define' ++d_gethostbyaddr_r='undef' ++d_gethostbyname_r='undef' ++d_gethostent_r='undef' ++d_gethostprotos='define' ++d_getitimer='define' ++d_getlogin='define' ++d_getlogin_r='undef' ++d_getmnt='undef' ++d_getmntent='define' ++d_getnbyaddr='define' ++d_getnbyname='define' ++d_getnent='define' ++d_getnetbyaddr_r='undef' ++d_getnetbyname_r='undef' ++d_getnetent_r='undef' ++d_getnetprotos='define' ++d_getpagsz='define' ++d_getpbyname='define' ++d_getpbynumber='define' ++d_getpent='define' ++d_getpgid='define' ++d_getpgrp2='undef' ++d_getpgrp='define' ++d_getppid='define' ++d_getprior='define' ++d_getprotobyname_r='undef' ++d_getprotobynumber_r='undef' ++d_getprotoent_r='undef' ++d_getprotoprotos='define' ++d_getprpwnam='undef' ++d_getpwent='define' ++d_getpwent_r='undef' ++d_getpwnam_r='undef' ++d_getpwuid_r='undef' ++d_getsbyname='define' ++d_getsbyport='define' ++d_getsent='define' ++d_getservbyname_r='undef' ++d_getservbyport_r='undef' ++d_getservent_r='undef' ++d_getservprotos='define' ++d_getspnam='define' ++d_getspnam_r='undef' ++d_gettimeod='define' ++d_gmtime_r='undef' ++d_gnulibc='undef' ++d_grpasswd='define' ++d_hasmntopt='define' ++d_htonl='define' ++d_index='undef' ++d_inetaton='define' ++d_int64_t='define' ++d_isascii='define' ++d_isfinite='undef' ++d_isinf='define' ++d_isnan='define' ++d_isnanl='define' ++d_killpg='define' ++d_lchown='define' ++d_ldbl_dig='define' ++d_link='define' ++d_localtime_r='undef' ++d_locconv='define' ++d_lockf='define' ++d_longdbl='define' ++d_longlong='define' ++d_lseekproto='define' ++d_lstat='define' ++d_madvise='define' ++d_mblen='define' ++d_mbstowcs='define' ++d_mbtowc='define' ++d_memchr='define' ++d_memcmp='define' ++d_memcpy='define' ++d_memmove='define' ++d_memset='define' ++d_mkdir='define' ++d_mkdtemp='define' ++d_mkfifo='define' ++d_mkstemp='define' ++d_mkstemps='undef' ++d_mktime='define' ++d_mmap='define' ++d_modfl='undef' ++d_modfl_pow32_bug='undef' ++d_mprotect='define' ++d_msg='define' ++d_msg_ctrunc='define' ++d_msg_dontroute='define' ++d_msg_oob='define' ++d_msg_peek='define' ++d_msg_proxy='define' ++d_msgctl='define' ++d_msgget='define' ++d_msghdr_s='define' ++d_msgrcv='define' ++d_msgsnd='define' ++d_msync='define' ++d_munmap='define' ++d_mymalloc='undef' ++d_nice='define' ++d_nl_langinfo='define' ++d_nv_preserves_uv='define' ++d_off64_t='undef' ++d_old_pthread_create_joinable='undef' ++d_oldpthreads='undef' ++d_oldsock='undef' ++d_open3='define' ++d_pathconf='define' ++d_pause='define' ++d_perl_otherlibdirs='undef' ++d_phostname='undef' ++d_pipe='define' ++d_poll='define' ++d_portable='define' ++d_procselfexe='define' ++d_pthread_atfork='undef' ++d_pthread_yield='undef' ++d_pwage='undef' ++d_pwchange='undef' ++d_pwclass='undef' ++d_pwcomment='undef' ++d_pwexpire='undef' ++d_pwgecos='define' ++d_pwpasswd='define' ++d_pwquota='undef' ++d_qgcvt='undef' ++d_quad='define' ++d_random_r='undef' ++d_readdir64_r='undef' ++d_readdir='define' ++d_readdir_r='undef' ++d_readlink='define' ++d_readv='define' ++d_recvmsg='define' ++d_rename='define' ++d_rewinddir='define' ++d_rmdir='define' ++d_safebcpy='undef' ++d_safemcpy='undef' ++d_sanemcmp='define' ++d_sbrkproto='define' ++d_sched_yield='define' ++d_scm_rights='define' ++d_seekdir='define' ++d_select='define' ++d_sem='define' ++d_semctl='define' ++d_semctl_semid_ds='define' ++d_semctl_semun='define' ++d_semget='define' ++d_semop='define' ++d_sendmsg='define' ++d_setegid='define' ++d_seteuid='define' ++d_setgrent='define' ++d_setgrent_r='undef' ++d_setgrps='define' ++d_sethent='define' ++d_sethostent_r='undef' ++d_setitimer='define' ++d_setlinebuf='define' ++d_setlocale='define' ++d_setlocale_r='undef' ++d_setnent='define' ++d_setnetent_r='undef' ++d_setpent='define' ++d_setpgid='define' ++d_setpgrp2='undef' ++d_setpgrp='define' ++d_setprior='define' ++d_setproctitle='undef' ++d_setprotoent_r='undef' ++d_setpwent='define' ++d_setpwent_r='undef' ++d_setregid='define' ++d_setresgid='define' ++d_setresuid='define' ++d_setreuid='define' ++d_setrgid='undef' ++d_setruid='undef' ++d_setsent='define' ++d_setservent_r='undef' ++d_setsid='define' ++d_setvbuf='define' ++d_sfio='undef' ++d_shm='define' ++d_shmat='define' ++d_shmatprototype='define' ++d_shmctl='define' ++d_shmdt='define' ++d_shmget='define' ++d_sigaction='define' ++d_sigprocmask='define' ++d_sigsetjmp='define' ++d_sockatmark='undef' ++d_sockatmarkproto='undef' ++d_socket='define' ++d_socklen_t='define' ++d_sockpair='define' ++d_socks5_init='undef' ++d_sqrtl='undef' ++d_srand48_r='undef' ++d_srandom_r='undef' ++d_sresgproto='undef' ++d_sresuproto='undef' ++d_statblks='define' ++d_statfs_f_flags='undef' ++d_statfs_s='define' ++d_statvfs='define' ++d_stdio_cnt_lval='undef' ++d_stdio_ptr_lval='undef' ++d_stdio_ptr_lval_nochange_cnt='undef' ++d_stdio_ptr_lval_sets_cnt='undef' ++d_stdio_stream_array='undef' ++d_stdiobase='undef' ++d_stdstdio='undef' ++d_strchr='define' ++d_strcoll='define' ++d_strctcpy='define' ++d_strerrm='strerror(e)' ++d_strerror='define' ++d_strerror_r='undef' ++d_strftime='define' ++d_strtod='define' ++d_strtol='define' ++d_strtold='define' ++d_strtoll='define' ++d_strtoq='define' ++d_strtoul='define' ++d_strtoull='define' ++d_strtouq='define' ++d_strxfrm='define' ++d_suidsafe='undef' ++d_symlink='define' ++d_syscall='define' ++d_syscallproto='define' ++d_sysconf='define' ++d_sysernlst='' ++d_syserrlst='define' ++d_system='define' ++d_tcgetpgrp='define' ++d_tcsetpgrp='define' ++d_telldir='define' ++d_telldirproto='define' ++d_time='define' ++d_times='define' ++d_tm_tm_gmtoff='define' ++d_tm_tm_zone='define' ++d_tmpnam_r='undef' ++d_truncate='define' ++d_ttyname_r='undef' ++d_tzname='define' ++d_u32align='undef' ++d_ualarm='undef' ++d_umask='define' ++d_uname='define' ++d_union_semun='undef' ++d_unordered='undef' ++d_usleep='define' ++d_usleepproto='define' ++d_ustat='undef' ++d_vendorarch='undef' ++d_vendorbin='undef' ++d_vendorlib='undef' ++d_vfork='undef' ++d_void_closedir='undef' ++d_voidsig='define' ++d_voidtty='' ++d_volatile='define' ++d_vprintf='define' ++d_wait4='define' ++d_waitpid='define' ++d_wcstombs='define' ++d_wctomb='define' ++d_writev='define' ++d_xenix='undef' ++date='date' ++db_hashtype='u_int32_t' ++db_prefixtype='size_t' ++db_version_major='' ++db_version_minor='' ++db_version_patch='' ++defvoidused='15' ++direntrytype='struct dirent' ++dlext='so' ++dlsrc='dl_dlopen.xs' ++doublesize='8' ++drand01='drand48()' ++drand48_r_proto='0' ++dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared' ++eagain='EAGAIN' ++ebcdic='undef' ++echo='echo' ++egrep='egrep' ++emacs='' ++endgrent_r_proto='0' ++endhostent_r_proto='0' ++endnetent_r_proto='0' ++endprotoent_r_proto='0' ++endpwent_r_proto='0' ++endservent_r_proto='0' ++eunicefix=':' ++exe_ext='' ++expr='expr' ++extensions='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Errno' ++extras='' ++fflushNULL='define' ++fflushall='undef' ++find='' ++firstmakefile='makefile' ++flex='' ++fpossize='16' ++fpostype='fpos_t' ++freetype='void' ++from=':' ++full_ar='/usr/bin/ar' ++full_csh='csh' ++full_sed='/bin/sed' ++gccosandvers='' ++gccversion='3.3' ++getgrent_r_proto='0' ++getgrgid_r_proto='0' ++getgrnam_r_proto='0' ++gethostbyaddr_r_proto='0' ++gethostbyname_r_proto='0' ++gethostent_r_proto='0' ++getlogin_r_proto='0' ++getnetbyaddr_r_proto='0' ++getnetbyname_r_proto='0' ++getnetent_r_proto='0' ++getprotobyname_r_proto='0' ++getprotobynumber_r_proto='0' ++getprotoent_r_proto='0' ++getpwent_r_proto='0' ++getpwnam_r_proto='0' ++getpwuid_r_proto='0' ++getservbyname_r_proto='0' ++getservbyport_r_proto='0' ++getservent_r_proto='0' ++getspnam_r_proto='0' ++gidformat='"lu"' ++gidsign='1' ++gidsize='4' ++gidtype='gid_t' ++glibpth='/usr/shlib /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib ' ++gmake='gmake' ++gmtime_r_proto='0' ++gnulibc_version='' ++grep='grep' ++groupcat='cat /etc/group' ++groupstype='gid_t' ++gzip='gzip' ++h_fcntl='false' ++h_sysfile='true' ++hint='previous' ++hostcat='cat /etc/hosts' ++i16size='2' ++i16type='short' ++i32size='4' ++i32type='long' ++i64size='8' ++i64type='long long' ++i8size='1' ++i8type='char' ++i_arpainet='define' ++i_bsdioctl='' ++i_crypt='define' ++i_db='undef' ++i_dbm='undef' ++i_dirent='define' ++i_dld='undef' ++i_dlfcn='define' ++i_fcntl='undef' ++i_float='define' ++i_fp='undef' ++i_fp_class='undef' ++i_gdbm='undef' ++i_grp='define' ++i_ieeefp='undef' ++i_inttypes='define' ++i_langinfo='define' ++i_libutil='undef' ++i_limits='define' ++i_locale='define' ++i_machcthr='undef' ++i_malloc='define' ++i_math='define' ++i_memory='undef' ++i_mntent='define' ++i_ndbm='undef' ++i_netdb='define' ++i_neterrno='undef' ++i_netinettcp='define' ++i_niin='define' ++i_poll='define' ++i_prot='undef' ++i_pthread='define' ++i_pwd='define' ++i_rpcsvcdbm='undef' ++i_sfio='undef' ++i_sgtty='undef' ++i_shadow='define' ++i_socks='undef' ++i_stdarg='define' ++i_stddef='define' ++i_stdlib='define' ++i_string='define' ++i_sunmath='undef' ++i_sysaccess='undef' ++i_sysdir='define' ++i_sysfile='define' ++i_sysfilio='undef' ++i_sysin='undef' ++i_sysioctl='define' ++i_syslog='define' ++i_sysmman='define' ++i_sysmode='undef' ++i_sysmount='define' ++i_sysndir='undef' ++i_sysparam='define' ++i_sysresrc='define' ++i_syssecrt='undef' ++i_sysselct='define' ++i_syssockio='undef' ++i_sysstat='define' ++i_sysstatfs='define' ++i_sysstatvfs='define' ++i_systime='define' ++i_systimek='undef' ++i_systimes='define' ++i_systypes='define' ++i_sysuio='define' ++i_sysun='define' ++i_sysutsname='define' ++i_sysvfs='define' ++i_syswait='define' ++i_termio='undef' ++i_termios='define' ++i_time='define' ++i_unistd='define' ++i_ustat='undef' ++i_utime='define' ++i_values='define' ++i_varargs='undef' ++i_varhdr='stdarg.h' ++i_vfork='undef' ++ignore_versioned_solibs='y' ++inc_version_list=' ' ++inc_version_list_init='0' ++incpath='' ++inews='' ++installarchlib='./install_me_here/usr/lib/perl/5.8.0/TARGET_ARCH-linux' ++installbin='./install_me_here/usr/bin' ++installman1dir='' ++installman3dir='' ++installprefix='./install_me_here/usr/lib/perl/5.8.0' ++installprefixexp='./install_me_here/usr/lib/perl/5.8.0' ++installprivlib='./install_me_here/usr/lib/perl/5.8.0' ++installscript='./install_me_here/usr/bin' ++installsitearch='./install_me_here/usr/lib/perl/5.8.0/TARGET_ARCH-linux' ++installsitebin='./install_me_here/usr/bin' ++installsitelib='./install_me_here/usr/lib/perl/5.8.0' ++installstyle='lib' ++installusrbinperl='undef' ++installvendorarch='' ++installvendorbin='' ++installvendorlib='' ++intsize='4' ++issymlink='/usr/bin/test -h' ++ivdformat='"ld"' ++ivsize='4' ++ivtype='long' ++known_extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Thread Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared' ++ksh='' ++ld='TARGET_CROSScc' ++lddlflags='-shared' ++ldflags='' ++ldflags_uselargefiles='' ++ldlibpthname='LD_LIBRARY_PATH' ++less='less' ++lib_ext='.a' ++libc='/lib/libc.so.0' ++libperl='libperl.a' ++libpth='/lib /usr/lib' ++libs='-ldl -lm -lpthread -lc -lcrypt' ++libsdirs='' ++libsfiles='' ++libsfound='' ++libspath=' /lib /usr/lib' ++libswanted='sfio socket bind inet nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt sec ucb BSD PW x util' ++libswanted_uselargefiles='' ++line='' ++lint='' ++lkflags='' ++ln='ln' ++lns='/bin/ln -s' ++localtime_r_proto='0' ++locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include' ++loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib' ++longdblsize='8' ++longlongsize='8' ++longsize='4' ++lp='' ++lpr='' ++ls='ls' ++lseeksize='8' ++lseektype='off_t' ++mail='' ++mailx='' ++make='make' ++make_set_make='#' ++mallocobj='' ++mallocsrc='' ++malloctype='void *' ++man1dir=' ' ++man1direxp='' ++man1ext='0' ++man3dir=' ' ++man3direxp='' ++man3ext='0' ++mips_type='' ++mkdir='mkdir' ++mmaptype='void *' ++modetype='mode_t' ++more='more' ++multiarch='undef' ++mv='' ++myarchname='TARGET_ARCH-linux' ++n='-n' ++need_va_copy='undef' ++netdb_hlen_type='size_t' ++netdb_host_type='const void *' ++netdb_name_type='const char *' ++netdb_net_type='in_addr_t' ++nm='TARGET_CROSSnm' ++nm_opt='' ++nm_so_opt='--dynamic' ++nonxs_ext='Errno' ++nroff='nroff' ++nvEUformat='"E"' ++nvFUformat='"F"' ++nvGUformat='"G"' ++nv_preserves_uv_bits='32' ++nveformat='"e"' ++nvfformat='"f"' ++nvgformat='"g"' ++nvsize='8' ++nvtype='double' ++o_nonblock='O_NONBLOCK' ++obj_ext='.o' ++old_pthread_create_joinable='' ++optimize='-O2' ++orderlib='false' ++osname='linux' ++otherlibdirs=' ' ++package='perl5' ++pager='/bin/more' ++passcat='cat /etc/passwd' ++patchlevel='8' ++path_sep=':' ++perl5='' ++perl='' ++perl_patchlevel='' ++perllibs='-ldl -lm -lpthread -lc -lcrypt' ++perlpath='/usr/bin/perl' ++pg='pg' ++phostname='hostname' ++pidtype='pid_t' ++plibpth='' ++pm_apiversion='5.005' ++pmake='' ++pr='' ++prefix='/usr/lib/perl/5.8.0' ++prefixexp='/usr/lib/perl/5.8.0' ++privlib='/usr/lib/perl/5.8.0' ++privlibexp='/usr/lib/perl/5.8.0' ++procselfexe='"/proc/self/exe"' ++prototype='define' ++ptrsize='4' ++quadkind='3' ++quadtype='long long' ++randbits='48' ++randfunc='drand48' ++random_r_proto='0' ++randseedtype='long' ++ranlib='TARGET_CROSSranlib' ++rd_nodata='-1' ++readdir64_r_proto='0' ++readdir_r_proto='0' ++revision='5' ++rm='rm' ++rmail='' ++run='' ++runnm='true' ++sPRIEUldbl='"E"' ++sPRIFUldbl='"F"' ++sPRIGUldbl='"G"' ++sPRIXU64='"LX"' ++sPRId64='"Ld"' ++sPRIeldbl='"e"' ++sPRIfldbl='"f"' ++sPRIgldbl='"g"' ++sPRIi64='"Li"' ++sPRIo64='"Lo"' ++sPRIu64='"Lu"' ++sPRIx64='"Lx"' ++sSCNfldbl='"f"' ++sched_yield='sched_yield()' ++scriptdir='/usr/bin' ++scriptdirexp='/usr/bin' ++sed='sed' ++seedfunc='srand48' ++selectminbits='32' ++selecttype='fd_set *' ++sendmail='' ++setgrent_r_proto='0' ++sethostent_r_proto='0' ++setlocale_r_proto='0' ++setnetent_r_proto='0' ++setprotoent_r_proto='0' ++setpwent_r_proto='0' ++setservent_r_proto='0' ++sh='/bin/sh' ++shar='' ++sharpbang='#!' ++shmattype='void *' ++shortsize='2' ++shrpenv='' ++shsharp='true' ++sig_count='64' ++sig_name='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS RTMIN NUM33 NUM34 NUM35 NUM36 NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 NUM43 NUM44 NUM45 NUM46 NUM47 NUM48 NUM49 NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58 NUM59 NUM60 NUM61 NUM62 RTMAX IOT CLD POLL UNUSED ' ++sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", "KILL", "USR1", "SEGV", "USR2", "PIPE", "ALRM", "TERM", "STKFLT", "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", "URG", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "IO", "PWR", "SYS", "RTMIN", "NUM33", "NUM34", "NUM35", "NUM36", "NUM37", "NUM38", "NUM39", "NUM40", "NUM41", "NUM42", "NUM43", "NUM44", "NUM45", "NUM46", "NUM47", "NUM48", "NUM49", "NUM50", "NUM51", "NUM52", "NUM53", "NUM54", "NUM55", "NUM56", "NUM57", "NUM58", "NUM59", "NUM60", "NUM61", "NUM62", "RTMAX", "IOT", "CLD", "POLL", "UNUSED", 0' ++sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 6 17 29 31 ' ++sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0' ++sig_size='68' ++signal_t='void' ++sitearch='/usr/lib/perl/5.8.0/TARGET_ARCH-linux' ++sitearchexp='/usr/lib/perl/5.8.0/TARGET_ARCH-linux' ++sitebin='/usr/bin' ++sitebinexp='/usr/bin' ++sitelib='/usr/lib/perl/5.8.0' ++sitelib_stem='/usr/lib/perl/5.8.0/lib/site_perl' ++sitelibexp='/usr/lib/perl/5.8.0' ++siteprefix='/usr/lib/perl/5.8.0' ++siteprefixexp='/usr/lib/perl/5.8.0' ++sizesize='4' ++sizetype='size_t' ++sleep='' ++smail='' ++so='so' ++sockethdr='' ++socketlib='' ++socksizetype='socklen_t' ++sort='sort' ++spackage='Perl5' ++spitshell='cat' ++srand48_r_proto='0' ++srandom_r_proto='0' ++src='.' ++ssizetype='ssize_t' ++startperl='#!/usr/bin/perl' ++startsh='#!/bin/sh' ++static_ext=' ' ++stdchar='char' ++stdio_base='((fp)->_base)' ++stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)' ++stdio_cnt='((fp)->_cnt)' ++stdio_filbuf='' ++stdio_ptr='((fp)->_ptr)' ++stdio_stream_array='' ++strerror_r_proto='0' ++strings='/usr/include/string.h' ++submit='' ++subversion='0' ++sysman='/usr/man/man1' ++tail='' ++tar='' ++targetarch='' ++tbl='' ++tee='' ++test='test' ++timeincl='/usr/include/sys/time.h /usr/include/time.h ' ++timetype='time_t' ++tmpnam_r_proto='0' ++to=':' ++touch='touch' ++tr='tr' ++trnl='\n' ++troff='' ++ttyname_r_proto='0' ++u16size='2' ++u16type='unsigned short' ++u32size='4' ++u32type='unsigned long' ++u64size='8' ++u64type='unsigned long long' ++u8size='1' ++u8type='unsigned char' ++uidformat='"lu"' ++uidsign='1' ++uidsize='4' ++uidtype='uid_t' ++uname='uname' ++uniq='uniq' ++uquadtype='unsigned long long' ++use5005threads='undef' ++use64bitall='undef' ++use64bitint='undef' ++usecrosscompile='undef' ++usedl='define' ++useithreads='undef' ++uselargefiles='define' ++uselongdouble='undef' ++usemorebits='undef' ++usemultiplicity='undef' ++usemymalloc='n' ++usenm='true' ++useopcode='true' ++useperlio='define' ++useposix='true' ++usereentrant='undef' ++usesfio='false' ++useshrplib='false' ++usesocks='undef' ++usethreads='undef' ++usevendorprefix='undef' ++usevfork='false' ++usrinc='/usr/include' ++uuname='' ++uvXUformat='"lX"' ++uvoformat='"lo"' ++uvsize='4' ++uvtype='unsigned long' ++uvuformat='"lu"' ++uvxformat='"lx"' ++vendorarch='' ++vendorarchexp='' ++vendorbin='' ++vendorbinexp='' ++vendorlib='' ++vendorlib_stem='' ++vendorlibexp='' ++vendorprefix='' ++vendorprefixexp='' ++version='5.8.0' ++version_patchlevel_string='version 8 subversion 0' ++versiononly='undef' ++vi='' ++voidflags='15' ++xlibpth='/usr/lib/386 /lib/386' ++xs_apiversion='5.8.0' ++yacc='yacc' ++yaccflags='' ++zcat='' ++zip='zip' ++# Configure command line arguments. ++config_arg0='./Configure' ++config_args='-Dprefix=/usr/lib/perl/5.8.0 -Uinstallusrbinperl -des' ++config_argc=3 ++config_arg1='-Dprefix=/usr/lib/perl/5.8.0' ++config_arg2='-Uinstallusrbinperl' ++config_arg3='-des' ++PERL_REVISION=5 ++PERL_VERSION=8 ++PERL_SUBVERSION=0 ++PERL_API_REVISION=5 ++PERL_API_VERSION=8 ++PERL_API_SUBVERSION=0 ++PERL_PATCHLEVEL= ++PERL_CONFIG_SH=true ++# Variables propagated from previous config.sh file. ++siteman1='' ++siteman3='' ++sitescript='' diff --git a/obsolete-buildroot/sources/sedcheck.sh b/obsolete-buildroot/sources/sedcheck.sh new file mode 100755 index 0000000000..4d645b6ab0 --- /dev/null +++ b/obsolete-buildroot/sources/sedcheck.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ -x /usr/bin/sed ]; then + SED="/usr/bin/sed"; +else + if [ -x /bin/sed ]; then + SED="/bin/sed"; + fi; +fi; + +echo "HELLO" > .sedtest +$SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1 + +if [ $? != 0 ] ; then + echo build-sed-host-binary +else + echo use-sed-host-binary +fi; +rm -f .sedtest + + diff --git a/obsolete-buildroot/sources/skel.tar.gz b/obsolete-buildroot/sources/skel.tar.gz new file mode 100644 index 0000000000..301c5cfa28 Binary files /dev/null and b/obsolete-buildroot/sources/skel.tar.gz differ diff --git a/obsolete-buildroot/sources/specs-arm-soft-float b/obsolete-buildroot/sources/specs-arm-soft-float new file mode 100644 index 0000000000..3f726bd940 --- /dev/null +++ b/obsolete-buildroot/sources/specs-arm-soft-float @@ -0,0 +1,124 @@ +*asm: +%{mbig-endian:-EB} %{mlittle-endian:-EL} %{mcpu=*:-mcpu=%*} %{march=*:-march=%*} %{mapcs-*:-mapcs-%*} %(subtarget_asm_float_spec) %{mthumb-interwork:-mthumb-interwork} %(subtarget_extra_asm_spec) + +*asm_debug: +%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}} + +*asm_final: + + +*asm_options: +%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} + +*invoke_as: +%{!S:-o %{|!pipe:%g.s} | + as %(asm_options) %{!pipe:%g.s} %A } + +*cpp: +%(cpp_cpu_arch) %(subtarget_cpp_spec) %{mapcs-32:%{mapcs-26: %e-mapcs-26 and -mapcs-32 may not be used together}} %{msoft-float:%{mhard-float: %e-msoft-float and -mhard_float may not be used together}} %{mbig-endian:%{mlittle-endian: %e-mbig-endian and -mlittle-endian may not be used together}} + +*cpp_options: +%(cpp_unique_options) %1 %{m*} %{std*} %{ansi} %{W*&pedantic*} %{w} %{f*} %{O*} %{undef} + +*cpp_debug_options: +%{d*} + +*cpp_unique_options: +%{C:%{!E:%eGNU C does not support -C without using -E}} %{CC:%{!E:%eGNU C does not support -CC without using -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3} %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}} + +*trad_capable_cpp: +cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp} + +*cc1: +%{profile:-p} + +*cc1_options: +%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} -auxbase%{c|S:%{o*:-strip %*}%{!o*: %b}}%{!c:%{!S: %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{msoft-float:%{mhard-float: %e-msoft-float and -mhard_float may not be used together}} %{!mhard-float:%{!msoft-float:-msoft-float}} + +*cc1plus: + + +*link_gcc_c_sequence: +%{static:--start-group} %G %L %{static:--end-group}%{!static:%G} + +*endfile: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s + +*link: +%{h*} %{version:-v} %{b} %{Wl,*:%*} %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} -X %{mbig-endian:-EB} -m armelf_linux -p + +*lib: +%{pthread:-lpthread} %{shared:-lc} %{!shared:%{profile:-lc_p}%{!profile:-lc}} + +*libgcc: +%{!mhard-float:-lfloat} %{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:-lgcc_s%M}}} + +*startfile: +%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s} + +*switches_need_spaces: + + +*predefines: + + +*cross_compile: +1 + +*version: +3.3.3 + +*multilib: +. ; + +*multilib_defaults: +marm mlittle-endian msoft-float mapcs-32 mno-thumb-interwork + +*multilib_extra: + + +*multilib_matches: + + +*multilib_exclusions: + + +*multilib_options: + + +*linker: +collect2 + +*link_libgcc: +%D + +*md_exec_prefix: + + +*md_startfile_prefix: + + +*md_startfile_prefix_1: + + +*startfile_prefix_spec: + + +*cpp_cpu_arch: +%{march=arm2:-D__ARM_ARCH_2__} %{march=arm250:-D__ARM_ARCH_2__} %{march=arm3:-D__ARM_ARCH_2__} %{march=arm6:-D__ARM_ARCH_3__} %{march=arm600:-D__ARM_ARCH_3__} %{march=arm610:-D__ARM_ARCH_3__} %{march=arm7:-D__ARM_ARCH_3__} %{march=arm700:-D__ARM_ARCH_3__} %{march=arm710:-D__ARM_ARCH_3__} %{march=arm720:-D__ARM_ARCH_3__} %{march=arm7100:-D__ARM_ARCH_3__} %{march=arm7500:-D__ARM_ARCH_3__} %{march=arm7500fe:-D__ARM_ARCH_3__} %{march=arm7m:-D__ARM_ARCH_3M__} %{march=arm7dm:-D__ARM_ARCH_3M__} %{march=arm7dmi:-D__ARM_ARCH_3M__} %{march=arm7tdmi:-D__ARM_ARCH_4T__} %{march=arm8:-D__ARM_ARCH_4__} %{march=arm810:-D__ARM_ARCH_4__} %{march=arm9:-D__ARM_ARCH_4T__} %{march=arm920:-D__ARM_ARCH_4__} %{march=arm920t:-D__ARM_ARCH_4T__} %{march=arm9tdmi:-D__ARM_ARCH_4T__} %{march=strongarm:-D__ARM_ARCH_4__} %{march=strongarm110:-D__ARM_ARCH_4__} %{march=strongarm1100:-D__ARM_ARCH_4__} %{march=xscale:-D__ARM_ARCH_5TE__} %{march=xscale:-D__XSCALE__} %{march=armv2:-D__ARM_ARCH_2__} %{march=armv2a:-D__ARM_ARCH_2__} %{march=armv3:-D__ARM_ARCH_3__} %{march=armv3m:-D__ARM_ARCH_3M__} %{march=armv4:-D__ARM_ARCH_4__} %{march=armv4t:-D__ARM_ARCH_4T__} %{march=armv5:-D__ARM_ARCH_5__} %{march=armv5t:-D__ARM_ARCH_5T__} %{march=armv5e:-D__ARM_ARCH_5E__} %{march=armv5te:-D__ARM_ARCH_5TE__} %{!march=*: %{mcpu=arm2:-D__ARM_ARCH_2__} %{mcpu=arm250:-D__ARM_ARCH_2__} %{mcpu=arm3:-D__ARM_ARCH_2__} %{mcpu=arm6:-D__ARM_ARCH_3__} %{mcpu=arm600:-D__ARM_ARCH_3__} %{mcpu=arm610:-D__ARM_ARCH_3__} %{mcpu=arm7:-D__ARM_ARCH_3__} %{mcpu=arm700:-D__ARM_ARCH_3__} %{mcpu=arm710:-D__ARM_ARCH_3__} %{mcpu=arm720:-D__ARM_ARCH_3__} %{mcpu=arm7100:-D__ARM_ARCH_3__} %{mcpu=arm7500:-D__ARM_ARCH_3__} %{mcpu=arm7500fe:-D__ARM_ARCH_3__} %{mcpu=arm7m:-D__ARM_ARCH_3M__} %{mcpu=arm7dm:-D__ARM_ARCH_3M__} %{mcpu=arm7dmi:-D__ARM_ARCH_3M__} %{mcpu=arm7tdmi:-D__ARM_ARCH_4T__} %{mcpu=arm8:-D__ARM_ARCH_4__} %{mcpu=arm810:-D__ARM_ARCH_4__} %{mcpu=arm9:-D__ARM_ARCH_4T__} %{mcpu=arm920:-D__ARM_ARCH_4__} %{mcpu=arm920t:-D__ARM_ARCH_4T__} %{mcpu=arm9tdmi:-D__ARM_ARCH_4T__} %{mcpu=strongarm:-D__ARM_ARCH_4__} %{mcpu=strongarm110:-D__ARM_ARCH_4__} %{mcpu=strongarm1100:-D__ARM_ARCH_4__} %{mcpu=xscale:-D__ARM_ARCH_5TE__} %{mcpu=xscale:-D__XSCALE__} %{!mcpu*:%(cpp_cpu_arch_default)}} + +*cpp_cpu_arch_default: +-D__ARM_ARCH_4T__ + +*subtarget_cpp_spec: +%{posix:-D_POSIX_SOURCE} %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} + +*subtarget_extra_asm_spec: + + +*subtarget_asm_float_spec: +%{mapcs-float:-mfloat} %{!mhard-float:-mno-fpu} + +*link_command: +%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}} + diff --git a/obsolete-buildroot/sources/specs-mips-soft-float b/obsolete-buildroot/sources/specs-mips-soft-float new file mode 100644 index 0000000000..35fd671184 --- /dev/null +++ b/obsolete-buildroot/sources/specs-mips-soft-float @@ -0,0 +1,145 @@ +*asm: +%{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips64}%{mips16:%{!mno-mips16:-mips16}} %{mno-mips16:-no-mips16} %(subtarget_asm_optimizing_spec) %(subtarget_asm_debugging_spec) %{membedded-pic} %{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} %{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} %{mgp32} %{mgp64} %{march=*} %(target_asm_spec) %(subtarget_asm_spec) + +*asm_debug: +%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}} + +*asm_final: +%| + +*asm_options: +%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} + +*invoke_as: +%{!S:-o %{|!pipe:%g.s} | + as %(asm_options) %{!pipe:%g.s} %A } + +*cpp: +%(subtarget_cpp_spec) + +*cpp_options: +%(cpp_unique_options) %1 %{m*} %{std*} %{ansi} %{W*&pedantic*} %{w} %{f*} %{O*} %{undef} + +*cpp_debug_options: +%{d*} + +*cpp_unique_options: +%{C:%{!E:%eGNU C does not support -C without using -E}} %{CC:%{!E:%eGNU C does not support -CC without using -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3} %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}} + +*trad_capable_cpp: +cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp} + +*cc1: +%{profile:-p} + +*cc1_options: +%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} -auxbase%{c|S:%{o*:-strip %*}%{!o*: %b}}%{!c:%{!S: %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{msoft-float:%{mhard-float: %e-msoft-float and -mhard_float may not be used together}} %{!mhard-float:%{!msoft-float:-msoft-float}} + +*cc1plus: + + +*link_gcc_c_sequence: +%{static:--start-group} %G %L %{static:--end-group}%{!static:%G} + +*endfile: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s + +*link: +%{!static:--eh-frame-hdr} %(endian_spec) %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} %{static:-static}}} + +*lib: +%{pthread:-lpthread} %{shared:-lc} %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}} + +*libgcc: +%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}}}} + +*startfile: +%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} crti.o%s %{static:crtbeginT.o%s} %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}} + +*switches_need_spaces: + + +*predefines: + + +*cross_compile: +1 + +*version: +3.3.3 + +*multilib: +. ; + +*multilib_defaults: +EB mips1 mabi=32 + +*multilib_extra: + + +*multilib_matches: + + +*multilib_exclusions: + + +*multilib_options: + + +*linker: +collect2 + +*link_libgcc: +%D + +*md_exec_prefix: + + +*md_startfile_prefix: + + +*md_startfile_prefix_1: + + +*startfile_prefix_spec: + + +*subtarget_cc1_spec: + + +*subtarget_cpp_spec: +%{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{pthread:-D_REENTRANT} + +*mips_as_asm_spec: +%{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} %{pipe: %e-pipe is not supported} %{K} %(subtarget_mips_as_asm_spec) + +*gas_asm_spec: +%{mtune=*} %{v} + +*target_asm_spec: +%{mmips-as: %(mips_as_asm_spec)} %{!mmips-as: %(gas_asm_spec)} + +*subtarget_mips_as_asm_spec: +%{v} + +*subtarget_asm_optimizing_spec: +%{noasmopt:-O0} %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} + +*subtarget_asm_debugging_spec: +-g0 + +*mdebug_asm_spec: +%{!gdwarf*:-mdebug} %{gdwarf*:-no-mdebug} + +*subtarget_asm_spec: +%{mabi=64: -64} %{!fno-PIC:%{!fno-pic:-KPIC}} %{fno-PIC:-non_shared} %{fno-pic:-non_shared} + +*asm_abi_default_spec: +-32 + +*endian_spec: +%{!EL:%{!mel:-EB}} %{EL|mel:-EL} + +*link_command: +%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}} + diff --git a/obsolete-buildroot/sources/specs-mipsel-soft-float b/obsolete-buildroot/sources/specs-mipsel-soft-float new file mode 100644 index 0000000000..72aa2a62ef --- /dev/null +++ b/obsolete-buildroot/sources/specs-mipsel-soft-float @@ -0,0 +1,145 @@ +*asm: +%{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips64}%{mips16:%{!mno-mips16:-mips16}} %{mno-mips16:-no-mips16} %(subtarget_asm_optimizing_spec) %(subtarget_asm_debugging_spec) %{membedded-pic} %{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} %{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} %{mgp32} %{mgp64} %{march=*} %(target_asm_spec) %(subtarget_asm_spec) + +*asm_debug: +%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}} + +*asm_final: +%| + +*asm_options: +%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} + +*invoke_as: +%{!S:-o %{|!pipe:%g.s} | + as %(asm_options) %{!pipe:%g.s} %A } + +*cpp: +%(subtarget_cpp_spec) + +*cpp_options: +%(cpp_unique_options) %1 %{m*} %{std*} %{ansi} %{W*&pedantic*} %{w} %{f*} %{O*} %{undef} + +*cpp_debug_options: +%{d*} + +*cpp_unique_options: +%{C:%{!E:%eGNU C does not support -C without using -E}} %{CC:%{!E:%eGNU C does not support -CC without using -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3} %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}} + +*trad_capable_cpp: +cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp} + +*cc1: +%{profile:-p} + +*cc1_options: +%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} -auxbase%{c|S:%{o*:-strip %*}%{!o*: %b}}%{!c:%{!S: %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{msoft-float:%{mhard-float: %e-msoft-float and -mhard_float may not be used together}} %{!mhard-float:%{!msoft-float:-msoft-float}} + +*cc1plus: + + +*link_gcc_c_sequence: +%{static:--start-group} %G %L %{static:--end-group}%{!static:%G} + +*endfile: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s + +*link: +%{!static:--eh-frame-hdr} %(endian_spec) %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} %{static:-static}}} + +*lib: +%{pthread:-lpthread} %{shared:-lc} %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}} + +*libgcc: +%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}}}} + +*startfile: +%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} crti.o%s %{static:crtbeginT.o%s} %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}} + +*switches_need_spaces: + + +*predefines: + + +*cross_compile: +1 + +*version: +3.3.3 + +*multilib: +. ; + +*multilib_defaults: +EL mips1 mabi=32 + +*multilib_extra: + + +*multilib_matches: + + +*multilib_exclusions: + + +*multilib_options: + + +*linker: +collect2 + +*link_libgcc: +%D + +*md_exec_prefix: + + +*md_startfile_prefix: + + +*md_startfile_prefix_1: + + +*startfile_prefix_spec: + + +*subtarget_cc1_spec: + + +*subtarget_cpp_spec: +%{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{pthread:-D_REENTRANT} + +*mips_as_asm_spec: +%{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} %{pipe: %e-pipe is not supported} %{K} %(subtarget_mips_as_asm_spec) + +*gas_asm_spec: +%{mtune=*} %{v} + +*target_asm_spec: +%{mmips-as: %(mips_as_asm_spec)} %{!mmips-as: %(gas_asm_spec)} + +*subtarget_mips_as_asm_spec: +%{v} + +*subtarget_asm_optimizing_spec: +%{noasmopt:-O0} %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} + +*subtarget_asm_debugging_spec: +-g0 + +*mdebug_asm_spec: +%{!gdwarf*:-mdebug} %{gdwarf*:-no-mdebug} + +*subtarget_asm_spec: +%{mabi=64: -64} %{!fno-PIC:%{!fno-pic:-KPIC}} %{fno-PIC:-non_shared} %{fno-pic:-non_shared} + +*asm_abi_default_spec: +-32 + +*endian_spec: +%{!EB:%{!meb:-EL}} %{EB|meb:-EB} + +*link_command: +%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}} + diff --git a/obsolete-buildroot/sources/specs-powerpc-soft-float b/obsolete-buildroot/sources/specs-powerpc-soft-float new file mode 100644 index 0000000000..0cb9ed3a72 --- /dev/null +++ b/obsolete-buildroot/sources/specs-powerpc-soft-float @@ -0,0 +1,352 @@ +*asm: +%(asm_cpu) %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-freebsd: -mbig} %{mcall-i960-old: -mlittle} %{mcall-linux: -mbig} %{mcall-gnu: -mbig} %{mcall-netbsd: -mbig} }}}} + +*asm_debug: +%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}} + +*asm_final: +%| + +*asm_options: +%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} + +*invoke_as: +%{!S:-o %{|!pipe:%g.s} | + as %(asm_options) %{!pipe:%g.s} %A } + +*cpp: +%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %{mads: %(cpp_os_ads) } %{myellowknife: %(cpp_os_yellowknife) } %{mmvme: %(cpp_os_mvme) } %{msim: %(cpp_os_sim) } %{mwindiss: %(cpp_os_windiss) } %{mcall-freebsd: %(cpp_os_freebsd) } %{mcall-linux: %(cpp_os_linux) } %{mcall-gnu: %(cpp_os_gnu) } %{mcall-netbsd: %(cpp_os_netbsd) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %(cpp_os_default) }}}}}}}}} + +*cpp_options: +%(cpp_unique_options) %1 %{m*} %{std*} %{ansi} %{W*&pedantic*} %{w} %{f*} %{O*} %{undef} + +*cpp_debug_options: +%{d*} + +*cpp_unique_options: +%{C:%{!E:%eGNU C does not support -C without using -E}} %{CC:%{!E:%eGNU C does not support -CC without using -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3} %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}} + +*trad_capable_cpp: +cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp} + +*cc1: +%{G*} %{mlittle: %(cc1_endian_little)} %{!mlittle: %{mlittle-endian: %(cc1_endian_little)}} %{mbig: %(cc1_endian_big)} %{!mbig: %{mbig-endian: %(cc1_endian_big)}} %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-aixdesc: -mbig %(cc1_endian_big) } %{mcall-freebsd: -mbig %(cc1_endian_big) } %{mcall-i960-old: -mlittle %(cc1_endian_little) } %{mcall-linux: -mbig %(cc1_endian_big) } %{mcall-gnu: -mbig %(cc1_endian_big) } %{mcall-netbsd: -mbig %(cc1_endian_big) } %{!mcall-aixdesc: %{!mcall-freebsd: %{!mcall-i960-old: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %(cc1_endian_default) }}}}}} }}}} %{mno-sdata: -msdata=none } %{meabi: %{!mcall-*: -mcall-sysv }} %{!meabi: %{!mno-eabi: %{mrelocatable: -meabi } %{mcall-freebsd: -mno-eabi } %{mcall-i960-old: -meabi } %{mcall-linux: -mno-eabi } %{mcall-gnu: -mno-eabi } %{mcall-netbsd: -mno-eabi }}} %{msdata: -msdata=default} %{mno-sdata: -msdata=none} %{profile: -p} + +*cc1_options: +%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} -auxbase%{c|S:%{o*:-strip %*}%{!o*: %b}}%{!c:%{!S: %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{msoft-float:%{mhard-float: %e-msoft-float and -mhard_float may not be used together}} %{!mhard-float:%{!msoft-float:-msoft-float}} + +*cc1plus: + + +*link_gcc_c_sequence: +%{static:--start-group} %G %L %{static:--end-group}%{!static:%G} + +*endfile: +%{mads: crtsavres.o%s %(endfile_ads)} %{myellowknife: crtsavres.o%s %(endfile_yellowknife)} %{mmvme: crtsavres.o%s %(endfile_mvme)} %{msim: crtsavres.o%s %(endfile_sim)} %{mwindiss: %(endfile_windiss)} %{mcall-freebsd: crtsavres.o%s %(endfile_freebsd) } %{mcall-linux: crtsavres.o%s %(endfile_linux) } %{mcall-gnu: crtsavres.o%s %(endfile_gnu) } %{mcall-netbsd: crtsavres.o%s %(endfile_netbsd) } %{mvxworks: crtsavres.o%s %(endfile_vxworks) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %{!mvxworks: %(crtsavres_default) %(endfile_default) }}}}}}}}}} + +*link: +%{!static:--eh-frame-hdr} %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} %{YP,*} %{R*} %{Qy:} %{!Qn:-Qy} %(link_shlib) %{!Wl,-T*: %{!T*: %(link_start) }} %(link_target) %(link_os) + +*lib: +%{mads: %(lib_ads) } %{myellowknife: %(lib_yellowknife) } %{mmvme: %(lib_mvme) } %{msim: %(lib_sim) } %{mwindiss: %(lib_windiss) } %{mcall-freebsd: %(lib_freebsd) } %{mcall-linux: %(lib_linux) } %{mcall-gnu: %(lib_gnu) } %{mcall-netbsd: %(lib_netbsd) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %(lib_default) }}}}}}}}} + +*libgcc: +%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}}}} + +*startfile: +%{mads: %(startfile_ads) } %{myellowknife: %(startfile_yellowknife) } %{mmvme: %(startfile_mvme) } %{msim: %(startfile_sim) } %{mwindiss: %(startfile_windiss) } %{mcall-freebsd: %(startfile_freebsd) } %{mcall-linux: %(startfile_linux) } %{mcall-gnu: %(startfile_gnu) } %{mcall-netbsd: %(startfile_netbsd) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %(startfile_default) }}}}}}}}} + +*switches_need_spaces: + + +*predefines: + + +*cross_compile: +1 + +*version: +3.3.3 + +*multilib: +. mhard-float;nof !mhard-float; + +*multilib_defaults: +mbig mcall-sysv + +*multilib_extra: +fPIC mstrict-align + +*multilib_matches: +mcpu=401 msoft-float;mcpu=403 msoft-float;mcpu=405 msoft-float;mcpu=ec603e msoft-float;mcpu=801 msoft-float;mcpu=821 msoft-float;mcpu=823 msoft-float;mcpu=860 msoft-float;msoft-float msoft-float; + +*multilib_exclusions: + + +*multilib_options: +msoft-float + +*linker: +collect2 + +*link_libgcc: +%D + +*md_exec_prefix: + + +*md_startfile_prefix: + + +*md_startfile_prefix_1: + + +*startfile_prefix_spec: + + +*cpp_default: + + +*asm_cpu: +%{!mcpu*: %{mpower: %{!mpower2: -mpwr}} %{mpower2: -mpwrx} %{mpowerpc*: -mppc} %{mno-power: %{!mpowerpc*: -mcom}} %{!mno-power: %{!mpower2: %(asm_default)}}} %{mcpu=common: -mcom} %{mcpu=power: -mpwr} %{mcpu=power2: -mpwrx} %{mcpu=power3: -m604} %{mcpu=power4: -mpower4} %{mcpu=powerpc: -mppc} %{mcpu=rios: -mpwr} %{mcpu=rios1: -mpwr} %{mcpu=rios2: -mpwrx} %{mcpu=rsc: -mpwr} %{mcpu=rsc1: -mpwr} %{mcpu=401: -mppc} %{mcpu=403: -m403} %{mcpu=405: -m405} %{mcpu=505: -mppc} %{mcpu=601: -m601} %{mcpu=602: -mppc} %{mcpu=603: -mppc} %{mcpu=603e: -mppc} %{mcpu=ec603e: -mppc} %{mcpu=604: -mppc} %{mcpu=604e: -mppc} %{mcpu=620: -mppc} %{mcpu=630: -m604} %{mcpu=740: -mppc} %{mcpu=7400: -mppc} %{mcpu=7450: -mppc} %{mcpu=750: -mppc} %{mcpu=801: -mppc} %{mcpu=821: -mppc} %{mcpu=823: -mppc} %{mcpu=860: -mppc} %{mcpu=8540: -me500} %{maltivec: -maltivec} + +*asm_default: +-mppc + +*cpp_sysv: +%{mrelocatable*: -D_RELOCATABLE} %{fpic: -D__PIC__=1 -D__pic__=1} %{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}} + +*crtsavres_default: +crtsavres.o%s + +*lib_ads: +--start-group -lads -lc --end-group + +*lib_yellowknife: +--start-group -lyk -lc --end-group + +*lib_mvme: +--start-group -lmvme -lc --end-group + +*lib_sim: +--start-group -lsim -lc --end-group + +*lib_freebsd: + %{!shared: %{!pg: %{!pthread:-lc} %{pthread:-lc_r}} %{pg: %{!pthread:-lc_p} %{pthread:-lc_r_p}} } + +*lib_gnu: +%{mnewlib: --start-group -lgnu -lc --end-group } %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } %{profile:-lc_p} %{!profile:-lc}}} + +*lib_linux: +%{mnewlib: --start-group -llinux -lc --end-group } %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } %{profile:-lc_p} %{!profile:-lc}}} + +*lib_netbsd: +%{profile:-lgmon -lc_p} %{!profile:-lc} + +*lib_vxworks: + + +*lib_windiss: +--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group + +*lib_default: +%(lib_linux) + +*startfile_ads: +ecrti.o%s crt0.o%s crtbegin.o%s + +*startfile_yellowknife: +ecrti.o%s crt0.o%s crtbegin.o%s + +*startfile_mvme: +ecrti.o%s crt0.o%s crtbegin.o%s + +*startfile_sim: +ecrti.o%s sim-crt0.o%s crtbegin.o%s + +*startfile_freebsd: +%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s} + +*startfile_gnu: +%{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s} + +*startfile_linux: +%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} %{static:crtbeginT.o%s} %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}} + +*startfile_netbsd: +ncrti.o%s crt0.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s} + +*startfile_vxworks: + + +*startfile_windiss: +crt0.o%s crtbegin.o%s + +*startfile_default: +%(startfile_linux) + +*endfile_ads: +crtend.o%s ecrtn.o%s + +*endfile_yellowknife: +crtend.o%s ecrtn.o%s + +*endfile_mvme: +crtend.o%s ecrtn.o%s + +*endfile_sim: +crtend.o%s ecrtn.o%s + +*endfile_freebsd: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s + +*endfile_gnu: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s} + +*endfile_linux: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s} + +*endfile_netbsd: +%{!shared:crtend.o%s} %{shared:crtendS.o%s} ncrtn.o%s + +*endfile_vxworks: + + +*endfile_windiss: +crtend.o%s + +*endfile_default: +%(endfile_linux) + +*link_path: + + +*link_shlib: +%{shared:-shared} %{!shared: %{static:-static}} + +*link_target: +%{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-i960-old: --oformat elf32-powerpcle} }}}} + +*link_start: +%{mads: %(link_start_ads) } %{myellowknife: %(link_start_yellowknife) } %{mmvme: %(link_start_mvme) } %{msim: %(link_start_sim) } %{mwindiss: %(link_start_windiss) } %{mcall-freebsd: %(link_start_freebsd) } %{mcall-linux: %(link_start_linux) } %{mcall-gnu: %(link_start_gnu) } %{mcall-netbsd: %(link_start_netbsd) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %{!mcall-freebsd: %(link_start_default) }}}}}}}}} + +*link_start_ads: +-T ads.ld%s + +*link_start_yellowknife: +-T yellowknife.ld%s + +*link_start_mvme: +-Ttext 0x40000 + +*link_start_sim: + + +*link_start_freebsd: + + +*link_start_gnu: + + +*link_start_linux: + + +*link_start_netbsd: + + +*link_start_vxworks: + + +*link_start_windiss: + + +*link_start_default: +%(link_start_linux) + +*link_os: +%{mads: %(link_os_ads) } %{myellowknife: %(link_os_yellowknife) } %{mmvme: %(link_os_mvme) } %{msim: %(link_os_sim) } %{mwindiss: %(link_os_windiss) } %{mcall-freebsd: %(link_os_freebsd) } %{mcall-linux: %(link_os_linux) } %{mcall-gnu: %(link_os_gnu) } %{mcall-netbsd: %(link_os_netbsd) } %{mcall-uclibc: %(link_os_linux_uclibc) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %{!mcall-uclibc: %(link_os_default) }}}}}}}}}} + +*link_os_ads: + + +*link_os_yellowknife: + + +*link_os_mvme: + + +*link_os_sim: +-m elf32ppcsim + +*link_os_freebsd: + %{p:%e`-p' not supported; use `-pg' and gprof(1)} %{Wl,*:%*} %{v:-V} %{assert*} %{R*} %{rpath*} %{defsym*} %{shared:-Bshareable %{h*} %{soname*}} %{!shared: %{!static: %{rdynamic: -export-dynamic} %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} %{static:-Bstatic}} %{symbolic:-Bsymbolic} + +*link_os_linux: +-m elf32ppclinux %{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}} + +*link_os_gnu: +-m elf32ppclinux %{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}} + +*link_os_netbsd: +%{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}} + +*link_os_vxworks: +-r + +*link_os_windiss: + + +*link_os_linux_uclibc: +-m elf32ppclinux %{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} + +*link_os_default: +%(link_os_linux_uclibc) + +*cc1_endian_big: + + +*cc1_endian_little: +%{!mstrict-align: %{!mno-strict-align: %{!mcall-i960-old: -mstrict-align } }} + +*cc1_endian_default: +%(cc1_endian_big) + +*cpp_os_ads: + + +*cpp_os_yellowknife: + + +*cpp_os_mvme: + + +*cpp_os_sim: + + +*cpp_os_freebsd: + -D__ELF__ -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ -Acpu=powerpc -Amachine=powerpc + +*cpp_os_gnu: +-D__unix__ -D__gnu_hurd__ -D__GNU__ %{!undef: %{!ansi: -Dunix -D__unix}} -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT} + +*cpp_os_linux: +-D__unix__ -D__gnu_linux__ -D__linux__ %{!undef: %{!ansi: %{!std=*:-Dunix -D__unix -Dlinux -D__linux} %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT} + +*cpp_os_netbsd: +-D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ + +*cpp_os_rtems: +%{!mcpu*: %{!Dppc*: %{!Dmpc*: -Dmpc750} } }%{mcpu=403: %{!Dppc*: %{!Dmpc*: -Dppc403} } } %{mcpu=505: %{!Dppc*: %{!Dmpc*: -Dmpc505} } } %{mcpu=601: %{!Dppc*: %{!Dmpc*: -Dppc601} } } %{mcpu=602: %{!Dppc*: %{!Dmpc*: -Dppc602} } } %{mcpu=603: %{!Dppc*: %{!Dmpc*: -Dppc603} } } %{mcpu=603e: %{!Dppc*: %{!Dmpc*: -Dppc603e} } } %{mcpu=604: %{!Dppc*: %{!Dmpc*: -Dmpc604} } } %{mcpu=750: %{!Dppc*: %{!Dmpc*: -Dmpc750} } } %{mcpu=821: %{!Dppc*: %{!Dmpc*: -Dmpc821} } } %{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } } + +*cpp_os_vxworks: +-DCPU_FAMILY=PPC %{!mcpu*: %{mpowerpc*: -DCPU=PPC603} %{!mno-powerpc: -DCPU=PPC603}} %{mcpu=powerpc: -DCPU=PPC603} %{mcpu=401: -DCPU=PPC403} %{mcpu=403: -DCPU=PPC403} %{mcpu=405: -DCPU=PPC405} %{mcpu=601: -DCPU=PPC601} %{mcpu=602: -DCPU=PPC603} %{mcpu=603: -DCPU=PPC603} %{mcpu=603e: -DCPU=PPC603} %{mcpu=ec603e: -DCPU=PPC603} %{mcpu=604: -DCPU=PPC604} %{mcpu=604e: -DCPU=PPC604} %{mcpu=620: -DCPU=PPC604} %{mcpu=740: -DCPU=PPC603} %{mcpu=7450: -DCPU=PPC603} %{mcpu=750: -DCPU=PPC603} %{mcpu=801: -DCPU=PPC603} %{mcpu=821: -DCPU=PPC603} %{mcpu=823: -DCPU=PPC603} %{mcpu=860: -DCPU=PPC603} + +*cpp_os_windiss: +-D__rtasim -D__EABI__ -D__ppc %{!msoft-float: -D__hardfp} + +*cpp_os_default: +%(cpp_os_linux) + +*link_command: +%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}} + diff --git a/obsolete-buildroot/sources/squashfs.patch b/obsolete-buildroot/sources/squashfs.patch new file mode 100644 index 0000000000..ea75a7f18a --- /dev/null +++ b/obsolete-buildroot/sources/squashfs.patch @@ -0,0 +1,36 @@ +This is a stupid little patch adding an option to change all uid/gid to +root/root in the generated filesystem. We really need to teach mksquashfs +about device tables though... + +--- squashfs1.3r3/squashfs-tools/mksquashfs.c-dist 2004-03-29 20:35:37.000000000 -0600 ++++ squashfs1.3r3/squashfs-tools/mksquashfs.c 2004-03-29 22:28:51.000000000 -0600 +@@ -136,6 +136,8 @@ + stotal_bytes, stotal_inode_bytes, stotal_directory_bytes, sinode_count, sfile_count, ssym_count, sdev_count, sdir_count, sdup_files; + int restore = 0; + ++unsigned int root_owned = 0; ++ + /*flag whether destination file is a block device */ + int block_device = 0; + +@@ -421,6 +423,11 @@ + return SQUASHFS_INVALID; + } + ++ if (root_owned) { ++ buf.st_uid = 0; ++ buf.st_gid = 0; ++ } ++ + base->mode = SQUASHFS_MODE(buf.st_mode); + base->uid = get_uid(&file_type, (squashfs_uid) buf.st_uid); + base->inode_type = file_type; +@@ -1268,6 +1275,8 @@ + root_name = argv[i]; + } else if(strcmp(argv[i], "-version") == 0) { + VERSION(); ++ } else if (strcmp(argv[i], "-root-owned") == 0) { ++ root_owned = TRUE; + } else { + ERROR("%s: invalid option\n\n", argv[0]); + printOptions: diff --git a/obsolete-buildroot/sources/target_skeleton/etc/TZ b/obsolete-buildroot/sources/target_skeleton/etc/TZ new file mode 100644 index 0000000000..9fcb2a3c56 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/TZ @@ -0,0 +1 @@ +MST7MDT diff --git a/obsolete-buildroot/sources/target_skeleton/etc/fstab b/obsolete-buildroot/sources/target_skeleton/etc/fstab new file mode 100644 index 0000000000..6d33629a7b --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/fstab @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information. +# +# +/dev/root / ext2 rw,noauto 0 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 +tmpfs /tmp tmpfs defaults 0 0 + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/group b/obsolete-buildroot/sources/target_skeleton/etc/group new file mode 100644 index 0000000000..a21ef0f769 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/group @@ -0,0 +1,10 @@ +root:x:0: +daemon:x:1: +bin:x:2: +sys:x:3: +adm:x:4: +tty:x:5: +disk:x:6: +utmp:x:43: +staff:x:50: +default:x:1000: diff --git a/obsolete-buildroot/sources/target_skeleton/etc/hostname b/obsolete-buildroot/sources/target_skeleton/etc/hostname new file mode 100644 index 0000000000..52e67d68aa --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/hostname @@ -0,0 +1 @@ +uclibc diff --git a/obsolete-buildroot/sources/target_skeleton/etc/hosts b/obsolete-buildroot/sources/target_skeleton/etc/hosts new file mode 100644 index 0000000000..ba712fe033 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/hosts @@ -0,0 +1 @@ +127.0.0.1 localhost diff --git a/obsolete-buildroot/sources/target_skeleton/etc/init.d/S20urandom b/obsolete-buildroot/sources/target_skeleton/etc/init.d/S20urandom new file mode 100755 index 0000000000..433fafee4e --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/init.d/S20urandom @@ -0,0 +1,44 @@ +#! /bin/sh +# +# urandom This script saves the random seed between reboots. +# It is called from the boot, halt and reboot scripts. +# +# Version: @(#)urandom 1.33 22-Jun-1998 miquels@cistron.nl +# + +[ -c /dev/urandom ] || exit 0 +#. /etc/default/rcS + +case "$1" in + start|"") + if [ "$VERBOSE" != no ] + then + echo -n "Initializing random number generator... " + fi + # Load and then save 512 bytes, + # which is the size of the entropy pool + if [ -f /etc/random-seed ] + then + cat /etc/random-seed >/dev/urandom + fi + rm -f /etc/random-seed + umask 077 + dd if=/dev/urandom of=/etc/random-seed count=1 \ + >/dev/null 2>&1 || echo "urandom start: failed." + umask 022 + [ "$VERBOSE" != no ] && echo "done." + ;; + stop) + # Carry a random seed from shut-down to start-up; + # see documentation in linux/drivers/char/random.c + [ "$VERBOSE" != no ] && echo -n "Saving random seed... " + umask 077 + dd if=/dev/urandom of=/etc/random-seed count=1 \ + >/dev/null 2>&1 || echo "urandom stop: failed." + [ "$VERBOSE" != no ] && echo "done." + ;; + *) + echo "Usage: urandom {start|stop}" >&2 + exit 1 + ;; +esac diff --git a/obsolete-buildroot/sources/target_skeleton/etc/init.d/S40network b/obsolete-buildroot/sources/target_skeleton/etc/init.d/S40network new file mode 100755 index 0000000000..d835d9c72a --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/init.d/S40network @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Start the network.... +# + +start() { + echo "Starting network..." + /sbin/ifup -a +} +stop() { + echo -n "Stopping network..." + /sbin/ifdown -a +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/init.d/rcS b/obsolete-buildroot/sources/target_skeleton/etc/init.d/rcS new file mode 100755 index 0000000000..de411534da --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/init.d/rcS @@ -0,0 +1,27 @@ +#!/bin/sh + + +# Start all init scripts in /etc/init.d +# executing them in numerical order. +# +for i in /etc/init.d/S??* ;do + + # Ignore dangling symlinks (if any). + [ ! -f "$i" ] && continue + + case "$i" in + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + set start + . $i + ) + ;; + *) + # No sh extension, so fork subprocess. + $i start + ;; + esac +done + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/inittab b/obsolete-buildroot/sources/target_skeleton/etc/inittab new file mode 100644 index 0000000000..a6c014e751 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/inittab @@ -0,0 +1,47 @@ +# /etc/inittab +# +# Copyright (C) 2001 Erik Andersen +# +# Note: BusyBox init doesn't support runlevels. The runlevels field is +# completely ignored by BusyBox init. If you want runlevels, use +# sysvinit. +# +# Format for each entry: ::: +# +# id == tty to run on, or empty for /dev/console +# runlevels == ignored +# action == one of sysinit, respawn, askfirst, wait, and once +# process == program to run + +# Startup the system +null::sysinit:/bin/mount -o remount,rw / +null::sysinit:/bin/mount -t proc proc /proc +null::sysinit:/bin/mount -a +null::sysinit:/bin/hostname -F /etc/hostname +null::sysinit:/sbin/ifconfig lo 127.0.0.1 up +null::sysinit:/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo +# now run any rc scripts +::sysinit:/etc/init.d/rcS + +# Set up a couple of getty's +tty1::respawn:/sbin/getty 38400 tty1 +tty2::respawn:/sbin/getty 38400 tty2 + +# Put a getty on the serial port +#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 + +# Logging junk +null::sysinit:/bin/touch /var/log/messages +null::respawn:/sbin/syslogd -n -m 0 +null::respawn:/sbin/klogd -n +tty3::respawn:/usr/bin/tail -f /var/log/messages + +# Stuff to do for the 3-finger salute +::ctrlaltdel:/sbin/reboot + +# Stuff to do before rebooting +null::shutdown:/usr/bin/killall klogd +null::shutdown:/usr/bin/killall syslogd +null::shutdown:/bin/umount -a -r +null::shutdown:/sbin/swapoff -a + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/inputrc b/obsolete-buildroot/sources/target_skeleton/etc/inputrc new file mode 100644 index 0000000000..2f1cb601a5 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/inputrc @@ -0,0 +1,44 @@ +# /etc/inputrc - global inputrc for libreadline +# See readline(3readline) and `info readline' for more information. + +# Be 8 bit clean. +set input-meta on +set output-meta on +set bell-style visible + +# To allow the use of 8bit-characters like the german umlauts, comment out +# the line below. However this makes the meta key not work as a meta key, +# which is annoying to those which don't need to type in 8-bit characters. + +# set convert-meta off + +"\e0d": backward-word +"\e0c": forward-word +"\e[h": beginning-of-line +"\e[f": end-of-line +"\e[1~": beginning-of-line +"\e[4~": end-of-line +#"\e[5~": beginning-of-history +#"\e[6~": end-of-history +"\e[3~": delete-char +"\e[2~": quoted-insert + +# Common standard keypad and cursor +# (codes courtsey Werner Fink, ) +#"\e[1~": history-search-backward +"\e[2~": yank +"\e[3~": delete-char +#"\e[4~": set-mark +"\e[5~": history-search-backward +"\e[6~": history-search-forward +# Normal keypad and cursor of xterm +"\e[F": end-of-line +"\e[H": beginning-of-line +# Application keypad and cursor of xterm +"\eOA": previous-history +"\eOC": forward-char +"\eOB": next-history +"\eOD": backward-char +"\eOF": end-of-line +"\eOH": beginning-of-line + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/issue b/obsolete-buildroot/sources/target_skeleton/etc/issue new file mode 100644 index 0000000000..f24b862c97 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/issue @@ -0,0 +1,4 @@ + + +Welcome to the Erik's uClibc development environment. + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/network/interfaces b/obsolete-buildroot/sources/target_skeleton/etc/network/interfaces new file mode 100644 index 0000000000..218b82cde5 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/network/interfaces @@ -0,0 +1,4 @@ +# Configure Loopback +auto lo +iface lo inet loopback + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/passwd b/obsolete-buildroot/sources/target_skeleton/etc/passwd new file mode 100644 index 0000000000..e0f473fc7b --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/passwd @@ -0,0 +1,13 @@ +root:x:0:0:root:/root:/bin/sh +daemon:x:1:1:daemon:/usr/sbin:/bin/sh +bin:x:2:2:bin:/bin:/bin/sh +sys:x:3:3:sys:/dev:/bin/sh +sync:x:4:100:sync:/bin:/bin/sync +mail:x:8:8:mail:/var/spool/mail:/bin/sh +proxy:x:13:13:proxy:/bin:/bin/sh +www-data:x:33:33:www-data:/var/www:/bin/sh +backup:x:34:34:backup:/var/backups:/bin/sh +operator:x:37:37:Operator:/var:/bin/sh +sshd:x:103:99:Operator:/var:/bin/sh +nobody:x:99:99:nobody:/home:/bin/sh +default:x:1000:1000:Default non-root user:/home/default:/bin/sh diff --git a/obsolete-buildroot/sources/target_skeleton/etc/profile b/obsolete-buildroot/sources/target_skeleton/etc/profile new file mode 100644 index 0000000000..cc2e0beb87 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/profile @@ -0,0 +1,48 @@ +# ~/.bashrc: executed by bash(1) for non-login interactive shells. + +export PATH=\ +/bin:\ +/sbin:\ +/usr/bin:\ +/usr/sbin:\ +/usr/bin/X11:\ +/usr/local/bin + +# If running interactively, then: +if [ "$PS1" ]; then + + if [ "$BASH" ]; then + export PS1="[\u@\h \W]\\$ " + alias ll='/bin/ls --color=tty -laFh' + alias ls='/bin/ls --color=tty -F' + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:'; + else + if [ "`id -u`" -eq 0 ]; then + export PS1='# ' + else + export PS1='$ ' + fi + fi + + export USER=`id -un` + export LOGNAME=$USER + export HOSTNAME=`/bin/hostname` + export HISTSIZE=1000 + export HISTFILESIZE=1000 + export PAGER='/bin/more ' + export EDITOR='/bin/vi' + export INPUTRC=/etc/inputrc + export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile + + ### Some aliases + alias ps2='ps facux ' + alias ps1='ps faxo "%U %t %p %a" ' + alias af='ps af' + alias cls='clear' + alias df='df -h' + alias indent='indent -bad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -npsl -nsc -nsob -nss -ts4 ' + #alias bc='bc -l' + alias minicom='minicom -c on' + alias calc='calc -Cd ' + alias bc='calc -Cd ' +fi; diff --git a/obsolete-buildroot/sources/target_skeleton/etc/protocols b/obsolete-buildroot/sources/target_skeleton/etc/protocols new file mode 100644 index 0000000000..98f9f2d30e --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/protocols @@ -0,0 +1,31 @@ +# /etc/protocols: +# $Id$ +# +# Internet (IP) protocols +# +# from: @(#)protocols 5.1 (Berkeley) 4/17/89 +# +# Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992). + +ip 0 IP # internet protocol, pseudo protocol number +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # Internet Group Management +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st 5 ST # ST datagram mode +tcp 6 TCP # transmission control protocol +egp 8 EGP # exterior gateway protocol +pup 12 PUP # PARC universal packet protocol +udp 17 UDP # user datagram protocol +hmp 20 HMP # host monitoring protocol +xns-idp 22 XNS-IDP # Xerox NS IDP +rdp 27 RDP # "reliable datagram" protocol +iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4 +xtp 36 XTP # Xpress Tranfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 39 IDPR-CMTP # IDPR Control Message Transport +rspf 73 RSPF #Radio Shortest Path First. +vmtp 81 VMTP # Versatile Message Transport +ospf 89 OSPFIGP # Open Shortest Path First IGP +ipip 94 IPIP # Yet Another IP encapsulation +encap 98 ENCAP # Yet Another IP encapsulation diff --git a/obsolete-buildroot/sources/target_skeleton/etc/random-seed b/obsolete-buildroot/sources/target_skeleton/etc/random-seed new file mode 100644 index 0000000000..fbc7352fbb Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/etc/random-seed differ diff --git a/obsolete-buildroot/sources/target_skeleton/etc/resolv.conf b/obsolete-buildroot/sources/target_skeleton/etc/resolv.conf new file mode 100644 index 0000000000..71a86dd76c --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/resolv.conf @@ -0,0 +1,2 @@ +domain dev.null +nameserver 127.0.0.1 diff --git a/obsolete-buildroot/sources/target_skeleton/etc/securetty b/obsolete-buildroot/sources/target_skeleton/etc/securetty new file mode 100644 index 0000000000..81616f38ea --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/securetty @@ -0,0 +1,12 @@ +tty1 +tty2 +tty3 +tty4 +tty5 +tty6 +tty7 +tty8 +ttyS0 +ttyS1 +ttyS2 +ttyS3 diff --git a/obsolete-buildroot/sources/target_skeleton/etc/services b/obsolete-buildroot/sources/target_skeleton/etc/services new file mode 100644 index 0000000000..13718ef3de --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/services @@ -0,0 +1,302 @@ +# /etc/services: +# $Id$ +# +# Network services, Internet style +# +# Note that it is presently the policy of IANA to assign a single well-known +# port number for both TCP and UDP; hence, most entries here have two entries +# even if the protocol doesn't support UDP operations. +# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports +# are included, only the more common ones. + +tcpmux 1/tcp # TCP port service multiplexer +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +daytime 13/tcp +daytime 13/udp +netstat 15/tcp +qotd 17/tcp quote +msp 18/tcp # message send protocol +msp 18/udp # message send protocol +chargen 19/tcp ttytst source +chargen 19/udp ttytst source +ftp-data 20/tcp +ftp 21/tcp +fsp 21/udp fspd +ssh 22/tcp # SSH Remote Login Protocol +ssh 22/udp # SSH Remote Login Protocol +telnet 23/tcp +# 24 - private +smtp 25/tcp mail +# 26 - unassigned +time 37/tcp timserver +time 37/udp timserver +rlp 39/udp resource # resource location +nameserver 42/tcp name # IEN 116 +whois 43/tcp nicname +re-mail-ck 50/tcp # Remote Mail Checking Protocol +re-mail-ck 50/udp # Remote Mail Checking Protocol +domain 53/tcp nameserver # name-domain server +domain 53/udp nameserver +mtp 57/tcp # deprecated +bootps 67/tcp # BOOTP server +bootps 67/udp +bootpc 68/tcp # BOOTP client +bootpc 68/udp +tftp 69/udp +gopher 70/tcp # Internet Gopher +gopher 70/udp +rje 77/tcp netrjs +finger 79/tcp +www 80/tcp http # WorldWideWeb HTTP +www 80/udp # HyperText Transfer Protocol +link 87/tcp ttylink +kerberos 88/tcp kerberos5 krb5 # Kerberos v5 +kerberos 88/udp kerberos5 krb5 # Kerberos v5 +supdup 95/tcp +# 100 - reserved +hostnames 101/tcp hostname # usually from sri-nic +iso-tsap 102/tcp tsap # part of ISODE. +csnet-ns 105/tcp cso-ns # also used by CSO name server +csnet-ns 105/udp cso-ns +# unfortunately the poppassd (Eudora) uses a port which has already +# been assigned to a different service. We list the poppassd as an +# alias here. This should work for programs asking for this service. +# (due to a bug in inetd the 3com-tsmux line is disabled) +#3com-tsmux 106/tcp poppassd +#3com-tsmux 106/udp poppassd +rtelnet 107/tcp # Remote Telnet +rtelnet 107/udp +pop-2 109/tcp postoffice # POP version 2 +pop-2 109/udp +pop-3 110/tcp # POP version 3 +pop-3 110/udp +sunrpc 111/tcp portmapper # RPC 4.0 portmapper TCP +sunrpc 111/udp portmapper # RPC 4.0 portmapper UDP +auth 113/tcp authentication tap ident +sftp 115/tcp +uucp-path 117/tcp +nntp 119/tcp readnews untp # USENET News Transfer Protocol +ntp 123/tcp +ntp 123/udp # Network Time Protocol +netbios-ns 137/tcp # NETBIOS Name Service +netbios-ns 137/udp +netbios-dgm 138/tcp # NETBIOS Datagram Service +netbios-dgm 138/udp +netbios-ssn 139/tcp # NETBIOS session service +netbios-ssn 139/udp +imap2 143/tcp # Interim Mail Access Proto v2 +imap2 143/udp +snmp 161/udp # Simple Net Mgmt Proto +snmp-trap 162/udp snmptrap # Traps for SNMP +cmip-man 163/tcp # ISO mgmt over IP (CMOT) +cmip-man 163/udp +cmip-agent 164/tcp +cmip-agent 164/udp +xdmcp 177/tcp # X Display Mgr. Control Proto +xdmcp 177/udp +nextstep 178/tcp NeXTStep NextStep # NeXTStep window +nextstep 178/udp NeXTStep NextStep # server +bgp 179/tcp # Border Gateway Proto. +bgp 179/udp +prospero 191/tcp # Cliff Neuman's Prospero +prospero 191/udp +irc 194/tcp # Internet Relay Chat +irc 194/udp +smux 199/tcp # SNMP Unix Multiplexer +smux 199/udp +at-rtmp 201/tcp # AppleTalk routing +at-rtmp 201/udp +at-nbp 202/tcp # AppleTalk name binding +at-nbp 202/udp +at-echo 204/tcp # AppleTalk echo +at-echo 204/udp +at-zis 206/tcp # AppleTalk zone information +at-zis 206/udp +qmtp 209/tcp # The Quick Mail Transfer Protocol +qmtp 209/udp # The Quick Mail Transfer Protocol +z3950 210/tcp wais # NISO Z39.50 database +z3950 210/udp wais +ipx 213/tcp # IPX +ipx 213/udp +imap3 220/tcp # Interactive Mail Access +imap3 220/udp # Protocol v3 +ulistserv 372/tcp # UNIX Listserv +ulistserv 372/udp +https 443/tcp # MCom +https 443/udp # MCom +snpp 444/tcp # Simple Network Paging Protocol +snpp 444/udp # Simple Network Paging Protocol +saft 487/tcp # Simple Asynchronous File Transfer +saft 487/udp # Simple Asynchronous File Transfer +npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS +npmp-local 610/udp dqs313_qmaster # npmp-local / DQS +npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS +npmp-gui 611/udp dqs313_execd # npmp-gui / DQS +hmmp-ind 612/tcp dqs313_intercell# HMMP Indication / DQS +hmmp-ind 612/udp dqs313_intercell# HMMP Indication / DQS +# +# UNIX specific services +# +exec 512/tcp +biff 512/udp comsat +login 513/tcp +who 513/udp whod +shell 514/tcp cmd # no passwords used +syslog 514/udp +printer 515/tcp spooler # line printer spooler +talk 517/udp +ntalk 518/udp +route 520/udp router routed # RIP +timed 525/udp timeserver +tempo 526/tcp newdate +courier 530/tcp rpc +conference 531/tcp chat +netnews 532/tcp readnews +netwall 533/udp # -for emergency broadcasts +uucp 540/tcp uucpd # uucp daemon +afpovertcp 548/tcp # AFP over TCP +afpovertcp 548/udp # AFP over TCP +remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem +klogin 543/tcp # Kerberized `rlogin' (v5) +kshell 544/tcp krcmd # Kerberized `rsh' (v5) +kerberos-adm 749/tcp # Kerberos `kadmin' (v5) +# +webster 765/tcp # Network dictionary +webster 765/udp +# +# From ``Assigned Numbers'': +# +#> The Registered Ports are not controlled by the IANA and on most systems +#> can be used by ordinary user processes or programs executed by ordinary +#> users. +# +#> Ports are used in the TCP [45,106] to name the ends of logical +#> connections which carry long term conversations. For the purpose of +#> providing services to unknown callers, a service contact port is +#> defined. This list specifies the port used by the server process as its +#> contact port. While the IANA can not control uses of these ports it +#> does register or list uses of these ports as a convienence to the +#> community. +# +nfsdstatus 1110/tcp +nfsd-keepalive 1110/udp + +ingreslock 1524/tcp +ingreslock 1524/udp +prospero-np 1525/tcp # Prospero non-privileged +prospero-np 1525/udp +datametrics 1645/tcp old-radius # datametrics / old radius entry +datametrics 1645/udp old-radius # datametrics / old radius entry +sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry +sa-msg-port 1646/udp old-radacct # sa-msg-port / old radacct entry +radius 1812/tcp # Radius +radius 1812/udp # Radius +radacct 1813/tcp # Radius Accounting +radacct 1813/udp # Radius Accounting +nfsd 2049/tcp nfs +nfsd 2049/udp nfs +cvspserver 2401/tcp # CVS client/server operations +cvspserver 2401/udp # CVS client/server operations +mysql 3306/tcp # MySQL +mysql 3306/udp # MySQL +rfe 5002/tcp # Radio Free Ethernet +rfe 5002/udp # Actually uses UDP only +cfengine 5308/tcp # CFengine +cfengine 5308/udp # CFengine +bbs 7000/tcp # BBS service +# +# +# Kerberos (Project Athena/MIT) services +# Note that these are for Kerberos v4, and are unofficial. Sites running +# v4 should uncomment these and comment out the v5 entries above. +# +kerberos4 750/udp kerberos-iv kdc # Kerberos (server) udp +kerberos4 750/tcp kerberos-iv kdc # Kerberos (server) tcp +kerberos_master 751/udp # Kerberos authentication +kerberos_master 751/tcp # Kerberos authentication +passwd_server 752/udp # Kerberos passwd server +krb_prop 754/tcp # Kerberos slave propagation +krbupdate 760/tcp kreg # Kerberos registration +kpasswd 761/tcp kpwd # Kerberos "passwd" +kpop 1109/tcp # Pop with Kerberos +knetd 2053/tcp # Kerberos de-multiplexor +zephyr-srv 2102/udp # Zephyr server +zephyr-clt 2103/udp # Zephyr serv-hm connection +zephyr-hm 2104/udp # Zephyr hostmanager +eklogin 2105/tcp # Kerberos encrypted rlogin +# +# Unofficial but necessary (for NetBSD) services +# +supfilesrv 871/tcp # SUP server +supfiledbg 1127/tcp # SUP debugging +# +# Datagram Delivery Protocol services +# +rtmp 1/ddp # Routing Table Maintenance Protocol +nbp 2/ddp # Name Binding Protocol +echo 4/ddp # AppleTalk Echo Protocol +zip 6/ddp # Zone Information Protocol +# +# Services added for the Debian GNU/Linux distribution +poppassd 106/tcp # Eudora +poppassd 106/udp # Eudora +mailq 174/tcp # Mailer transport queue for Zmailer +mailq 174/tcp # Mailer transport queue for Zmailer +omirr 808/tcp omirrd # online mirror +omirr 808/udp omirrd # online mirror +rmtcfg 1236/tcp # Gracilis Packeten remote config server +xtel 1313/tcp # french minitel +coda_opcons 1355/udp # Coda opcons (Coda fs) +coda_venus 1363/udp # Coda venus (Coda fs) +coda_auth 1357/udp # Coda auth (Coda fs) +coda_udpsrv 1359/udp # Coda udpsrv (Coda fs) +coda_filesrv 1361/udp # Coda filesrv (Coda fs) +codacon 1423/tcp venus.cmu # Coda Console (Coda fs) +coda_aux1 1431/tcp # coda auxiliary service (Coda fs) +coda_aux1 1431/udp # coda auxiliary service (Coda fs) +coda_aux2 1433/tcp # coda auxiliary service (Coda fs) +coda_aux2 1433/udp # coda auxiliary service (Coda fs) +coda_aux3 1435/tcp # coda auxiliary service (Coda fs) +coda_aux3 1435/udp # coda auxiliary service (Coda fs) +cfinger 2003/tcp # GNU Finger +afbackup 2988/tcp # Afbackup system +afbackup 2988/udp # Afbackup system +icp 3130/tcp # Internet Cache Protocol (Squid) +icp 3130/udp # Internet Cache Protocol (Squid) +postgres 5432/tcp # POSTGRES +postgres 5432/udp # POSTGRES +fax 4557/tcp # FAX transmission service (old) +hylafax 4559/tcp # HylaFAX client-server protocol (new) +noclog 5354/tcp # noclogd with TCP (nocol) +noclog 5354/udp # noclogd with UDP (nocol) +hostmon 5355/tcp # hostmon uses TCP (nocol) +hostmon 5355/udp # hostmon uses TCP (nocol) +ircd 6667/tcp # Internet Relay Chat +ircd 6667/udp # Internet Relay Chat +webcache 8080/tcp # WWW caching service +webcache 8080/udp # WWW caching service +tproxy 8081/tcp # Transparent Proxy +tproxy 8081/udp # Transparent Proxy +mandelspawn 9359/udp mandelbrot # network mandelbrot +amanda 10080/udp # amanda backup services +amandaidx 10082/tcp # amanda backup services +amidxtape 10083/tcp # amanda backup services +isdnlog 20011/tcp # isdn logging system +isdnlog 20011/udp # isdn logging system +vboxd 20012/tcp # voice box system +vboxd 20012/udp # voice box system +binkp 24554/tcp # Binkley +binkp 24554/udp # Binkley +asp 27374/tcp # Address Search Protocol +asp 27374/udp # Address Search Protocol +tfido 60177/tcp # Ifmail +tfido 60177/udp # Ifmail +fido 60179/tcp # Ifmail +fido 60179/udp # Ifmail + +# Local services + diff --git a/obsolete-buildroot/sources/target_skeleton/etc/shadow b/obsolete-buildroot/sources/target_skeleton/etc/shadow new file mode 100644 index 0000000000..4941a1ac53 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/etc/shadow @@ -0,0 +1,12 @@ +root::10933:0:99999:7::: +bin:*:10933:0:99999:7::: +daemon:*:10933:0:99999:7::: +adm:*:10933:0:99999:7::: +lp:*:10933:0:99999:7::: +sync:*:10933:0:99999:7::: +shutdown:*:10933:0:99999:7::: +halt:*:10933:0:99999:7::: +uucp:*:10933:0:99999:7::: +operator:*:10933:0:99999:7::: +nobody:*:10933:0:99999:7::: +default::10933:0:99999:7::: diff --git a/obsolete-buildroot/sources/target_skeleton/root/.bash_history b/obsolete-buildroot/sources/target_skeleton/root/.bash_history new file mode 100644 index 0000000000..e69de29bb2 diff --git a/obsolete-buildroot/sources/target_skeleton/root/.bash_logout b/obsolete-buildroot/sources/target_skeleton/root/.bash_logout new file mode 100644 index 0000000000..77ef1f9508 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/root/.bash_logout @@ -0,0 +1,7 @@ +# ~/.bash_logout: executed by bash(1) when login shell exits. + +# when leaving the console clear the screen to increase privacy + +case "`tty`" in + /dev/tty[0-9]*) clear +esac diff --git a/obsolete-buildroot/sources/target_skeleton/root/.bash_profile b/obsolete-buildroot/sources/target_skeleton/root/.bash_profile new file mode 100644 index 0000000000..27bf14953d --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/root/.bash_profile @@ -0,0 +1,15 @@ +# .bash_profile + +export PATH=\ +/bin:\ +/sbin:\ +/usr/bin:\ +/usr/sbin:\ +/usr/bin/X11:\ +/usr/local/bin + +umask 022 + +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi diff --git a/obsolete-buildroot/sources/target_skeleton/root/.bashrc b/obsolete-buildroot/sources/target_skeleton/root/.bashrc new file mode 100644 index 0000000000..d13c8f9026 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/root/.bashrc @@ -0,0 +1,48 @@ +# ~/.bashrc: executed by bash(1) for non-login interactive shells. + +export PATH=\ +/bin:\ +/sbin:\ +/usr/bin:\ +/usr/sbin:\ +/usr/bin/X11:\ +/usr/local/bin + +# If running interactively, then: +if [ "$PS1" ]; then + + if [ "$BASH" ]; then + export PS1="[\u@\h \W]\\$ " + else + if [ "`id -u`" -eq 0 ]; then + export PS1='# ' + else + export PS1='$ ' + fi + fi + + export USER=`id -un` + export LOGNAME=$USER + export HOSTNAME=`/bin/hostname` + export HISTSIZE=1000 + export HISTFILESIZE=1000 + export PAGER='/bin/more ' + export EDITOR='/bin/vi' + export INPUTRC=/etc/inputrc + export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:'; + + ### Some aliases + alias ps2='ps facux ' + alias ps1='ps faxo "%U %t %p %a" ' + alias af='ps af' + alias cls='clear' + alias ll='/bin/ls --color=tty -laFh' + alias ls='/bin/ls --color=tty -F' + alias df='df -h' + alias indent='indent -bad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -npsl -nsc -nsob -nss -ts4 ' + #alias bc='bc -l' + alias minicom='minicom -c on' + alias calc='calc -Cd ' + alias bc='calc -Cd ' +fi; diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/a/ansi b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/a/ansi new file mode 100644 index 0000000000..d1e14008c5 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/a/ansi differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/d/dumb b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/d/dumb new file mode 100644 index 0000000000..ffdc8acf34 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/d/dumb differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/l/linux b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/l/linux new file mode 100644 index 0000000000..e9ec115d5c Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/l/linux differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/r/rxvt b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/r/rxvt new file mode 100644 index 0000000000..ba6987a1a8 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/r/rxvt differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/screen b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/screen new file mode 100644 index 0000000000..8f4206c81e Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/screen differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/screen-w b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/screen-w new file mode 100644 index 0000000000..965601433d Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/screen-w differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/sun b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/sun new file mode 100644 index 0000000000..47c0d66faa Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/s/sun differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt100 b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt100 new file mode 100644 index 0000000000..5cc9a88bb0 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt100 differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt220 b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt220 new file mode 100644 index 0000000000..cefb7b3587 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt220 differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt52 b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt52 new file mode 100644 index 0000000000..d55932876a Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/v/vt52 differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/x/xterm b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/x/xterm new file mode 100644 index 0000000000..89da67d089 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/x/xterm differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/x/xterm-xfree86 b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/x/xterm-xfree86 new file mode 100644 index 0000000000..eeac9d8d35 Binary files /dev/null and b/obsolete-buildroot/sources/target_skeleton/usr/share/terminfo/x/xterm-xfree86 differ diff --git a/obsolete-buildroot/sources/target_skeleton/usr/share/udhcpc/default.script b/obsolete-buildroot/sources/target_skeleton/usr/share/udhcpc/default.script new file mode 100755 index 0000000000..a52a7f8122 --- /dev/null +++ b/obsolete-buildroot/sources/target_skeleton/usr/share/udhcpc/default.script @@ -0,0 +1,39 @@ +#!/bin/sh + +# udhcpc script edited by Tim Riker + +[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 + +RESOLV_CONF="/etc/resolv.conf" +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" +[ -n "$subnet" ] && NETMASK="netmask $subnet" + +case "$1" in + deconfig) + /sbin/ifconfig $interface 0.0.0.0 + ;; + + renew|bound) + /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + + if [ -n "$router" ] ; then + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface ; do + : + done + + for i in $router ; do + route add default gw $i dev $interface + done + fi + + echo -n > $RESOLV_CONF + [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF + for i in $dns ; do + echo adding dns $i + echo nameserver $i >> $RESOLV_CONF + done + ;; +esac + +exit 0 diff --git a/obsolete-buildroot/sources/tinyx-011010.patch b/obsolete-buildroot/sources/tinyx-011010.patch new file mode 100644 index 0000000000..3040b3dd40 --- /dev/null +++ b/obsolete-buildroot/sources/tinyx-011010.patch @@ -0,0 +1,173 @@ +diff -Nur --exclude=CVS xc-011010.src/include/extensions/lbxstr.h xc-011010/include/extensions/lbxstr.h +--- xc-011010.src/include/extensions/lbxstr.h Tue Jul 31 20:44:35 2001 ++++ xc-011010/include/extensions/lbxstr.h Sun Apr 21 12:35:05 2002 +@@ -25,7 +25,7 @@ + #ifndef _LBXSTR_H_ + #define _LBXSTR_H_ + +-#include ++#include "XLbx.h" + + #define LBXNAME "LBX" + +diff -Nur --exclude=CVS xc-011010.src/programs/Xserver/hw/kdrive/fbdev/fbdev.h xc-011010/programs/Xserver/hw/kdrive/fbdev/fbdev.h +--- xc-011010.src/programs/Xserver/hw/kdrive/fbdev/fbdev.h Sun Jun 3 17:52:45 2001 ++++ xc-011010/programs/Xserver/hw/kdrive/fbdev/fbdev.h Sun Apr 21 12:36:25 2002 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include "kdrive.h" + #include "layer.h" + +diff -Nur xc-011010.src2/lib/X11/Xlib.h xc-011010/lib/X11/Xlib.h +--- xc-011010.src/programs/Xserver/hw/kdrive/linux/ts.c Tue Jul 10 22:58:19 2001 ++++ xc-011010/programs/Xserver/hw/kdrive/linux/ts.c Tue Apr 23 20:16:23 2002 +@@ -33,65 +33,48 @@ + #include "kdrive.h" + #include "Xpoll.h" + #include +-#include /* touch screen events */ ++ ++typedef struct { ++ unsigned short pressure; ++ unsigned short x; ++ unsigned short y; ++ unsigned short pad; ++ struct timeval stamp; ++} TS_EVENT; + + static long lastx = 0, lasty = 0; + int TsScreen; + extern int TsFbdev; + +-void +-TsRead (int tsPort, void *closure) +-{ +- TS_EVENT event; +- long buf[3]; +- int n; +- long pressure; +- long x, y; +- unsigned long flags; +- unsigned long buttons; +- +- n = Ps2ReadBytes (tsPort, (char *) &event, +- sizeof (event), sizeof (event)); +- if (n == sizeof (event)) +- { +- if (event.pressure) +- { +- /* +- * HACK ATTACK. (static global variables used !) +- * Here we test for the touch screen driver actually being on the +- * touch screen, if it is we send absolute coordinates. If not, +- * then we send delta's so that we can track the entire vga screen. +- */ +- if (TsScreen == TsFbdev) { +- flags = KD_BUTTON_1; +- x = event.x; +- y = event.y; +- } else { +- flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA; +- if ((lastx == 0) || (lasty == 0)) { +- x = 0; +- y = 0; +- } else { +- x = event.x - lastx; +- y = event.y - lasty; +- } +- lastx = event.x; +- lasty = event.y; +- } +- } else { +- flags = KD_MOUSE_DELTA; +- x = 0; +- y = 0; +- lastx = 0; +- lasty = 0; +- } +- KdEnqueueMouseEvent (flags, x, y); ++void TsRead (int tsPort, void *closure) { ++ TS_EVENT event; ++ long buf[3]; ++ int n; ++ long pressure; ++ long x, y; ++ unsigned long flags; ++ unsigned long buttons; ++ ++ n = Ps2ReadBytes(tsPort, (char *) &event, sizeof (event), sizeof (event)); ++ if (n >= sizeof (event)) { ++ if (event.pressure >= 100) { ++ flags = KD_BUTTON_1; ++ x = (960 - event.x) * 640 / (920); ++ y = (960 - event.y) * 480 / (920); ++ //ErrorF("flags %d x %d y %dn",flags,event.x,event.y); ++ } ++ else { ++ flags = KD_MOUSE_DELTA; ++ x = lastx; ++ y = lasty; + } ++ KdEnqueueMouseEvent(flags, x, y); ++ } + } + + char *TsNames[] = { +- "/dev/ts", +- "/dev/h3600_ts" /* temporary name; note this code can try ++ "/dev/ucb1x00-ts", ++ "/dev/ts" /* temporary name; note this code can try + to open more than one device */ + }; + +@@ -99,9 +82,7 @@ + + int TsInputType; + +-int +-TsInit (void) +-{ ++int TsInit (void) { + int i; + int TsPort; + +diff -Nur xc-011010.src/startx xc-011010/startx +--- ../../buildroot-tux.Apr25-1/build/xc-011010.src/startx Thu Apr 25 05:20:35 2002 ++++ xc-011010/startx Sun Apr 28 05:35:35 2002 +@@ -0,0 +1,11 @@ ++#!/bin/sh ++killall Xfbdev ++sleep 1 ++export DISPLAY=":0" ++/usr/X11R6/bin/Xfbdev -ac & ++sleep 4 ++/usr/X11R6/bin/matchbox & ++sleep 1 ++/usr/X11R6/bin/minisys & ++/usr/X11R6/bin/minitime & ++/usr/X11R6/bin/rxvt & +diff -Nur xc-011010.src/lib/Xft/xftgram.y xc-011010/lib/Xft/xftgram.y +--- ../../buildroot-tux.Apr25-1/build/xc-011010/lib/Xft/xftgram.y Thu Apr 25 05:20:35 2002 ++++ xc-011010/lib/Xft/xftgram.y Sun Apr 28 05:35:35 2002 +@@ -165,6 +165,7 @@ + matrix.yx = $4; + matrix.__REALLY_YY__ = $5; + } ++ ; + number : INTEGER + { $$ = (double) $1; } + | DOUBLE +diff -Nur xc-011010.src/programs/twm/gram.y xc-011010/programs/twm/gram.y +--- ../../buildroot-tux.Apr25-1/build/xc-011010/programs/twm/gram.y Thu Apr 25 05:20:35 2002 ++++ xc-011010/programs/twm/gram.y Sun Apr 28 05:35:35 2002 +@@ -650,6 +650,7 @@ + RemoveDQuote(ptr); + $$ = ptr; + } ++ ; + number : NUMBER { $$ = $1; } + ; + diff --git a/obsolete-buildroot/sources/uClibc-ldso-0.9.24.patch b/obsolete-buildroot/sources/uClibc-ldso-0.9.24.patch new file mode 100644 index 0000000000..ee65aa1935 --- /dev/null +++ b/obsolete-buildroot/sources/uClibc-ldso-0.9.24.patch @@ -0,0 +1,11861 @@ +diff -urN uClibc/ldso-0.9.24/COPYRIGHT uClibc.ldso.24/ldso-0.9.24/COPYRIGHT +--- uClibc/ldso-0.9.24/COPYRIGHT 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/COPYRIGHT 2001-04-23 12:43:53.000000000 -0500 +@@ -0,0 +1,49 @@ ++/* ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, David Engel, ++ * Hongjiu Lu and Mitch D'Souza ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++/* Notice of general intent: ++ * ++ * The linux operating system generally contains large amounts of code ++ * that fall under the GNU General Public License, or GPL for short. ++ * This file contains source code that by it's very nature would always ++ * be linked with an application program, and because of this a GPL ++ * type of copyright on this file would place restrictions upon the ++ * distribution of binary-only commercial software. Since the goal of ++ * the Linux project as a whole is not to discourage the development and ++ * distribution of commercial software for Linux, this file has been ++ * placed under a more relaxed BSD-style of copyright. ++ * ++ * It is the general understanding of the above contributors that a ++ * program executable linked to a library containing code that falls ++ * under the GPL or GLPL style of license is not subject to the terms of ++ * the GPL or GLPL license if the program executable(s) that are supplied ++ * are linked to a shared library form of the GPL or GLPL library, and as ++ * long as the form of the shared library is such that it is possible for ++ * the end user to modify and rebuild the library and use it in ++ * conjunction with the program executable. ++ */ +diff -urN uClibc/ldso-0.9.24/Makefile uClibc.ldso.24/ldso-0.9.24/Makefile +--- uClibc/ldso-0.9.24/Makefile 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/Makefile 2003-11-06 16:38:45.000000000 -0600 +@@ -0,0 +1,52 @@ ++# Makefile for uClibc ++# ++# Copyright (C) 2000,2001 Erik Andersen ++# ++# This program is free software; you can redistribute it and/or modify it under ++# the terms of the GNU Library 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 Library General Public License for more ++# details. ++# ++# You should have received a copy of the GNU Library 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 ++# ++# Derived in part from the Linux-8086 C library, the GNU C Library, and several ++# other sundry sources. Files within this library are copyright by their ++# respective copyright holders. ++ ++TOPDIR=../ ++include $(TOPDIR)Rules.mak ++ ++ALL_SUBDIRS = ldso libdl ++ ++ ++all: headers ++ifeq ($(strip $(BUILD_UCLIBC_LDSO)),y) ++ $(MAKE) -C ldso; ++else ++ echo "Not building ld-uClibc" ++endif ++ ++shared: ++ifeq ($(strip $(BUILD_UCLIBC_LDSO)),y) ++ $(MAKE) -C libdl; ++else ++ echo "Not building libdl" ++endif ++ ++headers: ++ $(LN) -fs $(TOPDIR)../include/elf.h include/ ++ $(LN) -fs ../ldso/$(TARGET_ARCH)/boot1_arch.h include/ ++ $(LN) -fs ../ldso/$(TARGET_ARCH)/ld_syscalls.h include/ ++ $(LN) -fs ../ldso/$(TARGET_ARCH)/ld_sysdep.h include/ ++ ++clean: ++ set -e ; for d in $(ALL_SUBDIRS) ; do $(MAKE) -C $$d $@ ; done ++ -find . -name '*~' | xargs $(RM) ++ $(RM) include/elf.h include/boot1_arch.h include/ld_syscalls.h include/ld_sysdep.h +diff -urN uClibc/ldso-0.9.24/README uClibc.ldso.24/ldso-0.9.24/README +--- uClibc/ldso-0.9.24/README 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/README 2001-05-31 16:23:20.000000000 -0500 +@@ -0,0 +1,841 @@ ++ ++Apr 20, 2001 -- Manuel Novoa III ++ ++Inital port for uClibc from debian ld.so_1.9.11-9.tar.gz. ++ ++Removed a.out support. ++ ++****************** original ld.so.lsm file ************************** ++Begin3 ++Title: Linux shared, dynamic linker and utilities. ++Version: 1.9.11 ++Entered-date: 01MAY99 ++Description: This package contains ld.so, ld-linux.so, ldconfig, ++ ldd and libdl. ++Keywords: dynamic linker, shared library, ld.so, ld-linux.so, ++ ldconfig, ldd, libdl ++Author: david@ods.com (David Engel) ++Maintained-by: david@ods.com (David Engel) ++Primary-site: tsx-11.mit.edu /pub/linux/packages/GCC ++ ld.so-1.9.11.tar.gz ++Alternate-site: sunsite.unc.edu /pub/Linux/GCC ++ ld.so-1.9.11.tar.gz ++Platform: Linux 2.0.0 or later. ++Copying-policy: Copyrighted but freely distributable. ++End ++********************************************************************* ++ Original README starts here ++********************************************************************* ++ ++This package contains my ELF dynamic linkers (ld-linux.so.1), dynamic ++linker library (libdl.so.1) and utilities (ldconfig and ldd) for Linux. ++ ++You need Linux kernel 2.0.0 or later with ELF support compiled in ++(i.e. not loaded as a module) to use this package. ++ ++The dynamic linker is used to bootstrap programs and load shared ++libraries at startup. The dynamic linker library is used to ++dynamically load shared libraries after a program is running. ++Ldconfig is used to automatically update the symbolic links to shared ++libraries and build the cache file used by the dynamic linker. Ldd is ++used to list the shared libraries used by a program. ++ ++Please see the included manual pages for further details. ++ ++To install, simply run "sh instldso.sh" as root. Ready-to-go versions ++of all end-products are provided so nothing should need to be compiled ++or linked. If you are still using libc5 as your primary development ++library, you should use the "--devfiles" option when running ++instldso.sh to install the file needed to compile with libdl. ++ ++ELF versions of gcc, binutils and libc are now required to compile ++everything, including the old, unsupported, a.out dynamic linker. ++Finally, an optimization level of O2 or higher must be used to compile ++ld-linux.so and libdl.so due the use of inline functions. ++ ++Notable contributors to this package include Eric Youngdale, Peter ++MacDonald, Hongjiu Lu, Linus Torvalds, Lars Wirzenius, Mitch D'Souza, ++Rik Faith, Andreas Schwab and Adam Richter (not necessarily in that ++order). ++ ++###################### IMPORTANT NOTICES ############################# ++ ++A.OUT SUPPORT: ++ ++As of ld.so-1.9.0, the old, a.out dynamic loader is no longer ++officially supported. The code is still included and built, but I ++make no promises that it will work. I will accept patches for it, ++but they will not be tested by me. ++ ++GLIBC (AKA LIBC6) SUPPORT: ++ ++As of ld.so-1.9.0, the main focus of this package is to ease the ++transition to libc6. No significant, new features are expected to be ++added. If you need new features, switch to libc6. ++ ++Except for libpthread.so, the sonames of the core libraries provided ++with libc6 have been chosen so they do not conflict with those ++provided by libc5 and ld.so. However, the current plan is not use ++new, nonconflicting sonames for other libraries such as ncurses and ++X11. This presents two problems. First, libraries using the same ++soname for both libc5 and libc6 can not be placed in the same ++directory. Second, the dynamic linkers need to make sure not to load ++a library for the wrong version of libc. ++ ++The first problem is easy. Just move the old, libc5-based libraries ++to new directories (e.g. /lib/libc5-compat, /usr/lib/libc5-compat, ++etc.) and add those directories to /etc/ld.so.conf. Then install the ++new, libc6-based versions in the standard places. ++ ++The second problem is more difficult. Ideally, the dynamic linkers ++would be changed to perform a complete dependency analysis on every ++library to be loaded to make sure the wrong versions aren't used. ++This approach doesn't seem worth the added complexity, especially ++since we now have symbol versioning for ELF libraries. Instead a ++simpler approach will be used, at least initially. ++ ++Ldconfig has been modified to perform a (currently simple) dependency ++analysis on libraries and to store an indication in /etc/ld.so.cache ++of whether a library is for libc5, libc6 or an unknown libc. The ++dynamic linkers then only need to make a simple check at run-time to ++make sure they don't load the wrong version of a library. ++ ++The dynamic linker for libc5 provided in this package, has already ++been modified to use the new information in /etc/ld.so.cache. For ++glibc versions 2.0.1 and earlier, the dynamic linker for libc6 needs ++the patch contained in glibc.patch. You should apply the patch and ++rebuild glibc before using the new ldconfig. ++ ++As stated above, the dependency analysis currently done by ldconfig is ++rather simple. Basically, it looks for the sonames used by the ++various versions of libc, libm and libdl. For any approach using a ++dependency analysis such as this to work, it is very important that ++shared libraries be built with complete dependency information. This ++can be done by using the appropriate -l options when running 'gcc ++-shared'. For example, when building libfoo.so which depends on libc ++and libbar, you should add -lbar and -lc gcc command line. ++ ++###################################################################### ++ ++Changes in version 1.9.11: ++ ++ Fixed a bug in ld-linux.so where a reference to an ++ undefined symbol could cause a segfault. ++ ++ Added a clarification for LD_PRELOAD to the ld.so manual ++ page and added a symlink for ld-linux.so (Bug#33123). ++ ++ Don't install ldd for Debian except for the m68k arch ++ because glibc 2.1 now includes it (Bug#35458). ++ ++Changes in version 1.9.10: ++ ++ Changed ldconfig to issue a warning and not overwrite a ++ regular file with a symlink (Bug#30859). ++ ++ Changed Debian packaging to conflict with and replace the ++ ldconfig package (Bug#29398). ++ ++Changes in version 1.9.9: ++ ++ Changed ld-linux.so and libdl.so to match glibc by not ++ allowing user preloads of system libraries into setu/gid ++ binaries unless the library itself is setuid. ++ ++ Fixed problems in ld-linux.so on the sparc architecture ++ (Juan Cespedes). ++ ++Changes in version 1.9.8: ++ ++ Changed ldconfig to allow the expected type for all ++ libraries in a directory to be optionally specified ++ (Mark Phillips). See the ldconfig man page. ++ ++ Changed ldconfig to use the same type names used in the ++ change above when the -p option is used. ++ ++Changes in version 1.9.7: ++ ++ Changed ldd for m68k to use /lib/ld.so.1 instead of ++ /lib/ld-linux.so.2. ++ ++ Added support for dladdr to libdl.so (Eduard Gode). ++ ++ Fixed a small memory leak in libdl.so (Richard Garnish). ++ ++ Fixed a bug in ldconfig when the -l option was used on a ++ filename without a '/' in it. ++ ++ Updated the man pages (Bug#6404, Bug#9721, Bug#10652, ++ Bug#13494 and Bug#14127). They could still use some work. ++ ++ No longer install the info page since it's way out of date. ++ ++ Fixed minor Debian packaging problems (Bug#13160, ++ Bug#15577 and Bug#19345). ++ ++Changes in version 1.9.6: ++ ++ Changed ldd to not use the glibc dynamic linker when run ++ on a libc5-based shared library. ++ ++ Added a -q option to ldconfig which causes warnings not ++ to be printed (Bob Tinsley). ++ ++ Dropped support for the Debian libdl1-dev package. ++ ++ Changed ld-linux.so to be compilable with gcc 2.8.0 (Sven ++ Verdoolaege) ++ ++Changes in version 1.9.5: ++ ++ Fixed a bug in ldd where ld-linux.so.2 was not called ++ correctly when run on shared libraries. ++ ++ Fixed a problem in the previous version where some ++ Makefiles were not architecture independent. ++ ++Changes in version 1.9.4: ++ ++ Fixed a bug in ld.so introduced in the previous version ++ which broke preloads. ++ ++ Turned a.out support back on by default, at least for the ++ time being. There are no promises to keep it. ++ ++Changes in version 1.9.3: ++ ++ Fixed buffer overflow bugs in ld-linux.so and ld.so. ++ ++ Changed the README file a little to clarify a couple of ++ things. ++ ++ Changed ldconfig to chroot to the specified directory when ++ the new -r option is used (Bob Tinsley). ++ ++Changes in version 1.9.2: ++ ++ Removed /usr/local/lib from the default /etc/ld.so.conf ++ for Debian (Bug#8181). ++ ++ Changed ldconfig to be 64-bit clean (H.J. Lu). ++ ++Changes in version 1.9.1: ++ ++ Changed ldconfig to try to determine which libc a ++ library is for even if it doesn't have an soname. ++ ++ Fixed a bug in ldconfig where an older library using ++ the glibc naming convention would be used instead of ++ a newer library. ++ ++ Changed to ld-linux.so and libdl.so to not require the ++ libc5 headers in order to compile. ++ ++ Changed ldconfig and ldd to be compilable with either ++ libc5 or libc6. ++ ++Changes in version 1.9.0: ++ ++ Changed to not build the old, a.out dynamic loader by ++ default. ++ ++ Changed instldso.sh to require the --force option to ++ make sure users read the README file. ++ ++ Changed instldso.sh to not install the libdl.so ++ development files unless the --devfiles option is used. ++ ++ Changed instldso.sh to not strip binaries and libraries ++ if the --no-strip option is used. ++ ++ Changed the Debian packaging to put the development files ++ which conflict with glibc in a new libdl1-dev package. ++ ++ Changed ldd to use the glibc dynamic linker, if it is ++ available, when run on a shared library. ++ ++ Changed ld-linux.so to print the load addresses of ++ libraries, ala glibc, when run by ldd. ++ ++ Changed ld-linux.so to allow the libraries listed in ++ LD_PRELOAD to be separated by white space in addition to ++ colons. ++ ++ Changed ld-linux.so to load the libraries listed in ++ LD_PRELOAD for setu/gid programs as long as they can be ++ loaded securely. ++ ++ Changed ldconfig to update the symlinks for the dynamic ++ linkers. ++ ++ Changed ldconfig to try to determine if an ELF library is ++ intended for libc5 or libc6 and save the infomation in the ++ cache. The mechanism used is rather simplistic and may ++ need to be enhanced. ++ ++ Changed ldconfig to print the type of ELF library when ++ printing the cache. ++ ++ Changed ld-linux.so to only load ELF shared libraries for ++ use with libc5 or an unknown libc. ++ ++Changes in version 1.8.10: ++ ++ Fixed a bug in ldconfig where a symlink could be used ++ instead of a regular file. ++ ++ Fixed a Debian packaging problem for the sparc ++ architecture. ++ ++Changes in version 1.8.9: ++ ++ Changed ldconfig to only cache the symlinks it creates. ++ This make the behavior of the dynamic linkers consistent ++ with how they would behave if a cache was not used. ++ ++ Changed ldconfig to cache the symlinks that it finds but ++ use the name of the symlink as the soname instead of the ++ actual soname. ++ ++Changes in version 1.8.8: ++ ++ Minor documentation updates to reflect recent changes. ++ ++ Changed ld.so and ld-linux.so to perform more complete ++ validation on ld.so.cache before using it. ++ ++ Changed ldconfig to accept libraries with inconsistent ++ sonames since glibc is going to use them. A warning is ++ still printed in debug mode. ++ ++ Changed the install script to not strip _dl_debug_state ++ from ld-linux.so since gdb needs it. ++ ++ More sparc fixes (Derrick Brashear). ++ ++ Changed ldconfig to not issue a warning when a linker ++ script disguised as a shared library is found. ++ ++ Fixed a bug in ld-linux.so where some registers were ++ not preserved on the first call to a function causing ++ problems for non-C-like languages (Tim Renouf). ++ ++ Fixed a bug in ld-linux.so where global variables were ++ not always mapped correctly across dynamically loaded ++ libraries (Mikihiko Nakao). ++ ++ Converted to new Debian source packaging format (Shaya ++ Potter). ++ ++Changes in version 1.8.6/7: ++ ++ Never released as some unofficial patches used these ++ version numbers. ++ ++Changes in version 1.8.5: ++ ++ Fixed a bug in ld.so introduced in the previous changes. ++ ++Changes in version 1.8.4: ++ ++ Changed ldconfig to completely ignore symbolic links. ++ ++ Changed ldconfig to issue the warning concerning an ++ inconsistent soname in non-verbose mode. ++ ++ Changed ld-linux.so back to not keep ld.so.cache mapped ++ at all times. ++ ++ Changed Debian packaging to compress man pages, strip all ++ binaries (Bug#5125) and include a shlibs file. ++ ++Changes in version 1.8.3: ++ ++ Changed ld-linux.so to process LD_PRELOAD before ++ /etc/ld.so.preload. ++ ++ Fixed a Debian packaging problem where libdl might not ++ be available if other packages were upgraded at the same ++ time (Debian Bug#4728). ++ ++ Changed ldd to always exit with status 1 if any errors ++ occur (Debian Bug#4188). ++ ++ Fixed some minor problems in instldso.sh (Mike Castle and ++ Wolfgang Franke). ++ ++ Changed ldconfig to issue a warning in verbose mode when ++ skipping a library because the soname doesn't match. ++ ++ More sparc fixes (Miguel de Icaza). ++ ++ Don't link with -N when building ld.so (Alan Modra). ++ ++ Changed ld-linux.so to better support position-dependant ++ libraries (NIIBE Yutaka). ++ ++Changes in version 1.8.2: ++ ++ Added a texinfo file for ld.so and libdl (Michael ++ Deutschmann). ++ ++ Minor sparc and installation changes (Elliot Lee). ++ ++ Added multiple architecture support for Debian (Leland ++ Lucius). ++ ++ Changed libdl to better support RTLD_NEXT (Eric ++ Youngdale). Note: the exact meaning of ETLD_NEXT is ++ still not clear in all cases. ++ ++ Removed some libc dependencies from libdl. Still need ++ to remove malloc and free. ++ ++Changes in version 1.8.1: ++ ++ Changed ld.so to be compiled as ELF. This also means ++ that ELF support is now required. A.out support is ++ still optional. ++ ++ Changed ld-linux.so and libdl.so to use the rpath in the ++ executable instead of in the invoking shared library. ++ ++ More m68k fixes (Andreas Schwab). ++ ++ Various sparc fixes (Miguel de Icaza). ++ ++ Changed ldcnnfig to ignore libraries ending in '~'. ++ ++ Changed ldconfig to allow alternative conf and cache ++ files to be specified on the command-line. ++ ++ Changed libdl.so to work when dlsym is passed a NULL ++ handle pointer. ++ ++Changes in version 1.8.0: ++ ++ Changed ld-linux.so to be more liberal when checking to ++ see if a library is already loaded. This should avoid ++ the duplicate loading problem for programs linkeed with ++ the -rpath option. ++ ++ Various m68k fixes (Andreas Schwab). ++ ++ Changed ld.so to only use LD_AOUT_LIBRARY_PATH and ++ LD_AOUT_PRELOAD and ld-linux.so to only use ++ LD_LIBRARY_PATH and LD_PRELOAD. LD_ELF_LIBRARY_PATH ++ and LD_ELF_PRELOAD are no longer supported. ++ ++ Changed ld-linux.so to allow debugging of shared and ++ dynamically loaded libraries (H.J. Lu, Andreas Schwab). ++ ++ Changed ld-linux.so to preload ELF shared libraries ++ listed in /etc/ld.so.preload. This allows secure ++ preloads, even for setuid/setgid programs. ++ ++ Changed ld-linux.so to keep ld.so.cache mapped at all ++ times. ++ ++ Changed ldconfig to allow #-style comments in ld.so.conf. ++ ++ Removed various compiler warnings (Richard Sladkey and ++ David Engel). ++ ++ Changed ldd to work on ELF shared libraries. This may ++ need a little more work. ++ ++Changes in version 1.7.14: ++ ++ Changed ldconfig to recognize ELF shared libraries ++ generated by post-2.6 versions of ld (Andreas Schwab). ++ ++ Changed ldconfig to not remove stale links that do not ++ have a version number since they may be needed by ld. ++ ++Changes in version 1.7.13: ++ ++ Fixed a problem in ld-linux.so where a program linked ++ with a shared library that was not used could result in ++ a segmentation fault (H.J. Lu). ++ ++Changes in version 1.7.12: ++ ++ Fixed a problem in libdl.so where the wrong library ++ could be marked as global when RTLD_GLOBAL was used ++ (Lars Heete). ++ ++ Installed dlfcn.h with libdl.so instead of requiring ++ it to be supplied with libc. ++ ++ Removed support for libldso.a since it was nearly ++ impossible to use anyway. ++ ++ Changed ldd to detect when the program being checked ++ exited abnormally. ++ ++Changes in version 1.7.11: ++ ++ Changed ld.so and ld-linux.so to delete all variations ++ of LD_PRELOAD and LD_LIBRARY_PATH for set[ug]id programs, ++ This makes it harder for broken set[ug]id programs to be ++ compromised. ++ ++ Fixed a problem in libdl.so where dlsym would not accept ++ the handle returned from dlopen(0, *). ++ ++Changes in version 1.7.10: ++ ++ Changed ld-linux.so and libdl.so to support RTLD_GLOBAL ++ (Eric Youngdale). ++ ++Changes in version 1.7.9: ++ ++ Fixed a problem in ld-linux.so in detecting when the ++ new user/group information is provided by the kernel. ++ ++ Fixed a problem in ld-linux.so where a buffer could be ++ overflowed if a large number of libraries were loaded ++ (Thomas Moore). ++ ++Changes in version 1.7.8: ++ ++ Changed the Makefiles and install scripts to support ++ a.out- and ELF-only configurations. ++ ++ Changed ld-linux.so to use the user/group information ++ provided by linux 1.3.23+ instead of making syscalls ++ to get it. ++ ++ Changed libdl.so to support RTLD_NEXT (Glenn Fowler). ++ ++ Changed libdl.so to only execute the fini sections ++ instead of completely closing libraries at exit (Glenn ++ Fowler). ++ ++ Changed ld.so and ld-linux.so to print the required ++ cache version when a mismatch is detected. ++ ++ Changed ld-linux.so to not require on /dev/zero (Ralph ++ Loader). ++ ++ Minor m68k cleanups (Andreas Schwab). ++ ++Changes in version 1.7.7: ++ ++ Fixed problems compiling with recent 1.3.x kernels. ++ ++ Changed ld-linux.so to not use MAP_DENYWRITE until the ++ permission issue regarding it is resolved. ++ ++Changes in version 1.7.6: ++ ++ Fixed a bug in ld-linux.so dealing with a zero-length ++ LD_{ELF_}PRELOAD. ++ ++ Changed ld.so and ld-linux.so to truncate all variations ++ of LD_PRELOAD and LD_LIBRARY_PATH for set[ug]id programs. ++ ++Changes in version 1.7.5: ++ ++ Changed ldconfig to recognize libraries without any ++ version number (eg. libXYZ.so). ++ ++ Changed ldconfig to not generate a corrupt cache when ++ the disk is full or other write errors occur. ++ ++ Changed ld-linux.so to map files with MAP_DENYWRITE to ++ keep them from being changed while the file is in use ++ (Rick Sladkey). ++ ++ Changed libdl to not overwrite the scope pointer of a ++ library if it was already loaded (H.J. Lu). ++ ++ Changed ld-linux.so so gdb can be used on constructors ++ (Eric Youngdale). ++ ++ Changed ldconfig to ignore ELF libraries where the soname ++ does not match the file name on the assumption that it is ++ a used at compile-time (eg. libcurses.so -> libncruses.so). ++ ++Changes in version 1.7.4: ++ ++ Changed ld-linux.so and libdl to use the appropriate ++ rpaths when searching for shared libraries (Eric ++ Youngdale). ++ ++ Changed ld-linux.so to search rpath before using the ++ cache. This more closely conforms to the IBCS standard. ++ ++Changes in version 1.7.3: ++ ++ Changed ld-linux.so to only print a library name the ++ first time it is loaded when run from ldd. ++ ++ Fixed a bug in ldconfig where an invalid cache could be ++ generated if a directory was specified multiple times in ++ ld.so.conf. ++ ++ Changed ld-linux.so so it will return the address of a ++ weak symbol when called from dlsym in libdl (Eric ++ Youngdale. ++ ++Changes in version 1.7.2: ++ ++ Changed libdl.so again to fix the undefined foobar ++ problem. ++ ++Changes in version 1.7.1: ++ ++ Changed libdl so it will compile at optimization level ++ O3 or higher. ++ ++ Changed ldconfig to always create the cache file with ++ mode 644. ++ ++ Changed ldconfig to not ingore valid symlinks. ++ ++ Changed ldconfig to use the library name as the soname ++ for ELF libraries that do not have an soname entry. ++ ++ Changed ld-linux.so to print the actual, requested library ++ name at the time it is loaded instead of trying to figure ++ it out after the fact. ++ ++Changes in version 1.7.0: ++ ++ Changed ldconfig to read the actual soname from the image ++ for ELF libraries and make it available to ld-linux.so. ++ The soname for DLL libraries is still determined by ++ truncating the minor numbers from the image file name. ++ ++ Changed ldconfig to no longer support the undocumented ++ sort options. ++ ++ Changed ld.so to require a valid cache to find libraries ++ in directories specified in ld.so.conf. /usr/lib and /lib ++ are still searched as a last resort. Ld-linux.so already ++ operated this way. ++ ++ Fixed a bug in libldso.a where the arguments to ++ shared_loader were not parsed correctly (Wolfram Gloger). ++ ++ Added support for RELA-style relocations under Linux/68k ++ (Andreas Schwab). ++ ++ Changed ld-linux.so to only map the cache once for all ++ libraries instead of individually for each library. ++ ++ Changed ld-linux.so continue searching the cache instead of ++ giving up when failing to load the first entry found. ++ ++ Changed ld-linux.so to produce output similar to ld.so when ++ run from ldd or when errors occur. ++ ++Changes in version 1.6.7: ++ ++ Changed the install scripts to make sure that ld.so and ++ ld-linux.so are always usable. ++ ++ Added support for Linux/Sparc (Eric Youngdale). ++ ++ Added support for Linux/68k (Andreas Schwab). ++ ++ Fixed various bugs in ld-linux.so dealing with closing ++ files, unmapping memory, dereferencing NULL pointers and ++ printing library names (David Engel, Eric Youngdale and ++ Andreas Schwab). ++ ++ Replaced the manual page for libdl with a freely ++ distributable one (Adam Richter). ++ ++ Fixed a bug in ld-linux.so where LD_LIBRARY_PATH and ++ LD_PRELOAD were not cleared for setuid/setgid programs. ++ ++ Fixed a bug in libdl where dlsym would not return the ++ correct address of a symbol if it was redefined in another ++ library (Oleg Kibirev). ++ ++ Changed ld-linux.so to use the following order to search ++ for libraries: LD_{ELF_}LIBRARY_PATH, ld.so.cache, rpath, ++ /usr/lib and /lib. ++ ++ Changed ld-linux.so to not needlessly allocate memory when ++ using ld.so.cache. ++ ++Changes in version 1.6.6: ++ ++ Changed ldconfig to not warn about removing stale links ++ unless the -v option is specified. ++ ++ Added manual pages for libdl (from FreeBSD/Sun) ++ ++ Fixed a bug in ld.so dealing with preloading of objects ++ generated by recent versions of ld (Mitch D'Souza). ++ ++ Fixed bugs in ldd where some errors were either not ++ detected or not printed. ++ ++ Fixed a bug in ld-linux.so where the trailing nul in a ++ library name was not being copied (Owen Taylor). ++ ++Changes in version 1.6.5: ++ ++ Changed ldconfig to remove stale symbolic links. ++ ++ Added debug hooks in ld-linux.so and libdl.so to be used ++ by a future version of gdb (Eric Youngdale). ++ ++Changes in version 1.6.4: ++ ++ Change ld-linux.so to print on stdout instead of stderr ++ when run from ldd. ++ ++ Added support for Debian GNU/Linux packaging. ++ ++Changes in version 1.6.3: ++ ++ Fixed a bug in libdl when closing a library (H.J. Lu). ++ ++Changes in version 1.6.2: ++ ++ Changed the error message printed by ldd when a file is ++ not a.out or ELF. It used to only list a.out formats. ++ ++ Changed ldconfig to no longer cache and set up links for ++ ld-linux.so. ++ ++ Changed ld-linux.so and libdl to not conflict with upcoming ++ changes in kernel header files. ++ ++ Changed ld-linux.so to not print preloaded libraries. ++ ++Changes in version 1.6.1: ++ ++ Updated the installation script. ++ ++ Changed ld.so and ld-linux.so to look for LD_AOUT_PRELOAD ++ and LD_ELF_PRELOAD, respectively, before LD_PRELOAD. ++ ++ Changed ld.so and ld-linux.so to use LD_AOUT_LIBRARY_PATH ++ and LD_ELF_LIBRARY_PATH, respectively, instead of ++ AOUT_LD_LIBRARY_PATH and ELF_LD_LIBRARY_PATH. ++ ++Changes in version 1.6.0: ++ ++ Changed ldconfig to process libraries which do not have ++ a minor version or patch level number. ++ ++ Incorporated ld-linux.so and libdl.so. ++ ++ Changed ld.so and ld-linux.so to not miss entries in the ++ cache when the fully qualified library is requested. ++ ++ Changed ldconfig to use stdout instead of stderr when ++ printing the cache. ++ ++Changes in version 1.5.3: ++ ++ LD_PRELOAD enhancements (Tristan Gigold). ++ ++ LD_PRELOAD patch for linux-68k (Andreas Schwab). ++ ++Changes in version 1.5.2: ++ ++ More ELF changes (Mitch D'Souza). ++ ++ Changed ldconfig to also update the link for ld-linux.so. ++ ++Changes in version 1.5.1: ++ ++ More ELF and LD_PRELOAD changes (Mitch D'Souza). ++ ++Changes in version 1.5.0: ++ ++ Chnaged all executables to QMAGIC (Mitch D'Souza and Rick ++ Sladkey). ++ ++ Added preliminary support for ELF to ldd and ldconfig (Eric ++ Youndale and H.J. Lu). ++ ++ Added support for LD_PRELOAD to ld.so (Mitch D'Souza). ++ ++ Removed the "advertising" clause from the copyright notices ++ in all source files. ++ ++Changes in version 1.4.4: ++ ++ Changed ldconfig to support QMAGIC libraries. ++ ++ Fixed a bug in ld.so where some of the error messages had ++ transposed arguments. ++ ++Changes in version 1.4.3: ++ ++ Fixed an obscure bug in ld.so where an index was not being ++ incremented when a library was not found using the cache. ++ ++Changes in version 1.4.2: ++ ++ Changed ldconfig to issue a warning and continue instead ++ of an error and exiting when a link can't be updated. ++ This is useful when some libraries are imported on read- ++ only file systems, such as an NFS mounted /usr. ++ ++ Changed ld.so to be more robust in searching for libraries. ++ A library is not considered found unless it can actually be ++ loaded. If a library is not found using the cache, the ++ standard directories are searched as in pre-cache versions. ++ ++Changes in version 1.4.1: ++ ++ Fixed minor Makefile problems. ++ ++ Added support for linux-68k. ++ ++ Fixed a bug in ld.so where libraries with absolute paths ++ were not handled correctly. ++ ++ Changed ld.so to ignore the directory in the names of ++ shared libraries by default. This allows older libraries ++ with absolute paths, such as the XView libraries, to take ++ advantage of the cache support. ++ ++ Added a minimal usage message to ldconfig. ++ ++Changes in version 1.4: ++ ++ Fixed bug in ld.so where minor version numbers were not ++ reported correctly when a minor version incompatibility ++ was found. ++ ++ Fixed bug in ldconfig where libraries with subversion ++ numbers greater than 9 were not compared correctly. ++ ++ Added Mitch D'Souza's support for suppressing warning ++ messages from ld.so about minor version incompatibilities. ++ ++ Added Mitch D'Souza's support for using a cache to speed ++ up searching for libraries in the standard directories. ++ ++ Added Mitch D'Souza's support for a debugging version of ++ ld.so. Link with -lldso if you think you are experiencing ++ dynamic linker problems. ++ ++Changes in version 1.3: ++ ++ Added support for libraries using absolute pathnames. If I ++ had known that the XView libraries used them, I would have ++ added this earlier. ++ ++ Fixed a bug handling old libraries using a pathname beginning ++ with '/' or '/lib/'. ++ ++Changes in version 1.2a: ++ ++ Fixed a minor bug in ldd which caused all files, specifically ++ scripts, to be recognized as binaries. Thanks to Olaf Flebbe ++ for reporting it. ++ ++David Engel ++david@sw.ods.com +diff -urN uClibc/ldso-0.9.24/include/.cvsignore uClibc.ldso.24/ldso-0.9.24/include/.cvsignore +--- uClibc/ldso-0.9.24/include/.cvsignore 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/.cvsignore 2003-08-19 01:05:30.000000000 -0500 +@@ -0,0 +1,4 @@ ++elf.h ++ld_syscalls.h ++ld_sysdep.h ++boot1_arch.h +diff -urN uClibc/ldso-0.9.24/include/dlfcn.h uClibc.ldso.24/ldso-0.9.24/include/dlfcn.h +--- uClibc/ldso-0.9.24/include/dlfcn.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/dlfcn.h 2003-08-19 01:05:30.000000000 -0500 +@@ -0,0 +1,22 @@ ++/* User functions for run-time dynamic loading. libdl version */ ++#ifndef _DLFCN_H ++#define _DLFCN_H 1 ++ ++#include ++#include ++ ++#define RTLD_NEXT ((void *) -1l) ++#define RTLD_DEFAULT ((void *) 0) ++ ++/* Structure containing information about object searched using ++ `dladdr'. */ ++typedef struct ++{ ++ __const char *dli_fname; /* File name of defining object. */ ++ void *dli_fbase; /* Load address of that object. */ ++ __const char *dli_sname; /* Name of nearest symbol. */ ++ void *dli_saddr; /* Exact value of nearest symbol. */ ++} Dl_info; ++ ++ ++#endif /* dlfcn.h */ +diff -urN uClibc/ldso-0.9.24/include/ld_elf.h uClibc.ldso.24/ldso-0.9.24/include/ld_elf.h +--- uClibc/ldso-0.9.24/include/ld_elf.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/ld_elf.h 2003-11-04 07:07:45.000000000 -0600 +@@ -0,0 +1,93 @@ ++#ifndef LINUXELF_H ++#define LINUXELF_H ++ ++#include /* before elf.h to get ELF_USES_RELOCA right */ ++#include ++#include ++ ++#ifdef DEBUG ++# define LDSO_CONF "../util/ld.so.conf" ++# define LDSO_CACHE "../util/ld.so.cache" ++# define LDSO_PRELOAD "../util/ld.so.preload" ++#else ++# define LDSO_CONF UCLIBC_RUNTIME_PREFIX "etc/ld.so.conf" ++# define LDSO_CACHE UCLIBC_RUNTIME_PREFIX "etc/ld.so.cache" ++# define LDSO_PRELOAD UCLIBC_RUNTIME_PREFIX "etc/ld.so.preload" ++#endif ++ ++ ++#define LIB_ANY -1 ++#define LIB_DLL 0 ++#define LIB_ELF 1 ++#define LIB_ELF64 0x80 ++#define LIB_ELF_LIBC5 2 ++#define LIB_ELF_LIBC6 3 ++#define LIB_ELF_LIBC0 4 ++ ++/* Forward declarations for stuff defined in ld_hash.h */ ++struct dyn_elf; ++struct elf_resolve; ++ ++ ++/* Definitions and prototypes for cache stuff */ ++#ifdef USE_CACHE ++extern int _dl_map_cache(void); ++extern int _dl_unmap_cache(void); ++ ++#define LDSO_CACHE_MAGIC "ld.so-" ++#define LDSO_CACHE_MAGIC_LEN (sizeof LDSO_CACHE_MAGIC -1) ++#define LDSO_CACHE_VER "1.7.0" ++#define LDSO_CACHE_VER_LEN (sizeof LDSO_CACHE_VER -1) ++ ++typedef struct { ++ char magic [LDSO_CACHE_MAGIC_LEN]; ++ char version [LDSO_CACHE_VER_LEN]; ++ int nlibs; ++} header_t; ++ ++typedef struct { ++ int flags; ++ int sooffset; ++ int liboffset; ++} libentry_t; ++ ++#else ++static inline void _dl_map_cache(void) { } ++static inline void _dl_unmap_cache(void) { } ++#endif ++ ++ ++/* Function prototypes for non-static stuff in readelflib1.c */ ++int _dl_copy_fixups(struct dyn_elf * tpnt); ++extern int _dl_parse_copy_information(struct dyn_elf *rpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type); ++extern void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type); ++extern int _dl_parse_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type); ++extern struct elf_resolve * _dl_load_shared_library(int secure, ++ struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname); ++extern struct elf_resolve * _dl_load_elf_shared_library(int secure, ++ struct dyn_elf **rpnt, char *libname); ++extern struct elf_resolve *_dl_check_if_named_library_is_loaded(const char *full_libname); ++extern int _dl_linux_resolve(void); ++ ++ ++/* ++ * Datatype of a relocation on this platform ++ */ ++#ifdef ELF_USES_RELOCA ++# define ELF_RELOC ElfW(Rela) ++#else ++# define ELF_RELOC ElfW(Rel) ++#endif ++ ++ ++/* Convert between the Linux flags for page protections and the ++ ones specified in the ELF standard. */ ++#define LXFLAGS(X) ( (((X) & PF_R) ? PROT_READ : 0) | \ ++ (((X) & PF_W) ? PROT_WRITE : 0) | \ ++ (((X) & PF_X) ? PROT_EXEC : 0)) ++ ++ ++#endif /* LINUXELF_H */ +diff -urN uClibc/ldso-0.9.24/include/ld_hash.h uClibc.ldso.24/ldso-0.9.24/include/ld_hash.h +--- uClibc/ldso-0.9.24/include/ld_hash.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/ld_hash.h 2003-08-19 08:11:05.000000000 -0500 +@@ -0,0 +1,103 @@ ++#ifndef _LD_HASH_H_ ++#define _LD_HASH_H_ ++ ++#ifndef RTLD_NEXT ++#define RTLD_NEXT ((void*)-1) ++#endif ++ ++struct dyn_elf{ ++ unsigned long flags; ++ struct elf_resolve * dyn; ++ struct dyn_elf * next_handle; /* Used by dlopen et al. */ ++ struct dyn_elf * next; ++ struct dyn_elf * prev; ++}; ++ ++struct elf_resolve{ ++ /* These entries must be in this order to be compatible with the interface used ++ by gdb to obtain the list of symbols. */ ++ ElfW(Addr) loadaddr; /* Base address shared object is loaded at. */ ++ char *libname; /* Absolute file name object was found in. */ ++ ElfW(Dyn) *dynamic_addr; /* Dynamic section of the shared object. */ ++ struct elf_resolve * next; ++ struct elf_resolve * prev; ++ /* Nothing after this address is used by gdb. */ ++ enum {elf_lib, elf_executable,program_interpreter, loaded_file} libtype; ++ struct dyn_elf * symbol_scope; ++ unsigned short usage_count; ++ unsigned short int init_flag; ++ unsigned int nbucket; ++ unsigned long * elf_buckets; ++ /* ++ * These are only used with ELF style shared libraries ++ */ ++ unsigned long nchain; ++ unsigned long * chains; ++ unsigned long dynamic_info[24]; ++ ++ unsigned long dynamic_size; ++ unsigned long n_phent; ++ Elf32_Phdr * ppnt; ++ ++#if defined(__mips__) ++ /* Needed for MIPS relocation */ ++ unsigned long mips_gotsym; ++ unsigned long mips_local_gotno; ++ unsigned long mips_symtabno; ++#endif ++ ++#ifdef __powerpc__ ++ /* this is used to store the address of relocation data words, so ++ * we don't have to calculate it every time, which requires a divide */ ++ unsigned long data_words; ++#endif ++}; ++ ++#define COPY_RELOCS_DONE 1 ++#define RELOCS_DONE 2 ++#define JMP_RELOCS_DONE 4 ++#define INIT_FUNCS_CALLED 8 ++ ++extern struct dyn_elf * _dl_symbol_tables; ++extern struct elf_resolve * _dl_loaded_modules; ++extern struct dyn_elf * _dl_handles; ++ ++extern struct elf_resolve * _dl_check_hashed_files(const char * libname); ++extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname, ++ char * loadaddr, unsigned long * dynamic_info, ++ unsigned long dynamic_addr, unsigned long dynamic_size); ++ ++enum caller_type{symbolrel=0,copyrel=1,resolver=2}; ++extern char * _dl_find_hash(const char * name, struct dyn_elf * rpnt1, ++ struct elf_resolve * f_tpnt, enum caller_type); ++ ++extern int _dl_linux_dynamic_link(void); ++ ++extern char * _dl_library_path; ++extern char * _dl_not_lazy; ++extern unsigned long _dl_elf_hash(const char * name); ++ ++static inline int _dl_symbol(char * name) ++{ ++ if(name[0] != '_' || name[1] != 'd' || name[2] != 'l' || name[3] != '_') ++ return 0; ++ return 1; ++} ++ ++ ++#define LD_ERROR_NOFILE 1 ++#define LD_ERROR_NOZERO 2 ++#define LD_ERROR_NOTELF 3 ++#define LD_ERROR_NOTMAGIC 4 ++#define LD_ERROR_NOTDYN 5 ++#define LD_ERROR_MMAP_FAILED 6 ++#define LD_ERROR_NODYNAMIC 7 ++#define LD_WRONG_RELOCS 8 ++#define LD_BAD_HANDLE 9 ++#define LD_NO_SYMBOL 10 ++ ++ ++ ++#endif /* _LD_HASH_H_ */ ++ ++ +diff -urN uClibc/ldso-0.9.24/include/ld_string.h uClibc.ldso.24/ldso-0.9.24/include/ld_string.h +--- uClibc/ldso-0.9.24/include/ld_string.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/ld_string.h 2003-09-29 16:46:00.000000000 -0500 +@@ -0,0 +1,281 @@ ++#ifndef _LINUX_STRING_H_ ++#define _LINUX_STRING_H_ ++ ++extern void *_dl_malloc(int size); ++extern char *_dl_getenv(const char *symbol, char **envp); ++extern void _dl_unsetenv(const char *symbol, char **envp); ++extern char *_dl_strdup(const char *string); ++extern void _dl_dprintf(int, const char *, ...); ++ ++ ++static size_t _dl_strlen(const char * str); ++static char *_dl_strcat(char *dst, const char *src); ++static char * _dl_strcpy(char * dst,const char *src); ++static int _dl_strcmp(const char * s1,const char * s2); ++static int _dl_strncmp(const char * s1,const char * s2,size_t len); ++static char * _dl_strchr(const char * str,int c); ++static char *_dl_strrchr(const char *str, int c); ++static char *_dl_strstr(const char *s1, const char *s2); ++static void * _dl_memcpy(void * dst, const void * src, size_t len); ++static int _dl_memcmp(const void * s1,const void * s2,size_t len); ++static void *_dl_memset(void * str,int c,size_t len); ++static char *_dl_get_last_path_component(char *path); ++static char *_dl_simple_ltoa(char * local, unsigned long i); ++static char *_dl_simple_ltoahex(char * local, unsigned long i); ++ ++#ifndef NULL ++#define NULL ((void *) 0) ++#endif ++ ++static inline size_t _dl_strlen(const char * str) ++{ ++ register char *ptr = (char *) str; ++ ++ while (*ptr) ++ ptr++; ++ return (ptr - str); ++} ++ ++static inline char *_dl_strcat(char *dst, const char *src) ++{ ++ register char *ptr = dst; ++ ++ while (*ptr) ++ ptr++; ++ ++ while (*src) ++ *ptr++ = *src++; ++ *ptr = '\0'; ++ ++ return dst; ++} ++ ++static inline char * _dl_strcpy(char * dst,const char *src) ++{ ++ register char *ptr = dst; ++ ++ while (*src) ++ *dst++ = *src++; ++ *dst = '\0'; ++ ++ return ptr; ++} ++ ++static inline int _dl_strcmp(const char * s1,const char * s2) ++{ ++ register unsigned char c1, c2; ++ ++ do { ++ c1 = (unsigned char) *s1++; ++ c2 = (unsigned char) *s2++; ++ if (c1 == '\0') ++ return c1 - c2; ++ } ++ while (c1 == c2); ++ ++ return c1 - c2; ++} ++ ++static inline int _dl_strncmp(const char * s1,const char * s2,size_t len) ++{ ++ register unsigned char c1 = '\0'; ++ register unsigned char c2 = '\0'; ++ ++ while (len > 0) { ++ c1 = (unsigned char) *s1++; ++ c2 = (unsigned char) *s2++; ++ if (c1 == '\0' || c1 != c2) ++ return c1 - c2; ++ len--; ++ } ++ ++ return c1 - c2; ++} ++ ++static inline char * _dl_strchr(const char * str,int c) ++{ ++ register char ch; ++ ++ do { ++ if ((ch = *str) == c) ++ return (char *) str; ++ str++; ++ } ++ while (ch); ++ ++ return 0; ++} ++ ++static inline char *_dl_strrchr(const char *str, int c) ++{ ++ register char *prev = 0; ++ register char *ptr = (char *) str; ++ ++ while (*ptr != '\0') { ++ if (*ptr == c) ++ prev = ptr; ++ ptr++; ++ } ++ if (c == '\0') ++ return(ptr); ++ return(prev); ++} ++ ++ ++static inline char *_dl_strstr(const char *s1, const char *s2) ++{ ++ register const char *s = s1; ++ register const char *p = s2; ++ ++ do { ++ if (!*p) { ++ return (char *) s1;; ++ } ++ if (*p == *s) { ++ ++p; ++ ++s; ++ } else { ++ p = s2; ++ if (!*s) { ++ return NULL; ++ } ++ s = ++s1; ++ } ++ } while (1); ++} ++ ++static inline void * _dl_memcpy(void * dst, const void * src, size_t len) ++{ ++ register char *a = dst; ++ register const char *b = src; ++ ++ while (len--) ++ *a++ = *b++; ++ ++ return dst; ++} ++ ++ ++static inline int _dl_memcmp(const void * s1,const void * s2,size_t len) ++{ ++ unsigned char *c1 = (unsigned char *)s1; ++ unsigned char *c2 = (unsigned char *)s2; ++ ++ while (len--) { ++ if (*c1 != *c2) ++ return *c1 - *c2; ++ c1++; ++ c2++; ++ } ++ return 0; ++} ++ ++static inline void * _dl_memset(void * str,int c,size_t len) ++{ ++ register char *a = str; ++ ++ while (len--) ++ *a++ = c; ++ ++ return str; ++} ++ ++static inline char *_dl_get_last_path_component(char *path) ++{ ++ char *s; ++ register char *ptr = path; ++ register char *prev = 0; ++ ++ while (*ptr) ++ ptr++; ++ s = ptr - 1; ++ ++ /* strip trailing slashes */ ++ while (s != path && *s == '/') { ++ *s-- = '\0'; ++ } ++ ++ /* find last component */ ++ ptr = path; ++ while (*ptr != '\0') { ++ if (*ptr == '/') ++ prev = ptr; ++ ptr++; ++ } ++ s = prev; ++ ++ if (s == NULL || s[1] == '\0') ++ return path; ++ else ++ return s+1; ++} ++ ++/* Early on, we can't call printf, so use this to print out ++ * numbers using the SEND_STDERR() macro */ ++static inline char *_dl_simple_ltoa(char * local, unsigned long i) ++{ ++ /* 21 digits plus null terminator, good for 64-bit or smaller ints */ ++ char *p = &local[22]; ++ *p-- = '\0'; ++ do { ++ *p-- = '0' + i % 10; ++ i /= 10; ++ } while (i > 0); ++ return p + 1; ++} ++ ++static inline char *_dl_simple_ltoahex(char * local, unsigned long i) ++{ ++ /* 21 digits plus null terminator, good for 64-bit or smaller ints */ ++ char *p = &local[22]; ++ *p-- = '\0'; ++ do { ++ char temp = i % 0x10; ++ if (temp <= 0x09) ++ *p-- = '0' + temp; ++ else ++ *p-- = 'a' - 0x0a + temp; ++ i /= 0x10; ++ } while (i > 0); ++ *p-- = 'x'; ++ *p-- = '0'; ++ return p + 1; ++} ++ ++ ++#if defined(mc68000) || defined(__arm__) || defined(__mips__) || defined(__sh__) || defined(__powerpc__) ++/* On some arches constant strings are referenced through the GOT. */ ++/* XXX Requires load_addr to be defined. */ ++#define SEND_STDERR(X) \ ++ { const char *__s = (X); \ ++ if (__s < (const char *) load_addr) __s += load_addr; \ ++ _dl_write (2, __s, _dl_strlen (__s)); \ ++ } ++#else ++#define SEND_STDERR(X) _dl_write(2, X, _dl_strlen(X)); ++#endif ++ ++#define SEND_ADDRESS_STDERR(X, add_a_newline) { \ ++ char tmp[22], *tmp1; \ ++ _dl_memset(tmp, 0, sizeof(tmp)); \ ++ tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \ ++ _dl_write(2, tmp1, _dl_strlen(tmp1)); \ ++ if (add_a_newline) { \ ++ tmp[0]='\n'; \ ++ _dl_write(2, tmp, 1); \ ++ } \ ++}; ++ ++#define SEND_NUMBER_STDERR(X, add_a_newline) { \ ++ char tmp[22], *tmp1; \ ++ _dl_memset(tmp, 0, sizeof(tmp)); \ ++ tmp1=_dl_simple_ltoa( tmp, (unsigned long)(X)); \ ++ _dl_write(2, tmp1, _dl_strlen(tmp1)); \ ++ if (add_a_newline) { \ ++ tmp[0]='\n'; \ ++ _dl_write(2, tmp, 1); \ ++ } \ ++}; ++ ++ ++#endif +diff -urN uClibc/ldso-0.9.24/include/ld_syscall.h uClibc.ldso.24/ldso-0.9.24/include/ld_syscall.h +--- uClibc/ldso-0.9.24/include/ld_syscall.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/ld_syscall.h 2003-08-19 01:05:30.000000000 -0500 +@@ -0,0 +1,157 @@ ++#ifndef _LD_SYSCALL_H_ ++#define _LD_SYSCALL_H_ ++ ++/* Pull in the arch specific syscall implementation */ ++#include ++/* For MAP_ANONYMOUS -- differs between platforms */ ++#include ++/* Pull in whatever this particular arch's kernel thinks the kernel version of ++ * struct stat should look like. It turns out that each arch has a different ++ * opinion on the subject, and different kernel revs use different names... */ ++#define kernel_stat stat ++#include ++ ++ ++/* Encoding of the file mode. */ ++#define S_IFMT 0170000 /* These bits determine file type. */ ++ ++/* File types. */ ++#define S_IFDIR 0040000 /* Directory. */ ++#define S_IFCHR 0020000 /* Character device. */ ++#define S_IFBLK 0060000 /* Block device. */ ++#define S_IFREG 0100000 /* Regular file. */ ++#define S_IFIFO 0010000 /* FIFO. */ ++#define S_IFLNK 0120000 /* Symbolic link. */ ++#define S_IFSOCK 0140000 /* Socket. */ ++ ++/* Protection bits. */ ++ ++#define S_ISUID 04000 /* Set user ID on execution. */ ++#define S_ISGID 02000 /* Set group ID on execution. */ ++#define S_ISVTX 01000 /* Save swapped text after use (sticky). */ ++#define S_IREAD 0400 /* Read by owner. */ ++#define S_IWRITE 0200 /* Write by owner. */ ++#define S_IEXEC 0100 /* Execute by owner. */ ++ ++ ++/* Here are the definitions for some syscalls that are used ++ by the dynamic linker. The idea is that we want to be able ++ to call these before the errno symbol is dynamicly linked, so ++ we use our own version here. Note that we cannot assume any ++ dynamic linking at all, so we cannot return any error codes. ++ We just punt if there is an error. */ ++ ++ ++#define __NR__dl_exit __NR_exit ++static inline _syscall1(void, _dl_exit, int, status); ++ ++ ++#define __NR__dl_close __NR_close ++static inline _syscall1(int, _dl_close, int, fd); ++ ++ ++#if defined(__powerpc__) || defined(__mips__) || defined(__sh__) ++/* PowerPC, MIPS and SuperH have a different calling convention for mmap(). */ ++#define __NR__dl_mmap __NR_mmap ++static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length, ++ int, prot, int, flags, int, fd, off_t, offset); ++#else ++#define __NR__dl_mmap_real __NR_mmap ++static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer); ++ ++static inline void * _dl_mmap(void * addr, unsigned long size, int prot, ++ int flags, int fd, unsigned long offset) ++{ ++ unsigned long buffer[6]; ++ ++ buffer[0] = (unsigned long) addr; ++ buffer[1] = (unsigned long) size; ++ buffer[2] = (unsigned long) prot; ++ buffer[3] = (unsigned long) flags; ++ buffer[4] = (unsigned long) fd; ++ buffer[5] = (unsigned long) offset; ++ return (void *) _dl_mmap_real(buffer); ++} ++#endif ++ ++#ifndef _dl_MAX_ERRNO ++#define _dl_MAX_ERRNO 4096 ++#endif ++#define _dl_mmap_check_error(__res) \ ++ (((int)__res) < 0 && ((int)__res) >= -_dl_MAX_ERRNO) ++#ifndef MAP_ANONYMOUS ++#ifdef __sparc__ ++#define MAP_ANONYMOUS 0x20 ++#else ++#error MAP_ANONYMOUS not defined and suplementary value not known ++#endif ++#endif ++ ++ ++#define __NR__dl_open __NR_open ++#define O_RDONLY 0x0000 ++#define O_WRONLY 01 ++#define O_RDWR 02 ++#define O_CREAT 0100 /* not fcntl */ ++static inline _syscall2(int, _dl_open, const char *, fn, int, flags); ++ ++#define __NR__dl_write __NR_write ++static inline _syscall3(unsigned long, _dl_write, int, fd, ++ const void *, buf, unsigned long, count); ++ ++ ++#define __NR__dl_read __NR_read ++static inline _syscall3(unsigned long, _dl_read, int, fd, ++ const void *, buf, unsigned long, count); ++ ++#define __NR__dl_mprotect __NR_mprotect ++static inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot); ++ ++ ++ ++#define __NR__dl_stat __NR_stat ++static inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf); ++ ++ ++#define __NR__dl_munmap __NR_munmap ++static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length); ++ ++#define __NR__dl_getuid __NR_getuid ++static inline _syscall0(uid_t, _dl_getuid); ++ ++#define __NR__dl_geteuid __NR_geteuid ++static inline _syscall0(uid_t, _dl_geteuid); ++ ++#define __NR__dl_getgid __NR_getgid ++static inline _syscall0(gid_t, _dl_getgid); ++ ++#define __NR__dl_getegid __NR_getegid ++static inline _syscall0(gid_t, _dl_getegid); ++ ++#define __NR__dl_getpid __NR_getpid ++static inline _syscall0(gid_t, _dl_getpid); ++ ++/* ++ * Not an actual syscall, but we need something in assembly to say whether ++ * this is OK or not. ++ */ ++static inline int _dl_suid_ok(void) ++{ ++ uid_t uid, euid, gid, egid; ++ ++ uid = _dl_getuid(); ++ euid = _dl_geteuid(); ++ gid = _dl_getgid(); ++ egid = _dl_getegid(); ++ ++ if(uid == euid && gid == egid) ++ return 1; ++ else ++ return 0; ++} ++ ++#define __NR__dl_readlink __NR_readlink ++static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz); ++ ++#endif /* _LD_SYSCALL_H_ */ ++ +diff -urN uClibc/ldso-0.9.24/include/ldso.h uClibc.ldso.24/ldso-0.9.24/include/ldso.h +--- uClibc/ldso-0.9.24/include/ldso.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/include/ldso.h 2003-08-19 01:05:30.000000000 -0500 +@@ -0,0 +1,11 @@ ++#include ++/* Pull in compiler and arch stuff */ ++#include ++#include ++/* Pull in the arch specific type information */ ++#include ++/* Now the ldso specific headers */ ++#include ++#include ++#include ++#include +diff -urN uClibc/ldso-0.9.24/ldso/.cvsignore uClibc.ldso.24/ldso-0.9.24/ldso/.cvsignore +--- uClibc/ldso-0.9.24/ldso/.cvsignore 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/.cvsignore 2003-08-19 01:05:31.000000000 -0500 +@@ -0,0 +1,2 @@ ++ld-uclibc.so* ++_dl_progname.h +diff -urN uClibc/ldso-0.9.24/ldso/Makefile uClibc.ldso.24/ldso-0.9.24/ldso/Makefile +--- uClibc/ldso-0.9.24/ldso/Makefile 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/Makefile 2004-03-01 02:58:58.000000000 -0600 +@@ -0,0 +1,101 @@ ++# Makefile for uClibc ++# ++# Copyright (C) 2000 by Lineo, inc. ++# Copyright (C) 2000-2002 Erik Andersen ++# ++# This program is free software; you can redistribute it and/or modify it under ++# the terms of the GNU Library 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 Library General Public License for more ++# details. ++# ++# You should have received a copy of the GNU Library 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 ++# ++# Derived in part from the Linux-8086 C library, the GNU C Library, and several ++# other sundry sources. Files within this library are copyright by their ++# respective copyright holders. ++ ++ ++TOPDIR=../../ ++include $(TOPDIR)Rules.mak ++LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ++ ++ ++XXFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \ ++ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ ++ -fno-builtin -nostdinc -I$(TOPDIR)ldso-0.9.24/include -I. -I$(TOPDIR)include ++ ++ifeq ($(SUPPORT_LD_DEBUG),y) ++XXFLAGS=$(XWARNINGS) $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \ ++ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ ++ -fno-builtin -nostdinc -I$(TOPDIR)ldso-0.9.24/include -I. -I$(TOPDIR)include ++# Not really much point in including debugging info, since gdb ++# can't really debug ldso, since gdb requires help from ldso to ++# debug things.... ++XXFLAGS+=-Os #-g3 ++endif ++ ++# BEWARE!!! At least mips* will die if -O0 is used!!! ++XXFLAGS :=$(XXFLAGS:-O0=-O1) ++ ++XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp") ++LDFLAGS=$(CPU_LDFLAGS-y) -shared --warn-common --export-dynamic --sort-common \ ++ -z combreloc --discard-locals --discard-all --no-undefined ++ ++CSRC= ldso.c #hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c ++COBJS=$(patsubst %.c,%.o, $(CSRC)) ++ASRC=$(shell ls $(TARGET_ARCH)/*.S) ++AOBJS=$(patsubst %.S,%.o, $(ASRC)) ++OBJS=$(AOBJS) $(COBJS) ++ ++ifneq ($(strip $(SUPPORT_LD_DEBUG)),y) ++LDFLAGS+=-s ++endif ++ ++ifeq ($(strip $(SUPPORT_LD_DEBUG)),y) ++XXFLAGS+=-D__SUPPORT_LD_DEBUG__ ++endif ++ ++ifeq ($(strip $(SUPPORT_LD_DEBUG_EARLY)),y) ++XXFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__ ++endif ++ ++ifeq ($(strip $(FORCE_SHAREABLE_TEXT_SEGMENTS)),y) ++XXFLAGS+=-DFORCE_SHAREABLE_TEXT_SEGMENTS ++endif ++ ++#This stuff will not work with -fomit-frame-pointer ++XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=) ++ ++all: lib ++ ++lib:: _dl_progname.h $(OBJS) $(DLINK_OBJS) ++ $(LD) $(LDFLAGS) -e _dl_boot -soname=$(UCLIBC_LDSO) \ ++ -o $(LDSO_FULLNAME) $(OBJS) $(LIBGCC); ++ $(INSTALL) -d $(TOPDIR)lib ++ $(INSTALL) -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib ++ $(LN) -sf $(LDSO_FULLNAME) $(TOPDIR)lib/$(UCLIBC_LDSO) ++ ++_dl_progname.h: Makefile ++ echo "const char *_dl_progname=\""$(UCLIBC_LDSO)"\";" > _dl_progname.h ++ echo "#include \"$(TARGET_ARCH)/elfinterp.c\"" >> _dl_progname.h ++ ++ ++$(COBJS): %.o : %.c ++ $(CC) $(XXFLAGS) -I../libdl -c $< -o $@ ++ $(STRIPTOOL) -x -R .note -R .comment $*.o ++ ++$(AOBJS): %.o : %.S ++ $(CC) $(XXFLAGS) -I../libdl -c $< -o $@ ++ $(STRIPTOOL) -x -R .note -R .comment $*.o ++ ++ldso.o: ldso.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c _dl_progname.h ++ ++clean: ++ $(RM) $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i _dl_progname.h ldso.h *~ +diff -urN uClibc/ldso-0.9.24/ldso/arm/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/arm/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/arm/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/arm/boot1_arch.h 2002-11-13 18:53:49.000000000 -0600 +@@ -0,0 +1,30 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. */ ++ ++/* Overrive the default _dl_boot function, and replace it with a bit of asm. ++ * Then call the real _dl_boot function, which is now named _dl_boot2. */ ++ ++asm("" \ ++" .text\n" \ ++" .globl _dl_boot\n" \ ++"_dl_boot:\n" \ ++" mov r7, sp\n" \ ++" @ldr r0, [sp], #4\n" \ ++" mov r0, sp\n" \ ++" bl _dl_boot2\n" \ ++" mov r6, r0\n" \ ++" mov r0, r7\n" \ ++" mov pc, r6\n" \ ++); ++ ++#define _dl_boot _dl_boot2 ++#define LD_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X) ++ ++ ++ /* It seems ARM needs an offset here */ ++#undef ELFMAGIC ++#define ELFMAGIC ELFMAG+load_addr ++ ++ ++ +diff -urN uClibc/ldso-0.9.24/ldso/arm/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/arm/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/arm/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/arm/elfinterp.c 2002-11-07 21:20:59.000000000 -0600 +@@ -0,0 +1,462 @@ ++/* vi: set sw=4 ts=4: */ ++/* ARM ELF shared library loader suppport ++ * ++ * Copyright (C) 2001-2002, Erik Andersen ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes_tab[] = ++{ ++ [0] "R_ARM_NONE", "R_ARM_PC24", "R_ARM_ABS32", "R_ARM_REL32", ++ [4] "R_ARM_PC13", "R_ARM_ABS16", "R_ARM_ABS12", "R_ARM_THM_ABS5", ++ [8] "R_ARM_ABS8", "R_ARM_SBREL32","R_ARM_THM_PC22", "R_ARM_THM_PC8", ++ [12] "R_ARM_AMP_VCALL9", "R_ARM_SWI24", "R_ARM_THM_SWI8", "R_ARM_XPC25", ++ [16] "R_ARM_THM_XPC22", ++ [20] "R_ARM_COPY", "R_ARM_GLOB_DAT","R_ARM_JUMP_SLOT", "R_ARM_RELATIVE", ++ [24] "R_ARM_GOTOFF", "R_ARM_GOTPC", "R_ARM_GOT32", "R_ARM_PLT32", ++ [32] "R_ARM_ALU_PCREL_7_0","R_ARM_ALU_PCREL_15_8","R_ARM_ALU_PCREL_23_15","R_ARM_LDR_SBREL_11_0", ++ [36] "R_ARM_ALU_SBREL_19_12","R_ARM_ALU_SBREL_27_20", ++ [100] "R_ARM_GNU_VTENTRY","R_ARM_GNU_VTINHERIT","R_ARM_THM_PC11","R_ARM_THM_PC9", ++ [249] "R_ARM_RXPC25", "R_ARM_RSBREL32", "R_ARM_THM_RPC22", "R_ARM_RREL32", ++ [253] "R_ARM_RABS22", "R_ARM_RPC24", "R_ARM_RBASE", ++}; ++ ++static const char * ++_dl_reltypes(int type) ++{ ++ static char buf[22]; ++ const char *str; ++ ++ if (type >= (sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) || ++ NULL == (str = _dl_reltypes_tab[type])) ++ { ++ str =_dl_simple_ltoa( buf, (unsigned long)(type)); ++ } ++ return str; ++} ++ ++static ++void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index) ++{ ++ if(_dl_debug_symbols) ++ { ++ if(symtab_index){ ++ _dl_dprintf(_dl_debug_file, "\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_value, ++ symtab[symtab_index].st_size, ++ symtab[symtab_index].st_info, ++ symtab[symtab_index].st_other, ++ symtab[symtab_index].st_shndx); ++ } ++ } ++} ++ ++static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt) ++{ ++ if(_dl_debug_reloc) ++ { ++ int symtab_index; ++ const char *sym; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0"; ++ ++#ifdef ELF_USES_RELOCA ++ _dl_dprintf(_dl_debug_file, "\n%s\toffset=%x\taddend=%x %s", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ rpnt->r_addend, ++ sym); ++#else ++ _dl_dprintf(_dl_debug_file, "\n%s\toffset=%x %s", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ sym); ++#endif ++ } ++} ++#endif ++ ++/* Program to load an ELF binary on a linux system, and run it. ++ References to symbols in sharable libraries can be resolved by either ++ an ELF sharable library or a linux style of shared library. */ ++ ++/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have ++ I ever taken any courses on internals. This program was developed using ++ information available through the book "UNIX SYSTEM V RELEASE 4, ++ Programmers guide: Ansi C and Programming Support Tools", which did ++ a more than adequate job of explaining everything required to get this ++ working. */ ++ ++extern int _dl_linux_resolve(void); ++ ++unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) ++{ ++ int reloc_type; ++ ELF_RELOC *this_reloc; ++ char *strtab; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rel_addr; ++ int symtab_index; ++ char *new_addr; ++ char **got_addr; ++ unsigned long instr_addr; ++ ++ rel_addr = (ELF_RELOC *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr); ++ ++ this_reloc = rel_addr + (reloc_entry >> 3); ++ reloc_type = ELF32_R_TYPE(this_reloc->r_info); ++ symtab_index = ELF32_R_SYM(this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ ++ if (reloc_type != R_ARM_JUMP_SLOT) { ++ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n", ++ _dl_progname); ++ _dl_exit(1); ++ }; ++ ++ /* Address of jump instruction to fix up */ ++ instr_addr = ((unsigned long) this_reloc->r_offset + ++ (unsigned long) tpnt->loadaddr); ++ got_addr = (char **) instr_addr; ++ ++ /* Get the address of the GOT entry */ ++ new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name, ++ tpnt->symbol_scope, tpnt, resolver); ++ if (!new_addr) { ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ _dl_exit(1); ++ }; ++#if defined (__SUPPORT_LD_DEBUG__) ++ if ((unsigned long) got_addr < 0x40000000) ++ { ++ if (_dl_debug_bindings) ++ { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", ++ strtab + symtab[symtab_index].st_name); ++ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, ++ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr); ++ } ++ } ++ if (!_dl_debug_nofixups) { ++ *got_addr = new_addr; ++ } ++#else ++ *got_addr = new_addr; ++#endif ++ ++ return (unsigned long) new_addr; ++} ++ ++static int ++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, ++ unsigned long rel_addr, unsigned long rel_size, ++ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)) ++{ ++ int i; ++ char *strtab; ++ int goof = 0; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rpnt; ++ int symtab_index; ++ /* Now parse the relocation information */ ++ ++ rpnt = (ELF_RELOC *) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof(ELF_RELOC); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) { ++ int res; ++ ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ ++ /* When the dynamic linker bootstrapped itself, it resolved some symbols. ++ Make sure we do not do them again */ ++ if (!symtab_index && tpnt->libtype == program_interpreter) ++ continue; ++ if (symtab_index && tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab,strtab,symtab_index); ++ debug_reloc(symtab,strtab,rpnt); ++#endif ++ ++ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab); ++ ++ if (res==0) continue; ++ ++ _dl_dprintf(2, "\n%s: ",_dl_progname); ++ ++ if (symtab_index) ++ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); ++ ++ if (res <0) ++ { ++ int reloc_type = ELF32_R_TYPE(rpnt->r_info); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); ++#else ++ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); ++#endif ++ _dl_exit(-res); ++ } ++ else if (res >0) ++ { ++ _dl_dprintf(2, "can't resolve symbol\n"); ++ goof += res; ++ } ++ } ++ return goof; ++} ++ ++static unsigned long ++fix_bad_pc24 (unsigned long *const reloc_addr, unsigned long value) ++{ ++ static void *fix_page; ++ static unsigned int fix_offset; ++ unsigned int *fix_address; ++ if (! fix_page) ++ { ++ fix_page = _dl_mmap (NULL, 4096 , PROT_READ | PROT_WRITE | PROT_EXEC, ++ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ++ fix_offset = 0; ++ } ++ ++ fix_address = (unsigned int *)(fix_page + fix_offset); ++ fix_address[0] = 0xe51ff004; /* ldr pc, [pc, #-4] */ ++ fix_address[1] = value; ++ ++ fix_offset += 8; ++ if (fix_offset >= 4096) ++ fix_page = NULL; ++ ++ return (unsigned long)fix_address; ++} ++ ++static int ++_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ int goof = 0; ++ ++ reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ ++ if (symtab_index) { ++ ++ symbol_addr = (unsigned long) _dl_find_hash(strtab + symtab[symtab_index].st_name, ++ scope, (reloc_type == R_ARM_JUMP_SLOT ? tpnt : NULL), symbolrel); ++ ++ /* ++ * We want to allow undefined references to weak symbols - this might ++ * have been intentional. We should not be linking local symbols ++ * here, so all bases should be covered. ++ */ ++ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) { ++ goof++; ++ } ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ { ++ unsigned long old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_ARM_NONE: ++ break; ++ case R_ARM_ABS32: ++ *reloc_addr += symbol_addr; ++ break; ++ case R_ARM_PC24: ++ { ++ unsigned long addend; ++ long newvalue, topbits; ++ ++ addend = *reloc_addr & 0x00ffffff; ++ if (addend & 0x00800000) addend |= 0xff000000; ++ ++ newvalue = symbol_addr - (unsigned long)reloc_addr + (addend << 2); ++ topbits = newvalue & 0xfe000000; ++ if (topbits != 0xfe000000 && topbits != 0x00000000) ++ { ++ newvalue = fix_bad_pc24(reloc_addr, symbol_addr) ++ - (unsigned long)reloc_addr + (addend << 2); ++ topbits = newvalue & 0xfe000000; ++ if (topbits != 0xfe000000 && topbits != 0x00000000) ++ { ++ _dl_dprintf(2,"symbol '%s': R_ARM_PC24 relocation out of range.", ++ symtab[symtab_index].st_name); ++ _dl_exit(1); ++ } ++ } ++ newvalue >>= 2; ++ symbol_addr = (*reloc_addr & 0xff000000) | (newvalue & 0x00ffffff); ++ *reloc_addr = symbol_addr; ++ break; ++ } ++ case R_ARM_GLOB_DAT: ++ case R_ARM_JUMP_SLOT: ++ *reloc_addr = symbol_addr; ++ break; ++ case R_ARM_RELATIVE: ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ break; ++ case R_ARM_COPY: ++#if 0 ++ /* Do this later */ ++ _dl_dprintf(2, "Doing copy for symbol "); ++ if (symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name); ++ _dl_dprintf(2, "\n"); ++ _dl_memcpy((void *) symtab[symtab_index].st_value, ++ (void *) symbol_addr, symtab[symtab_index].st_size); ++#endif ++ break; ++ default: ++ return -1; /*call _dl_exit(1) */ ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++ } ++ ++#endif ++ ++ return goof; ++} ++ ++static int ++_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ unsigned long *reloc_addr; ++ ++ reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ { ++ unsigned long old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_ARM_NONE: ++ break; ++ case R_ARM_JUMP_SLOT: ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ break; ++ default: ++ return -1; /*call _dl_exit(1) */ ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++ } ++ ++#endif ++ return 0; ++ ++} ++ ++/* This is done as a separate step, because there are cases where ++ information is first copied and later initialized. This results in ++ the wrong information being copied. Someone at Sun was complaining about ++ a bug in the handling of _COPY by SVr4, and this may in fact be what he ++ was talking about. Sigh. */ ++ ++/* No, there are cases where the SVr4 linker fails to emit COPY relocs ++ at all */ ++static int ++_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ int goof = 0; ++ ++ reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ if (reloc_type != R_ARM_COPY) ++ return 0; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ ++ if (symtab_index) { ++ ++ symbol_addr = (unsigned long) _dl_find_hash(strtab + ++ symtab[symtab_index].st_name, scope, ++ NULL, copyrel); ++ if (!symbol_addr) goof++; ++ } ++ if (!goof) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_move) ++ _dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_size, ++ symbol_addr, symtab[symtab_index].st_value); ++#endif ++ _dl_memcpy((char *) symtab[symtab_index].st_value, ++ (char *) symbol_addr, symtab[symtab_index].st_size); ++ } ++ ++ return goof; ++} ++ ++void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); ++} ++ ++int _dl_parse_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc); ++} ++ ++int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy); ++} ++ +diff -urN uClibc/ldso-0.9.24/ldso/arm/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/arm/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/arm/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/arm/ld_syscalls.h 2003-09-09 01:11:11.000000000 -0500 +@@ -0,0 +1,19 @@ ++/* Define the __set_errno macro as nothing so that INLINE_SYSCALL ++ * won't set errno, which is important since we make system calls ++ * before the errno symbol is dynamicly linked. */ ++ ++#define __set_errno(X) {(void)(X);} ++ ++/* Prepare for the case that `__builtin_expect' is not available. */ ++#if __GNUC__ == 2 && __GNUC_MINOR__ < 96 ++#define __builtin_expect(x, expected_value) (x) ++#endif ++#ifndef likely ++# define likely(x) __builtin_expect((!!(x)),1) ++#endif ++#ifndef unlikely ++# define unlikely(x) __builtin_expect((!!(x)),0) ++#endif ++ ++#include "sys/syscall.h" ++ +diff -urN uClibc/ldso-0.9.24/ldso/arm/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/arm/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/arm/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/arm/ld_sysdep.h 2002-08-09 09:41:04.000000000 -0500 +@@ -0,0 +1,124 @@ ++/* ++ * Various assmbly language/system dependent hacks that are required ++ * so that we can minimize the amount of platform specific code. ++ */ ++ ++/* ++ * Define this if the system uses RELOCA. ++ */ ++#undef ELF_USES_RELOCA ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long*) ARGS) ++ ++/* ++ * Initialization sequence for a GOT. ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++{ \ ++ GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ ++ GOT_BASE[1] = (unsigned long) MODULE; \ ++} ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. RELP is the relocation that we ++ * are performing, REL is the pointer to the address we are relocating. ++ * SYMBOL is the symbol involved in the relocation, and LOAD is the ++ * load address. ++ */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ switch(ELF32_R_TYPE((RELP)->r_info)){ \ ++ case R_ARM_ABS32: \ ++ *REL += SYMBOL; \ ++ break; \ ++ case R_ARM_PC24: \ ++ { long newvalue, topbits; \ ++ unsigned long addend = *REL & 0x00ffffff; \ ++ if (addend & 0x00800000) addend |= 0xff000000; \ ++ newvalue=SYMBOL-(unsigned long)REL+(addend<<2); \ ++ topbits = newvalue & 0xfe000000; \ ++ if (topbits!=0xfe000000&&topbits!=0x00000000){ \ ++ newvalue = fix_bad_pc24(REL, SYMBOL) \ ++ -(unsigned long)REL+(addend<<2); \ ++ topbits = newvalue & 0xfe000000; \ ++ if (topbits!=0xfe000000&&topbits!=0x00000000){ \ ++ SEND_STDERR("R_ARM_PC24 relocation out of range\n");\ ++ _dl_exit(1); } } \ ++ newvalue>>=2; \ ++ SYMBOL=(*REL&0xff000000)|(newvalue & 0x00ffffff); \ ++ *REL=SYMBOL; \ ++ } \ ++ break; \ ++ case R_ARM_GLOB_DAT: \ ++ case R_ARM_JUMP_SLOT: \ ++ *REL = SYMBOL; \ ++ break; \ ++ case R_ARM_RELATIVE: \ ++ *REL += (unsigned long) LOAD; \ ++ break; \ ++ case R_ARM_NONE: \ ++ break; \ ++ default: \ ++ SEND_STDERR("Aiieeee!"); \ ++ _dl_exit(1); \ ++ } ++ ++ ++/* ++ * Transfer control to the user's application, once the dynamic loader ++ * is done. This routine has to exit the current function, then ++ * call the _dl_elf_main function. ++ */ ++ ++#define START() return _dl_elf_main; ++ ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++ ++#define MAGIC1 EM_ARM ++#undef MAGIC2 ++/* Used for error messages */ ++#define ELF_TARGET "ARM" ++ ++struct elf_resolve; ++unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); ++ ++static inline unsigned long arm_modulus(unsigned long m, unsigned long p) { ++ unsigned long i,t,inc; ++ i=p; t=0; ++ while(!(i&(1<<31))) { ++ i<<=1; ++ t++; ++ } ++ t--; ++ for(inc=t;inc>2;inc--) { ++ i=p<=i) { ++ m-=i; ++ i<<=1; ++ if(i&(1<<31)) ++ break; ++ if(i=p) { ++ m-=p; ++ } ++ return m; ++} ++ ++#define do_rem(result, n, base) result=arm_modulus(n,base); ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/arm/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/arm/resolve.S +--- uClibc/ldso-0.9.24/ldso/arm/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/arm/resolve.S 2002-08-12 04:03:30.000000000 -0500 +@@ -0,0 +1,43 @@ ++/* ++ * This function is _not_ called directly. It is jumped to (so no return ++ * address is on the stack) when attempting to use a symbol that has not yet ++ * been resolved. The first time a jump symbol (such as a function call inside ++ * a shared library) is used (before it gets resolved) it will jump here to ++ * _dl_linux_resolve. When we get called the stack looks like this: ++ * reloc_entry ++ * tpnt ++ * ++ * This function saves all the registers, puts a copy of reloc_entry and tpnt ++ * on the stack (as function arguments) then make the function call ++ * _dl_linux_resolver(tpnt, reloc_entry). _dl_linux_resolver() figures out ++ * where the jump symbol is _really_ supposed to have jumped to and returns ++ * that to us. Once we have that, we overwrite tpnt with this fixed up ++ * address. We then clean up after ourselves, put all the registers back how we ++ * found them, then we jump to the fixed up address, which is where the jump ++ * symbol that got us here really wanted to jump to in the first place. ++ * -Erik Andersen ++ */ ++ ++#define sl r10 ++#define fp r11 ++#define ip r12 ++ ++.text ++.globl _dl_linux_resolve ++.type _dl_linux_resolve,%function ++.align 4; ++ ++_dl_linux_resolve: ++ stmdb sp!, {r0, r1, r2, r3, sl, fp} ++ sub r1, ip, lr ++ sub r1, r1, #4 ++ add r1, r1, r1 ++ ldr r0, [lr, #-4] ++ mov r3,r0 ++ ++ bl _dl_linux_resolver ++ ++ mov ip, r0 ++ ldmia sp!, {r0, r1, r2, r3, sl, fp, lr} ++ mov pc,ip ++.size _dl_linux_resolve, .-_dl_linux_resolve +diff -urN uClibc/ldso-0.9.24/ldso/cris/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/cris/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/cris/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/cris/boot1_arch.h 2003-09-19 07:11:43.000000000 -0500 +@@ -0,0 +1,17 @@ ++/* ++ * This code fix the stack pointer so that the dynamic linker ++ * can find argc, argv and auxvt (Auxillary Vector Table). ++ */ ++asm("" \ ++" .text\n" \ ++" .globl _dl_boot\n" \ ++" .type _dl_boot,@function\n" \ ++"_dl_boot:\n" \ ++" move.d $sp,$r10\n" \ ++" move.d $pc,$r9\n" \ ++" add.d _dl_boot2 - ., $r9\n" \ ++" jsr $r9\n" \ ++); ++ ++#define _dl_boot _dl_boot2 ++#define LD_BOOT(X) static void * __attribute__ ((unused)) _dl_boot(X) +diff -urN uClibc/ldso-0.9.24/ldso/cris/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/cris/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/cris/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/cris/elfinterp.c 2003-09-30 06:51:11.000000000 -0500 +@@ -0,0 +1,414 @@ ++/* ++ * CRIS ELF shared library loader support. ++ * ++ * Program to load an elf binary on a linux system, and run it. ++ * References to symbols in sharable libraries can be resolved ++ * by either an ELF sharable library or a linux style of shared ++ * library. ++ * ++ * Copyright (C) 2002, Axis Communications AB ++ * All rights reserved ++ * ++ * Author: Tobias Anderberg, ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++/* Support for the LD_DEBUG variable. */ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes_tab[] = { ++ [0] "R_CRIS_NONE", "R_CRIS_8", "R_CRIS_16", "R_CRIS_32", ++ [4] "R_CRIS_8_PCREL", "R_CRIS_16_PCREL", "R_CRIS_32_PCREL", "R_CRIS_GNU_VTINHERIT", ++ [8] "R_CRIS_GNU_VTENTRY", "R_CRIS_COPY", "R_CRIS_GLOB_DAT", "R_CRIS_JUMP_SLOT", ++ [16] "R_CRIS_RELATIVE", "R_CRIS_16_GOT", "R_CRIS_32_GOT", "R_CRIS_16_GOTPLT", ++ [32] "R_CRIS_32_GOTPLT", "R_CRIS_32_GOTREL", "R_CRIS_32_PLT_GOTREL", "R_CRIS_32_PLT_PCREL", ++ ++}; ++ ++ ++static const char * ++_dl_reltypes(int type) ++{ ++ const char *str; ++ static char buf[22]; ++ ++ if (type >= (sizeof(_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) || ++ NULL == (str = _dl_reltypes_tab[type])) ++ str = _dl_simple_ltoa(buf, (unsigned long) (type)); ++ ++ return str; ++} ++ ++static void ++debug_sym(Elf32_Sym *symtab, char *strtab, int symtab_index) ++{ ++ if (_dl_debug_symbols) { ++ if (symtab_index) { ++ _dl_dprintf(_dl_debug_file, ++ "\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_value, ++ symtab[symtab_index].st_size, ++ symtab[symtab_index].st_info, ++ symtab[symtab_index].st_other, ++ symtab[symtab_index].st_shndx); ++ } ++ } ++} ++ ++static void ++debug_reloc(Elf32_Sym *symtab, char *strtab, ELF_RELOC *rpnt) ++{ ++ if (_dl_debug_reloc) { ++ int symtab_index; ++ const char *sym; ++ ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0"; ++ ++ if (_dl_debug_symbols) ++ _dl_dprintf(_dl_debug_file, "\n\t"); ++ else ++ _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym); ++ ++#ifdef ELF_USES_RELOCA ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ rpnt->r_addend); ++#else ++ _dl_dprintf(_dl_debug_file, "%s\toffset%x\n", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset); ++#endif ++ } ++} ++#endif /* __SUPPORT_LD_DEBUG__ */ ++ ++/* Defined in resolve.S. */ ++extern int _dl_linux_resolv(void); ++ ++unsigned long ++_dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) ++{ ++ int reloc_type; ++ int symtab_index; ++ char *strtab; ++ char *symname; ++ char *new_addr; ++ char *rel_addr; ++ char **got_addr; ++ Elf32_Sym *symtab; ++ ELF_RELOC *this_reloc; ++ unsigned long instr_addr; ++ ++ rel_addr = (char *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr); ++ ++ this_reloc = (ELF_RELOC *) (intptr_t)(rel_addr + reloc_entry); ++ reloc_type = ELF32_R_TYPE(this_reloc->r_info); ++ symtab_index = ELF32_R_SYM(this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *) (intptr_t)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (reloc_type != R_CRIS_JUMP_SLOT) { ++ _dl_dprintf(2, "%s: Incorrect relocation type for jump relocations.\n", ++ _dl_progname); ++ _dl_exit(1); ++ } ++ ++ /* Fetch the address of the jump instruction to fix up. */ ++ instr_addr = ((unsigned long) this_reloc->r_offset + (unsigned long) tpnt->loadaddr); ++ got_addr = (char **) instr_addr; ++ ++ /* Fetch the address of the GOT entry. */ ++ new_addr = _dl_find_hash(symname, tpnt->symbol_scope, tpnt, resolver); ++ ++ if (!new_addr) { ++ new_addr = _dl_find_hash(symname, NULL, NULL, resolver); ++ ++ if (new_addr) ++ return (unsigned long) new_addr; ++ ++ _dl_dprintf(2, "%s: Can't resolv symbol '%s'\n", _dl_progname, symname); ++ _dl_exit(1); ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if (_dl_debug_bindings) { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname); ++ ++ if (_dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr); ++ } ++#endif ++ ++ *got_addr = new_addr; ++ return (unsigned long) new_addr; ++} ++ ++static int ++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, unsigned long rel_addr, ++ unsigned long rel_size, int (*reloc_fnc)(struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)) ++{ ++ int symtab_index; ++ int res; ++ unsigned int i; ++ char *strtab; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rpnt; ++ ++ /* Parse the relocation information. */ ++ rpnt = (ELF_RELOC *) (intptr_t) (rel_addr + tpnt->loadaddr); ++ rel_size /= sizeof(ELF_RELOC); ++ ++ symtab = (Elf32_Sym *) (intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) { ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ ++ /* ++ * Make sure the same symbols that the linker resolved when it ++ * bootstapped itself isn't resolved again. ++ */ ++ if (!symtab_index && tpnt->libtype == program_interpreter) ++ continue; ++ ++ if (symtab_index && tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab, strtab, symtab_index); ++ debug_reloc(symtab, strtab, rpnt); ++#endif ++ ++ /* Pass over to actual relocation function. */ ++ res = reloc_fnc(tpnt, scope, rpnt, symtab, strtab); ++ ++ if (res == 0) ++ continue; ++ ++ _dl_dprintf(2, "\n%s: ", _dl_progname); ++ ++ if (symtab_index) ++ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); ++ ++ if (res < 0) { ++ int reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "can't handle relocation type '%s'\n", _dl_reltypes(reloc_type)); ++#else ++ _dl_dprintf(2, "can't handle relocation type %x\n", reloc_type); ++#endif ++ _dl_exit(-res); ++ } ++ else if (res > 0) { ++ _dl_dprintf(2, "can't resolv symbol\n"); ++ return res; ++ } ++ } ++ ++ return 0; ++} ++ ++static int ++_dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rpnt, ++ Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ char *symname; ++ unsigned long *reloc_addr; ++ unsigned symbol_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ ++ reloc_addr = (unsigned long *)(intptr_t)(tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ if (symtab[symtab_index].st_shndx != SHN_UNDEF && ++ ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_LOCAL) { ++ symbol_addr = (unsigned long) tpnt->loadaddr; ++ } ++ else { ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, ++ (reloc_type == R_CRIS_JUMP_SLOT ? tpnt : NULL), symbolrel); ++ } ++ ++ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s'\n", ++ symname, tpnt->libname); ++#endif ++ return 0; ++ } ++ ++ symbol_addr += rpnt->r_addend; ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ ++ switch (reloc_type) { ++ case R_CRIS_NONE: ++ break; ++ case R_CRIS_GLOB_DAT: ++ case R_CRIS_JUMP_SLOT: ++ case R_CRIS_32: ++ case R_CRIS_COPY: ++ *reloc_addr = symbol_addr; ++ break; ++ case R_CRIS_RELATIVE: ++ *reloc_addr = (unsigned long) tpnt->loadaddr + rpnt->r_addend; ++ break; ++ default: ++ return -1; /* Call _dl_exit(1). */ ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if (_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ ++ return 0; ++} ++ ++static int ++_dl_do_lazy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rpnt, ++ Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ unsigned long *reloc_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ ++ /* Don't care about these, just keep the compiler happy. */ ++ (void) scope; ++ (void) symtab; ++ (void) strtab; ++ ++ reloc_addr = (unsigned long *)(intptr_t)(tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ ++ switch (reloc_type) { ++ case R_CRIS_NONE: ++ break; ++ case R_CRIS_JUMP_SLOT: ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ break; ++ default: ++ return -1; /* Calls _dl_exit(1). */ ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if (_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ ++ return 0; ++} ++ ++static int ++_dl_do_copy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rpnt, ++ Elf32_Sym *symtab, char *strtab) ++{ ++ int goof; ++ int reloc_type; ++ int symtab_index; ++ char *symname; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++ if (reloc_type != R_CRIS_COPY) ++ return 0; ++ ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ goof = 0; ++ ++ if (symtab_index) { ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel); ++ ++ if (!symbol_addr) ++ goof++; ++ } ++ ++ if (!goof) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if (_dl_debug_move) ++ _dl_dprintf(_dl_debug_file, "\n%s move %x bytes from %x to %x", ++ symname, symtab[symtab_index].st_size, symbol_addr, symtab[symtab_index].st_value); ++#endif ++ _dl_memcpy((char *) symtab[symtab_index].st_value, ++ (char *) symbol_addr, symtab[symtab_index].st_size); ++ } ++ ++ return goof; ++} ++ ++/* External interface to the generic part of the dynamic linker. */ ++ ++int ++_dl_parse_relocation_information(struct elf_resolve *tpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ /* Keep the compiler happy. */ ++ (void) type; ++ return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc); ++} ++void ++_dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ /* Keep the compiler happy. */ ++ (void) type; ++ _dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); ++} ++ ++int ++_dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ /* Keep the compiler happy. */ ++ (void) type; ++ return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy_reloc); ++} +diff -urN uClibc/ldso-0.9.24/ldso/cris/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/cris/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/cris/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/cris/ld_syscalls.h 2002-09-23 05:37:16.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* ++ * Define the __set_errno macro as nothing so that INLINE_SYSCALL ++ * won't set errno, which is important since we make system calls ++ * before the errno symbol is dynamicly linked. ++ */ ++#define __set_errno(X) {(void)(X);} ++#include "sys/syscall.h" +diff -urN uClibc/ldso-0.9.24/ldso/cris/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/cris/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/cris/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/cris/ld_sysdep.h 2003-08-27 07:59:23.000000000 -0500 +@@ -0,0 +1,112 @@ ++/* CRIS can never use Elf32_Rel relocations. */ ++#define ELF_USES_RELOCA ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *) ARGS) ++ ++/* ++ * Initialization sequence for a GOT. ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++{ \ ++ GOT_BASE[1] = (unsigned long) MODULE; \ ++ GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ ++} ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. RELP is the relocation that we ++ * are performing, REL is the pointer to the address we are relocating. ++ * SYMBOL is the symbol involved in the relocation, and LOAD is the ++ * load address. ++ */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP, REL, SYMBOL, LOAD) \ ++ switch (ELF32_R_TYPE((RELP)->r_info)) { \ ++ case R_CRIS_GLOB_DAT: \ ++ case R_CRIS_JUMP_SLOT: \ ++ case R_CRIS_32: \ ++ *REL = SYMBOL; \ ++ break; \ ++ case R_CRIS_16_PCREL: \ ++ *(short *) *REL = SYMBOL + (RELP)->r_addend - *REL - 2; \ ++ break; \ ++ case R_CRIS_32_PCREL: \ ++ *REL = SYMBOL + (RELP)->r_addend - *REL - 4; \ ++ break; \ ++ case R_CRIS_NONE: \ ++ break; \ ++ case R_CRIS_RELATIVE: \ ++ *REL = (unsigned long) LOAD + (RELP)->r_addend; \ ++ break; \ ++ default: \ ++ _dl_exit(1); \ ++ break; \ ++ } ++ ++/* ++ * Transfer control to the user's application once the dynamic loader ++ * is done. This routine has to exit the current function, then call ++ * _dl_elf_main. ++ */ ++#define START() __asm__ volatile ("moveq 0,$r8\n\t" \ ++ "move $r8,$srp\n\t" \ ++ "move.d %1,$sp\n\t" \ ++ "jump %0\n\t" \ ++ : : "r" (_dl_elf_main), "r" (args)) ++ ++/* Defined some magic numbers that this ld.so should accept. */ ++#define MAGIC1 EM_CRIS ++#undef MAGIC2 ++#define ELF_TARGET "CRIS" ++ ++struct elf_resolve; ++extern unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry); ++ ++/* Cheap modulo implementation, taken from arm/ld_sysdep.h. */ ++static inline unsigned long ++cris_mod(unsigned long m, unsigned long p) ++{ ++ unsigned long i, t, inc; ++ ++ i = p; ++ t = 0; ++ ++ while (!(i & (1 << 31))) { ++ i <<= 1; ++ t++; ++ } ++ ++ t--; ++ ++ for (inc = t; inc > 2; inc--) { ++ i = p << inc; ++ ++ if (i & (1 << 31)) ++ break; ++ ++ while (m >= i) { ++ m -= i; ++ i <<= 1; ++ if (i & (1 << 31)) ++ break; ++ if (i < p) ++ break; ++ } ++ } ++ ++ while (m >= p) ++ m -= p; ++ ++ return m; ++} ++ ++#define do_rem(result, n, base) result = cris_mod(n, base); ++ ++/* 8192 bytes alignment */ ++#define PAGE_ALIGN 0xffffe000 ++#define ADDR_ALIGN 0x1fff ++#define OFFS_ALIGN 0xffffe000 +diff -urN uClibc/ldso-0.9.24/ldso/cris/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/cris/resolve.S +--- uClibc/ldso-0.9.24/ldso/cris/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/cris/resolve.S 2002-09-16 03:11:43.000000000 -0500 +@@ -0,0 +1,48 @@ ++/* ++ * This function is _not_ called directly. It is jumped to from PLT when ++ * attempting to use a symbol that has not yet been resolved. The first ++ * time a jump symbol (such as a function call inside a shared library) ++ * is used (before it gets resolved) it will jump here. When we get called ++ * the stack contains reloc_offset and tpnt is in MOF. ++ * ++ * We save all the registers, setup R10 and R11 with the right arguments ++ * then call _dl_linux_resolver(tpnt, reloc_offset). _dl_linux_resolver() ++ * figures out where the jump symbol is _really_ supposed to have jumped to ++ * and returns that to us. Once we have that, we overwrite tpnt with this ++ * fixed up address. We then clean up after ourselves, put all the registers ++ * back how we found them, then we jump to where the fixed up address, which ++ * is where the jump symbol that got us here really wanted to jump to in the ++ * first place. ++ */ ++ ++.globl _dl_linux_resolve ++.type _dl_linux_resolve,@function ++ ++_dl_linux_resolve: ++ push $r13 ++ push $r12 ++ push $r11 ++ push $r10 ++ push $r9 ++ push $srp ++ move.d [$sp+6*4],$r11 ++ move $mof,$r10 ++#ifdef __PIC__ ++ move.d $pc,$r0 ++ sub.d .:GOTOFF,$r0 ++ move.d _dl_linux_resolver:PLTG,$r9 ++ add.d $r0,$r9 ++ jsr $r9 ++#else ++ jsr _dl_linux_resolver ++#endif ++ move.d $r10,[$sp+6*4] ++ pop $srp ++ pop $r9 ++ pop $r10 ++ pop $r11 ++ pop $r12 ++ pop $r13 ++ jump [$sp+] ++ ++ .size _dl_linux_resolve, . - _dl_linux_resolve +diff -urN uClibc/ldso-0.9.24/ldso/hash.c uClibc.ldso.24/ldso-0.9.24/ldso/hash.c +--- uClibc/ldso-0.9.24/ldso/hash.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/hash.c 2003-08-19 08:11:06.000000000 -0500 +@@ -0,0 +1,327 @@ ++/* vi: set sw=4 ts=4: */ ++/* Program to load an ELF binary on a linux system, and run it ++ * after resolving ELF shared library symbols ++ * ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, ++ * David Engel, Hongjiu Lu and Mitch D'Souza ++ * Copyright (C) 2001-2002, Erik Andersen ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++ ++/* Various symbol table handling functions, including symbol lookup */ ++ ++/* ++ * This is the start of the linked list that describes all of the files present ++ * in the system with pointers to all of the symbol, string, and hash tables, ++ * as well as all of the other good stuff in the binary. ++ */ ++ ++struct elf_resolve *_dl_loaded_modules = NULL; ++ ++/* ++ * This is the list of modules that are loaded when the image is first ++ * started. As we add more via dlopen, they get added into other ++ * chains. ++ */ ++struct dyn_elf *_dl_symbol_tables = NULL; ++ ++/* ++ * This is the list of modules that are loaded via dlopen. We may need ++ * to search these for RTLD_GLOBAL files. ++ */ ++struct dyn_elf *_dl_handles = NULL; ++ ++ ++/* ++ * This is the hash function that is used by the ELF linker to generate ++ * the hash table that each executable and library is required to ++ * have. We need it to decode the hash table. ++ */ ++ ++unsigned long _dl_elf_hash(const char *name) ++{ ++ unsigned long hash = 0; ++ unsigned long tmp; ++ ++ while (*name) { ++ hash = (hash << 4) + *name++; ++ if ((tmp = hash & 0xf0000000)) ++ hash ^= tmp >> 24; ++ hash &= ~tmp; ++ }; ++ return hash; ++} ++ ++/* ++ * Check to see if a library has already been added to the hash chain. ++ */ ++struct elf_resolve *_dl_check_hashed_files(const char *libname) ++{ ++ struct elf_resolve *tpnt; ++ int len = _dl_strlen(libname); ++ ++ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { ++ if (_dl_strncmp(tpnt->libname, libname, len) == 0 && ++ (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.')) ++ return tpnt; ++ } ++ ++ return NULL; ++} ++ ++/* ++ * We call this function when we have just read an ELF library or executable. ++ * We add the relevant info to the symbol chain, so that we can resolve all ++ * externals properly. ++ */ ++ ++struct elf_resolve *_dl_add_elf_hash_table(const char *libname, ++ char *loadaddr, unsigned long *dynamic_info, unsigned long dynamic_addr, ++ unsigned long dynamic_size) ++{ ++ unsigned long *hash_addr; ++ struct elf_resolve *tpnt; ++ int i; ++ ++ if (!_dl_loaded_modules) { ++ tpnt = _dl_loaded_modules = ++ (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve)); ++ _dl_memset(tpnt, 0, sizeof(struct elf_resolve)); ++ } else { ++ tpnt = _dl_loaded_modules; ++ while (tpnt->next) ++ tpnt = tpnt->next; ++ tpnt->next = (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve)); ++ _dl_memset(tpnt->next, 0, sizeof(struct elf_resolve)); ++ tpnt->next->prev = tpnt; ++ tpnt = tpnt->next; ++ }; ++ ++ tpnt->next = NULL; ++ tpnt->init_flag = 0; ++ tpnt->libname = _dl_strdup(libname); ++ tpnt->dynamic_addr = (ElfW(Dyn) *)dynamic_addr; ++ tpnt->dynamic_size = dynamic_size; ++ tpnt->libtype = loaded_file; ++ ++ if (dynamic_info[DT_HASH] != 0) { ++ hash_addr = (unsigned long *) (intptr_t)(dynamic_info[DT_HASH] + loadaddr); ++ tpnt->nbucket = *hash_addr++; ++ tpnt->nchain = *hash_addr++; ++ tpnt->elf_buckets = hash_addr; ++ hash_addr += tpnt->nbucket; ++ tpnt->chains = hash_addr; ++ } ++ tpnt->loadaddr = (ElfW(Addr))loadaddr; ++ for (i = 0; i < 24; i++) ++ tpnt->dynamic_info[i] = dynamic_info[i]; ++#ifdef __mips__ ++ { ++ Elf32_Dyn *dpnt = (Elf32_Dyn *) dynamic_addr; ++ ++ while(dpnt->d_tag) { ++ if (dpnt->d_tag == DT_MIPS_GOTSYM) ++ tpnt->mips_gotsym = dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) ++ tpnt->mips_local_gotno = dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_MIPS_SYMTABNO) ++ tpnt->mips_symtabno = dpnt->d_un.d_val; ++ dpnt++; ++ } ++ } ++#endif ++ return tpnt; ++} ++ ++ ++/* ++ * This function resolves externals, and this is either called when we process ++ * relocations or when we call an entry in the PLT table for the first time. ++ */ ++ ++char *_dl_find_hash(const char *name, struct dyn_elf *rpnt1, ++ struct elf_resolve *f_tpnt, enum caller_type caller_type) ++{ ++ struct elf_resolve *tpnt; ++ int si; ++ char *pnt; ++ int pass; ++ char *strtab; ++ Elf32_Sym *symtab; ++ unsigned long elf_hash_number, hn; ++ char *weak_result; ++ struct elf_resolve *first_def; ++ struct dyn_elf *rpnt, first; ++ char *data_result = 0; /* nakao */ ++ ++ weak_result = 0; ++ elf_hash_number = _dl_elf_hash(name); ++ ++ /* A quick little hack to make sure that any symbol in the executable ++ will be preferred to one in a shared library. This is necessary so ++ that any shared library data symbols referenced in the executable ++ will be seen at the same address by the executable, shared libraries ++ and dynamically loaded code. -Rob Ryan (robr@cmu.edu) */ ++ if (_dl_symbol_tables && !caller_type && rpnt1) { ++ first = (*_dl_symbol_tables); ++ first.next = rpnt1; ++ rpnt1 = (&first); ++ } ++ ++ /* ++ * The passes are so that we can first search the regular symbols ++ * for whatever module was specified, and then search anything ++ * loaded with RTLD_GLOBAL. When pass is 1, it means we are just ++ * starting the first dlopened module, and anything above that ++ * is just the next one in the chain. ++ */ ++ for (pass = 0; (1 == 1); pass++) { ++ ++ /* ++ * If we are just starting to search for RTLD_GLOBAL, setup ++ * the pointer for the start of the search. ++ */ ++ if (pass == 1) { ++ rpnt1 = _dl_handles; ++ } ++ ++ /* ++ * Anything after this, we need to skip to the next module. ++ */ ++ else if (pass >= 2) { ++ rpnt1 = rpnt1->next_handle; ++ } ++ ++ /* ++ * Make sure we still have a module, and make sure that this ++ * module was loaded with RTLD_GLOBAL. ++ */ ++ if (pass != 0) { ++ if (rpnt1 == NULL) ++ break; ++ if ((rpnt1->flags & RTLD_GLOBAL) == 0) ++ continue; ++ } ++ ++ for (rpnt = (rpnt1 ? rpnt1 : _dl_symbol_tables); rpnt; rpnt = rpnt->next) { ++ tpnt = rpnt->dyn; ++ ++ /* ++ * The idea here is that if we are using dlsym, we want to ++ * first search the entire chain loaded from dlopen, and ++ * return a result from that if we found anything. If this ++ * fails, then we continue the search into the stuff loaded ++ * when the image was activated. For normal lookups, we start ++ * with rpnt == NULL, so we should never hit this. ++ */ ++ if (tpnt->libtype == elf_executable && weak_result != 0) { ++ break; ++ } ++ ++ /* ++ * Avoid calling .urem here. ++ */ ++ do_rem(hn, elf_hash_number, tpnt->nbucket); ++ symtab = (Elf32_Sym *) (intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ /* ++ * This crap is required because the first instance of a ++ * symbol on the chain will be used for all symbol references. ++ * Thus this instance must be resolved to an address that ++ * contains the actual function, ++ */ ++ ++ first_def = NULL; ++ ++ for (si = tpnt->elf_buckets[hn]; si; si = tpnt->chains[si]) { ++ pnt = strtab + symtab[si].st_name; ++ ++ if (_dl_strcmp(pnt, name) == 0 && ++ symtab[si].st_value != 0) ++ { ++ if ((ELF32_ST_TYPE(symtab[si].st_info) == STT_FUNC || ++ ELF32_ST_TYPE(symtab[si].st_info) == STT_NOTYPE || ++ ELF32_ST_TYPE(symtab[si].st_info) == STT_OBJECT) && ++ symtab[si].st_shndx != SHN_UNDEF) { ++ ++ /* Here we make sure that we find a module where the symbol is ++ * actually defined. ++ */ ++ ++ if (f_tpnt) { ++ if (!first_def) ++ first_def = tpnt; ++ if (first_def == f_tpnt ++ && symtab[si].st_shndx == 0) ++ continue; ++ } ++ ++ switch (ELF32_ST_BIND(symtab[si].st_info)) { ++ case STB_GLOBAL: ++ if (tpnt->libtype != elf_executable && ++ ELF32_ST_TYPE(symtab[si].st_info) ++ == STT_NOTYPE) ++ { /* nakao */ ++ data_result = (char *)tpnt->loadaddr + ++ symtab[si].st_value; /* nakao */ ++ break; /* nakao */ ++ } else /* nakao */ ++ return (char*)tpnt->loadaddr + symtab[si].st_value; ++ case STB_WEAK: ++ if (!weak_result) ++ weak_result = (char *)tpnt->loadaddr + symtab[si].st_value; ++ break; ++ default: /* Do local symbols need to be examined? */ ++ break; ++ } ++ } ++#ifndef __mips__ ++ /* ++ * References to the address of a function from an executable file and ++ * the shared objects associated with it might not resolve to the same ++ * value. To allow comparisons of function addresses we must resolve ++ * to the address of the plt entry of the executable instead of the ++ * real function address. ++ * see "TIS ELF Specification Version 1.2, Book 3, A-11 (Function ++ * Adresses) ++ */ ++ if (resolver != caller_type && ++ NULL==f_tpnt && /*trick: don't handle R_??_JMP_SLOT reloc type*/ ++ tpnt->libtype == elf_executable && ++ ELF32_ST_TYPE(symtab[si].st_info) == STT_FUNC && ++ symtab[si].st_shndx == SHN_UNDEF) ++ { ++ return (char*)symtab[si].st_value; ++ } ++#endif ++ } ++ } ++ } ++ } ++ if (data_result) ++ return data_result; /* nakao */ ++ return weak_result; ++} +diff -urN uClibc/ldso-0.9.24/ldso/i386/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/i386/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/i386/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/i386/boot1_arch.h 2002-08-08 09:35:31.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. See arm/boot1_arch.h for an example of what ++ * can be done. ++ */ ++ ++#define LD_BOOT(X) void _dl_boot (X) +diff -urN uClibc/ldso-0.9.24/ldso/i386/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/i386/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/i386/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/i386/elfinterp.c 2003-11-06 16:09:38.000000000 -0600 +@@ -0,0 +1,415 @@ ++/* vi: set sw=4 ts=4: */ ++/* i386 ELF shared library loader suppport ++ * ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, ++ * David Engel, Hongjiu Lu and Mitch D'Souza ++ * Copyright (C) 2001-2002, Erik Andersen ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes_tab[] = ++{ ++ [0] "R_386_NONE", "R_386_32", "R_386_PC32", "R_386_GOT32", ++ [4] "R_386_PLT32", "R_386_COPY", "R_386_GLOB_DAT", "R_386_JMP_SLOT", ++ [8] "R_386_RELATIVE", "R_386_GOTOFF", "R_386_GOTPC", ++}; ++ ++static const char * ++_dl_reltypes(int type) ++{ ++ static char buf[22]; ++ const char *str; ++ ++ if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) || ++ NULL == (str = _dl_reltypes_tab[type])) ++ { ++ str =_dl_simple_ltoa( buf, (unsigned long)(type)); ++ } ++ return str; ++} ++ ++static ++void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index) ++{ ++ if(_dl_debug_symbols) ++ { ++ if(symtab_index){ ++ _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_value, ++ symtab[symtab_index].st_size, ++ symtab[symtab_index].st_info, ++ symtab[symtab_index].st_other, ++ symtab[symtab_index].st_shndx); ++ } ++ } ++} ++ ++static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt) ++{ ++ if(_dl_debug_reloc) ++ { ++ int symtab_index; ++ const char *sym; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0"; ++ ++ if(_dl_debug_symbols) ++ _dl_dprintf(_dl_debug_file, "\n\t"); ++ else ++ _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym); ++#ifdef ELF_USES_RELOCA ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ rpnt->r_addend); ++#else ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset); ++#endif ++ } ++} ++#endif ++ ++/* Program to load an ELF binary on a linux system, and run it. ++ References to symbols in sharable libraries can be resolved by either ++ an ELF sharable library or a linux style of shared library. */ ++ ++/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have ++ I ever taken any courses on internals. This program was developed using ++ information available through the book "UNIX SYSTEM V RELEASE 4, ++ Programmers guide: Ansi C and Programming Support Tools", which did ++ a more than adequate job of explaining everything required to get this ++ working. */ ++ ++extern int _dl_linux_resolve(void); ++ ++unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) ++{ ++ int reloc_type; ++ ELF_RELOC *this_reloc; ++ char *strtab; ++ Elf32_Sym *symtab; ++ int symtab_index; ++ char *rel_addr; ++ char *new_addr; ++ char **got_addr; ++ unsigned long instr_addr; ++ char *symname; ++ ++ rel_addr = (char *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr); ++ ++ this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry); ++ reloc_type = ELF32_R_TYPE(this_reloc->r_info); ++ symtab_index = ELF32_R_SYM(this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ symname= strtab + symtab[symtab_index].st_name; ++ ++ if (reloc_type != R_386_JMP_SLOT) { ++ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n", ++ _dl_progname); ++ _dl_exit(1); ++ } ++ ++ /* Address of jump instruction to fix up */ ++ instr_addr = ((unsigned long) this_reloc->r_offset + ++ (unsigned long) tpnt->loadaddr); ++ got_addr = (char **) instr_addr; ++ ++ /* Get the address of the GOT entry */ ++ new_addr = _dl_find_hash(symname, tpnt->symbol_scope, tpnt, resolver); ++ if (!new_addr) { ++ new_addr = _dl_find_hash(symname, NULL, NULL, resolver); ++ if (new_addr) { ++ return (unsigned long) new_addr; ++ } ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); ++ _dl_exit(1); ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if ((unsigned long) got_addr < 0x40000000) ++ { ++ if (_dl_debug_bindings) ++ { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname); ++ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, ++ "\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr); ++ } ++ } ++ if (!_dl_debug_nofixups) { ++ *got_addr = new_addr; ++ } ++#else ++ *got_addr = new_addr; ++#endif ++ ++ return (unsigned long) new_addr; ++} ++ ++static int ++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, ++ unsigned long rel_addr, unsigned long rel_size, ++ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)) ++{ ++ unsigned int i; ++ char *strtab; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rpnt; ++ int symtab_index; ++ ++ /* Now parse the relocation information */ ++ rpnt = (ELF_RELOC *)(intptr_t) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof(ELF_RELOC); ++ ++ symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) { ++ int res; ++ ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ ++ /* When the dynamic linker bootstrapped itself, it resolved some symbols. ++ Make sure we do not do them again */ ++ if (!symtab_index && tpnt->libtype == program_interpreter) ++ continue; ++ if (symtab_index && tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab,strtab,symtab_index); ++ debug_reloc(symtab,strtab,rpnt); ++#endif ++ ++ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab); ++ ++ if (res==0) continue; ++ ++ _dl_dprintf(2, "\n%s: ",_dl_progname); ++ ++ if (symtab_index) ++ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); ++ ++ if (res <0) ++ { ++ int reloc_type = ELF32_R_TYPE(rpnt->r_info); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); ++#else ++ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); ++#endif ++ _dl_exit(-res); ++ } ++ else if (res >0) ++ { ++ _dl_dprintf(2, "can't resolve symbol\n"); ++ return res; ++ } ++ } ++ return 0; ++} ++ ++ ++static int ++_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ char *symname; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, ++ (reloc_type == R_386_JMP_SLOT ? tpnt : NULL), symbolrel); ++ ++ /* ++ * We want to allow undefined references to weak symbols - this might ++ * have been intentional. We should not be linking local symbols ++ * here, so all bases should be covered. ++ */ ++ ++ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s'\n", ++ symname, tpnt->libname); ++#endif ++ return 0; ++ } ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_386_NONE: ++ break; ++ case R_386_32: ++ *reloc_addr += symbol_addr; ++ break; ++ case R_386_PC32: ++ *reloc_addr += symbol_addr - (unsigned long) reloc_addr; ++ break; ++ case R_386_GLOB_DAT: ++ case R_386_JMP_SLOT: ++ *reloc_addr = symbol_addr; ++ break; ++ case R_386_RELATIVE: ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ break; ++ case R_386_COPY: ++ /* handled later on */ ++ break; ++ default: ++ return -1; /*call _dl_exit(1) */ ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ ++ return 0; ++} ++ ++static int ++_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ unsigned long *reloc_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ (void)scope; ++ (void)symtab; ++ (void)strtab; ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_386_NONE: ++ break; ++ case R_386_JMP_SLOT: ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ break; ++ default: ++ return -1; /*call _dl_exit(1) */ ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ return 0; ++ ++} ++ ++/* This is done as a separate step, because there are cases where ++ information is first copied and later initialized. This results in ++ the wrong information being copied. Someone at Sun was complaining about ++ a bug in the handling of _COPY by SVr4, and this may in fact be what he ++ was talking about. Sigh. */ ++ ++/* No, there are cases where the SVr4 linker fails to emit COPY relocs ++ at all */ ++static int ++_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ int goof = 0; ++ char *symname; ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ if (reloc_type != R_386_COPY) ++ return 0; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel); ++ if (!symbol_addr) goof++; ++ } ++ if (!goof) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_move) ++ _dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x", ++ symname, symtab[symtab_index].st_size, ++ symbol_addr, symtab[symtab_index].st_value); ++#endif ++ _dl_memcpy((char *) symtab[symtab_index].st_value, ++ (char *) symbol_addr, symtab[symtab_index].st_size); ++ } ++ ++ return goof; ++} ++ ++void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void) type; ++ (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); ++} ++ ++int _dl_parse_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void) type; ++ return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc); ++} ++ ++int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ (void) type; ++ return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy); ++} ++ +diff -urN uClibc/ldso-0.9.24/ldso/i386/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/i386/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/i386/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/i386/ld_syscalls.h 2002-08-09 07:20:21.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* Define the __set_errno macro as nothing so that INLINE_SYSCALL ++ * won't set errno, which is important since we make system calls ++ * before the errno symbol is dynamicly linked. */ ++ ++#define __set_errno(X) {(void)(X);} ++#include "sys/syscall.h" ++ +diff -urN uClibc/ldso-0.9.24/ldso/i386/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/i386/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/i386/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/i386/ld_sysdep.h 2002-05-28 16:33:32.000000000 -0500 +@@ -0,0 +1,81 @@ ++/* ++ * Various assmbly language/system dependent hacks that are required ++ * so that we can minimize the amount of platform specific code. ++ */ ++ ++/* ++ * Define this if the system uses RELOCA. ++ */ ++#undef ELF_USES_RELOCA ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long*) & ARGS) ++ ++/* ++ * Initialization sequence for a GOT. ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++{ \ ++ GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ ++ GOT_BASE[1] = (unsigned long) MODULE; \ ++} ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. RELP is the relocation that we ++ * are performing, REL is the pointer to the address we are relocating. ++ * SYMBOL is the symbol involved in the relocation, and LOAD is the ++ * load address. ++ */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ switch(ELF32_R_TYPE((RELP)->r_info)){ \ ++ case R_386_32: \ ++ *REL += SYMBOL; \ ++ break; \ ++ case R_386_PC32: \ ++ *REL += SYMBOL - (unsigned long) REL; \ ++ break; \ ++ case R_386_GLOB_DAT: \ ++ case R_386_JMP_SLOT: \ ++ *REL = SYMBOL; \ ++ break; \ ++ case R_386_RELATIVE: \ ++ *REL += (unsigned long) LOAD; \ ++ break; \ ++ default: \ ++ _dl_exit(1); \ ++ } ++ ++ ++/* ++ * Transfer control to the user's application, once the dynamic loader ++ * is done. This routine has to exit the current function, then ++ * call the _dl_elf_main function. ++ */ ++#define START() \ ++ __asm__ volatile ("leave\n\t" \ ++ "jmp *%%eax\n\t" \ ++ : "=a" (status) : "a" (_dl_elf_main)) ++ ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++ ++#define MAGIC1 EM_386 ++#undef MAGIC2 ++/* Used for error messages */ ++#define ELF_TARGET "386" ++ ++struct elf_resolve; ++extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); ++ ++#define do_rem(result, n, base) result = (n % base) ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/i386/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/i386/resolve.S +--- uClibc/ldso-0.9.24/ldso/i386/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/i386/resolve.S 2001-06-14 16:51:51.000000000 -0500 +@@ -0,0 +1,52 @@ ++/* ++ * This function is _not_ called directly. It is jumped to (so no return ++ * address is on the stack) when attempting to use a symbol that has not yet ++ * been resolved. The first time a jump symbol (such as a function call inside ++ * a shared library) is used (before it gets resolved) it will jump here to ++ * _dl_linux_resolve. When we get called the stack looks like this: ++ * reloc_entry ++ * tpnt ++ * ++ * This function saves all the registers, puts a copy of reloc_entry and tpnt ++ * on the stack (as function arguments) then make the function call ++ * _dl_linux_resolver(tpnt, reloc_entry). _dl_linux_resolver() figures out ++ * where the jump symbol is _really_ supposed to have jumped to and returns ++ * that to us. Once we have that, we overwrite tpnt with this fixed up ++ * address. We then clean up after ourselves, put all the registers back how we ++ * found them, then we jump to where the fixed up address, which is where the ++ * jump symbol that got us here really wanted to jump to in the first place. ++ * found them, then we jump to the fixed up address, which is where the jump ++ * symbol that got us here really wanted to jump to in the first place. ++ * -Erik Andersen ++ */ ++ ++.text ++.align 4 ++ ++.globl _dl_linux_resolve ++.type _dl_linux_resolve,@function ++ ++_dl_linux_resolve: ++ pusha /* preserve all regs */ ++ lea 0x20(%esp),%eax /* eax = tpnt and reloc_entry params */ ++ pushl 4(%eax) /* push copy of reloc_entry param */ ++ pushl (%eax) /* push copy of tpnt param */ ++ ++#ifdef __PIC__ ++ call .L24 ++.L24: ++ popl %ebx ++ addl $_GLOBAL_OFFSET_TABLE_+[.-.L24],%ebx ++ movl _dl_linux_resolver@GOT(%ebx),%ebx /* eax = resolved func */ ++ call *%ebx ++#else ++ call _dl_linux_resolver ++#endif ++ movl %eax,0x28(%esp) /* store func addr over original ++ * tpnt param */ ++ addl $0x8,%esp /* remove copy parameters */ ++ popa /* restore regs */ ++ ret $4 /* jump to func removing original ++ * reloc_entry param from stack */ ++.LFE2: ++ .size _dl_linux_resolve,.LFE2-_dl_linux_resolve +diff -urN uClibc/ldso-0.9.24/ldso/ldso.c uClibc.ldso.24/ldso-0.9.24/ldso/ldso.c +--- uClibc/ldso-0.9.24/ldso/ldso.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/ldso.c 2003-12-05 14:24:26.000000000 -0600 +@@ -0,0 +1,1296 @@ ++/* vi: set sw=4 ts=4: */ ++/* Program to load an ELF binary on a linux system, and run it ++ * after resolving ELF shared library symbols ++ * ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, ++ * David Engel, Hongjiu Lu and Mitch D'Souza ++ * Copyright (C) 2001-2002, Erik Andersen ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++// Support a list of library preloads in /etc/ld.so.preload ++//#define SUPPORT_LDSO_PRELOAD_FILE ++ ++ ++/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have ++ I ever taken any courses on internals. This program was developed using ++ information available through the book "UNIX SYSTEM V RELEASE 4, ++ Programmers guide: Ansi C and Programming Support Tools", which did ++ a more than adequate job of explaining everything required to get this ++ working. */ ++ ++/* ++ * The main trick with this program is that initially, we ourselves are ++ * not dynamicly linked. This means that we cannot access any global ++ * variables or call any functions. No globals initially, since the ++ * Global Offset Table (GOT) is initialized by the linker assuming a ++ * virtual address of 0, and no function calls initially since the ++ * Procedure Linkage Table (PLT) is not yet initialized. ++ * ++ * There are additional initial restrictions - we cannot use large ++ * switch statements, since the compiler generates tables of addresses ++ * and jumps through them. We can use inline functions, because these ++ * do not transfer control to a new address, but they must be static so ++ * that they are not exported from the modules. We cannot use normal ++ * syscall stubs, because these all reference the errno global variable ++ * which is not yet initialized. We can use all of the local stack ++ * variables that we want. ++ * ++ * Life is further complicated by the fact that initially we do not ++ * want to do a complete dynamic linking. We want to allow the user to ++ * supply new functions to override symbols (i.e. weak symbols and/or ++ * LD_PRELOAD). So initially, we only perform relocations for ++ * variables that start with "_dl_" since ANSI specifies that the user ++ * is not supposed to redefine any of these variables. ++ * ++ * Fortunately, the linker itself leaves a few clues lying around, and ++ * when the kernel starts the image, there are a few further clues. ++ * First of all, there is Auxiliary Vector Table information sitting on ++ * which is provided to us by the kernel, and which includes ++ * information about the load address that the program interpreter was ++ * loaded at, the number of sections, the address the application was ++ * loaded at and so forth. Here this information is stored in the ++ * array auxvt. For details see linux/fs/binfmt_elf.c where it calls ++ * NEW_AUX_ENT() a bunch of time.... ++ * ++ * Next, we need to find the GOT. On most arches there is a register ++ * pointing to the GOT, but just in case (and for new ports) I've added ++ * some (slow) C code to locate the GOT for you. ++ * ++ * This code was originally written for SVr4, and there the kernel ++ * would load all text pages R/O, so they needed to call mprotect a ++ * zillion times to mark all text pages as writable so dynamic linking ++ * would succeed. Then when they were done, they would change the ++ * protections for all the pages back again. Well, under Linux ++ * everything is loaded writable (since Linux does copy on write ++ * anyways) so all the mprotect stuff has been disabled. ++ * ++ * Initially, we do not have access to _dl_malloc since we can't yet ++ * make function calls, so we mmap one page to use as scratch space. ++ * Later on, when we can call _dl_malloc we reuse this this memory. ++ * This is also beneficial, since we do not want to use the same memory ++ * pool as malloc anyway - esp if the user redefines malloc to do ++ * something funky. ++ * ++ * Our first task is to perform a minimal linking so that we can call ++ * other portions of the dynamic linker. Once we have done this, we ++ * then build the list of modules that the application requires, using ++ * LD_LIBRARY_PATH if this is not a suid program (/usr/lib otherwise). ++ * Once this is done, we can do the dynamic linking as required, and we ++ * must omit the things we did to get the dynamic linker up and running ++ * in the first place. After we have done this, we just have a few ++ * housekeeping chores and we can transfer control to the user's ++ * application. ++ */ ++ ++#include "ldso.h" ++ ++ ++#define ALLOW_ZERO_PLTGOT ++ ++/* Some arches may need to override this in boot1_arch.h */ ++#define ELFMAGIC ELFMAG ++ ++/* This is a poor man's malloc, used prior to resolving our internal poor man's malloc */ ++#define LD_MALLOC(SIZE) ((void *) (malloc_buffer += SIZE, malloc_buffer - SIZE)) ; REALIGN(); ++/* ++ * Make sure that the malloc buffer is aligned on 4 byte boundary. For 64 bit ++ * platforms we may need to increase this to 8, but this is good enough for ++ * now. This is typically called after LD_MALLOC. ++ */ ++#define REALIGN() malloc_buffer = (char *) (((unsigned long) malloc_buffer + 3) & ~(3)) ++ ++char *_dl_library_path = 0; /* Where we look for libraries */ ++char *_dl_preload = 0; /* Things to be loaded before the libs. */ ++char *_dl_ldsopath = 0; ++static int _dl_be_lazy = RTLD_LAZY; ++#ifdef __SUPPORT_LD_DEBUG__ ++char *_dl_debug = 0; ++char *_dl_debug_symbols = 0; ++char *_dl_debug_move = 0; ++char *_dl_debug_reloc = 0; ++char *_dl_debug_detail = 0; ++char *_dl_debug_nofixups = 0; ++char *_dl_debug_bindings = 0; ++int _dl_debug_file = 2; ++#else ++#define _dl_debug_file 2 ++#endif ++static char *_dl_malloc_addr, *_dl_mmap_zero; ++ ++static char *_dl_trace_loaded_objects = 0; ++static int (*_dl_elf_main) (int, char **, char **); ++struct r_debug *_dl_debug_addr = NULL; ++unsigned long *_dl_brkp; ++unsigned long *_dl_envp; ++int _dl_fixup(struct elf_resolve *tpnt, int lazy); ++void _dl_debug_state(void); ++char *_dl_get_last_path_component(char *path); ++static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt, ++ unsigned long load_addr, unsigned long *hash_addr, Elf32_auxv_t auxvt[AT_EGID + 1], ++ char **envp, struct r_debug *debug_addr); ++ ++#include "boot1_arch.h" ++#include "_dl_progname.h" /* Pull in the value of _dl_progname */ ++ ++/* When we enter this piece of code, the program stack looks like this: ++ argc argument counter (integer) ++ argv[0] program name (pointer) ++ argv[1...N] program args (pointers) ++ argv[argc-1] end of args (integer) ++ NULL ++ env[0...N] environment variables (pointers) ++ NULL ++ auxvt[0...N] Auxiliary Vector Table elements (mixed types) ++*/ ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++/* Debugging is especially tricky on PowerPC, since string literals ++ * require relocations. Thus, you can't use _dl_dprintf() for ++ * anything until the bootstrap relocations are finished. */ ++static inline void hexprint(unsigned long x) ++{ ++ int i; ++ char c; ++ ++ for (i = 0; i < 8; i++) { ++ c = ((x >> 28) + '0'); ++ if (c > '9') ++ c += 'a' - '9' - 1; ++ _dl_write(1, &c, 1); ++ x <<= 4; ++ } ++ c = '\n'; ++ _dl_write(1, &c, 1); ++} ++#endif ++ ++LD_BOOT(unsigned long args) __attribute__ ((unused)); ++ ++LD_BOOT(unsigned long args) ++{ ++ unsigned int argc; ++ char **argv, **envp; ++ unsigned long load_addr; ++ unsigned long *got; ++ unsigned long *aux_dat; ++ int goof = 0; ++ ElfW(Ehdr) *header; ++ struct elf_resolve *tpnt; ++ struct elf_resolve *app_tpnt; ++ Elf32_auxv_t auxvt[AT_EGID + 1]; ++ unsigned char *malloc_buffer, *mmap_zero; ++ Elf32_Dyn *dpnt; ++ unsigned long *hash_addr; ++ struct r_debug *debug_addr = NULL; ++ int indx; ++ int status; ++ ++ ++ /* WARNING! -- we cannot make _any_ funtion calls until we have ++ * taken care of fixing up our own relocations. Making static ++ * inline calls is ok, but _no_ function calls. Not yet ++ * anyways. */ ++ ++ /* First obtain the information on the stack that tells us more about ++ what binary is loaded, where it is loaded, etc, etc */ ++ GET_ARGV(aux_dat, args); ++#if defined (__arm__) || defined (__mips__) || defined (__cris__) ++ aux_dat += 1; ++#endif ++ argc = *(aux_dat - 1); ++ argv = (char **) aux_dat; ++ aux_dat += argc; /* Skip over the argv pointers */ ++ aux_dat++; /* Skip over NULL at end of argv */ ++ envp = (char **) aux_dat; ++ while (*aux_dat) ++ aux_dat++; /* Skip over the envp pointers */ ++ aux_dat++; /* Skip over NULL at end of envp */ ++ ++ /* Place -1 here as a checkpoint. We later check if it was changed ++ * when we read in the auxvt */ ++ auxvt[AT_UID].a_type = -1; ++ ++ /* The junk on the stack immediately following the environment is ++ * the Auxiliary Vector Table. Read out the elements of the auxvt, ++ * sort and store them in auxvt for later use. */ ++ while (*aux_dat) { ++ Elf32_auxv_t *auxv_entry = (Elf32_auxv_t *) aux_dat; ++ ++ if (auxv_entry->a_type <= AT_EGID) { ++ _dl_memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(Elf32_auxv_t)); ++ } ++ aux_dat += 2; ++ } ++ ++ /* locate the ELF header. We need this done as soon as possible ++ * (esp since SEND_STDERR() needs this on some platforms... */ ++ load_addr = auxvt[AT_BASE].a_un.a_val; ++ header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_ptr; ++ ++ /* Check the ELF header to make sure everything looks ok. */ ++ if (!header || header->e_ident[EI_CLASS] != ELFCLASS32 || ++ header->e_ident[EI_VERSION] != EV_CURRENT ++#if !defined(__powerpc__) && !defined(__mips__) && !defined(__sh__) ++ || _dl_strncmp((void *) header, ELFMAGIC, SELFMAG) != 0 ++#else ++ || header->e_ident[EI_MAG0] != ELFMAG0 ++ || header->e_ident[EI_MAG1] != ELFMAG1 ++ || header->e_ident[EI_MAG2] != ELFMAG2 ++ || header->e_ident[EI_MAG3] != ELFMAG3 ++#endif ++ ) { ++ SEND_STDERR("Invalid ELF header\n"); ++ _dl_exit(0); ++ } ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("ELF header="); ++ SEND_ADDRESS_STDERR(load_addr, 1); ++#endif ++ ++ ++ /* Locate the global offset table. Since this code must be PIC ++ * we can take advantage of the magic offset register, if we ++ * happen to know what that is for this architecture. If not, ++ * we can always read stuff out of the ELF file to find it... */ ++#if defined(__i386__) ++ __asm__("\tmovl %%ebx,%0\n\t":"=a"(got)); ++#elif defined(__m68k__) ++ __asm__("movel %%a5,%0":"=g"(got)) ++#elif defined(__sparc__) ++ __asm__("\tmov %%l7,%0\n\t":"=r"(got)) ++#elif defined(__arm__) ++ __asm__("\tmov %0, r10\n\t":"=r"(got)); ++#elif defined(__powerpc__) ++ __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got)); ++#elif defined(__mips__) ++ __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got)); ++#elif defined(__sh__) ++ __asm__( ++" mov.l 1f, %0\n" ++" mova 1f, r0\n" ++" bra 2f\n" ++" add r0, %0\n" ++" .balign 4\n" ++"1: .long _GLOBAL_OFFSET_TABLE_\n" ++"2:" : "=r" (got) : : "r0"); ++#elif defined(__cris__) ++ __asm__("\tmove.d $pc,%0\n\tsub.d .:GOTOFF,%0\n\t":"=r"(got)); ++#else ++ /* Do things the slow way in C */ ++ { ++ unsigned long tx_reloc; ++ Elf32_Dyn *dynamic = NULL; ++ Elf32_Shdr *shdr; ++ Elf32_Phdr *pt_load; ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("Finding the GOT using C code to read the ELF file\n"); ++#endif ++ /* Find where the dynamic linking information section is hiding */ ++ shdr = (Elf32_Shdr *) (header->e_shoff + (char *) header); ++ for (indx = header->e_shnum; --indx >= 0; ++shdr) { ++ if (shdr->sh_type == SHT_DYNAMIC) { ++ goto found_dynamic; ++ } ++ } ++ SEND_STDERR("missing dynamic linking information section \n"); ++ _dl_exit(0); ++ ++ found_dynamic: ++ dynamic = (Elf32_Dyn *) (shdr->sh_offset + (char *) header); ++ ++ /* Find where PT_LOAD is hiding */ ++ pt_load = (Elf32_Phdr *) (header->e_phoff + (char *) header); ++ for (indx = header->e_phnum; --indx >= 0; ++pt_load) { ++ if (pt_load->p_type == PT_LOAD) { ++ goto found_pt_load; ++ } ++ } ++ SEND_STDERR("missing loadable program segment\n"); ++ _dl_exit(0); ++ ++ found_pt_load: ++ /* Now (finally) find where DT_PLTGOT is hiding */ ++ tx_reloc = pt_load->p_vaddr - pt_load->p_offset; ++ for (; DT_NULL != dynamic->d_tag; ++dynamic) { ++ if (dynamic->d_tag == DT_PLTGOT) { ++ goto found_got; ++ } ++ } ++ SEND_STDERR("missing global offset table\n"); ++ _dl_exit(0); ++ ++ found_got: ++ got = (unsigned long *) (dynamic->d_un.d_val - tx_reloc + ++ (char *) header); ++ } ++#endif ++ ++ /* Now, finally, fix up the location of the dynamic stuff */ ++ dpnt = (Elf32_Dyn *) (*got + load_addr); ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("First Dynamic section entry="); ++ SEND_ADDRESS_STDERR(dpnt, 1); ++#endif ++ ++ ++ /* Call mmap to get a page of writable memory that can be used ++ * for _dl_malloc throughout the shared lib loader. */ ++ mmap_zero = malloc_buffer = _dl_mmap((void *) 0, 4096, ++ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); ++ if (_dl_mmap_check_error(mmap_zero)) { ++ SEND_STDERR("dl_boot: mmap of a spare page failed!\n"); ++ _dl_exit(13); ++ } ++ ++ tpnt = LD_MALLOC(sizeof(struct elf_resolve)); ++ _dl_memset(tpnt, 0, sizeof(struct elf_resolve)); ++ app_tpnt = LD_MALLOC(sizeof(struct elf_resolve)); ++ _dl_memset(app_tpnt, 0, sizeof(struct elf_resolve)); ++ ++ /* ++ * This is used by gdb to locate the chain of shared libraries that are currently loaded. ++ */ ++ debug_addr = LD_MALLOC(sizeof(struct r_debug)); ++ _dl_memset(debug_addr, 0, sizeof(struct r_debug)); ++ ++ /* OK, that was easy. Next scan the DYNAMIC section of the image. ++ We are only doing ourself right now - we will have to do the rest later */ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("scanning DYNAMIC section\n"); ++#endif ++ while (dpnt->d_tag) { ++#if defined(__mips__) ++ if (dpnt->d_tag == DT_MIPS_GOTSYM) ++ tpnt->mips_gotsym = (unsigned long) dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) ++ tpnt->mips_local_gotno = (unsigned long) dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_MIPS_SYMTABNO) ++ tpnt->mips_symtabno = (unsigned long) dpnt->d_un.d_val; ++#endif ++ if (dpnt->d_tag < 24) { ++ tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_TEXTREL) { ++ tpnt->dynamic_info[DT_TEXTREL] = 1; ++ } ++ } ++ dpnt++; ++ } ++ ++ { ++ ElfW(Phdr) *ppnt; ++ int i; ++ ++ ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_ptr; ++ for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) ++ if (ppnt->p_type == PT_DYNAMIC) { ++ dpnt = (Elf32_Dyn *) ppnt->p_vaddr; ++ while (dpnt->d_tag) { ++#if defined(__mips__) ++ if (dpnt->d_tag == DT_MIPS_GOTSYM) ++ app_tpnt->mips_gotsym = ++ (unsigned long) dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) ++ app_tpnt->mips_local_gotno = ++ (unsigned long) dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_MIPS_SYMTABNO) ++ app_tpnt->mips_symtabno = ++ (unsigned long) dpnt->d_un.d_val; ++ if (dpnt->d_tag > DT_JMPREL) { ++ dpnt++; ++ continue; ++ } ++ app_tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val; ++ ++#warning "Debugging threads on mips won't work till someone fixes this..." ++#if 0 ++ if (dpnt->d_tag == DT_DEBUG) { ++ dpnt->d_un.d_val = (unsigned long) debug_addr; ++ } ++#endif ++ ++#else ++ if (dpnt->d_tag > DT_JMPREL) { ++ dpnt++; ++ continue; ++ } ++ app_tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_DEBUG) { ++ dpnt->d_un.d_val = (unsigned long) debug_addr; ++ } ++#endif ++ if (dpnt->d_tag == DT_TEXTREL) ++ app_tpnt->dynamic_info[DT_TEXTREL] = 1; ++ dpnt++; ++ } ++ } ++ } ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("done scanning DYNAMIC section\n"); ++#endif ++ ++ /* Get some more of the information that we will need to dynamicly link ++ this module to itself */ ++ ++ hash_addr = (unsigned long *) (tpnt->dynamic_info[DT_HASH] + load_addr); ++ tpnt->nbucket = *hash_addr++; ++ tpnt->nchain = *hash_addr++; ++ tpnt->elf_buckets = hash_addr; ++ hash_addr += tpnt->nbucket; ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("done grabbing link information\n"); ++#endif ++ ++#ifndef FORCE_SHAREABLE_TEXT_SEGMENTS ++ /* Ugly, ugly. We need to call mprotect to change the protection of ++ the text pages so that we can do the dynamic linking. We can set the ++ protection back again once we are done */ ++ ++ { ++ ElfW(Phdr) *ppnt; ++ int i; ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("calling mprotect on the shared library/dynamic linker\n"); ++#endif ++ ++ /* First cover the shared library/dynamic linker. */ ++ if (tpnt->dynamic_info[DT_TEXTREL]) { ++ header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_ptr; ++ ppnt = (ElfW(Phdr) *) ((int)auxvt[AT_BASE].a_un.a_ptr + ++ header->e_phoff); ++ for (i = 0; i < header->e_phnum; i++, ppnt++) { ++ if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) { ++ _dl_mprotect((void *) (load_addr + (ppnt->p_vaddr & PAGE_ALIGN)), ++ (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz, ++ PROT_READ | PROT_WRITE | PROT_EXEC); ++ } ++ } ++ } ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("calling mprotect on the application program\n"); ++#endif ++ /* Now cover the application program. */ ++ if (app_tpnt->dynamic_info[DT_TEXTREL]) { ++ ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_ptr; ++ for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) { ++ if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) ++ _dl_mprotect((void *) (ppnt->p_vaddr & PAGE_ALIGN), ++ (ppnt->p_vaddr & ADDR_ALIGN) + ++ (unsigned long) ppnt->p_filesz, ++ PROT_READ | PROT_WRITE | PROT_EXEC); ++ } ++ } ++ } ++#endif ++ ++#if defined(__mips__) ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("About to do MIPS specific GOT bootstrap\n"); ++#endif ++ /* For MIPS we have to do stuff to the GOT before we do relocations. */ ++ PERFORM_BOOTSTRAP_GOT(got); ++#endif ++ ++ /* OK, now do the relocations. We do not do a lazy binding here, so ++ that once we are done, we have considerably more flexibility. */ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("About to do library loader relocations\n"); ++#endif ++ ++ goof = 0; ++ for (indx = 0; indx < 2; indx++) { ++ unsigned int i; ++ ELF_RELOC *rpnt; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ int symtab_index; ++ unsigned long rel_addr, rel_size; ++ ++ ++#ifdef ELF_USES_RELOCA ++ rel_addr = (indx ? tpnt->dynamic_info[DT_JMPREL] : tpnt-> ++ dynamic_info[DT_RELA]); ++ rel_size = (indx ? tpnt->dynamic_info[DT_PLTRELSZ] : tpnt-> ++ dynamic_info[DT_RELASZ]); ++#else ++ rel_addr = (indx ? tpnt->dynamic_info[DT_JMPREL] : tpnt-> ++ dynamic_info[DT_REL]); ++ rel_size = (indx ? tpnt->dynamic_info[DT_PLTRELSZ] : tpnt-> ++ dynamic_info[DT_RELSZ]); ++#endif ++ ++ if (!rel_addr) ++ continue; ++ ++ /* Now parse the relocation information */ ++ rpnt = (ELF_RELOC *) (rel_addr + load_addr); ++ for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) { ++ reloc_addr = (unsigned long *) (load_addr + (unsigned long) rpnt->r_offset); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ if (symtab_index) { ++ char *strtab; ++ Elf32_Sym *symtab; ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + load_addr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + load_addr); ++ ++ /* We only do a partial dynamic linking right now. The user ++ is not supposed to redefine any symbols that start with ++ a '_', so we can do this with confidence. */ ++ if (!_dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ symbol_addr = load_addr + symtab[symtab_index].st_value; ++ ++ if (!symbol_addr) { ++ /* This will segfault - you cannot call a function until ++ * we have finished the relocations. ++ */ ++ SEND_STDERR("ELF dynamic loader - unable to self-bootstrap - symbol "); ++ SEND_STDERR(strtab + symtab[symtab_index].st_name); ++ SEND_STDERR(" undefined.\n"); ++ goof++; ++ } ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ SEND_STDERR("About to fixup symbol: "); ++ SEND_STDERR(strtab + symtab[symtab_index].st_name); ++ SEND_STDERR("\n"); ++#endif ++ } ++ /* ++ * Use this machine-specific macro to perform the actual relocation. ++ */ ++ PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr); ++ } ++ } ++ ++ if (goof) { ++ _dl_exit(14); ++ } ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ /* Wahoo!!! */ ++ _dl_dprintf(_dl_debug_file, "Done relocating library loader, so we can now\n\tuse globals and make function calls!\n"); ++#endif ++ ++ if (argv[0]) { ++ _dl_progname = argv[0]; ++ } ++ ++ /* Start to build the tables of the modules that are required for ++ * this beast to run. We start with the basic executable, and then ++ * go from there. Eventually we will run across ourself, and we ++ * will need to properly deal with that as well. */ ++ ++ /* Make it so _dl_malloc can use the page of memory we have already ++ * allocated, so we shouldn't need to grab any more memory */ ++ _dl_malloc_addr = malloc_buffer; ++ _dl_mmap_zero = mmap_zero; ++ ++ ++ ++ /* Now we have done the mandatory linking of some things. We are now ++ free to start using global variables, since these things have all been ++ fixed up by now. Still no function calls outside of this library , ++ since the dynamic resolver is not yet ready. */ ++ _dl_get_ready_to_run(tpnt, app_tpnt, load_addr, hash_addr, auxvt, envp, debug_addr); ++ ++ ++ /* Notify the debugger that all objects are now mapped in. */ ++ _dl_debug_addr->r_state = RT_CONSISTENT; ++ _dl_debug_state(); ++ ++ ++ /* OK we are done here. Turn out the lights, and lock up. */ ++ _dl_elf_main = (int (*)(int, char **, char **)) auxvt[AT_ENTRY].a_un.a_fcn; ++ ++ /* ++ * Transfer control to the application. ++ */ ++ status = 0; /* Used on x86, but not on other arches */ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file,"\ntransfering control: %s\n\n", _dl_progname); ++#endif ++ START(); ++} ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static void debug_fini (int status, void *arg) ++{ ++ (void)status; ++ _dl_dprintf(_dl_debug_file,"\ncalling fini: %s\n\n", (const char*)arg); ++} ++#endif ++ ++static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt, ++ unsigned long load_addr, unsigned long *hash_addr, Elf32_auxv_t auxvt[AT_EGID + 1], ++ char **envp, struct r_debug *debug_addr) ++{ ++ ElfW(Phdr) *ppnt; ++ char *lpntstr; ++ int i, _dl_secure, goof = 0; ++ struct dyn_elf *rpnt; ++ struct elf_resolve *tcurr; ++ struct elf_resolve *tpnt1; ++ unsigned long brk_addr, *lpnt; ++ int (*_dl_atexit) (void *); ++#if defined (__SUPPORT_LD_DEBUG__) ++ int (*_dl_on_exit) (void (*FUNCTION)(int STATUS, void *ARG),void*); ++#endif ++ ++ /* Now we have done the mandatory linking of some things. We are now ++ free to start using global variables, since these things have all been ++ fixed up by now. Still no function calls outside of this library , ++ since the dynamic resolver is not yet ready. */ ++ lpnt = (unsigned long *) (tpnt->dynamic_info[DT_PLTGOT] + load_addr); ++ ++ tpnt->chains = hash_addr; ++ tpnt->next = 0; ++ tpnt->libname = 0; ++ tpnt->libtype = program_interpreter; ++ tpnt->loadaddr = (ElfW(Addr)) load_addr; ++ ++#ifdef ALLOW_ZERO_PLTGOT ++ if (tpnt->dynamic_info[DT_PLTGOT]) ++#endif ++ { ++ INIT_GOT(lpnt, tpnt); ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "GOT found at %x\n", lpnt); ++#endif ++ } ++ ++ /* OK, this was a big step, now we need to scan all of the user images ++ and load them properly. */ ++ ++ { ++ ElfW(Ehdr) *epnt; ++ ElfW(Phdr) *myppnt; ++ int j; ++ ++ epnt = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_ptr; ++ tpnt->n_phent = epnt->e_phnum; ++ tpnt->ppnt = myppnt = (ElfW(Phdr) *) (load_addr + epnt->e_phoff); ++ for (j = 0; j < epnt->e_phnum; j++, myppnt++) { ++ if (myppnt->p_type == PT_DYNAMIC) { ++ tpnt->dynamic_addr = (ElfW(Dyn) *)myppnt->p_vaddr + load_addr; ++ tpnt->dynamic_size = myppnt->p_filesz; ++ } ++ } ++ } ++ ++ brk_addr = 0; ++ rpnt = NULL; ++ ++ /* At this point we are now free to examine the user application, ++ and figure out which libraries are supposed to be called. Until ++ we have this list, we will not be completely ready for dynamic linking */ ++ ++ ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_ptr; ++ for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) { ++ if (ppnt->p_type == PT_LOAD) { ++ if (ppnt->p_vaddr + ppnt->p_memsz > brk_addr) ++ brk_addr = ppnt->p_vaddr + ppnt->p_memsz; ++ } ++ if (ppnt->p_type == PT_DYNAMIC) { ++#ifndef ALLOW_ZERO_PLTGOT ++ /* make sure it's really there. */ ++ if (app_tpnt->dynamic_info[DT_PLTGOT] == 0) ++ continue; ++#endif ++ /* OK, we have what we need - slip this one into the list. */ ++ app_tpnt = _dl_add_elf_hash_table("", 0, ++ app_tpnt->dynamic_info, ppnt->p_vaddr, ppnt->p_filesz); ++ _dl_loaded_modules->libtype = elf_executable; ++ _dl_loaded_modules->ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_ptr; ++ _dl_loaded_modules->n_phent = auxvt[AT_PHNUM].a_un.a_val; ++ _dl_symbol_tables = rpnt = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); ++ _dl_memset(rpnt, 0, sizeof(struct dyn_elf)); ++ rpnt->dyn = _dl_loaded_modules; ++ app_tpnt->usage_count++; ++ app_tpnt->symbol_scope = _dl_symbol_tables; ++ lpnt = (unsigned long *) (app_tpnt->dynamic_info[DT_PLTGOT]); ++#ifdef ALLOW_ZERO_PLTGOT ++ if (lpnt) ++#endif ++ INIT_GOT(lpnt, _dl_loaded_modules); ++ } ++ ++ /* OK, fill this in - we did not have this before */ ++ if (ppnt->p_type == PT_INTERP) { ++ int readsize = 0; ++ char *pnt, *pnt1, buf[1024]; ++ tpnt->libname = _dl_strdup((char *) ppnt->p_offset + ++ (auxvt[AT_PHDR].a_un.a_val & PAGE_ALIGN)); ++ ++ /* Determine if the shared lib loader is a symlink */ ++ _dl_memset(buf, 0, sizeof(buf)); ++ readsize = _dl_readlink(tpnt->libname, buf, sizeof(buf)); ++ if (readsize > 0 && readsize < (int)(sizeof(buf)-1)) { ++ pnt1 = _dl_strrchr(buf, '/'); ++ if (pnt1 && buf != pnt1) { ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "changing tpnt->libname from '%s' to '%s'\n", tpnt->libname, buf); ++#endif ++ tpnt->libname = _dl_strdup(buf); ++ } ++ } ++ ++ /* Store the path where the shared lib loader was found for ++ * later use */ ++ pnt = _dl_strdup(tpnt->libname); ++ pnt1 = _dl_strrchr(pnt, '/'); ++ if (pnt != pnt1) { ++ *pnt1 = '\0'; ++ _dl_ldsopath = pnt; ++ } else { ++ _dl_ldsopath = tpnt->libname; ++ } ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "Lib Loader:\t(%x) %s\n", tpnt->loadaddr, tpnt->libname); ++#endif ++ } ++ } ++ ++ ++ /* Now we need to figure out what kind of options are selected. ++ Note that for SUID programs we ignore the settings in LD_LIBRARY_PATH */ ++ { ++ if (_dl_getenv("LD_BIND_NOW", envp)) ++ _dl_be_lazy = 0; ++ ++ if ((auxvt[AT_UID].a_un.a_val == -1 && _dl_suid_ok()) || ++ (auxvt[AT_UID].a_un.a_val != -1 && ++ auxvt[AT_UID].a_un.a_val == auxvt[AT_EUID].a_un.a_val ++ && auxvt[AT_GID].a_un.a_val== auxvt[AT_EGID].a_un.a_val)) { ++ _dl_secure = 0; ++ _dl_preload = _dl_getenv("LD_PRELOAD", envp); ++ _dl_library_path = _dl_getenv("LD_LIBRARY_PATH", envp); ++ } else { ++ _dl_secure = 1; ++ _dl_preload = _dl_getenv("LD_PRELOAD", envp); ++ _dl_unsetenv("LD_AOUT_PRELOAD", envp); ++ _dl_unsetenv("LD_LIBRARY_PATH", envp); ++ _dl_unsetenv("LD_AOUT_LIBRARY_PATH", envp); ++ _dl_library_path = NULL; ++ } ++ } ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ _dl_debug = _dl_getenv("LD_DEBUG", envp); ++ if (_dl_debug) ++ { ++ if (_dl_strstr(_dl_debug, "all")) { ++ _dl_debug_detail = _dl_debug_move = _dl_debug_symbols ++ = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_strstr(_dl_debug, "all"); ++ } ++ else { ++ _dl_debug_detail = _dl_strstr(_dl_debug, "detail"); ++ _dl_debug_move = _dl_strstr(_dl_debug, "move"); ++ _dl_debug_symbols = _dl_strstr(_dl_debug, "sym"); ++ _dl_debug_reloc = _dl_strstr(_dl_debug, "reloc"); ++ _dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix"); ++ _dl_debug_bindings = _dl_strstr(_dl_debug, "bind"); ++ } ++ } ++ { ++ const char *dl_debug_output; ++ ++ dl_debug_output = _dl_getenv("LD_DEBUG_OUTPUT", envp); ++ ++ if (dl_debug_output) ++ { ++ char tmp[22], *tmp1, *filename; ++ int len1, len2; ++ ++ _dl_memset(tmp, 0, sizeof(tmp)); ++ tmp1=_dl_simple_ltoa( tmp, (unsigned long)_dl_getpid()); ++ ++ len1 = _dl_strlen(dl_debug_output); ++ len2 = _dl_strlen(tmp1); ++ ++ filename = _dl_malloc(len1+len2+2); ++ ++ if (filename) ++ { ++ _dl_strcpy (filename, dl_debug_output); ++ filename[len1] = '.'; ++ _dl_strcpy (&filename[len1+1], tmp1); ++ ++ _dl_debug_file= _dl_open (filename, O_WRONLY|O_CREAT); ++ if (_dl_debug_file<0) ++ { ++ _dl_debug_file = 2; ++ _dl_dprintf (2, "can't open file: '%s'\n",filename); ++ } ++ } ++ } ++ } ++ ++ ++#endif ++ _dl_trace_loaded_objects = _dl_getenv("LD_TRACE_LOADED_OBJECTS", envp); ++#ifndef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects) { ++ _dl_dprintf(_dl_debug_file, "Use the ldd provided by uClibc\n"); ++ _dl_exit(1); ++ } ++#endif ++ ++ /* ++ * OK, fix one more thing - set up debug_addr so it will point ++ * to our chain. Later we may need to fill in more fields, but this ++ * should be enough for now. ++ */ ++ debug_addr->r_map = (struct link_map *) _dl_loaded_modules; ++ debug_addr->r_version = 1; ++ debug_addr->r_ldbase = load_addr; ++ debug_addr->r_brk = (unsigned long) &_dl_debug_state; ++ _dl_debug_addr = debug_addr; ++ ++ /* Notify the debugger we are in a consistant state */ ++ _dl_debug_addr->r_state = RT_CONSISTENT; ++ _dl_debug_state(); ++ ++ /* OK, we now have the application in the list, and we have some ++ basic stuff in place. Now search through the list for other shared ++ libraries that should be loaded, and insert them on the list in the ++ correct order. */ ++ ++ _dl_map_cache(); ++ ++ ++ if (_dl_preload) ++ { ++ char c, *str, *str2; ++ ++ str = _dl_preload; ++ while (*str == ':' || *str == ' ' || *str == '\t') ++ str++; ++ while (*str) ++ { ++ str2 = str; ++ while (*str2 && *str2 != ':' && *str2 != ' ' && *str2 != '\t') ++ str2++; ++ c = *str2; ++ *str2 = '\0'; ++ if (!_dl_secure || _dl_strchr(str, '/') == NULL) ++ { ++ if ((tpnt1 = _dl_check_if_named_library_is_loaded(str))) ++ { ++ continue; ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n", ++ str, _dl_progname); ++#endif ++ tpnt1 = _dl_load_shared_library(_dl_secure, &rpnt, NULL, str); ++ if (!tpnt1) { ++#ifdef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects) ++ _dl_dprintf(1, "\t%s => not found\n", str); ++ else ++#endif ++ { ++ _dl_dprintf(2, "%s: can't load " "library '%s'\n", _dl_progname, str); ++ _dl_exit(15); ++ } ++ } else { ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "Loading:\t(%x) %s\n", tpnt1->loadaddr, tpnt1->libname); ++#endif ++#ifdef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects && tpnt1->usage_count==1) { ++ /* this is a real hack to make ldd not print ++ * the library itself when run on a library. */ ++ if (_dl_strcmp(_dl_progname, str) != 0) ++ _dl_dprintf(1, "\t%s => %s (%x)\n", str, tpnt1->libname, ++ (unsigned) tpnt1->loadaddr); ++ } ++#endif ++ } ++ } ++ *str2 = c; ++ str = str2; ++ while (*str == ':' || *str == ' ' || *str == '\t') ++ str++; ++ } ++ } ++ ++#ifdef SUPPORT_LDSO_PRELOAD_FILE ++ { ++ int fd; ++ struct stat st; ++ char *preload; ++ if (!_dl_stat(LDSO_PRELOAD, &st) && st.st_size > 0) { ++ if ((fd = _dl_open(LDSO_PRELOAD, O_RDONLY)) < 0) { ++ _dl_dprintf(2, "%s: can't open file '%s'\n", ++ _dl_progname, LDSO_PRELOAD); ++ } else { ++ preload = (caddr_t) _dl_mmap(0, st.st_size + 1, ++ PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); ++ _dl_close(fd); ++ if (preload == (caddr_t) - 1) { ++ _dl_dprintf(2, "%s: can't map file '%s'\n", ++ _dl_progname, LDSO_PRELOAD); ++ } else { ++ char c, *cp, *cp2; ++ ++ /* convert all separators and comments to spaces */ ++ for (cp = preload; *cp; /*nada */ ) { ++ if (*cp == ':' || *cp == '\t' || *cp == '\n') { ++ *cp++ = ' '; ++ } else if (*cp == '#') { ++ do ++ *cp++ = ' '; ++ while (*cp != '\n' && *cp != '\0'); ++ } else { ++ cp++; ++ } ++ } ++ ++ /* find start of first library */ ++ for (cp = preload; *cp && *cp == ' '; cp++) ++ /*nada */ ; ++ ++ while (*cp) { ++ /* find end of library */ ++ for (cp2 = cp; *cp && *cp != ' '; cp++) ++ /*nada */ ; ++ c = *cp; ++ *cp = '\0'; ++ ++ if ((tpnt1 = _dl_check_if_named_library_is_loaded(cp2))) ++ { ++ continue; ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n", ++ cp2, _dl_progname); ++#endif ++ tpnt1 = _dl_load_shared_library(0, &rpnt, NULL, cp2); ++ if (!tpnt1) { ++#ifdef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects) ++ _dl_dprintf(1, "\t%s => not found\n", cp2); ++ else ++#endif ++ { ++ _dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, cp2); ++ _dl_exit(15); ++ } ++ } else { ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "Loading:\t(%x) %s\n", tpnt1->loadaddr, tpnt1->libname); ++#endif ++#ifdef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects && tpnt1->usage_count==1) { ++ _dl_dprintf(1, "\t%s => %s (%x)\n", cp2, ++ tpnt1->libname, (unsigned) tpnt1->loadaddr); ++ } ++#endif ++ } ++ ++ /* find start of next library */ ++ *cp = c; ++ for ( /*nada */ ; *cp && *cp == ' '; cp++) ++ /*nada */ ; ++ } ++ ++ _dl_munmap(preload, st.st_size + 1); ++ } ++ } ++ } ++ } ++#endif ++ ++ for (tcurr = _dl_loaded_modules; tcurr; tcurr = tcurr->next) ++ { ++ Elf32_Dyn *dpnt; ++ for (dpnt = (Elf32_Dyn *) tcurr->dynamic_addr; dpnt->d_tag; dpnt++) ++ { ++ if (dpnt->d_tag == DT_NEEDED) ++ { ++ char *name; ++ lpntstr = (char*) (tcurr->loadaddr + tcurr->dynamic_info[DT_STRTAB] + dpnt->d_un.d_val); ++ name = _dl_get_last_path_component(lpntstr); ++ ++ if ((tpnt1 = _dl_check_if_named_library_is_loaded(name))) ++ { ++ continue; ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n", ++ lpntstr, _dl_progname); ++#endif ++ if (!(tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr))) ++ { ++#ifdef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects) { ++ _dl_dprintf(1, "\t%s => not found\n", lpntstr); ++ continue; ++ } else ++#endif ++ { ++ _dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, lpntstr); ++ _dl_exit(16); ++ } ++ } else { ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "Loading:\t(%x) %s\n", tpnt1->loadaddr, tpnt1->libname); ++#endif ++#ifdef __LDSO_LDD_SUPPORT__ ++ if (_dl_trace_loaded_objects && tpnt1->usage_count==1) { ++ _dl_dprintf(1, "\t%s => %s (%x)\n", lpntstr, tpnt1->libname, ++ (unsigned) tpnt1->loadaddr); ++ } ++#endif ++ } ++ } ++ } ++ } ++ ++ ++ _dl_unmap_cache(); ++ ++ /* ++ * If the program interpreter is not in the module chain, add it. This will ++ * be required for dlopen to be able to access the internal functions in the ++ * dynamic linker. ++ */ ++ if (tpnt) { ++ tcurr = _dl_loaded_modules; ++ if (tcurr) ++ while (tcurr->next) ++ tcurr = tcurr->next; ++ tpnt->next = NULL; ++ tpnt->usage_count++; ++ ++ if (tcurr) { ++ tcurr->next = tpnt; ++ tpnt->prev = tcurr; ++ } else { ++ _dl_loaded_modules = tpnt; ++ tpnt->prev = NULL; ++ } ++ if (rpnt) { ++ rpnt->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); ++ _dl_memset(rpnt->next, 0, sizeof(struct dyn_elf)); ++ rpnt->next->prev = rpnt; ++ rpnt = rpnt->next; ++ } else { ++ rpnt = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); ++ _dl_memset(rpnt, 0, sizeof(struct dyn_elf)); ++ } ++ rpnt->dyn = tpnt; ++ tpnt = NULL; ++ } ++ ++#ifdef __LDSO_LDD_SUPPORT__ ++ /* End of the line for ldd.... */ ++ if (_dl_trace_loaded_objects) { ++ _dl_dprintf(1, "\t%s => %s (%x)\n", rpnt->dyn->libname + (_dl_strlen(_dl_ldsopath)) + 1, ++ rpnt->dyn->libname, rpnt->dyn->loadaddr); ++ _dl_exit(0); ++ } ++#endif ++ ++ ++#ifdef __mips__ ++ /* ++ * Relocation of the GOT entries for MIPS have to be done ++ * after all the libraries have been loaded. ++ */ ++ _dl_perform_mips_global_got_relocations(_dl_loaded_modules); ++#endif ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "Beginning relocation fixups\n"); ++#endif ++ /* ++ * OK, now all of the kids are tucked into bed in their proper addresses. ++ * Now we go through and look for REL and RELA records that indicate fixups ++ * to the GOT tables. We need to do this in reverse order so that COPY ++ * directives work correctly */ ++ goof = _dl_loaded_modules ? _dl_fixup(_dl_loaded_modules, _dl_be_lazy) : 0; ++ ++ ++ /* Some flavors of SVr4 do not generate the R_*_COPY directive, ++ and we have to manually search for entries that require fixups. ++ Solaris gets this one right, from what I understand. */ ++ ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(_dl_debug_file, "Beginning copy fixups\n"); ++#endif ++ if (_dl_symbol_tables) ++ goof += _dl_copy_fixups(_dl_symbol_tables); ++ ++ /* OK, at this point things are pretty much ready to run. Now we ++ need to touch up a few items that are required, and then ++ we can let the user application have at it. Note that ++ the dynamic linker itself is not guaranteed to be fully ++ dynamicly linked if we are using ld.so.1, so we have to look ++ up each symbol individually. */ ++ ++ ++ _dl_brkp = (unsigned long *) (intptr_t) _dl_find_hash("___brk_addr", NULL, NULL, symbolrel); ++ ++ if (_dl_brkp) { ++ *_dl_brkp = brk_addr; ++ } ++ _dl_envp = (unsigned long *) (intptr_t) _dl_find_hash("__environ", NULL, NULL, symbolrel); ++ ++ if (_dl_envp) { ++ *_dl_envp = (unsigned long) envp; ++ } ++ ++#ifndef FORCE_SHAREABLE_TEXT_SEGMENTS ++ { ++ unsigned int j; ++ ElfW(Phdr) *myppnt; ++ ++ /* We had to set the protections of all pages to R/W for dynamic linking. ++ Set text pages back to R/O */ ++ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { ++ for (myppnt = tpnt->ppnt, j = 0; j < tpnt->n_phent; j++, myppnt++) { ++ if (myppnt->p_type == PT_LOAD && !(myppnt->p_flags & PF_W) && tpnt->dynamic_info[DT_TEXTREL]) { ++ _dl_mprotect((void *) (tpnt->loadaddr + (myppnt->p_vaddr & PAGE_ALIGN)), ++ (myppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) myppnt->p_filesz, LXFLAGS(myppnt->p_flags)); ++ } ++ } ++ } ++ ++ } ++#endif ++ _dl_atexit = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit", NULL, NULL, symbolrel); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_on_exit = (int (*)(void (*)(int, void *),void*)) ++ (intptr_t) _dl_find_hash("on_exit", NULL, NULL, symbolrel); ++#endif ++ ++ /* Notify the debugger we have added some objects. */ ++ _dl_debug_addr->r_state = RT_ADD; ++ _dl_debug_state(); ++ ++ for (rpnt = _dl_symbol_tables; rpnt!=NULL&& rpnt->next!=NULL; rpnt=rpnt->next) ++ ; ++ ++ for (;rpnt!=NULL; rpnt=rpnt->prev) ++ { ++ tpnt = rpnt->dyn; ++ ++ if (tpnt->libtype == program_interpreter) ++ continue; ++ ++ /* Apparently crt0/1 for the application is responsible for handling this. ++ * We only need to run the init/fini for shared libraries ++ */ ++ if (tpnt->libtype == elf_executable) ++ break; /* at this point all shared libs are initialized !! */ ++ ++ if (tpnt->init_flag & INIT_FUNCS_CALLED) ++ continue; ++ tpnt->init_flag |= INIT_FUNCS_CALLED; ++ ++ if (tpnt->dynamic_info[DT_INIT]) { ++ void (*dl_elf_func) (void); ++ dl_elf_func = (void (*)(void)) (intptr_t) (tpnt->loadaddr + tpnt->dynamic_info[DT_INIT]); ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file,"\ncalling init: %s\n\n", tpnt->libname); ++#endif ++ (*dl_elf_func) (); ++ } ++ if (_dl_atexit && tpnt->dynamic_info[DT_FINI]) { ++ void (*dl_elf_func) (void); ++ dl_elf_func = (void (*)(void)) (intptr_t) (tpnt->loadaddr + tpnt->dynamic_info[DT_FINI]); ++ (*_dl_atexit) (dl_elf_func); ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug && _dl_on_exit) ++ { ++ (*_dl_on_exit)(debug_fini, tpnt->libname); ++ } ++#endif ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ else { ++ if (!_dl_atexit) ++ _dl_dprintf(_dl_debug_file, "%s: The address of atexit () is 0x0.\n", tpnt->libname); ++#if 0 ++ if (!tpnt->dynamic_info[DT_FINI]) ++ _dl_dprintf(_dl_debug_file, "%s: Invalid .fini section.\n", tpnt->libname); ++#endif ++ } ++#endif ++ } ++} ++ ++/* ++ * This stub function is used by some debuggers. The idea is that they ++ * can set an internal breakpoint on it, so that we are notified when the ++ * address mapping is changed in some way. ++ */ ++void _dl_debug_state(void) ++{ ++} ++ ++char *_dl_getenv(const char *symbol, char **envp) ++{ ++ char *pnt; ++ const char *pnt1; ++ ++ while ((pnt = *envp++)) { ++ pnt1 = symbol; ++ while (*pnt && *pnt == *pnt1) ++ pnt1++, pnt++; ++ if (!*pnt || *pnt != '=' || *pnt1) ++ continue; ++ return pnt + 1; ++ } ++ return 0; ++} ++ ++void _dl_unsetenv(const char *symbol, char **envp) ++{ ++ char *pnt; ++ const char *pnt1; ++ char **newenvp = envp; ++ ++ for (pnt = *envp; pnt; pnt = *++envp) { ++ pnt1 = symbol; ++ while (*pnt && *pnt == *pnt1) ++ pnt1++, pnt++; ++ if (!*pnt || *pnt != '=' || *pnt1) ++ *newenvp++ = *envp; ++ } ++ *newenvp++ = *envp; ++ return; ++} ++ ++#include "hash.c" ++#include "readelflib1.c" +diff -urN uClibc/ldso-0.9.24/ldso/m68k/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/m68k/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/m68k/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/m68k/boot1_arch.h 2002-08-08 09:35:37.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. See arm/boot1_arch.h for an example of what ++ * can be done. ++ */ ++ ++#define LD_BOOT(X) void _dl_boot (X) +diff -urN uClibc/ldso-0.9.24/ldso/m68k/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/m68k/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/m68k/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/m68k/elfinterp.c 2002-11-05 12:21:04.000000000 -0600 +@@ -0,0 +1,359 @@ ++/* vi: set sw=4 ts=4: */ ++/* m68k ELF shared library loader suppport ++ * ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, ++ * David Engel, Hongjiu Lu and Mitch D'Souza ++ * Adapted to ELF/68k by Andreas Schwab. ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes[] = ++{ ++ "R_68K_NONE", ++ "R_68K_32", "R_68K_16", "R_68K_8", ++ "R_68K_PC32", "R_68K_PC16", "R_68K_PC8", ++ "R_68K_GOT32", "R_68K_GOT16", "R_68K_GOT8", ++ "R_68K_GOT32O", "R_68K_GOT16O", "R_68K_GOT8O", ++ "R_68K_PLT32", "R_68K_PLT16", "R_68K_PLT8", ++ "R_68K_PLT32O", "R_68K_PLT16O", "R_68K_PLT8O", ++ "R_68K_COPY", "R_68K_GLOB_DAT", "R_68K_JMP_SLOT", "R_68K_RELATIVE", ++ "R_68K_NUM" ++}; ++#endif ++ ++/* Program to load an ELF binary on a linux system, and run it. ++ References to symbols in sharable libraries can be resolved by either ++ an ELF sharable library or a linux style of shared library. */ ++ ++/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have ++ I ever taken any courses on internals. This program was developed using ++ information available through the book "UNIX SYSTEM V RELEASE 4, ++ Programmers guide: Ansi C and Programming Support Tools", which did ++ a more than adequate job of explaining everything required to get this ++ working. */ ++ ++ ++unsigned int _dl_linux_resolver (int dummy1, int dummy2, ++ struct elf_resolve *tpnt, int reloc_entry) ++{ ++ int reloc_type; ++ Elf32_Rela *this_reloc; ++ char *strtab; ++ Elf32_Sym *symtab; ++ char *rel_addr; ++ int symtab_index; ++ char *new_addr; ++ char **got_addr; ++ unsigned int instr_addr; ++ ++ rel_addr = tpnt->loadaddr + tpnt->dynamic_info[DT_JMPREL]; ++ this_reloc = (Elf32_Rela *) (rel_addr + reloc_entry); ++ reloc_type = ELF32_R_TYPE (this_reloc->r_info); ++ symtab_index = ELF32_R_SYM (this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] ++ + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ ++ if (reloc_type != R_68K_JMP_SLOT) ++ { ++ _dl_dprintf (2, "%s: incorrect relocation type in jump relocations\n", ++ _dl_progname); ++ _dl_exit (1); ++ } ++ ++ /* Address of jump instruction to fix up. */ ++ instr_addr = (int) this_reloc->r_offset + (int) tpnt->loadaddr; ++ got_addr = (char **) instr_addr; ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if (_dl_debug_symbols) { ++ _dl_dprintf (2, "Resolving symbol %s\n", strtab + symtab[symtab_index].st_name); ++ } ++#endif ++ ++ /* Get the address of the GOT entry. */ ++ new_addr = _dl_find_hash (strtab + symtab[symtab_index].st_name, ++ tpnt->symbol_scope, tpnt, resolver); ++ if (!new_addr) ++ { ++ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ _dl_exit (1); ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if ((unsigned long) got_addr < 0x40000000) ++ { ++ if (_dl_debug_bindings) ++ { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", ++ strtab + symtab[symtab_index].st_name); ++ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, ++ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr); ++ } ++ } ++ if (!_dl_debug_nofixups) { ++ *got_addr = new_addr; ++ } ++#else ++ *got_addr = new_addr; ++#endif ++ ++ return (unsigned int) new_addr; ++} ++ ++void ++_dl_parse_lazy_relocation_information (struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ int i; ++ char *strtab; ++ int reloc_type; ++ int symtab_index; ++ Elf32_Sym *symtab; ++ Elf32_Rela *rpnt; ++ unsigned int *reloc_addr; ++ ++ /* Now parse the relocation information. */ ++ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof (Elf32_Rela); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] ++ + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) ++ { ++ reloc_addr = (int *) (tpnt->loadaddr + (int) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE (rpnt->r_info); ++ symtab_index = ELF32_R_SYM (rpnt->r_info); ++ ++ /* When the dynamic linker bootstrapped itself, it resolved some symbols. ++ Make sure we do not do them again. */ ++ if (tpnt->libtype == program_interpreter ++ && (!symtab_index ++ || _dl_symbol (strtab + symtab[symtab_index].st_name))) ++ continue; ++ ++ switch (reloc_type) ++ { ++ case R_68K_NONE: ++ break; ++ case R_68K_JMP_SLOT: ++ *reloc_addr += (unsigned int) tpnt->loadaddr; ++ break; ++ default: ++ _dl_dprintf (2, "%s: (LAZY) can't handle reloc type ", _dl_progname); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf (2, "%s ", _dl_reltypes[reloc_type]); ++#endif ++ if (symtab_index) ++ _dl_dprintf (2, "'%s'", strtab + symtab[symtab_index].st_name); ++ _dl_dprintf (2, "\n"); ++ _dl_exit (1); ++ } ++ } ++} ++ ++int ++_dl_parse_relocation_information (struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ int i; ++ char *strtab; ++ int reloc_type; ++ int goof = 0; ++ Elf32_Sym *symtab; ++ Elf32_Rela *rpnt; ++ unsigned int *reloc_addr; ++ unsigned int symbol_addr; ++ int symtab_index; ++ /* Now parse the relocation information */ ++ ++ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof (Elf32_Rela); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] ++ + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) ++ { ++ reloc_addr = (int *) (tpnt->loadaddr + (int) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE (rpnt->r_info); ++ symtab_index = ELF32_R_SYM (rpnt->r_info); ++ symbol_addr = 0; ++ ++ if (tpnt->libtype == program_interpreter ++ && (!symtab_index ++ || _dl_symbol (strtab + symtab[symtab_index].st_name))) ++ continue; ++ ++ if (symtab_index) ++ { ++ symbol_addr = (unsigned int) ++ _dl_find_hash (strtab + symtab[symtab_index].st_name, ++ tpnt->symbol_scope, ++ reloc_type == R_68K_JMP_SLOT ? tpnt : NULL, symbolrel); ++ ++ /* We want to allow undefined references to weak symbols - ++ this might have been intentional. We should not be ++ linking local symbols here, so all bases should be ++ covered. */ ++ if (!symbol_addr ++ && ELF32_ST_BIND (symtab[symtab_index].st_info) == STB_GLOBAL) ++ { ++ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ goof++; ++ } ++ } ++ switch (reloc_type) ++ { ++ case R_68K_NONE: ++ break; ++ case R_68K_8: ++ *(char *) reloc_addr = symbol_addr + rpnt->r_addend; ++ break; ++ case R_68K_16: ++ *(short *) reloc_addr = symbol_addr + rpnt->r_addend; ++ break; ++ case R_68K_32: ++ *reloc_addr = symbol_addr + rpnt->r_addend; ++ break; ++ case R_68K_PC8: ++ *(char *) reloc_addr = (symbol_addr + rpnt->r_addend ++ - (unsigned int) reloc_addr); ++ break; ++ case R_68K_PC16: ++ *(short *) reloc_addr = (symbol_addr + rpnt->r_addend ++ - (unsigned int) reloc_addr); ++ break; ++ case R_68K_PC32: ++ *reloc_addr = (symbol_addr + rpnt->r_addend ++ - (unsigned int) reloc_addr); ++ break; ++ case R_68K_GLOB_DAT: ++ case R_68K_JMP_SLOT: ++ *reloc_addr = symbol_addr; ++ break; ++ case R_68K_RELATIVE: ++ *reloc_addr = ((unsigned int) tpnt->loadaddr ++ /* Compatibility kludge. */ ++ + (rpnt->r_addend ? : *reloc_addr)); ++ break; ++ case R_68K_COPY: ++#if 0 /* Do this later. */ ++ _dl_dprintf (2, "Doing copy"); ++ if (symtab_index) ++ _dl_dprintf (2, " for symbol %s", ++ strtab + symtab[symtab_index].st_name); ++ _dl_dprintf (2, "\n"); ++ _dl_memcpy ((void *) symtab[symtab_index].st_value, ++ (void *) symbol_addr, ++ symtab[symtab_index].st_size); ++#endif ++ break; ++ default: ++ _dl_dprintf (2, "%s: can't handle reloc type ", _dl_progname); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf (2, "%s ", _dl_reltypes[reloc_type]); ++#endif ++ if (symtab_index) ++ _dl_dprintf (2, "'%s'", strtab + symtab[symtab_index].st_name); ++ _dl_dprintf (2, "\n"); ++ _dl_exit (1); ++ } ++ ++ } ++ return goof; ++} ++ ++/* This is done as a separate step, because there are cases where ++ information is first copied and later initialized. This results in ++ the wrong information being copied. Someone at Sun was complaining about ++ a bug in the handling of _COPY by SVr4, and this may in fact be what he ++ was talking about. Sigh. */ ++ ++/* No, there are cases where the SVr4 linker fails to emit COPY relocs ++ at all. */ ++ ++int ++_dl_parse_copy_information (struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ int i; ++ char *strtab; ++ int reloc_type; ++ int goof = 0; ++ Elf32_Sym *symtab; ++ Elf32_Rela *rpnt; ++ unsigned int *reloc_addr; ++ unsigned int symbol_addr; ++ struct elf_resolve *tpnt; ++ int symtab_index; ++ /* Now parse the relocation information */ ++ ++ tpnt = xpnt->dyn; ++ ++ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof (Elf32_Rela); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] ++ + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) ++ { ++ reloc_addr = (int *) (tpnt->loadaddr + (int) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE (rpnt->r_info); ++ if (reloc_type != R_68K_COPY) ++ continue; ++ symtab_index = ELF32_R_SYM (rpnt->r_info); ++ symbol_addr = 0; ++ if (tpnt->libtype == program_interpreter ++ && (!symtab_index ++ || _dl_symbol (strtab + symtab[symtab_index].st_name))) ++ continue; ++ if (symtab_index) ++ { ++ symbol_addr = (unsigned int) ++ _dl_find_hash (strtab + symtab[symtab_index].st_name, ++ xpnt->next, NULL, copyrel); ++ if (!symbol_addr) ++ { ++ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ goof++; ++ } ++ } ++ if (!goof) ++ _dl_memcpy ((void *) symtab[symtab_index].st_value, (void *) symbol_addr, ++ symtab[symtab_index].st_size); ++ } ++ return goof; ++} +diff -urN uClibc/ldso-0.9.24/ldso/m68k/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/m68k/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/m68k/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/m68k/ld_syscalls.h 2002-03-19 04:43:32.000000000 -0600 +@@ -0,0 +1,174 @@ ++/* ++ * This file contains the system call macros and syscall ++ * numbers used by the shared library loader. ++ */ ++ ++#define __NR_exit 1 ++#define __NR_read 3 ++#define __NR_write 4 ++#define __NR_open 5 ++#define __NR_close 6 ++#define __NR_getuid 24 ++#define __NR_geteuid 49 ++#define __NR_getgid 47 ++#define __NR_getegid 50 ++#define __NR_readlink 85 ++#define __NR_mmap 90 ++#define __NR_munmap 91 ++#define __NR_stat 106 ++#define __NR_mprotect 125 ++ ++ ++/* Here are the macros which define how this platform makes ++ * system calls. This particular variant does _not_ set ++ * errno (note how it is disabled in __syscall_return) since ++ * these will get called before the errno symbol is dynamicly ++ * linked. */ ++ ++ ++#define __syscall_return(type, res) \ ++do { \ ++ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ ++ /* avoid using res which is declared to be in register d0; \ ++ errno might expand to a function call and clobber it. */ \ ++ /* int __err = -(res); \ ++ errno = __err; */ \ ++ res = -1; \ ++ } \ ++ return (type) (res); \ ++} while (0) ++ ++#define _syscall0(type, name) \ ++type name(void) \ ++{ \ ++ long __res; \ ++ __asm__ __volatile__ ("movel %1, %%d0\n\t" \ ++ "trap #0\n\t" \ ++ "movel %%d0, %0" \ ++ : "=g" (__res) \ ++ : "i" (__NR_##name) \ ++ : "cc", "%d0"); \ ++ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ ++ /* errno = -__res; */ \ ++ __res = -1; \ ++ } \ ++ return (type)__res; \ ++} ++ ++#define _syscall1(type, name, atype, a) \ ++type name(atype a) \ ++{ \ ++ long __res; \ ++ __asm__ __volatile__ ("movel %2, %%d1\n\t" \ ++ "movel %1, %%d0\n\t" \ ++ "trap #0\n\t" \ ++ "movel %%d0, %0" \ ++ : "=g" (__res) \ ++ : "i" (__NR_##name), \ ++ "g" ((long)a) \ ++ : "cc", "%d0", "%d1"); \ ++ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ ++ /* errno = -__res; */ \ ++ __res = -1; \ ++ } \ ++ return (type)__res; \ ++} ++ ++#define _syscall2(type, name, atype, a, btype, b) \ ++type name(atype a, btype b) \ ++{ \ ++ long __res; \ ++ __asm__ __volatile__ ("movel %3, %%d2\n\t" \ ++ "movel %2, %%d1\n\t" \ ++ "movel %1, %%d0\n\t" \ ++ "trap #0\n\t" \ ++ "movel %%d0, %0" \ ++ : "=g" (__res) \ ++ : "i" (__NR_##name), \ ++ "a" ((long)a), \ ++ "g" ((long)b) \ ++ : "cc", "%d0", "%d1", "%d2"); \ ++ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ ++ /* errno = -__res; */ \ ++ __res = -1; \ ++ } \ ++ return (type)__res; \ ++} ++ ++#define _syscall3(type, name, atype, a, btype, b, ctype, c) \ ++type name(atype a, btype b, ctype c) \ ++{ \ ++ long __res; \ ++ __asm__ __volatile__ ("movel %4, %%d3\n\t" \ ++ "movel %3, %%d2\n\t" \ ++ "movel %2, %%d1\n\t" \ ++ "movel %1, %%d0\n\t" \ ++ "trap #0\n\t" \ ++ "movel %%d0, %0" \ ++ : "=g" (__res) \ ++ : "i" (__NR_##name), \ ++ "a" ((long)a), \ ++ "a" ((long)b), \ ++ "g" ((long)c) \ ++ : "cc", "%d0", "%d1", "%d2", "%d3"); \ ++ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ ++ /* errno = -__res; */ \ ++ __res = -1; \ ++ } \ ++ return (type)__res; \ ++} ++ ++#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \ ++type name(atype a, btype b, ctype c, dtype d) \ ++{ \ ++ long __res; \ ++ __asm__ __volatile__ ("movel %5, %%d4\n\t" \ ++ "movel %4, %%d3\n\t" \ ++ "movel %3, %%d2\n\t" \ ++ "movel %2, %%d1\n\t" \ ++ "movel %1, %%d0\n\t" \ ++ "trap #0\n\t" \ ++ "movel %%d0, %0" \ ++ : "=g" (__res) \ ++ : "i" (__NR_##name), \ ++ "a" ((long)a), \ ++ "a" ((long)b), \ ++ "a" ((long)c), \ ++ "g" ((long)d) \ ++ : "cc", "%d0", "%d1", "%d2", "%d3", \ ++ "%d4"); \ ++ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ ++ /* errno = -__res; */ \ ++ __res = -1; \ ++ } \ ++ return (type)__res; \ ++} ++ ++#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e)\ ++type name(atype a, btype b, ctype c, dtype d, etype e) \ ++{ \ ++ long __res; \ ++ __asm__ __volatile__ ("movel %6, %%d5\n\t" \ ++ "movel %5, %%d4\n\t" \ ++ "movel %4, %%d3\n\t" \ ++ "movel %3, %%d2\n\t" \ ++ "movel %2, %%d1\n\t" \ ++ "movel %1, %%d0\n\t" \ ++ "trap #0\n\t" \ ++ "movel %%d0, %0" \ ++ : "=g" (__res) \ ++ : "i" (__NR_##name), \ ++ "a" ((long)a), \ ++ "a" ((long)b), \ ++ "a" ((long)c), \ ++ "a" ((long)d), \ ++ "g" ((long)e) \ ++ : "cc", "%d0", "%d1", "%d2", "%d3", \ ++ "%d4", "%d5"); \ ++ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ ++ /* errno = -__res; */ \ ++ __res = -1; \ ++ } \ ++ return (type)__res; \ ++} ++ +diff -urN uClibc/ldso-0.9.24/ldso/m68k/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/m68k/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/m68k/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/m68k/ld_sysdep.h 2002-05-28 16:33:34.000000000 -0500 +@@ -0,0 +1,88 @@ ++ ++/* Various assmbly language/system dependent hacks that are required ++ so that we can minimize the amount of platform specific code. */ ++ ++/* Define this if the system uses RELOCA. */ ++#define ELF_USES_RELOCA ++ ++/* Get a pointer to the argv array. On many platforms this can be ++ just the address if the first argument, on other platforms we need ++ to do something a little more subtle here. */ ++#define GET_ARGV(ARGVP, ARGS) ((ARGVP) = ((unsigned int *) &(ARGS))) ++ ++/* Initialization sequence for a GOT. */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++{ \ ++ GOT_BASE[2] = (int) _dl_linux_resolve; \ ++ GOT_BASE[1] = (int) (MODULE); \ ++} ++ ++/* Here is a macro to perform a relocation. This is only used when ++ bootstrapping the dynamic loader. RELP is the relocation that we ++ are performing, REL is the pointer to the address we are ++ relocating. SYMBOL is the symbol involved in the relocation, and ++ LOAD is the load address. */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ switch (ELF32_R_TYPE ((RELP)->r_info)) \ ++ { \ ++ case R_68K_8: \ ++ *(char *) (REL) = (SYMBOL) + (RELP)->r_addend; \ ++ break; \ ++ case R_68K_16: \ ++ *(short *) (REL) = (SYMBOL) + (RELP)->r_addend; \ ++ break; \ ++ case R_68K_32: \ ++ *(REL) = (SYMBOL) + (RELP)->r_addend; \ ++ break; \ ++ case R_68K_PC8: \ ++ *(char *) (REL) = ((SYMBOL) + (RELP)->r_addend \ ++ - (unsigned int) (REL)); \ ++ break; \ ++ case R_68K_PC16: \ ++ *(short *) (REL) = ((SYMBOL) + (RELP)->r_addend \ ++ - (unsigned int) (REL)); \ ++ break; \ ++ case R_68K_PC32: \ ++ *(REL) = ((SYMBOL) + (RELP)->r_addend \ ++ - (unsigned int) (REL)); \ ++ break; \ ++ case R_68K_GLOB_DAT: \ ++ case R_68K_JMP_SLOT: \ ++ *(REL) = (SYMBOL); \ ++ break; \ ++ case R_68K_RELATIVE: /* Compatibility kludge */ \ ++ *(REL) = ((unsigned int) (LOAD) + ((RELP)->r_addend ? : *(REL))); \ ++ break; \ ++ default: \ ++ _dl_exit (1); \ ++ } ++ ++ ++/* Transfer control to the user's application, once the dynamic loader ++ is done. */ ++ ++#define START() \ ++ __asm__ volatile ("unlk %%a6\n\t" \ ++ "jmp %0@" \ ++ : : "a" (_dl_elf_main)); ++ ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++ ++#define MAGIC1 EM_68K ++#undef MAGIC2 ++/* Used for error messages */ ++#define ELF_TARGET "m68k" ++ ++struct elf_resolve; ++extern unsigned int _dl_linux_resolver (int, int, struct elf_resolve *, int); ++ ++/* Define this because we do not want to call .udiv in the library. ++ Not needed for m68k. */ ++#define do_rem(result, n, base) ((result) = (n) % (base)) ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/m68k/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/m68k/resolve.S +--- uClibc/ldso-0.9.24/ldso/m68k/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/m68k/resolve.S 2001-04-27 12:23:26.000000000 -0500 +@@ -0,0 +1,21 @@ ++/* ++ * These are various helper routines that are needed to run an ELF image. ++ */ ++ ++.text ++.even ++ ++.globl _dl_linux_resolve ++ .type _dl_linux_resolve,@function ++_dl_linux_resolve: ++ moveml %a0/%a1,%sp@- ++#ifdef __PIC__ ++ bsrl _dl_linux_resolver@PLTPC ++#else ++ jbsr _dl_linux_resolver ++#endif ++ moveml %sp@+,%a0/%a1 ++ addql #8,%sp ++ jmp @(%d0) ++.LFE2: ++ .size _dl_linux_resolve,.LFE2-_dl_linux_resolve +diff -urN uClibc/ldso-0.9.24/ldso/mips/README uClibc.ldso.24/ldso-0.9.24/ldso/mips/README +--- uClibc/ldso-0.9.24/ldso/mips/README 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/mips/README 2002-07-25 16:15:59.000000000 -0500 +@@ -0,0 +1,52 @@ ++Almost all of the code present in these source files was taken ++from GLIBC. In the descriptions below, all files mentioned are ++with respect to the top level GLIBC source directory accept for ++code taken from the Linux kernel. ++ ++boot1_arch.h ++------------ ++Contains code to fix up the stack pointer so that the dynamic ++linker can find argc, argv and Auxillary Vector Table (AVT). ++The code is taken from the function 'RTLD_START' in the file ++'sysdeps/mips/dl-machine.h'. ++ ++elfinterp.c ++----------- ++Contains the runtime resolver code taken from the function ++'__dl_runtime_resolve' in 'sysdeps/mips/dl-machine.h'. Also ++contains the function to perform relocations for objects ++other than the linker itself. The code was taken from the ++function 'elf_machine_rel' in 'sysdeps/mips/dl-machine.h'. ++ ++ld_syscalls.h ++------------- ++Used to contain all the macro functions for the system calls ++as well as the list of system calls supported. We now include ++ but with the __set_errno macro defined empty ++so we can use the same file for the linker as well as userspace. ++Original code was taken from the Linux kernel source 2.4.17 and ++can be found in the file 'include/asm-mips/unistd.h'. ++ ++ld_sysdep.h ++----------- ++Contains bootstrap code for the dynamic linker, magic numbers ++for detecting MIPS target types and some macros. The macro ++function 'PERFORM_BOOTSTRAP_GOT' is used to relocate the dynamic ++linker's GOT so that function calls can be made. The code is ++taken from the function 'ELF_MACHINE_BEFORE_RTLD_RELOC' in the ++file 'sysdeps/mips/dl-machine.h'. The other macro function ++'PERFORM_BOOTSTRAP_RELOC' is used to do the relocations for ++the dynamic loader. The code is taken from the function ++'elf_machine_rel' in the file 'sysdeps/mips/dl-machine.h'. The ++final macro function is 'INIT_GOT' which initializes the GOT ++for the application being dynamically linked and loaded. The ++code is taken from the functions 'elf_machine_runtime_setup' ++and 'elf_machine_got_rel' in 'sysdeps/mips/dl-machine.h'. ++ ++resolve.S ++--------- ++Contains the low-level assembly code for the dynamic runtime ++resolver. The code is taken from the assembly code function ++'_dl_runtime_resolve' in the file 'sysdeps/mips/dl-machine.h'. ++The code looks a bit different since we only need to pass the ++symbol index and the old GP register. +diff -urN uClibc/ldso-0.9.24/ldso/mips/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/mips/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/mips/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/mips/boot1_arch.h 2003-06-12 16:39:10.000000000 -0500 +@@ -0,0 +1,38 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. ++ */ ++ ++asm("" \ ++" .text\n" \ ++" .globl _dl_boot\n" \ ++"_dl_boot:\n" \ ++" .set noreorder\n" \ ++" bltzal $0, 0f\n" \ ++" nop\n" \ ++"0: .cpload $31\n" \ ++" .set reorder\n" \ ++" la $4, _DYNAMIC\n" \ ++" sw $4, -0x7ff0($28)\n" \ ++" move $4, $29\n" \ ++" la $8, coff\n" \ ++" .set noreorder\n" \ ++" bltzal $0, coff\n" \ ++" nop\n" \ ++"coff: subu $8, $31, $8\n" \ ++" .set reorder\n" \ ++" la $25, _dl_boot2\n" \ ++" addu $25, $8\n" \ ++" jalr $25\n" \ ++" lw $4, 0($29)\n" \ ++" la $5, 4($29)\n" \ ++" sll $6, $4, 2\n" \ ++" addu $6, $6, $5\n" \ ++" addu $6, $6, 4\n" \ ++" la $7, _dl_elf_main\n" \ ++" lw $25, 0($7)\n" \ ++" jr $25\n" \ ++); ++ ++#define _dl_boot _dl_boot2 ++#define LD_BOOT(X) static void __attribute__ ((unused)) _dl_boot (X) +diff -urN uClibc/ldso-0.9.24/ldso/mips/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/mips/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/mips/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/mips/elfinterp.c 2003-08-22 02:04:16.000000000 -0500 +@@ -0,0 +1,301 @@ ++/* vi: set sw=4 ts=4: */ ++/* mips/mipsel ELF shared library loader suppport ++ * ++ Copyright (C) 2002, Steven J. Hill (sjhill@realitydiluted.com) ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes_tab[] = ++{ ++ [0] "R_MIPS_NONE", "R_MIPS_16", "R_MIPS_32", ++ [3] "R_MIPS_REL32", "R_MIPS_26", "R_MIPS_HI16", ++ [6] "R_MIPS_LO16", "R_MIPS_GPREL16", "R_MIPS_LITERAL", ++ [9] "R_MIPS_GOT16", "R_MIPS_PC16", "R_MIPS_CALL16", ++ [12] "R_MIPS_GPREL32", ++ [16] "R_MIPS_SHIFT5", "R_MIPS_SHIFT6", "R_MIPS_64", ++ [19] "R_MIPS_GOT_DISP", "R_MIPS_GOT_PAGE", "R_MIPS_GOT_OFST", ++ [22] "R_MIPS_GOT_HI16", "R_MIPS_GOT_LO16", "R_MIPS_SUB", ++ [25] "R_MIPS_INSERT_A", "R_MIPS_INSERT_B", "R_MIPS_DELETE", ++ [28] "R_MIPS_HIGHER", "R_MIPS_HIGHEST", "R_MIPS_CALL_HI16", ++ [31] "R_MIPS_CALL_LO16", "R_MIPS_SCN_DISP", "R_MIPS_REL16", ++ [34] "R_MIPS_ADD_IMMEDIATE", "R_MIPS_PJUMP", "R_MIPS_RELGOT", ++ [37] "R_MIPS_JALR", ++}; ++ ++static const char * ++_dl_reltypes(int type) ++{ ++ static char buf[22]; ++ const char *str; ++ ++ if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) || ++ NULL == (str = _dl_reltypes_tab[type])) ++ { ++ str =_dl_simple_ltoa( buf, (unsigned long)(type)); ++ } ++ return str; ++} ++ ++static ++void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index) ++{ ++ if(_dl_debug_symbols) ++ { ++ if(symtab_index){ ++ _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_value, ++ symtab[symtab_index].st_size, ++ symtab[symtab_index].st_info, ++ symtab[symtab_index].st_other, ++ symtab[symtab_index].st_shndx); ++ } ++ } ++} ++ ++static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt) ++{ ++ if(_dl_debug_reloc) ++ { ++ int symtab_index; ++ const char *sym; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0"; ++ ++ if(_dl_debug_symbols) ++ _dl_dprintf(_dl_debug_file, "\n\t"); ++ else ++ _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym); ++#ifdef ELF_USES_RELOCA ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ rpnt->r_addend); ++#else ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset); ++#endif ++ } ++} ++#endif ++ ++extern int _dl_linux_resolve(void); ++ ++#define OFFSET_GP_GOT 0x7ff0 ++ ++unsigned long _dl_linux_resolver(unsigned long sym_index, ++ unsigned long old_gpreg) ++{ ++ unsigned long *got = (unsigned long *) (old_gpreg - OFFSET_GP_GOT); ++ struct elf_resolve *tpnt = (struct elf_resolve *) got[1]; ++ Elf32_Sym *sym; ++ char *strtab; ++ unsigned long local_gotno; ++ unsigned long gotsym; ++ unsigned long new_addr; ++ unsigned long instr_addr; ++ char **got_addr; ++ char *symname; ++ ++ gotsym = tpnt->mips_gotsym; ++ local_gotno = tpnt->mips_local_gotno; ++ ++ sym = ((Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr)) + sym_index; ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ symname = strtab + sym->st_name; ++ ++ new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name, ++ tpnt->symbol_scope, tpnt, resolver); ++ ++ /* Address of jump instruction to fix up */ ++ instr_addr = (unsigned long) (got + local_gotno + sym_index - gotsym); ++ got_addr = (char **) instr_addr; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if (_dl_debug_bindings) ++ { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname); ++ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, ++ "\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr); ++ } ++ if (!_dl_debug_nofixups) { ++ *got_addr = (char*)new_addr; ++ } ++#else ++ *got_addr = (char*)new_addr; ++#endif ++ ++ return new_addr; ++} ++ ++void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ /* Nothing to do */ ++ return; ++} ++ ++int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ /* Nothing to do */ ++ return 0; ++} ++ ++ ++int _dl_parse_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ Elf32_Sym *symtab; ++ Elf32_Rel *rpnt; ++ char *strtab; ++ unsigned long *got; ++ unsigned long *reloc_addr=NULL, old_val=0; ++ unsigned long symbol_addr; ++ int i, reloc_type, symtab_index; ++ ++ /* Now parse the relocation information */ ++ rel_size = rel_size / sizeof(Elf32_Rel); ++ rpnt = (Elf32_Rel *) (rel_addr + tpnt->loadaddr); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ got = (unsigned long *) (tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) { ++ reloc_addr = (unsigned long *) (tpnt->loadaddr + ++ (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ ++ if (!symtab_index && tpnt->libtype == program_interpreter) ++ continue; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab,strtab,symtab_index); ++ debug_reloc(symtab,strtab,rpnt); ++ old_val = *reloc_addr; ++#endif ++ ++ switch (reloc_type) { ++ case R_MIPS_REL32: ++ if (symtab_index) { ++ if (symtab_index < tpnt->mips_gotsym) ++ *reloc_addr += ++ symtab[symtab_index].st_value + ++ (unsigned long) tpnt->loadaddr; ++ else { ++ *reloc_addr += got[symtab_index + tpnt->mips_local_gotno - ++ tpnt->mips_gotsym]; ++ } ++ } ++ else { ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ } ++ break; ++ case R_MIPS_NONE: ++ break; ++ default: ++ { ++ int reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ _dl_dprintf(2, "\n%s: ",_dl_progname); ++ ++ if (symtab_index) ++ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); ++#else ++ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); ++#endif ++ _dl_exit(1); ++ } ++ }; ++ ++ }; ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n", old_val, *reloc_addr, reloc_addr); ++#endif ++ ++ return 0; ++} ++ ++void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt) ++{ ++ Elf32_Sym *sym; ++ char *strtab; ++ unsigned long i; ++ unsigned long *got_entry; ++ ++ for (; tpnt ; tpnt = tpnt->next) { ++ ++ /* We don't touch the dynamic linker */ ++ if (tpnt->libtype == program_interpreter) ++ continue; ++ ++ /* Setup the loop variables */ ++ got_entry = (unsigned long *) (tpnt->loadaddr + ++ tpnt->dynamic_info[DT_PLTGOT]) + tpnt->mips_local_gotno; ++ sym = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + ++ (unsigned long) tpnt->loadaddr) + tpnt->mips_gotsym; ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + ++ (unsigned long) tpnt->loadaddr); ++ i = tpnt->mips_symtabno - tpnt->mips_gotsym; ++ ++ /* Relocate the global GOT entries for the object */ ++ while(i--) { ++ if (sym->st_shndx == SHN_UNDEF) { ++ if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && sym->st_value) ++ *got_entry = sym->st_value + (unsigned long) tpnt->loadaddr; ++ else { ++ *got_entry = (unsigned long) _dl_find_hash(strtab + ++ sym->st_name, tpnt->symbol_scope, NULL, copyrel); ++ } ++ } ++ else if (sym->st_shndx == SHN_COMMON) { ++ *got_entry = (unsigned long) _dl_find_hash(strtab + ++ sym->st_name, tpnt->symbol_scope, NULL, copyrel); ++ } ++ else if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && ++ *got_entry != sym->st_value) ++ *got_entry += (unsigned long) tpnt->loadaddr; ++ else if (ELF32_ST_TYPE(sym->st_info) == STT_SECTION) { ++ if (sym->st_other == 0) ++ *got_entry += (unsigned long) tpnt->loadaddr; ++ } ++ else { ++ *got_entry = (unsigned long) _dl_find_hash(strtab + ++ sym->st_name, tpnt->symbol_scope, NULL, copyrel); ++ } ++ ++ got_entry++; ++ sym++; ++ } ++ } ++} +diff -urN uClibc/ldso-0.9.24/ldso/mips/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/mips/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/mips/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/mips/ld_syscalls.h 2002-08-09 07:20:20.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* Define the __set_errno macro as nothing so that we don't bother ++ * setting errno, which is important since we make system calls ++ * before the errno symbol is dynamicly linked. */ ++ ++#define __set_errno(X) {(void)(X);} ++#include "sys/syscall.h" ++ +diff -urN uClibc/ldso-0.9.24/ldso/mips/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/mips/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/mips/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/mips/ld_sysdep.h 2002-05-28 16:33:36.000000000 -0500 +@@ -0,0 +1,136 @@ ++/* vi: set sw=4 ts=4: */ ++ ++/* ++ * Various assmbly language/system dependent hacks that are required ++ * so that we can minimize the amount of platform specific code. ++ */ ++ ++/* ++ * Define this if the system uses RELOCA. ++ */ ++#undef ELF_USES_RELOCA ++ ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *) ARGS) ++ ++ ++/* ++ * Initialization sequence for the application/library GOT. ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++do { \ ++ unsigned long i; \ ++ \ ++ /* Check if this is the dynamic linker itself */ \ ++ if (MODULE->libtype == program_interpreter) \ ++ continue; \ ++ \ ++ /* Fill in first two GOT entries according to the ABI */ \ ++ GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \ ++ GOT_BASE[1] = (unsigned long) MODULE; \ ++ \ ++ /* Add load address displacement to all local GOT entries */ \ ++ i = 2; \ ++ while (i < MODULE->mips_local_gotno) \ ++ GOT_BASE[i++] += (unsigned long) MODULE->loadaddr; \ ++ \ ++} while (0) ++ ++ ++/* ++ * Here is a macro to perform the GOT relocation. This is only ++ * used when bootstrapping the dynamic loader. ++ */ ++#define PERFORM_BOOTSTRAP_GOT(got) \ ++do { \ ++ Elf32_Sym *sym; \ ++ unsigned long i; \ ++ \ ++ /* Add load address displacement to all local GOT entries */ \ ++ i = 2; \ ++ while (i < tpnt->mips_local_gotno) \ ++ got[i++] += load_addr; \ ++ \ ++ /* Handle global GOT entries */ \ ++ got += tpnt->mips_local_gotno; \ ++ sym = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + \ ++ load_addr) + tpnt->mips_gotsym; \ ++ i = tpnt->mips_symtabno - tpnt->mips_gotsym; \ ++ \ ++ while (i--) { \ ++ if (sym->st_shndx == SHN_UNDEF || \ ++ sym->st_shndx == SHN_COMMON) \ ++ *got = load_addr + sym->st_value; \ ++ else if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && \ ++ *got != sym->st_value) \ ++ *got += load_addr; \ ++ else if (ELF32_ST_TYPE(sym->st_info) == STT_SECTION) { \ ++ if (sym->st_other == 0) \ ++ *got += load_addr; \ ++ } \ ++ else \ ++ *got = load_addr + sym->st_value; \ ++ \ ++ got++; \ ++ sym++; \ ++ } \ ++} while (0) ++ ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. ++ */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ switch(ELF32_R_TYPE((RELP)->r_info)) { \ ++ case R_MIPS_REL32: \ ++ if (symtab_index) { \ ++ if (symtab_index < tpnt->mips_gotsym) \ ++ *REL += SYMBOL; \ ++ } \ ++ else { \ ++ *REL += LOAD; \ ++ } \ ++ break; \ ++ case R_MIPS_NONE: \ ++ break; \ ++ default: \ ++ SEND_STDERR("Aiieeee!"); \ ++ _dl_exit(1); \ ++ } ++ ++ ++/* ++ * Transfer control to the user's application, once the dynamic loader ++ * is done. This routine has to exit the current function, then ++ * call the _dl_elf_main function. For MIPS, we do it in assembly ++ * because the stack doesn't get properly restored otherwise. Got look ++ * at boot1_arch.h ++ */ ++#define START() ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++#define MAGIC1 EM_MIPS ++#define MAGIC2 EM_MIPS_RS3_LE ++ ++ ++/* Used for error messages */ ++#define ELF_TARGET "MIPS" ++ ++ ++unsigned long _dl_linux_resolver(unsigned long sym_index, ++ unsigned long old_gpreg); ++ ++ ++#define do_rem(result, n, base) result = (n % base) ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/mips/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/mips/resolve.S +--- uClibc/ldso-0.9.24/ldso/mips/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/mips/resolve.S 2003-01-30 10:40:26.000000000 -0600 +@@ -0,0 +1,45 @@ ++ /* ++ * Linux dynamic resolving code for MIPS. Fixes up the GOT entry as ++ * indicated in register t8 and jumps to the resolved address. Shamelessly ++ * ripped from 'sysdeps/mips/dl-machine.h' in glibc-2.2.5. ++ * ++ * This file is subject to the terms and conditions of the GNU Lesser General ++ * Public License. See the file "COPYING.LIB" in the main directory of this ++ * archive for more details. ++ * ++ * Copyright (C) 1996-2001 Kazumoto Kojima ++ * Copyright (C) 2002 Steven J. Hill ++ * ++ */ ++.text ++.align 2 ++.globl _dl_linux_resolve ++.type _dl_linux_resolve,@function ++.ent _dl_linux_resolve ++_dl_linux_resolve: ++ .frame $29, 40, $31 ++ .set noreorder ++ move $3, $28 # Save GP ++ addu $25, 8 # t9 ($25) now points at .cpload instruction ++ .cpload $25 # Compute GP ++ .set reorder ++ subu $29, 40 ++ .cprestore 32 ++ sw $15, 36($29) ++ sw $4, 16($29) ++ sw $5, 20($29) ++ sw $6, 24($29) ++ sw $7, 28($29) ++ move $4, $24 ++ move $5, $3 ++ jal _dl_linux_resolver ++ lw $31, 36($29) ++ lw $4, 16($29) ++ lw $5, 20($29) ++ lw $6, 24($29) ++ lw $7, 28($29) ++ addu $29, 40 ++ move $25, $2 ++ jr $25 ++.size _dl_linux_resolve,.-_dl_linux_resolve ++.end _dl_linux_resolve +diff -urN uClibc/ldso-0.9.24/ldso/powerpc/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/powerpc/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/boot1_arch.h 2003-02-15 19:22:41.000000000 -0600 +@@ -0,0 +1,20 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. */ ++ ++/* Overrive the default _dl_boot function, and replace it with a bit of asm. ++ * Then call the real _dl_boot function, which is now named _dl_boot2. */ ++ ++asm("" \ ++" .text\n" \ ++" .globl _dl_boot\n" \ ++"_dl_boot:\n" \ ++" mr 3,1\n" \ ++" addi 1,1,-16\n" \ ++" bl _dl_boot2\n" \ ++".previous\n" \ ++); ++ ++#define _dl_boot _dl_boot2 ++#define LD_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X) ++ +diff -urN uClibc/ldso-0.9.24/ldso/powerpc/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/powerpc/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/elfinterp.c 2003-12-03 17:28:33.000000000 -0600 +@@ -0,0 +1,621 @@ ++/* vi: set sw=4 ts=4: */ ++/* powerpc shared library loader suppport ++ * ++ * Copyright (C) 2001-2002, David A. Schleef ++ * Copyright (C) 2003, Erik Andersen ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes_tab[] = ++ { "R_PPC_NONE", "R_PPC_ADDR32", "R_PPC_ADDR24", "R_PPC_ADDR16", ++ "R_PPC_ADDR16_LO", "R_PPC_ADDR16_HI", "R_PPC_ADDR16_HA", ++ "R_PPC_ADDR14", "R_PPC_ADDR14_BRTAKEN", "R_PPC_ADDR14_BRNTAKEN", ++ "R_PPC_REL24", "R_PPC_REL14", "R_PPC_REL14_BRTAKEN", ++ "R_PPC_REL14_BRNTAKEN", "R_PPC_GOT16", "R_PPC_GOT16_LO", ++ "R_PPC_GOT16_HI", "R_PPC_GOT16_HA", "R_PPC_PLTREL24", ++ "R_PPC_COPY", "R_PPC_GLOB_DAT", "R_PPC_JMP_SLOT", "R_PPC_RELATIVE", ++ "R_PPC_LOCAL24PC", "R_PPC_UADDR32", "R_PPC_UADDR16", "R_PPC_REL32", ++ "R_PPC_PLT32", "R_PPC_PLTREL32", "R_PPC_PLT16_LO", "R_PPC_PLT16_HI", ++ "R_PPC_PLT16_HA", "R_PPC_SDAREL16", "R_PPC_SECTOFF", ++ "R_PPC_SECTOFF_LO", "R_PPC_SECTOFF_HI", "R_PPC_SECTOFF_HA", ++}; ++ ++static const char * ++_dl_reltypes(int type) ++{ ++ static char buf[22]; ++ const char *str; ++ ++ if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) || ++ NULL == (str = _dl_reltypes_tab[type])) ++ { ++ str =_dl_simple_ltoa( buf, (unsigned long)(type)); ++ } ++ return str; ++} ++ ++static ++void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index) ++{ ++ if(_dl_debug_symbols) ++ { ++ if(symtab_index){ ++ _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_value, ++ symtab[symtab_index].st_size, ++ symtab[symtab_index].st_info, ++ symtab[symtab_index].st_other, ++ symtab[symtab_index].st_shndx); ++ } ++ } ++} ++ ++static ++void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt) ++{ ++ if(_dl_debug_reloc) ++ { ++ int symtab_index; ++ const char *sym; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0"; ++ ++ if(_dl_debug_symbols) ++ _dl_dprintf(_dl_debug_file, "\n\t"); ++ else ++ _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym); ++#ifdef ELF_USES_RELOCA ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ rpnt->r_addend); ++#else ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset); ++#endif ++ } ++} ++#endif ++ ++extern int _dl_linux_resolve(void); ++ ++void _dl_init_got(unsigned long *plt,struct elf_resolve *tpnt) ++{ ++ unsigned long target_addr = (unsigned long)_dl_linux_resolve; ++ unsigned int n_plt_entries; ++ unsigned long *tramp; ++ unsigned long data_words; ++ unsigned int rel_offset_words; ++ ++ //DPRINTF("init_got plt=%x, tpnt=%x\n", (unsigned long)plt,(unsigned long)tpnt); ++ ++ n_plt_entries = tpnt->dynamic_info[DT_PLTRELSZ] / sizeof(ELF_RELOC); ++ //DPRINTF("n_plt_entries %d\n",n_plt_entries); ++ ++ rel_offset_words = PLT_DATA_START_WORDS(n_plt_entries); ++ //DPRINTF("rel_offset_words %x\n",rel_offset_words); ++ data_words = (unsigned long)(plt + rel_offset_words); ++ //DPRINTF("data_words %x\n",data_words); ++ ++ tpnt->data_words = data_words; ++ ++ plt[PLT_LONGBRANCH_ENTRY_WORDS] = OPCODE_ADDIS_HI(11, 11, data_words); ++ plt[PLT_LONGBRANCH_ENTRY_WORDS+1] = OPCODE_LWZ(11,data_words,11); ++ ++ plt[PLT_LONGBRANCH_ENTRY_WORDS+2] = OPCODE_MTCTR(11); ++ plt[PLT_LONGBRANCH_ENTRY_WORDS+3] = OPCODE_BCTR(); ++ ++ /* [4] */ ++ /* [5] */ ++ ++ tramp = plt + PLT_TRAMPOLINE_ENTRY_WORDS; ++ tramp[0] = OPCODE_ADDIS_HI(11,11,-data_words); ++ tramp[1] = OPCODE_ADDI(11,11,-data_words); ++ tramp[2] = OPCODE_SLWI(12,11,1); ++ tramp[3] = OPCODE_ADD(11,12,11); ++ tramp[4] = OPCODE_LI(12,target_addr); ++ tramp[5] = OPCODE_ADDIS_HI(12,12,target_addr); ++ tramp[6] = OPCODE_MTCTR(12); ++ tramp[7] = OPCODE_LI(12,(unsigned long)tpnt); ++ tramp[8] = OPCODE_ADDIS_HI(12,12,(unsigned long)tpnt); ++ tramp[9] = OPCODE_BCTR(); ++ ++ /* [16] unused */ ++ /* [17] unused */ ++ ++ /* instructions were modified */ ++ PPC_DCBST(plt); ++ PPC_DCBST(plt+4); ++ PPC_DCBST(plt+8); ++ PPC_DCBST(plt+12); ++ PPC_DCBST(plt+16-1); ++ PPC_SYNC; ++ PPC_ICBI(plt); ++ PPC_ICBI(plt+4); /* glibc thinks this is not needed */ ++ PPC_ICBI(plt+8); /* glibc thinks this is not needed */ ++ PPC_ICBI(plt+12); /* glibc thinks this is not needed */ ++ PPC_ICBI(plt+16-1); ++ PPC_ISYNC; ++} ++ ++unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) ++{ ++ int reloc_type; ++ ELF_RELOC *this_reloc; ++ char *strtab; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rel_addr; ++ int symtab_index; ++ char *symname; ++ unsigned long insn_addr; ++ unsigned long *insns; ++ unsigned long new_addr; ++ unsigned long delta; ++ ++ rel_addr = (ELF_RELOC *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr); ++ ++ this_reloc = (void *)rel_addr + reloc_entry; ++ reloc_type = ELF32_R_TYPE(this_reloc->r_info); ++ symtab_index = ELF32_R_SYM(this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ symname = strtab + symtab[symtab_index].st_name; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab,strtab,symtab_index); ++ debug_reloc(symtab,strtab,this_reloc); ++#endif ++ ++ if (reloc_type != R_PPC_JMP_SLOT) { ++ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocation\n", _dl_progname); ++ _dl_exit(1); ++ }; ++ ++ /* Address of dump instruction to fix up */ ++ insn_addr = (unsigned long) tpnt->loadaddr + ++ (unsigned long) this_reloc->r_offset; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\n\tResolving symbol %s %x --> ", symname, insn_addr); ++#endif ++ ++ /* Get the address of the GOT entry */ ++ new_addr = (unsigned long) _dl_find_hash( ++ strtab + symtab[symtab_index].st_name, ++ tpnt->symbol_scope, tpnt, resolver); ++ if (!new_addr) { ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, symname); ++ _dl_exit(1); ++ }; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "%x\n", new_addr); ++#endif ++ ++ insns = (unsigned long *)insn_addr; ++ delta = new_addr - insn_addr; ++ ++ if(delta<<6>>6 == delta){ ++ insns[0] = OPCODE_B(delta); ++ }else if (new_addr <= 0x01fffffc || new_addr >= 0xfe000000){ ++ insns[0] = OPCODE_BA (new_addr); ++ }else{ ++ /* Warning: we don't handle double-sized PLT entries */ ++ unsigned long plt_addr; ++ unsigned long *ptr; ++ int index; ++ ++ plt_addr = (unsigned long)tpnt->dynamic_info[DT_PLTGOT] + ++ (unsigned long)tpnt->loadaddr; ++ ++ delta = PLT_LONGBRANCH_ENTRY_WORDS*4 - (insn_addr-plt_addr+4); ++ ++ index = (insn_addr - plt_addr - PLT_INITIAL_ENTRY_WORDS*4)/8; ++ ++ ptr = (unsigned long *)tpnt->data_words; ++ //DPRINTF("plt_addr=%x delta=%x index=%x ptr=%x\n", plt_addr, delta, index, ptr); ++ insns += 1; ++ ++ ptr[index] = new_addr; ++ PPC_SYNC; ++ /* icache sync is not necessary, since this will be a data load */ ++ //PPC_DCBST(ptr+index); ++ //PPC_SYNC; ++ //PPC_ICBI(ptr+index); ++ //PPC_ISYNC; ++ ++ insns[0] = OPCODE_B(delta); ++ ++ } ++ ++ /* instructions were modified */ ++ PPC_DCBST(insns); ++ PPC_SYNC; ++ PPC_ICBI(insns); ++ PPC_ISYNC; ++ ++ return new_addr; ++} ++ ++static int ++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, ++ unsigned long rel_addr, unsigned long rel_size, ++ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)) ++{ ++ unsigned int i; ++ char *strtab; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rpnt; ++ int symtab_index; ++ ++ /* Now parse the relocation information */ ++ rpnt = (ELF_RELOC *)(intptr_t) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof(ELF_RELOC); ++ ++ symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) { ++ int res; ++ ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ ++ /* When the dynamic linker bootstrapped itself, it resolved some symbols. ++ Make sure we do not do them again */ ++ if (!symtab_index && tpnt->libtype == program_interpreter) ++ continue; ++ if (symtab_index && tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab,strtab,symtab_index); ++ debug_reloc(symtab,strtab,rpnt); ++#endif ++ ++ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab); ++ ++ if (res==0) continue; ++ ++ _dl_dprintf(2, "\n%s: ",_dl_progname); ++ ++ if (symtab_index) ++ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); ++ ++ if (res <0) ++ { ++ int reloc_type = ELF32_R_TYPE(rpnt->r_info); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); ++#else ++ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); ++#endif ++ _dl_exit(-res); ++ } ++ else if (res >0) ++ { ++ _dl_dprintf(2, "can't resolve symbol\n"); ++ return res; ++ } ++ } ++ return 0; ++} ++ ++static int ++_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ unsigned long reloc_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ (void)scope; ++ (void)symtab; ++ (void)strtab; ++ ++ reloc_addr = (unsigned long)tpnt->loadaddr + (unsigned long) rpnt->r_offset; ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = reloc_addr; ++#endif ++ ++ switch (reloc_type) { ++ case R_PPC_NONE: ++ return 0; ++ break; ++ case R_PPC_JMP_SLOT: ++ { ++ int index; ++ unsigned long delta; ++ unsigned long *plt; ++ unsigned long *insns; ++ ++ plt = (unsigned long *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr); ++ ++ delta = (unsigned long)(plt+PLT_TRAMPOLINE_ENTRY_WORDS+2) - (reloc_addr+4); ++ ++ index = (reloc_addr - (unsigned long)(plt+PLT_INITIAL_ENTRY_WORDS)) ++ /sizeof(unsigned long); ++ index /= 2; ++ //DPRINTF(" index %x delta %x\n",index,delta); ++ insns = (unsigned long *)reloc_addr; ++ insns[0] = OPCODE_LI(11,index*4); ++ insns[1] = OPCODE_B(delta); ++ break; ++ } ++ default: ++#if 0 ++ _dl_dprintf(2, "%s: (LAZY) can't handle reloc type ", ++ _dl_progname); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]); ++#endif ++ if (symtab_index) ++ _dl_dprintf(2, "'%s'\n", strtab + symtab[symtab_index].st_name); ++#endif ++ //_dl_exit(1); ++ return -1; ++ }; ++ ++ /* instructions were modified */ ++ PPC_DCBST(reloc_addr); ++ PPC_DCBST(reloc_addr+4); ++ PPC_SYNC; ++ PPC_ICBI(reloc_addr); ++ PPC_ICBI(reloc_addr+4); ++ PPC_ISYNC; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x", old_val, reloc_addr); ++#endif ++ return 0; ++ ++} ++ ++static int ++_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ char *symname; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, ++ (reloc_type == R_PPC_JMP_SLOT ? tpnt : NULL), symbolrel); ++ ++ /* ++ * We want to allow undefined references to weak symbols - this might ++ * have been intentional. We should not be linking local symbols ++ * here, so all bases should be covered. ++ */ ++ ++ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s'\n", ++ symname, tpnt->libname); ++#endif ++ return 0; ++ } ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_PPC_NONE: ++ return 0; ++ break; ++ case R_PPC_REL24: ++#if 0 ++ { ++ unsigned long delta = symbol_addr - (unsigned long)reloc_addr; ++ if(delta<<6>>6 != delta){ ++ _dl_dprintf(2,"R_PPC_REL24: Reloc out of range\n"); ++ _dl_exit(1); ++ } ++ *reloc_addr &= 0xfc000003; ++ *reloc_addr |= delta&0x03fffffc; ++ } ++ break; ++#else ++ _dl_dprintf(2, "%s: symbol '%s' is type R_PPC_REL24\n\tCompile shared libraries with -fPIC!\n", ++ _dl_progname, symname); ++ _dl_exit(1); ++#endif ++ case R_PPC_RELATIVE: ++ *reloc_addr = (unsigned long)tpnt->loadaddr + (unsigned long)rpnt->r_addend; ++ break; ++ case R_PPC_ADDR32: ++ *reloc_addr += symbol_addr; ++ break; ++ case R_PPC_ADDR16_HA: ++ /* XXX is this correct? */ ++ *(short *)reloc_addr += (symbol_addr+0x8000)>>16; ++ break; ++ case R_PPC_ADDR16_HI: ++ *(short *)reloc_addr += symbol_addr>>16; ++ break; ++ case R_PPC_ADDR16_LO: ++ *(short *)reloc_addr += symbol_addr; ++ break; ++ case R_PPC_JMP_SLOT: ++ { ++ unsigned long targ_addr = (unsigned long)*reloc_addr; ++ unsigned long delta = targ_addr - (unsigned long)reloc_addr; ++ if(delta<<6>>6 == delta){ ++ *reloc_addr = OPCODE_B(delta); ++ }else if (targ_addr <= 0x01fffffc || targ_addr >= 0xfe000000){ ++ *reloc_addr = OPCODE_BA (targ_addr); ++ }else{ ++ { ++ int index; ++ unsigned long delta2; ++ unsigned long *plt, *ptr; ++ plt = (unsigned long *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr); ++ ++ delta2 = (unsigned long)(plt+PLT_LONGBRANCH_ENTRY_WORDS) ++ - (unsigned long)(reloc_addr+1); ++ ++ index = ((unsigned long)reloc_addr - ++ (unsigned long)(plt+PLT_INITIAL_ENTRY_WORDS)) ++ /sizeof(unsigned long); ++ index /= 2; ++ //DPRINTF(" index %x delta %x\n",index,delta2); ++ ptr = (unsigned long *)tpnt->data_words; ++ ptr[index] = targ_addr; ++ reloc_addr[0] = OPCODE_LI(11,index*4); ++ reloc_addr[1] = OPCODE_B(delta2); ++ ++ /* instructions were modified */ ++ PPC_DCBST(reloc_addr+1); ++ PPC_SYNC; ++ PPC_ICBI(reloc_addr+1); ++ } ++ } ++ break; ++ } ++ case R_PPC_GLOB_DAT: ++ *reloc_addr += symbol_addr; ++ break; ++ case R_PPC_COPY: ++ // handled later ++ return 0; ++ break; ++ default: ++#if 0 ++ _dl_dprintf(2, "%s: can't handle reloc type ", _dl_progname); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]); ++#endif ++ if (symtab_index) ++ _dl_dprintf(2, "'%s'\n", strtab + symtab[symtab_index].st_name); ++#endif ++ //_dl_exit(1); ++ return -1; ++ }; ++ ++ /* instructions were modified */ ++ PPC_DCBST(reloc_addr); ++ PPC_SYNC; ++ PPC_ICBI(reloc_addr); ++ PPC_ISYNC; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ ++ return 0; ++} ++ ++ ++/* This is done as a separate step, because there are cases where ++ information is first copied and later initialized. This results in ++ the wrong information being copied. Someone at Sun was complaining about ++ a bug in the handling of _COPY by SVr4, and this may in fact be what he ++ was talking about. Sigh. */ ++static int ++_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ int goof = 0; ++ char *symname; ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ if (reloc_type != R_PPC_COPY) ++ return 0; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel); ++ if (!symbol_addr) goof++; ++ } ++ if (!goof) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_move) ++ _dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x", ++ symname, symtab[symtab_index].st_size, ++ symbol_addr, symtab[symtab_index].st_value); ++#endif ++ _dl_memcpy((char *) reloc_addr, ++ (char *) symbol_addr, symtab[symtab_index].st_size); ++ } ++ ++ return goof; ++} ++ ++void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void) type; ++ (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); ++} ++ ++int _dl_parse_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void) type; ++ return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc); ++} ++ ++int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ (void) type; ++ return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy); ++} ++ ++ +diff -urN uClibc/ldso-0.9.24/ldso/powerpc/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/powerpc/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/ld_syscalls.h 2003-06-14 20:08:43.000000000 -0500 +@@ -0,0 +1,244 @@ ++/* ++ * This file contains the system call macros and syscall ++ * numbers used by the shared library loader. ++ */ ++ ++#define __NR_exit 1 ++#define __NR_read 3 ++#define __NR_write 4 ++#define __NR_open 5 ++#define __NR_close 6 ++#define __NR_getpid 20 ++#define __NR_getuid 24 ++#define __NR_geteuid 49 ++#define __NR_getgid 47 ++#define __NR_getegid 50 ++#define __NR_readlink 85 ++#define __NR_mmap 90 ++#define __NR_munmap 91 ++#define __NR_stat 106 ++#define __NR_mprotect 125 ++ ++/* Here are the macros which define how this platform makes ++ * system calls. This particular variant does _not_ set ++ * errno (note how it is disabled in __syscall_return) since ++ * these will get called before the errno symbol is dynamicly ++ * linked. */ ++ ++#undef __syscall_return ++#define __syscall_return(type) \ ++ return (__sc_err & 0x10000000 ? /*errno = __sc_ret,*/ __sc_ret = -1 : 0), \ ++ (type) __sc_ret ++ ++#undef __syscall_clobbers ++#define __syscall_clobbers \ ++ "r9", "r10", "r11", "r12" ++ //"r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ++ ++#undef _syscall0 ++#define _syscall0(type,name) \ ++type name(void) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0) \ ++ : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++#undef _syscall1 ++#define _syscall1(type,name,type1,arg1) \ ++type name(type1 arg1) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ \ ++ __sc_3 = (unsigned long) (arg1); \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0) \ ++ : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++#undef _syscall2 ++#define _syscall2(type,name,type1,arg1,type2,arg2) \ ++type name(type1 arg1, type2 arg2) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ register unsigned long __sc_4 __asm__ ("r4"); \ ++ \ ++ __sc_3 = (unsigned long) (arg1); \ ++ __sc_4 = (unsigned long) (arg2); \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0), \ ++ "r" (__sc_4) \ ++ : "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++#undef _syscall3 ++#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ ++type name(type1 arg1, type2 arg2, type3 arg3) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ register unsigned long __sc_4 __asm__ ("r4"); \ ++ register unsigned long __sc_5 __asm__ ("r5"); \ ++ \ ++ __sc_3 = (unsigned long) (arg1); \ ++ __sc_4 = (unsigned long) (arg2); \ ++ __sc_5 = (unsigned long) (arg3); \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0), \ ++ "r" (__sc_4), \ ++ "r" (__sc_5) \ ++ : "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++#undef _syscall4 ++#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ ++type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ register unsigned long __sc_4 __asm__ ("r4"); \ ++ register unsigned long __sc_5 __asm__ ("r5"); \ ++ register unsigned long __sc_6 __asm__ ("r6"); \ ++ \ ++ __sc_3 = (unsigned long) (arg1); \ ++ __sc_4 = (unsigned long) (arg2); \ ++ __sc_5 = (unsigned long) (arg3); \ ++ __sc_6 = (unsigned long) (arg4); \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0), \ ++ "r" (__sc_4), \ ++ "r" (__sc_5), \ ++ "r" (__sc_6) \ ++ : "r7", "r8", "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++#undef _syscall5 ++#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ ++type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ register unsigned long __sc_4 __asm__ ("r4"); \ ++ register unsigned long __sc_5 __asm__ ("r5"); \ ++ register unsigned long __sc_6 __asm__ ("r6"); \ ++ register unsigned long __sc_7 __asm__ ("r7"); \ ++ \ ++ __sc_3 = (unsigned long) (arg1); \ ++ __sc_4 = (unsigned long) (arg2); \ ++ __sc_5 = (unsigned long) (arg3); \ ++ __sc_6 = (unsigned long) (arg4); \ ++ __sc_7 = (unsigned long) (arg5); \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0), \ ++ "r" (__sc_4), \ ++ "r" (__sc_5), \ ++ "r" (__sc_6), \ ++ "r" (__sc_7) \ ++ : "r8", "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++ ++#undef _syscall6 ++#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ ++type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ ++{ \ ++ unsigned long __sc_ret, __sc_err; \ ++ { \ ++ register unsigned long __sc_0 __asm__ ("r0"); \ ++ register unsigned long __sc_3 __asm__ ("r3"); \ ++ register unsigned long __sc_4 __asm__ ("r4"); \ ++ register unsigned long __sc_5 __asm__ ("r5"); \ ++ register unsigned long __sc_6 __asm__ ("r6"); \ ++ register unsigned long __sc_7 __asm__ ("r7"); \ ++ register unsigned long __sc_8 __asm__ ("r8"); \ ++ \ ++ __sc_3 = (unsigned long) (arg1); \ ++ __sc_4 = (unsigned long) (arg2); \ ++ __sc_5 = (unsigned long) (arg3); \ ++ __sc_6 = (unsigned long) (arg4); \ ++ __sc_7 = (unsigned long) (arg5); \ ++ __sc_8 = (unsigned long) (arg6); \ ++ __sc_0 = __NR_##name; \ ++ __asm__ __volatile__ \ ++ ("sc \n\t" \ ++ "mfcr %1 " \ ++ : "=&r" (__sc_3), "=&r" (__sc_0) \ ++ : "0" (__sc_3), "1" (__sc_0), \ ++ "r" (__sc_4), \ ++ "r" (__sc_5), \ ++ "r" (__sc_6), \ ++ "r" (__sc_7), \ ++ "r" (__sc_8) \ ++ : "r9", "r10", "r11", "r12" ); \ ++ __sc_ret = __sc_3; \ ++ __sc_err = __sc_0; \ ++ } \ ++ __syscall_return (type); \ ++} ++ ++ +diff -urN uClibc/ldso-0.9.24/ldso/powerpc/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/powerpc/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/ld_sysdep.h 2003-12-03 17:38:43.000000000 -0600 +@@ -0,0 +1,136 @@ ++/* ++ * Various assmbly language/system dependent hacks that are required ++ * so that we can minimize the amount of platform specific code. ++ */ ++ ++/* ++ * Define this if the system uses RELOCA. ++ */ ++#define ELF_USES_RELOCA ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1) ++ ++/* ++ * Initialization sequence for a GOT. ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) _dl_init_got(GOT_BASE,MODULE) ++ ++/* Stuff for the PLT. */ ++#define PLT_INITIAL_ENTRY_WORDS 18 ++#define PLT_LONGBRANCH_ENTRY_WORDS 0 ++#define PLT_TRAMPOLINE_ENTRY_WORDS 6 ++#define PLT_DOUBLE_SIZE (1<<13) ++#define PLT_ENTRY_START_WORDS(entry_number) \ ++ (PLT_INITIAL_ENTRY_WORDS + (entry_number)*2 \ ++ + ((entry_number) > PLT_DOUBLE_SIZE \ ++ ? ((entry_number) - PLT_DOUBLE_SIZE)*2 \ ++ : 0)) ++#define PLT_DATA_START_WORDS(num_entries) PLT_ENTRY_START_WORDS(num_entries) ++ ++/* Macros to build PowerPC opcode words. */ ++#define OPCODE_ADDI(rd,ra,simm) \ ++ (0x38000000 | (rd) << 21 | (ra) << 16 | ((simm) & 0xffff)) ++#define OPCODE_ADDIS(rd,ra,simm) \ ++ (0x3c000000 | (rd) << 21 | (ra) << 16 | ((simm) & 0xffff)) ++#define OPCODE_ADD(rd,ra,rb) \ ++ (0x7c000214 | (rd) << 21 | (ra) << 16 | (rb) << 11) ++#define OPCODE_B(target) (0x48000000 | ((target) & 0x03fffffc)) ++#define OPCODE_BA(target) (0x48000002 | ((target) & 0x03fffffc)) ++#define OPCODE_BCTR() 0x4e800420 ++#define OPCODE_LWZ(rd,d,ra) \ ++ (0x80000000 | (rd) << 21 | (ra) << 16 | ((d) & 0xffff)) ++#define OPCODE_LWZU(rd,d,ra) \ ++ (0x84000000 | (rd) << 21 | (ra) << 16 | ((d) & 0xffff)) ++#define OPCODE_MTCTR(rd) (0x7C0903A6 | (rd) << 21) ++#define OPCODE_RLWINM(ra,rs,sh,mb,me) \ ++ (0x54000000 | (rs) << 21 | (ra) << 16 | (sh) << 11 | (mb) << 6 | (me) << 1) ++ ++#define OPCODE_LI(rd,simm) OPCODE_ADDI(rd,0,simm) ++#define OPCODE_ADDIS_HI(rd,ra,value) \ ++ OPCODE_ADDIS(rd,ra,((value) + 0x8000) >> 16) ++#define OPCODE_LIS_HI(rd,value) OPCODE_ADDIS_HI(rd,0,value) ++#define OPCODE_SLWI(ra,rs,sh) OPCODE_RLWINM(ra,rs,sh,0,31-sh) ++ ++ ++#define PPC_DCBST(where) asm volatile ("dcbst 0,%0" : : "r"(where) : "memory") ++#define PPC_SYNC asm volatile ("sync" : : : "memory") ++#define PPC_ISYNC asm volatile ("sync; isync" : : : "memory") ++#define PPC_ICBI(where) asm volatile ("icbi 0,%0" : : "r"(where) : "memory") ++#define PPC_DIE asm volatile ("tweq 0,0") ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. RELP is the relocation that we ++ * are performing, REL is the pointer to the address we are relocating. ++ * SYMBOL is the symbol involved in the relocation, and LOAD is the ++ * load address. ++ */ ++// finaladdr = LOAD ? ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ {int type=ELF32_R_TYPE((RELP)->r_info); \ ++ if(type==R_PPC_NONE){ \ ++ }else if(type==R_PPC_ADDR32){ \ ++ *REL += (SYMBOL); \ ++ }else if(type==R_PPC_RELATIVE){ \ ++ *REL = (Elf32_Word)(LOAD) + (RELP)->r_addend; \ ++ }else if(type==R_PPC_REL24){ \ ++ Elf32_Sword delta = (Elf32_Word)(SYMBOL) - (Elf32_Word)(REL); \ ++ *REL &= 0xfc000003; \ ++ *REL |= (delta & 0x03fffffc); \ ++ }else if(type==R_PPC_JMP_SLOT){ \ ++ Elf32_Sword delta = (Elf32_Word)(SYMBOL) - (Elf32_Word)(REL); \ ++ /*if (delta << 6 >> 6 != delta)_dl_exit(99);*/ \ ++ *REL = OPCODE_B(delta); \ ++ }else{ \ ++ _dl_exit(100+ELF32_R_TYPE((RELP)->r_info)); \ ++ } \ ++ if(type!=R_PPC_NONE){ \ ++ PPC_DCBST(REL); PPC_SYNC; PPC_ICBI(REL);\ ++ } \ ++ } ++ ++/* ++ * Transfer control to the user's application, once the dynamic loader ++ * is done. This routine has to exit the current function, then ++ * call the _dl_elf_main function. ++ */ ++ ++/* hgb@ifi.uio.no: ++ * Adding a clobber list consisting of r0 for %1. addi on PowerPC ++ * takes a register as the second argument, but if the register is ++ * r0, the value 0 is used instead. If r0 is used here, the stack ++ * pointer (r1) will be zeroed, and the dynamically linked ++ * application will seg.fault immediatly when receiving control. ++ */ ++#define START() \ ++ __asm__ volatile ( \ ++ "addi 1,%1,0\n\t" \ ++ "mtlr %0\n\t" \ ++ "blrl\n\t" \ ++ : : "r" (_dl_elf_main), "r" (args) \ ++ : "r0") ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++ ++#define MAGIC1 EM_PPC ++#undef MAGIC2 ++/* Used for error messages */ ++#define ELF_TARGET "powerpc" ++ ++struct elf_resolve; ++extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); ++void _dl_init_got(unsigned long *lpnt,struct elf_resolve *tpnt); ++ ++ ++#define do_rem(result, n, base) result = (n % base) ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/powerpc/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/resolve.S +--- uClibc/ldso-0.9.24/ldso/powerpc/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/powerpc/resolve.S 2001-07-12 05:14:09.000000000 -0500 +@@ -0,0 +1,82 @@ ++/* ++ * Stolen from glibc-2.2.2 by David Schleef ++ */ ++ ++.text ++.align 4 ++ ++.globl _dl_linux_resolver ++ ++.globl _dl_linux_resolve ++.type _dl_linux_resolve,@function ++ ++_dl_linux_resolve: ++// We need to save the registers used to pass parameters, and register 0, ++// which is used by _mcount; the registers are saved in a stack frame. ++ stwu 1,-64(1) ++ stw 0,12(1) ++ stw 3,16(1) ++ stw 4,20(1) ++// The code that calls this has put parameters for 'fixup' in r12 and r11. ++ mr 3,12 ++ stw 5,24(1) ++ mr 4,11 ++ stw 6,28(1) ++ mflr 0 ++// We also need to save some of the condition register fields. ++ stw 7,32(1) ++ stw 0,48(1) ++ stw 8,36(1) ++ mfcr 0 ++ stw 9,40(1) ++ stw 10,44(1) ++ stw 0,8(1) ++ bl _dl_linux_resolver@local ++// 'fixup' returns the address we want to branch to. ++ mtctr 3 ++// Put the registers back... ++ lwz 0,48(1) ++ lwz 10,44(1) ++ lwz 9,40(1) ++ mtlr 0 ++ lwz 8,36(1) ++ lwz 0,8(1) ++ lwz 7,32(1) ++ lwz 6,28(1) ++ mtcrf 0xFF,0 ++ lwz 5,24(1) ++ lwz 4,20(1) ++ lwz 3,16(1) ++ lwz 0,12(1) ++// ...unwind the stack frame, and jump to the PLT entry we updated. ++ addi 1,1,64 ++ bctr ++ ++.LFE2: ++ .size _dl_linux_resolve,.LFE2-_dl_linux_resolve ++ ++#if 0 ++ ++ pusha /* preserve all regs */ ++ lea 0x20(%esp),%eax /* eax = tpnt and reloc_entry params */ ++ pushl 4(%eax) /* push copy of reloc_entry param */ ++ pushl (%eax) /* push copy of tpnt param */ ++ ++#ifdef __PIC__ ++ call .L24 ++.L24: ++ popl %ebx ++ addl $_GLOBAL_OFFSET_TABLE_+[.-.L24],%ebx ++ movl _dl_linux_resolver@GOT(%ebx),%ebx /* eax = resolved func */ ++ call *%ebx ++#else ++ call _dl_linux_resolver ++#endif ++ movl %eax,0x28(%esp) /* store func addr over original ++ * tpnt param */ ++ addl $0x8,%esp /* remove copy parameters */ ++ popa /* restore regs */ ++ ret $4 /* jump to func removing original ++ * reloc_entry param from stack */ ++#endif ++ +diff -urN uClibc/ldso-0.9.24/ldso/readelflib1.c uClibc.ldso.24/ldso-0.9.24/ldso/readelflib1.c +--- uClibc/ldso-0.9.24/ldso/readelflib1.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/readelflib1.c 2003-12-05 14:24:26.000000000 -0600 +@@ -0,0 +1,971 @@ ++/* vi: set sw=4 ts=4: */ ++/* Program to load an ELF binary on a linux system, and run it ++ * after resolving ELF shared library symbols ++ * ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, ++ * David Engel, Hongjiu Lu and Mitch D'Souza ++ * Copyright (C) 2001-2003, Erik Andersen ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++ ++/* This file contains the helper routines to load an ELF sharable ++ library into memory and add the symbol table info to the chain. */ ++ ++#ifdef USE_CACHE ++ ++static caddr_t _dl_cache_addr = NULL; ++static size_t _dl_cache_size = 0; ++ ++int _dl_map_cache(void) ++{ ++ int fd; ++ struct stat st; ++ header_t *header; ++ libentry_t *libent; ++ int i, strtabsize; ++ ++ if (_dl_cache_addr == (caddr_t) - 1) ++ return -1; ++ else if (_dl_cache_addr != NULL) ++ return 0; ++ ++ if (_dl_stat(LDSO_CACHE, &st) ++ || (fd = _dl_open(LDSO_CACHE, O_RDONLY)) < 0) { ++ _dl_dprintf(2, "%s: can't open cache '%s'\n", _dl_progname, LDSO_CACHE); ++ _dl_cache_addr = (caddr_t) - 1; /* so we won't try again */ ++ return -1; ++ } ++ ++ _dl_cache_size = st.st_size; ++ _dl_cache_addr = (caddr_t) _dl_mmap(0, _dl_cache_size, PROT_READ, MAP_SHARED, fd, 0); ++ _dl_close(fd); ++ if (_dl_mmap_check_error(_dl_cache_addr)) { ++ _dl_dprintf(2, "%s: can't map cache '%s'\n", ++ _dl_progname, LDSO_CACHE); ++ return -1; ++ } ++ ++ header = (header_t *) _dl_cache_addr; ++ ++ if (_dl_cache_size < sizeof(header_t) || ++ _dl_memcmp(header->magic, LDSO_CACHE_MAGIC, LDSO_CACHE_MAGIC_LEN) ++ || _dl_memcmp(header->version, LDSO_CACHE_VER, LDSO_CACHE_VER_LEN) ++ || _dl_cache_size < ++ (sizeof(header_t) + header->nlibs * sizeof(libentry_t)) ++ || _dl_cache_addr[_dl_cache_size - 1] != '\0') ++ { ++ _dl_dprintf(2, "%s: cache '%s' is corrupt\n", _dl_progname, ++ LDSO_CACHE); ++ goto fail; ++ } ++ ++ strtabsize = _dl_cache_size - sizeof(header_t) - ++ header->nlibs * sizeof(libentry_t); ++ libent = (libentry_t *) & header[1]; ++ ++ for (i = 0; i < header->nlibs; i++) { ++ if (libent[i].sooffset >= strtabsize || ++ libent[i].liboffset >= strtabsize) ++ { ++ _dl_dprintf(2, "%s: cache '%s' is corrupt\n", _dl_progname, LDSO_CACHE); ++ goto fail; ++ } ++ } ++ ++ return 0; ++ ++ fail: ++ _dl_munmap(_dl_cache_addr, _dl_cache_size); ++ _dl_cache_addr = (caddr_t) - 1; ++ return -1; ++} ++ ++int _dl_unmap_cache(void) ++{ ++ if (_dl_cache_addr == NULL || _dl_cache_addr == (caddr_t) - 1) ++ return -1; ++ ++#if 1 ++ _dl_munmap(_dl_cache_addr, _dl_cache_size); ++ _dl_cache_addr = NULL; ++#endif ++ ++ return 0; ++} ++ ++#endif ++ ++/* This function's behavior must exactly match that ++ * in uClibc/ldso/util/ldd.c */ ++static struct elf_resolve * ++search_for_named_library(const char *name, int secure, const char *path_list, ++ struct dyn_elf **rpnt) ++{ ++ int i, count = 1; ++ char *path, *path_n; ++ char mylibname[2050]; ++ struct elf_resolve *tpnt1; ++ ++ if (path_list==NULL) ++ return NULL; ++ ++ /* We need a writable copy of this string */ ++ path = _dl_strdup(path_list); ++ if (!path) { ++ _dl_dprintf(2, "Out of memory!\n"); ++ _dl_exit(0); ++ } ++ ++ ++ /* Unlike ldd.c, don't bother to eliminate double //s */ ++ ++ ++ /* Replace colons with zeros in path_list and count them */ ++ for(i=_dl_strlen(path); i > 0; i--) { ++ if (path[i]==':') { ++ path[i]=0; ++ count++; ++ } ++ } ++ ++ path_n = path; ++ for (i = 0; i < count; i++) { ++ _dl_strcpy(mylibname, path_n); ++ _dl_strcat(mylibname, "/"); ++ _dl_strcat(mylibname, name); ++ if ((tpnt1 = _dl_load_elf_shared_library(secure, rpnt, mylibname)) != NULL) ++ { ++ return tpnt1; ++ } ++ path_n += (_dl_strlen(path_n) + 1); ++ } ++ return NULL; ++} ++ ++/* Check if the named library is already loaded... */ ++struct elf_resolve *_dl_check_if_named_library_is_loaded(const char *full_libname) ++{ ++ const char *pnt, *pnt1; ++ struct elf_resolve *tpnt1; ++ const char *libname, *libname2; ++ static const char *libc = "libc.so."; ++ static const char *aborted_wrong_lib = "%s: aborted attempt to load %s!\n"; ++ ++ pnt = libname = full_libname; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) ++ _dl_dprintf(_dl_debug_file, "Checking if '%s' is already loaded\n", full_libname); ++#endif ++ /* quick hack to ensure mylibname buffer doesn't overflow. don't ++ allow full_libname or any directory to be longer than 1024. */ ++ if (_dl_strlen(full_libname) > 1024) ++ return NULL; ++ ++ /* Skip over any initial initial './' and '/' stuff to ++ * get the short form libname with no path garbage */ ++ pnt1 = _dl_strrchr(pnt, '/'); ++ if (pnt1) { ++ libname = pnt1 + 1; ++ } ++ ++ /* Make sure they are not trying to load the wrong C library! ++ * This sometimes happens esp with shared libraries when the ++ * library path is somehow wrong! */ ++#define isdigit(c) (c >= '0' && c <= '9') ++ if ((_dl_strncmp(libname, libc, 8) == 0) && _dl_strlen(libname) >=8 && ++ isdigit(libname[8])) ++ { ++ /* Abort attempts to load glibc, libc5, etc */ ++ if ( libname[8]!='0') { ++ if (!_dl_trace_loaded_objects) { ++ _dl_dprintf(2, aborted_wrong_lib, libname, _dl_progname); ++ _dl_exit(1); ++ } ++ return NULL; ++ } ++ } ++ ++ /* Critical step! Weed out duplicates early to avoid ++ * function aliasing, which wastes memory, and causes ++ * really bad things to happen with weaks and globals. */ ++ for (tpnt1 = _dl_loaded_modules; tpnt1; tpnt1 = tpnt1->next) { ++ ++ /* Skip over any initial initial './' and '/' stuff to ++ * get the short form libname with no path garbage */ ++ libname2 = tpnt1->libname; ++ pnt1 = _dl_strrchr(libname2, '/'); ++ if (pnt1) { ++ libname2 = pnt1 + 1; ++ } ++ ++ if (_dl_strcmp(libname2, libname) == 0) { ++ /* Well, that was certainly easy */ ++ return tpnt1; ++ } ++ } ++ ++ return NULL; ++} ++ ++ ++ ++/* ++ * Used to return error codes back to dlopen et. al. ++ */ ++ ++unsigned long _dl_error_number; ++unsigned long _dl_internal_error_number; ++extern char *_dl_ldsopath; ++ ++struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt, ++ struct elf_resolve *tpnt, char *full_libname) ++{ ++ char *pnt, *pnt1; ++ struct elf_resolve *tpnt1; ++ char *libname; ++ ++ _dl_internal_error_number = 0; ++ libname = full_libname; ++ ++ /* quick hack to ensure mylibname buffer doesn't overflow. don't ++ allow full_libname or any directory to be longer than 1024. */ ++ if (_dl_strlen(full_libname) > 1024) ++ goto goof; ++ ++ /* Skip over any initial initial './' and '/' stuff to ++ * get the short form libname with no path garbage */ ++ pnt1 = _dl_strrchr(libname, '/'); ++ if (pnt1) { ++ libname = pnt1 + 1; ++ } ++ ++ /* Critical step! Weed out duplicates early to avoid ++ * function aliasing, which wastes memory, and causes ++ * really bad things to happen with weaks and globals. */ ++ if ((tpnt1=_dl_check_if_named_library_is_loaded(libname))!=NULL) ++ return tpnt1; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfind library='%s'; searching\n", libname); ++#endif ++ /* If the filename has any '/', try it straight and leave it at that. ++ For IBCS2 compatibility under linux, we substitute the string ++ /usr/i486-sysv4/lib for /usr/lib in library names. */ ++ ++ if (libname != full_libname) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\ttrying file='%s'\n", full_libname); ++#endif ++ tpnt1 = _dl_load_elf_shared_library(secure, rpnt, full_libname); ++ if (tpnt1) { ++ return tpnt1; ++ } ++ //goto goof; ++ } ++ ++ /* ++ * The ABI specifies that RPATH is searched before LD_*_PATH or ++ * the default path of /usr/lib. Check in rpath directories. ++ */ ++ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { ++ if (tpnt->libtype == elf_executable) { ++ pnt = (char *) tpnt->dynamic_info[DT_RPATH]; ++ if (pnt) { ++ pnt += (unsigned long) tpnt->loadaddr + tpnt->dynamic_info[DT_STRTAB]; ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching RPATH='%s'\n", pnt); ++#endif ++ if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL) ++ { ++ return tpnt1; ++ } ++ } ++ } ++ } ++ ++ /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */ ++ if (_dl_library_path) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path); ++#endif ++ if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL) ++ { ++ return tpnt1; ++ } ++ } ++ ++ /* ++ * Where should the cache be searched? There is no such concept in the ++ * ABI, so we have some flexibility here. For now, search it before ++ * the hard coded paths that follow (i.e before /lib and /usr/lib). ++ */ ++#ifdef USE_CACHE ++ if (_dl_cache_addr != NULL && _dl_cache_addr != (caddr_t) - 1) { ++ int i; ++ header_t *header = (header_t *) _dl_cache_addr; ++ libentry_t *libent = (libentry_t *) & header[1]; ++ char *strs = (char *) &libent[header->nlibs]; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching cache='%s'\n", LDSO_CACHE); ++#endif ++ for (i = 0; i < header->nlibs; i++) { ++ if ((libent[i].flags == LIB_ELF || ++ libent[i].flags == LIB_ELF_LIBC5) && ++ _dl_strcmp(libname, strs + libent[i].sooffset) == 0 && ++ (tpnt1 = _dl_load_elf_shared_library(secure, ++ rpnt, strs + libent[i].liboffset))) ++ return tpnt1; ++ } ++ } ++#endif ++ ++ /* Look for libraries wherever the shared library loader ++ * was installed */ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching ldso dir='%s'\n", _dl_ldsopath); ++#endif ++ if ((tpnt1 = search_for_named_library(libname, secure, _dl_ldsopath, rpnt)) != NULL) ++ { ++ return tpnt1; ++ } ++ ++ ++ /* Lastly, search the standard list of paths for the library. ++ This list must exactly match the list in uClibc/ldso/util/ldd.c */ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching full lib path list\n"); ++#endif ++ if ((tpnt1 = search_for_named_library(libname, secure, ++ UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib:" ++ UCLIBC_RUNTIME_PREFIX "usr/lib:" ++ UCLIBC_RUNTIME_PREFIX "lib:" ++ "/usr/lib:" ++ "/lib", rpnt) ++ ) != NULL) ++ { ++ return tpnt1; ++ } ++ ++goof: ++ /* Well, we shot our wad on that one. All we can do now is punt */ ++ if (_dl_internal_error_number) ++ _dl_error_number = _dl_internal_error_number; ++ else ++ _dl_error_number = LD_ERROR_NOFILE; ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(2, "Bummer: could not find '%s'!\n", libname); ++#endif ++ return NULL; ++} ++ ++ ++/* ++ * Read one ELF library into memory, mmap it into the correct locations and ++ * add the symbol info to the symbol chain. Perform any relocations that ++ * are required. ++ */ ++ ++struct elf_resolve *_dl_load_elf_shared_library(int secure, ++ struct dyn_elf **rpnt, char *libname) ++{ ++ ElfW(Ehdr) *epnt; ++ unsigned long dynamic_addr = 0; ++ unsigned long dynamic_size = 0; ++ Elf32_Dyn *dpnt; ++ struct elf_resolve *tpnt; ++ ElfW(Phdr) *ppnt; ++ char *status, *header; ++ unsigned long dynamic_info[24]; ++ unsigned long *lpnt; ++ unsigned long libaddr; ++ unsigned long minvma = 0xffffffff, maxvma = 0; ++ int i, flags, piclib, infile; ++ ++ /* If this file is already loaded, skip this step */ ++ tpnt = _dl_check_hashed_files(libname); ++ if (tpnt) { ++ if (*rpnt) { ++ (*rpnt)->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); ++ _dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf)); ++ (*rpnt)->next->prev = (*rpnt); ++ *rpnt = (*rpnt)->next; ++ (*rpnt)->dyn = tpnt; ++ tpnt->symbol_scope = _dl_symbol_tables; ++ } ++ tpnt->usage_count++; ++ tpnt->libtype = elf_lib; ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(2, "file='%s'; already loaded\n", libname); ++#endif ++ return tpnt; ++ } ++ ++ /* If we are in secure mode (i.e. a setu/gid binary using LD_PRELOAD), ++ we don't load the library if it isn't setuid. */ ++ ++ if (secure) { ++ struct stat st; ++ ++ if (_dl_stat(libname, &st) || !(st.st_mode & S_ISUID)) ++ return NULL; ++ } ++ ++ libaddr = 0; ++ infile = _dl_open(libname, O_RDONLY); ++ if (infile < 0) { ++#if 0 ++ /* ++ * NO! When we open shared libraries we may search several paths. ++ * it is inappropriate to generate an error here. ++ */ ++ _dl_dprintf(2, "%s: can't open '%s'\n", _dl_progname, libname); ++#endif ++ _dl_internal_error_number = LD_ERROR_NOFILE; ++ return NULL; ++ } ++ ++ header = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE, ++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); ++ if (_dl_mmap_check_error(header)) { ++ _dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname); ++ _dl_internal_error_number = LD_ERROR_MMAP_FAILED; ++ _dl_close(infile); ++ return NULL; ++ }; ++ ++ _dl_read(infile, header, 4096); ++ epnt = (ElfW(Ehdr) *) (intptr_t) header; ++ if (epnt->e_ident[0] != 0x7f || ++ epnt->e_ident[1] != 'E' || ++ epnt->e_ident[2] != 'L' || ++ epnt->e_ident[3] != 'F') ++ { ++ _dl_dprintf(2, "%s: '%s' is not an ELF file\n", _dl_progname, ++ libname); ++ _dl_internal_error_number = LD_ERROR_NOTELF; ++ _dl_close(infile); ++ _dl_munmap(header, 4096); ++ return NULL; ++ }; ++ ++ if ((epnt->e_type != ET_DYN) || (epnt->e_machine != MAGIC1 ++#ifdef MAGIC2 ++ && epnt->e_machine != MAGIC2 ++#endif ++ )) ++ { ++ _dl_internal_error_number = ++ (epnt->e_type != ET_DYN ? LD_ERROR_NOTDYN : LD_ERROR_NOTMAGIC); ++ _dl_dprintf(2, "%s: '%s' is not an ELF executable for " ELF_TARGET ++ "\n", _dl_progname, libname); ++ _dl_close(infile); ++ _dl_munmap(header, 4096); ++ return NULL; ++ }; ++ ++ ppnt = (ElfW(Phdr) *)(intptr_t) & header[epnt->e_phoff]; ++ ++ piclib = 1; ++ for (i = 0; i < epnt->e_phnum; i++) { ++ ++ if (ppnt->p_type == PT_DYNAMIC) { ++ if (dynamic_addr) ++ _dl_dprintf(2, "%s: '%s' has more than one dynamic section\n", ++ _dl_progname, libname); ++ dynamic_addr = ppnt->p_vaddr; ++ dynamic_size = ppnt->p_filesz; ++ }; ++ ++ if (ppnt->p_type == PT_LOAD) { ++ /* See if this is a PIC library. */ ++ if (i == 0 && ppnt->p_vaddr > 0x1000000) { ++ piclib = 0; ++ minvma = ppnt->p_vaddr; ++ } ++ if (piclib && ppnt->p_vaddr < minvma) { ++ minvma = ppnt->p_vaddr; ++ } ++ if (((unsigned long) ppnt->p_vaddr + ppnt->p_memsz) > maxvma) { ++ maxvma = ppnt->p_vaddr + ppnt->p_memsz; ++ } ++ } ++ ppnt++; ++ }; ++ ++ maxvma = (maxvma + ADDR_ALIGN) & ~ADDR_ALIGN; ++ minvma = minvma & ~0xffffU; ++ ++ flags = MAP_PRIVATE /*| MAP_DENYWRITE */ ; ++ if (!piclib) ++ flags |= MAP_FIXED; ++ ++ status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma), ++ maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0); ++ if (_dl_mmap_check_error(status)) { ++ _dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname); ++ _dl_internal_error_number = LD_ERROR_MMAP_FAILED; ++ _dl_close(infile); ++ _dl_munmap(header, 4096); ++ return NULL; ++ }; ++ libaddr = (unsigned long) status; ++ flags |= MAP_FIXED; ++ ++ /* Get the memory to store the library */ ++ ppnt = (ElfW(Phdr) *)(intptr_t) & header[epnt->e_phoff]; ++ ++ for (i = 0; i < epnt->e_phnum; i++) { ++ if (ppnt->p_type == PT_LOAD) { ++ ++ /* See if this is a PIC library. */ ++ if (i == 0 && ppnt->p_vaddr > 0x1000000) { ++ piclib = 0; ++ /* flags |= MAP_FIXED; */ ++ } ++ ++ ++ ++ if (ppnt->p_flags & PF_W) { ++ unsigned long map_size; ++ char *cpnt; ++ ++ status = (char *) _dl_mmap((char *) ((piclib ? libaddr : 0) + ++ (ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN) ++ + ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, infile, ++ ppnt->p_offset & OFFS_ALIGN); ++ ++ if (_dl_mmap_check_error(status)) { ++ _dl_dprintf(2, "%s: can't map '%s'\n", ++ _dl_progname, libname); ++ _dl_internal_error_number = LD_ERROR_MMAP_FAILED; ++ _dl_munmap((char *) libaddr, maxvma - minvma); ++ _dl_close(infile); ++ _dl_munmap(header, 4096); ++ return NULL; ++ }; ++ ++ /* Pad the last page with zeroes. */ ++ cpnt = (char *) (status + (ppnt->p_vaddr & ADDR_ALIGN) + ++ ppnt->p_filesz); ++ while (((unsigned long) cpnt) & ADDR_ALIGN) ++ *cpnt++ = 0; ++ ++ /* I am not quite sure if this is completely ++ * correct to do or not, but the basic way that ++ * we handle bss segments is that we mmap ++ * /dev/zero if there are any pages left over ++ * that are not mapped as part of the file */ ++ ++ map_size = (ppnt->p_vaddr + ppnt->p_filesz + ADDR_ALIGN) & PAGE_ALIGN; ++ ++ if (map_size < ppnt->p_vaddr + ppnt->p_memsz) ++ status = (char *) _dl_mmap((char *) map_size + ++ (piclib ? libaddr : 0), ++ ppnt->p_vaddr + ppnt->p_memsz - map_size, ++ LXFLAGS(ppnt->p_flags), flags | MAP_ANONYMOUS, -1, 0); ++ } else ++ status = (char *) _dl_mmap((char *) (ppnt->p_vaddr & PAGE_ALIGN) ++ + (piclib ? libaddr : 0), (ppnt->p_vaddr & ADDR_ALIGN) + ++ ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, ++ infile, ppnt->p_offset & OFFS_ALIGN); ++ if (_dl_mmap_check_error(status)) { ++ _dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname); ++ _dl_internal_error_number = LD_ERROR_MMAP_FAILED; ++ _dl_munmap((char *) libaddr, maxvma - minvma); ++ _dl_close(infile); ++ _dl_munmap(header, 4096); ++ return NULL; ++ }; ++ ++ /* if(libaddr == 0 && piclib) { ++ libaddr = (unsigned long) status; ++ flags |= MAP_FIXED; ++ }; */ ++ }; ++ ppnt++; ++ }; ++ _dl_close(infile); ++ ++ /* For a non-PIC library, the addresses are all absolute */ ++ if (piclib) { ++ dynamic_addr += (unsigned long) libaddr; ++ } ++ ++ /* ++ * OK, the ELF library is now loaded into VM in the correct locations ++ * The next step is to go through and do the dynamic linking (if needed). ++ */ ++ ++ /* Start by scanning the dynamic section to get all of the pointers */ ++ ++ if (!dynamic_addr) { ++ _dl_internal_error_number = LD_ERROR_NODYNAMIC; ++ _dl_dprintf(2, "%s: '%s' is missing a dynamic section\n", ++ _dl_progname, libname); ++ _dl_munmap(header, 4096); ++ return NULL; ++ } ++ ++ dpnt = (Elf32_Dyn *) dynamic_addr; ++ ++ dynamic_size = dynamic_size / sizeof(Elf32_Dyn); ++ _dl_memset(dynamic_info, 0, sizeof(dynamic_info)); ++ ++#if defined(__mips__) ++ { ++ ++ int indx = 1; ++ Elf32_Dyn *dpnt = (Elf32_Dyn *) dynamic_addr; ++ ++ while(dpnt->d_tag) { ++ dpnt++; ++ indx++; ++ } ++ dynamic_size = indx; ++ } ++#endif ++ ++ { ++ unsigned long indx; ++ ++ for (indx = 0; indx < dynamic_size; indx++) ++ { ++ if (dpnt->d_tag > DT_JMPREL) { ++ dpnt++; ++ continue; ++ } ++ dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val; ++ if (dpnt->d_tag == DT_TEXTREL) ++ dynamic_info[DT_TEXTREL] = 1; ++ dpnt++; ++ }; ++ } ++ ++ /* If the TEXTREL is set, this means that we need to make the pages ++ writable before we perform relocations. Do this now. They get set ++ back again later. */ ++ ++ if (dynamic_info[DT_TEXTREL]) { ++#ifndef FORCE_SHAREABLE_TEXT_SEGMENTS ++ ppnt = (ElfW(Phdr) *)(intptr_t) & header[epnt->e_phoff]; ++ for (i = 0; i < epnt->e_phnum; i++, ppnt++) { ++ if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) ++ _dl_mprotect((void *) ((piclib ? libaddr : 0) + ++ (ppnt->p_vaddr & PAGE_ALIGN)), ++ (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz, ++ PROT_READ | PROT_WRITE | PROT_EXEC); ++ } ++#else ++ _dl_dprintf(_dl_debug_file, "Can't modify %s's text section. Use GCC option -fPIC for shared objects, please.\n",libname); ++ _dl_exit(1); ++#endif ++ } ++ ++ tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info, ++ dynamic_addr, dynamic_size); ++ ++ tpnt->ppnt = (ElfW(Phdr) *)(intptr_t) (tpnt->loadaddr + epnt->e_phoff); ++ tpnt->n_phent = epnt->e_phnum; ++ ++ /* ++ * Add this object into the symbol chain ++ */ ++ if (*rpnt) { ++ (*rpnt)->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); ++ _dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf)); ++ (*rpnt)->next->prev = (*rpnt); ++ *rpnt = (*rpnt)->next; ++ (*rpnt)->dyn = tpnt; ++ tpnt->symbol_scope = _dl_symbol_tables; ++ } ++ tpnt->usage_count++; ++ tpnt->libtype = elf_lib; ++ ++ /* ++ * OK, the next thing we need to do is to insert the dynamic linker into ++ * the proper entry in the GOT so that the PLT symbols can be properly ++ * resolved. ++ */ ++ ++ lpnt = (unsigned long *) dynamic_info[DT_PLTGOT]; ++ ++ if (lpnt) { ++ lpnt = (unsigned long *) (dynamic_info[DT_PLTGOT] + ++ ((int) libaddr)); ++ INIT_GOT(lpnt, tpnt); ++ }; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) { ++ _dl_dprintf(2, "\n\tfile='%s'; generating link map\n", libname); ++ _dl_dprintf(2, "\t\tdynamic: %x base: %x size: %x\n", ++ dynamic_addr, libaddr, dynamic_size); ++ _dl_dprintf(2, "\t\t entry: %x phdr: %x phnum: %d\n\n", ++ epnt->e_entry + libaddr, tpnt->ppnt, tpnt->n_phent); ++ ++ } ++#endif ++ _dl_munmap(header, 4096); ++ ++ return tpnt; ++} ++ ++/* Ugly, ugly. Some versions of the SVr4 linker fail to generate COPY ++ relocations for global variables that are present both in the image and ++ the shared library. Go through and do it manually. If the images ++ are guaranteed to be generated by a trustworthy linker, then this ++ step can be skipped. */ ++ ++int _dl_copy_fixups(struct dyn_elf *rpnt) ++{ ++ int goof = 0; ++ struct elf_resolve *tpnt; ++ ++ if (rpnt->next) ++ goof += _dl_copy_fixups(rpnt->next); ++ else ++ return 0; ++ ++ tpnt = rpnt->dyn; ++ ++ if (tpnt->init_flag & COPY_RELOCS_DONE) ++ return goof; ++ tpnt->init_flag |= COPY_RELOCS_DONE; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation copy fixups: %s", tpnt->libname); ++#endif ++ ++#ifdef ELF_USES_RELOCA ++ goof += _dl_parse_copy_information(rpnt, ++ tpnt->dynamic_info[DT_RELA], tpnt->dynamic_info[DT_RELASZ], 0); ++ ++#else ++ goof += _dl_parse_copy_information(rpnt, tpnt->dynamic_info[DT_REL], ++ tpnt->dynamic_info[DT_RELSZ], 0); ++ ++#endif ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation copy fixups: %s; finished\n\n", tpnt->libname); ++#endif ++ return goof; ++} ++ ++/* Minimal printf which handles only %s, %d, and %x */ ++void _dl_dprintf(int fd, const char *fmt, ...) ++{ ++ int num; ++ va_list args; ++ char *start, *ptr, *string; ++ static char *buf; ++ ++ buf = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE, ++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); ++ if (_dl_mmap_check_error(buf)) { ++ _dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname); ++ _dl_exit(20); ++ } ++ ++ start = ptr = buf; ++ ++ if (!fmt) ++ return; ++ ++ if (_dl_strlen(fmt) >= (sizeof(buf) - 1)) ++ _dl_write(fd, "(overflow)\n", 10); ++ ++ _dl_strcpy(buf, fmt); ++ va_start(args, fmt); ++ ++ while (start) { ++ while (*ptr != '%' && *ptr) { ++ ptr++; ++ } ++ ++ if (*ptr == '%') { ++ *ptr++ = '\0'; ++ _dl_write(fd, start, _dl_strlen(start)); ++ ++ switch (*ptr++) { ++ case 's': ++ string = va_arg(args, char *); ++ ++ if (!string) ++ _dl_write(fd, "(null)", 6); ++ else ++ _dl_write(fd, string, _dl_strlen(string)); ++ break; ++ ++ case 'i': ++ case 'd': ++ { ++ char tmp[22]; ++ num = va_arg(args, int); ++ ++ string = _dl_simple_ltoa(tmp, num); ++ _dl_write(fd, string, _dl_strlen(string)); ++ break; ++ } ++ case 'x': ++ case 'X': ++ { ++ char tmp[22]; ++ num = va_arg(args, int); ++ ++ string = _dl_simple_ltoahex(tmp, num); ++ _dl_write(fd, string, _dl_strlen(string)); ++ break; ++ } ++ default: ++ _dl_write(fd, "(null)", 6); ++ break; ++ } ++ ++ start = ptr; ++ } else { ++ _dl_write(fd, start, _dl_strlen(start)); ++ start = NULL; ++ } ++ } ++ _dl_munmap(buf, 4096); ++ return; ++} ++ ++char *_dl_strdup(const char *string) ++{ ++ char *retval; ++ int len; ++ ++ len = _dl_strlen(string); ++ retval = _dl_malloc(len + 1); ++ _dl_strcpy(retval, string); ++ return retval; ++} ++ ++void *(*_dl_malloc_function) (size_t size) = NULL; ++void *_dl_malloc(int size) ++{ ++ void *retval; ++ ++#if 0 ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(2, "malloc: request for %d bytes\n", size); ++#endif ++#endif ++ ++ if (_dl_malloc_function) ++ return (*_dl_malloc_function) (size); ++ ++ if (_dl_malloc_addr - _dl_mmap_zero + size > 4096) { ++#ifdef __SUPPORT_LD_DEBUG_EARLY__ ++ _dl_dprintf(2, "malloc: mmapping more memory\n"); ++#endif ++ _dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, size, ++ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); ++ if (_dl_mmap_check_error(_dl_mmap_zero)) { ++ _dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname); ++ _dl_exit(20); ++ } ++ } ++ retval = _dl_malloc_addr; ++ _dl_malloc_addr += size; ++ ++ /* ++ * Align memory to 4 byte boundary. Some platforms require this, others ++ * simply get better performance. ++ */ ++ _dl_malloc_addr = (char *) (((unsigned long) _dl_malloc_addr + 3) & ~(3)); ++ return retval; ++} ++ ++int _dl_fixup(struct elf_resolve *tpnt, int flag) ++{ ++ int goof = 0; ++ ++ if (tpnt->next) ++ goof += _dl_fixup(tpnt->next, flag); ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); ++#endif ++ ++ if (tpnt->dynamic_info[DT_REL]) { ++#ifdef ELF_USES_RELOCA ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(2, "%s: can't handle REL relocation records\n", _dl_progname); ++#endif ++ goof++; ++ return goof; ++#else ++ if (tpnt->init_flag & RELOCS_DONE) ++ return goof; ++ tpnt->init_flag |= RELOCS_DONE; ++ goof += _dl_parse_relocation_information(tpnt, ++ tpnt->dynamic_info[DT_REL], ++ tpnt->dynamic_info[DT_RELSZ], 0); ++#endif ++ } ++ if (tpnt->dynamic_info[DT_RELA]) { ++#ifndef ELF_USES_RELOCA ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) _dl_dprintf(2, "%s: can't handle RELA relocation records\n", _dl_progname); ++#endif ++ goof++; ++ return goof; ++#else ++ if (tpnt->init_flag & RELOCS_DONE) ++ return goof; ++ tpnt->init_flag |= RELOCS_DONE; ++ goof += _dl_parse_relocation_information(tpnt, ++ tpnt->dynamic_info[DT_RELA], ++ tpnt->dynamic_info[DT_RELASZ], 0); ++#endif ++ } ++ if (tpnt->dynamic_info[DT_JMPREL]) { ++ if (tpnt->init_flag & JMP_RELOCS_DONE) ++ return goof; ++ tpnt->init_flag |= JMP_RELOCS_DONE; ++ if (flag & RTLD_LAZY) { ++ _dl_parse_lazy_relocation_information(tpnt, ++ tpnt->dynamic_info[DT_JMPREL], ++ tpnt->dynamic_info [DT_PLTRELSZ], 0); ++ } else { ++ goof += _dl_parse_relocation_information(tpnt, ++ tpnt->dynamic_info[DT_JMPREL], ++ tpnt->dynamic_info[DT_PLTRELSZ], 0); ++ } ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug) { ++ _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); ++ _dl_dprintf(_dl_debug_file,"; finished\n\n"); ++ } ++#endif ++ return goof; ++} ++ ++ +diff -urN uClibc/ldso-0.9.24/ldso/sh/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/sh/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/sh/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sh/boot1_arch.h 2002-11-03 08:12:29.000000000 -0600 +@@ -0,0 +1,22 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. */ ++ ++asm("" \ ++" .text\n" \ ++" .globl _dl_boot\n" \ ++"_dl_boot:\n" \ ++" mov r15, r4\n" \ ++" mov.l .L_dl_boot2, r0\n" \ ++" bsrf r0\n" \ ++" add #4, r4\n" \ ++".jmp_loc:\n" \ ++" jmp @r0\n" \ ++" mov #0, r4 !call _start with arg == 0\n" \ ++".L_dl_boot2:\n" \ ++" .long _dl_boot2-.jmp_loc\n" \ ++" .previous\n" \ ++); ++ ++#define _dl_boot _dl_boot2 ++#define LD_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X) +diff -urN uClibc/ldso-0.9.24/ldso/sh/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/sh/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/sh/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sh/elfinterp.c 2003-09-11 05:26:16.000000000 -0500 +@@ -0,0 +1,427 @@ ++/* vi: set sw=4 ts=4: */ ++/* SuperH ELF shared library loader suppport ++ * ++ * Copyright (C) 2002, Stefan Allius and ++ * Eddie C. Dost ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char *_dl_reltypes_tab[] = ++{ ++ [0] "R_SH_NONE", "R_SH_DIR32", "R_SH_REL32", "R_SH_DIR8WPN", ++ [4] "R_SH_IND12W", "R_SH_DIR8WPL", "R_SH_DIR8WPZ", "R_SH_DIR8BP", ++ [8] "R_SH_DIR8W", "R_SH_DIR8L", ++ [25] "R_SH_SWITCH16","R_SH_SWITCH32","R_SH_USES", ++ [28] "R_SH_COUNT", "R_SH_ALIGN", "R_SH_CODE", "R_SH_DATA", ++ [32] "R_SH_LABEL", "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT","R_SH_GNU_VTENTRY", ++[160] "R_SH_GOT32", "R_SH_PLT32", "R_SH_COPY", "R_SH_GLOB_DAT", ++[164] "R_SH_JMP_SLOT","R_SH_RELATIVE","R_SH_GOTOFF", "R_SH_GOTPC", ++}; ++ ++static const char * ++_dl_reltypes(int type) ++{ ++ static char buf[22]; ++ const char *str; ++ ++ if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) || ++ NULL == (str = _dl_reltypes_tab[type])) ++ { ++ str =_dl_simple_ltoa( buf, (unsigned long)(type)); ++ } ++ return str; ++} ++ ++static ++void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index) ++{ ++ if(_dl_debug_symbols) ++ { ++ if(symtab_index){ ++ _dl_dprintf(_dl_debug_file, "\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x", ++ strtab + symtab[symtab_index].st_name, ++ symtab[symtab_index].st_value, ++ symtab[symtab_index].st_size, ++ symtab[symtab_index].st_info, ++ symtab[symtab_index].st_other, ++ symtab[symtab_index].st_shndx); ++ } ++ } ++} ++ ++static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt) ++{ ++ if(_dl_debug_reloc) ++ { ++ int symtab_index; ++ const char *sym; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0"; ++ ++ if(_dl_debug_symbols) ++ _dl_dprintf(_dl_debug_file, "\n\t"); ++ else ++ _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym); ++ ++#ifdef ELF_USES_RELOCA ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset, ++ rpnt->r_addend); ++#else ++ _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n", ++ _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)), ++ rpnt->r_offset); ++#endif ++ } ++} ++#endif ++ ++/* Program to load an ELF binary on a linux system, and run it. ++ References to symbols in sharable libraries can be resolved by either ++ an ELF sharable library or a linux style of shared library. */ ++ ++/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have ++ I ever taken any courses on internals. This program was developed using ++ information available through the book "UNIX SYSTEM V RELEASE 4, ++ Programmers guide: Ansi C and Programming Support Tools", which did ++ a more than adequate job of explaining everything required to get this ++ working. */ ++ ++extern int _dl_linux_resolve(void); ++ ++unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) ++{ ++ int reloc_type; ++ ELF_RELOC *this_reloc; ++ char *strtab; ++ Elf32_Sym *symtab; ++ int symtab_index; ++ char *rel_addr; ++ char *new_addr; ++ char **got_addr; ++ unsigned long instr_addr; ++ char *symname; ++ ++ rel_addr = (char *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr); ++ ++ this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry); ++ reloc_type = ELF32_R_TYPE(this_reloc->r_info); ++ symtab_index = ELF32_R_SYM(this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (reloc_type != R_SH_JMP_SLOT) { ++ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n", ++ _dl_progname); ++ _dl_exit(1); ++ } ++ ++ /* Address of jump instruction to fix up */ ++ instr_addr = ((unsigned long) this_reloc->r_offset + ++ (unsigned long) tpnt->loadaddr); ++ got_addr = (char **) instr_addr; ++ ++ ++ /* Get the address of the GOT entry */ ++ new_addr = _dl_find_hash(symname, tpnt->symbol_scope, tpnt, resolver); ++ if (!new_addr) { ++ new_addr = _dl_find_hash(symname, NULL, NULL, resolver); ++ if (new_addr) { ++ return (unsigned long) new_addr; ++ } ++ ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); ++ _dl_exit(1); ++ } ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if ((unsigned long) got_addr < 0x20000000) ++ { ++ if (_dl_debug_bindings) ++ { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname); ++ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, ++ "\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr); ++ } ++ } ++ if (!_dl_debug_nofixups) { ++ *got_addr = new_addr; ++ } ++#else ++ *got_addr = new_addr; ++#endif ++ ++ return (unsigned long) new_addr; ++} ++ ++ ++static int ++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, ++ unsigned long rel_addr, unsigned long rel_size, ++ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)) ++{ ++ unsigned int i; ++ char *strtab; ++ Elf32_Sym *symtab; ++ ELF_RELOC *rpnt; ++ int symtab_index; ++ /* Now parse the relocation information */ ++ ++ rpnt = (ELF_RELOC *)(intptr_t) (rel_addr + tpnt->loadaddr); ++ rel_size = rel_size / sizeof(ELF_RELOC); ++ ++ symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for (i = 0; i < rel_size; i++, rpnt++) { ++ int res; ++ ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ ++ /* When the dynamic linker bootstrapped itself, it resolved some symbols. ++ Make sure we do not do them again */ ++ if (!symtab_index && tpnt->libtype == program_interpreter) ++ continue; ++ if (symtab_index && tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ debug_sym(symtab,strtab,symtab_index); ++ debug_reloc(symtab,strtab,rpnt); ++#endif ++ ++ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab); ++ ++ if (res==0) continue; ++ ++ _dl_dprintf(2, "\n%s: ",_dl_progname); ++ ++ if (symtab_index) ++ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); ++ ++ if (res <0) ++ { ++ int reloc_type = ELF32_R_TYPE(rpnt->r_info); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); ++#else ++ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); ++#endif ++ _dl_exit(-res); ++ } ++ else if (res >0) ++ { ++ _dl_dprintf(2, "can't resolve symbol\n"); ++ return res; ++ } ++ } ++ return 0; ++} ++ ++ ++static int ++_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ char *symname; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ ++ ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, ++ (reloc_type == R_SH_JMP_SLOT ? tpnt : NULL), symbolrel); ++ ++ /* ++ * We want to allow undefined references to weak symbols - this might ++ * have been intentional. We should not be linking local symbols ++ * here, so all bases should be covered. ++ */ ++ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s'\n", ++ symname, tpnt->libname); ++#endif ++ return 0; ++ } ++ } ++ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_SH_NONE: ++ break; ++ case R_SH_COPY: ++ /* handled later on */ ++ break; ++ case R_SH_DIR32: ++ case R_SH_GLOB_DAT: ++ case R_SH_JMP_SLOT: ++ *reloc_addr = symbol_addr + rpnt->r_addend; ++ break; ++ case R_SH_REL32: ++ *reloc_addr = symbol_addr + rpnt->r_addend - ++ (unsigned long) reloc_addr; ++ break; ++ case R_SH_RELATIVE: ++ *reloc_addr = (unsigned long) tpnt->loadaddr + rpnt->r_addend; ++ break; ++ default: ++ return -1; /*call _dl_exit(1) */ ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ ++ return 0; ++} ++ ++ ++static int ++_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ unsigned long *reloc_addr; ++#if defined (__SUPPORT_LD_DEBUG__) ++ unsigned long old_val; ++#endif ++ (void)scope; ++ (void)symtab; ++ (void)strtab; ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ old_val = *reloc_addr; ++#endif ++ switch (reloc_type) { ++ case R_SH_NONE: ++ break; ++ case R_SH_JMP_SLOT: ++ *reloc_addr += (unsigned long) tpnt->loadaddr; ++ break; ++ default: ++ return -1; /*call _dl_exit(1) */ ++ } ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_reloc && _dl_debug_detail) ++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); ++#endif ++ return 0; ++ ++} ++ ++/* This is done as a separate step, because there are cases where ++ information is first copied and later initialized. This results in ++ the wrong information being copied. Someone at Sun was complaining about ++ a bug in the handling of _COPY by SVr4, and this may in fact be what he ++ was talking about. Sigh. */ ++ ++/* No, there are cases where the SVr4 linker fails to emit COPY relocs ++ at all */ ++static int ++_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope, ++ ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) ++{ ++ int reloc_type; ++ int symtab_index; ++ unsigned long *reloc_addr; ++ unsigned long symbol_addr; ++ int goof = 0; ++ char*symname; ++ ++ reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ if (reloc_type != R_SH_COPY) ++ return 0; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ symname = strtab + symtab[symtab_index].st_name; ++ ++ if (symtab_index) { ++ ++ symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel); ++ if (!symbol_addr) goof++; ++ } ++ if (!goof) { ++#if defined (__SUPPORT_LD_DEBUG__) ++ if(_dl_debug_move) ++ _dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x", ++ symname, symtab[symtab_index].st_size, ++ symbol_addr, symtab[symtab_index].st_value); ++#endif ++ _dl_memcpy((char *) symtab[symtab_index].st_value, ++ (char *) symbol_addr, symtab[symtab_index].st_size); ++ } ++ ++ return goof; ++} ++ ++ ++void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void) type; ++ (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); ++} ++ ++int _dl_parse_relocation_information(struct elf_resolve *tpnt, ++ unsigned long rel_addr, unsigned long rel_size, int type) ++{ ++ (void) type; ++ return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc); ++} ++ ++int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, ++ unsigned long rel_size, int type) ++{ ++ (void) type; ++ return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy); ++} ++ ++ +diff -urN uClibc/ldso-0.9.24/ldso/sh/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/sh/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/sh/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sh/ld_syscalls.h 2002-08-09 07:20:19.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* Define the __set_errno macro as nothing so that we don't bother ++ * setting errno, which is important since we make system calls ++ * before the errno symbol is dynamicly linked. */ ++ ++#define __set_errno(X) {(void)(X);} ++#include "sys/syscall.h" ++ +diff -urN uClibc/ldso-0.9.24/ldso/sh/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/sh/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/sh/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sh/ld_sysdep.h 2002-11-07 20:18:16.000000000 -0600 +@@ -0,0 +1,144 @@ ++/* ++ * Various assmbly language/system dependent hacks that are required ++ * so that we can minimize the amount of platform specific code. ++ */ ++ ++/* ++ * Define this if the system uses RELOCA. ++ */ ++#define ELF_USES_RELOCA ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long*) ARGS) ++ ++/* ++ * Initialization sequence for a GOT. ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++{ \ ++ GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ ++ GOT_BASE[1] = (unsigned long) (MODULE); \ ++} ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. RELP is the relocation that we ++ * are performing, REL is the pointer to the address we are relocating. ++ * SYMBOL is the symbol involved in the relocation, and LOAD is the ++ * load address. ++ */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ switch(ELF32_R_TYPE((RELP)->r_info)){ \ ++ case R_SH_REL32: \ ++ *(REL) = (SYMBOL) + (RELP)->r_addend \ ++ - (unsigned long)(REL); \ ++ break; \ ++ case R_SH_DIR32: \ ++ case R_SH_GLOB_DAT: \ ++ case R_SH_JMP_SLOT: \ ++ *(REL) = (SYMBOL) + (RELP)->r_addend; \ ++ break; \ ++ case R_SH_RELATIVE: \ ++ *(REL) = (LOAD) + (RELP)->r_addend; \ ++ break; \ ++ case R_SH_NONE: \ ++ break; \ ++ default: \ ++ SEND_STDERR("BOOTSTRAP_RELOC: unhandled reloc type "); \ ++ SEND_NUMBER_STDERR(ELF32_R_TYPE((RELP)->r_info), 1); \ ++ SEND_STDERR("REL, SYMBOL, LOAD: "); \ ++ SEND_ADDRESS_STDERR(REL, 0); \ ++ SEND_STDERR(", "); \ ++ SEND_ADDRESS_STDERR(SYMBOL, 0); \ ++ SEND_STDERR(", "); \ ++ SEND_ADDRESS_STDERR(LOAD, 1); \ ++ _dl_exit(1); \ ++ } ++ ++ ++/* ++ * Transfer control to the user's application, once the dynamic loader ++ * is done. This routine has to exit the current function, then ++ * call the _dl_elf_main function. ++ */ ++ ++#define START() return _dl_elf_main; ++ ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++ ++#define MAGIC1 EM_SH ++#undef MAGIC2 ++/* Used for error messages */ ++#define ELF_TARGET "sh" ++ ++struct elf_resolve; ++extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); ++ ++static __inline__ unsigned int ++_dl_urem(unsigned int n, unsigned int base) ++{ ++ int res; ++ ++ __asm__ (""\ ++ "mov #0, r0\n\t" \ ++ "div0u\n\t" \ ++ "" \ ++ "! get one bit from the msb of the numerator into the T\n\t" \ ++ "! bit and divide it by whats in %2. Put the answer bit\n\t" \ ++ "! into the T bit so it can come out again at the bottom\n\t" \ ++ "" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1 ; div1 %2, r0\n\t" \ ++ "rotcl %1\n\t" ++ : "=r" (res) ++ : "0" (n), "r" (base) ++ : "r0","cc"); ++ ++ return n - (base * res); ++} ++ ++#define do_rem(result, n, base) ((result) = _dl_urem((n), (base))) ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/sh/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/sh/resolve.S +--- uClibc/ldso-0.9.24/ldso/sh/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sh/resolve.S 2002-11-07 20:18:16.000000000 -0600 +@@ -0,0 +1,91 @@ ++/* ++ * Stolen from glibc-2.2.2 by Eddie C. Dost ++ */ ++ ++ .text ++ .globl _dl_linux_resolver ++ .globl _dl_linux_resolve ++ .type _dl_linux_resolve, @function ++ .balign 16 ++_dl_linux_resolve: ++ mov.l r3, @-r15 ++ mov.l r4, @-r15 ++ mov.l r5, @-r15 ++ mov.l r6, @-r15 ++ mov.l r7, @-r15 ++ mov.l r12, @-r15 ++ movt r3 ! Save T flag ++ mov.l r3, @-r15 ++ ++#ifdef HAVE_FPU ++ sts.l fpscr, @-r15 ++ mov #8,r3 ++ swap.w r3, r3 ++ lds r3, fpscr ++ fmov.s fr11, @-r15 ++ fmov.s fr10, @-r15 ++ fmov.s fr9, @-r15 ++ fmov.s fr8, @-r15 ++ fmov.s fr7, @-r15 ++ fmov.s fr6, @-r15 ++ fmov.s fr5, @-r15 ++ fmov.s fr4, @-r15 ++#endif ++ sts.l pr, @-r15 ++/* Note - The PLT entries have been "optimised" not to use r2. r2 is used by ++ GCC to return the address of large structures, so it should not be ++ corrupted here. This does mean however, that those PLTs does not conform ++ to the SH PIC ABI. That spec says that r0 contains the type of the PLT ++ and r2 contains the GOT id. The GNU Plt version stores the GOT id in r0 and ++ ignores the type. We can easily detect this difference however, ++ since the type will always be 0 or 8, and the GOT ids will always be ++ greater than or equal to 12. ++ ++ Found in binutils/bfd/elf32-sh.c by Stefan Allius ++ */ ++ mov #8 ,r5 ++ cmp/gt r5, r0 ++ bt 1f ++ mov r2, r0 ! link map address in r2 (SH PIC ABI) ++1: ++ mov r0, r4 ! link map address in r0 (GNUs PLT) ++ mova .LG, r0 ++ mov.l .LG, r5 ++ add r5, r0 ++ mov.l 3f, r5 ++ mov.l @(r0, r5),r5 ++ jsr @r5 ++ mov r1, r5 ! Reloc offset ++ ++ lds.l @r15+, pr ! Get register content back ++ ++#ifdef HAVE_FPU ++ fmov.s @r15+, fr4 ++ fmov.s @r15+, fr5 ++ fmov.s @r15+, fr6 ++ fmov.s @r15+, fr7 ++ fmov.s @r15+, fr8 ++ fmov.s @r15+, fr9 ++ fmov.s @r15+, fr10 ++ fmov.s @r15+, fr11 ++ lds.l @r15+, fpscr ++#endif ++ ++ mov.l @r15+, r3 ++ shal r3 ! Load T flag ++ mov.l @r15+, r12 ++ mov.l @r15+, r7 ++ mov.l @r15+, r6 ++ mov.l @r15+, r5 ++ mov.l @r15+, r4 ++ jmp @r0 ! Jump to function address ++ mov.l @r15+, r3 ++ ++ .balign 4 ++ ++3: ++ .long _dl_linux_resolver@GOT ++.LG: ++ .long _GLOBAL_OFFSET_TABLE_ ++ .size _dl_linux_resolve, . - _dl_linux_resolve ++ +diff -urN uClibc/ldso-0.9.24/ldso/sparc/boot1_arch.h uClibc.ldso.24/ldso-0.9.24/ldso/sparc/boot1_arch.h +--- uClibc/ldso-0.9.24/ldso/sparc/boot1_arch.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sparc/boot1_arch.h 2002-08-08 09:35:49.000000000 -0500 +@@ -0,0 +1,7 @@ ++/* Any assmbly language/system dependent hacks needed to setup boot1.c so it ++ * will work as expected and cope with whatever platform specific wierdness is ++ * needed for this architecture. See arm/boot1_arch.h for an example of what ++ * can be done. ++ */ ++ ++#define LD_BOOT(X) void _dl_boot (X) +diff -urN uClibc/ldso-0.9.24/ldso/sparc/elfinterp.c uClibc.ldso.24/ldso-0.9.24/ldso/sparc/elfinterp.c +--- uClibc/ldso-0.9.24/ldso/sparc/elfinterp.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sparc/elfinterp.c 2002-11-05 12:21:12.000000000 -0600 +@@ -0,0 +1,357 @@ ++/* vi: set sw=4 ts=4: */ ++/* sparc ELF shared library loader suppport ++ * ++ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, ++ * David Engel, Hongjiu Lu and Mitch D'Souza ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. The name of the above contributors may not be ++ * used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++static const char * _dl_reltypes[] = { "R_SPARC_NONE", "R_SPARC_8", ++ "R_SPARC_16", "R_SPARC_32", "R_SPARC_DISP8", "R_SPARC_DISP16", ++ "R_SPARC_DISP32", "R_SPARC_WDISP30", "R_SPARC_WDISP22", ++ "R_SPARC_HI22", "R_SPARC_22", "R_SPARC_13", "R_SPARC_LO10", ++ "R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22", "R_SPARC_PC10", ++ "R_SPARC_PC22", "R_SPARC_WPLT30", "R_SPARC_COPY", ++ "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", "R_SPARC_RELATIVE", ++ "R_SPARC_UA32"}; ++#endif ++ ++/* Program to load an ELF binary on a linux system, and run it. ++References to symbols in sharable libraries can be resolved by either ++an ELF sharable library or a linux style of shared library. */ ++ ++/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have ++ I ever taken any courses on internals. This program was developed using ++ information available through the book "UNIX SYSTEM V RELEASE 4, ++ Programmers guide: Ansi C and Programming Support Tools", which did ++ a more than adequate job of explaining everything required to get this ++ working. */ ++ ++extern _dl_linux_resolve(void); ++ ++unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) ++{ ++ int reloc_type; ++ Elf32_Rela * this_reloc; ++ char * strtab; ++ Elf32_Sym * symtab; ++ Elf32_Rela * rel_addr; ++ struct elf_resolve * tpnt; ++ int symtab_index; ++ char * new_addr; ++ char ** got_addr; ++ unsigned int instr_addr; ++ tpnt = (struct elf_resolve *) plt[2]; ++ ++ rel_addr = (Elf32_Rela *) (tpnt->dynamic_info[DT_JMPREL] + ++ tpnt->loadaddr); ++ ++ /* ++ * Generate the correct relocation index into the .rela.plt section. ++ */ ++ reloc_entry = (reloc_entry >> 12) - 0xc; ++ ++ this_reloc = (Elf32_Rela *) ((char *) rel_addr + reloc_entry); ++ ++ reloc_type = ELF32_R_TYPE(this_reloc->r_info); ++ symtab_index = ELF32_R_SYM(this_reloc->r_info); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ _dl_dprintf(2, "tpnt = %x\n", tpnt); ++ _dl_dprintf(2, "reloc = %x\n", this_reloc); ++ _dl_dprintf(2, "symtab = %x\n", symtab); ++ _dl_dprintf(2, "strtab = %x\n", strtab); ++ ++ ++ if (reloc_type != R_SPARC_JMP_SLOT) { ++ _dl_dprintf(2, "%s: incorrect relocation type in jump relocations (%d)\n", ++ _dl_progname, reloc_type); ++ _dl_exit(30); ++ }; ++ ++ /* Address of jump instruction to fix up */ ++ instr_addr = ((int)this_reloc->r_offset + (int)tpnt->loadaddr); ++ got_addr = (char **) instr_addr; ++ ++ _dl_dprintf(2, "symtab_index %d\n", symtab_index); ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if (_dl_debug_symbols) { ++ _dl_dprintf(2, "Resolving symbol %s\n", ++ strtab + symtab[symtab_index].st_name); ++ } ++#endif ++ ++ /* Get the address of the GOT entry */ ++ new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name, ++ tpnt->symbol_scope, tpnt, resolver); ++ if(!new_addr) { ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ _dl_exit(31); ++ }; ++ ++#if defined (__SUPPORT_LD_DEBUG__) ++ if ((unsigned long) got_addr < 0x40000000) ++ { ++ if (_dl_debug_bindings) ++ { ++ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", ++ strtab + symtab[symtab_index].st_name); ++ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, ++ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr); ++ } ++ } ++ if (!_dl_debug_nofixups) { ++ got_addr[1] = (char *) (0x03000000 | (((unsigned int) new_addr >> 10) & 0x3fffff)); ++ got_addr[2] = (char *) (0x81c06000 | ((unsigned int) new_addr & 0x3ff)); ++ } ++#else ++ got_addr[1] = (char *) (0x03000000 | (((unsigned int) new_addr >> 10) & 0x3fffff)); ++ got_addr[2] = (char *) (0x81c06000 | ((unsigned int) new_addr & 0x3ff)); ++#endif ++ ++ _dl_dprintf(2, "Address = %x\n",new_addr); ++ _dl_exit(32); ++ ++ return (unsigned int) new_addr; ++} ++ ++void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_addr, ++ int rel_size, int type){ ++ int i; ++ char * strtab; ++ int reloc_type; ++ int symtab_index; ++ Elf32_Sym * symtab; ++ Elf32_Rela * rpnt; ++ unsigned int * reloc_addr; ++ ++ /* Now parse the relocation information */ ++ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = ( char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for(i=0; i< rel_size; i += sizeof(Elf32_Rela), rpnt++){ ++ reloc_addr = (int *) (tpnt->loadaddr + (int)rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ ++ /* When the dynamic linker bootstrapped itself, it resolved some symbols. ++ Make sure we do not do them again */ ++ if(!symtab_index && tpnt->libtype == program_interpreter) continue; ++ if(symtab_index && tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++ switch(reloc_type){ ++ case R_SPARC_NONE: ++ break; ++ case R_SPARC_JMP_SLOT: ++ break; ++ default: ++ _dl_dprintf(2, "%s: (LAZY) can't handle reloc type ", _dl_progname); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]); ++#endif ++ if(symtab_index) _dl_dprintf(2, "'%s'\n", ++ strtab + symtab[symtab_index].st_name); ++ _dl_exit(33); ++ }; ++ }; ++} ++ ++int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr, ++ int rel_size, int type){ ++ int i; ++ char * strtab; ++ int reloc_type; ++ int goof = 0; ++ Elf32_Sym * symtab; ++ Elf32_Rela * rpnt; ++ unsigned int * reloc_addr; ++ unsigned int symbol_addr; ++ int symtab_index; ++ /* Now parse the relocation information */ ++ ++ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = ( char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for(i=0; i< rel_size; i+= sizeof(Elf32_Rela), rpnt++){ ++ reloc_addr = (int *) (tpnt->loadaddr + (int)rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ ++ if(!symtab_index && tpnt->libtype == program_interpreter) continue; ++ ++ if(symtab_index) { ++ ++ if(tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++ symbol_addr = (unsigned int) ++ _dl_find_hash(strtab + symtab[symtab_index].st_name, ++ tpnt->symbol_scope, ++ (reloc_type == R_SPARC_JMP_SLOT ? tpnt : NULL), symbolrel); ++ ++ if(!symbol_addr && ++ ELF32_ST_BIND(symtab [symtab_index].st_info) == STB_GLOBAL) { ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ goof++; ++ }; ++ }; ++ switch(reloc_type){ ++ case R_SPARC_NONE: ++ break; ++ case R_SPARC_32: ++ *reloc_addr = symbol_addr + rpnt->r_addend; ++ break; ++ case R_SPARC_DISP32: ++ *reloc_addr = symbol_addr + rpnt->r_addend - (unsigned int) reloc_addr; ++ break; ++ case R_SPARC_GLOB_DAT: ++ *reloc_addr = symbol_addr + rpnt->r_addend; ++ break; ++ case R_SPARC_JMP_SLOT: ++ reloc_addr[1] = 0x03000000 | ((symbol_addr >> 10) & 0x3fffff); ++ reloc_addr[2] = 0x81c06000 | (symbol_addr & 0x3ff); ++ break; ++ case R_SPARC_RELATIVE: ++ *reloc_addr += (unsigned int) tpnt->loadaddr + rpnt->r_addend; ++ break; ++ case R_SPARC_HI22: ++ if (!symbol_addr) ++ symbol_addr = tpnt->loadaddr + rpnt->r_addend; ++ else ++ symbol_addr += rpnt->r_addend; ++ *reloc_addr = (*reloc_addr & 0xffc00000)|(symbol_addr >> 10); ++ break; ++ case R_SPARC_LO10: ++ if (!symbol_addr) ++ symbol_addr = tpnt->loadaddr + rpnt->r_addend; ++ else ++ symbol_addr += rpnt->r_addend; ++ *reloc_addr = (*reloc_addr & ~0x3ff)|(symbol_addr & 0x3ff); ++ break; ++ case R_SPARC_WDISP30: ++ *reloc_addr = (*reloc_addr & 0xc0000000)| ++ ((symbol_addr - (unsigned int) reloc_addr) >> 2); ++ break; ++ case R_SPARC_COPY: ++#if 0 /* This one is done later */ ++ _dl_dprintf(2, "Doing copy for symbol "); ++ if(symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name); ++ _dl_dprintf(2, "\n"); ++ _dl_memcpy((void *) symtab[symtab_index].st_value, ++ (void *) symbol_addr, ++ symtab[symtab_index].st_size); ++#endif ++ break; ++ default: ++ _dl_dprintf(2, "%s: can't handle reloc type ", _dl_progname); ++#if defined (__SUPPORT_LD_DEBUG__) ++ _dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]); ++#endif ++ if (symtab_index) ++ _dl_dprintf(2, "'%s'\n", strtab + symtab[symtab_index].st_name); ++ _dl_exit(34); ++ }; ++ ++ }; ++ return goof; ++} ++ ++ ++/* This is done as a separate step, because there are cases where ++ information is first copied and later initialized. This results in ++ the wrong information being copied. Someone at Sun was complaining about ++ a bug in the handling of _COPY by SVr4, and this may in fact be what he ++ was talking about. Sigh. */ ++ ++/* No, there are cases where the SVr4 linker fails to emit COPY relocs ++ at all */ ++ ++int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr, ++ int rel_size, int type) ++{ ++ int i; ++ char * strtab; ++ int reloc_type; ++ int goof = 0; ++ Elf32_Sym * symtab; ++ Elf32_Rela * rpnt; ++ unsigned int * reloc_addr; ++ unsigned int symbol_addr; ++ struct elf_resolve *tpnt; ++ int symtab_index; ++ /* Now parse the relocation information */ ++ ++ tpnt = xpnt->dyn; ++ ++ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); ++ ++ symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); ++ strtab = ( char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr); ++ ++ for(i=0; i< rel_size; i+= sizeof(Elf32_Rela), rpnt++){ ++ reloc_addr = (int *) (tpnt->loadaddr + (int)rpnt->r_offset); ++ reloc_type = ELF32_R_TYPE(rpnt->r_info); ++ if(reloc_type != R_SPARC_COPY) continue; ++ symtab_index = ELF32_R_SYM(rpnt->r_info); ++ symbol_addr = 0; ++ if(!symtab_index && tpnt->libtype == program_interpreter) continue; ++ if(symtab_index) { ++ ++ if(tpnt->libtype == program_interpreter && ++ _dl_symbol(strtab + symtab[symtab_index].st_name)) ++ continue; ++ ++ symbol_addr = (unsigned int) ++ _dl_find_hash(strtab + symtab[symtab_index].st_name, ++ xpnt->next, NULL, copyrel); ++ if(!symbol_addr) { ++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", ++ _dl_progname, strtab + symtab[symtab_index].st_name); ++ goof++; ++ }; ++ }; ++ if (!goof) ++ _dl_memcpy((char *) symtab[symtab_index].st_value, ++ (char *) symbol_addr, ++ symtab[symtab_index].st_size); ++ }; ++ return goof; ++} ++ ++ +diff -urN uClibc/ldso-0.9.24/ldso/sparc/ld_syscalls.h uClibc.ldso.24/ldso-0.9.24/ldso/sparc/ld_syscalls.h +--- uClibc/ldso-0.9.24/ldso/sparc/ld_syscalls.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sparc/ld_syscalls.h 2002-03-19 04:43:35.000000000 -0600 +@@ -0,0 +1,155 @@ ++/* ++ * This file contains the system call macros and syscall ++ * numbers used by the shared library loader. ++ */ ++ ++#define __NR_exit 1 ++#define __NR_read 3 ++#define __NR_write 4 ++#define __NR_open 5 ++#define __NR_close 6 ++#define __NR_getuid 24 ++#define __NR_getgid 47 ++#define __NR_geteuid 49 ++#define __NR_getegid 50 ++#define __NR_readlink 58 ++#define __NR_mmap 71 ++#define __NR_munmap 73 ++#define __NR_stat 38 ++#define __NR_mprotect 74 ++ ++/* Here are the macros which define how this platform makes ++ * system calls. This particular variant does _not_ set ++ * errno (note how it is disabled in __syscall_return) since ++ * these will get called before the errno symbol is dynamicly ++ * linked. */ ++ ++#define _syscall0(type,name) \ ++type name(void) \ ++{ \ ++long __res; \ ++register long __g1 __asm__ ("g1") = __NR_##name; \ ++__asm__ __volatile__ ("t 0x10\n\t" \ ++ "bcc 1f\n\t" \ ++ "mov %%o0, %0\n\t" \ ++ "sub %%g0, %%o0, %0\n\t" \ ++ "1:\n\t" \ ++ : "=r" (__res)\ ++ : "r" (__g1) \ ++ : "o0", "cc"); \ ++if (__res < -255 || __res >= 0) \ ++ return (type) __res; \ ++/*errno = -__res; */\ ++return -1; \ ++} ++ ++#define _syscall1(type,name,type1,arg1) \ ++type name(type1 arg1) \ ++{ \ ++long __res; \ ++register long __g1 __asm__ ("g1") = __NR_##name; \ ++register long __o0 __asm__ ("o0") = (long)(arg1); \ ++__asm__ __volatile__ ("t 0x10\n\t" \ ++ "bcc 1f\n\t" \ ++ "mov %%o0, %0\n\t" \ ++ "sub %%g0, %%o0, %0\n\t" \ ++ "1:\n\t" \ ++ : "=r" (__res), "=&r" (__o0) \ ++ : "1" (__o0), "r" (__g1) \ ++ : "cc"); \ ++if (__res < -255 || __res >= 0) \ ++ return (type) __res; \ ++/*errno = -__res;*/ \ ++return -1; \ ++} ++ ++#define _syscall2(type,name,type1,arg1,type2,arg2) \ ++type name(type1 arg1,type2 arg2) \ ++{ \ ++long __res; \ ++register long __g1 __asm__ ("g1") = __NR_##name; \ ++register long __o0 __asm__ ("o0") = (long)(arg1); \ ++register long __o1 __asm__ ("o1") = (long)(arg2); \ ++__asm__ __volatile__ ("t 0x10\n\t" \ ++ "bcc 1f\n\t" \ ++ "mov %%o0, %0\n\t" \ ++ "sub %%g0, %%o0, %0\n\t" \ ++ "1:\n\t" \ ++ : "=r" (__res), "=&r" (__o0) \ ++ : "1" (__o0), "r" (__o1), "r" (__g1) \ ++ : "cc"); \ ++if (__res < -255 || __res >= 0) \ ++ return (type) __res; \ ++/*errno = -__res;*/ \ ++return -1; \ ++} ++ ++#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ ++type name(type1 arg1,type2 arg2,type3 arg3) \ ++{ \ ++long __res; \ ++register long __g1 __asm__ ("g1") = __NR_##name; \ ++register long __o0 __asm__ ("o0") = (long)(arg1); \ ++register long __o1 __asm__ ("o1") = (long)(arg2); \ ++register long __o2 __asm__ ("o2") = (long)(arg3); \ ++__asm__ __volatile__ ("t 0x10\n\t" \ ++ "bcc 1f\n\t" \ ++ "mov %%o0, %0\n\t" \ ++ "sub %%g0, %%o0, %0\n\t" \ ++ "1:\n\t" \ ++ : "=r" (__res), "=&r" (__o0) \ ++ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ ++ : "cc"); \ ++if (__res < -255 || __res>=0) \ ++ return (type) __res; \ ++/*errno = -__res;*/ \ ++return -1; \ ++} ++ ++#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ ++type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ ++{ \ ++long __res; \ ++register long __g1 __asm__ ("g1") = __NR_##name; \ ++register long __o0 __asm__ ("o0") = (long)(arg1); \ ++register long __o1 __asm__ ("o1") = (long)(arg2); \ ++register long __o2 __asm__ ("o2") = (long)(arg3); \ ++register long __o3 __asm__ ("o3") = (long)(arg4); \ ++__asm__ __volatile__ ("t 0x10\n\t" \ ++ "bcc 1f\n\t" \ ++ "mov %%o0, %0\n\t" \ ++ "sub %%g0, %%o0, %0\n\t" \ ++ "1:\n\t" \ ++ : "=r" (__res), "=&r" (__o0) \ ++ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ ++ : "cc"); \ ++if (__res < -255 || __res>=0) \ ++ return (type) __res; \ ++/*errno = -__res;*/ \ ++return -1; \ ++} ++ ++#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ ++ type5,arg5) \ ++type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ ++{ \ ++long __res; \ ++register long __g1 __asm__ ("g1") = __NR_##name; \ ++register long __o0 __asm__ ("o0") = (long)(arg1); \ ++register long __o1 __asm__ ("o1") = (long)(arg2); \ ++register long __o2 __asm__ ("o2") = (long)(arg3); \ ++register long __o3 __asm__ ("o3") = (long)(arg4); \ ++register long __o4 __asm__ ("o4") = (long)(arg5); \ ++__asm__ __volatile__ ("t 0x10\n\t" \ ++ "bcc 1f\n\t" \ ++ "mov %%o0, %0\n\t" \ ++ "sub %%g0, %%o0, %0\n\t" \ ++ "1:\n\t" \ ++ : "=r" (__res), "=&r" (__o0) \ ++ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \ ++ : "cc"); \ ++if (__res < -255 || __res>=0) \ ++ return (type) __res; \ ++/*errno = -__res; */\ ++return -1; \ ++} +diff -urN uClibc/ldso-0.9.24/ldso/sparc/ld_sysdep.h uClibc.ldso.24/ldso-0.9.24/ldso/sparc/ld_sysdep.h +--- uClibc/ldso-0.9.24/ldso/sparc/ld_sysdep.h 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sparc/ld_sysdep.h 2002-08-09 08:05:29.000000000 -0500 +@@ -0,0 +1,112 @@ ++ ++/* ++ * Various assmbly language/system dependent hacks that are required ++ * so that we can minimize the amount of platform specific code. ++ */ ++#define LINUXBIN ++ ++/* ++ * Define this if the system uses RELOCA. ++ */ ++#define ELF_USES_RELOCA ++ ++/* ++ * Get a pointer to the argv array. On many platforms this can be just ++ * the address if the first argument, on other platforms we need to ++ * do something a little more subtle here. We assume that argc is stored ++ * at the word just below the argvp that we return here. ++ */ ++#define GET_ARGV(ARGVP, ARGS) __asm__("\tadd %%fp,68,%0\n" : "=r" (ARGVP)); ++ ++/* ++ * Initialization sequence for a GOT. For the Sparc, this points to the ++ * PLT, and we need to initialize a couple of the slots. The PLT should ++ * look like: ++ * ++ * save %sp, -64, %sp ++ * call _dl_linux_resolve ++ * nop ++ * .word implementation_dependent ++ */ ++#define INIT_GOT(GOT_BASE,MODULE) \ ++{ \ ++ GOT_BASE[0] = 0x9de3bfc0; /* save %sp, -64, %sp */ \ ++ GOT_BASE[1] = 0x40000000 | (((unsigned int) _dl_linux_resolve - (unsigned int) GOT_BASE - 4) >> 2); \ ++ GOT_BASE[2] = 0x01000000; /* nop */ \ ++ GOT_BASE[3] = (int) MODULE; \ ++} ++ ++/* ++ * Here is a macro to perform a relocation. This is only used when ++ * bootstrapping the dynamic loader. ++ */ ++#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ ++ switch(ELF32_R_TYPE((RELP)->r_info)) { \ ++ case R_SPARC_32: \ ++ *REL = SYMBOL + (RELP)->r_addend; \ ++ break; \ ++ case R_SPARC_GLOB_DAT: \ ++ *REL = SYMBOL + (RELP)->r_addend; \ ++ break; \ ++ case R_SPARC_JMP_SLOT: \ ++ REL[1] = 0x03000000 | ((SYMBOL >> 10) & 0x3fffff); \ ++ REL[2] = 0x81c06000 | (SYMBOL & 0x3ff); \ ++ break; \ ++ case R_SPARC_NONE: \ ++ break; \ ++ case R_SPARC_WDISP30: \ ++ break; \ ++ case R_SPARC_RELATIVE: \ ++ *REL += (unsigned int) LOAD + (RELP)->r_addend; \ ++ break; \ ++ default: \ ++ _dl_exit(1); \ ++ } ++ ++ ++/* ++ * Transfer control to the user's application, once the dynamic loader ++ * is done. The crt calls atexit with $g1 if not null, so we need to ++ * ensure that it contains NULL. ++ */ ++ ++#define START() \ ++ __asm__ volatile ( \ ++ "add %%g0,%%g0,%%g1\n\t" \ ++ "jmpl %0, %%o7\n\t" \ ++ "restore %%g0,%%g0,%%g0\n\t" \ ++ : /*"=r" (status) */ : \ ++ "r" (_dl_elf_main): "g1", "o0", "o1") ++ ++ ++ ++/* Here we define the magic numbers that this dynamic loader should accept */ ++ ++#define MAGIC1 EM_SPARC ++#undef MAGIC2 ++/* Used for error messages */ ++#define ELF_TARGET "Sparc" ++ ++#ifndef COMPILE_ASM ++extern unsigned int _dl_linux_resolver(unsigned int reloc_entry, ++ unsigned int * i); ++#endif ++ ++/* ++ * Define this if you want a dynamic loader that works on Solaris. ++ */ ++#define SOLARIS_COMPATIBLE ++ ++#define do_rem(result, n, base) result = (n % base) ++ ++/* ++ * dbx wants the binder to have a specific name. Mustn't disappoint it. ++ */ ++#ifdef SOLARIS_COMPATIBLE ++#define _dl_linux_resolve _elf_rtbndr ++#endif ++ ++/* 4096 bytes alignment */ ++#define PAGE_ALIGN 0xfffff000 ++#define ADDR_ALIGN 0xfff ++#define OFFS_ALIGN 0x7ffff000 +diff -urN uClibc/ldso-0.9.24/ldso/sparc/resolve.S uClibc.ldso.24/ldso-0.9.24/ldso/sparc/resolve.S +--- uClibc/ldso-0.9.24/ldso/sparc/resolve.S 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/ldso/sparc/resolve.S 2002-01-11 13:57:41.000000000 -0600 +@@ -0,0 +1,25 @@ ++/* ++ * These are various helper routines that are needed to run an ELF image. ++ */ ++#define COMPILE_ASM ++#include "ld_sysdep.h" ++ ++.text ++ .align 16 ++ ++.globl _dl_linux_resolve ++_dl_linux_resolve: ++ /* ++ * Call the resolver - pass the address of the PLT so that we can ++ * figure out which module we are in. ++ */ ++ mov %o7,%o1 ++ call _dl_linux_resolver ++ mov %g1,%o0 ++ ++ jmpl %o0,%o7 ++ restore ++.LFE2: ++ ++ .type _dl_linux_resolve,#function ++ .size _dl_linux_resolve,.LFE2-_dl_linux_resolve +diff -urN uClibc/ldso-0.9.24/libdl/.cvsignore uClibc.ldso.24/ldso-0.9.24/libdl/.cvsignore +--- uClibc/ldso-0.9.24/libdl/.cvsignore 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/libdl/.cvsignore 2001-04-26 11:12:47.000000000 -0500 +@@ -0,0 +1,2 @@ ++libdl.so* ++ +diff -urN uClibc/ldso-0.9.24/libdl/Makefile uClibc.ldso.24/ldso-0.9.24/libdl/Makefile +--- uClibc/ldso-0.9.24/libdl/Makefile 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/libdl/Makefile 2004-03-01 03:05:53.000000000 -0600 +@@ -0,0 +1,86 @@ ++# Makefile for uClibc ++# ++# Copyright (C) 2000 by Lineo, inc. ++# Copyright (C) 2000-2002 Erik Andersen ++# ++# This program is free software; you can redistribute it and/or modify it under ++# the terms of the GNU Library 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 Library General Public License for more ++# details. ++# ++# You should have received a copy of the GNU Library 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 ++ ++ ++TOPDIR=../../ ++include $(TOPDIR)Rules.mak ++ ++XXFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) \ ++ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ ++ -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso-0.9.24/include -I. -I$(TOPDIR)include ++ ++ifeq ($(DODEBUG),y) ++XXFLAGS=$(XWARNINGS) -O0 -g3 $(XARCH_CFLAGS) $(CPU_CFLAGS) \ ++ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ ++ -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso-0.9.24/include -I. -I$(TOPDIR)include ++endif ++ ++XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp") ++XXFLAGS_NOPIC:=$(XXFLAGS) ++ifeq ($(DOPIC),y) ++ XXFLAGS += $(PICFLAG) -D__LIBDL_SHARED__ ++endif ++ifeq ($(strip $(SUPPORT_LD_DEBUG)),y) ++XXFLAGS+=-D__SUPPORT_LD_DEBUG__ ++endif ++ ++LIBDL=libdl.a ++LIBDL_PIC=libdl_pic.a ++LIBDL_SHARED=libdl.so ++LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ++ ++CSRC=dlib.c ++OBJS=dlib.o ++PIC_OBJS=dlib_pic.o ++ ++all: $(OBJS) $(LIBDL) shared ++ ++$(LIBDL): ar-target ++ ++ar-target: $(OBJS) $(PIC_OBJS) ++ $(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS) ++ $(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS) ++ $(INSTALL) -d $(TOPDIR)lib ++ $(RM) $(TOPDIR)lib/$(LIBDL) ++ $(INSTALL) -m 644 $(LIBDL) $(TOPDIR)lib ++ ++ ++dlib.o: dlib.c ++ $(CC) $(XXFLAGS_NOPIC) -c dlib.c -o dlib.o ++ $(STRIPTOOL) -x -R .note -R .comment $*.o ++ ++dlib_pic.o: dlib.c ++ $(CC) $(XXFLAGS) -c dlib.c -o dlib_pic.o ++ $(STRIPTOOL) -x -R .note -R .comment $*.o ++ ++$(OBJ): Makefile ++ ++shared: ++ $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \ ++ -o $(LIBDL_SHARED_FULLNAME) --whole-archive $(LIBDL_PIC) \ ++ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \ ++ -L$(TOPDIR)/lib -lc $(LDADD_LIBFLOAT) $(LIBGCC); ++ $(INSTALL) -d $(TOPDIR)lib ++ $(RM) $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION) ++ $(INSTALL) -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib ++ $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED) ++ $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION) ++ ++clean: ++ $(RM) .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~ +diff -urN uClibc/ldso-0.9.24/libdl/dlib.c uClibc.ldso.24/ldso-0.9.24/libdl/dlib.c +--- uClibc/ldso-0.9.24/libdl/dlib.c 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/libdl/dlib.c 2004-03-01 03:04:42.000000000 -0600 +@@ -0,0 +1,664 @@ ++/* ++ * libdl.c ++ * ++ * Functions required for dlopen et. al. ++ */ ++ ++#include ++ ++ ++/* The public interfaces */ ++void *dlopen(const char *, int) __attribute__ ((__weak__, __alias__ ("_dlopen"))); ++int dlclose(void *) __attribute__ ((__weak__, __alias__ ("_dlclose"))); ++void *dlsym(void *, const char *) __attribute__ ((__weak__, __alias__ ("_dlsym"))); ++const char *dlerror(void) __attribute__ ((__weak__, __alias__ ("_dlerror"))); ++int dladdr(void *, Dl_info *) __attribute__ ((__weak__, __alias__ ("_dladdr"))); ++void _dlinfo(void); ++ ++ ++#ifdef __LIBDL_SHARED__ ++/* This is a real hack. We need access to the dynamic linker, but we ++also need to make it possible to link against this library without any ++unresolved externals. We provide these weak symbols to make the link ++possible, but at run time the normal symbols are accessed. */ ++static void __attribute__ ((unused)) foobar(void) ++{ ++ const char msg[]="libdl library not correctly linked\n"; ++ _dl_write(2, msg, _dl_strlen(msg)); ++ _dl_exit(1); ++} ++ ++static int __attribute__ ((unused)) foobar1 = (int) foobar; /* Use as pointer */ ++extern void _dl_dprintf(int, const char *, ...) __attribute__ ((__weak__, __alias__ ("foobar"))); ++extern char *_dl_find_hash(const char *, struct dyn_elf *, struct elf_resolve *, enum caller_type) ++ __attribute__ ((__weak__, __alias__ ("foobar"))); ++extern struct elf_resolve * _dl_load_shared_library(int, struct dyn_elf **, struct elf_resolve *, char *) ++ __attribute__ ((__weak__, __alias__ ("foobar"))); ++extern struct elf_resolve * _dl_check_if_named_library_is_loaded(const char *full_libname) ++ __attribute__ ((__weak__, __alias__ ("foobar"))); ++extern int _dl_fixup(struct elf_resolve *tpnt, int lazy) ++ __attribute__ ((__weak__, __alias__ ("foobar"))); ++extern int _dl_copy_fixups(struct dyn_elf * tpnt) ++ __attribute__ ((__weak__, __alias__ ("foobar"))); ++#ifdef __mips__ ++extern void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt) ++ __attribute__ ((__weak__, __alias__ ("foobar"))); ++#endif ++#ifdef USE_CACHE ++int _dl_map_cache(void) __attribute__ ((__weak__, __alias__ ("foobar"))); ++int _dl_unmap_cache(void) __attribute__ ((__weak__, __alias__ ("foobar"))); ++#endif ++ ++extern struct dyn_elf *_dl_symbol_tables __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern struct dyn_elf *_dl_handles __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern struct elf_resolve *_dl_loaded_modules __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern struct r_debug *_dl_debug_addr __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern unsigned long _dl_error_number __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern void *(*_dl_malloc_function)(size_t) __attribute__ ((__weak__, __alias__ ("foobar1"))); ++#ifdef __SUPPORT_LD_DEBUG__ ++extern char *_dl_debug __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern char *_dl_debug_symbols __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern char *_dl_debug_move __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern char *_dl_debug_reloc __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern char *_dl_debug_detail __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern char *_dl_debug_nofixups __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern char *_dl_debug_bindings __attribute__ ((__weak__, __alias__ ("foobar1"))); ++extern int _dl_debug_file __attribute__ ((__weak__, __alias__ ("foobar1"))); ++#endif ++ ++#else /* __LIBDL_SHARED__ */ ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++char *_dl_debug = 0; ++char *_dl_debug_symbols = 0; ++char *_dl_debug_move = 0; ++char *_dl_debug_reloc = 0; ++char *_dl_debug_detail = 0; ++char *_dl_debug_nofixups = 0; ++char *_dl_debug_bindings = 0; ++int _dl_debug_file = 2; ++#endif ++char *_dl_library_path = 0; ++char *_dl_ldsopath = 0; ++struct r_debug *_dl_debug_addr = NULL; ++static char *_dl_malloc_addr, *_dl_mmap_zero; ++#include "../ldso/_dl_progname.h" /* Pull in the name of ld.so */ ++#include "../ldso/hash.c" ++#define _dl_trace_loaded_objects 0 ++#include "../ldso/readelflib1.c" ++void *(*_dl_malloc_function) (size_t size); ++int _dl_fixup(struct elf_resolve *tpnt, int lazy); ++#endif ++ ++static int do_dlclose(void *, int need_fini); ++ ++ ++static const char *dl_error_names[] = { ++ "", ++ "File not found", ++ "Unable to open /dev/zero", ++ "Not an ELF file", ++#if defined (__i386__) ++ "Not i386 binary", ++#elif defined (__sparc__) ++ "Not sparc binary", ++#elif defined (__mc68000__) ++ "Not m68k binary", ++#else ++ "Unrecognized binary type", ++#endif ++ "Not an ELF shared library", ++ "Unable to mmap file", ++ "No dynamic section", ++#ifdef ELF_USES_RELOCA ++ "Unable to process REL relocs", ++#else ++ "Unable to process RELA relocs", ++#endif ++ "Bad handle", ++ "Unable to resolve symbol" ++}; ++ ++static void __attribute__ ((destructor)) dl_cleanup(void) ++{ ++ struct dyn_elf *d; ++ ++ for (d = _dl_handles; d; d = d->next_handle) ++ if (d->dyn->libtype == loaded_file && d->dyn->dynamic_info[DT_FINI]) { ++ (* ((int (*)(void)) (d->dyn->loadaddr + d->dyn->dynamic_info[DT_FINI]))) (); ++ d->dyn->dynamic_info[DT_FINI] = 0; ++ } ++} ++ ++void *_dlopen(const char *libname, int flag) ++{ ++ struct elf_resolve *tpnt, *tfrom, *tcurr; ++ struct dyn_elf *dyn_chain, *rpnt = NULL; ++ struct dyn_elf *dpnt; ++ static int dl_init = 0; ++ ElfW(Addr) from; ++ struct elf_resolve *tpnt1; ++ void (*dl_brk) (void); ++ ++ /* A bit of sanity checking... */ ++ if (!(flag & (RTLD_LAZY|RTLD_NOW))) { ++ _dl_error_number = LD_BAD_HANDLE; ++ return NULL; ++ } ++ ++ from = (ElfW(Addr)) __builtin_return_address(0); ++ ++ /* Have the dynamic linker use the regular malloc function now */ ++ if (!dl_init) { ++ dl_init++; ++ _dl_malloc_function = malloc; ++ } ++ ++ /* Cover the trivial case first */ ++ if (!libname) ++ return _dl_symbol_tables; ++ ++ _dl_map_cache(); ++ ++ /* ++ * Try and locate the module we were called from - we ++ * need this so that we get the correct RPATH. Note that ++ * this is the current behavior under Solaris, but the ++ * ABI+ specifies that we should only use the RPATH from ++ * the application. Thus this may go away at some time ++ * in the future. ++ */ ++ tfrom = NULL; ++ for (dpnt = _dl_symbol_tables; dpnt; dpnt = dpnt->next) { ++ tpnt = dpnt->dyn; ++ if (tpnt->loadaddr < from ++ && (tfrom == NULL || tfrom->loadaddr < tpnt->loadaddr)) ++ tfrom = tpnt; ++ } ++ ++ /* Try to load the specified library */ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(_dl_debug_file, "Trying to dlopen '%s'\n", (char*)libname); ++#endif ++ tpnt = _dl_load_shared_library(0, &rpnt, tfrom, (char*)libname); ++ if (tpnt == NULL) { ++ _dl_unmap_cache(); ++ return NULL; ++ } ++ ++ dyn_chain = (struct dyn_elf *) malloc(sizeof(struct dyn_elf)); ++ _dl_memset(dyn_chain, 0, sizeof(struct dyn_elf)); ++ dyn_chain->dyn = tpnt; ++ dyn_chain->flags = flag; ++ if (!tpnt->symbol_scope) ++ tpnt->symbol_scope = dyn_chain; ++ ++ dyn_chain->next_handle = _dl_handles; ++ _dl_handles = rpnt = dyn_chain; ++ ++ if (tpnt->init_flag & INIT_FUNCS_CALLED) { ++ /* If the init and fini stuff has already been run, that means ++ * the dlopen'd library has already been loaded, and nothing ++ * further needs to be done. */ ++ return (void *) dyn_chain; ++ } ++ ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(_dl_debug_file, "Looking for needed libraries\n"); ++#endif ++ ++ for (tcurr = tpnt; tcurr; tcurr = tcurr->next) ++ { ++ Elf32_Dyn *dpnt; ++ char *lpntstr; ++ for (dpnt = (Elf32_Dyn *) tcurr->dynamic_addr; dpnt->d_tag; dpnt++) { ++ if (dpnt->d_tag == DT_NEEDED) { ++ ++ char *name; ++ lpntstr = (char*) (tcurr->loadaddr + tcurr->dynamic_info[DT_STRTAB] + ++ dpnt->d_un.d_val); ++ name = _dl_get_last_path_component(lpntstr); ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(_dl_debug_file, "Trying to load '%s', needed by '%s'\n", ++ lpntstr, tcurr->libname); ++#endif ++ ++ if (!(tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr))) { ++ goto oops; ++ } ++ ++#if 1 ++//FIXME: Enabling this is _so_ wrong.... ++ /* We need global symbol resolution for everything ++ * in the dependent chain */ ++ dyn_chain->flags |= RTLD_GLOBAL; ++#endif ++ ++ rpnt->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf)); ++ _dl_memset (rpnt->next, 0, sizeof (struct dyn_elf)); ++ rpnt = rpnt->next; ++ if (!tpnt1->symbol_scope) tpnt1->symbol_scope = rpnt; ++ rpnt->dyn = tpnt1; ++ ++ } ++ } ++ } ++ ++ /* ++ * OK, now attach the entire chain at the end ++ */ ++ rpnt->next = _dl_symbol_tables; ++ ++#ifdef __mips__ ++ /* ++ * Relocation of the GOT entries for MIPS have to be done ++ * after all the libraries have been loaded. ++ */ ++ _dl_perform_mips_global_got_relocations(tpnt); ++#endif ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(_dl_debug_file, "Beginning dlopen relocation fixups\n"); ++#endif ++ /* ++ * OK, now all of the kids are tucked into bed in their proper addresses. ++ * Now we go through and look for REL and RELA records that indicate fixups ++ * to the GOT tables. We need to do this in reverse order so that COPY ++ * directives work correctly */ ++ if (_dl_fixup(dyn_chain->dyn, dyn_chain->flags)) ++ goto oops; ++ ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(_dl_debug_file, "Beginning dlopen copy fixups\n"); ++#endif ++ if (_dl_symbol_tables) { ++ if (_dl_copy_fixups(dyn_chain)) ++ goto oops; ++ } ++ ++ ++ /* TODO: Should we set the protections of all pages back to R/O now ? */ ++ ++ ++ /* Notify the debugger we have added some objects. */ ++ _dl_debug_addr->r_state = RT_ADD; ++ if (_dl_debug_addr) { ++ dl_brk = (void (*)(void)) _dl_debug_addr->r_brk; ++ if (dl_brk != NULL) { ++ _dl_debug_addr->r_state = RT_ADD; ++ (*dl_brk) (); ++ ++ _dl_debug_addr->r_state = RT_CONSISTENT; ++ (*dl_brk) (); ++ } ++ } ++ ++#if 0 //def __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dlinfo(); ++#endif ++ ++#ifdef __LIBDL_SHARED__ ++ /* Find the last library so we can run things in the right order */ ++ for (tpnt = dyn_chain->dyn; tpnt->next!=NULL; tpnt = tpnt->next) ++ ; ++ ++ /* Run the ctors and set up the dtors */ ++ for (; tpnt != dyn_chain->dyn->prev; tpnt=tpnt->prev) ++ { ++ /* Apparently crt1 for the application is responsible for handling this. ++ * We only need to run the init/fini for shared libraries ++ */ ++ if (tpnt->libtype == program_interpreter) ++ continue; ++ if (tpnt->libtype == elf_executable) ++ continue; ++ if (tpnt->init_flag & INIT_FUNCS_CALLED) ++ continue; ++ tpnt->init_flag |= INIT_FUNCS_CALLED; ++ ++ if (tpnt->dynamic_info[DT_INIT]) { ++ void (*dl_elf_func) (void); ++ dl_elf_func = (void (*)(void)) (tpnt->loadaddr + tpnt->dynamic_info[DT_INIT]); ++ if (dl_elf_func && *dl_elf_func != NULL) { ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(2, "running ctors for library %s at '%x'\n", tpnt->libname, dl_elf_func); ++#endif ++ (*dl_elf_func) (); ++ } ++ } ++ if (tpnt->dynamic_info[DT_FINI]) { ++ void (*dl_elf_func) (void); ++ dl_elf_func = (void (*)(void)) (tpnt->loadaddr + tpnt->dynamic_info[DT_FINI]); ++ if (dl_elf_func && *dl_elf_func != NULL) { ++#ifdef __SUPPORT_LD_DEBUG__ ++ if(_dl_debug) ++ _dl_dprintf(2, "setting up dtors for library %s at '%x'\n", tpnt->libname, dl_elf_func); ++#endif ++ atexit(dl_elf_func); ++ } ++ } ++ } ++#endif ++ return (void *) dyn_chain; ++ ++oops: ++ /* Something went wrong. Clean up and return NULL. */ ++ _dl_unmap_cache(); ++ do_dlclose(dyn_chain, 0); ++ return NULL; ++} ++ ++void *_dlsym(void *vhandle, const char *name) ++{ ++ struct elf_resolve *tpnt, *tfrom; ++ struct dyn_elf *handle; ++ ElfW(Addr) from; ++ struct dyn_elf *rpnt; ++ void *ret; ++ ++ handle = (struct dyn_elf *) vhandle; ++ ++ /* First of all verify that we have a real handle ++ of some kind. Return NULL if not a valid handle. */ ++ ++ if (handle == NULL) ++ handle = _dl_symbol_tables; ++ else if (handle != RTLD_NEXT && handle != _dl_symbol_tables) { ++ for (rpnt = _dl_handles; rpnt; rpnt = rpnt->next_handle) ++ if (rpnt == handle) ++ break; ++ if (!rpnt) { ++ _dl_error_number = LD_BAD_HANDLE; ++ return NULL; ++ } ++ } else if (handle == RTLD_NEXT) { ++ /* ++ * Try and locate the module we were called from - we ++ * need this so that we know where to start searching ++ * from. We never pass RTLD_NEXT down into the actual ++ * dynamic loader itself, as it doesn't know ++ * how to properly treat it. ++ */ ++ from = (ElfW(Addr)) __builtin_return_address(0); ++ ++ tfrom = NULL; ++ for (rpnt = _dl_symbol_tables; rpnt; rpnt = rpnt->next) { ++ tpnt = rpnt->dyn; ++ if (tpnt->loadaddr < from ++ && (tfrom == NULL || tfrom->loadaddr < tpnt->loadaddr)) { ++ tfrom = tpnt; ++ handle = rpnt->next; ++ } ++ } ++ } ++ ++ ret = _dl_find_hash((char*)name, handle, NULL, copyrel); ++ ++ /* ++ * Nothing found. ++ */ ++ if (!ret) ++ _dl_error_number = LD_NO_SYMBOL; ++ return ret; ++} ++ ++int _dlclose(void *vhandle) ++{ ++ return do_dlclose(vhandle, 1); ++} ++ ++static int do_dlclose(void *vhandle, int need_fini) ++{ ++ struct dyn_elf *rpnt, *rpnt1; ++ struct dyn_elf *spnt, *spnt1; ++ ElfW(Phdr) *ppnt; ++ struct elf_resolve *tpnt; ++ int (*dl_elf_fini) (void); ++ void (*dl_brk) (void); ++ struct dyn_elf *handle; ++ unsigned int end; ++ int i = 0; ++ ++ handle = (struct dyn_elf *) vhandle; ++ rpnt1 = NULL; ++ for (rpnt = _dl_handles; rpnt; rpnt = rpnt->next_handle) { ++ if (rpnt == handle) { ++ break; ++ } ++ rpnt1 = rpnt; ++ } ++ ++ if (!rpnt) { ++ _dl_error_number = LD_BAD_HANDLE; ++ return 1; ++ } ++ ++ /* OK, this is a valid handle - now close out the file. ++ * We check if we need to call fini () on the handle. */ ++ spnt = need_fini ? handle : handle->next; ++ for (; spnt; spnt = spnt1) { ++ spnt1 = spnt->next; ++ ++ /* We appended the module list to the end - when we get back here, ++ quit. The access counts were not adjusted to account for being here. */ ++ if (spnt == _dl_symbol_tables) ++ break; ++ if (spnt->dyn->usage_count == 1 ++ && spnt->dyn->libtype == loaded_file) { ++ tpnt = spnt->dyn; ++ /* Apparently crt1 for the application is responsible for handling this. ++ * We only need to run the init/fini for shared libraries ++ */ ++ ++ if (tpnt->dynamic_info[DT_FINI]) { ++ dl_elf_fini = (int (*)(void)) (tpnt->loadaddr + ++ tpnt->dynamic_info[DT_FINI]); ++ (*dl_elf_fini) (); ++ } ++ } ++ } ++ if (rpnt1) ++ rpnt1->next_handle = rpnt->next_handle; ++ else ++ _dl_handles = rpnt->next_handle; ++ ++ /* OK, this is a valid handle - now close out the file */ ++ for (rpnt = handle; rpnt; rpnt = rpnt1) { ++ rpnt1 = rpnt->next; ++ ++ /* We appended the module list to the end - when we get back here, ++ quit. The access counts were not adjusted to account for being here. */ ++ if (rpnt == _dl_symbol_tables) ++ break; ++ ++ rpnt->dyn->usage_count--; ++ if (rpnt->dyn->usage_count == 0 ++ && rpnt->dyn->libtype == loaded_file) { ++ tpnt = rpnt->dyn; ++ /* Apparently crt1 for the application is responsible for handling this. ++ * We only need to run the init/fini for shared libraries ++ */ ++#if 0 ++ ++ /* We have to do this above, before we start closing objects. ++ * Otherwise when the needed symbols for _fini handling are ++ * resolved a coredump would occur. Rob Ryan (robr@cmu.edu)*/ ++ if (tpnt->dynamic_info[DT_FINI]) { ++ dl_elf_fini = (int (*)(void)) (tpnt->loadaddr + tpnt->dynamic_info[DT_FINI]); ++ (*dl_elf_fini) (); ++ } ++#endif ++ end = 0; ++ for (i = 0, ppnt = rpnt->dyn->ppnt; ++ i < rpnt->dyn->n_phent; ppnt++, i++) { ++ if (ppnt->p_type != PT_LOAD) ++ continue; ++ if (end < ppnt->p_vaddr + ppnt->p_memsz) ++ end = ppnt->p_vaddr + ppnt->p_memsz; ++ } ++ _dl_munmap((void*)rpnt->dyn->loadaddr, end); ++ /* Next, remove rpnt->dyn from the loaded_module list */ ++ if (_dl_loaded_modules == rpnt->dyn) { ++ _dl_loaded_modules = rpnt->dyn->next; ++ if (_dl_loaded_modules) ++ _dl_loaded_modules->prev = 0; ++ } else ++ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) ++ if (tpnt->next == rpnt->dyn) { ++ tpnt->next = tpnt->next->next; ++ if (tpnt->next) ++ tpnt->next->prev = tpnt; ++ break; ++ } ++ free(rpnt->dyn->libname); ++ free(rpnt->dyn); ++ } ++ free(rpnt); ++ } ++ ++ ++ if (_dl_debug_addr) { ++ dl_brk = (void (*)(void)) _dl_debug_addr->r_brk; ++ if (dl_brk != NULL) { ++ _dl_debug_addr->r_state = RT_DELETE; ++ (*dl_brk) (); ++ ++ _dl_debug_addr->r_state = RT_CONSISTENT; ++ (*dl_brk) (); ++ } ++ } ++ ++ return 0; ++} ++ ++const char *_dlerror(void) ++{ ++ const char *retval; ++ ++ if (!_dl_error_number) ++ return NULL; ++ retval = dl_error_names[_dl_error_number]; ++ _dl_error_number = 0; ++ return retval; ++} ++ ++/* ++ * Dump information to stderrr about the current loaded modules ++ */ ++static char *type[] = { "Lib", "Exe", "Int", "Mod" }; ++ ++void _dlinfo(void) ++{ ++ struct elf_resolve *tpnt; ++ struct dyn_elf *rpnt, *hpnt; ++ ++ _dl_dprintf(2, "List of loaded modules\n"); ++ /* First start with a complete list of all of the loaded files. */ ++ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { ++ _dl_dprintf(2, "\t%x %x %x %s %d %s\n", ++ (unsigned) tpnt->loadaddr, (unsigned) tpnt, ++ (unsigned) tpnt->symbol_scope, ++ type[tpnt->libtype], ++ tpnt->usage_count, tpnt->libname); ++ } ++ ++ /* Next dump the module list for the application itself */ ++ _dl_dprintf(2, "\nModules for application (%x):\n", ++ (unsigned) _dl_symbol_tables); ++ for (rpnt = _dl_symbol_tables; rpnt; rpnt = rpnt->next) ++ _dl_dprintf(2, "\t%x %s\n", (unsigned) rpnt->dyn, rpnt->dyn->libname); ++ ++ for (hpnt = _dl_handles; hpnt; hpnt = hpnt->next_handle) { ++ _dl_dprintf(2, "Modules for handle %x\n", (unsigned) hpnt); ++ for (rpnt = hpnt; rpnt; rpnt = rpnt->next) ++ _dl_dprintf(2, "\t%x %s\n", (unsigned) rpnt->dyn, ++ rpnt->dyn->libname); ++ } ++} ++ ++int _dladdr(void *__address, Dl_info * __dlip) ++{ ++ struct elf_resolve *pelf; ++ struct elf_resolve *rpnt; ++ ++ _dl_map_cache(); ++ ++ /* ++ * Try and locate the module address is in ++ */ ++ pelf = NULL; ++ ++#if 0 ++ _dl_dprintf(2, "dladdr( %x, %x )\n", __address, __dlip); ++#endif ++ ++ for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next) { ++ struct elf_resolve *tpnt; ++ ++ tpnt = rpnt; ++#if 0 ++ _dl_dprintf(2, "Module \"%s\" at %x\n", ++ tpnt->libname, tpnt->loadaddr); ++#endif ++ if (tpnt->loadaddr < (ElfW(Addr)) __address ++ && (pelf == NULL || pelf->loadaddr < tpnt->loadaddr)) { ++ pelf = tpnt; ++ } ++ } ++ ++ if (!pelf) { ++ return 0; ++ } ++ ++ /* ++ * Try and locate the symbol of address ++ */ ++ ++ { ++ char *strtab; ++ Elf32_Sym *symtab; ++ int hn, si; ++ int sf; ++ int sn = 0; ++ ElfW(Addr) sa; ++ ++ sa = 0; ++ symtab = (Elf32_Sym *) (pelf->dynamic_info[DT_SYMTAB] + pelf->loadaddr); ++ strtab = (char *) (pelf->dynamic_info[DT_STRTAB] + pelf->loadaddr); ++ ++ sf = 0; ++ for (hn = 0; hn < pelf->nbucket; hn++) { ++ for (si = pelf->elf_buckets[hn]; si; si = pelf->chains[si]) { ++ ElfW(Addr) symbol_addr; ++ ++ symbol_addr = pelf->loadaddr + symtab[si].st_value; ++ if (symbol_addr <= (ElfW(Addr))__address && (!sf || sa < symbol_addr)) { ++ sa = symbol_addr; ++ sn = si; ++ sf = 1; ++ } ++#if 0 ++ _dl_dprintf(2, "Symbol \"%s\" at %x\n", ++ strtab + symtab[si].st_name, symbol_addr); ++#endif ++ } ++ } ++ ++ if (sf) { ++ __dlip->dli_fname = pelf->libname; ++ __dlip->dli_fbase = (void *)pelf->loadaddr; ++ __dlip->dli_sname = strtab + symtab[sn].st_name; ++ __dlip->dli_saddr = (void *)sa; ++ } ++ return 1; ++ } ++} +diff -urN uClibc/ldso-0.9.24/man/Makefile uClibc.ldso.24/ldso-0.9.24/man/Makefile +--- uClibc/ldso-0.9.24/man/Makefile 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/man/Makefile 2003-10-18 05:18:37.000000000 -0500 +@@ -0,0 +1,33 @@ ++# Makefile for uClibc ++# ++# Copyright (C) 2000,2001 Erik Andersen ++# ++# This program is free software; you can redistribute it and/or modify it under ++# the terms of the GNU Library 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 Library General Public License for more ++# details. ++# ++# You should have received a copy of the GNU Library 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 ++# ++# Derived in part from the Linux-8086 C library, the GNU C Library, and several ++# other sundry sources. Files within this library are copyright by their ++# respective copyright holders. ++ ++include ../Config.mk ++ ++ALL = #ld.so.info ++ ++all: $(ALL) ++ ++ld.so.info: ld.so.texi ++ makeinfo $< ++ ++clean: ++ $(RM) $(ALL) *~ +diff -urN uClibc/ldso-0.9.24/man/dlopen.3 uClibc.ldso.24/ldso-0.9.24/man/dlopen.3 +--- uClibc/ldso-0.9.24/man/dlopen.3 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/man/dlopen.3 2001-04-23 12:43:54.000000000 -0500 +@@ -0,0 +1,218 @@ ++.\" -*- nroff -*- ++.\" Copyright 1995 Yggdrasil Computing, Incorporated. ++.\" written by Adam J. Richter (adam@yggdrasil.com), ++.\" with typesetting help from Daniel Quinlan (quinlan@yggdrasil.com). ++.\" ++.\" This is free documentation; 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. ++.\" ++.\" The GNU General Public License's references to "object code" ++.\" and "executables" are to be interpreted as the output of any ++.\" document formatting or typesetting system, including ++.\" intermediate and printed output. ++.\" ++.\" This manual 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 manual; if not, write to the Free ++.\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, ++.\" USA. ++.\" ++.TH DLOPEN 3 "16 May 1995" "Linux" "Linux Programmer's Manual" ++.SH NAME ++dlclose, dlerror, dlopen, dlsym \- Programming interface to dynamic linking loader. ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "void *dlopen (const char *" "filename" ", int " flag "); ++.br ++.BI "const char *dlerror(void);" ++.br ++.BI "void *dlsym(void *"handle ", char *"symbol ");" ++.br ++.BI "int dladdr(void *"address ", Dl_info *"dlip ");" ++.br ++.BI "int dlclose (void *"handle "); ++.sp ++Special symbols: ++.BR "_init" ", " "_fini" ". " ++.SH DESCRIPTION ++.B dlopen ++loads a dynamic library from the file named by the null terminated ++string ++.I filename ++and returns an opaque "handle" for the dynamic library. ++If ++.I filename ++is not an absolute path (i.e., it does not begin with a "/"), then the ++file is searched for in the following locations: ++.RS ++.PP ++A colon-separated list of directories in the user's ++\fBLD_LIBRARY\fP path environment variable. ++.PP ++The list of libraries specified in \fI/etc/ld.so.cache\fP. ++.PP ++\fI/usr/lib\fP, followed by \fI/lib\fP. ++.RE ++.PP ++If ++.I filename ++is a NULL pointer, then the returned handle is for the main program. ++.PP ++External references in the library are resolved using the libraries ++in that library's dependency list and any other libraries previously ++opened with the ++.B RTLD_GLOBAL ++flag. ++If the executable was linked ++with the flag "-rdynamic", then the global symbols in the executable ++will also be used to resolve references in a dynamically loaded ++library. ++.PP ++.I flag ++must be either ++.BR RTLD_LAZY , ++meaning resolve undefined symbols as code from the dynamic library is ++executed, or ++.BR RTLD_NOW , ++meaning resolve all undefined symbols before ++.B dlopen ++returns, and fail if this cannot be done. ++Optionally, ++.B RTLD_GLOBAL ++may be or'ed with ++.IR flag, ++in which case the external symbols defined in the library will be ++made available to subsequently loaded libraries. ++.PP ++If the library exports a routine named ++.BR _init , ++then that code is executed before dlopen returns. ++If the same library is loaded twice with ++.BR dlopen() , ++the same file handle is returned. The dl library maintains link ++counts for dynamic file handles, so a dynamic library is not ++deallocated until ++.B dlclose ++has been called on it as many times as ++.B dlopen ++has succeeded on it. ++.PP ++If ++.B dlopen ++fails for any reason, it returns NULL. ++A human readable string describing the most recent error that occurred ++from any of the dl routines (dlopen, dlsym or dlclose) can be ++extracted with ++.BR dlerror() . ++.B dlerror ++returns NULL if no errors have occurred since initialization or since ++it was last called. (Calling ++.B dlerror() ++twice consecutively, will always result in the second call returning ++NULL.) ++ ++.B dlsym ++takes a "handle" of a dynamic library returned by dlopen and the null ++terminated symbol name, returning the address where that symbol is ++loaded. If the symbol is not found, ++.B dlsym ++returns NULL; however, the correct way to test for an error from ++.B dlsym ++is to save the result of ++.B dlerror ++into a variable, and then check if saved value is not NULL. ++This is because the value of the symbol could actually be NULL. ++It is also necessary to save the results of ++.B dlerror ++into a variable because if ++.B dlerror ++is called again, it will return NULL. ++.PP ++.B dladdr ++returns information about the shared library containing the memory ++location specified by ++.IR address . ++.B dladdr ++returns zero on success and non-zero on error. ++.PP ++.B dlclose ++decrements the reference count on the dynamic library handle ++.IR handle . ++If the reference count drops to zero and no other loaded libraries use ++symbols in it, then the dynamic library is unloaded. If the dynamic ++library exports a routine named ++.BR _fini , ++then that routine is called just before the library is unloaded. ++.SH EXAMPLES ++.B Load the math library, and print the cosine of 2.0: ++.RS ++.nf ++.if t .ft CW ++#include ++ ++int main(int argc, char **argv) { ++ void *handle = dlopen ("/lib/libm.so", RTLD_LAZY); ++ double (*cosine)(double) = dlsym(handle, "cos"); ++ printf ("%f\\n", (*cosine)(2.0)); ++ dlclose(handle); ++} ++.if t .ft P ++.fi ++.PP ++If this program were in a file named "foo.c", you would build the program ++with the following command: ++.RS ++.LP ++gcc -rdynamic -o foo foo.c -ldl ++.RE ++.RE ++.LP ++.B Do the same thing, but check for errors at every step: ++.RS ++.nf ++.if t .ft CW ++#include ++#include ++ ++int main(int argc, char **argv) { ++ void *handle; ++ double (*cosine)(double); ++ char *error; ++ ++ handle = dlopen ("/lib/libm.so", RTLD_LAZY); ++ if (!handle) { ++ fputs (dlerror(), stderr); ++ exit(1); ++ } ++ ++ cosine = dlsym(handle, "cos"); ++ if ((error = dlerror()) != NULL) { ++ fputs(error, stderr); ++ exit(1); ++ } ++ ++ printf ("%f\\n", (*cosine)(2.0)); ++ dlclose(handle); ++} ++.if t .ft P ++.fi ++.RE ++.SH ACKNOWLEDGEMENTS ++The dlopen interface standard comes from Solaris. ++The Linux dlopen implementation was primarily written by ++Eric Youngdale with help from Mitch D'Souza, David Engel, ++Hongjiu Lu, Andreas Schwab and others. ++The manual page was written by Adam Richter. ++.SH SEE ALSO ++.BR ld(1) , ++.BR ld.so(8) , ++.BR ldconfig(8) , ++.BR ldd(1) , ++.BR ld.so.info . +diff -urN uClibc/ldso-0.9.24/man/ld.so.8 uClibc.ldso.24/ldso-0.9.24/man/ld.so.8 +--- uClibc/ldso-0.9.24/man/ld.so.8 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/man/ld.so.8 2001-04-23 12:43:54.000000000 -0500 +@@ -0,0 +1,113 @@ ++.TH ld.so 8 "14 March 1998" ++.SH NAME ++ld.so/ld-linux.so \- dynamic linker/loader ++.SH DESCRIPTION ++.B ld.so ++loads the shared libraries needed by a program, prepares the program ++to run, and then runs it. ++Unless explicitly specified via the ++.B \-static ++option to ++.B ld ++during compilation, all Linux programs are incomplete and require ++further linking at run time. ++.PP ++The necessary shared libraries needed by the program are searched for ++in the following order ++.IP o ++Using the environment variable ++.B LD_LIBRARY_PATH ++.RB ( LD_AOUT_LIBRARY_PATH ++for a.out programs). ++Except if the executable is a setuid/setgid binary, in which case it ++is ignored. ++.IP o ++From the cache file ++.BR /etc/ld.so.cache ++which contains a compiled list of candidate libraries previously found ++in the augmented library path. ++.IP o ++In the default path ++.BR /usr/lib , ++and then ++.BR /lib . ++.SH ENVIRONMENT ++.TP ++.B LD_LIBRARY_PATH ++A colon-separated list of directories in which to search for ++ELF libraries at execution-time. ++Similar to the ++.B PATH ++environment variable. ++.TP ++.B LD_PRELOAD ++A whitespace-separated list of additional, user-specified, ELF shared ++libraries to be loaded before all others. ++This can be used to selectively override functions in other shared libraries. ++For setuid/setgid ELF binaries, only libraries in the standard search ++directories that are also setgid will be loaded. ++.TP ++.B LD_TRACE_LOADED_OBJECTS ++If present, causes the program to list its dynamic library dependencies, ++as if run by ldd, instead of running normally. ++.TP ++.B LD_BIND_NOW ++If present, causes the dynamic linker to resolve all symbols at program ++startup instead of when they are first referenced. ++.TP ++.B LD_AOUT_LIBRARY_PATH ++A colon-separated list of directories in which to search for ++a.out libraries at execution-time. ++Similar to the ++.B PATH ++environment variable. ++.TP ++.B LD_AOUT_PRELOAD ++The name of an additional, user-specified, a.out shared library to be loaded ++after all others. ++This can be used to selectively override functions in other shared libraries. ++.TP ++.B LD_NOWARN ++Suppress warnings about a.out libraries with incompatible minor ++version numbers. ++.TP ++.B LD_KEEPDIR ++Don't ignore the directory in the names of a.out libraries to be loaded. ++Use of this option is strongly discouraged. ++.SH FILES ++.PD 0 ++.TP 20 ++.B /lib/ld.so ++a.out dynamic linker/loader ++.TP 20 ++.B /lib/ld-linux.so.* ++ELF dynamic linker/loader ++.TP ++.B /etc/ld.so.cache ++File containing a compiled list of directories in which to search for ++libraries and an ordered list of candidate libraries. ++.TP ++.B /etc/ld.so.preload ++File containing a whitespace separated list of ELF shared libraries to ++be loaded before the program. ++libraries and an ordered list of candidate libraries. ++.TP ++.B lib*.so* ++shared libraries ++.PD ++.SH SEE ALSO ++.BR ldd (1), ++.BR ldconfig (8). ++.SH BUGS ++.LP ++Currently ++.B ld.so ++has no means of unloading and searching for compatible or newer version of ++libraries. ++.PP ++.B ld.so ++functionality is only available for executables compiled using libc version ++4.4.3 or greater. ++.SH AUTHORS ++David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus ++Torvalds, Lars Wirzenius and Mitch D'Souza (not necessarily in that order). +diff -urN uClibc/ldso-0.9.24/man/ld.so.texi uClibc.ldso.24/ldso-0.9.24/man/ld.so.texi +--- uClibc/ldso-0.9.24/man/ld.so.texi 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/man/ld.so.texi 2001-04-23 12:43:54.000000000 -0500 +@@ -0,0 +1,411 @@ ++\input texinfo @c -*-texinfo-*- ++@c %**start of header ++@setfilename ld.so.info ++@settitle ld.so : Dynamic-Link Library support ++@c %**end of header ++ ++@ifinfo ++This file documents the dynamic-link support libraries and utilities for the ++Linux OS, version 1.8.1. ++ ++Copyright 1996 Michael Deutschmann ++ ++This document is subject to the GNU General Public License as published by ++the Free Software foundation, version 2 or later (your choice). ++ ++Note: The software described in this document is under a different copyright ++and license. ++ ++@end ifinfo ++ ++@titlepage ++@title ld.so ++@subtitle Dynamic Link library support for the Linux OS. ++@author David Engel ++@author Eric Youngdale ++@author Peter Macdonald ++@author Hongjiu Lu ++@author Mitch D'Souza ++@author Michael Deutschmann (this documentation) ++ ++@page ++Copyright @copyright{} 1996 Michael Deutschmann ++ ++This document is subject to the GNU General Public License as published by ++the Free Software foundation, version 2 or later (your choice). ++ ++Note: The software described in this document is under a different copyright ++and license. ++@end titlepage ++ ++@ifinfo ++@node Top ++@top ++ ++The @code{ld.so} module provides dynamic linked library support in Linux. ++This file documents @code{ld.so} and its companion software. ++ ++@menu ++* intro:: Introduction ++ ++* ld.so:: The dynamic linker core program ++* ldd:: A utility to print out dependencies ++* ldconfig:: A utility to maintain the cache and symlinks ++* libdl:: Manual dynamic linking library ++@end menu ++ ++@end ifinfo ++ ++@node intro ++@unnumbered Introduction ++ ++The @code{ld.so} suite contains special files and utilities needed for linux ++to handle @dfn{dynamic libraries}. ++ ++Ordinary static libraries (@file{lib*.a} files) are included into executables ++that use their functions. A file that only uses static libraries needs less ++intelligence to load, but takes up more space. If many executables use the ++same library, there can be much wastage of storage space, since multiple ++copies of the library functions are scattered across the executables. ++However, static libraries are easier to make. ++ ++Dynamic libraries (@file{lib*.so*} files) are not copied into executables --- ++the executable is written in such a way that it will automatically load the ++libraries. In linux, the executable will first load the special library ++@code{ld.so} or @code{ld-linux.so}, which contains the intelligence ++to load further dynamic libraries. Since multiple files end up getting ++executable data from the same file, dynamic libraries are also known as ++shared libraries. ++ ++Linux executables come in two flavors, @sc{elf} and a.out. ++ ++a.out is the original executable format used by Linux. It has somewhat less ++overhead than @sc{elf}. However creating shared libraries for a.out is ++@emph{very} involved, and each a.out shared library must be explicitly ++registered. ++ ++@sc{elf} is a more recent format, which supports a much simpler method of ++creating libraries. @sc{elf} libraries may also be linked manually ++(@pxref{libdl}). ++ ++Since many library authors prefer @sc{elf} and no longer release shared a.out ++libraries, a.out is moribund on Linux. This version of the @code{ld.so} can ++be compiled to support only @sc{elf}, or to support both formats. (The last ++release of ld.so to support a.out alone was 1.8.0.) ++ ++@node ld.so ++@chapter @code{ld.so}: Dynamic linker core ++ ++@code{ld.so} works behind the scenes to handle dynamic libraries in Linux. ++Users will almost never have to deal with it directly, but in special cases ++one can send instructions to it through environment variables. Also, if ++something is wrong with your libraries (usually an incorrect version) ld.so ++will give error messages. ++ ++Actually @code{ld.so} is the a.out linker. The new @sc{elf} executables are ++handled by a related program @code{ld-linux.so}. ++ ++@menu ++* files:: Configuration files used by the suite ++* environment:: Environment settings that tweak @code{ld.so} ++* errors:: Complaints @code{ld.so} might make ++@end menu ++ ++@node files ++@section Configuration Files ++ ++@table @file ++@item /etc/ld.so.cache ++A file created by @code{ldconfig} and used to speed linking. It's structure ++is private to the suite. ++ ++@item /etc/ld.so.conf ++A simple list of directories to scan for libraries, in addition to ++@file{/usr/lib} and @file{/lib}, which are hardwired. It may contain ++comments started with a @samp{#}. ++ ++@item /etc/ld.so.preload ++A list of libraries to preload. This allows preloading libraries for ++setuid/setgid executables securely. It may contain comments. ++@end table ++ ++@node environment ++@section Environment Variables ++ ++@table @code ++@item LD_AOUT_LIBRARY_PATH ++@itemx LD_LIBRARY_PATH ++These variables supply a library path for finding dynamic libraries, in the ++standard colon seperated format. These variables are ignored when executing ++setuid/setgid programs, because otherwise they would be a security hazard. ++@code{ld.so} will use @code{LD_AOUT_LIBRARY_PATH} and @code{ld-linux.so} will ++use @code{LD_LIBRARY_PATH}. ++ ++@item LD_AOUT_PRELOAD ++@itemx LD_PRELOAD ++These variables allow an extra library not specified in the executable to be ++loaded. Generally this is only useful if you want to override a function. ++These are also ignored when running setuid/setgid executables. @code{ld.so} ++will use @code{LD_AOUT_PRELOAD} and @code{ld-linux.so} will use ++@code{LD_PRELOAD}. ++ ++@item LD_NOWARN ++If non-empty, errors about incompatible minor revisions are suppressed. ++ ++@item LD_KEEPDIR ++If non-empty, allow executables to specify absolute library names. This ++option is deprecated. ++@c FIXME: ++@c The following are things I noticed in the ld-linux.so source. ++@c I don't really understand 'em. Could someone help me? ++@c ++@c @item LD_BIND_NOW ++@c This option is used by the @code{ld-linux.so} only. I don't know ++@c what it does. (I suspect, looking at the code, that it specifies ++@c "RTLD_NOW" rather than "RTLD_LAZY" mode for the shared libraries.) ++@c ++@c @item LD_TRACE_LOADED_OBJECTS ++@c @itemx LD_WARN ++@c These seem to have something to do with the communication between the ++@c @code{ld-linux.so} and @code{ldd}. I don't know more. ++@end table ++ ++@node errors ++@section Errors ++ ++@table @samp ++@item Can't find library @var{library} ++The executable required a dynamically linked library that ld.so cannot find. ++Your symbolic links may be not set right, or you may have not installed a ++library needed by the program. ++ ++@item Can't load library @var{library} ++The library is corrupt. ++ ++@item Incompatible library @var{library} ++@itemx Require major version @var{x} and found @var{y} ++Your version of the library is incompatible with the executable. Recompiling ++the executable, or upgrading the library will fix the problem. ++ ++@item using incompatible library @var{library} ++@itemx Desire minor version >= @var{x} and found @var{y}. ++Your version of the library is older than that expected by the executable, ++but not so old that the library interface has radically changed, so the ++linker will attempt to run anyway. There is a chance that it will work, but ++you should upgrade the library or recompile the software. The environment ++variable @code{LD_NOWARN} can be used to supress this message. ++ ++@item too many directories in library path ++The linker only supports up to 32 library directories. You have too many. ++ ++@item dynamic linker error in @var{blah} ++The linker is having trouble handling a binary - it is probably corrupt. ++ ++@item can't map cache file @var{cache-file} ++@itemx cache file @var{cache-file} @var{blah} ++The linker cache file (generally @file{/etc/ld.so.cache}) is corrupt or ++non-existent. These errors can be ignored, and can be prevented by ++regenerating the cache file with @code{ldconfig}. ++@end table ++ ++@node ldd ++@chapter @code{ldd}: Dependency scanner ++ ++@code{ldd} is a utility that prints out the dynamic libraries that an ++executable is linked to. ++ ++Actually @code{ldd} works by signalling ld.so to print the dependencies. ++For a.out executables this is done by starting the executable with ++@code{argc} equal to 0. The linker detects this and prints the dependencies. ++(This can cause problems with @emph{very} old binaries, which would run as ++normal only with an inappropriate @code{argc}.) ++ ++For @sc{elf} executables, special environment variables are used to tell the ++linker to print the dependencies. ++ ++@code{ldd} has a few options: ++ ++@table @samp ++@item -v ++Print the version number of @code{ldd} itself ++ ++@item -V ++Print the version number of the dynamic linker ++ ++@item -d ++Report missing functions. This is only supported for @sc{elf} executables. ++ ++@item -r ++Report missing objects. This is also only available for @sc{elf} ++executables. ++@end table ++ ++@node ldconfig ++@chapter @code{ldconfig}: Setup program ++ ++This utility is used by the system administrator to automatically set up ++symbolic links needed by the libraries, and also to set up the cache file. ++ ++@code{ldconfig} is run after new dynamic libraries are installed, and if the ++cache file or links are damaged. It is also run when upgrading the ++@code{ld.so} suite itself. ++ ++The @file{/lib} and @file{/usr/lib} directories, and any listed in the file ++@file{/etc/ld.so.conf} are scanned by default unless @samp{-n} is used. ++Additional directories may be specified on the command line. ++ ++It has the following options: ++ ++@table @samp ++@item -D ++Enter debug mode. Implies @samp{-N} and @samp{-X}. ++ ++@item -v ++Verbose. Print out links created and directories scanned. ++ ++@item -n ++Check directories specified on the commandline @emph{only}. ++ ++@item -N ++Do not regenerate the cache. ++ ++@item -X ++Do not rebuild symbolic links. ++ ++@item -l ++Set up symbolic links for only libraries presented on the command line. ++ ++@item -p ++Print out the library pathnames in the cache file (@file{/etc/ld.so.cache}) ++@end table ++ ++@node libdl ++@chapter User dynamic linking library ++ ++The @code{ld.so} package includes a small library of functions ++(@code{libdl}) to allow manual dynamic linking. Normally programs are linked ++so that dynamic functions and objects are automagically available. These ++functions allow one to manually load and access a symbol from a library. ++They are only available for @sc{elf} executables. ++ ++@menu ++* using libdl:: General points ++* functions:: How to use the functions ++* example:: A sample program ++@end menu ++ ++@node using libdl ++@section Overview ++ ++To access this library, add the flag @samp{-ldl} to your compile command when ++linking the executable. You also must include the header file ++@code{dlfcn.h}. You may also need the flag @samp{-rdynamic}, which enables ++resolving references in the loaded libraries against your executable. ++ ++Generally, you will first use @code{dlopen} to open a library. Then you use ++@code{dlsym} one or more times to access symbols. Finally you use ++@code{dlclose} to close the library. ++ ++These facilities are most useful for language interpreters that provide ++access to external libraries. Without @code{libdl}, it would be neccessary ++to link the interpreter executable with any and all external libraries ++needed by the programs it runs. With @code{libdl}, the interpreter only ++needs to be linked with the libraries it uses itself, and can dynamically ++load in additional ones if programs need it. ++ ++@node functions ++@section Functions ++ ++@deftypefun void *dlopen ( const char @var{filename}, int @var{flags} ) ++ ++This function opens the dynamic library specified by @var{filename} ++and returns an abstract handle, which can be used in subsequent calls to ++@code{dlsym}. The function will respect the @code{LD_ELF_LIBRARY_PATH} and ++@code{LD_LIBRARY_PATH} environment variables. ++ ++@end deftypefun ++ ++The following flags can be used with @code{dlopen}: ++ ++@deftypevr Macro int RTLD_LAZY ++Resolve symbols in the library as they are needed. ++@end deftypevr ++ ++@deftypevr Macro int RTLD_NOW ++Resolve all symbols in the library before returning, and fail if not all can ++be resolved. This is mutually exclusive with @code{RTLD_LAZY}. ++@end deftypevr ++ ++@deftypevr Macro int RTLD_GLOBAL ++Make symbols in this library available for resolving symbols in other ++libraries loaded with @code{dlopen}. ++@end deftypevr ++ ++@deftypefun int dlclose ( void *@var{handle} ) ++ ++This function releases a library handle. ++ ++Note that if a library opened twice, the handle will be the same. However, ++a reference count is used, so you should still close the library as many ++times as you open it. ++ ++@end deftypefun ++ ++@deftypefun void *dlsym (void *@var{handle},char *@var{symbol-name}) ++ ++This function looks up the name @var{symbol-name} in the library and returns ++it in the void pointer. ++ ++If there is an error, a null pointer will be returned. However, it is ++possible for a valid name in the library to have a null value, so ++@code{dlerror} should be used to check if there was an error. ++ ++@end deftypefun ++ ++@deftypefun {libdl function} {const char} *dlerror( void ) ++ ++This function is used to read the error state. It returns a human-readable ++string describing the last error, or null, meaning no error. ++ ++The function resets the error value each time it is called, so the result ++should be copied into a variable. If the function is called more than once ++after an error, the second and subsequent calls will return null. ++ ++@end deftypefun ++ ++@node example ++@section Example program ++ ++Here is an example program that prints the cosine of two by manually linking ++to the math library: ++ ++@example ++@c The following was snarfed verbatim from the dlopen.3 man file. ++#include ++#include ++ ++int main(int argc, char **argv) @{ ++ void *handle; ++ double (*cosine)(double); ++ char *error; ++ ++ handle = dlopen ("/lib/libm.so", RTLD_LAZY); ++ if (!handle) @{ ++ fputs (dlerror(), stderr); ++ exit(1); ++ @} ++ ++ cosine = dlsym(handle, "cos"); ++ if ((error = dlerror()) != NULL) @{ ++ fputs(error, stderr); ++ exit(1); ++ @} ++ ++ printf ("%f\\n", (*cosine)(2.0)); ++ dlclose(handle); ++@} ++@end example ++ ++@contents ++ ++@bye +diff -urN uClibc/ldso-0.9.24/man/ldconfig.8 uClibc.ldso.24/ldso-0.9.24/man/ldconfig.8 +--- uClibc/ldso-0.9.24/man/ldconfig.8 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/man/ldconfig.8 2001-04-23 12:43:54.000000000 -0500 +@@ -0,0 +1,189 @@ ++.TH ldconfig 8 "14 March 1998" ++.SH NAME ++ldconfig \- determine run-time link bindings ++.SH SYNOPSIS ++ldconfig ++.RB [ \-DvqnNX ] ++.RB [ \-f\ conf ] ++.RB [ \-C\ cache ] ++.RB [ \-r\ root ] ++.IR directory \ ... ++.PD 0 ++.PP ++.PD ++ldconfig ++.B \-l ++.RB [ \-Dvq ] ++.IR library \ ... ++.PD 0 ++.PP ++.PD ++ldconfig ++.B \-p ++.SH DESCRIPTION ++.B ldconfig ++creates the necessary links and cache (for use by the run-time linker, ++.IR ld.so ) ++to the most recent shared libraries found in the directories specified ++on the command line, in the file ++.IR /etc/ld.so.conf , ++and in the trusted directories ++.RI ( /usr/lib ++and ++.IR /lib ). ++.B ldconfig ++checks the header and file names of the libraries it encounters when ++determining which versions should have their links updated. ++.B ldconfig ++ignores symbolic links when scanning for libraries. ++.PP ++.B ldconfig ++will attempt to deduce the type of ELF libs (ie. libc5 or libc6/glibc) ++based on what C libs if any the library was linked against, therefore when ++making dynamic libraries, it is wise to explicitly link against libc (use -lc). ++.PP ++Some existing libs do not contain enough information to allow the deduction of ++their type, therefore the ++.IR /etc/ld.so.conf ++file format allows the specification of an expected type. This is ++.B only ++used for those ELF libs which we can not work out. The format ++is like this "dirname=TYPE", where type can be libc4, libc5 or libc6. ++(This syntax also works on the command line). Spaces are ++.B not ++allowed. Also see the ++.B -p ++option. ++.PP ++Directory names containing an ++.B = are no longer legal ++unless they also have an expected type specifier. ++.PP ++.B ldconfig ++should normally be run by the super-user as it may require write ++permission on some root owned directories and files. ++It is normally run automatically at bootup, from /etc/rc, or manually ++whenever new DLL's are installed. ++.SH OPTIONS ++.TP ++.B \-D ++Debug mode. ++Implies ++.B \-N ++and ++.BR \-X . ++.TP ++.B \-v ++Verbose mode. ++Print current version number, the name of each directory as it ++is scanned and any links that are created. ++Overrides quiet mode. ++.TP ++.B \-q ++Quiet mode. ++Don't print warnings. ++.TP ++.B \-n ++Only process directories specified on the command line. ++Don't process the trusted directories ++.RI ( /usr/lib ++and ++.IR /lib ) ++nor those specified in ++.IR /etc/ld.so.conf . ++Implies ++.BR \-N . ++.TP ++.B \-N ++Don't rebuild the cache. ++Unless ++.B \-X ++is also specified, links are still updated. ++.TP ++.B \-X ++Don't update links. ++Unless ++.B \-N ++is also specified, the cache is still rebuilt. ++.TP ++.B \-f conf ++Use ++.B conf ++instead of ++.IR /etc/ld.so.conf . ++.TP ++.B \-C cache ++Use ++.B cache ++instead of ++.IR /etc/ld.so.cache . ++.TP ++.B \-r root ++Change to and use ++.B root ++as the root directory. ++.TP ++.B \-l ++Library mode. ++Manually link individual libraries. ++Intended for use by experts only. ++.TP ++.B \-p ++Print the lists of directories and candidate libraries stored in ++the current cache. ++.SH EXAMPLES ++In the bootup file ++.I /etc/rc ++having the line ++.RS ++ ++/sbin/ldconfig -v ++ ++.RE ++will set up the correct links for the shared binaries and rebuild ++the cache. ++.TP ++On the command line ++.RS ++ ++# /sbin/ldconfig -n /lib ++ ++.RE ++as root after the installation of a new DLL, will properly update the ++shared library symbolic links in /lib. ++ ++.SH FILES ++.PD 0 ++.TP 20 ++.B /lib/ld.so ++execution time linker/loader ++.TP 20 ++.B /etc/ld.so.conf ++File containing a list of colon, space, tab, newline, or comma spearated ++directories in which to search for libraries. ++.TP 20 ++.B /etc/ld.so.cache ++File containing an ordered list of libraries found in the directories ++specified in ++.BR /etc/ld.so.conf . ++.TP ++.B lib*.so.version ++shared libraries ++.PD ++.SH SEE ALSO ++.BR ldd (1), ++.BR ld.so (8). ++.SH BUGS ++.LP ++.BR ldconfig 's ++functionality, in conjunction with ++.BR ld.so , ++is only available for executables compiled using libc version 4.4.3 or greater. ++.PP ++.BR ldconfig , ++being a user process, must be run manually and has no means of dynamically ++determining and relinking shared libraries for use by ++.BR ld.so ++when a new DLL is installed. ++.SH AUTHORS ++David Engel and Mitch D'Souza. +diff -urN uClibc/ldso-0.9.24/man/ldd.1 uClibc.ldso.24/ldso-0.9.24/man/ldd.1 +--- uClibc/ldso-0.9.24/man/ldd.1 1969-12-31 18:00:00.000000000 -0600 ++++ uClibc.ldso.24/ldso-0.9.24/man/ldd.1 2001-04-23 12:43:54.000000000 -0500 +@@ -0,0 +1,59 @@ ++.\" Copyright 1995-2000 David Engel (david@ods.com) ++.\" Copyright 1995 Rickard E. Faith (faith@cs.unc.edu) ++.\" Most of this was copied from the README file. Do not restrict distribution. ++.\" May be distributed under the GNU General Public License ++.TH LDD 1 "14 March 1998" ++.SH NAME ++ldd \- print shared library dependencies ++.SH SYNOPSIS ++.B ldd ++.RB [ \-vVdr ] ++program|library ... ++.SH DESCRIPTION ++.B ldd ++prints the shared libraries required by each program or shared library ++specified on the command line. ++If a shared library name does not contain a '/', ++.B ldd ++attempts to locate the library in the standard locations. ++To run ++.B ldd ++on a shared library in the current directory, a "./" must be prepended ++to its name. ++.SH OPTIONS ++.TP ++.B \-v ++Print the version number of ++.BR ldd . ++.TP ++.B \-V ++Print the version number of the dynamic linker, ++.BR ld.so . ++.TP ++.B \-d ++Perform relocations and report any missing functions (ELF only). ++.TP ++.B \-r ++Perform relocations for both data objects and functions, and ++report any missing objects (ELF only). ++.SH BUGS ++.B ldd ++does not work very well on libc.so.5 itself. ++.PP ++.B ldd ++does not work on a.out shared libraries. ++.PP ++.B ldd ++does not work with some extremely old a.out programs which were ++built before ++.B ldd ++support was added to the compiler releases. ++If you use ++.B ldd ++on one of these programs, the program will attempt to run with argc = 0 and ++the results will be unpredictable. ++.SH AUTHOR ++David Engel. ++.SH SEE ALSO ++.BR ldconfig (8), ++.BR ld.so (8). diff --git a/obsolete-buildroot/sources/uClibc.config b/obsolete-buildroot/sources/uClibc.config new file mode 100644 index 0000000000..985f76d764 --- /dev/null +++ b/obsolete-buildroot/sources/uClibc.config @@ -0,0 +1,144 @@ +# +# Automatically generated make config: don't edit +# +# TARGET_alpha is not set +# TARGET_arm is not set +# TARGET_cris is not set +# TARGET_e1 is not set +# TARGET_frv is not set +# TARGET_h8300 is not set +# TARGET_i386 is not set +# TARGET_i960 is not set +# TARGET_m68k is not set +# TARGET_microblaze is not set +TARGET_mips=y +# TARGET_powerpc is not set +# TARGET_sh is not set +# TARGET_sparc is not set +# TARGET_v850 is not set + +# +# Target Architecture Features and Options +# +HAVE_ELF=y +ARCH_SUPPORTS_LITTLE_ENDIAN=y +TARGET_ARCH="mips" +ARCH_CFLAGS="-mno-split-addresses" +ARCH_SUPPORTS_BIG_ENDIAN=y +# CONFIG_MIPS_ISA_1 is not set +CONFIG_MIPS_ISA_2=y +# CONFIG_MIPS_ISA_3 is not set +# CONFIG_MIPS_ISA_4 is not set +# CONFIG_MIPS_ISA_MIPS32 is not set +# CONFIG_MIPS_ISA_MIPS64 is not set +ARCH_LITTLE_ENDIAN=y +# ARCH_BIG_ENDIAN is not set +# ARCH_HAS_NO_MMU is not set +ARCH_HAS_MMU=y +UCLIBC_HAS_FLOATS=y +HAS_FPU=y +DO_C99_MATH=y +WARNINGS="-Wall" +KERNEL_SOURCE="/usr/src/linux" +HAVE_DOT_CONFIG=y + +# +# General Library Settings +# +# HAVE_NO_PIC is not set +DOPIC=y +# HAVE_NO_SHARED is not set +HAVE_SHARED=y +# ARCH_HAS_NO_LDSO is not set +BUILD_UCLIBC_LDSO=y +# FORCE_SHAREABLE_TEXT_SEGMENTS is not set +# UCLIBC_PIE_SUPPORT is not set +LDSO_LDD_SUPPORT=y +UCLIBC_CTOR_DTOR=y +# UCLIBC_PROPOLICE is not set +# UCLIBC_PROFILING is not set +# HAS_NO_THREADS is not set +UCLIBC_HAS_THREADS=y +PTHREADS_DEBUG_SUPPORT=y +UCLIBC_HAS_LFS=y +# MALLOC is not set +# MALLOC_SIMPLE is not set +MALLOC_STANDARD=y +MALLOC_GLIBC_COMPAT=y +UCLIBC_DYNAMIC_ATEXIT=y +HAS_SHADOW=y +# UNIX98PTY_ONLY is not set +ASSUME_DEVPTS=y +UCLIBC_HAS_TM_EXTENSIONS=y +UCLIBC_HAS_TZ_CACHING=y +UCLIBC_HAS_TZ_FILE=y +UCLIBC_HAS_TZ_FILE_READ_MANY=y +UCLIBC_TZ_FILE_PATH="/etc/TZ" + +# +# Networking Support +# +UCLIBC_HAS_IPV6=y +UCLIBC_HAS_RPC=y +UCLIBC_HAS_FULL_RPC=y + +# +# String and Stdio Support +# +UCLIBC_HAS_CTYPE_TABLES=y +UCLIBC_HAS_CTYPE_SIGNED=y +# UCLIBC_HAS_CTYPE_UNSAFE is not set +UCLIBC_HAS_CTYPE_CHECKED=y +# UCLIBC_HAS_CTYPE_ENFORCED is not set +UCLIBC_HAS_WCHAR=y +# UCLIBC_HAS_LOCALE is not set +UCLIBC_HAS_HEXADECIMAL_FLOATS=y +UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y +UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 +UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y +# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set +# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set +UCLIBC_HAS_STDIO_BUFSIZ_4096=y +# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set +UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set +UCLIBC_HAS_STDIO_GETC_MACRO=y +UCLIBC_HAS_STDIO_PUTC_MACRO=y +UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y +# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set +UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y +UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y +UCLIBC_HAS_PRINTF_M_SPEC=y +UCLIBC_HAS_ERRNO_MESSAGES=y +# UCLIBC_HAS_SYS_ERRLIST is not set +UCLIBC_HAS_SIGNUM_MESSAGES=y +# UCLIBC_HAS_SYS_SIGLIST is not set +UCLIBC_HAS_GNU_GETOPT=y + +# +# Big and Tall +# +UCLIBC_HAS_REGEX=y +# UCLIBC_HAS_WORDEXP is not set +UCLIBC_HAS_FTW=y +UCLIBC_HAS_GLOB=y + +# +# Library Installation Options +# +SHARED_LIB_LOADER_PREFIX="/lib" +RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" +DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" + +# +# uClibc development/debugging options +# +# DODEBUG is not set +# DOASSERTS is not set +# SUPPORT_LD_DEBUG is not set +# SUPPORT_LD_DEBUG_EARLY is not set +# UCLIBC_MJN3_ONLY is not set diff --git a/obsolete-buildroot/sources/uClibc.config-locale b/obsolete-buildroot/sources/uClibc.config-locale new file mode 100644 index 0000000000..b8b7fc8374 --- /dev/null +++ b/obsolete-buildroot/sources/uClibc.config-locale @@ -0,0 +1,134 @@ +# +# Automatically generated make config: don't edit +# +# TARGET_alpha is not set +# TARGET_arm is not set +# TARGET_cris is not set +# TARGET_e1 is not set +# TARGET_h8300 is not set +# TARGET_i386 is not set +# TARGET_i960 is not set +# TARGET_m68k is not set +# TARGET_microblaze is not set +# TARGET_mips is not set +# TARGET_powerpc is not set +# TARGET_sh is not set +# TARGET_sparc is not set +# TARGET_v850 is not set + +# +# Target Architecture Features and Options +# +HAVE_ELF=y +TARGET_ARCH="none" +# ARCH_LITTLE_ENDIAN is not set +# ARCH_BIG_ENDIAN is not set +# ARCH_HAS_NO_MMU is not set +UCLIBC_HAS_FLOATS=y +HAS_FPU=y +DO_C99_MATH=y +WARNINGS="-Wall" +KERNEL_SOURCE="/usr/src/linux" +HAVE_DOT_CONFIG=y + +# +# General Library Settings +# +# HAVE_NO_PIC is not set +DOPIC=y +HAVE_SHARED=y +BUILD_UCLIBC_LDSO=y +# UCLIBC_PIE_SUPPORT is not set +LDSO_LDD_SUPPORT=y +UCLIBC_CTOR_DTOR=y +# UCLIBC_PROPOLICE is not set +# UCLIBC_PROFILING is not set +UCLIBC_HAS_THREADS=y +PTHREADS_DEBUG_SUPPORT=y +UCLIBC_HAS_LFS=y +# MALLOC is not set +MALLOC_STANDARD=y +MALLOC_GLIBC_COMPAT=y +UCLIBC_DYNAMIC_ATEXIT=y +HAS_SHADOW=y +# UNIX98PTY_ONLY is not set +ASSUME_DEVPTS=y +UCLIBC_HAS_TM_EXTENSIONS=y +UCLIBC_HAS_TZ_CACHING=y +UCLIBC_HAS_TZ_FILE=y +UCLIBC_HAS_TZ_FILE_READ_MANY=y +UCLIBC_TZ_FILE_PATH="/etc/TZ" + +# +# Networking Support +# +UCLIBC_HAS_IPV6=y +UCLIBC_HAS_RPC=y +UCLIBC_HAS_FULL_RPC=y + +# +# String and Stdio Support +# +UCLIBC_HAS_CTYPE_TABLES=y +UCLIBC_HAS_CTYPE_SIGNED=y +# UCLIBC_HAS_CTYPE_UNSAFE is not set +UCLIBC_HAS_CTYPE_CHECKED=y +# UCLIBC_HAS_CTYPE_ENFORCED is not set +UCLIBC_HAS_WCHAR=y +UCLIBC_HAS_LOCALE=y +UCLIBC_PREGENERATED_LOCALE_DATA=y +UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA=y +UCLIBC_HAS_XLOCALE=y +UCLIBC_HAS_HEXADECIMAL_FLOATS=y +UCLIBC_HAS_GLIBC_DIGIT_GROUPING=y +UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING=y +UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y +UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 +UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y +# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set +# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set +UCLIBC_HAS_STDIO_BUFSIZ_4096=y +# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set +UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set +UCLIBC_HAS_STDIO_GETC_MACRO=y +UCLIBC_HAS_STDIO_PUTC_MACRO=y +UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y +# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set +UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y +UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y +UCLIBC_HAS_PRINTF_M_SPEC=y +UCLIBC_HAS_ERRNO_MESSAGES=y +# UCLIBC_HAS_SYS_ERRLIST is not set +UCLIBC_HAS_SIGNUM_MESSAGES=y +# UCLIBC_HAS_SYS_SIGLIST is not set +UCLIBC_HAS_GETTEXT_AWARENESS=y +UCLIBC_HAS_GNU_GETOPT=y + +# +# Big and Tall +# +UCLIBC_HAS_REGEX=y +UCLIBC_HAS_WORDEXP=y +UCLIBC_HAS_FTW=y +UCLIBC_HAS_GLOB=y + +# +# Library Installation Options +# +SHARED_LIB_LOADER_PREFIX="/lib" +RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" +DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" + +# +# uClibc development/debugging options +# +# DODEBUG is not set +# DOASSERTS is not set +# SUPPORT_LD_DEBUG is not set +# SUPPORT_LD_DEBUG_EARLY is not set +# UCLIBC_MJN3_ONLY is not set diff --git a/obsolete-buildroot/sources/uClibc.config-openwrt b/obsolete-buildroot/sources/uClibc.config-openwrt new file mode 100644 index 0000000000..985f76d764 --- /dev/null +++ b/obsolete-buildroot/sources/uClibc.config-openwrt @@ -0,0 +1,144 @@ +# +# Automatically generated make config: don't edit +# +# TARGET_alpha is not set +# TARGET_arm is not set +# TARGET_cris is not set +# TARGET_e1 is not set +# TARGET_frv is not set +# TARGET_h8300 is not set +# TARGET_i386 is not set +# TARGET_i960 is not set +# TARGET_m68k is not set +# TARGET_microblaze is not set +TARGET_mips=y +# TARGET_powerpc is not set +# TARGET_sh is not set +# TARGET_sparc is not set +# TARGET_v850 is not set + +# +# Target Architecture Features and Options +# +HAVE_ELF=y +ARCH_SUPPORTS_LITTLE_ENDIAN=y +TARGET_ARCH="mips" +ARCH_CFLAGS="-mno-split-addresses" +ARCH_SUPPORTS_BIG_ENDIAN=y +# CONFIG_MIPS_ISA_1 is not set +CONFIG_MIPS_ISA_2=y +# CONFIG_MIPS_ISA_3 is not set +# CONFIG_MIPS_ISA_4 is not set +# CONFIG_MIPS_ISA_MIPS32 is not set +# CONFIG_MIPS_ISA_MIPS64 is not set +ARCH_LITTLE_ENDIAN=y +# ARCH_BIG_ENDIAN is not set +# ARCH_HAS_NO_MMU is not set +ARCH_HAS_MMU=y +UCLIBC_HAS_FLOATS=y +HAS_FPU=y +DO_C99_MATH=y +WARNINGS="-Wall" +KERNEL_SOURCE="/usr/src/linux" +HAVE_DOT_CONFIG=y + +# +# General Library Settings +# +# HAVE_NO_PIC is not set +DOPIC=y +# HAVE_NO_SHARED is not set +HAVE_SHARED=y +# ARCH_HAS_NO_LDSO is not set +BUILD_UCLIBC_LDSO=y +# FORCE_SHAREABLE_TEXT_SEGMENTS is not set +# UCLIBC_PIE_SUPPORT is not set +LDSO_LDD_SUPPORT=y +UCLIBC_CTOR_DTOR=y +# UCLIBC_PROPOLICE is not set +# UCLIBC_PROFILING is not set +# HAS_NO_THREADS is not set +UCLIBC_HAS_THREADS=y +PTHREADS_DEBUG_SUPPORT=y +UCLIBC_HAS_LFS=y +# MALLOC is not set +# MALLOC_SIMPLE is not set +MALLOC_STANDARD=y +MALLOC_GLIBC_COMPAT=y +UCLIBC_DYNAMIC_ATEXIT=y +HAS_SHADOW=y +# UNIX98PTY_ONLY is not set +ASSUME_DEVPTS=y +UCLIBC_HAS_TM_EXTENSIONS=y +UCLIBC_HAS_TZ_CACHING=y +UCLIBC_HAS_TZ_FILE=y +UCLIBC_HAS_TZ_FILE_READ_MANY=y +UCLIBC_TZ_FILE_PATH="/etc/TZ" + +# +# Networking Support +# +UCLIBC_HAS_IPV6=y +UCLIBC_HAS_RPC=y +UCLIBC_HAS_FULL_RPC=y + +# +# String and Stdio Support +# +UCLIBC_HAS_CTYPE_TABLES=y +UCLIBC_HAS_CTYPE_SIGNED=y +# UCLIBC_HAS_CTYPE_UNSAFE is not set +UCLIBC_HAS_CTYPE_CHECKED=y +# UCLIBC_HAS_CTYPE_ENFORCED is not set +UCLIBC_HAS_WCHAR=y +# UCLIBC_HAS_LOCALE is not set +UCLIBC_HAS_HEXADECIMAL_FLOATS=y +UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y +UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 +UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y +# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set +# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set +UCLIBC_HAS_STDIO_BUFSIZ_4096=y +# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set +UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set +UCLIBC_HAS_STDIO_GETC_MACRO=y +UCLIBC_HAS_STDIO_PUTC_MACRO=y +UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y +# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set +UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y +UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y +UCLIBC_HAS_PRINTF_M_SPEC=y +UCLIBC_HAS_ERRNO_MESSAGES=y +# UCLIBC_HAS_SYS_ERRLIST is not set +UCLIBC_HAS_SIGNUM_MESSAGES=y +# UCLIBC_HAS_SYS_SIGLIST is not set +UCLIBC_HAS_GNU_GETOPT=y + +# +# Big and Tall +# +UCLIBC_HAS_REGEX=y +# UCLIBC_HAS_WORDEXP is not set +UCLIBC_HAS_FTW=y +UCLIBC_HAS_GLOB=y + +# +# Library Installation Options +# +SHARED_LIB_LOADER_PREFIX="/lib" +RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" +DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" + +# +# uClibc development/debugging options +# +# DODEBUG is not set +# DOASSERTS is not set +# SUPPORT_LD_DEBUG is not set +# SUPPORT_LD_DEBUG_EARLY is not set +# UCLIBC_MJN3_ONLY is not set diff --git a/obsolete-buildroot/sources/util-linux.patch b/obsolete-buildroot/sources/util-linux.patch new file mode 100644 index 0000000000..601e7dc11d --- /dev/null +++ b/obsolete-buildroot/sources/util-linux.patch @@ -0,0 +1,28 @@ +--- util-linux-2.11z/mount/fstab.c.orig 2003-12-03 15:28:22.000000000 -0700 ++++ util-linux-2.11z/mount/fstab.c 2003-12-03 15:28:41.000000000 -0700 +@@ -342,7 +342,7 @@ + /* Ensure that the lock is released if we are interrupted. */ + static void + handler (int sig) { +- die (EX_USER, "%s", sys_siglist[sig]); ++ die (EX_USER, "%s", strsignal(sig)); + } + + static void +--- /dev/null 2003-09-07 01:55:59.000000000 -0600 ++++ util-linux-2.11z/mount/swapargs.h 2003-12-03 15:44:50.000000000 -0700 +@@ -0,0 +1,3 @@ ++#define SWAPON_HAS_TWO_ARGS ++#include ++#include +--- util-linux-2.11z/mount/swap.configure.orig 2003-12-03 15:43:24.000000000 -0700 ++++ util-linux-2.11z/mount/swap.configure 2003-12-03 15:45:33.000000000 -0700 +@@ -1,6 +1,8 @@ + # Find out whether we can include + # and whether libc thinks that swapon() has two arguments. + ++exit 0 ++ + # Prepare test + CC=${CC-cc} + compile="$CC -o conftest conftest.c >/dev/null 2>&1" diff --git a/obsolete-buildroot/sources/valgrind.patch b/obsolete-buildroot/sources/valgrind.patch new file mode 100644 index 0000000000..d0946bd9c6 --- /dev/null +++ b/obsolete-buildroot/sources/valgrind.patch @@ -0,0 +1,115 @@ +--- valgrind-2.1.1.orig/coregrind/vg_syscalls.c 2004-02-24 17:07:10.000000000 -0700 ++++ valgrind-2.1.1/coregrind/vg_syscalls.c 2004-04-16 18:13:11.000000000 -0600 +@@ -3231,6 +3245,93 @@ + case CDROM_CLEAR_OPTIONS: /* 0x5321 */ + break; + ++ /* Stuff added by Erik Andersen for general device probing/handling */ ++#define BLKSSZGET _IO(0x12,104) ++ case BLKSSZGET: ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(BLKSSZGET)", arg3, ++ sizeof(int)); ++ break; ++#undef _IOR ++#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) ++#define BLKGETSIZE64 _IOR(0x12,114,sizeof(uint64_t)) ++ case BLKGETSIZE64: ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(BLKGETSIZE64)", arg3, ++ sizeof(uint64_t)); ++ break; ++#define HDIO_GETGEO 0x0301 /* get device geometry */ ++ case HDIO_GETGEO: ++ { ++ struct hd_geometry { ++ unsigned char heads; ++ unsigned char sectors; ++ unsigned short cylinders; ++ unsigned long start; ++ }; ++ ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(HDIO_GETGEO)", arg3, ++ sizeof(struct hd_geometry)); ++ } ++ break; ++#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ ++#define struct_hd_driveid_size 256 /* ATA6 specifies words 0-255 */ ++ case HDIO_GET_IDENTITY: ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(HDIO_GET_IDENTITY)", arg3, ++ struct_hd_driveid_size); ++ break; ++#define SCSI_IOCTL_GET_IDLUN 0x5382 ++ case SCSI_IOCTL_GET_IDLUN: ++ { ++ struct scsi_idlun ++ { ++ int mux4; ++ int host_unique_id; ++ ++ }; ++ ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_GET_IDLUN)", arg3, ++ sizeof(struct scsi_idlun)); ++ } ++ break; ++#define SCSI_IOCTL_SEND_COMMAND 1 ++ case SCSI_IOCTL_SEND_COMMAND: ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_SEND_COMMAND)", arg3, ++ ((2 * sizeof(unsigned int)) + 6 + 512)); ++ break; ++#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 ++ case SCSI_IOCTL_GET_BUS_NUMBER: ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", arg3, ++ sizeof(int)); ++ break; ++#define SCSI_IOCTL_PROBE_HOST 0x5385 ++ case SCSI_IOCTL_PROBE_HOST: ++ { ++ int xxxx; ++ char *array = (char*)arg3; ++ xxxx = array[0] + (array[1]<<8) + (array[2]<<16) + (array[3]<<24); ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_PROBE_HOST)", arg3, ++ sizeof(int)); ++ } ++ break; ++#define BLKFLSBUF _IO(0x12,97) ++ case BLKFLSBUF: ++ break; ++#define BLKRRPART _IO(0x12,95) ++ case BLKRRPART: ++ break; ++#define MTIOCTOP _IO(0x6d,0x1) ++ case MTIOCTOP: ++ { ++ struct mtop ++ { ++ short int mt_op; /* Operations defined below. */ ++ int mt_count; /* How many of them. */ ++ }; ++ SYSCALL_TRACK( pre_mem_write, tid, "ioctl(MTIOCTOP)", arg3, ++ sizeof(struct mtop)); ++ } ++ break; ++ ++ + /* We don't have any specific information on it, so + try to do something reasonable based on direction and + size bits. The encoding scheme is described in +--- valgrind-2.1.1.orig/coregrind/vg_libpthread.c 2004-03-08 08:57:17.000000000 -0700 ++++ valgrind-2.1.1/coregrind/vg_libpthread.c 2004-04-16 17:58:31.000000000 -0600 +@@ -3175,6 +3175,8 @@ + pthread_mutex). So basically, this is completely broken on recent + glibcs. */ + ++#ifndef __UCLIBC__ ++ + #undef _IO_flockfile + void _IO_flockfile ( _IO_FILE * file ) + { +@@ -3192,6 +3194,7 @@ + weak_alias(_IO_funlockfile, funlockfile); + #endif + ++#endif + + /* This doesn't seem to be needed to simulate libpthread.so's external + interface, but many people complain about its absence. */ diff --git a/obsolete-buildroot/sources/vtun.patch b/obsolete-buildroot/sources/vtun.patch new file mode 100644 index 0000000000..00a12454ee --- /dev/null +++ b/obsolete-buildroot/sources/vtun.patch @@ -0,0 +1,186 @@ +diff -urN vtun/Makefile.in vtun-2.6/Makefile.in +--- vtun/Makefile.in 2002-12-20 09:55:47.000000000 -0700 ++++ vtun-2.6/Makefile.in 2003-06-05 12:38:31.000000000 -0600 +@@ -28,7 +28,7 @@ + LEXFLAGS = -t + + INSTALL = @INSTALL@ +-INSTALL_OWNER = -o root -g 0 ++INSTALL_OWNER = + + prefix = @prefix@ + exec_prefix = @exec_prefix@ +@@ -86,15 +86,15 @@ + + install_config: + $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(ETC_DIR) +- if [ ! -f $(ETC_DIR)/vtund.conf ]; then \ +- $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR); \ +- fi ++ $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR); ++ $(INSTALL) -m 600 $(INSTALL_OWNER) scripts/vtund-start.conf $(DESTDIR)$(ETC_DIR); + + install: vtund install_config install_man +- $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(VAR_DIR)/run + $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(STAT_DIR) + $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(LOCK_DIR) + $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(SBIN_DIR) + $(INSTALL) -m 755 $(INSTALL_OWNER) vtund $(DESTDIR)$(SBIN_DIR) ++ $(INSTALL) -m 755 $(INSTALL_OWNER) scripts/vtund.rc.debian \ ++ $(DESTDIR)$(ETC_DIR)/init.d/S90vtun + + # DO NOT DELETE THIS LINE -- make depend depends on it. +diff -urN vtun/scripts/vtund.rc.debian vtun-2.6/scripts/vtund.rc.debian +--- vtun/scripts/vtund.rc.debian 2000-03-26 10:06:37.000000000 -0700 ++++ vtun-2.6/scripts/vtund.rc.debian 2003-06-05 12:38:46.000000000 -0600 +@@ -1,92 +1,48 @@ +-#! /usr/bin/perl -w ++#! /bin/sh ++# + +-### vtund-start +-### +-### script to start vtund as either a server or a client, according to +-### the config file /etc/vtund-start.conf +-### +-### Copyright 1999 Craig Sanders +-### +-### Written for the Debian GNU/Linux distribution. This script is free +-### software licensed under the terms of the GNU General Public License. +- +-$DAEMON="/usr/sbin/vtund" ; +- +-$do_what = shift ; +-$args="start|stop|reload|force-reload|restart" ; +-if ( $do_what !~ /^($args)$/i ) { +- print "Usage: /etc/init.d/vtun {$args}\n" ; +- exit 0 ; +-} +- +-$SSD="/sbin/start-stop-daemon" ; +-$SSDARGS="--verbose --exec $DAEMON" ; +- +-$sconf="/etc/vtund-start.conf" ; +-open(SCONF,"<$sconf") || die "couldn't open $sconf: $!\n" ; +-while () { +- chomp ; +- s/#.*//; +- s/^ +| +$//; +- next if (/^$/) ; +- +- @line = split ; +- $host = shift(@line) ; +- $server = shift(@line) ; +- $args = "" ; +- foreach (@line) { $args .= " $_" } ; +- +- $host='' if ($host =~ /--server--/i ) ; +- +- if ( $do_what eq 'start' ) { +- &start($host,$server,$args) ; +- } elsif ( $do_what eq 'stop' ) { +- &stop($host,$server,$args) ; +- } elsif ( $do_what eq 'restart' ) { +- &stop($pidfile) ; +- &start($host,$server,$args) ; +- } elsif ( $do_what =~ /^(reload|force-reload)$/ ) { +- &reload($host,$server) ; +- } +-} +-close (SCONF); +- +- +-sub start { +- my($host,$server,$args) = @_ ; +- print " Starting vtun " ; +- if ($host eq '') { +- print "server\n" ; +- system "$SSD --start $SSDARGS -- $args -s -P $server" ; +- } else { +- print "client $host to $server\n" ; +- $pidfile="/var/run/vtun.$host.$server" ; +- system "$SSD --start $SSDARGS --pidfile $pidfile -- $args $host $server" ; +- } +-} ; +- +-sub stop { +- my($host,$server,$args) = @_ ; +- print " Stopping vtun " ; +- if ($host eq '') { +- print "server\n" ; +- system "$SSD --stop $SSDARGS" ; +- } else { +- print "client $host to $server\n" ; +- $pidfile="/var/run/vtun.$host.$server" ; +- system "$SSD --stop $SSDARGS --pidfile $pidfile" ; +- } +-} ; +- +-sub reload { +- my($host,$server) = @_ ; +- print " Reloading vtun " ; +- if ($host eq '') { +- print "server\n" ; +- system "$SSD --stop $SSDARGS --signal 1" ; +- } else { +- print "client $host to $server\n" ; +- $pidfile="/var/run/vtun.$host.$server" ; +- system "$SSD --stop $SSDARGS --signal 1 --pidfile $pidfile" ; +- } +-} ++PATH=/bin:/usr/bin:/sbin:/usr/sbin ++DAEMON=/usr/sbin/vtund ++CONFFILE=/etc/vtund-start.conf ++PIDPREFIX=/var/run/vtund ++ ++test -f $DAEMON || exit 0 ++ ++case "$1" in ++ start) ++ # find all the defined tunnels ++ egrep -v '^[:space:]*(#.*)?$' $CONFFILE | while true; ++ do ++ read i ++ # no more lines available? done, then. ++ if [ $? != 0 ] ; then break; fi ++ SARGS=`echo $i|sed -ne 's/--server--\s*/-s -P /p'`; ++ if [ -n "$SARGS" ]; ++ then ++ echo "Starting vtund server." ++ start-stop-daemon -S -x $DAEMON -- $SARGS; ++ else ++ # split args into host and rest ++ HOST=`echo $i|cut -f 1 -d " "`; ++ TARGET=`echo $i|cut -f 2 -d " "`; ++ echo "Starting vtund client $HOST to $TARGET."; ++ start-stop-daemon -S -x $DAEMON -- $i; ++ fi ++ done ++ ;; ++ stop) ++ echo "Stopping vtund."; ++ start-stop-daemon -K -x vtund; ++ ;; ++ ++ restart|reload|force-reload) ++ $0 stop ++ sleep 1; ++ $0 start ++ ;; ++ *) ++ echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 ++ exit 1 ++ ;; ++esac ++exit 0 +--- vtun-2.6/configure.dist 2004-03-11 10:39:10.000000000 -0600 ++++ vtun-2.6/configure 2004-03-11 10:45:52.000000000 -0600 +@@ -2112,7 +2112,7 @@ + echo $ac_n "checking "for blowfish.h"""... $ac_c" 1>&6 + echo "configure:2114: checking "for blowfish.h"" >&5 + ac_hdr_found=no +- for p in $BLOWFISH_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include /usr/include/crypto; do ++ for p in $BLOWFISH_HDR_DIR $SSL_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include /usr/include/crypto; do + if test -n "$p"; then + dir="$p" + else diff --git a/obsolete-buildroot/sources/yacc b/obsolete-buildroot/sources/yacc new file mode 100755 index 0000000000..aed120e88a --- /dev/null +++ b/obsolete-buildroot/sources/yacc @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/bison -y "$@"