├── README ├── www ├── index.html ├── screenshots │ ├── footer.html │ ├── header.html │ └── screenshots.sh ├── footer.html └── header.html ├── .hgignore ├── sources ├── root-filesystem │ ├── init │ ├── etc │ │ ├── mtab │ │ ├── group │ │ ├── mdev.conf │ │ ├── resolv.conf │ │ ├── passwd │ │ └── os-release │ ├── src │ │ ├── hello.c │ │ ├── hello.cpp │ │ ├── thread-hello.c │ │ └── thread-hello2.c │ ├── bin │ │ └── getent │ └── sbin │ │ ├── record-commands │ │ ├── zapchroot │ │ ├── setup-chroot │ │ └── init.sh ├── sections │ ├── make.build │ ├── README │ ├── musl.build │ ├── distcc.build │ ├── bash.build │ ├── uClibc++.build │ ├── ccwrap.sh │ ├── toybox.build │ ├── linux-headers.sh │ ├── elf2flt.sh │ ├── busybox.build │ ├── uClibc.build │ ├── binutils.build │ └── gcc.sh ├── targets │ ├── sh2elf │ ├── mips │ ├── i686 │ ├── x86_64 │ ├── mipsel │ ├── mips64 │ ├── i486 │ ├── i586 │ ├── sparc │ ├── powerpc-440fp │ ├── sh2eb │ ├── armv5l │ ├── m68k │ ├── powerpc │ ├── armv6l │ ├── armv4l │ ├── sh4 │ └── armv4tl ├── patches │ ├── uClibc-setns.c │ ├── uClibc-setns.patch │ ├── linux-hack.patch │ ├── uClibc++-nozdefs.patch │ ├── uClibc-pthread_once.patch │ ├── linux-fixuClibc.patch │ ├── gcc-core-armeb.patch │ ├── elf2flt-stack.patch │ ├── gcc-core-fixmips64.patch │ ├── gcc-core-shpic.patch │ ├── gcc-g++-is-stupid.patch │ ├── linux-deeplystupid.patch │ ├── gcc-core-unbreak-armv4t.patch │ ├── binutils-shpcrel.patch │ ├── binutils-mips.patch │ ├── uClibc-lddwithmusl.patch │ ├── bash-fixfunc.patch │ ├── bash-fixread.patch │ ├── uClibc-sparcfix.patch │ ├── binutils-screwinfo.patch │ ├── uClibc++-norelpath.patch │ ├── uClibc-fixm68k.patch │ ├── musl-mips.patch │ ├── bash-fixsize.patch │ ├── linux-powerpc-bamboo.patch │ ├── uClibc-strndup.patch │ ├── gcc-core-xgcc.patch │ ├── musl-regex.patch │ ├── linux-powerpc-altivec.patch │ ├── uClibc-shutupldd.patch │ ├── gcc-core-stopdefaults.patch │ ├── gcc-core-softfloat-fix.patch │ ├── gcc-core-libgcceh.patch │ ├── uClibc-fixlocalestruct.patch │ ├── linux-sh4-fixifconfig.patch │ ├── uClibc-headerdep.patch │ ├── toybox-grep.patch │ ├── linux-shutup.patch │ ├── gcc-core-stopdefaults2.patch │ ├── gcc-core-fix-inhibit-libc.patch │ ├── gcc-core-macrosity.patch │ ├── uClibc-ruserpass.patch │ ├── binutils-bfd.patch │ ├── elf2flt-make.patch │ ├── gcc-core-fix52.patch │ ├── elf2flt-musl.patch │ ├── gcc-core-sh2.patch │ ├── uClibc-mkostemp.patch │ ├── gcc-core-weakbugs.patch │ ├── linux-fixsh4.patch │ ├── linux-arm-qemuirq.patch │ ├── uClibc-mips-siginfo.patch │ ├── gcc-core-musl.patch │ └── uClibc-mmu.patch ├── toys │ ├── make-hdb.sh │ ├── filter.py │ ├── unique-port.sh │ ├── hdainit.sh │ ├── gen_initramfs_list.sh │ ├── native-build.sh │ ├── README.footer │ ├── wrappy.c │ ├── trximg.sh │ └── dev-environment.sh ├── include.sh ├── baseconfig-linux ├── README ├── baseconfig-uClibc ├── variables.sh ├── utility_functions.sh └── baseconfig-busybox ├── more ├── zapchroot.sh ├── run-emulator-from-build.sh ├── README ├── dev-environment-from-build.sh ├── test.sh ├── clean.sh ├── native-build-from-build.sh ├── for-each-target.sh ├── tweak.sh ├── timeout.sh ├── smoketest-report.sh ├── cross-smoke-test.sh ├── record-commands.sh ├── smoketest.sh ├── smoketest-all.sh ├── repo.sh ├── report-recorded-commands.sh ├── migrate-kernel.sh ├── buildall-native.sh ├── chroot-splice.sh ├── buildall.sh ├── cronjob.sh ├── bisectinate.sh └── miniconfig.sh ├── cross-compiler.sh ├── .hgtags ├── native-compiler.sh ├── simple-cross-compiler.sh ├── root-filesystem.sh ├── system-image.sh └── download.sh /README: -------------------------------------------------------------------------------- 1 | www/README -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | news.html -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | ^build*/ 2 | ^packages/ 3 | -------------------------------------------------------------------------------- /sources/root-filesystem/init: -------------------------------------------------------------------------------- 1 | sbin/init.sh -------------------------------------------------------------------------------- /www/screenshots/footer.html: -------------------------------------------------------------------------------- 1 | ../footer.html -------------------------------------------------------------------------------- /www/screenshots/header.html: -------------------------------------------------------------------------------- 1 | ../header.html -------------------------------------------------------------------------------- /sources/root-filesystem/etc/mtab: -------------------------------------------------------------------------------- 1 | /proc/mounts -------------------------------------------------------------------------------- /more/zapchroot.sh: -------------------------------------------------------------------------------- 1 | ../sources/root-filesystem/sbin/zapchroot -------------------------------------------------------------------------------- /sources/root-filesystem/etc/group: -------------------------------------------------------------------------------- 1 | root:x:0: 2 | guest:x:500: 3 | -------------------------------------------------------------------------------- /sources/root-filesystem/etc/mdev.conf: -------------------------------------------------------------------------------- 1 | null 0:0 777 2 | (zero|random|urandom) 0:0 666 3 | -------------------------------------------------------------------------------- /sources/root-filesystem/etc/resolv.conf: -------------------------------------------------------------------------------- 1 | # This is the default for QEMU 2 | nameserver 10.0.2.3 3 | -------------------------------------------------------------------------------- /sources/root-filesystem/etc/passwd: -------------------------------------------------------------------------------- 1 | root::0:0:root:/home/root:/bin/sh 2 | guest:x:500:500:guest:/home/guest:/bin/sh 3 | -------------------------------------------------------------------------------- /more/run-emulator-from-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Launch system image out of build directory. 4 | 5 | cd build/system-image-"$1" && ./run-emulator.sh 6 | -------------------------------------------------------------------------------- /sources/root-filesystem/src/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | printf("Hello world!\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /www/footer.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 |
Copyright 2002, 2011 Rob Landley <rob@landley.net>
6 | -------------------------------------------------------------------------------- /sources/root-filesystem/src/hello.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "hello world" << endl; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /sources/sections/make.build: -------------------------------------------------------------------------------- 1 | LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${CC_PREFIX}cc" ./configure \ 2 | --prefix="$STAGE_DIR" --build="${CROSS_HOST}" --host="${CROSS_TARGET}" && 3 | make -j $CPUS && 4 | make -j $CPUS install 5 | -------------------------------------------------------------------------------- /sources/targets/sh2elf: -------------------------------------------------------------------------------- 1 | DESCRIPTION="ELF toolchain has different prefixes, and the bootloader cares." 2 | 3 | GCC_FLAGS="--disable-threads --disable-shared" 4 | NO_CPLUSPLUS=1 5 | BINUTILS_FLAGS= 6 | CROSS_TARGET=sh2-unknown-elf 7 | -------------------------------------------------------------------------------- /more/README: -------------------------------------------------------------------------------- 1 | The scripts in the top level directory are the build stages, called in order 2 | by the build.sh wrapper. This directory contains additional commands the 3 | user may want to run directly, but which aren't build stages. 4 | -------------------------------------------------------------------------------- /more/dev-environment-from-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run development environment out of build directory, using host-tools.sh if 4 | # available. 5 | 6 | cd build/system-image-"$1" && 7 | PATH="$(pwd)/build/host:$PATH" ./dev-environment.sh 8 | -------------------------------------------------------------------------------- /sources/sections/README: -------------------------------------------------------------------------------- 1 | These shell script snippets contain the logic to actually build each package. 2 | They're called by "build_stage" in sources/functions.sh. 3 | 4 | The "name.build" files have "setupfor name" called before running them, 5 | and "cleanup" called afterwards. 6 | 7 | The "name.sh" files do their own setup/cleanup (if any). 8 | -------------------------------------------------------------------------------- /sources/root-filesystem/src/thread-hello.c: -------------------------------------------------------------------------------- 1 | #define __REENTRANT 2 | #include 3 | #include 4 | 5 | void *threadhello(void *unused) 6 | { 7 | printf("Hello, world!\n"); 8 | return 0; 9 | } 10 | 11 | int main() { 12 | pthread_t thready; 13 | pthread_create(&thready, NULL, &threadhello, NULL); 14 | usleep(10); 15 | } 16 | -------------------------------------------------------------------------------- /sources/sections/musl.build: -------------------------------------------------------------------------------- 1 | # Build and install musl 2 | 3 | CC= CROSS_COMPILE="$CC_PREFIX" ./configure --prefix=/ $MUSL_FLAGS && 4 | DESTDIR="$STAGE_DIR" make -j $CPUS $DO_CROSS all install && 5 | echo '#define __MUSL__' >> "$STAGE_DIR"/include/features.h && 6 | ln -s libc.so "$STAGE_DIR/lib/ld-musl.so.0" && 7 | ln -s /lib/libc.so "$STAGE_DIR/bin/ldd" 8 | 9 | -------------------------------------------------------------------------------- /more/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run a command with sources/include.sh and an architecture loaded 4 | 5 | if [ $# -eq 0 ] 6 | then 7 | echo "Usage: [STAGE_NAME=...] more/test.sh ARCH COMMAND..." >&2 8 | exit 1 9 | fi 10 | 11 | . sources/include.sh || exit 1 12 | 13 | [ "$1" != "host" ] && NO_CLEANUP=1 load_target "$1" 14 | shift 15 | eval "$@" 16 | -------------------------------------------------------------------------------- /sources/root-filesystem/etc/os-release: -------------------------------------------------------------------------------- 1 | NAME="Aboriginal Linux" 2 | VERSION="1.4.2" 3 | ID=aboriginal 4 | ID_LIKE=toybox 5 | PRETTY_NAME="Aboriginal Linux 1.4.2" 6 | VERSION_ID="1.4.2" 7 | HOME_URL="http://landley.net/aboriginal" 8 | SUPPORT_URL="http://landley.net/aboriginal/about.html" 9 | BUG_REPORT_URL="http://lists.landley.net/listinfo.cgi/toybox-landley.net" 10 | 11 | -------------------------------------------------------------------------------- /sources/patches/uClibc-setns.c: -------------------------------------------------------------------------------- 1 | The setns system call is only 5 years old, so uClibc can't be expected to support it, but toybox needs it. 2 | 3 | --- /dev/null 2015-03-12 00:35:23.675793740 -0500 4 | +++ uClibc/libc/sysdeps/linux/common/setns.c 2015-03-19 13:18:05.711157730 -0500 5 | @@ -0,0 +1,3 @@ 6 | +#include 7 | + 8 | +_syscall2(int, setns, int, fd, int, nstype); 9 | -------------------------------------------------------------------------------- /sources/patches/uClibc-setns.patch: -------------------------------------------------------------------------------- 1 | The setns system call is only 5 years old, so uClibc can't be expected to support it, but toybox needs it. 2 | 3 | --- /dev/null 2015-03-12 00:35:23.675793740 -0500 4 | +++ uClibc/libc/sysdeps/linux/common/setns.c 2015-03-19 13:18:05.711157730 -0500 5 | @@ -0,0 +1,3 @@ 6 | +#include 7 | + 8 | +_syscall2(int, setns, int, fd, int, nstype); 9 | -------------------------------------------------------------------------------- /more/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Delete all the target stages, to force them to rebuild next build.sh. 4 | 5 | # This leaves build.packages and build/host alone. You can delete those 6 | # too if you like, "rm -rf build" is safe, it just means these steps will have 7 | # to do their thing again: 8 | # 9 | # EXTRACT_ALL=1 ./download.sh 10 | # ./host-tools.sh 11 | 12 | rm -rf build/*-* 13 | -------------------------------------------------------------------------------- /sources/toys/make-hdb.sh: -------------------------------------------------------------------------------- 1 | make_hdb() 2 | { 3 | # Some distros don't put /sbin:/usr/sbin in the $PATH for non-root users. 4 | if [ -z "$(which mke2fs)" ] || [ -z "$(which tune2fs)" ] 5 | then 6 | export PATH=/sbin:/usr/sbin:$PATH 7 | fi 8 | 9 | truncate -s ${HDBMEGS}m "$HDB" && 10 | mke2fs -q -b 1024 -F "$HDB" -i 4096 && 11 | tune2fs -j -c 0 -i 0 "$HDB" 12 | 13 | [ $? -ne 0 ] && exit 1 14 | } 15 | -------------------------------------------------------------------------------- /sources/patches/linux-hack.patch: -------------------------------------------------------------------------------- 1 | This is a workaround for commit e09df47885d7 which broke building i686 with 2 | gcc 4.2. Remind me to patch gcc to fix this... 3 | 4 | diff --git a/init/Kconfig b/init/Kconfig 5 | index 6fdd6e3..938b342 100644 6 | --- a/init/Kconfig 7 | +++ b/init/Kconfig 8 | @@ -1666,6 +1666,7 @@ config PADATA 9 | # mappings 10 | config BROKEN_RODATA 11 | bool 12 | + default y 13 | 14 | config ASN1 15 | tristate 16 | -------------------------------------------------------------------------------- /sources/patches/uClibc++-nozdefs.patch: -------------------------------------------------------------------------------- 1 | --- uClibc++/Rules.mak 2007-06-03 17:51:12.000000000 -0500 2 | +++ uClibc++2/Rules.mak 2008-11-03 17:43:49.000000000 -0600 3 | @@ -102,7 +102,7 @@ 4 | GEN_CFLAGS:=-fno-builtin 5 | CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS) -ansi 6 | 7 | -LDFLAGS:=-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,defs 8 | +LDFLAGS:=-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc 9 | 10 | ifeq ($(DODEBUG),y) 11 | CFLAGS += -O0 -g3 12 | -------------------------------------------------------------------------------- /sources/patches/uClibc-pthread_once.patch: -------------------------------------------------------------------------------- 1 | diff -u a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S 2 | --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S 3 | +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S 4 | @@ -23,6 +23,7 @@ 5 | #include 6 | 7 | 8 | + .hidden __fork_generation 9 | .comm __fork_generation, 4, 4 10 | 11 | .text 12 | -------------------------------------------------------------------------------- /sources/toys/filter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Filter out baseconfig entries from output of miniconfig.sh 4 | 5 | import os,sys 6 | 7 | if len(sys.argv) != 3: 8 | sys.stderr.write("usage: filter.py baseconfig mini.config\n") 9 | sys.exit(1) 10 | 11 | baseconfig=file(sys.argv[1]).readlines() 12 | miniconfig=file(sys.argv[2]).readlines() 13 | 14 | for i in baseconfig: 15 | if i in miniconfig: 16 | miniconfig.remove(i) 17 | 18 | print "".join(miniconfig), 19 | -------------------------------------------------------------------------------- /sources/patches/linux-fixuClibc.patch: -------------------------------------------------------------------------------- 1 | Fix uClibc build break 2 | 3 | diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h 4 | index 1a85940..e294c77 100644 5 | --- a/include/uapi/linux/netlink.h 6 | +++ b/include/uapi/linux/netlink.h 7 | @@ -1,7 +1,6 @@ 8 | #ifndef _UAPI__LINUX_NETLINK_H 9 | #define _UAPI__LINUX_NETLINK_H 10 | 11 | -#include 12 | #include /* for __kernel_sa_family_t */ 13 | #include 14 | 15 | -------------------------------------------------------------------------------- /sources/sections/distcc.build: -------------------------------------------------------------------------------- 1 | rsync_cv_HAVE_C99_VSNPRINTF=yes \ 2 | LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${CC_PREFIX}cc" ./configure \ 3 | --host="${CROSS_TARGET}" --prefix="$STAGE_DIR" --bindir="$STAGE_DIR/distcc" \ 4 | --with-included-popt --disable-Werror && 5 | make -j $CPUS && 6 | make -j $CPUS install && 7 | mkdir -p "$STAGE_DIR/distcc" || dienow 8 | 9 | TEMP="" 10 | [ -z "$NO_CPLUSPLUS" ] && TEMP="g++ c++" 11 | for i in gcc cc $TEMP 12 | do 13 | ln -s distcc "$STAGE_DIR/distcc/$i" || dienow 14 | done 15 | -------------------------------------------------------------------------------- /more/native-build-from-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run native build out of build directory, using host-tools.sh if 4 | # available. 5 | 6 | SYSIMG="build/system-image-$1" 7 | 8 | if [ ! -e "$SYSIMG" ] 9 | then 10 | echo "no $SYSIMG" >&2 11 | exit 1 12 | fi 13 | 14 | PATH="$PWD/build/host:$PWD/build/native-compiler-$1:$PATH" 15 | 16 | X=$(readlink -f "$2" 2>/dev/null) 17 | if [ -z "$X" ] 18 | then 19 | echo "No control image $2" >&2 20 | exit 1 21 | fi 22 | 23 | cd "$SYSIMG" && ./native-build.sh "$X" 24 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-armeb.patch: -------------------------------------------------------------------------------- 1 | --- gcc-core/gcc/config/arm/linux-elf.h 2009-04-04 23:41:52.000000000 -0500 2 | +++ gcc-core2/gcc/config/arm/linux-elf.h 2009-04-05 04:36:41.000000000 -0500 3 | @@ -36,7 +36,8 @@ 4 | 5 | #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 6 | 7 | -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" 8 | +#define SUBTARGET_EXTRA_LINK_SPEC " -p" 9 | +/*#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"*/ 10 | 11 | #undef MULTILIB_DEFAULTS 12 | #define MULTILIB_DEFAULTS \ 13 | -------------------------------------------------------------------------------- /more/for-each-target.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Iterate through every target architecture, running rest of command line 4 | # on each $TARGET. 5 | 6 | # If $FORK is set, run them in parallel with filtered output. 7 | 8 | . sources/utility_functions.sh || exit 1 9 | 10 | [ -z "${ARCHES}" ] && 11 | ARCHES="$(ls sources/targets)" 12 | 13 | for TARGET in $ARCHES 14 | do 15 | [ ! -f "sources/targets/$TARGET" ] && continue 16 | announce "$TARGET running" 17 | maybe_fork "$* 2>&1 | maybe_quiet" 18 | done 19 | 20 | wait 21 | -------------------------------------------------------------------------------- /sources/toys/unique-port.sh: -------------------------------------------------------------------------------- 1 | unique_port() 2 | { 3 | # Try to find an unused port number for each running instance of the program. 4 | 5 | START=8192 6 | RANGE=$[$(awk '{print $1}' /proc/sys/net/ipv4/ip_local_port_range)-$START] 7 | if [ $RANGE -lt 8 ] 8 | then 9 | START=$[$(awk '{print $2}' /proc/sys/net/ipv4/ip_local_port_range)] 10 | RANGE=$[65535-$START] 11 | if [ $RANGE -lt 8 ] 12 | then 13 | START=16384 14 | RANGE=32768 15 | fi 16 | fi 17 | echo $[($$%$RANGE)+$START] 18 | } 19 | -------------------------------------------------------------------------------- /sources/patches/elf2flt-stack.patch: -------------------------------------------------------------------------------- 1 | The default stack size is way too small to run much beyond "hello world". 2 | 3 | diff -ru elf2flt/elf2flt.c elf2flt.bak/elf2flt.c 4 | --- elf2flt/elf2flt.c 2015-01-04 02:14:55.000000000 -0600 5 | +++ elf2flt.bak/elf2flt.c 2015-10-19 08:49:53.608497450 -0500 6 | @@ -1673,7 +1673,7 @@ 7 | sizeof(hdr)); 8 | 9 | #ifndef TARGET_e1 10 | - stack = 4096; 11 | + stack = 65536; 12 | #else /* We need plenty of stack for both of them (Aggregate and Register) */ 13 | stack = 0x2020; 14 | #endif 15 | -------------------------------------------------------------------------------- /sources/toys/hdainit.sh: -------------------------------------------------------------------------------- 1 | # splice hda into / 2 | cp -rFs /usr/overlay/. / 3 | 4 | # cleanup copy of _this_ script, and plug gcc so search stops 5 | 6 | if [ -z "$DISTCC_HOSTS" ] 7 | then 8 | echo "Not using distcc." 9 | else 10 | echo "Distcc acceleration enabled." 11 | PATH="/usr/distcc:$PATH" 12 | fi 13 | 14 | if [ -e /mnt/init ] 15 | then 16 | X=xx 17 | echo "Press any key for command line..." 18 | read -t 3 -n 1 X 19 | if [ "$X" == xx ] 20 | then 21 | echo "Running automated build." 22 | HANDOFF=/mnt/init 23 | fi 24 | fi 25 | -------------------------------------------------------------------------------- /more/tweak.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Rerun 4 | 5 | if [ $# -lt 2 ] 6 | then 7 | echo "usage: more/tweak.sh ARCH STAGE COMMAND..." >&1 8 | exit 1 9 | fi 10 | 11 | [ ! -e "$2".sh ] && echo "No stage $2" >&2 && exit 1 12 | ARCH="$1" 13 | STAGE="$2" 14 | [ "$STAGE" == "native-compiler" ] && 15 | STUFF='STAGE_DIR=$STAGE_DIR/usr HOST_ARCH=$ARCH' 16 | shift 17 | shift 18 | 19 | NO_CLEANUP=temp STAGE_NAME="$STAGE" more/test.sh "$ARCH" \ 20 | $STUFF "$@" " && create_stage_tarball" || exit 1 21 | NO_CLEANUP=temp AFTER="$STAGE" ./build.sh "$ARCH" "$STAGE" 22 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-fixmips64.patch: -------------------------------------------------------------------------------- 1 | diff -ru gcc-core/gcc/config/mips/linux64.h gcc-core.bak/gcc/config/mips/linux64.h 2 | --- gcc-core/gcc/config/mips/linux64.h 2006-05-04 08:21:11.000000000 -0500 3 | +++ gcc-core.bak/gcc/config/mips/linux64.h 2010-02-27 23:00:22.000000000 -0600 4 | @@ -23,7 +23,7 @@ 5 | in order to make the other specs easier to write. */ 6 | #define DRIVER_SELF_SPECS \ 7 | "%{!EB:%{!EL:%(endian_spec)}}", \ 8 | -"%{!mabi=*: -mabi=n32}" 9 | +"%{!mabi=*: -mabi=64}" 10 | 11 | #undef SUBTARGET_ASM_SPEC 12 | #define SUBTARGET_ASM_SPEC "\ 13 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-shpic.patch: -------------------------------------------------------------------------------- 1 | Don't build libgcc.a with -fpic for elf2flt binaries. 2 | 3 | diff -ruN gcc-core/gcc/config/sh/t-linux gcc-core.bak/gcc/config/sh/t-linux 4 | --- gcc-core/gcc/config/sh/t-linux 2006-03-31 16:31:05.000000000 -0600 5 | +++ gcc-core.bak/gcc/config/sh/t-linux 2015-05-22 20:48:34.890802152 -0500 6 | @@ -1,4 +1,4 @@ 7 | -TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES 8 | +TARGET_LIBGCC2_CFLAGS = -DNO_FPSCR_VALUES 9 | LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array 10 | 11 | LIB2FUNCS_EXTRA= $(srcdir)/config/sh/linux-atomic.asm 12 | -------------------------------------------------------------------------------- /sources/targets/mips: -------------------------------------------------------------------------------- 1 | DESCRIPTION="Mips r4k big endian." 2 | 3 | KARCH=mips 4 | KERNEL_PATH=vmlinux 5 | BINUTILS_FLAGS= 6 | GCC_FLAGS= 7 | MUSL_FLAGS=--disable-optimize # -O3 internal compiler errors in malloc, use -Os 8 | QEMU_TEST=mips 9 | 10 | CONSOLE=ttyS0 11 | 12 | LINUX_CONFIG=" 13 | CONFIG_MIPS_MALTA=y 14 | CONFIG_CPU_MIPS32_R2=y 15 | CONFIG_SERIAL_8250=y 16 | CONFIG_SERIAL_8250_CONSOLE=y 17 | #CONFIG_PM=y 18 | CONFIG_PCNET32=y 19 | CONFIG_BLK_DEV_PIIX=y 20 | " 21 | 22 | emulator_command() 23 | { 24 | echo qemu-system-mips -M malta $(qemu_defaults "$@") 25 | } 26 | -------------------------------------------------------------------------------- /sources/patches/gcc-g++-is-stupid.patch: -------------------------------------------------------------------------------- 1 | --- gcc-g++/libstdc++-v3/configure 2007-01-29 04:51:01.000000000 -0600 2 | +++ gcc-g++2/libstdc++-v3/configure 2008-11-02 03:46:15.000000000 -0600 3 | @@ -7947,7 +7947,7 @@ 4 | 5 | echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 6 | echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6 7 | - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` 8 | + target_thread_file=posix 9 | echo "$as_me:$LINENO: result: $target_thread_file" >&5 10 | echo "${ECHO_T}$target_thread_file" >&6 11 | 12 | -------------------------------------------------------------------------------- /sources/targets/i686: -------------------------------------------------------------------------------- 1 | DESCRIPTION="Standard 32-bit x86 target, Pentium 3 or later." 2 | 3 | KARCH=i386 4 | KERNEL_PATH=arch/${KARCH}/boot/bzImage 5 | BINUTILS_FLAGS= 6 | GCC_FLAGS= 7 | QEMU_TEST=$KARCH 8 | 9 | CONSOLE=ttyS0 10 | 11 | LINUX_CONFIG=" 12 | CONFIG_MPENTIUMII=y 13 | CONFIG_ACPI=y 14 | CONFIG_BLK_DEV_PIIX=y 15 | CONFIG_NETDEV_1000=y 16 | CONFIG_E1000=y 17 | CONFIG_SERIAL_8250=y 18 | CONFIG_SERIAL_8250_CONSOLE=y 19 | " 20 | 21 | emulator_command() 22 | { 23 | echo qemu-system-i386 -cpu pentium3 $(qemu_defaults "$@") \ 24 | -net nic,model=e1000 -net user 25 | } 26 | -------------------------------------------------------------------------------- /sources/targets/x86_64: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | 64-bit x86. 3 | 4 | Modern standard PC architecture. Runs i686 code as well. 5 | " 6 | 7 | KARCH=x86_64 8 | KERNEL_PATH=arch/${KARCH}/boot/bzImage 9 | GCC_FLAGS= 10 | BINUTILS_FLAGS="--enable-64-bit-bfd" 11 | QEMU_TEST= 12 | 13 | CONSOLE=ttyS0 14 | 15 | LINUX_CONFIG=" 16 | CONFIG_64BIT=y 17 | CONFIG_ACPI=y 18 | CONFIG_BLK_DEV_PIIX=y 19 | CONFIG_NETDEV_1000=y 20 | CONFIG_E1000=y 21 | CONFIG_SERIAL_8250=y 22 | CONFIG_SERIAL_8250_CONSOLE=y 23 | " 24 | 25 | emulator_command() 26 | { 27 | echo qemu-system-x86_64 $(qemu_defaults "$@") 28 | } 29 | -------------------------------------------------------------------------------- /sources/patches/linux-deeplystupid.patch: -------------------------------------------------------------------------------- 1 | The kernel developers added a new "feature" (in commit 5d2acfc7b974) to 2 | switch _on_ some symbols in "make allnoconfig", breaking miniconfig. 3 | Cut the blue wire to make this drooling idiocy stop. 4 | 5 | diff --git a/init/Kconfig b/init/Kconfig 6 | index 9d3585b..b097eb6 100644 7 | --- a/init/Kconfig 8 | +++ b/init/Kconfig 9 | @@ -1486,7 +1486,6 @@ config PCI_QUIRKS 10 | 11 | config EMBEDDED 12 | bool "Embedded system" 13 | - option allnoconfig_y 14 | select EXPERT 15 | help 16 | This option should be enabled if compiling the kernel for 17 | -------------------------------------------------------------------------------- /sources/targets/mipsel: -------------------------------------------------------------------------------- 1 | DESCRIPTION="Mips r4k little endian" 2 | 3 | KARCH=mips 4 | KERNEL_PATH=vmlinux 5 | BINUTILS_FLAGS= 6 | GCC_FLAGS= 7 | MUSL_FLAGS=--disable-optimize # -O3 internal compiler errors in malloc, use -Os 8 | QEMU_TEST=mipsel 9 | 10 | CONSOLE=ttyS0 11 | 12 | LINUX_CONFIG=" 13 | CONFIG_MIPS_MALTA=y 14 | CONFIG_CPU_LITTLE_ENDIAN=y 15 | CONFIG_CPU_MIPS32_R2=y 16 | CONFIG_SERIAL_8250=y 17 | CONFIG_SERIAL_8250_CONSOLE=y 18 | CONFIG_PCNET32=y 19 | CONFIG_BLK_DEV_PIIX=y 20 | " 21 | 22 | emulator_command() 23 | { 24 | echo qemu-system-mipsel -M malta $(qemu_defaults "$@") 25 | } 26 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-unbreak-armv4t.patch: -------------------------------------------------------------------------------- 1 | --- gcc-4.2.1/gcc/config/arm/linux-eabi.h 2006-02-17 00:29:10.000000000 +0100 2 | +++ gcc-4.2.1-patched/gcc/config/arm/linux-eabi.h 2009-09-16 13:34:25.000000000 +0200 3 | @@ -45,8 +45,6 @@ 4 | /* Default to armv5t so that thumb shared libraries work. 5 | The ARM10TDMI core is the default for armv5t, so set 6 | SUBTARGET_CPU_DEFAULT to achieve this. */ 7 | -#undef SUBTARGET_CPU_DEFAULT 8 | -#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi 9 | 10 | #undef SUBTARGET_EXTRA_LINK_SPEC 11 | #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" 12 | -------------------------------------------------------------------------------- /sources/toys/gen_initramfs_list.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -d "$1" ] 4 | then 5 | echo "usage: gen_initramfs_list.sh dirname" >&2 6 | exit 1 7 | fi 8 | 9 | LEN=$(echo $1 | wc -c) 10 | 11 | find "$1" | while read i 12 | do 13 | PERM=$(stat -c %a "$i") 14 | NAME="$(echo $i | cut -b ${LEN}-)" 15 | 16 | [ -z "$NAME" ] && continue 17 | 18 | if [ -L "$i" ] 19 | then 20 | echo "slink $NAME $(readlink "$i") $PERM 0 0" 21 | elif [ -f "$i" ] 22 | then 23 | echo "file $NAME $i $PERM 0 0" 24 | elif [ -d "$i" ] 25 | then 26 | echo "dir $NAME $PERM 0 0" 27 | fi 28 | done 29 | -------------------------------------------------------------------------------- /sources/patches/binutils-shpcrel.patch: -------------------------------------------------------------------------------- 1 | Teach gas to understand a thing musl's assembly uses. 2 | 3 | --- binutils-397a64b3.orig//gas/config/tc-sh.c 2015-08-11 01:29:26.000000000 +0000 4 | +++ binutils-397a64b3/gas/config/tc-sh.c 2015-11-02 23:17:03.931462591 +0000 5 | @@ -4491,6 +4496,8 @@ sh_parse_name (char const *name, 6 | reloc_type = BFD_RELOC_SH_TLS_LE_32; 7 | else if ((next_end = sh_end_of_match (next + 1, "DTPOFF"))) 8 | reloc_type = BFD_RELOC_SH_TLS_LDO_32; 9 | + else if ((next_end = sh_end_of_match (next + 1, "PCREL"))) 10 | + reloc_type = BFD_RELOC_32_PCREL; 11 | else 12 | goto no_suffix; 13 | 14 | -------------------------------------------------------------------------------- /sources/patches/binutils-mips.patch: -------------------------------------------------------------------------------- 1 | Remove gratuitous breakage that annoys musl dynamic linking. 2 | 3 | diff -ruN binutils/bfd/elf32-mips.c binutils.bak/bfd/elf32-mips.c 4 | --- binutils/bfd/elf32-mips.c 2012-09-23 01:02:58.000000000 -0500 5 | +++ binutils.bak/bfd/elf32-mips.c 2016-02-08 16:35:46.964996584 -0600 6 | @@ -947,7 +947,7 @@ 7 | if (relocatable) 8 | { 9 | /* Make up a value. */ 10 | - *pgp = symbol->section->output_section->vma + 0x4000; 11 | + *pgp = symbol->section->output_section->vma; 12 | _bfd_set_gp_value (output_bfd, *pgp); 13 | } 14 | else if (!mips_elf_assign_gp (output_bfd, pgp)) 15 | -------------------------------------------------------------------------------- /more/timeout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run a command line with a hang timeout, which kills the child process if it 4 | # doesn't produce a new line of output for $1 seconds. 5 | 6 | # This script has to be a separate process (rather than just a shell function) 7 | # so killing it doesn't kill the parent process. 8 | 9 | source sources/utility_functions.sh 10 | 11 | if [ $# -lt 1 ] 12 | then 13 | echo "Usage: timeout.sh SECONDS COMMANDS..." >&2 14 | exit 1 15 | fi 16 | 17 | trap "killtree $$" EXIT 18 | TIMEOUT="$1" 19 | shift 20 | ( eval "$@" ) | tee >(while read -t "$TIMEOUT" -n 32 i; do true; done; sleep 1; kill -TERM $$ 2>/dev/null ) 21 | -------------------------------------------------------------------------------- /sources/targets/mips64: -------------------------------------------------------------------------------- 1 | DESCRIPTION="64 bit big endian mips" 2 | 3 | KARCH=mips 4 | KERNEL_PATH=vmlinux 5 | BINUTILS_FLAGS="--enable-64-bit-bfd" 6 | GCC_FLAGS= 7 | QEMU_TEST=mips64 8 | 9 | CONSOLE=ttyS0 10 | 11 | UCLIBC_CONFIG=" 12 | TARGET_mips=y 13 | CONFIG_MIPS_N64_ABI=y 14 | CONFIG_MIPS_ISA_MIPS64=y 15 | UCLIBC_HAS_FPU=y 16 | " 17 | 18 | LINUX_CONFIG=" 19 | CONFIG_CPU_MIPS64_R1=y 20 | CONFIG_64BIT=y 21 | CONFIG_MIPS_MALTA=y 22 | CONFIG_SERIAL_8250=y 23 | CONFIG_SERIAL_8250_CONSOLE=y 24 | CONFIG_PCNET32=y 25 | CONFIG_BLK_DEV_PIIX=y 26 | " 27 | 28 | emulator_command() 29 | { 30 | echo qemu-system-mips64 -M malta $(qemu_defaults "$@") 31 | } 32 | -------------------------------------------------------------------------------- /sources/sections/bash.build: -------------------------------------------------------------------------------- 1 | # wire around some tests ./configure can't run when cross-compiling. 2 | echo -e "ac_cv_func_setvbuf_reversed=no\nbash_cv_sys_named_pipes=yes\nbash_cv_have_mbstate_t=yes\nbash_cv_getenv_redef=no\nac_cv_func_bindtextdomain=nyet" > config.cache && 3 | LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${CC_PREFIX}cc" \ 4 | RANLIB="${CC_PREFIX}ranlib" ./configure --prefix="$STAGE_DIR" \ 5 | --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \ 6 | --without-bash-malloc --disable-readline && 7 | # note: doesn't work with -j 8 | make && 9 | make install && 10 | # Make bash the default shell. 11 | ln -sf bash "$STAGE_DIR/bin/sh" 12 | -------------------------------------------------------------------------------- /sources/patches/uClibc-lddwithmusl.patch: -------------------------------------------------------------------------------- 1 | The uClibc ldd won't build with musl's elf.h because no ELFMAG_U32 symbol. 2 | (Needed for CROSS_COMPILER_HOST=i686 now that toolchain's musl.) 3 | 4 | diff -ruN uClibc/utils/ldd.c uClibc.bak/utils/ldd.c 5 | --- uClibc/utils/ldd.c 2016-01-03 17:56:54.737861633 -0600 6 | +++ uClibc.bak/utils/ldd.c 2016-01-03 17:58:39.165864429 -0600 7 | @@ -224,7 +224,7 @@ 8 | 9 | static int check_elf_header(ElfW(Ehdr) *const ehdr) 10 | { 11 | - if (!ehdr || *(uint32_t*)ehdr != ELFMAG_U32 12 | + if (!ehdr || memcmp(ehdr, ELFMAG, 4) 13 | || ehdr->e_ident[EI_CLASS] != ELFCLASSM 14 | || ehdr->e_ident[EI_VERSION] != EV_CURRENT 15 | ) { 16 | -------------------------------------------------------------------------------- /sources/patches/bash-fixfunc.patch: -------------------------------------------------------------------------------- 1 | Disable exported function definitions because they're a giant pointless bug. 2 | 3 | diff -ru bash/variables.c bash.bak/variables.c 4 | --- bash/variables.c 2002-06-25 08:43:33.000000000 -0500 5 | +++ bash.bak/variables.c 2014-09-28 22:04:31.497654646 -0500 6 | @@ -260,7 +260,7 @@ 7 | 8 | /* If exported function, define it now. Don't import functions from 9 | the environment in privileged mode. */ 10 | - if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4)) 11 | + if (0) 12 | { 13 | string_length = strlen (string); 14 | temp_string = (char *)xmalloc (3 + string_length + char_index); 15 | -------------------------------------------------------------------------------- /sources/patches/bash-fixread.patch: -------------------------------------------------------------------------------- 1 | Using read with a timeout does a longjmp() out of a signal handler, which leaves 2 | SIGARLM blocked. This is inherited by children, and thus not something you 3 | want to do from PID 1. 4 | 5 | diff -ru bash/builtins/read.def bash.bak/builtins/read.def 6 | --- bash/builtins/read.def 2002-03-19 13:33:41.000000000 -0600 7 | +++ bash.bak/builtins/read.def 2011-09-07 23:11:56.853885092 -0500 8 | @@ -101,6 +101,11 @@ 9 | sigalrm (s) 10 | int s; 11 | { 12 | + sigset_t walrus; 13 | + 14 | + sigemptyset(&walrus); 15 | + sigaddset(&walrus, SIGALRM); 16 | + sigprocmask(SIG_UNBLOCK, &walrus, 0); 17 | longjmp (alrmbuf, 1); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /sources/patches/uClibc-sparcfix.patch: -------------------------------------------------------------------------------- 1 | The sparc dynamic linker segfaults without this. I should track down why 2 | and do a proper fix that doesn't hit common code... 3 | 4 | diff -ruN uClibc-0.9.32.bak/ldso/include/dl-hash.h uClibc-0.9.32/ldso/include/dl-hash.h 5 | --- uClibc-0.9.32.bak/ldso/include/dl-hash.h 2011-06-08 14:35:20.000000000 -0500 6 | +++ uClibc-0.9.32/ldso/include/dl-hash.h 2011-11-10 17:53:49.148917902 -0600 7 | @@ -111,7 +111,11 @@ 8 | ElfW(Addr) relro_addr; 9 | size_t relro_size; 10 | 11 | +#ifdef __sparc__ 12 | + int st_dev; 13 | +#else 14 | dev_t st_dev; /* device */ 15 | +#endif 16 | ino_t st_ino; /* inode */ 17 | 18 | #ifdef __powerpc__ 19 | -------------------------------------------------------------------------------- /sources/root-filesystem/bin/getent: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2009 Rob Landley , licensed under GPLv2. 4 | 5 | isnum() 6 | { 7 | [ ! -z "$(echo $1 | grep '^[0-9]*$')" ] 8 | } 9 | 10 | nocomments() 11 | { 12 | sed 's/\([^#]*\)#.*/\1/' /etc/$1 13 | } 14 | 15 | # The world's cheesiest getent implementation 16 | 17 | case "$1" in 18 | passwd|group) 19 | isnum "$2" && 20 | grep -m 1 "[^:]*:[^:]*:$2:" /etc/$1 || 21 | grep -m 1 "^$2:" /etc/$1 22 | ;; 23 | 24 | hosts|networks|protocols) 25 | nocomments $1 | grep -m 1 -w "$2" 26 | ;; 27 | 28 | services) 29 | nocomments $1 | (isnum "$2" && grep -m 1 "[ ]$2/" || grep -m 1 -w "$2") 30 | ;; 31 | esac 32 | -------------------------------------------------------------------------------- /sources/sections/uClibc++.build: -------------------------------------------------------------------------------- 1 | # Build and install uClibc++ 2 | 3 | CROSS= make defconfig && 4 | sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config && 5 | sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config || dienow 6 | if [ ! -z "$ELF2FLT" ] 7 | then 8 | sed -i 's/.*\(BUILD_ONLY_STATIC_LIB\).*/\1=y/' .config || dienow 9 | fi 10 | CROSS= make oldconfig && 11 | CROSS="$CC_PREFIX" make && 12 | CROSS= make install PREFIX="$STAGE_DIR/c++" && 13 | 14 | # Move libraries somewhere useful. 15 | 16 | mv "$STAGE_DIR"/c++/lib/* "$STAGE_DIR"/lib && 17 | rm -rf "$STAGE_DIR"/c++/{lib,bin} && 18 | ln -s libuClibc++.so "$STAGE_DIR"/lib/libstdc++.so && 19 | ln -s libuClibc++.a "$STAGE_DIR"/lib/libstdc++.a 20 | -------------------------------------------------------------------------------- /sources/patches/binutils-screwinfo.patch: -------------------------------------------------------------------------------- 1 | The binutils build notices that makeinfo is missing, but fails anyway, breaking 2 | the build. Make it stop. 3 | 4 | The "info" file format is obsolete (similar to "gopher"), was never used 5 | by anyone but the FSF, and failed to even replace man pages (which are 6 | now available in HTML). 7 | 8 | --- binutils-2.18/missing 2005-07-13 20:24:56.000000000 -0500 9 | +++ binutils-2.18/missing 2008-08-11 02:05:47.000000000 -0500 10 | @@ -299,7 +299,7 @@ 11 | fi 12 | # If the file does not exist, the user really needs makeinfo; 13 | # let's fail without touching anything. 14 | - test -f $file || exit 1 15 | + test -f $file || exit 0 16 | touch $file 17 | ;; 18 | 19 | -------------------------------------------------------------------------------- /more/smoketest-report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . sources/utility_functions.sh || exit 1 4 | 5 | # Test all architctures to see whether or not they can compile and run 6 | # the included "hello world" program. 7 | 8 | echo "Architecture,Smoketest,Control Image,Build Stage" 9 | 10 | for i in $(ls sources/targets | sed 's@.*/@@') 11 | do 12 | [ ! -f "sources/targets/$i" ] && continue 13 | 14 | echo -n "$i," 15 | 16 | grep -q 'Hello world!' build/logs/smoketest-$i.txt 2>/dev/null && 17 | echo -n "PASS," || echo -n "FAIL," 18 | 19 | [ -e "build/dropbearmulti-$i" ] && 20 | echo -n "PASS," || echo -n "FAIL," 21 | 22 | echo $( 23 | sed -n 's/^=== \([^(]*\)([^ ]* \(.*\))/\2 \1/p' \ 24 | build/logs/build-$i.txt | tail -n 1 ) 25 | done 26 | -------------------------------------------------------------------------------- /sources/patches/uClibc++-norelpath.patch: -------------------------------------------------------------------------------- 1 | If /.config exists and is a directory (thanks Trolltech) the build dies because -include $(TOPDIR).config is not an absolute path so it falls back to the search path and finds /usr/include/../../.config 2 | diff -ru uClibc++/extra/config/Makefile uClibc++.bak/extra/config/Makefile 3 | --- uClibc++/extra/config/Makefile 2007-06-03 17:51:13.000000000 -0500 4 | +++ uClibc++.bak/extra/config/Makefile 2012-08-17 12:37:25.571361853 -0500 5 | @@ -16,7 +16,7 @@ 6 | # along with this program; if not, write to the Free Software Foundation, Inc., 7 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 8 | 9 | -TOPDIR=../../ 10 | +TOPDIR=$(shell readlink -f ../..)/ 11 | include $(TOPDIR)Rules.mak 12 | 13 | all: ncurses conf mconf 14 | -------------------------------------------------------------------------------- /sources/patches/uClibc-fixm68k.patch: -------------------------------------------------------------------------------- 1 | Avoid an internal compiler error in inet_ntoa.c for m68k. 2 | 3 | --- uClibc.bak/Rules.mak 2012-04-11 12:04:21.000000000 -0500 4 | +++ uClibc/Rules.mak 2012-04-18 23:56:18.746334332 -0500 5 | @@ -226,6 +226,7 @@ 6 | 7 | OPTIMIZATION:= 8 | # Use '-Os' optimization if available, else use -O2, allow Config to override 9 | +ifneq ($(TARGET_ARCH),m68k) 10 | $(eval $(call check-gcc-var,-Os)) 11 | ifneq ($(CFLAG_-Os),) 12 | OPTIMIZATION += $(CFLAG_-Os) 13 | @@ -233,6 +234,7 @@ 14 | $(eval $(call check-gcc-var,-O2)) 15 | OPTIMIZATION += $(CFLAG_-O2) 16 | endif 17 | +endif 18 | # Use the gcc 3.4 -funit-at-a-time optimization when available 19 | $(eval $(call check-gcc-var,-funit-at-a-time)) 20 | OPTIMIZATION += $(CFLAG_-funit-at-a-time) 21 | -------------------------------------------------------------------------------- /sources/patches/musl-mips.patch: -------------------------------------------------------------------------------- 1 | Workaround for binutils 2.17 linking things on mips in a way musl doesn't like. 2 | 3 | diff --git a/arch/mips/crt_arch.h b/arch/mips/crt_arch.h 4 | index 21e139b..f4ba02a 100644 5 | --- a/arch/mips/crt_arch.h 6 | +++ b/arch/mips/crt_arch.h 7 | @@ -4,13 +4,16 @@ __asm__( 8 | ".text \n" 9 | ".global _" START "\n" 10 | ".global " START "\n" 11 | +".global " START "_data\n" 12 | ".type _" START ", @function\n" 13 | ".type " START ", @function\n" 14 | +".type " START "_data, @function\n" 15 | "_" START ":\n" 16 | "" START ":\n" 17 | " bal 1f \n" 18 | " move $fp, $0 \n" 19 | -"2: .gpword 2b \n" 20 | +"" START "_data: \n" 21 | +" .gpword " START "_data \n" 22 | " .gpword " START "_c \n" 23 | ".weak _DYNAMIC \n" 24 | ".hidden _DYNAMIC \n" 25 | -------------------------------------------------------------------------------- /sources/root-filesystem/sbin/record-commands: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set up command recording wrapper 4 | 5 | [ -z "$WRAPDIR" ] && WRAPDIR=/tmp/record-commands 6 | [ -z "$WRAPPY_LOGPATH" ] && 7 | export WRAPPY_LOGPATH=/tmp/record-commands-log.txt 8 | 9 | if [ $# -eq 0 ] 10 | then 11 | echo "Usage: record-commands command..." 12 | echo "Then examine $WRAPPY_LOGPATH" 13 | exit 1 14 | fi 15 | 16 | mkdir -p "$WRAPDIR" && 17 | ln -s $(which record-commands-wrapper) "$WRAPDIR" || exit 1 18 | 19 | echo "$PATH" | sed 's/:/\n/g' | while read DIR 20 | do 21 | find "$DIR/" -maxdepth 1 -mindepth 1 | sed 's@.*/@@' | while read FILE 22 | do 23 | ln -s record-commands-wrapper "$WRAPDIR/$FILE" 2>/dev/null 24 | done 25 | done 26 | 27 | OLDPATH="$PATH" PATH="$WRAPDIR:$PATH" "$@" 28 | rm -rf "$WRAPDIR" 29 | -------------------------------------------------------------------------------- /sources/patches/bash-fixsize.patch: -------------------------------------------------------------------------------- 1 | George Bodreau noticed that bash uses size rather than $ARCH-size, which can go 2 | "boing" on unrecognized file formats. The use here is purely cosmetic, so 3 | yank it to avoid problems. 4 | 5 | --- bash-old/Makefile.in 2002-05-31 13:44:23.000000000 -0400 6 | +++ bash-2.05b/Makefile.in 2007-04-17 17:25:19.000000000 -0400 7 | @@ -471,7 +471,6 @@ 8 | $(RM) $@ 9 | $(PURIFY) $(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS) 10 | ls -l $(Program) 11 | - size $(Program) 12 | 13 | .build: $(SOURCES) config.h Makefile version.h $(VERSPROG) 14 | @echo 15 | @@ -493,7 +492,6 @@ 16 | strip: $(Program) .made 17 | strip $(Program) 18 | ls -l $(Program) 19 | - size $(Program) 20 | 21 | lint: 22 | ${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made 23 | -------------------------------------------------------------------------------- /sources/targets/i486: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | An i486 based computer. 3 | 4 | Yes it's obsolete, but there are embedded processors that use it. The 5 | existance of an FPU is assumed, even though some i486s don't have one. 6 | This is simply coz i486s with no FPU are not of interest to me. Someone 7 | else can fix that if they care. 8 | 9 | Produced and tested by David Seikel. 10 | " 11 | 12 | KARCH=i386 13 | KERNEL_PATH=arch/${KARCH}/boot/bzImage 14 | BINUTILS_FLAGS= 15 | GCC_FLAGS= 16 | QEMU_TEST=$KARCH 17 | 18 | CONSOLE=ttyS0 19 | 20 | LINUX_CONFIG=" 21 | CONFIG_M486=y 22 | CONFIG_ACPI=y 23 | CONFIG_BLK_DEV_PIIX=y 24 | CONFIG_NETDEV_1000=y 25 | CONFIG_E1000=y 26 | CONFIG_SERIAL_8250=y 27 | CONFIG_SERIAL_8250_CONSOLE=y 28 | " 29 | 30 | emulator_command() 31 | { 32 | echo qemu-system-i386 -cpu 486 $(qemu_defaults "$@") 33 | } 34 | -------------------------------------------------------------------------------- /sources/patches/linux-powerpc-bamboo.patch: -------------------------------------------------------------------------------- 1 | The bamboo target unconditionally builds uboot, which adds additional 2 | build prerequisites, but qemu cam boot from vlinux just fine. 3 | 4 | diff -ruN linux/arch/powerpc/boot/Makefile linux.bak/arch/powerpc/boot/Makefile 5 | --- linux/arch/powerpc/boot/Makefile 2015-08-30 13:34:09.000000000 -0500 6 | +++ linux.bak/arch/powerpc/boot/Makefile 2016-01-06 16:51:31.958735214 -0600 7 | @@ -239,7 +239,7 @@ 8 | 9 | # Board ports in arch/powerpc/platform/44x/Kconfig 10 | image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 11 | -image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 12 | +image-$(CONFIG_BAMBOO) += treeImage.bamboo #cuImage.bamboo 13 | image-$(CONFIG_SAM440EP) += cuImage.sam440ep 14 | image-$(CONFIG_SEQUOIA) += cuImage.sequoia 15 | image-$(CONFIG_RAINIER) += cuImage.rainier 16 | -------------------------------------------------------------------------------- /more/cross-smoke-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Perform a smoke test on a target's cross compiler by building "hello world" 4 | # and attempting to run it under QEMU application emulation. 5 | 6 | source sources/include.sh && load_target "$1" || exit 1 7 | 8 | # Build statically linked hello world, if necessary 9 | 10 | if [ ! -e "$WORK/hello" ] 11 | then 12 | "${ARCH}-gcc" -Os -static "${SOURCES}/toys/hello.c" -o "$WORK"/hello 13 | 14 | if [ $? -ne 0 ] 15 | then 16 | echo "Compiler doesn't seem to work" >&2 17 | dienow 18 | fi 19 | fi 20 | 21 | # Attempt to run statically linked hello world 22 | 23 | RESULT="$(PATH="$OLDPATH" qemu-"$QEMU_TEST" "$WORK/hello")" 24 | if [ "$RESULT" == "Hello world!" ] 25 | then 26 | echo "Cross toolchain seems to work." 27 | exit 0 28 | else 29 | echo "Can't run hello world" >&2 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /sources/sections/ccwrap.sh: -------------------------------------------------------------------------------- 1 | # build and install gcc wrapper 2 | 3 | # Which compiler do we build the wrapper with, and should it be static? 4 | 5 | [ "$BUILD_STATIC" == none ] && STATIC_FLAGS= || STATIC_FLAGS=--static 6 | [ -z "$HOST_ARCH" ] && TEMP="$CC" || TEMP="${HOST_ARCH}-cc" 7 | LIBC_TYPE=musl 8 | [ ! -z "$UCLIBC_CONFIG" ] && [ -z "$MUSL" ] && LIBC_TYPE=uClibc 9 | 10 | # Build wrapper binary 11 | 12 | mkdir -p "$STAGE_DIR/bin" && 13 | "$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \ 14 | -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS \ 15 | -DDYNAMIC_LINKER=\"/lib/ld-${LIBC_TYPE}.so.0\" \ 16 | ${ELF2FLT:+-DELF2FLT} && 17 | # ${HOST_ARCH:+${ELF2FLT:+-DELF2FLT}} && 18 | echo -e "#!/bin/bash\n\n${TOOLCHAIN_PREFIX}cc -E "'"$@"' \ 19 | > "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" && 20 | chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow 21 | -------------------------------------------------------------------------------- /more/record-commands.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source sources/include.sh || exit 1 4 | 5 | # Build a wrapper that records each command line the build runs out of the 6 | # host's $PATH, so we know exactly what commands the build uses. 7 | 8 | # (Note: this misses things called via absolute paths, such as the #!/bin/bash 9 | # at the start of shell scripts.) 10 | 11 | echo "=== Setting up command recording wrapper" 12 | 13 | [ -f "$WRAPDIR/wrappy" ] && PATH="$OLDPATH" 14 | [ -f "$HOSTTOOLS/toybox" ] && PATH="$(hosttools_path)" 15 | NO_CLEANUP= blank_tempdir "$WRAPDIR" 16 | 17 | # Populate a directory of symlinks with every command in the $PATH. 18 | 19 | echo 'Linking $PATH to '$WRAPDIR 20 | path_search "$PATH" "*" 'ln -s wrappy "$WRAPDIR/$FILE"' 2>/dev/null | dotprogress 21 | 22 | # Build the wrapper 23 | $CC -Os "$SOURCES/toys/wrappy.c" -o "$WRAPDIR/wrappy" || dienow 24 | -------------------------------------------------------------------------------- /sources/targets/i586: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | An i586 board, such as the original Pentium/Pentium Pro/Pentium II/Via Samuel 3 | 4 | This demonstrates how creating code which runs on the host can still be cross 5 | compiling, because the target may only support a subset of the host's 6 | instruction set. Thus target code runs on the host, but host code won't 7 | run on the target, so you still can't afford to leak context. 8 | " 9 | 10 | KARCH=i386 11 | KERNEL_PATH=arch/${KARCH}/boot/bzImage 12 | BINUTILS_FLAGS= 13 | GCC_FLAGS= 14 | QEMU_TEST=$KARCH 15 | 16 | CONSOLE=ttyS0 17 | 18 | LINUX_CONFIG=" 19 | CONFIG_M586=y 20 | CONFIG_ACPI=y 21 | CONFIG_BLK_DEV_PIIX=y 22 | CONFIG_NETDEV_1000=y 23 | CONFIG_E1000=y 24 | CONFIG_SERIAL_8250=y 25 | CONFIG_SERIAL_8250_CONSOLE=y 26 | " 27 | 28 | emulator_command() 29 | { 30 | echo qemu-system-i386 -cpu pentium $(qemu_defaults "$@") 31 | } 32 | -------------------------------------------------------------------------------- /sources/include.sh: -------------------------------------------------------------------------------- 1 | #!/bin/echo "This file is sourced, not run" 2 | 3 | # This is the top level include file sourced by each build stage. 4 | 5 | # Guard against multiple inclusion 6 | 7 | if ! already_included_this 2>/dev/null 8 | then 9 | alias already_included_this=true 10 | 11 | # Set up all the environment variables and functions for a build stage. 12 | 13 | source config 14 | source sources/utility_functions.sh 15 | source sources/functions.sh 16 | source sources/download_functions.sh 17 | source sources/variables.sh 18 | 19 | # Create files with known permissions 20 | umask 022 21 | 22 | # Tell bash not to cache the $PATH because we modify it. (Without this, bash 23 | # won't find new executables added after startup.) 24 | set +h 25 | 26 | # Disable internationalization so sort and sed and such can cope with ASCII. 27 | 28 | export LC_ALL=C 29 | 30 | fi # already_included_this 31 | -------------------------------------------------------------------------------- /sources/patches/uClibc-strndup.patch: -------------------------------------------------------------------------------- 1 | strndup() is posix-2008. Don't require defining "gnu gnu gnu GNU gnu GNU!!! gnu I invented oxygen gnu mine MINE mine GNU bwahahaha" to get the prototype. 2 | 3 | diff -ruN uClibc/include/string.h uClibc.bak/include/string.h 4 | --- uClibc/include/string.h 2012-05-15 02:20:09.000000000 -0500 5 | +++ uClibc.bak/include/string.h 2015-09-15 17:39:49.544614373 -0500 6 | @@ -152,11 +152,9 @@ 7 | /* Return a malloc'd copy of at most N bytes of STRING. The 8 | resultant string is terminated even if no null terminator 9 | appears before STRING[N]. */ 10 | -#if defined __USE_GNU 11 | extern char *strndup (__const char *__string, size_t __n) 12 | __THROW __attribute_malloc__ __nonnull ((1)); 13 | libc_hidden_proto(strndup) 14 | -#endif 15 | 16 | #if defined __USE_GNU && defined __GNUC__ 17 | /* Duplicate S, returning an identical alloca'd string. */ 18 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-xgcc.patch: -------------------------------------------------------------------------------- 1 | We drop an xgcc symlink so it doesn't rebuild xgcc. But if it ever does decide 2 | to overwrite it, that follows the symlink and either stomps the original file 3 | or build breaks because it's not writeable. So add an "rm -f" first. 4 | 5 | diff -ru gcc-core/gcc/Makefile.in gcc-core.bak/gcc/Makefile.in 6 | --- gcc-core/gcc/Makefile.in 2007-05-31 10:37:38.000000000 -0500 7 | +++ gcc-core.bak/gcc/Makefile.in 2015-10-06 08:55:39.060448638 -0500 8 | @@ -1311,6 +1311,7 @@ 9 | # and CC is `gcc'. It is renamed to `gcc' when it is installed. 10 | xgcc$(exeext): $(GCC_OBJS) gccspec.o version.o intl.o prefix.o \ 11 | version.o $(LIBDEPS) $(EXTRA_GCC_OBJS) 12 | + rm -f $@ && \ 13 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) gccspec.o \ 14 | intl.o prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS) 15 | 16 | Only in gcc-core.bak/gcc: .Makefile.in.swo 17 | Only in gcc-core.bak/gcc: .Makefile.in.swp 18 | -------------------------------------------------------------------------------- /sources/sections/toybox.build: -------------------------------------------------------------------------------- 1 | # Build toybox statically by default, but don't statically link against 2 | # glibc (during host-tools.sh build) because glibc is buggy and can't combine 3 | # --static with --gc-sections. See 4 | # http://elinux.org/images/2/2d/ELC2010-gc-sections_Denys_Vlasenko.pdf 5 | # for details 6 | 7 | # Build toybox 8 | 9 | for i in defconfig toybox \ 10 | $( [ -z "$BUSYBOX" ] && echo install$([ -z "$ARCH" ] && echo _flat) ) 11 | do 12 | PREFIX="$STAGE_DIR" CFLAGS="$CFLAGS $STATIC_FLAGS" CC= STRIP= \ 13 | make -j $CPUS $VERBOSITY $DO_CROSS $i || dienow 14 | done 15 | cp .config "$WORK"/config-toybox || dienow 16 | 17 | # We always need at least oneit 18 | 19 | if [ ! -z "$BUSYBOX" ] 20 | then 21 | ln -sf {$ARCH:+/usr/bin/}toybox "$STAGE_DIR/${ARCH:+sbin/}oneit" || dienow 22 | fi 23 | 24 | if [ ! -z "$SKIP_STRIP" ] 25 | then 26 | cp --remove-destination toybox_unstripped "$INSTDIR/toybox" || dienow 27 | fi 28 | -------------------------------------------------------------------------------- /more/smoketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script compiles stuff under the final system, using distcc to call out 4 | # to the cross compiler. It calls run-from-build with a here document. 5 | 6 | # Note that the first line of the script is a few spaces followed by a comment 7 | # character. This gives some harmless data for the linux boot process (serial 8 | # initialization) to consume and discard before it gets to the command prompt. 9 | # (The comment character is just so you can see how much got eaten.) 10 | 11 | # If you cat your own script into emulator-build.sh, you probably also need 12 | # to start with a line of spaces like that. Just FYI. 13 | 14 | sayhello() 15 | { 16 | sleep 10 17 | echo df 18 | sleep 1 19 | echo gcc -s /usr/src/thread-hello2.c -lpthread -o /tmp/hello 20 | sleep 5 21 | echo /tmp/hello 22 | sleep 1 23 | echo exit 24 | } 25 | sayhello | more/timeout.sh ${TIMEOUT:-60} more/run-emulator-from-build.sh "$1" 26 | -------------------------------------------------------------------------------- /sources/patches/musl-regex.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c 2 | index 978dd87..d7e7a9c 100644 3 | --- a/src/regex/regcomp.c 4 | +++ b/src/regex/regcomp.c 5 | @@ -1008,13 +1008,18 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx) 6 | nbranch = tre_ast_new_catenation(ctx->mem, nbranch, ctx->n); 7 | if ((ere && *s == '|') || 8 | (ere && *s == ')' && depth) || 9 | - (!ere && *s == '\\' && s[1] == ')') || 10 | + (!ere && *s == '\\' && (s[1] == ')' || s[1] == '|')) || 11 | !*s) { 12 | /* extension: empty branch is unspecified (), (|a), (a|) 13 | here they are not rejected but match on empty string */ 14 | int c = *s; 15 | nunion = tre_ast_new_union(ctx->mem, nunion, nbranch); 16 | nbranch = 0; 17 | + 18 | + if (c == '\\' && s[1] == '|') { 19 | + s++; 20 | + c = '|'; 21 | + } 22 | if (c != '|') { 23 | if (c == '\\') { 24 | if (!depth) return REG_EPAREN; 25 | -------------------------------------------------------------------------------- /sources/root-filesystem/sbin/zapchroot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2010 Rob Landley licensed under GPLv2 4 | 5 | if [ "$1" == "-d" ] 6 | then 7 | DELETE=1 8 | shift 9 | fi 10 | 11 | # Clean up a chroot directory 12 | 13 | ZAP=$(readlink -f "$1" 2>/dev/null) 14 | 15 | if [ ! -d "$ZAP" ] 16 | then 17 | echo "usage: zapchroot [-d] dirname" 18 | exit 1 19 | fi 20 | 21 | i="$(readlink -f "$(pwd)")" 22 | if [ "$ZAP" == "${i:0:${#ZAP}}" ] 23 | then 24 | echo "Sanity check failed: cwd is under zapdir" >&2 25 | exit 1 26 | fi 27 | 28 | # Iterate through the second entry of /proc/mounts in reverse order 29 | 30 | for i in $(awk '{print $2}' /proc/mounts | tac) 31 | do 32 | # De-escape octal versions of space, tab, backslash, newline... 33 | i=$(echo -e "$i") 34 | 35 | # Skip entries that aren't under our chroot 36 | [ "$ZAP" != "${i:0:${#ZAP}}" ] && continue 37 | 38 | echo "Umounting: $i" 39 | umount "$i" 40 | done 41 | -------------------------------------------------------------------------------- /sources/patches/linux-powerpc-altivec.patch: -------------------------------------------------------------------------------- 1 | After commit ef1313deafb7 attempting to build xor_vmx.c died with: 2 | 3 | In file included from include/linux/thread_info.h:10, 4 | from include/linux/preempt.h:9, 5 | from arch/powerpc/lib/xor_vmx.c:22: 6 | include/linux/types.h:29: error: both 'unsigned' and '_Bool' in declaration specifiers 7 | 8 | Because gcc's altivec.h was #defining bool to __bool and then the kernel was 9 | trying to typedef bool later. Out of morbid curiosity I tried copying a 2012 10 | version of the header, and it made no difference. 11 | 12 | diff --git a/arch/powerpc/lib/xor_vmx.c b/arch/powerpc/lib/xor_vmx.c 13 | index e905f7c..fbb1e2c 100644 14 | --- a/arch/powerpc/lib/xor_vmx.c 15 | +++ b/arch/powerpc/lib/xor_vmx.c 16 | @@ -18,6 +18,7 @@ 17 | * Author: Anton Blanchard 18 | */ 19 | #include 20 | +#undef bool 21 | 22 | #include 23 | #include 24 | -------------------------------------------------------------------------------- /sources/sections/linux-headers.sh: -------------------------------------------------------------------------------- 1 | # Install Linux kernel headers. 2 | 3 | setupfor linux 4 | 5 | # Expand and copy kernel .config. 6 | 7 | getconfig linux > mini.conf && 8 | [ "$SYSIMAGE_TYPE" == "initramfs" ] && 9 | echo "CONFIG_BLK_DEV_INITRD=y" >> mini.conf 10 | 11 | make ARCH=${BOOT_KARCH:-$KARCH} KCONFIG_ALLCONFIG=mini.conf $LINUX_FLAGS \ 12 | $VERBOSITY allnoconfig >/dev/null && 13 | mkdir -p "$STAGE_DIR/src" && 14 | cp .config "$STAGE_DIR/src/config-linux" 15 | 16 | 17 | # Install Linux kernel headers (for use by uClibc). 18 | make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="$STAGE_DIR" \ 19 | $VERBOSITY && 20 | # This makes some very old package builds happy. 21 | [ ! -e "$STAGE_DIR/include/asm/page.h" ] && 22 | ln -sf ../sys/user.h "$STAGE_DIR/include/asm/page.h" 23 | 24 | cleanup 25 | 26 | # Remove debris the kernel puts in there for no apparent reason. 27 | 28 | find "$STAGE_DIR/include" -name ".install" -print0 -or -name "..install.cmd" -print0 | xargs -0 rm 29 | -------------------------------------------------------------------------------- /sources/patches/uClibc-shutupldd.patch: -------------------------------------------------------------------------------- 1 | Prevent ldd from emitting a lot of spurious noise other implementations don't. 2 | 3 | diff -ru uClibc/utils/ldd.c uClibc.bak/utils/ldd.c 4 | --- uClibc/utils/ldd.c 2011-06-08 14:35:20.000000000 -0500 5 | +++ uClibc.bak/utils/ldd.c 2011-09-15 16:20:48.739165013 -0500 6 | @@ -263,7 +263,7 @@ 7 | return 0; 8 | 9 | if (stat(LDSO_CACHE, &st) || (fd = open(LDSO_CACHE, O_RDONLY)) < 0) { 10 | - fprintf(stderr, "ldd: can't open cache '%s'\n", LDSO_CACHE); 11 | + //fprintf(stderr, "ldd: can't open cache '%s'\n", LDSO_CACHE); 12 | cache_addr = (caddr_t) - 1; /* so we won't try again */ 13 | return -1; 14 | } 15 | @@ -773,7 +773,7 @@ 16 | for (cur = lib_list; cur; cur = cur->next) { 17 | if (cur->resolved == 0 && cur->path) { 18 | got_em_all = 1; 19 | - printf("checking sub-depends for '%s'\n", cur->path); 20 | + // printf("checking sub-depends for '%s'\n", cur->path); 21 | find_dependencies(cur->path); 22 | cur->resolved = 1; 23 | } 24 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-stopdefaults.patch: -------------------------------------------------------------------------------- 1 | The ./configure stage of gcc is really stupid, if you have a cross compiler 2 | installed on the host it'll sometimes find the linker out of it and make 3 | the new cc call the old ld, for no apparent reason. (Can we say version skew?) 4 | 5 | diff -ru gcc-core/gcc/configure gcc-core2/gcc/configure 6 | --- gcc-core/gcc/configure 2007-01-01 21:44:31.000000000 -0600 7 | +++ gcc-core2/gcc/configure 2014-01-05 10:43:10.245563728 -0600 8 | @@ -13294,7 +13294,7 @@ 9 | : 10 | else 11 | 12 | -if test -x "$DEFAULT_ASSEMBLER"; then 13 | +if test -x "$DEFAULT_ASSEMBLER" && false; then 14 | gcc_cv_as="$DEFAULT_ASSEMBLER" 15 | elif test -f $gcc_cv_as_gas_srcdir/configure.in \ 16 | && test -f ../gas/Makefile \ 17 | @@ -13410,7 +13410,7 @@ 18 | : 19 | else 20 | 21 | -if test -x "$DEFAULT_LINKER"; then 22 | +if test -x "$DEFAULT_LINKER" && false; then 23 | gcc_cv_ld="$DEFAULT_LINKER" 24 | elif test -f $gcc_cv_ld_gld_srcdir/configure.in \ 25 | && test -f ../ld/Makefile \ 26 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-softfloat-fix.patch: -------------------------------------------------------------------------------- 1 | diff -ru gcc.bak/gcc/config.gcc gcc-4.1.2/gcc/config.gcc 2 | --- gcc.bak/gcc/config.gcc 2006-10-15 19:12:23.000000000 -0400 3 | +++ gcc-4.1.2/gcc/config.gcc 2007-07-04 21:07:42.000000000 -0400 4 | @@ -685,7 +685,7 @@ 5 | default_use_cxa_atexit=yes 6 | ;; 7 | *) 8 | - tmake_file="$tmake_file arm/t-linux" 9 | + tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" 10 | ;; 11 | esac 12 | tm_file="$tm_file arm/aout.h arm/arm.h" 13 | diff -ru gcc.bak/gcc/config/arm/linux-elf.h gcc-4.1.2/gcc/config/arm/linux-elf.h 14 | --- gcc.bak/gcc/config/arm/linux-elf.h 2005-10-09 21:04:31.000000000 -0400 15 | +++ gcc-4.1.2/gcc/config/arm/linux-elf.h 2007-07-04 21:07:42.000000000 -0400 16 | @@ -49,7 +49,7 @@ 17 | %{shared:-lc} \ 18 | %{!shared:%{profile:-lc_p}%{!profile:-lc}}" 19 | 20 | -#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" 21 | +#define LIBGCC_SPEC "-lgcc" 22 | 23 | #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" 24 | 25 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-libgcceh.patch: -------------------------------------------------------------------------------- 1 | --- gcc-4.2.1/gcc/mklibgcc.in 2006-07-04 15:20:01.000000000 -0500 2 | +++ gcc-core/gcc/mklibgcc.in 2009-08-21 21:51:35.000000000 -0500 3 | @@ -223,8 +223,8 @@ 4 | if [ "$LIBUNWIND" ]; then 5 | libunwind_a=$dir/libunwind.a 6 | fi 7 | + libgcc_eh_a=$dir/libgcc_eh.a 8 | if [ "$SHLIB_LINK" ]; then 9 | - libgcc_eh_a=$dir/libgcc_eh.a 10 | libgcc_s_so=$dir/libgcc_s${SHLIB_EXT} 11 | if [ "$LIBUNWIND" ]; then 12 | libunwind_so=$dir/libunwind${SHLIB_EXT} 13 | @@ -889,11 +889,11 @@ 14 | echo ' chmod 644' ${ldir}/libgcov.a 15 | echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a 16 | 17 | - if [ "$SHLIB_LINK" ]; then 18 | echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/ 19 | echo ' chmod 644' ${ldir}/libgcc_eh.a 20 | echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a 21 | 22 | + if [ "$SHLIB_LINK" ]; then 23 | shlib_slibdir_qual= 24 | os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory` 25 | if [ "$os_multilib_dir" != . ]; then 26 | -------------------------------------------------------------------------------- /more/smoketest-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run smoketest script on every build/system-image-* architecture. 4 | 5 | # If $FORK is set, run them in parallel. 6 | 7 | [ -z "$FORK" ] || TIMEOUT=${TIMEOUT:-180} 8 | 9 | . sources/utility_functions.sh || exit 1 10 | 11 | function dotest() 12 | { 13 | [ -z "$FORK" ] && echo -n "Testing $1:" 14 | [ ! -z "$VERBOSE" ] && VERBOSITY="tee >(cat >&2) |" 15 | RESULT="$(more/smoketest.sh "$1" 2>&1 | eval "$VERBOSITY grep 'Hello world!'")" 16 | [ -z "$RESULT" ] && RESULT="FAIL" || RESULT="PASS" 17 | [ -z "$FORK" ] && echo "$RESULT" || echo "Testing $1:$RESULT" 18 | rm -f build/system-image-"$1"/hdb.img 2>/dev/null 19 | } 20 | 21 | # Test all non-hw targets to see whether or not they can compile and run 22 | # the included "hello world" program. 23 | 24 | for i in $(ls -d sources/targets/* | sed 's@.*/@@' | grep -v "^hw-") 25 | do 26 | if [ -e "build/system-image-$i" ] 27 | then 28 | maybe_fork "dotest $i" 29 | else 30 | echo "Testing $i:NONE" 31 | fi 32 | done 33 | 34 | wait 35 | -------------------------------------------------------------------------------- /more/repo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Populate a few source control directories. If they exist, they'll be used 4 | # instead of source tarballs. (Note: if you want to apply patches you'll have 5 | # to do it yourself, sources/patches only applies to tarballs.) 6 | 7 | mkdir -p packages && 8 | if [ ! -d packages/busybox ] 9 | then 10 | git clone git://busybox.net/busybox packages/busybox || exit 1 11 | else 12 | (cd packages/busybox && git pull) || exit 1 13 | fi 14 | 15 | if [ ! -d packages/uClibc ] 16 | then 17 | git clone git://uclibc.org/uClibc packages/uClibc 18 | else 19 | (cd packages/uClibc && git pull) || exit 1 20 | fi 21 | 22 | if [ ! -d packages/linux ] 23 | then 24 | git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 \ 25 | packages/linux || exit 1 26 | else 27 | (cd packages/linux && git pull) || exit 1 28 | fi 29 | 30 | if [ ! -d packages/toybox ] 31 | then 32 | hg clone http://landley.net/hg/toybox packages/toybox || exit 1 33 | else 34 | (cd packages/toybox && hg pull -u) || exit 1 35 | fi 36 | -------------------------------------------------------------------------------- /sources/patches/uClibc-fixlocalestruct.patch: -------------------------------------------------------------------------------- 1 | diff -ruN uClibc/libc/sysdeps/linux/common/bits/uClibc_locale.h uClibc.bak/libc/sysdeps/linux/common/bits/uClibc_locale.h 2 | --- uClibc/libc/sysdeps/linux/common/bits/uClibc_locale.h 2010-04-02 10:34:27.000000000 -0500 3 | +++ uClibc.bak/libc/sysdeps/linux/common/bits/uClibc_locale.h 2010-11-10 15:11:31.000000000 -0600 4 | @@ -41,11 +41,9 @@ 5 | 6 | # define __LOCALE_C_ONLY 7 | 8 | -# ifdef _LIBC 9 | # define __XL_NPP(N) N 10 | # define __LOCALE_PARAM 11 | # define __LOCALE_ARG 12 | -# endif 13 | 14 | #endif 15 | 16 | @@ -90,8 +88,6 @@ 17 | struct __uclibc_locale_struct; 18 | typedef struct __uclibc_locale_struct *__locale_t; 19 | 20 | -#ifdef _LIBC 21 | - 22 | /* extern void _locale_set(const unsigned char *p); */ 23 | /* extern void _locale_init(void); */ 24 | 25 | @@ -367,8 +363,6 @@ 26 | #endif 27 | /**********************************************************************/ 28 | 29 | -#endif /* _LIBC */ 30 | - 31 | #endif /* !defined(__LOCALE_C_ONLY) */ 32 | 33 | #endif /* _UCLIBC_LOCALE_H */ 34 | -------------------------------------------------------------------------------- /sources/targets/sparc: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | 32-bit sparc 3 | 4 | Sparc was a risc processor design Sun Microsystems came up with to replace 5 | m68k in their Unix workstations. With the advent of OpenSolaris and 6 | x86-64, Fujitsu mainframes may now use more of it than they do. 7 | 8 | This has been broken for a couple years, and nobody's bothered to fix it. 9 | " 10 | 11 | # Originally contributed by Bertl. 12 | 13 | KARCH=sparc 14 | KERNEL_PATH=arch/${KARCH}/boot/image 15 | BINUTILS_FLAGS= 16 | GCC_FLAGS= 17 | QEMU_TEST=$KARCH 18 | 19 | #BUILD_STATIC=all 20 | 21 | CONSOLE=ttyS0 22 | 23 | UCLIBC_CONFIG=" 24 | TARGET_sparc=y 25 | UCLIBC_HAS_FPU=y 26 | FORCE_SHAREABLE_TEXT_SEGMENTS=y 27 | " 28 | 29 | LINUX_CONFIG=" 30 | CONFIG_SCSI_SUNESP=y 31 | CONFIG_SUNLANCE=y 32 | CONFIG_SERIAL_SUNZILOG=y 33 | CONFIG_SERIAL_SUNZILOG_CONSOLE=y 34 | CONFIG_SUN_MOSTEK_RTC=y 35 | " 36 | 37 | #CONFIG_UNWIND_INFO 38 | #CONFIG_FORCED_INLINING 39 | #CONFIG_RTC_HCTOSYS 40 | 41 | emulator_command() 42 | { 43 | echo qemu-system-sparc -cpu '"Fujitsu MB86907"' $(qemu_defaults "$@") 44 | } 45 | -------------------------------------------------------------------------------- /sources/targets/powerpc-440fp: -------------------------------------------------------------------------------- 1 | DESCRIPTION="Power PC 440, with hardware floating point." 2 | 3 | GCC_FLAGS="--with-cpu=440fp --with-tune=440fp --enable-secureplt ${GCC_FLAGS}" 4 | BINUTILS_FLAGS="--with-cpu=440fp --with-tune=440fp" 5 | CROSS_TARGET=powerpc-unknown-linux 6 | KARCH=powerpc 7 | KERNEL_PATH=vmlinux 8 | CONSOLE=ttyS0 9 | 10 | # LINUX_CONFIG and emulator_command aren't correct, qemu should use -M bamboo 11 | # and the kernel config should be a variant of 44x/bamboo_defconfig. 12 | # Unfortunately that's hardwired to require an external project (uboot), and 13 | # the vmlinux won't boot without a device tree binary. TODO item. 14 | 15 | LINUX_CONFIG=" 16 | CONFIG_44x=y 17 | CONFIG_CROSS_MEMORY_ATTACH=y 18 | # CONFIG_EMBEDDED is not set 19 | CONFIG_BAMBOO=y 20 | #CONFIG_STDBINUTILS=y 21 | #CONFIG_CMDLINE_BOOL=y 22 | #CONFIG_CMDLINE="" 23 | CONFIG_SERIO_SERPORT=y 24 | CONFIG_SERIAL_8250=y 25 | CONFIG_SERIAL_8250_CONSOLE=y 26 | CONFIG_SERIAL_OF_PLATFORM=y 27 | #CONFIG_IOMMU_SUPPORT=y 28 | " 29 | 30 | emulator_command() 31 | { 32 | echo qemu-system-ppc -M bamboo $(qemu_defaults "$@") 33 | } 34 | -------------------------------------------------------------------------------- /sources/patches/linux-sh4-fixifconfig.patch: -------------------------------------------------------------------------------- 1 | Revert a broken commit that makes ifconfig panic the kernel. 2 | 3 | commit 3f9b8520b06013939ad247ba08b69529b5f14be1 4 | Author: Paul Mundt 5 | Date: Tue May 31 14:38:29 2011 +0900 6 | 7 | sh64: Move from P1SEG to CAC_ADDR for consistent sync. 8 | 9 | sh64 doesn't define a P1SEGADDR, resulting in a build failure. The proper 10 | mapping can be attained for both sh32 and 64 via the CAC_ADDR macro, so 11 | switch to that instead. 12 | 13 | Signed-off-by: Paul Mundt 14 | 15 | diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c 16 | index 40733a9..f251b5f 100644 17 | --- a/arch/sh/mm/consistent.c 18 | +++ b/arch/sh/mm/consistent.c 19 | @@ -82,7 +82,7 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 20 | void *addr; 21 | 22 | addr = __in_29bit_mode() ? 23 | - (void *)CAC_ADDR((unsigned long)vaddr) : vaddr; 24 | + (void *)P1SEGADDR((unsigned long)vaddr) : vaddr; 25 | 26 | switch (direction) { 27 | case DMA_FROM_DEVICE: /* invalidate only */ 28 | -------------------------------------------------------------------------------- /sources/patches/uClibc-headerdep.patch: -------------------------------------------------------------------------------- 1 | The uClibc build isn't quite happy with -j builds because it tries to use headers before they're all the way there. 2 | 3 | diff -ru uClibc/Makefile.in uClibc.bak/Makefile.in 4 | --- uClibc/Makefile.in 2012-05-15 02:20:09.000000000 -0500 5 | +++ uClibc.bak/Makefile.in 2012-10-08 18:52:41.697432235 -0500 6 | @@ -195,7 +195,7 @@ 7 | HOSTCC="$(HOSTCC)" \ 8 | install 9 | 10 | -install: install_runtime install_dev 11 | +install: install_headers install_runtime install_dev 12 | 13 | 14 | RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)$(MULTILIB_DIR) $(RUNTIME_PREFIX)$(MULTILIB_DIR)) 15 | @@ -303,7 +303,7 @@ 16 | $(do_mkdir) 17 | endif 18 | endif 19 | -install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)include 20 | +install_headers: pregen $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)include 21 | @$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)include") 22 | $(Q)top_builddir=$(top_builddir) \ 23 | $(top_srcdir)extra/scripts/install_headers.sh \ 24 | -------------------------------------------------------------------------------- /more/report-recorded-commands.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # List the commands used to build each architecture. 4 | 5 | # If given an argument it's the architecture to compare others against, 6 | # which shows just the extra commands used by those other architectures. 7 | 8 | # Mines the output created by build.sh after record-commands.sh. 9 | 10 | COMPARE="$1" 11 | 12 | # Output the list of commands used in a command log. 13 | 14 | function mine_commands() 15 | { 16 | awk '{print $1}' build/logs/cmdlines.$1.* | sort -u 17 | } 18 | 19 | # Iterate through architectures 20 | 21 | for i in `ls -1 build/logs/cmdlines.* | sed 's@.*/cmdlines\.\([^.]*\).*@\1@' | sort -u` 22 | do 23 | [ "$COMPARE" == "$i" ] && continue 24 | 25 | # Start of new group, announce build stage we're looking at. 26 | echo 27 | echo -n Checking $i: 28 | 29 | if [ -z "$COMPARE" ] 30 | then 31 | # Show all commands in first architecture. 32 | echo $(mine_commands $i) 33 | else 34 | # Show commands that differ from first architecture (if any). 35 | echo $(sort <(mine_commands $COMPARE) <(mine_commands $i) | uniq -u) 36 | fi 37 | done 38 | -------------------------------------------------------------------------------- /sources/patches/toybox-grep.patch: -------------------------------------------------------------------------------- 1 | Toybox grep on a directory hits a uClibc bug and segfaults. This bug does not 2 | happen in glibc, musl, or bionic, so it's not worth adding a workaround 3 | upstream. 4 | 5 | diff --git a/toys/posix/grep.c b/toys/posix/grep.c 6 | index d44a92d..b9c2def 100644 7 | --- a/toys/posix/grep.c 8 | +++ b/toys/posix/grep.c 9 | @@ -63,7 +63,8 @@ GLOBALS( 10 | // Show matches in one file 11 | static void do_grep(int fd, char *name) 12 | { 13 | - FILE *file = fdopen(fd, "r"); 14 | + struct stat *st = (void *)(toybuf+sizeof(regex_t)); 15 | + FILE *file = 0; 16 | long offset = 0; 17 | int lcount = 0, mcount = 0; 18 | char indelim = '\n' * !(toys.optflags&FLAG_z), 19 | @@ -71,8 +72,13 @@ static void do_grep(int fd, char *name) 20 | 21 | if (!fd) name = "(standard input)"; 22 | 23 | + if (!fstat(fd, st)) { 24 | + // grep * hits directories, skip but don't treat them as errors. 25 | + if (S_ISDIR(st->st_mode)) errno = 0; 26 | + else file = fdopen(fd, "r"); 27 | + } 28 | if (!file) { 29 | - perror_msg("%s", name); 30 | + if (errno) perror_msg("%s", name); 31 | return; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /sources/patches/linux-shutup.patch: -------------------------------------------------------------------------------- 1 | Modern kernels crap asynchronus messages over the serial console after lauching init, hiding the shell prompt. Silence two of them. 2 | 3 | diff -ru linux/drivers/net/ethernet/intel/e1000/e1000_main.c linux.bak/drivers/net/ethernet/intel/e1000/e1000_main.c 4 | --- linux/drivers/net/ethernet/intel/e1000/e1000_main.c 2014-06-08 13:19:54.000000000 -0500 5 | +++ linux.bak/drivers/net/ethernet/intel/e1000/e1000_main.c 2014-09-06 20:55:29.974299985 -0500 6 | @@ -2426,7 +2426,7 @@ 7 | &adapter->link_duplex); 8 | 9 | ctrl = er32(CTRL); 10 | - pr_info("%s NIC Link is Up %d Mbps %s, " 11 | + pr_debug("%s NIC Link is Up %d Mbps %s, " 12 | "Flow Control: %s\n", 13 | netdev->name, 14 | adapter->link_speed, 15 | diff --git a/drivers/char/random.c b/drivers/char/random.c 16 | index d0da5d8..085ec6a 100644 17 | --- a/drivers/char/random.c 18 | +++ b/drivers/char/random.c 19 | @@ -681,7 +681,7 @@ retry: 20 | prandom_reseed_late(); 21 | process_random_ready_list(); 22 | wake_up_all(&urandom_init_wait); 23 | - pr_notice("random: %s pool is initialized\n", r->name); 24 | + pr_debug("random: %s pool is initialized\n", r->name); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /cross-compiler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build a more advanced cross compiler, including thread support and uClibc++, 4 | # built --with-shared (which produces libgcc_s.so), statically linked 5 | # against uClibc on the host (for portability), and including the $TARGET-ldd 6 | # and $TARGET-ldconfig utilities. 7 | 8 | # Building this requires two existing (simple) cross compilers: one for 9 | # the host (to build the executables) and one for the target (to build 10 | # the libraries). 11 | 12 | # This is a simple wrapper for native-compiler.sh, we re-use the canadian 13 | # cross infrastructure in there to build a very similar compiler. 14 | 15 | . sources/include.sh || exit 1 16 | 17 | # Unless told otherwise, create statically linked i686 host binaries (which 18 | # should run on an x86-64 host just fine, even if it hasn't got 32-bit 19 | # libraries installed). 20 | 21 | BUILD_STATIC=${BUILD_STATIC:-all} HOST_ARCH="${CROSS_COMPILER_HOST:-i686}" \ 22 | TOOLCHAIN_PREFIX="${1}-" STAGE_NAME=cross-compiler \ 23 | ./native-compiler.sh "$1" || exit 1 24 | 25 | # Run the cross compiler smoke test if requested. 26 | 27 | if [ ! -z "$CROSS_SMOKE_TEST" ] 28 | then 29 | more/cross-smoke-test.sh "$ARCH" || exit 1 30 | fi 31 | -------------------------------------------------------------------------------- /sources/sections/elf2flt.sh: -------------------------------------------------------------------------------- 1 | # This pile of crap cannot be built without zlib. Even if you're not using 2 | # it, neither the autoconf nor the C has any concept of _not_ using zlib. 3 | 4 | setupfor zlib 5 | CC=${HOST_ARCH:+${HOST_ARCH}-}$CC ./configure && 6 | make -j $CPUS && 7 | install -D z*.h "$STAGE_DIR/host/include" && 8 | install -D libz.a "$STAGE_DIR/host/lib" && 9 | cleanup 10 | 11 | setupfor elf2flt 12 | CC=${HOST_ARCH:+${HOST_ARCH}-}$CC CFLAGS="$CFLAGS $STATIC_FLAGS" \ 13 | ./configure --with-bfd-include-dir="$STAGE_DIR/host/include" \ 14 | --with-binutils-include-dir="$STAGE_DIR/host/include" \ 15 | --with-libiberty="$STAGE_DIR/host/lib/libiberty.a" --prefix="$STAGE_DIR" \ 16 | --with-libbfd="$STAGE_DIR/host/lib/libbfd.a" --target="$ELF2FLT" \ 17 | --with-zlib-prefix="$STAGE_DIR/host" --enable-always-reloc-text \ 18 | ${HOST_ARCH:+--host=${KARCH}-unknown-linux} && 19 | make -j $CPUS && 20 | make install TARGET="$CROSS_TARGET" PREFIX="$TOOLCHAIN_PREFIX" 21 | 22 | [ $? -ne 0 ] && dienow 23 | 24 | # elf2flt's wrapper sometimes calls the unprefixed version of this. :( 25 | 26 | if [ ! -e "$STAGE_DIR/bin/ld.real" ] 27 | then 28 | ln -s "${TOOLCHAIN_PREFIX}ld.real" "$STAGE_DIR/bin/ld.real" 29 | fi 30 | 31 | cleanup 32 | -------------------------------------------------------------------------------- /sources/targets/sh2eb: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | See se-instruments.com and http://linux-sh.org. 3 | " 4 | 5 | KARCH=sh 6 | KERNEL_PATH=vmlinux 7 | GCC_FLAGS=--enable-twoprocess #"--with-cpu=m4-nofpu" 8 | BINUTILS_FLAGS= 9 | QEMU_TEST=$KARCH 10 | 11 | ELF2FLT=sh-unknown-linux 12 | BUILD_STATIC=all 13 | 14 | CONSOLE="ttyUL0 noiotrap" 15 | 16 | NO_CPLUSPLUS=1 17 | SYSIMAGE_TYPE=rootfs 18 | 19 | UCLIBC_CONFIG=" 20 | TARGET_sh=y 21 | CONFIG_SH2=y 22 | LINUXTHREADS_OLD=y 23 | " 24 | 25 | LINUX_CONFIG=" 26 | CONFIG_0PF_FPGA=y 27 | CONFIG_CPU_BIG_ENDIAN=y 28 | CONFIG_CPU_SUBTYPE_0PF=y 29 | CONFIG_CACHE_OFF=y 30 | 31 | CONFIG_HZ_100=y 32 | CONFIG_MEMORY_SIZE=0x8000000 33 | CONFIG_MEMORY_START=0x10000000 34 | CONFIG_SH_PCLK_FREQ=32000000 35 | 36 | CONFIG_BINFMT_ELF_FDPIC=y 37 | CONFIG_BINFMT_FLAT=y 38 | 39 | CONFIG_DEVMEM=y 40 | CONFIG_DEVTMPFS_MOUNT=y 41 | CONFIG_FLATMEM_MANUAL=y 42 | 43 | CONFIG_CMDLINE_EXTEND=y 44 | CONFIG_CMDLINE=\"console=$CONSOLE\" 45 | 46 | CONFIG_SERIAL_UARTLITE=y 47 | CONFIG_SERIAL_UARTLITE_0PF=y 48 | CONFIG_SERIAL_UARTLITE_CONSOLE=y 49 | 50 | CONFIG_VFAT_FS=y 51 | CONFIG_FAT_DEFAULT_IOCHARSET=\"utf8\" 52 | CONFIG_NLS_DEFAULT=\"utf8\" 53 | CONFIG_NLS_UTF8=y 54 | " 55 | 56 | emulator_command() 57 | { 58 | echo echo No emulator 59 | } 60 | -------------------------------------------------------------------------------- /sources/targets/armv5l: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | ARM v5, little endian, EABI with vector floating point (vfp). 3 | 4 | ARMv5 is the Pentium of the ARM world. Most modern arm hardware should be 5 | able to run this, and hardware that supports the v5 instruction set should run 6 | this about 25% faster than code compiled for v4. 7 | " 8 | 9 | KARCH=arm 10 | KERNEL_PATH=arch/${KARCH}/boot/zImage 11 | GCC_FLAGS="--with-march=armv5 --with-mfloat-abi=soft --with-mfp=vfp" 12 | BINUTILS_FLAGS= 13 | QEMU_TEST=$KARCH 14 | 15 | CROSS_TARGET=armv5l-unknown-linux-gnueabi 16 | 17 | CONSOLE=ttyAMA0 18 | 19 | LINUX_CONFIG=" 20 | 21 | # Processor config 22 | 23 | CONFIG_CPU_ARM926T=y 24 | CONFIG_MMU=y 25 | CONFIG_VFP=y 26 | CONFIG_ARM_THUMB=y 27 | CONFIG_AEABI=y 28 | 29 | # Versatile board 30 | 31 | CONFIG_ARCH_VERSATILE=y 32 | CONFIG_ARCH_VERSATILE_PB=y 33 | CONFIG_PCI_LEGACY=y 34 | CONFIG_SERIAL_NONSTANDARD=y 35 | CONFIG_SERIAL_AMBA_PL011=y 36 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 37 | CONFIG_RTC_DRV_PL031=y 38 | CONFIG_SCSI_SYM53C8XX_2=y 39 | CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 40 | CONFIG_SCSI_SYM53C8XX_MMIO=y 41 | " 42 | 43 | emulator_command() 44 | { 45 | echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \ 46 | -net nic,model=rtl8139 -net user 47 | } 48 | -------------------------------------------------------------------------------- /sources/targets/m68k: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | Motorola 68040. 3 | 4 | Mainline qemu m68k support is actually just coldfire, an mmu-less subset of 5 | the m68k instruction set. 6 | 7 | To run this, you need the "q800" branch of Laurent Vivier's m68k qemu fork, 8 | which you can clone from git://gitorious.org/qemu-m68k/qemu-m68k 9 | 10 | Tested in version 2.1.0, it's hardwired to 128 mb memory (despite what -M says, 11 | even though q800 hardware went to 256 megs) and shutdown doesn't work, 12 | but other than that... 13 | " 14 | 15 | KARCH=m68k 16 | KERNEL_PATH=vmlinux 17 | GCC_FLAGS= # "--with-float=soft" 18 | BINUTILS_FLAGS= 19 | QEMU_TEST= #$KARCH 20 | 21 | CONSOLE=ttyS0 22 | 23 | UCLIBC_CONFIG=" 24 | TARGET_m68k=y 25 | UCLIBC_HAS_FPU=y 26 | LINUXTHREADS_OLD=y 27 | " 28 | 29 | LINUX_CONFIG=" 30 | CONFIG_MMU=y 31 | CONFIG_M68040=y 32 | CONFIG_M68KFPU_EMU=y 33 | CONFIG_MAC=y 34 | CONFIG_SCSI_MAC_ESP=y 35 | CONFIG_MACINTOSH_DRIVERS=y 36 | CONFIG_ADB=y 37 | CONFIG_ADB_MACII=y 38 | CONFIG_NET_CORE=y 39 | CONFIG_MACSONIC=y 40 | CONFIG_SERIAL_PMACZILOG=y 41 | CONFIG_SERIAL_PMACZILOG_TTYS=y 42 | CONFIG_SERIAL_PMACZILOG_CONSOLE=y 43 | 44 | #CONFIG_SQUASHFS_FILE_DIRECT=y 45 | " 46 | 47 | emulator_command() 48 | { 49 | echo qemu-system-m68k -M q800 $(qemu_defaults "$@") 50 | } 51 | -------------------------------------------------------------------------------- /sources/sections/busybox.build: -------------------------------------------------------------------------------- 1 | # Build busybox statically by default, but don't statically link against 2 | # glibc (during host_tools) build because glibc is buggy and can't combine 3 | # --static with --gc-sections. 4 | 5 | # Build busybox 6 | 7 | if [ ! -z "$BUSYBOX" ] 8 | then 9 | make defconfig V=${BUILD_VERBOSE:+1} && 10 | # breaks on ubuntu 11.10 11 | sed -i -e 's/^\(CONFIG_UBI.*\)=y/# \1 is not set/' .config && 12 | cp .config "$WORK"/config-busybox || dienow 13 | else 14 | getconfig busybox | sed '/toybox/,$d' > "$WORK/config-busybox" && 15 | make allnoconfig KCONFIG_ALLCONFIG="$WORK/config-busybox" || dienow 16 | fi 17 | 18 | LDFLAGS="$LDFLAGS $STATIC_FLAGS" make -j $CPUS V=${BUILD_VERBOSE:+1} \ 19 | $DO_CROSS ${ELF2FLT:+SKIP_STRIP=y} && 20 | make busybox.links || dienow 21 | 22 | [ -d "$STAGE_DIR/bin" ] && INSTDIR="$STAGE_DIR/bin" || INSTDIR="$STAGE_DIR" 23 | 24 | cp busybox${SKIP_STRIP:+_unstripped} "$INSTDIR/busybox" || dienow 25 | 26 | for i in $(sed 's@.*/@@' busybox.links) 27 | do 28 | # busybox mke2fs/tune2fs don't support -j 29 | if [ "$i" == mke2fs ] || [ "$i" == tune2fs ] 30 | then 31 | continue 32 | fi 33 | [ ! -e "$INSTDIR/$i" ] && (ln -s busybox "$INSTDIR/$i" || dienow) 34 | done 35 | 36 | # Reset error condition, the last file already existing is not an error 37 | 38 | true 39 | -------------------------------------------------------------------------------- /sources/targets/powerpc: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | Power PC, 32 bit 3 | 4 | Generic Power PC system, a basic unoptimized instruction set which 5 | just about any powerpc should be able to run. 6 | 7 | The main exceptions are the 440 and 880 lines, which were stripped down 8 | versions of the powerpc (created by IBM and Motorola, respectively) targetted 9 | at battery powered devices such as cell phones. They do not support the 10 | entire powerpc instruction set. (Alas, the two chose _different_ subsets, so 11 | they don't run each other's code either. These days the 880 is known as 12 | PowerQuic.) 13 | " 14 | 15 | KARCH=powerpc 16 | KERNEL_PATH=vmlinux 17 | GCC_FLAGS=--enable-secureplt # --with-long-double-64 (default on 4.2.1) 18 | BINUTILS_FLAGS= 19 | QEMU_TEST=ppc 20 | 21 | CONSOLE=ttyS0 22 | 23 | LINUX_CONFIG=" 24 | CONFIG_ALTIVEC=y 25 | CONFIG_PPC_PMAC=y 26 | CONFIG_PPC_OF_BOOT_TRAMPOLINE=y 27 | CONFIG_PPC601_SYNC_FIX=y 28 | CONFIG_PROC_DEVICETREE=y 29 | CONFIG_BLK_DEV_IDE_PMAC=y 30 | CONFIG_MACINTOSH_DRIVERS=y 31 | CONFIG_ADB=y 32 | CONFIG_ADB_CUDA=y 33 | CONFIG_NE2K_PCI=y 34 | CONFIG_SERIO=y 35 | CONFIG_SERIAL_PMACZILOG=y 36 | CONFIG_SERIAL_PMACZILOG_TTYS=y 37 | CONFIG_SERIAL_PMACZILOG_CONSOLE=y 38 | CONFIG_BOOTX_TEXT=y 39 | " 40 | 41 | emulator_command() 42 | { 43 | echo qemu-system-ppc -M g3beige $(qemu_defaults "$@") 44 | } 45 | -------------------------------------------------------------------------------- /more/migrate-kernel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Calculate new config for ALT kernel based on stable kernel config. 4 | # I.E. calculate miniconfig-alt-linux based on miniconfig-linux for a target. 5 | 6 | # Expand miniconfig with the old kernel, copy .config to new kernel, run 7 | # make oldconfig, compress to miniconfig, copy to sources/targets/$TARGET 8 | 9 | . sources/include.sh 10 | 11 | load_target "$1" 12 | rmdir "$STAGE_DIR" 13 | 14 | [ -z "$BOOT_KARCH" ] && BOOT_KARCH="$KARCH" 15 | 16 | # Expand config against current kernel 17 | 18 | USE_ALT= 19 | 20 | getconfig linux > "$WORK/miniconfig-linux" 21 | 22 | setupfor linux 23 | 24 | make ARCH=$BOOT_KARCH $LINUX_FLAGS KCONFIG_ALLCONFIG="$WORK/miniconfig-linux" \ 25 | allnoconfig >/dev/null && 26 | cp .config "$WORK" 27 | 28 | cleanup 29 | 30 | USE_ALT=linux 31 | 32 | setupfor linux 33 | 34 | mv "$WORK/.config" . && 35 | yes "" | make ARCH="$BOOT_KARCH" oldconfig && 36 | mv .config walrus && 37 | ARCH="${BOOT_KARCH}" "$SOURCES/toys/miniconfig.sh" walrus || dienow 38 | 39 | CFG="$CONFIG_DIR/$ARCH_NAME/miniconfig-alt-linux" 40 | if [ -e "$CFG" ] && ! cmp mini.config "$CFG" 41 | then 42 | mv "$CFG" "${CFG}.bak" || dienow 43 | fi 44 | mv mini.config "$CFG" 45 | 46 | cleanup 47 | 48 | diff -u <(sort "$WORK/miniconfig-linux") <(sort "$CFG") \ 49 | | sed '/^ /d;/^@/d;1,2d' | tee "$WORK/mini.diff" 50 | -------------------------------------------------------------------------------- /more/buildall-native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run a native build with a control image for every architecture, 4 | # using existing system-images under build, saving log files to build/log, 5 | # uploading output into build. 6 | 7 | # If $FORK is set, build them in parallel. 8 | 9 | # Kill any build that doesn't produce output for $TIMEOUT (default 60) seconds. 10 | 11 | . sources/utility_functions.sh || exit 1 12 | 13 | if [ ! -f "$1" ] 14 | then 15 | echo "Can't find control image at \"$1\"" >&2 16 | exit 1 17 | fi 18 | 19 | trap "killtree $$" EXIT 20 | 21 | # Build the hdb images sequentially without timeout.sh, to avoid potential 22 | # I/O storm triggering timeouts 23 | 24 | [ ! -z "$FORK" ] && FORK= more/for-each-target.sh \ 25 | '. sources/toys/make-hdb.sh; HDBMEGS=2048; HDB=build/system-image-$TARGET/hdb.img; echo "$HDB"; rm -f "$HDB"; make_hdb' 26 | 27 | # Put each control image's output in the build directory 28 | 29 | mkdir -p build/logs || dienow 30 | 31 | # Run a control image for each target, using existing hdb.img 32 | 33 | [ -z "$TIMEOUT" ] && export TIMEOUT=60 34 | [ -z "$LOGFILE" ] && LOGFILE="$(echo $1 | sed 's@.*/\(.*\)\.hdc@\1@')" 35 | more/for-each-target.sh \ 36 | 'ln -sfn .. build/system-image-$TARGET/upload && more/timeout.sh $TIMEOUT "HDB=hdb.img more/native-build-from-build.sh $TARGET '"$1 | tee build/logs/native-$LOGFILE-"'$TARGET.txt"' 37 | -------------------------------------------------------------------------------- /more/chroot-splice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Combine a root filesystem directory and a control image into an $ARCH-specific 4 | # chroot containing native build control files, suitable for chrooting into. 5 | 6 | if [ $# -ne 1 ] && [ $# -ne 2 ] 7 | then 8 | echo "usage: $0 "'$ARCH [$CONTROL_IMAGE]' >&2 9 | exit 1 10 | fi 11 | 12 | # Make sure prerequisites exist 13 | 14 | for i in build/{root-filesystem,native-compiler}-"$1" "$2" 15 | do 16 | if [ ! -z "$i" ] && [ ! -e "$i" ] 17 | then 18 | echo "No $i" >&2 19 | exit 1 20 | fi 21 | done 22 | 23 | if [ `id -u` -ne 0 ] 24 | then 25 | echo "Not root">&2 26 | exit 1 27 | fi 28 | 29 | # Zap old stuff (if any) 30 | 31 | [ -z "$CHROOT" ] && CHROOT="build/chroot-$1" 32 | trap 'more/zapchroot.sh "$CHROOT"' EXIT 33 | if [ -e "$CHROOT" ] 34 | then 35 | more/zapchroot.sh "$CHROOT" || exit 1 36 | fi 37 | 38 | # Copy root filesystem and native compiler 39 | cp -lan "build/root-filesystem-$1/." "$CHROOT" || exit 1 40 | cp -lan "build/native-compiler-$1/." "$CHROOT" || exit 1 41 | 42 | # splice in control image 43 | if [ $# -eq 2 ] 44 | then 45 | if [ -d "$2" ] 46 | then 47 | mount -o bind "$2" "$CHROOT/mnt" && 48 | mount -o remount,ro "$CHROOT/mnt"|| exit 1 49 | else 50 | mount -o loop "$2" "$CHROOT/mnt" || exit 1 51 | fi 52 | fi 53 | 54 | # Output some usage hints 55 | 56 | CPUS=1 HOST="$1" chroot "$CHROOT" /sbin/init.sh 57 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-stopdefaults2.patch: -------------------------------------------------------------------------------- 1 | Fix from Bobby Bingham. 2 | 3 | diff -ru gcc-core/gcc/gcc.c gcc-core2/gcc/gcc.c 4 | --- gcc-core/gcc/gcc.c 2014-01-05 20:23:51.963533293 -0600 5 | +++ gcc-core2/gcc/gcc.c 2014-01-05 20:28:03.776864811 -0600 6 | @@ -1473,8 +1473,6 @@ 7 | #endif 8 | 9 | static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; 10 | -static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/"; 11 | -static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/"; 12 | static const char *md_exec_prefix = MD_EXEC_PREFIX; 13 | 14 | static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; 15 | @@ -3949,16 +3947,10 @@ 16 | PREFIX_PRIORITY_LAST, 2, 0); 17 | add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", 18 | PREFIX_PRIORITY_LAST, 2, 0); 19 | - add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", 20 | - PREFIX_PRIORITY_LAST, 2, 0); 21 | - add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS", 22 | - PREFIX_PRIORITY_LAST, 2, 0); 23 | #endif 24 | 25 | add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", 26 | PREFIX_PRIORITY_LAST, 1, 0); 27 | - add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", 28 | - PREFIX_PRIORITY_LAST, 1, 0); 29 | 30 | tooldir_prefix = concat (tooldir_base_prefix, spec_machine, 31 | dir_separator_str, NULL); 32 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-fix-inhibit-libc.patch: -------------------------------------------------------------------------------- 1 | diff -ru gcc-core/gcc/config/sh/linux-unwind.h gcc-core/gcc/config/sh/linux-unwind.h 2 | --- gcc-core/gcc/config/sh/linux-unwind.h 2005-06-28 20:45:37.000000000 -0500 3 | +++ gcc-core/gcc/config/sh/linux-unwind.h 2008-02-06 17:41:12.000000000 -0600 4 | @@ -26,6 +26,8 @@ 5 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, 6 | Boston, MA 02110-1301, USA. */ 7 | 8 | +#ifndef inhibit_libc 9 | + 10 | /* Do code reading to identify a signal frame, and set the frame 11 | state data appropriately. See unwind-dw2.c for the structs. */ 12 | 13 | @@ -249,3 +251,5 @@ 14 | return _URC_NO_REASON; 15 | } 16 | #endif /* defined (__SH5__) */ 17 | + 18 | +#endif 19 | diff -ru gcc-core/gcc/config/alpha/linux-unwind.h gcc-core2/gcc/config/alpha/linux-unwind.h 20 | --- gcc-core/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 21 | +++ gcc-core2/gcc/config/alpha/linux-unwind.h 2010-01-10 20:05:56.000000000 -0600 22 | @@ -26,6 +26,8 @@ 23 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, 24 | Boston, MA 02110-1301, USA. */ 25 | 26 | +#ifndef inhibit_libc 27 | + 28 | /* Do code reading to identify a signal frame, and set the frame 29 | state data appropriately. See unwind-dw2.c for the structs. */ 30 | 31 | @@ -80,3 +82,5 @@ 32 | fs->retaddr_column = 64; 33 | return _URC_NO_REASON; 34 | } 35 | + 36 | +#endif 37 | -------------------------------------------------------------------------------- /sources/targets/armv6l: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | ARM v6, little endian, EABI with vector floating point (vfp). 3 | 4 | The Pentium II of the ARM world: this architecture was introduced in 2001 5 | and actually shipped silicon around 2003. This hardware can still run v4 6 | and v5 instruction sets, but recompiling for armv6 should provide a 7 | slight performance boost (and thus better battery life). 8 | " 9 | 10 | KARCH=arm 11 | KERNEL_PATH=arch/${KARCH}/boot/zImage 12 | GCC_FLAGS="--with-march=armv6 --with-mfloat-abi=soft --with-mfp=vfp" 13 | BINUTILS_FLAGS= 14 | QEMU_TEST=$KARCH 15 | 16 | CROSS_TARGET="armv6l-unknown-linux-gnueabi" 17 | 18 | CONSOLE=ttyAMA0 19 | 20 | LINUX_CONFIG=" 21 | 22 | # Processor config 23 | 24 | CONFIG_CPU_V6=y 25 | CONFIG_MMU=y 26 | CONFIG_ARM_THUMB=y 27 | CONFIG_AEABI=y 28 | CONFIG_VFP=y 29 | 30 | # Versatile board 31 | 32 | CONFIG_ARCH_VERSATILE=y 33 | CONFIG_ARCH_VERSATILE_PB=y 34 | CONFIG_PCI_LEGACY=y 35 | CONFIG_SERIAL_NONSTANDARD=y 36 | CONFIG_SERIAL_AMBA_PL011=y 37 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 38 | CONFIG_RTC_DRV_PL031=y 39 | CONFIG_SCSI_SYM53C8XX_2=y 40 | CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 41 | CONFIG_SCSI_SYM53C8XX_MMIO=y 42 | 43 | # Work around random breakage in the 3.11 kernel 44 | CONFIG_KUSER_HELPERS=y 45 | " 46 | 47 | emulator_command() 48 | { 49 | echo qemu-system-arm -M versatilepb -cpu arm1136-r2 $(qemu_defaults "$@") \ 50 | -net nic,model=rtl8139 -net user 51 | } 52 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-macrosity.patch: -------------------------------------------------------------------------------- 1 | Back in 2007 gcc started predefining __SIZEOF_BLAH__ macros, and the 3.7 2 | kernel won't build without them, so hack them into the toolchain. 3 | 4 | --- gcc-core/gcc/c-cppbuiltin.c 2007-03-12 13:50:38.000000000 -0500 5 | +++ gcc-core.bak/gcc/c-cppbuiltin.c 2012-12-14 22:22:25.922719393 -0600 6 | @@ -549,6 +549,25 @@ 7 | if (flag_openmp) 8 | cpp_define (pfile, "_OPENMP=200505"); 9 | 10 | +#define MACRO_AND_CHEESE(NAME, TYPE) \ 11 | + builtin_define_with_int_value("__SIZEOF_" NAME "__", \ 12 | + tree_low_cst(TYPE_SIZE_UNIT(TYPE##_type_node), 1)) 13 | + 14 | + MACRO_AND_CHEESE("INT", integer); 15 | + MACRO_AND_CHEESE("LONG", long_integer); 16 | + MACRO_AND_CHEESE("LONG_LONG", long_long_integer); 17 | + MACRO_AND_CHEESE("SHORT", short_integer); 18 | + MACRO_AND_CHEESE("FLOAT", float); 19 | + MACRO_AND_CHEESE("DOUBLE", double); 20 | + MACRO_AND_CHEESE("LONG_DOUBLE", long_double); 21 | + MACRO_AND_CHEESE("SIZE_T", size); 22 | + MACRO_AND_CHEESE("WCHAR_T", wchar); 23 | + MACRO_AND_CHEESE("WINT_T", wint); 24 | + MACRO_AND_CHEESE("PTRDIFF_T", unsigned_ptrdiff); 25 | + 26 | + builtin_define_with_int_value("__SIZEOF_POINTER__", 27 | + POINTER_SIZE/BITS_PER_UNIT); 28 | + 29 | /* A straightforward target hook doesn't work, because of problems 30 | linking that hook's body when part of non-C front ends. */ 31 | # define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM) 32 | -------------------------------------------------------------------------------- /sources/baseconfig-linux: -------------------------------------------------------------------------------- 1 | CONFIG_NO_HZ=y 2 | CONFIG_SWAP=y 3 | CONFIG_SYSVIPC=y 4 | CONFIG_IKCONFIG=y 5 | CONFIG_IKCONFIG_PROC=y 6 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y 7 | CONFIG_PCI=y 8 | CONFIG_BINFMT_ELF=y 9 | CONFIG_BINFMT_SCRIPT=y 10 | CONFIG_MAGIC_SYSRQ=y 11 | 12 | CONFIG_BLK_DEV=y 13 | CONFIG_BLK_DEV_LOOP=y 14 | 15 | CONFIG_IDE=y 16 | CONFIG_IDE_GD=y 17 | CONFIG_IDE_GD_ATA=y 18 | CONFIG_BLK_DEV_IDECD=y 19 | 20 | CONFIG_SCSI=y 21 | CONFIG_BLK_DEV_SD=y 22 | CONFIG_BLK_DEV_SR=y 23 | CONFIG_SCSI_LOWLEVEL=y 24 | 25 | CONFIG_NET=y 26 | CONFIG_PACKET=y 27 | CONFIG_UNIX=y 28 | CONFIG_INET=y 29 | 30 | CONFIG_NETDEVICES=y 31 | CONFIG_8139CP=y 32 | 33 | CONFIG_HW_RANDOM=y 34 | 35 | CONFIG_RTC_CLASS=y 36 | CONFIG_RTC_HCTOSYS=y 37 | CONFIG_RTC_INTF_SYSFS=y 38 | CONFIG_RTC_INTF_DEV=y 39 | 40 | CONFIG_EXT4_FS=y 41 | CONFIG_EXT4_USE_FOR_EXT23=y 42 | CONFIG_TMPFS=y 43 | CONFIG_MISC_FILESYSTEMS=y 44 | CONFIG_SQUASHFS=y 45 | CONFIG_SQUASHFS_ZLIB=y 46 | CONFIG_SQUASHFS_FILE_DIRECT=y 47 | CONFIG_OVERLAY_FS=y 48 | CONFIG_DEVTMPFS=y 49 | CONFIG_BLK_DEV_INITRD=y 50 | CONFIG_RD_GZIP=y 51 | CONFIG_INITRAMFS_COMPRESSION_GZIP=y 52 | 53 | CONFIG_VIRTUALIZATION=y 54 | CONFIG_VIRTIO_PCI=y 55 | CONFIG_VIRTIO_NET=y 56 | CONFIG_NET_9P=y 57 | CONFIG_NET_9P_VIRTIO=y 58 | CONFIG_NETWORK_FILESYSTEMS=y 59 | CONFIG_9P_FS=y 60 | CONFIG_9P_FS_POSIX_ACL=y 61 | 62 | # More random (inexplicable) guard symbols added in 3.2. TODO: write 63 | # miniconfig expander that automatically sets guard symbols when setting a 64 | # dependent symbol. 65 | 66 | CONFIG_ETHERNET=y 67 | CONFIG_NET_VENDOR_INTEL=y 68 | CONFIG_NET_VENDOR_REALTEK=y 69 | CONFIG_NET_VENDOR_AMD=y 70 | CONFIG_NET_VENDOR_NATSEMI=y 71 | CONFIG_NET_VENDOR_8390=y 72 | -------------------------------------------------------------------------------- /sources/patches/uClibc-ruserpass.patch: -------------------------------------------------------------------------------- 1 | diff -ru uClibc/include/netdb.h uClibc.new/include/netdb.h 2 | --- uClibc/include/netdb.h 2010-04-02 10:34:27.000000000 -0500 3 | +++ uClibc.new/include/netdb.h 2010-11-13 14:40:03.000000000 -0600 4 | @@ -483,12 +483,6 @@ 5 | #endif /* misc */ 6 | 7 | 8 | -/* ruserpass - remote password check. 9 | - This function also exists in glibc but is undocumented */ 10 | -extern int ruserpass(const char *host, const char **aname, const char **apass); 11 | -libc_hidden_proto(ruserpass) 12 | - 13 | - 14 | #ifdef __USE_BSD 15 | /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. 16 | The local user is LOCUSER, on the remote machine the command is 17 | diff -ru uClibc/libc/inet/rpc/rexec.c uClibc.new/libc/inet/rpc/rexec.c 18 | --- uClibc/libc/inet/rpc/rexec.c 2010-04-02 10:34:27.000000000 -0500 19 | +++ uClibc.new/libc/inet/rpc/rexec.c 2010-11-13 16:23:37.000000000 -0600 20 | @@ -48,6 +48,8 @@ 21 | /* int rexecoptions; - google does not know it */ 22 | static char ahostbuf[NI_MAXHOST]; 23 | 24 | +int ruserpass(const char *host, const char **aname, const char **apass); 25 | + 26 | int 27 | rexec_af(char **ahost, int rport, const char *name, const char *pass, const char *cmd, int *fd2p, sa_family_t af) 28 | { 29 | diff -ru uClibc/libc/inet/rpc/ruserpass.c uClibc.new/libc/inet/rpc/ruserpass.c 30 | --- uClibc/libc/inet/rpc/ruserpass.c 2010-04-02 10:34:27.000000000 -0500 31 | +++ uClibc.new/libc/inet/rpc/ruserpass.c 2010-11-13 16:25:27.000000000 -0600 32 | @@ -283,7 +283,7 @@ 33 | (void) fclose(cfile); 34 | return (-1); 35 | } 36 | -libc_hidden_def(ruserpass) 37 | +libc_hidden_proto(ruserpass) 38 | 39 | static int 40 | token(void) 41 | -------------------------------------------------------------------------------- /sources/targets/armv4l: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | ARM v4, little endian, soft float, OABI. 3 | 4 | This is a generic low-end arm image that should run on any arm hardware 5 | still in use today (except ARMv7M, which is arm in name only). 6 | 7 | The downside is it uses the Old Application Binary Interface, described here: 8 | http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Why-ARMs-EABI-matters/ 9 | 10 | This instruction set cannot support EABI, which requies the Thumb extensions. 11 | It's sort of the 80286 of the ARM world. 12 | " 13 | 14 | KARCH=arm 15 | KERNEL_PATH=arch/${KARCH}/boot/zImage 16 | GCC_FLAGS="--with-float=soft" 17 | BINUTILS_FLAGS= 18 | QEMU_TEST=$KARCH 19 | 20 | CONSOLE=ttyAMA0 21 | 22 | UCLIBC_CONFIG=" 23 | TARGET_arm=y 24 | ARCH_WANTS_LITTLE_ENDIAN=y 25 | LINUXTHREADS_OLD=y 26 | " 27 | 28 | LINUX_CONFIG=" 29 | 30 | # Processor config 31 | 32 | # QEMU patch: http://www.mail-archive.com/qemu-devel@nongnu.org/msg19370.html 33 | # and QEMU option '-cpu arm920t' enable CONFIG_CPU_ARM920T=y which is the 34 | # processor that actually _needs_ this code. But until then, qemu can only 35 | # emulate an armv5 CPU... 36 | 37 | CONFIG_CPU_ARM926T=y 38 | CONFIG_MMU=y 39 | 40 | # Versatile board 41 | 42 | CONFIG_ARCH_VERSATILE=y 43 | CONFIG_ARCH_VERSATILE_PB=y 44 | CONFIG_PCI_LEGACY=y 45 | CONFIG_SERIAL_NONSTANDARD=y 46 | CONFIG_SERIAL_AMBA_PL011=y 47 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 48 | CONFIG_RTC_DRV_PL031=y 49 | CONFIG_SCSI_SYM53C8XX_2=y 50 | CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 51 | CONFIG_SCSI_SYM53C8XX_MMIO=y 52 | " 53 | 54 | emulator_command() 55 | { 56 | echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \ 57 | -net nic,model=rtl8139 -net user 58 | } 59 | -------------------------------------------------------------------------------- /sources/targets/sh4: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | Hitachi developed the 4th iteration of the SuperH processor for the Dreamcast game console in 1998. 3 | The design remains popular in Japan (especially the automotive industry), and is these days owned 4 | by Renesas, a joint venture between Hitachi, NEC, and Mitsubishi. 5 | 6 | There's a wiki about it at http://linux-sh.org. 7 | " 8 | 9 | KARCH=sh 10 | KERNEL_PATH=arch/${KARCH}/boot/zImage 11 | GCC_FLAGS= #"--with-cpu=m4-nofpu" 12 | BINUTILS_FLAGS= 13 | QEMU_TEST=$KARCH 14 | CROSS_TARGET=sh-superh-linux 15 | 16 | CONSOLE="ttySC1 noiotrap" 17 | 18 | # This needs some massive cleanup, but part of the problem is arch/sh4/Kconfig forces on EXPERT 19 | # which requies re-selecting a bunch of standard features. Apparently sh is not meant to be 20 | # used by normal people, it's "special". 21 | 22 | LINUX_CONFIG=" 23 | CONFIG_CPU_SUBTYPE_SH7751R=y 24 | CONFIG_MMU=y 25 | CONFIG_MEMORY_START=0x0c000000 26 | CONFIG_VSYSCALL=y 27 | CONFIG_FLATMEM_MANUAL=y 28 | CONFIG_SH_FPU=y 29 | CONFIG_SH_RTS7751R2D=y 30 | CONFIG_RTS7751R2D_PLUS=y 31 | CONFIG_SH_TIMER_TMU=y 32 | CONFIG_HW_PERF_EVENTS=y 33 | CONFIG_ATA=y 34 | CONFIG_SATA_PMP=y 35 | CONFIG_ATA_SFF=y 36 | CONFIG_ATA_BMDMA=y 37 | CONFIG_PATA_PLATFORM=y 38 | CONFIG_SERIO_SERPORT=y 39 | CONFIG_SERIAL_8250=y 40 | CONFIG_SERIAL_SH_SCI=y 41 | CONFIG_SERIAL_SH_SCI_CONSOLE=y 42 | CONFIG_SPI=y 43 | CONFIG_SPI_SH_SCI=y 44 | CONFIG_MFD_SM501=y 45 | CONFIG_RTC_DRV_R9701=y 46 | " 47 | 48 | emulator_command() 49 | { 50 | echo qemu-system-sh4 -M r2d $(qemu_defaults "$@") -monitor null -serial null -serial stdio 51 | } 52 | 53 | # qemu-system-sh4 -m 512 -nographic -monitor null -serial null -serial stdio -append 'earlyprintk=sh-sci.1 root=/dev/sda rw init=/bin/ash' 54 | -------------------------------------------------------------------------------- /sources/sections/uClibc.build: -------------------------------------------------------------------------------- 1 | # Build and install uClibc 2 | 3 | # Work around a uClibc bug: it tries to use assembly directives on binutils 4 | # versions that don't have them. 5 | 6 | find . -name uClibc_arch_features.h | xargs sed -i 's/\#define \(__UCLIBC_HAVE_ASM_CFI_DIRECTIVES__\)/#undef \1/' 7 | 8 | [ ! -z "$BUILD_VERBOSE" ] && VERBOSITY=V=2 9 | 10 | make_uClibc() 11 | { 12 | make -j $CPUS $VERBOSITY $DO_CROSS \ 13 | UCLIBC_LDSO_NAME=ld-uClibc KERNEL_HEADERS="$STAGE_DIR/include" \ 14 | PREFIX="$STAGE_DIR/" RUNTIME_PREFIX=/ DEVEL_PREFIX=/ $1 15 | } 16 | 17 | # Configure 18 | 19 | getconfig uClibc > "$WORK/mini.conf" || dienow 20 | 21 | # Build and install 22 | 23 | make KCONFIG_ALLCONFIG="$WORK/mini.conf" allnoconfig && 24 | mkdir -p "$STAGE_DIR/src" && 25 | cp .config "$STAGE_DIR/src/config-uClibc" && 26 | make_uClibc install || dienow 27 | 28 | # Old versions of uClibc (0.9.30-ish) couldn't be told not to hardwire absolute 29 | # paths into their linker scripts. This isn't needed for current versions, and 30 | # is allowed to fail if HAVE_SHARED=n 31 | 32 | [ -e "$STAGE_DIR/lib/libc.so" ] && 33 | sed -i 's@/lib/@@g' "$STAGE_DIR/lib/libc.so" 2>/dev/null 34 | 35 | # Build ldd and friends 36 | 37 | if [ ! -z "$HOST_ARCH" ] 38 | then 39 | # The uClibc utils/Makefile.in is crazy. There's no way to specify a prefix, 40 | # or to pass in --static via CFLAGS. Just build 'em by hand. 41 | 42 | "$HOST_ARCH-cc" utils/ldd.c -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}ldd" \ 43 | --static -I ldso/include -DBUILDING_LINKAGE && 44 | "$HOST_ARCH-cc" utils/ldconfig.c utils/chroot_realpath.c \ 45 | -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}ldconfig" --static -I ldso/include \ 46 | -DUCLIBC_RUNTIME_PREFIX='"/"' -DBUILDING_LINKAGE || dienow 47 | fi 48 | -------------------------------------------------------------------------------- /sources/targets/armv4tl: -------------------------------------------------------------------------------- 1 | DESCRIPTION=" 2 | ARM v4, with thumb support, little endian, EABI, soft float. 3 | 4 | This is the lowest-end arm instruction set that can support EABI, the current 5 | binary ABI documented by ARM. It's used used in 920t processors (such as the 6 | OpenMoko Freerunner). 7 | 8 | This is \"the i386 of ARM\", an extremely generic low-end arm image that 9 | should run on any arm hardware still in use today (except ARMv7M, which 10 | is arm in name only). 11 | " 12 | 13 | KARCH=arm 14 | KERNEL_PATH=arch/${KARCH}/boot/zImage 15 | GCC_FLAGS="--with-march=armv4t --with-float=soft" 16 | BINUTILS_FLAGS= 17 | QEMU_TEST=$KARCH 18 | 19 | CROSS_TARGET=armv4tl-unknown-linux-gnueabi 20 | 21 | CONSOLE=ttyAMA0 22 | 23 | # This is every bit as ugly as it looks, because it's for gcc. 24 | export target_cpu_cname=arm9tdmi 25 | 26 | LINUX_CONFIG=" 27 | 28 | # Processor config 29 | 30 | # QEMU patch: http://www.mail-archive.com/qemu-devel@nongnu.org/msg19370.html 31 | # and QEMU option '-cpu arm920t' enable CONFIG_CPU_ARM920T=y which is the 32 | # processor that actually _needs_ this code. But until then, qemu can only 33 | # emulate an armv5 CPU... 34 | 35 | CONFIG_CPU_ARM926T=y 36 | CONFIG_MMU=y 37 | CONFIG_VFP=y 38 | CONFIG_ARM_THUMB=y 39 | CONFIG_AEABI=y 40 | 41 | # Versatile board 42 | 43 | CONFIG_ARCH_VERSATILE=y 44 | CONFIG_ARCH_VERSATILE_PB=y 45 | CONFIG_PCI_LEGACY=y 46 | CONFIG_SERIAL_NONSTANDARD=y 47 | CONFIG_SERIAL_AMBA_PL011=y 48 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 49 | CONFIG_RTC_DRV_PL031=y 50 | CONFIG_SCSI_SYM53C8XX_2=y 51 | CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 52 | CONFIG_SCSI_SYM53C8XX_MMIO=y 53 | " 54 | 55 | emulator_command() 56 | { 57 | echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \ 58 | -net nic,model=rtl8139 -net user 59 | } 60 | -------------------------------------------------------------------------------- /sources/root-filesystem/sbin/setup-chroot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -lt 1 ] || [ "${1:0:1}" == "-" ] || [ "$(readlink -f "$1")" == '/' ] 4 | then 5 | ( 6 | echo "Usage: setup-chroot NEWDIR [COMMAND...]" 7 | echo -e "\nCopies root filesystem to NEWDIR and executes COMMAND or /bin/sh" 8 | echo "If NEWDIR already exists, bind mounts directories instead." 9 | ) >&2 10 | exit 1 11 | fi 12 | 13 | # Copy root filesystem into a new chroot directory and restart in there. 14 | 15 | NEWROOT="$1" 16 | shift 17 | 18 | dotprogress() 19 | { 20 | while read i; do echo -n .; done; echo 21 | } 22 | 23 | if [ ! -d "$NEWROOT" ] 24 | then 25 | mkdir -p "$NEWROOT" 26 | [ -d /mnt/files ] && cp -a /mnt/files/. "$NEWROOT" 27 | find / -xdev | cpio -m -v -p "$NEWROOT" | dotprogress 28 | fi 29 | 30 | # Copy mounts from existing root filesystem to new target. 31 | 32 | # Get mount point list, minus the one our new root filesystem is already in, 33 | # then mount --bind each remaining mount point (once) into NEWROOT. 34 | 35 | ZAP="$(readlink -f "$NEWROOT")" 36 | 37 | for i in $(awk '{print $2}' /proc/mounts | tac) 38 | do 39 | # De-escape octal versions of space, tab, backslash, newline... 40 | x=$(echo -e "$i") 41 | 42 | # Skip the entry our chroot is under (generally /home) 43 | if [ "$x" == "${ZAP:0:${#x}}" ] || [ "$x" == '/' ] 44 | then 45 | [ ! -z "$VERBOSE" ] && echo Zapping "$x" >&2 46 | ZAP="" 47 | continue 48 | fi 49 | 50 | echo "$i" 51 | done | tac | while read i 52 | do 53 | mountpoint -q "$NEWROOT$i" && continue 54 | 55 | [ ! -z "$VERBOSE" ] && echo "Bind $i to $NEWROOT$i" >&2 56 | 57 | mount --bind "$i" "$NEWROOT$i" 58 | done 59 | 60 | [ ! -z "$VERBOSE" ] && echo "Chrooting to \"$NEWROOT\"" >&2 61 | chroot "$NEWROOT" "$@" 62 | RC=$? 63 | 64 | [ ! -z "$VERBOSE" ] && echo "Cleanup chroot" >&2 65 | zapchroot "$NEWROOT" 66 | 67 | exit $RC 68 | -------------------------------------------------------------------------------- /sources/patches/binutils-bfd.patch: -------------------------------------------------------------------------------- 1 | diff -ruN binutils/bfd/configure binutils.bak/bfd/configure 2 | --- binutils/bfd/configure 2012-09-23 01:02:58.000000000 -0500 3 | +++ binutils.bak/bfd/configure 2015-06-20 22:30:34.088466082 -0500 4 | @@ -10703,21 +10703,9 @@ 5 | 6 | # Need _noncanonical variables for this. 7 | 8 | - 9 | - 10 | - 11 | - # libbfd.a is a host library containing target dependent code 12 | - bfdlibdir='$(libdir)' 13 | - bfdincludedir='$(includedir)' 14 | - if test "${host}" != "${target}"; then 15 | - bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' 16 | - bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' 17 | - fi 18 | - 19 | - 20 | - 21 | - 22 | - 23 | +# libbfd.a is a host library containing target dependent code 24 | +bfdlibdir='$(exec_prefix)/host/lib' 25 | +bfdincludedir='$(exec_prefix)/host/include' 26 | 27 | host64=false 28 | target64=false 29 | diff -ruN binutils/opcodes/configure binutils.bak/opcodes/configure 30 | --- binutils/opcodes/configure 2012-09-23 01:03:01.000000000 -0500 31 | +++ binutils.bak/opcodes/configure 2015-06-20 22:31:22.316466235 -0500 32 | @@ -9847,23 +9847,11 @@ 33 | INSTALL_LIBBFD_FALSE= 34 | fi 35 | 36 | - # Need _noncanonical variables for this. 37 | - 38 | - 39 | - 40 | - 41 | - # libbfd.a is a host library containing target dependent code 42 | - bfdlibdir='$(libdir)' 43 | - bfdincludedir='$(includedir)' 44 | - if test "${host}" != "${target}"; then 45 | - bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' 46 | - bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' 47 | - fi 48 | - 49 | - 50 | - 51 | - 52 | +# Need _noncanonical variables for this. 53 | 54 | +# libbfd.a is a host library containing target dependent code 55 | +bfdlibdir='$(exec_prefix)/host/lib' 56 | +bfdincludedir='$(exec_prefix)/host/include' 57 | 58 | # host-specific stuff: 59 | 60 | -------------------------------------------------------------------------------- /sources/toys/native-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Wrapper around dev-environment.sh which runs an automated native build 4 | # using a control image, and sets up an FTP server on the host to upload 5 | # results to. 6 | 7 | # If you already have an FTP server, export FTP_SERVER and/or FTP_PORT. 8 | 9 | # Parse arguments 10 | 11 | if [ $# -ne 1 ] 12 | then 13 | echo "usage: $0 CONTROL_IMAGE" >&2 14 | exit 1 15 | fi 16 | 17 | if [ ! -f "$1" ] 18 | then 19 | echo "Filesystem image $1 missing" >&2 20 | exit 1 21 | fi 22 | HDCFILE="$(readlink -f $1)" 23 | 24 | INCLUDE unique-port.sh 25 | 26 | # Do we already have an FTP daemon? 27 | 28 | if [ -z "$FTP_SERVER" ] 29 | then 30 | FTP_SERVER=127.0.0.1 31 | elif [ -z "$FTP_PORT" ] 32 | then 33 | FTP_PORT=21 34 | fi 35 | 36 | if [ -z "$FTP_PORT" ] 37 | then 38 | if [ -z "$(which toybox)" ] 39 | then 40 | echo "Warning: can't find toybox, no ftp daemon launched." >&2 41 | else 42 | FTP_PORT=$(unique_port) 43 | 44 | echo === launching FTP daemon on port "$FTP_PORT" 45 | 46 | # Fire off an ftp daemon, making sure it's killed when this script exits. 47 | # (We use the busybox version because no two ftp daemons have quite the same 48 | # command line arguments, and this one's a known quantity.) 49 | 50 | mkdir -p upload 51 | toybox nc -s 127.0.0.1 -p $FTP_PORT -L busybox ftpd -w upload & 52 | trap "kill $(jobs -p)" EXIT 53 | disown $(jobs -p) 54 | 55 | # QEMU's alias for host loopback 56 | 57 | FTP_SERVER=10.0.2.2 58 | fi 59 | fi 60 | 61 | # Run emulator as a child process, feeding in -hdc and some extra environment 62 | # variables so it auto-launches the build process. 63 | 64 | export HDC="$HDCFILE" 65 | NATIVE_BUILD="$(echo "$HDCFILE" | sed -e 's@.*/@@' -e 's@[.]hdc$@@')" 66 | export KERNEL_EXTRA="FTP_SERVER=$FTP_SERVER FTP_PORT=$FTP_PORT NATIVE_BUILD=$NATIVE_BUILD $KERNEL_EXTRA" 67 | 68 | [ -z "$HDB" ] && rm -f hdb.img 69 | ./dev-environment.sh 70 | 71 | echo === End native build 72 | -------------------------------------------------------------------------------- /sources/patches/elf2flt-make.patch: -------------------------------------------------------------------------------- 1 | Remove nonexistent header (which apparently has no symbols we need), 2 | and teach makefile that the prefix can be something other than full target name. 3 | 4 | diff -ruN elf2flt/ld-elf2flt.c elf2flt.bak/ld-elf2flt.c 5 | --- elf2flt/ld-elf2flt.c 2012-10-03 21:32:38.000000000 -0500 6 | +++ elf2flt.bak/ld-elf2flt.c 2014-11-06 23:42:35.703148578 -0600 7 | @@ -24,7 +24,6 @@ 8 | #include 9 | #include 10 | #include 11 | -#include 12 | 13 | #include "stubs.h" 14 | const char *elf2flt_progname; 15 | diff -ruN elf2flt/Makefile.in elf2flt.bak/Makefile.in 16 | --- elf2flt/Makefile.in 2012-10-03 21:32:38.000000000 -0500 17 | +++ elf2flt.bak/Makefile.in 2014-11-07 08:12:07.914832959 -0600 18 | @@ -97,15 +97,15 @@ 19 | $(INSTALL) -d $(bindir) 20 | $(INSTALL) -d $(target_bindir) 21 | $(INSTALL) -d $(target_libdir) 22 | - $(INSTALL) -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR) 23 | + $(INSTALL) -m 755 $(PROG_FLTHDR) $(bindir)/$(PREFIX)$(PROG_FLTHDR) 24 | $(INSTALL) -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR) 25 | - $(INSTALL) -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT) 26 | + $(INSTALL) -m 755 $(PROG_ELF2FLT) $(bindir)/$(PREFIX)$(PROG_ELF2FLT) 27 | $(INSTALL) -m 755 $(PROG_ELF2FLT) $(target_bindir)/$(PROG_ELF2FLT) 28 | - [ -f $(bindir)/$(TARGET)-ld.real$(EXEEXT) ] || \ 29 | - mv $(bindir)/$(TARGET)-ld$(EXEEXT) $(bindir)/$(TARGET)-ld.real$(EXEEXT) 30 | + [ -f $(bindir)/$(PREFIX)ld.real$(EXEEXT) ] || \ 31 | + mv $(bindir)/$(PREFIX)ld$(EXEEXT) $(bindir)/$(PREFIX)ld.real$(EXEEXT) 32 | [ -f $(target_bindir)/ld.real$(EXEEXT) ] || \ 33 | mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT) 34 | - $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(bindir)/$(TARGET)-ld$(EXEEXT) 35 | + $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(bindir)/$(PREFIX)ld$(EXEEXT) 36 | $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(target_bindir)/ld$(EXEEXT) 37 | $(INSTALL) -m 644 $(SRC_LDFILE) $(target_libdir)/$(LDFILE) 38 | 39 | -------------------------------------------------------------------------------- /sources/sections/binutils.build: -------------------------------------------------------------------------------- 1 | # Build binutils, which provides the linker and assembler and such. 2 | 3 | if [ ! -z "$ELF2FLT" ] 4 | then 5 | BINUTILS_FLAGS="$BINUTILS_FLAGS --enable-install-libbfd" 6 | fi 7 | 8 | function configure_binutils() 9 | { 10 | "$CURSRC/configure" --prefix="$STAGE_DIR" "$@" --target="$CROSS_TARGET" \ 11 | --disable-nls --disable-shared --disable-multilib --disable-werror \ 12 | --with-lib-path=lib --program-prefix="$TOOLCHAIN_PREFIX" $BINUTILS_FLAGS 13 | 14 | [ $? -ne 0 ] && dienow 15 | } 16 | 17 | # Don't require objective C on the host. 18 | find . -name "*.m" | xargs rm 19 | 20 | blank_workdir build-binutils 21 | 22 | if [ -z "$HOST_ARCH" ] 23 | then 24 | # Create a simple cross compiler, from this host to target $ARCH. 25 | # This has no prerequisites. 26 | 27 | # Define lots of environment variables to make configure behave. 28 | 29 | AR=ar AS=as LD=ld NM=nm OBJDUMP=objdump OBJCOPY=objcopy configure_binutils 30 | else 31 | # Canadian cross for an arbitrary host/target. The new compiler will run 32 | # on $HOST_ARCH as its host, and build executables for $ARCH as its target. 33 | # (Use host==target to produce a native compiler.) Doing this requires 34 | # existing host ($HOST_ARCH) _and_ target ($ARCH) cross compilers as 35 | # prerequisites. 36 | 37 | AR="${HOST_ARCH}-ar" CC="${HOST_ARCH}-cc" configure_binutils \ 38 | --build="$CROSS_HOST" --host="$CROSS_TARGET" 39 | fi 40 | 41 | # Now that it's configured, build and install binutils 42 | 43 | make -j $CPUS configure-host && 44 | make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS $CFLAGS" && 45 | ln -s lib "$STAGE_DIR/lib64" && 46 | make -j $CPUS install && 47 | rm "$STAGE_DIR/lib64" && 48 | 49 | # Fix up install 50 | 51 | mkdir -p "$STAGE_DIR"/host/{include,lib} && 52 | cp {"$CURSRC","$STAGE_DIR"/host}/include/libiberty.h && 53 | mv "$STAGE_DIR/"{lib/libiberty.a,host/lib} || 54 | dienow 55 | 56 | if [ -z "$NO_CLEANUP" ] 57 | then 58 | cd .. && rm -rf build-binutils || dienow 59 | fi 60 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 478178b9337bcb1aa7cce39fa81ab67507f0e70d 0.1.0 2 | 8b75dee28f400573ce282f3ac8a485b48a2d9fbb 0.0.1 3 | f56cfecf46214588c14428311f7a0f7488c2fb19 0.1.1 4 | 2dd9f480ff4efc0ddf0c685a9407ddc93b690f29 0.2.0 5 | ce1ca3d0f95b6da9369d87c9d7e1dd610ecedfa0 0.2.1 6 | dd60fbdf04c74a7af06ee316c782efc57006f57d 0.2.2 7 | c3d2fd8b45cfa3c86f748cb9e759674ec3c88eea 0.3.0 8 | 3ca6f52688acb05733552bea3e08f319daf8da04 0.3.1 9 | 1a70dfe0a436ef20206451b5c3602f591e3ac349 0.4.0 10 | 2925f71bce99513468349b01d7cd5892aa40b047 0.9.0 11 | f2b7db2e4315c94a06c78e0710d66b8aab0ee888 0.9.5 12 | 55a526672f43e040803a5ecf14754e76af6dcb53 0.9.6 13 | d0b74a631587e2d929ef7f64f84a9a39aefd564b 0.9.7 14 | 563c1abb06d05f63451a15a70b424646c203e9b8 0.9.8 15 | d7485ceb119fdd6975fe5d4845f82daa32427d46 0.9.9 16 | 19660e12c1decfc3a17dc12a8ce860deac5a79ba 0.9.10 17 | b9319aa31df816094fe7fc58ef14581f11ed1af5 0.9.11 18 | 479bcbb2775eacdfab220070cd8e57ce0be8711b 1.0 19 | a44deb7b4ee0a035dff5aca2f70e0b060db73a6a 1.0.1 20 | a9685aea2a2c5bed20ca4a273f475deca2f8bd7e 1.0.2 21 | 4aceeceefb2d259b8a40f17d04cd2b49757de308 1.0.3 22 | 707beb993e137b4d88a58f10a2502361fde721a5 1.1.0 23 | ef315a8461c0e25043b42e4697ca8b974b46fac7 1.1.1 24 | 2d264744ac3a7e623c65137f3f410897aac90f31 1.2.0 25 | 6bdc83f4992038a1b3a48feb7f25428dec67f257 1.2.1 26 | 76350236e5f1bb52afdaf5636c2e993441f6cd7d 1.2.2 27 | 96fb8598a446fbef7870c312f5b1706e97a8b472 1.2.3 28 | c756b708583f30b20138c80ac195ac714bb678b4 1.2.4 29 | 556a5bc3c8a42a424ead30dc56b028954ba92bcf 1.2.5 30 | f641160e79ea24c58e25fa3636fe0eb73d928313 1.2.6 31 | 946d9e8f1752e23d708856e6fb1e8d6ef96664d6 1.2.7 32 | 7b4566efd8bd49a329214fe25d01fd3759d23255 1.2.8 33 | 00e528cdad9583fe9765cf01250812e1f2dadfa0 1.2.9 34 | bffb25915831f1d6ef28f9299868f527fd850a47 1.3.0 35 | 48d64deac231382d4c97948c3e0aabec860e7b9c 1.4.0 36 | 79e08a2f2573f752bd2d38f05305a358a640a932 1.4.1 37 | 0787ceb820bf1d1048d8c3007c6940f72886823e 1.4.2 38 | d7921aa5ea60b47e93ed2a65b26f09c761b8e8cb 1.4.3 39 | d8233213e7702937a887120ac613a08427d851a3 1.4.4 40 | 6477f27294f8bb70331e9dd3e98a3ddc4dcf2470 1.4.5 41 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-fix52.patch: -------------------------------------------------------------------------------- 1 | Newer gcc (5.2 and up) won't compile older gcc because they added an 'extension' 2 | and made their code depnd on it, and then decided it had been a bad idea and 3 | ripped it out again but older gcc goes "oh of course newer gcc will support 4 | this forever". The Aristrocrats! FSF! 5 | 6 | diff -ruN gcc-core/gcc/toplev.c gcc-core.bak/gcc/toplev.c 7 | --- gcc-core/gcc/toplev.c 2006-10-09 11:27:14.000000000 -0500 8 | +++ gcc-core.bak/gcc/toplev.c 2015-12-15 16:19:26.643494852 -0600 9 | @@ -531,7 +531,7 @@ 10 | for floor_log2 and exact_log2; see toplev.h. That construct, however, 11 | conflicts with the ISO C++ One Definition Rule. */ 12 | 13 | -#if GCC_VERSION < 3004 || !defined (__cplusplus) 14 | +#if 0 15 | 16 | /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. 17 | If X is 0, return -1. */ 18 | diff -ruN gcc-core/gcc/toplev.h gcc-core.bak/gcc/toplev.h 19 | --- gcc-core/gcc/toplev.h 2006-02-26 14:23:40.000000000 -0600 20 | +++ gcc-core.bak/gcc/toplev.h 2015-12-15 17:47:59.755637132 -0600 21 | @@ -151,12 +151,6 @@ 22 | /* Return true iff flags are set as if -ffast-math. */ 23 | extern bool fast_math_flags_set_p (void); 24 | 25 | -/* Return log2, or -1 if not exact. */ 26 | -extern int exact_log2 (unsigned HOST_WIDE_INT); 27 | - 28 | -/* Return floor of log2, with -1 for zero. */ 29 | -extern int floor_log2 (unsigned HOST_WIDE_INT); 30 | - 31 | /* Inline versions of the above for speed. */ 32 | #if GCC_VERSION >= 3004 33 | # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG 34 | @@ -170,13 +164,13 @@ 35 | # define CTZ_HWI __builtin_ctz 36 | # endif 37 | 38 | -extern inline int 39 | +static inline int 40 | floor_log2 (unsigned HOST_WIDE_INT x) 41 | { 42 | return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1; 43 | } 44 | 45 | -extern inline int 46 | +static inline int 47 | exact_log2 (unsigned HOST_WIDE_INT x) 48 | { 49 | return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1; 50 | -------------------------------------------------------------------------------- /sources/toys/README.footer: -------------------------------------------------------------------------------- 1 | 2 | Each cross-compiler tarball contains a uClibc cross compiler for a given 3 | target; the target binaries they produce are linked against uClibc. For 4 | maximum portability, they are compiled for an i686 host and statically linked 5 | against i686 uClibc on the host. 6 | 7 | To try out uClibc on your system, you might do something like: 8 | 9 | tar -xvjf cross-compiler-i686.tar.bz2 10 | export PATH=`pwd`/cross-compiler-i686/bin:$PATH 11 | i686-gcc -static hello_world.c -o hello_world 12 | ./hello_world 13 | 14 | Each mini-native tarball contains a small native root filesystem (uClibc-based), 15 | with busybox, uClibc, and a native compiler toolchain supporting C (uClibc) 16 | and C++ (uClibc++). To try these out, you might go: 17 | 18 | tar -xvjf mini-native-x86_64.tar.bz2 19 | sudo chroot mini-native-x86_64 /bin/chroot-setup.sh 20 | g++ /tools/src/hello.cpp 21 | ./a.out 22 | 23 | The system-image tarballs contain the same root filesystem as mini-native, 24 | packaged as an ext2 image, along with a kernel configured for use with 25 | qemu (0.9.1 or later) and shell scripts to run the images under qemu: 26 | 27 | 1) run-emulator.sh - simple script to boot qemu 28 | 29 | 2) run-with-home.sh - adds an empty 2 gigabyte ext3 image mounted on /home 30 | 31 | 3) run-with-distcc.sh - adds distcc support calling out to the cross compiler 32 | on the host system (on top of run-with-home's hdb image). 33 | 34 | The logs directory contains build logs. These are only of interest if you 35 | plan to reproduce these from source and can't get it to work on the first try. 36 | 37 | Note that chrooting into mini-native-i686 on an x86_64 host may not give you 38 | a good build environment, because /proc will still show an x86_64 host kernel 39 | in an i686 chroot, and this confuses many ./configure scripts. 40 | 41 | Cross compiling is tricky. The easy way to build packages is to build fully 42 | natively, either by booting a system image under qemu or by finding real 43 | target hardware to build on. 44 | -------------------------------------------------------------------------------- /sources/patches/elf2flt-musl.patch: -------------------------------------------------------------------------------- 1 | Building cross-compiler with i686-cc built against musl breaks because elf2flt 2 | inserts "-lc" into the link line before -l libiberty.c, resulting in libc's 3 | weak symbols getting resolved and conflicting with libiberty's gratuitous 4 | redefines. 5 | 6 | The reason elf2flt inserts -lc is it doesn't trust libc to define "malloc". 7 | (No really.) The fix is to rip that test out entirely. 8 | 9 | diff -ruN elf2flt/configure elf2flt.bak/configure 10 | --- elf2flt/configure 2015-01-04 02:14:55.000000000 -0600 11 | +++ elf2flt.bak/configure 2016-01-04 11:33:40.331559582 -0600 12 | @@ -3971,46 +3971,6 @@ 13 | ;; 14 | esac 15 | 16 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lc" >&5 17 | -$as_echo_n "checking for malloc in -lc... " >&6; } 18 | -if ${ac_cv_lib_c_malloc+:} false; then : 19 | - $as_echo_n "(cached) " >&6 20 | -else 21 | - ac_check_lib_save_LIBS=$LIBS 22 | -LIBS="-lc $LIBS" 23 | -cat confdefs.h - <<_ACEOF >conftest.$ac_ext 24 | -/* end confdefs.h. */ 25 | - 26 | -/* Override any GCC internal prototype to avoid an error. 27 | - Use char because int might match the return type of a GCC 28 | - builtin and then its argument prototype would still apply. */ 29 | -#ifdef __cplusplus 30 | -extern "C" 31 | -#endif 32 | -char malloc (); 33 | -int 34 | -main () 35 | -{ 36 | -return malloc (); 37 | - ; 38 | - return 0; 39 | -} 40 | -_ACEOF 41 | -if ac_fn_c_try_link "$LINENO"; then : 42 | - ac_cv_lib_c_malloc=yes 43 | -else 44 | - ac_cv_lib_c_malloc=no 45 | -fi 46 | -rm -f core conftest.err conftest.$ac_objext \ 47 | - conftest$ac_exeext conftest.$ac_ext 48 | -LIBS=$ac_check_lib_save_LIBS 49 | -fi 50 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_malloc" >&5 51 | -$as_echo "$ac_cv_lib_c_malloc" >&6; } 52 | -if test "x$ac_cv_lib_c_malloc" = xyes; then : 53 | - LIBS="-lc $LIBS" 54 | -fi 55 | - 56 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 57 | $as_echo_n "checking for dlopen in -ldl... " >&6; } 58 | if ${ac_cv_lib_dl_dlopen+:} false; then : 59 | -------------------------------------------------------------------------------- /more/buildall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build every target architecture, saving log files to build/log. 4 | # If $FORK is set, build them in parallel. 5 | 6 | . sources/utility_functions.sh || exit 1 7 | 8 | [ -z "$CROSS_COMPILER_HOST" ] && export CROSS_COMPILER_HOST=i686 9 | 10 | trap "killtree $$" EXIT 11 | 12 | # Build the host architecture. This has to be built first so the other 13 | # architectures can canadian cross static compilers to run on the host using 14 | # this toolchain to link against a host version of uClibc. 15 | 16 | # This also performs the download.sh and host-tools.sh steps, which don't 17 | # parallelize well if many build.sh instances try to call them at once. 18 | 19 | # If this fails, don't bother trying to build the other targets. 20 | 21 | [ -z "$NO_CLEAN" ] && blank_tempdir build 22 | 23 | mkdir -p build/logs && 24 | (EXTRACT_ALL=1 ./download.sh 2>&1 && 25 | more/record-commands.sh && 26 | ./host-tools.sh 2>&1 && 27 | more/record-commands.sh && 28 | ./simple-cross-compiler.sh "$CROSS_COMPILER_HOST" 2>&1 || 29 | dienow) | tee build/logs/build-host-cc.txt | maybe_quiet 30 | 31 | cp packages/MANIFEST build || dienow 32 | 33 | # Adjust $CPUS so as not to overload the machine, max 2 build processes 34 | # per gigabyte of RAM 35 | 36 | if [ ! -z "$FORK" ] && [ -z "$CPUS" ] 37 | then 38 | MEGS=$(($(awk '/MemTotal:/{print $2}' /proc/meminfo)/1024)) 39 | TARGET_COUNT=$(find sources/targets -maxdepth 1 -type f | wc -l) 40 | export CPUS=$(($MEGS/($TARGET_COUNT*512))) 41 | [ "$CPUS" -lt 1 ] && CPUS=1 42 | fi 43 | 44 | # Build all non-hw targets, possibly in parallel 45 | 46 | more/for-each-target.sh \ 47 | './build.sh $TARGET 2>&1 | tee build/logs/build-${TARGET}.txt' 48 | 49 | # Run smoketest.sh for each non-hw target. 50 | 51 | more/for-each-target.sh \ 52 | 'more/smoketest.sh $TARGET 2>&1 | tee build/logs/smoketest-$TARGET.txt' 53 | 54 | # If we have a control image, build natively 55 | 56 | for i in "$@" 57 | do 58 | more/buildall-native.sh "$1" 59 | done 60 | 61 | more/smoketest-report.sh | tee build/logs/status.txt 62 | -------------------------------------------------------------------------------- /sources/README: -------------------------------------------------------------------------------- 1 | The following files live here: 2 | 3 | include.sh: Common code included by every build stage. Defines many 4 | environment variables, and sources the various *functions.sh. 5 | 6 | functions.sh: Shell functions internal to Aboriginal Linux. 7 | 8 | utility-functions.sh: Functions usable in contexts other than the Aboriginal 9 | Linux build. 10 | 11 | download-functions.sh: Functions to manage package source. (Download 12 | tarballs, confirm checksums, extract and apply 13 | patches, manage package cache.) 14 | 15 | timeout.sh: Wrapper to run a command line with a timeout. 16 | 17 | baseconfig-linux: Common miniconfig shared by most architectures, to which 18 | $LINUX_CONFIG from the target/$ARCH/settings is appended. 19 | 20 | baseconfig-uClibc: Common miniconfig shared by all architectures, to which 21 | $UCLIBC_CONFIG from the target/$ARCH/settings is appended. 22 | 23 | The following subdirectories live here: 24 | 25 | native: Files copied verbatim into each architecture's root-filesystem image. 26 | 27 | toys: Various small code snippets written or maintained for this project. 28 | 29 | sections: Package build scripts called more than once during build.sh. 30 | This is duplicate code factored out into a common location. 31 | 32 | patches: Patches applied to the packages listed in download.sh by "setupfor". 33 | Each package has "$PACKAGE-*.patch" applied in alphabetical order. 34 | 35 | targets: Configuration for each target platform, parsed by load_target() 36 | and getconfig() in functions.sh. Each entry is a target name, 37 | either a self-contained script setting configuration information, 38 | or else a directory containing: 39 | 40 | settings: Environment variables needed by the build. 41 | 42 | miniconfig-linux: linux kernel .config compressed by toys/miniconfig.sh 43 | 44 | miniconfig-uClibc: uClibc .config compressed by toys/miniconfig.sh 45 | 46 | root-filesystem: Files to be copied verbatim into the target filesystem. 47 | Used by simple-root-filesystem.sh. 48 | -------------------------------------------------------------------------------- /www/screenshots/screenshots.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Take 80x25 screen shot from the end of a text file, and excape it for html. 4 | 5 | process_text_file() 6 | { 7 | X=0 8 | 9 | # Break into 80 line chunks, substituting &, < and > 10 | sed -e 's/\(................................................................................\)/\1\n/g' "$1" | \ 11 | tail -n 25 | while read i 12 | do 13 | echo -n "$i" | sed -e 's@\&@\&@g' -e 's@<@\<@g' -e 's@>@\>@g' 14 | 15 | # If the first line is shorter than 80 characters, pad it. 16 | if [ $X -eq 0 ] 17 | then 18 | X=${#i} 19 | while [ $X -lt 80 ] 20 | do 21 | echo -n ' ' 22 | X=$[$X+1] 23 | done 24 | fi 25 | echo 26 | done 27 | } 28 | 29 | wrap_screenshot() 30 | { 31 | echo '' 32 | 33 | cat << EOF 34 | 35 | boot log 36 | cross compiler
37 | native compiler
38 | root filesystem
39 | system image
40 | 41 |
42 | busybox binary
43 | dropbear binary
44 | strace binary
45 | 46 | EOF 47 | 48 | echo '' 49 | echo '
'
50 |   process_text_file "bootlog-$1.txt"
51 |   echo '
' 52 | echo 53 | echo '' 54 | } 55 | 56 | # Harvest screenshots from each system image 57 | 58 | more/for-each-target.sh '(sleep 20 && echo -n cat "/proc" && sleep 1 && echo /cpuinfo && sleep 2 && echo exit) | more/run-emulator-from-build.sh $TARGET | tee www/screenshots/bootlog-$TARGET.txt' 59 | 60 | cd www/screenshots 61 | 62 | # Filter out escape sequence (shell asking the current screen size) 63 | sed -i $(echo -e 's/\033\[6n//g;s/\015$//') bootlog-*.txt 64 | 65 | # Create html snippet 66 | 67 | for i in $(ls bootlog-*.txt | sed 's/bootlog-\(.*\)\.txt/\1/') 68 | do 69 | wrap_screenshot "$i" > "screenshot-$i.html" 70 | done 71 | -------------------------------------------------------------------------------- /native-compiler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build a compiler for a given target, using one or more existing simple 4 | # cross compilers. 5 | 6 | # This can be used to build a native compiler for an aribitrary target, or to 7 | # build a more portable and capable cross compiler for an arbitrary host. 8 | 9 | # The new compiler is built --with-shared, with thread support, has uClibc++ 10 | # installed, and is linked against musl (see BUILD_STATIC in config). 11 | 12 | source sources/include.sh && load_target "$1" || exit 1 13 | check_for_base_arch || exit 0 14 | 15 | check_prerequisite "${CC_PREFIX}cc" 16 | 17 | [ -z "$HOST_ARCH" ] && HOST_ARCH="$ARCH" && STAGE_DIR="$STAGE_DIR/usr" || 18 | check_prerequisite "${HOST_ARCH}-cc" 19 | 20 | mkdir -p "$STAGE_DIR/bin" || dienow 21 | 22 | # Build C Library 23 | 24 | if [ ! -z "$KARCH" ] 25 | then 26 | build_section linux-headers 27 | if [ -z "$UCLIBC_CONFIG" ] || [ ! -z "$MUSL" ] 28 | then 29 | build_section musl 30 | else 31 | build_section uClibc 32 | fi 33 | fi 34 | 35 | # Build binutils, gcc, and ccwrap 36 | 37 | build_section binutils 38 | [ ! -z "$ELF2FLT" ] && build_section elf2flt 39 | build_section gcc 40 | build_section ccwrap 41 | 42 | # Tell future packages to link against the libraries in the new compiler, 43 | # rather than the ones in the simple compiler. 44 | 45 | export "$(echo $ARCH | sed 's/-/_/g')"_CCWRAP_TOPDIR="$STAGE_DIR" 46 | 47 | if [ ! -z "$KARCH" ] 48 | then 49 | # Add C++ standard library 50 | 51 | [ -z "$NO_CPLUSPLUS" ] && build_section uClibc++ 52 | 53 | # For a native compiler, build make, bash, and distcc. (Yes, this is an old 54 | # version of Bash. It's intentional.) 55 | 56 | if [ -z "$TOOLCHAIN_PREFIX" ] 57 | then 58 | build_section make 59 | build_section bash 60 | build_section distcc 61 | cp "$SOURCES/toys/hdainit.sh" "$STAGE_DIR/../init" && 62 | mv "$STAGE_DIR"/{man,share/man} || dienow 63 | fi 64 | fi 65 | 66 | # Delete some unneeded files and strip everything else 67 | rm -rf "$STAGE_DIR"/{info,libexec/gcc/*/*/install-tools} || dienow 68 | if [ -z "$SKIP_STRIP" ] 69 | then 70 | "${ARCH}-strip" --strip-unneeded "$STAGE_DIR"/lib/*.so 71 | "${ARCH}-strip" "$STAGE_DIR"/{bin/*,sbin/*} 72 | fi 73 | 74 | create_stage_tarball 75 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-sh2.patch: -------------------------------------------------------------------------------- 1 | diff -ru gcc-core/gcc/config.gcc gcc-core.bak/gcc/config.gcc 2 | --- gcc-core/gcc/config.gcc 2014-10-11 13:03:43.993132192 -0500 3 | +++ gcc-core.bak/gcc/config.gcc 2014-10-11 13:14:27.048275968 -0500 4 | @@ -1964,7 +1964,7 @@ 5 | ;; 6 | sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \ 7 | sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ 8 | - sh-*-linux* | sh[346lbe]*-*-linux* | \ 9 | + sh-*-linux* | sh[2346lbe]*-*-linux* | \ 10 | sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ 11 | sh64-*-netbsd* | sh64l*-*-netbsd*) 12 | tmake_file="${tmake_file} sh/t-sh sh/t-elf" 13 | diff -ru gcc-core/gcc/config/sh/lib1funcs.asm gcc-core.bak/gcc/config/sh/lib1funcs.asm 14 | --- gcc-core/gcc/config/sh/lib1funcs.asm 2006-06-13 12:44:56.000000000 -0500 15 | +++ gcc-core.bak/gcc/config/sh/lib1funcs.asm 2014-10-16 06:28:53.842282481 -0500 16 | @@ -3891,3 +3891,7 @@ 17 | ENDFUNC(GLOBAL(udiv_qrnnd_16)) 18 | #endif /* !__SHMEDIA__ */ 19 | #endif /* L_udiv_qrnnd_16 */ 20 | + 21 | +#ifdef __sh2__ 22 | +#include "lib1funcs-Os-4-200.asm" 23 | +#endif 24 | diff -ru gcc-core/gcc/config/sh/lib1funcs.h gcc-core.bak/gcc/config/sh/lib1funcs.h 25 | --- gcc-core/gcc/config/sh/lib1funcs.h 2006-06-13 12:44:56.000000000 -0500 26 | +++ gcc-core.bak/gcc/config/sh/lib1funcs.h 2014-10-16 06:27:44.361942821 -0500 27 | @@ -26,6 +26,9 @@ 28 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, 29 | Boston, MA 02110-1301, USA. */ 30 | 31 | +#ifndef LIB1FUNCS_H 32 | +#define LIB1FUNCS_H 33 | + 34 | #ifdef __ELF__ 35 | #define LOCAL(X) .L_##X 36 | #define FUNC(X) .type X,@function 37 | @@ -79,3 +82,5 @@ 38 | #define SL1(branch, dest, in_slot) \ 39 | branch##/s dest; in_slot 40 | #endif /* !__sh1__ */ 41 | + 42 | +#endif 43 | diff -ruN gcc-core/gcc/config/sh/t-sh gcc-core.bak/gcc/config/sh/t-sh 44 | --- gcc-core/gcc/config/sh/t-sh 2006-06-13 12:44:56.000000000 -0500 45 | +++ gcc-core.bak/gcc/config/sh/t-sh 2014-10-24 07:13:49.252759353 -0500 46 | @@ -5,7 +5,7 @@ 47 | LIB1ASMSRC = sh/lib1funcs.asm 48 | LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movmem \ 49 | _movmem_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \ 50 | - _div_table _udiv_qrnnd_16 \ 51 | + _div_table _udiv_qrnnd_16 _udivsi3_i4i \ 52 | $(LIB1ASMFUNCS_CACHE) 53 | 54 | # We want fine grained libraries, so use the new code to build the 55 | -------------------------------------------------------------------------------- /sources/root-filesystem/sbin/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/hush 2 | 3 | # Announce version 4 | sed -n 's/PRETTY_NAME="\([^"]*\)"/\1/p' /etc/os-release 5 | 6 | export HOME=/home 7 | export PATH=/bin:/sbin 8 | 9 | # Mount filesystems 10 | mountpoint -q proc || mount -t proc proc proc 11 | mountpoint -q sys || mount -t sysfs sys sys 12 | mountpoint -q dev || mount -t devtmpfs dev dev || mdev -s 13 | mkdir -p dev/pts 14 | mountpoint -q dev/pts || mount -t devpts dev/pts dev/pts 15 | # /tmp inherited from initmpfs 16 | 17 | # If nobody said how many CPUS to use in builds, try to figure it out. 18 | if [ -z "$CPUS" ] 19 | then 20 | export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w) 21 | [ "$CPUS" -lt 1 ] && CPUS=1 22 | fi 23 | export PS1="($HOST:$CPUS) \w \$ " 24 | 25 | # When running under qemu, do some more setup 26 | if [ $$ -eq 1 ] 27 | then 28 | 29 | # Note that 10.0.2.2 forwards to 127.0.0.1 on the host. 30 | 31 | # Setup networking for QEMU (needs /proc) 32 | ifconfig eth0 10.0.2.15 33 | route add default gw 10.0.2.2 34 | 35 | # If we have no RTC, try rdate instead: 36 | [ "$(date +%s)" -lt 1000 ] && rdate 10.0.2.2 # or time-b.nist.gov 37 | 38 | # mount hda on /usr/overlay, hdb on /home, and hdc on /mnt, if available 39 | 40 | [ -b /dev/[hsv]da ] && 41 | mkdir -p /usr/overlay && mount /dev/[hsv]da /usr/overlay 42 | [ -b /dev/[hsv]db ] && mount -o noatime /dev/[hsv]db /home && cd /home 43 | [ -b /dev/[hsv]dc ] && mount -o ro /dev/[hsv]dc /mnt 44 | 45 | [ -z "$CONSOLE" ] && 46 | CONSOLE="$(sed -n 's@.* console=\(/dev/\)*\([^ ]*\).*@\2@p' /proc/cmdline)" 47 | 48 | # Call overlay/init if available 49 | [ -e /usr/overlay/init ] && . /usr/overlay/init 50 | 51 | [ -z "$HANDOFF" ] && echo Type exit when done. && HANDOFF=/bin/hush 52 | [ -z "$CONSOLE" ] && CONSOLE=console 53 | exec /sbin/oneit -c /dev/"$CONSOLE" "$HANDOFF" 54 | 55 | # If we're not PID 1, it's probably a chroot. 56 | else 57 | [ ! -z "$(grep "default for QEMU" /etc/resolv.conf)" ] && 58 | echo "nameserver 8.8.8.8" > /etc/resolv.conf 59 | 60 | # If we have no RTC, try using ntp to set the clock 61 | [ "$(date +%s)" -lt 10000000 ] && ntpd -nq -p north-america.pool.ntp.org 62 | 63 | # Switch to a shell with command history. 64 | 65 | echo Type exit when done. 66 | /bin/hush 67 | cd / 68 | umount ./dev/pts 69 | umount ./dev 70 | umount ./sys 71 | umount ./proc 72 | sync 73 | fi 74 | -------------------------------------------------------------------------------- /sources/patches/uClibc-mkostemp.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/stdlib.h b/include/stdlib.h 2 | index e9a8b84..b76078c 100644 3 | --- a/include/stdlib.h 4 | +++ b/include/stdlib.h 5 | @@ -630,16 +630,21 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur; 6 | marked with __THROW. */ 7 | # ifndef __USE_FILE_OFFSET64 8 | extern int mkstemp (char *__template) __nonnull ((1)) __wur; 9 | +extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur; 10 | # else 11 | # ifdef __REDIRECT 12 | extern int __REDIRECT (mkstemp, (char *__template), mkstemp64) 13 | __nonnull ((1)) __wur; 14 | +extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64) 15 | + __nonnull ((1)) __wur; 16 | # else 17 | # define mkstemp mkstemp64 18 | +# define mkostemp mkostemp64 19 | # endif 20 | # endif 21 | # ifdef __USE_LARGEFILE64 22 | extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; 23 | +extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur; 24 | # endif 25 | #endif 26 | 27 | diff --git a/libc/stdlib/mkstemp.c b/libc/stdlib/mkstemp.c 28 | index ce7d7db..68581b8 100644 29 | --- a/libc/stdlib/mkstemp.c 30 | +++ b/libc/stdlib/mkstemp.c 31 | @@ -25,7 +25,12 @@ 32 | The last six characters of TEMPLATE must be "XXXXXX"; 33 | they are replaced with a string that makes the filename unique. 34 | Then open the file and return a fd. */ 35 | +int mkostemp (char *template, int flags) 36 | +{ 37 | + return __gen_tempname (template, __GT_FILE, flags); 38 | +} 39 | + 40 | int mkstemp (char *template) 41 | { 42 | - return __gen_tempname (template, __GT_FILE, S_IRUSR | S_IWUSR); 43 | + return mkostemp(template, S_IRUSR | S_IWUSR); 44 | } 45 | diff --git a/libc/stdlib/mkstemp64.c b/libc/stdlib/mkstemp64.c 46 | index 2cdee70..375c5d3 100644 47 | --- a/libc/stdlib/mkstemp64.c 48 | +++ b/libc/stdlib/mkstemp64.c 49 | @@ -25,7 +25,12 @@ 50 | The last six characters of TEMPLATE must be "XXXXXX"; 51 | they are replaced with a string that makes the filename unique. 52 | Then open the file and return a fd. */ 53 | +int mkostemp64 (char *template, int flags) 54 | +{ 55 | + return __gen_tempname (template, __GT_BIGFILE, flags); 56 | +} 57 | + 58 | int mkstemp64 (char *template) 59 | { 60 | - return __gen_tempname (template, __GT_BIGFILE, S_IRUSR | S_IWUSR); 61 | + return mkostemp64 (template, S_IRUSR | S_IWUSR); 62 | } 63 | -------------------------------------------------------------------------------- /simple-cross-compiler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build a simple cross compiler for the specified target. 4 | 5 | # This simple compiler has no thread support, no libgcc_s.so, doesn't include 6 | # uClibc++, and is dynamically linked against the host's shared libraries. 7 | 8 | # Its stripped down nature makes it easy to build on an arbitrary host, and 9 | # provides just enough capability to build a root filesystem, and to be used 10 | # as a distcc accelerator from within that system. 11 | 12 | 13 | # Get lots of predefined environment variables and shell functions. 14 | 15 | source sources/include.sh || exit 1 16 | 17 | # Parse sources/targets/$1 18 | 19 | load_target "$1" 20 | 21 | # If this target has a base architecture that's already been built, use that. 22 | 23 | check_for_base_arch || exit 0 24 | 25 | export TOOLCHAIN_PREFIX="${ARCH}-" 26 | 27 | # Build binutils, gcc, and ccwrap 28 | 29 | build_section binutils 30 | [ ! -z "$ELF2FLT" ] && build_section elf2flt 31 | build_section gcc 32 | build_section ccwrap 33 | 34 | if [ ! -z "$KARCH" ] 35 | then 36 | 37 | # Build C Library 38 | 39 | build_section linux-headers 40 | 41 | if [ -z "$UCLIBC_CONFIG" ] || [ ! -z "$MUSL" ] 42 | then 43 | build_section musl 44 | else 45 | build_section uClibc 46 | fi 47 | fi 48 | 49 | [ ! -z "$KARCH" ] && cat > "${STAGE_DIR}"/README << EOF 50 | Cross compiler for $ARCH from http://landley.net/aboriginal 51 | 52 | To use: Add the "bin" subdirectory to your \$PATH, and use "$ARCH-cc" as 53 | your compiler. 54 | 55 | The syntax used to build the Linux kernel is: 56 | 57 | make ARCH=${KARCH} CROSS_COMPILE=${ARCH}- 58 | 59 | EOF 60 | 61 | # Strip the binaries 62 | 63 | if [ -z "$SKIP_STRIP" ] 64 | then 65 | cd "$STAGE_DIR" 66 | for i in `find bin -type f` `find "$CROSS_TARGET" -type f` 67 | do 68 | strip "$i" 2> /dev/null 69 | done 70 | fi 71 | 72 | if [ ! -z "$KARCH" ] 73 | then 74 | # A quick hello world program to test the cross compiler out. 75 | # Build hello.c dynamic, then static, to verify header/library paths. 76 | 77 | echo "Sanity test: building Hello World." 78 | 79 | "${ARCH}-gcc" -Os "${SOURCES}/root-filesystem/src/hello.c" -o "$WORK"/hello && 80 | "${ARCH}-gcc" -Os -static "${SOURCES}/root-filesystem/src/hello.c" \ 81 | -o "$WORK"/hello || dienow 82 | 83 | # Does the hello world we just built actually run? 84 | 85 | if [ ! -z "$CROSS_SMOKE_TEST" ] 86 | then 87 | more/cross-smoke-test.sh "$ARCH" || exit 1 88 | fi 89 | fi 90 | 91 | # Tar it up 92 | 93 | create_stage_tarball 94 | 95 | echo -e "\e[32mCross compiler toolchain build complete.\e[0m" 96 | -------------------------------------------------------------------------------- /www/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 26 | 27 | 28 | 64 | 65 |
4 | 5 | 6 |

Aboriginal Linux

7 |
10 | 24 |
11 | 23 |
25 |
29 |
30 | News 31 | 34 | Documentation 35 | 44 | Download 45 | 49 | 50 | Development 51 | 60 | Control Images 61 | 62 |
63 |
66 | -------------------------------------------------------------------------------- /more/cronjob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build stable versions of all packages with current scripts. 4 | 5 | # This gets run in the aboriginal top directory. 6 | 7 | pull_repo() 8 | { 9 | # Clone working copy 10 | 11 | rm -rf "packages/alt-$1-0.tar.bz2" build/packages/alt-$1 12 | mkdir -p build/packages/alt-$1 13 | pushd build/packages/alt-$1 && 14 | ln -s ../../../repos/$1/.git .git && 15 | git checkout -f master && 16 | git pull 17 | popd 18 | } 19 | 20 | # Expire snapshots directory 21 | 22 | SNAPSHOTS="$(find snapshots -mindepth 1 -maxdepth 1 -type d)" 23 | COUNT=$(( $(echo "$SNAPSHOTS" | wc -l) - 30 )) 24 | if [ "$COUNT" -gt 0 ] 25 | then 26 | # Delete appropriate number of oldest entries, then dead symlinks. 27 | rm -rf $( echo "$SNAPSHOTS" | sort | head -n $COUNT ) 28 | rm -rf $(find -L snapshots -type l) 29 | fi 30 | 31 | echo === Begin cron job 32 | 33 | # Start a new snapshot 34 | 35 | export SNAPSHOT_DATE=$(date +"%Y-%m-%d") 36 | mkdir -p snapshots/$SNAPSHOT_DATE/base && 37 | rm snapshots/latest && 38 | ln -sf $SNAPSHOT_DATE snapshots/latest || exit 1 39 | 40 | # build base repo 41 | 42 | build_snapshot() 43 | { 44 | if [ -z "$USE_ALT" ] 45 | then 46 | SNAPNAME=base 47 | else 48 | pull_repo $USE_ALT 49 | SNAPNAME=$USE_ALT 50 | fi 51 | 52 | echo === Building snapshot $SNAPNAME 53 | 54 | [ "$USE_ALT" == linux ] && 55 | more/for-each-arch.sh 'more/migrate-kernel.sh $TARGET' 56 | 57 | # Update manifest 58 | 59 | ./download.sh 60 | 61 | # If it's unchanged, just hardlink the previous binaries instead of rebuilding 62 | 63 | if cmp -s snapshots/latest/$SNAPNAME/MANIFEST packages/MANIFEST 64 | then 65 | cp -rl snapshots/latest/$SNAPNAME/* snapshots/$SNAPSHOT_DATE/$SNAPNAME 66 | return 67 | fi 68 | 69 | # Build it 70 | 71 | nice -n 20 more/buildall.sh 72 | rm build/simple-cross-compiler-*.tar.bz2 73 | mv build/*.tar.bz2 build/logs build/MANIFEST snapshots/$SNAPSHOT_DATE/$SNAPNAME 74 | } 75 | 76 | build_snapshot base 77 | 78 | echo === Building QEMU 79 | 80 | # build qemu-git 81 | 82 | QPATH="" 83 | CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w) 84 | pull_repo qemu 85 | pushd build/packages/alt-qemu 86 | ./configure --disable-werror && 87 | nice -n 20 make -j $CPUS 2>&1 | tee build/logs/alt-qemu.txt && 88 | QPATH="$(for i in *-softmmu;do echo -n $(pwd)/$i:; done)" 89 | popd 90 | 91 | # test all with qemu-git 92 | 93 | [ -z "$QPATH" ] || 94 | PATH="$QPATH:$PATH" more/for-each-target.sh \ 95 | 'more/smoketest.sh $TARGET | tee snapshots/$SNAPSHOT_DATE/base/logs/newqemu-smoketest-$TARGET.txt' 96 | 97 | #USE_ALT=linux build_snapshot 98 | #USE_ALT=uClibc build_snapshot 99 | #USE_ALT=busybox build_snapshot 100 | -------------------------------------------------------------------------------- /sources/root-filesystem/src/thread-hello2.c: -------------------------------------------------------------------------------- 1 | // Threaded hello world program that uses mutex and event semaphores to pass 2 | // the string to print from one thread to another, and waits for the child 3 | // thread to return a result before exiting the program. 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | // Thread, semaphores, and mailbox 11 | struct thread_info { 12 | pthread_t thread; 13 | pthread_mutex_t wakeup_mutex; 14 | pthread_cond_t wakeup_send, wakeup_receive; 15 | unsigned len; 16 | char *data; 17 | }; 18 | 19 | // Create a new thread with associated resources. 20 | struct thread_info *newthread(void *(*func)(void *)) 21 | { 22 | struct thread_info *ti = malloc(sizeof(struct thread_info)); 23 | memset(ti, 0, sizeof(struct thread_info)); 24 | 25 | pthread_create(&(ti->thread), NULL, func, ti); 26 | 27 | return ti; 28 | } 29 | 30 | // Send a block of data through mailbox. 31 | void thread_send(struct thread_info *ti, char *data, unsigned len) 32 | { 33 | pthread_mutex_lock(&(ti->wakeup_mutex)); 34 | // If consumer hasn't consumed yet, wait for them to do so. 35 | if (ti->len) 36 | pthread_cond_wait(&(ti->wakeup_send), &(ti->wakeup_mutex)); 37 | ti->data = data; 38 | ti->len = len; 39 | pthread_cond_signal(&(ti->wakeup_receive)); 40 | pthread_mutex_unlock(&(ti->wakeup_mutex)); 41 | } 42 | 43 | // Receive a block of data through mailbox. 44 | void thread_receive(struct thread_info *ti, char **data, unsigned *len) 45 | { 46 | pthread_mutex_lock(&(ti->wakeup_mutex)); 47 | if (!ti->len) 48 | pthread_cond_wait(&(ti->wakeup_receive), &(ti->wakeup_mutex)); 49 | *data = ti->data; 50 | *len = ti->len; 51 | // If sender is waiting to send us a second message, wake 'em up. 52 | // Note that "if (ti->len)" be used as an unlocked/nonblocking test for 53 | // pending data, although you still need call this function to read data. 54 | ti->len = 0; 55 | pthread_cond_signal(&(ti->wakeup_send)); 56 | pthread_mutex_unlock(&(ti->wakeup_mutex)); 57 | } 58 | 59 | // Function for new thread to execute. 60 | void *hello_thread(void *thread_data) 61 | { 62 | struct thread_info *ti = (struct thread_info *)thread_data; 63 | 64 | for (;;) { 65 | unsigned len; 66 | char *data; 67 | 68 | thread_receive(ti, &data, &len); 69 | if (!data) break; 70 | printf("%.*s", len, data); 71 | free(data); 72 | } 73 | 74 | return 0; 75 | } 76 | 77 | int main(int argc, char *argv[]) 78 | { 79 | void *result; 80 | char *data = strdup("Hello world!\n"); 81 | struct thread_info *ti = newthread(hello_thread); 82 | 83 | // Send one line of text. 84 | thread_send(ti, data, strlen(data)); 85 | // Signal thread to exit and wait for it to do so. 86 | thread_send(ti, NULL, 1); 87 | pthread_join(ti->thread, &result); 88 | 89 | return (long)result; 90 | } 91 | -------------------------------------------------------------------------------- /sources/toys/wrappy.c: -------------------------------------------------------------------------------- 1 | // A little wrapper to figure out what commands you're actually using. 2 | 3 | // To use it, you'll need to make a directory of symlinks and set up two 4 | // environment variables. Something like: 5 | // 6 | // export WRAPPY_LOGPATH=/path/to/wrappy.log 7 | // export OLDPATH="$PATH" 8 | // 9 | // WRAPPYDIR=/path/to/wrappy 10 | // cp wrappy $WRAPPYDIR 11 | // for i in `echo $PATH | sed 's/:/ /g'` 12 | // do 13 | // for j in `ls $i` 14 | // do 15 | // ln -s wrappy $WRAPPYDIR/$j 16 | // done 17 | // done 18 | // 19 | // PATH="$WRAPPYDIR" make thingy 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | // No, I'm not doing any bounds checking. It's a debug wrapper. 27 | char blah[65536]; 28 | 29 | int main(int argc, char *argv[], char *env[]) 30 | { 31 | char *logpath, *realpath, *p, *p2, *p3; 32 | 33 | int i, fd; 34 | 35 | // If these environment variables didn't propogate down to our build, how 36 | // did $PATH make it there? (Faily noisily if they are missing...) 37 | 38 | logpath = getenv("WRAPPY_LOGPATH"); 39 | realpath = getenv("OLDPATH"); 40 | if (!logpath || !realpath) { 41 | fprintf(stderr, "No %s\n", logpath ? "OLDPATH" : "WRAPPY_LOGPATH"); 42 | exit(1); 43 | } 44 | 45 | // Figure out name of command being run. 46 | 47 | p2 = strrchr(*argv, '/'); 48 | if (!p2) p2=*argv; 49 | else p2++; 50 | 51 | // Write command line to a buffer. (We need the whole command line in one 52 | // buffer so we can do a single atomic write, so commands don't get 53 | // interleaved via make -j.) 54 | 55 | p=blah + sprintf(blah, "%s ",p2); 56 | for (i=1; idecl) 13 | + else if ((DECL_WEAK (node->decl) || !(*targetm.binds_local_p) (node->decl)) 14 | && !DECL_COMDAT (node->decl) && !DECL_EXTERNAL (node->decl)) 15 | avail = AVAIL_OVERWRITABLE; 16 | else avail = AVAIL_AVAILABLE; 17 | @@ -1190,7 +1190,8 @@ cgraph_variable_initializer_availability (struct cgraph_varpool_node *node) 18 | /* If the variable can be overwritten, return OVERWRITABLE. Takes 19 | care of at least two notable extensions - the COMDAT variables 20 | used to share template instantiations in C++. */ 21 | - if (!(*targetm.binds_local_p) (node->decl) && !DECL_COMDAT (node->decl)) 22 | + if ((DECL_WEAK (node->decl) || !(*targetm.binds_local_p) (node->decl)) 23 | + && !DECL_COMDAT (node->decl)) 24 | return AVAIL_OVERWRITABLE; 25 | return AVAIL_AVAILABLE; 26 | } 27 | diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c 28 | index 84ef830..73d9fcc 100644 29 | --- a/gcc/ipa-inline.c 30 | +++ b/gcc/ipa-inline.c 31 | @@ -300,7 +300,7 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason) 32 | 33 | if (n->inline_decl) 34 | decl = n->inline_decl; 35 | - if (!DECL_INLINE (decl)) 36 | + if (!DECL_INLINE (decl) || DECL_WEAK (decl)) 37 | { 38 | if (reason) 39 | *reason = N_("function not inlinable"); 40 | diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c 41 | index fdaff50..1bfd577 100644 42 | --- a/gcc/ipa-pure-const.c 43 | +++ b/gcc/ipa-pure-const.c 44 | @@ -512,7 +512,7 @@ analyze_function (struct cgraph_node *fn) 45 | /* If this function does not return normally or does not bind local, 46 | do not touch this unless it has been marked as const or pure by the 47 | front end. */ 48 | - if (TREE_THIS_VOLATILE (decl) 49 | + if (TREE_THIS_VOLATILE (decl) || DECL_WEAK (decl) 50 | || !targetm.binds_local_p (decl)) 51 | { 52 | l->pure_const_state = IPA_NEITHER; 53 | diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c 54 | index 1c0b79b..5a3ba7e 100644 55 | --- a/gcc/tree-inline.c 56 | +++ b/gcc/tree-inline.c 57 | @@ -1522,6 +1522,8 @@ inlinable_function_p (tree fn) 58 | else if (!DECL_INLINE (fn) && !flag_unit_at_a_time) 59 | inlinable = false; 60 | 61 | + else if (DECL_WEAK (fn)) 62 | + inlinable = false; 63 | else if (inline_forbidden_p (fn)) 64 | { 65 | /* See if we should warn about uninlinable functions. Previously, 66 | -------------------------------------------------------------------------------- /sources/baseconfig-uClibc: -------------------------------------------------------------------------------- 1 | # Common configuration for uClibc. 2 | 3 | # This is a miniconfig (created by running sources/toys/miniconfig.sh on 4 | # a full .config file), to which target-specific entries in $UCLIBC_CONFIG 5 | # (from the target's settings file) are appended. 6 | 7 | # Obsolete symbols 0.9.30 needs 8 | 9 | #UCLIBC_HAS_THREADS=y 10 | #UCLIBC_HAS_REALTIME=y 11 | #UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y 12 | 13 | # Obsolete symbols for 0.9.31 14 | 15 | ARCH_HAS_MMU=y 16 | #LINUXTHREADS_OLD=y 17 | 18 | # Baseconfig for 0.9.31 19 | 20 | ARCH_USE_MMU=y 21 | UCLIBC_HAS_FLOATS=y 22 | DO_C99_MATH=y 23 | UCLIBC_HAS_FENV=y 24 | HAVE_SHARED=y 25 | LDSO_CACHE_SUPPORT=y 26 | LDSO_BASE_FILENAME="ld-uClibc.so" 27 | UCLIBC_STATIC_LDCONFIG=y 28 | LDSO_RUNPATH=y 29 | LDSO_SEARCH_INTERP_PATH=y 30 | LDSO_LD_LIBRARY_PATH=y 31 | UCLIBC_CTOR_DTOR=y 32 | UCLIBC_HAS_THREADS_NATIVE=y 33 | UCLIBC_HAS_TLS=y 34 | UCLIBC_HAS_SYSLOG=y 35 | UCLIBC_HAS_LFS=y 36 | MALLOC_GLIBC_COMPAT=y 37 | UCLIBC_DYNAMIC_ATEXIT=y 38 | UCLIBC_SUSV3_LEGACY=y 39 | UCLIBC_SUSV3_LEGACY_MACROS=y 40 | UCLIBC_SUSV4_LEGACY=y 41 | UCLIBC_HAS_SHADOW=y 42 | UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y 43 | UCLIBC_HAS___PROGNAME=y 44 | UCLIBC_HAS_PTY=y 45 | ASSUME_DEVPTS=y 46 | UNIX98PTY_ONLY=y 47 | UCLIBC_HAS_LIBUTIL=y 48 | UCLIBC_HAS_TM_EXTENSIONS=y 49 | UCLIBC_HAS_TZ_CACHING=y 50 | UCLIBC_HAS_TZ_FILE=y 51 | UCLIBC_HAS_TZ_FILE_READ_MANY=y 52 | UCLIBC_LINUX_SPECIFIC=y 53 | UCLIBC_HAS_GNU_ERROR=y 54 | UCLIBC_BSD_SPECIFIC=y 55 | UCLIBC_HAS_BSD_ERR=y 56 | UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y 57 | UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y 58 | UCLIBC_NTP_LEGACY=y 59 | UCLIBC_SV4_DEPRECATED=y 60 | UCLIBC_HAS_REALTIME=y 61 | UCLIBC_HAS_ADVANCED_REALTIME=y 62 | UCLIBC_HAS_EPOLL=y 63 | UCLIBC_HAS_XATTR=y 64 | UCLIBC_HAS_PROFILING=y 65 | UCLIBC_HAS_CRYPT_IMPL=y 66 | UCLIBC_HAS_NETWORK_SUPPORT=y 67 | UCLIBC_HAS_IPV4=y 68 | UCLIBC_HAS_IPV6=y 69 | UCLIBC_HAS_RPC=y 70 | UCLIBC_HAS_FULL_RPC=y 71 | UCLIBC_HAS_REENTRANT_RPC=y 72 | UCLIBC_HAS_RESOLVER_SUPPORT=y 73 | UCLIBC_HAS_LIBRESOLV_STUB=y 74 | UCLIBC_HAS_STRING_GENERIC_OPT=y 75 | UCLIBC_HAS_STRING_ARCH_OPT=y 76 | UCLIBC_HAS_CTYPE_TABLES=y 77 | UCLIBC_HAS_CTYPE_SIGNED=y 78 | UCLIBC_HAS_WCHAR=y 79 | UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y 80 | UCLIBC_HAS_STDIO_GETC_MACRO=y 81 | UCLIBC_HAS_STDIO_PUTC_MACRO=y 82 | UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y 83 | UCLIBC_HAS_PRINTF_M_SPEC=y 84 | UCLIBC_HAS_ERRNO_MESSAGES=y 85 | UCLIBC_HAS_SIGNUM_MESSAGES=y 86 | UCLIBC_HAS_GNU_GETOPT=y 87 | UCLIBC_HAS_GNU_GETSUBOPT=y 88 | UCLIBC_HAS_REGEX=y 89 | UCLIBC_HAS_REGEX_OLD=y 90 | UCLIBC_HAS_FNMATCH=y 91 | UCLIBC_HAS_FNMATCH_OLD=y 92 | UCLIBC_HAS_GLOB=y 93 | UCLIBC_HAS_GNU_GLOB=y 94 | UCLIBC_BUILD_RELRO=y 95 | UCLIBC_BUILD_NOEXECSTACK=y 96 | UCLIBC_HAS_LIBNSL_STUB=y 97 | UCLIBC_HAS_UTMPX=y 98 | UCLIBC_LINUX_MODULE_26=y 99 | 100 | # Optional internationalization stuff 101 | 102 | #UCLIBC_HAS_LOCALE=y 103 | #UCLIBC_HAS_XLOCALE=y 104 | #UCLIBC_BUILD_MINIMAL_LOCALE=y 105 | 106 | # These hugely obscure functions are required by mdadm partition scanning. 107 | 108 | UCLIBC_HAS_FTW=y 109 | UCLIBC_HAS_NFTW=y 110 | UCLIBC_HAS_GETPT=y 111 | -------------------------------------------------------------------------------- /more/bisectinate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Development script: bisect a git repository to find the first broken commit 4 | # since the last known good version. 5 | 6 | # If any of the pipe segments fail, treat that as a fail. 7 | 8 | set -o pipefail 9 | 10 | if [ $# -lt 4 ] 11 | then 12 | echo "usage: bisectinate ARCH PACKAGE REPO[@BAD] GOOD [TEST...]" >&2 13 | echo >&2 14 | echo "Bisect PACKAGE for ARCH, from START to BAD within REPO" >&2 15 | exit 1 16 | fi 17 | 18 | # Parse command line options 19 | 20 | ARCH="$1" 21 | PKG="$2" 22 | REPO="${3/@*/}" 23 | BRANCH="${3/*@/}" 24 | [ "$BRANCH" == "$3" ] && BRANCH=master 25 | START="$4" 26 | shift 4 27 | TEST="$1" 28 | 29 | TOP="$(pwd)" 30 | [ -z "$SRCDIR" ] && SRCDIR="$TOP/packages" 31 | [ -z "$BUILD" ] && BUILD="$TOP/build" 32 | 33 | if [ ! -d "$REPO/.git" ] 34 | then 35 | echo "No git repo at $REPO" 36 | exit 1 37 | fi 38 | 39 | [ -z "$TEST" ] && TEST=true 40 | 41 | # For kernel and busybox bisects, only redo part of the build 42 | 43 | if [ "$PKG" == linux ] && [ -e "$BUILD/root-filesystem-$ARCH".tar.bz2 ] 44 | then 45 | ZAPJUST=linux-kernel 46 | elif [ "$PKG" == busybox ] && 47 | [ -e "$BUILD/simple-cross-compiler-$ARCH.tar.bz2" ] 48 | then 49 | ZAPJUST=root-filesystem 50 | else 51 | ZAPJUST= 52 | fi 53 | 54 | # Initialize bisection repository 55 | 56 | rm -rf "$BUILD/packages/alt-$PKG" "$SRCDIR/alt-$PKG-0.tar.bz2" && 57 | mkdir -p "$BUILD"/{logs,packages} && 58 | cd "$BUILD/packages" && 59 | git clone "$REPO" "alt-$PKG" && 60 | cd "alt-$PKG" && 61 | git bisect start && 62 | git bisect good "$START" || exit 1 63 | 64 | RESULT="bad $BRANCH" 65 | 66 | # Loop through bisection results 67 | 68 | while true 69 | do 70 | # Bisect repository to prepare next version to build. Exit if done. 71 | 72 | cd "$BUILD/packages/alt-$PKG" && 73 | git clean -fdx && 74 | git checkout -f || exit 1 75 | 76 | RESULT="$(git bisect $RESULT)" 77 | echo "$RESULT" 78 | [ ! "$(echo "$RESULT" | head -n 1 | grep "^Bisecting:")" ] && exit 79 | 80 | # Update log 81 | 82 | git show > "$BUILD/logs/bisectinate-${ARCH}.txt" 83 | git bisect log > "$BUILD/logs/bisectinate-${ARCH}.log" 84 | # The "cat" bypasses git's stupid overengineered built-in call to less. 85 | git log HEAD -1 | cat 86 | echo "Testing..." 87 | 88 | cd "$TOP" || exit 1 89 | 90 | # Figure out how much ./build.sh needs to rebuild 91 | 92 | [ ! -z "$ZAPJUST" ] && 93 | rm -rf "$BUILD/${ZAPJUST}-$ARCH"{,.tar.bz2} || 94 | rm -rf "$BUILD"/*-"$ARCH"{,.tar.bz2} 95 | 96 | # Try the build 97 | 98 | EXTRACT_ALL=1 ALLOW_PATCH_FAILURE=1 USE_ALT="$PKG" \ 99 | ./build.sh "$ARCH" 2>&1 | tee -a "$BUILD"/logs/bisectinate-"$ARCH".txt 100 | 101 | # Did it work? 102 | 103 | RESULT=bad 104 | if [ -e "$BUILD"/system-image-"$ARCH".tar.bz2 ] 105 | then 106 | set -o pipefail 107 | ARCH="$ARCH" more/timeout.sh 60 "$TEST" 2>&1 | \ 108 | tee -a "$BUILD/logs/bisectinate-$ARCH".txt 109 | [ $? -eq 0 ] && RESULT=good 110 | fi 111 | 112 | # Keep the last "good" and "bad" logs, separately. 113 | 114 | mv "$BUILD"/logs/bisectinate{,-$RESULT}-"$ARCH".txt 115 | done 116 | -------------------------------------------------------------------------------- /root-filesystem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build a basic busybox+uClibc root filesystem for a given target. 4 | 5 | # Requires a cross-compiler (or simple-cross-compiler) in the $PATH or in 6 | # the build directory. In theory you can supply your own as long as the 7 | # prefix- name is correct. 8 | 9 | source sources/include.sh || exit 1 10 | load_target "$1" 11 | check_for_base_arch || exit 0 12 | check_prerequisite "${CC_PREFIX}cc" 13 | 14 | # Source control isn't good at storing empty directories, so create 15 | # directory layout and apply permissions changes. 16 | 17 | mkdir -p "$STAGE_DIR"/{tmp,proc,sys,dev,home,mnt,root} && 18 | chmod a+rwxt "$STAGE_DIR/tmp" || dienow 19 | 20 | STAGE_USR="$STAGE_DIR/usr" 21 | 22 | # Having lots of repeated locations at / and also under /usr is silly, so 23 | # symlink them together. (The duplication happened back in the 1970's 24 | # when Ken and Dennis ran out of space on their PDP-11's root disk and 25 | # leaked the OS into the disk containing the user home directories. It's 26 | # been mindlessly duplicated ever since.) 27 | for i in bin sbin lib etc 28 | do 29 | mkdir -p "$STAGE_USR/$i" && ln -s "usr/$i" "$STAGE_DIR/$i" || dienow 30 | done 31 | 32 | # Copy qemu setup script and so on. 33 | 34 | cp -r "$SOURCES/root-filesystem/." "$STAGE_USR/" && 35 | echo -e "CROSS_TARGET=$CROSS_TARGET\nKARCH=$KARCH" > \ 36 | "$STAGE_USR/src/host-info" && 37 | cp "$SRCDIR"/MANIFEST "$STAGE_USR/src" || dienow 38 | 39 | # If user specified different files to put in the root filesystem, add them. 40 | # (This overwrites existing files.) 41 | 42 | if [ ! -z "$MY_ROOT_OVERLAY" ] 43 | then 44 | cd "$TOP" 45 | tar -c -C "$MY_ROOT_OVERLAY" . | tar -x -C "$STAGE_DIR" || dienow 46 | fi 47 | 48 | # Build toybox 49 | 50 | STAGE_DIR="$STAGE_USR" build_section busybox 51 | cp "$WORK"/config-busybox "$STAGE_USR"/src || dienow 52 | build_section toybox 53 | 54 | # Put statically and dynamically linked hello world programs on there for 55 | # test purposes. 56 | 57 | "${CC_PREFIX}cc" "${SOURCES}/root-filesystem/src/hello.c" -Os $CFLAGS \ 58 | -o "$STAGE_USR/bin/hello-dynamic" || dienow 59 | 60 | if [ "$BUILD_STATIC" != none ] 61 | then 62 | "${CC_PREFIX}cc" "${SOURCES}/root-filesystem/src/hello.c" -Os $CFLAGS -static \ 63 | -o "$STAGE_USR/bin/hello-static" || dienow 64 | STATIC=--static 65 | else 66 | STATIC= 67 | fi 68 | 69 | # Debug wrapper for use with /usr/src/record-commands.sh 70 | 71 | "${CC_PREFIX}cc" "$SOURCES/toys/wrappy.c" -Os $CFLAGS $STATIC \ 72 | -o "$STAGE_USR/bin/record-commands-wrapper" || dienow 73 | 74 | # Do we need shared libraries? 75 | 76 | if ! is_in_list toybox $BUILD_STATIC || ! is_in_list busybox $BUILD_STATIC 77 | then 78 | echo Copying compiler libraries... 79 | mkdir -p "$STAGE_USR/lib" || dienow 80 | (path_search \ 81 | "$("${CC_PREFIX}cc" --print-search-dirs | sed -n 's/^libraries: =*//p')" \ 82 | "*.so*" 'cp -H "$DIR/$FILE" "$STAGE_USR/lib/$FILE"' \ 83 | || dienow) | dotprogress 84 | 85 | [ -z "$SKIP_STRIP" ] && 86 | "${CC_PREFIX}strip" --strip-unneeded "$STAGE_USR"/lib/*.so 87 | fi 88 | 89 | # Clean up and package the result 90 | 91 | [ -z "$SKIP_STRIP" ] && 92 | "${CC_PREFIX}strip" "$STAGE_USR"/{bin/*,sbin/*} 93 | 94 | create_stage_tarball 95 | 96 | # Color back to normal 97 | echo -e "\e[0mBuild complete" 98 | -------------------------------------------------------------------------------- /sources/patches/linux-fixsh4.patch: -------------------------------------------------------------------------------- 1 | Revert the following patch, which breaks the sh4 target: 2 | 3 | commit fea966f7564205fcf5919af9bde031e753419c96 4 | Author: Stuart Menefy 5 | Date: Mon Aug 24 17:09:53 2009 +0900 6 | 7 | sh: Remove implicit sign extension from assembler immediates 8 | 9 | The SH instruction set has several instructions which accept an 8 bit 10 | immediate operand. For logical instructions this operand is zero extended, 11 | for arithmetic instructions the operand is sign extended. After adding an 12 | option to the assembler to check this, it was found that several pieces 13 | of assembly code were assuming this behaviour, and in one case 14 | getting it wrong. 15 | 16 | So this patch explicitly sign extends any immediate operands, which makes 17 | it obvious what is happening, and fixes the one case which got it wrong. 18 | 19 | Signed-off-by: Stuart Menefy 20 | Signed-off-by: Paul Mundt 21 | diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S 22 | index 02a3093..06ac31f 100644 23 | --- a/arch/sh/boot/compressed/head_32.S 24 | +++ b/arch/sh/boot/compressed/head_32.S 25 | @@ -22,7 +22,7 @@ startup: 26 | bt clear_bss 27 | sub r0, r2 28 | mov.l bss_start_addr, r0 29 | - mov #0xffffffe0, r1 30 | + mov #0xe0, r1 31 | and r1, r0 ! align cache line 32 | mov.l text_start_addr, r3 33 | mov r0, r1 34 | diff --git a/arch/sh/include/asm/entry-macros.S b/arch/sh/include/asm/entry-macros.S 35 | index cc43a55..64fd0de 100644 36 | --- a/arch/sh/include/asm/entry-macros.S 37 | +++ b/arch/sh/include/asm/entry-macros.S 38 | @@ -7,7 +7,7 @@ 39 | .endm 40 | 41 | .macro sti 42 | - mov #0xfffffff0, r11 43 | + mov #0xf0, r11 44 | extu.b r11, r11 45 | not r11, r11 46 | stc sr, r10 47 | diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S 48 | index 9421ec7..8c19e21 100644 49 | --- a/arch/sh/kernel/cpu/sh3/entry.S 50 | +++ b/arch/sh/kernel/cpu/sh3/entry.S 51 | @@ -257,7 +257,7 @@ restore_all: 52 | ! 53 | ! Calculate new SR value 54 | mov k3, k2 ! original SR value 55 | - mov #0xfffffff0, k1 56 | + mov #0xf0, k1 57 | extu.b k1, k1 58 | not k1, k1 59 | and k1, k2 ! Mask original SR value 60 | diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S 61 | index 68d9223..7004776 100644 62 | --- a/arch/sh/kernel/entry-common.S 63 | +++ b/arch/sh/kernel/entry-common.S 64 | @@ -98,9 +98,8 @@ need_resched: 65 | 66 | mov #OFF_SR, r0 67 | mov.l @(r0,r15), r0 ! get status register 68 | - shlr r0 69 | - and #(0xf0>>1), r0 ! interrupts off (exception path)? 70 | - cmp/eq #(0xf0>>1), r0 71 | + and #0xf0, r0 ! interrupts off (exception path)? 72 | + cmp/eq #0xf0, r0 73 | bt noresched 74 | mov.l 1f, r0 75 | jsr @r0 ! call preempt_schedule_irq 76 | diff --git a/arch/sh/lib/clear_page.S b/arch/sh/lib/clear_page.S 77 | index c92244d..8342bfb 100644 78 | --- a/arch/sh/lib/__clear_user.S 79 | +++ b/arch/sh/lib/__clear_user.S 80 | @@ -57,7 +57,7 @@ ENTRY(clear_page) 81 | ENTRY(__clear_user) 82 | ! 83 | mov #0, r0 84 | - mov #0xffffffe0, r1 85 | + mov #0xe0, r1 ! 0xffffffe0 86 | ! 87 | ! r4..(r4+31)&~32 -------- not aligned [ Area 0 ] 88 | ! (r4+31)&~32..(r4+r5)&~32 -------- aligned [ Area 1 ] 89 | -------------------------------------------------------------------------------- /sources/patches/linux-arm-qemuirq.patch: -------------------------------------------------------------------------------- 1 | Modify arm IRQ setup to work with all versions of qemu since 1.0. 2 | 3 | For many years, the kernel's versatile board setup expected all devices 4 | to share IRQ 27, and QEMU 1.2 helpfully emulated hardware that did that 5 | (or used IRQ 59 if the IRQ controller was told to shift everything up 32 6 | places). This wasn't what the actual hardware did, but nobody noticed for 7 | over a decade because this reference board was long-gone and only useful 8 | as a base for virtualization. 9 | 10 | Then the kernel developers noticed that the default IRQ range could 11 | (theoretically) use IRQ 0 as an actual IRQ, so they poked the "move everything 12 | up 32 places" register... and got the math wrong calculating the new IRQ 13 | to expect stuff on. (Because just adding 32 wouldn't be the right thing to 14 | do, you've gotta do a multi-stage process going through three different 15 | functions with a callback.) 16 | 17 | When informed they'd broken qemu, they looked up old Versatile documentation 18 | and realized what they'd done had never matched real hardware, and adjusted 19 | it to some other random value: still getting the math wrong. Then they finally 20 | fixed the wrong math, but it turns out the documentation they were using 21 | didn't match what actual hardware was doing, or something. All in all they 22 | changed the IRQ mapping at least _4_TIMES_ before finally unearthing an 23 | actual Versatile board out of some landfill or other to test it out on. 24 | Needless to say, "this breaks QEMU" was not considered a valid data point. 25 | 26 | Meanwhile, QEMU 1.2 and earlier only supported the "everything on irq 27" mode, 27 | and the next several releases supported random potluck things the kernel du 28 | jour did, but current ones don't. 29 | 30 | BUT: if you the kernel requests irq 27 from the controller as 31 | its first action, QEMU thinks you're running an old "everying on 27" kernel 32 | and triggers an emulation mode that puts everything on IRQ 27 (or 59 if 33 | you flip the add 32 bit in the controller, meaning current kernels aren't 34 | bothered by IRQ 0 being potentially used). And this runs on all the qemu 35 | versions since 1.0. (Although you still don't want to use QEMU 1.3 and 1.4 36 | because they had a bug in TCG that got the size of translated blocks wrong 37 | causing spurious but highly intermittent segfaults...) 38 | 39 | Note, I broke this patch out of the big arm patch after the FIFTH time 40 | they made changes that prevented this patch from cleanly applying. 41 | 42 | diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c 43 | index c97be4e..da0342d 100644 44 | --- a/arch/arm/mach-versatile/pci.c 45 | +++ b/arch/arm/mach-versatile/pci.c 46 | @@ -305,7 +305,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys) 47 | * real hardware behaviour and it need not be backwards 48 | * compatible for us. This write is harmless on real hardware. 49 | */ 50 | - __raw_writel(0, VERSATILE_PCI_VIRT_BASE+PCI_INTERRUPT_LINE); 51 | + __raw_writel(27, VERSATILE_PCI_VIRT_BASE+PCI_INTERRUPT_LINE); 52 | 53 | /* 54 | * Do not to map Versatile FPGA PCI device into memory space 55 | @@ -346,7 +346,7 @@ static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 56 | * 30 PCI0 PCI1 PCI2 PCI3 57 | * 29 PCI3 PCI0 PCI1 PCI2 58 | */ 59 | - irq = IRQ_SIC_PCI0 + ((slot + 2 + pin - 1) & 3); 60 | + irq = 59; 61 | 62 | return irq; 63 | } 64 | -------------------------------------------------------------------------------- /sources/toys/trximg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create a TRX image from up to three source files (kernel, initramfs, rootfs), 4 | # and output it to stdout. (This is the format you flash linksys routers with.) 5 | 6 | # The TRX format is a simple (28 byte) header followed by the concatenation of 7 | # the files with each file zero padded to a multiple of 4 bytes, and then the 8 | # file as a whole padded up to 4k. Padding is done with zero bytes. 9 | 10 | # The tricky part is calculating the lengths and CRC for the header before 11 | # outputting the header, without screwing up the ability to pipe the output 12 | # somewhere. 13 | 14 | if [ ! -f "$1" ] || 15 | ( [ ! -z "$2" ] && [ ! -f "$2" ] ) || 16 | ( [ ! -z "$3" ] && [ ! -f "$3" ] ) 17 | then 18 | echo "Usage: trximg.sh file1 [file2 [file3]]" >&2 19 | exit 1 20 | fi 21 | 22 | # Output $1 bytes of decimal number $2 as little endian binary data 23 | 24 | function leout() 25 | { 26 | X=0 27 | DATA=$2 28 | 29 | # Loop through bytes, smallest first 30 | 31 | while [ $X -lt $1 ] 32 | do 33 | # Grab next byte 34 | 35 | BYTE=$[$DATA%256] 36 | DATA=$[$DATA/256] 37 | 38 | # Convert to octal (because that's what echo needs) 39 | 40 | OCTAL="" 41 | for i in 1 2 3 42 | do 43 | OCTAL=$[$BYTE%8]"$OCTAL" 44 | BYTE=$[$BYTE/8] 45 | done 46 | 47 | # Emit byte and loop 48 | 49 | echo -ne "\0$OCTAL" 50 | 51 | X=$[$X+1] 52 | BYTE=$x 53 | done 54 | } 55 | 56 | # Print number of bytes required to round $2 up to a multiple of $1 57 | 58 | function padlen() 59 | { 60 | echo $[($1-($2%$1))%$1] 61 | } 62 | 63 | # Print number $2 rounded up to $1 64 | 65 | function roundlen() 66 | { 67 | echo $[$2+$(padlen $1 $2)] 68 | } 69 | 70 | # Return length of file $1 in bytes 71 | 72 | function filelen() 73 | { 74 | wc -c "$1" | awk '{print $1}' 75 | } 76 | 77 | # Output $1 zero bytes 78 | 79 | function zpad() 80 | { 81 | [ $1 -ne 0 ] && dd if=/dev/zero bs=$1 count=1 2>/dev/null 82 | } 83 | 84 | # Output file $2, followed by enough zero bytes to pad length up to $1 bytes 85 | 86 | function zpad_file() 87 | { 88 | [ -z "$2" ] && return 89 | cat $2 90 | zpad $(padlen $1 $(filelen "$2")) 91 | } 92 | 93 | # Output header. (Optionally just the part included in the CRC32). 94 | 95 | function emit_header 96 | { 97 | if [ -z "$1" ] 98 | then 99 | echo -n "HDR0" # File ID magic 100 | leout 4 $LENGTH # Length of file (including this header) 101 | leout 4 $CRC32 # crc32 of all file data after this crc field 102 | fi 103 | 104 | leout 2 0 # flags 105 | leout 2 1 # version 106 | leout 4 28 # Start of first file 107 | leout 4 $OFFSET2 # Start of second file 108 | leout 4 $OFFSET3 # Start of third file 109 | } 110 | 111 | # Calculate file offsets for the three arguments 112 | 113 | TOTAL=$[28+$(roundlen 4 $(filelen "$1"))] 114 | if [ -z "$2" ] 115 | then 116 | OFFSET2=0 117 | else 118 | OFFSET2=$TOTAL 119 | TOTAL=$[$TOTAL+$(roundlen 4 $(filelen "$2"))] 120 | fi 121 | if [ -z "$3" ] 122 | then 123 | OFFSET3=0 124 | else 125 | OFFSET3=$TOTAL 126 | TOTAL=$[$TOTAL+$(roundlen 4 $(filelen "$3"))] 127 | fi 128 | LENGTH=$(roundlen 4096 $TOTAL) 129 | 130 | # Calculate the CRC value for the header 131 | 132 | CRC32=$( 133 | ( 134 | emit_header skip 135 | zpad_file 4 "$1" 136 | zpad_file 4 "$2" 137 | zpad_file 4 "$3" 138 | zpad $(padlen 4096 $TOTAL) 139 | ) | cksum -NILP 140 | ) 141 | 142 | # Output the image to stdout 143 | 144 | emit_header 145 | zpad_file 4 "$1" 146 | zpad_file 4 "$2" 147 | zpad_file 4 "$3" 148 | zpad $(padlen 4096 $TOTAL) 149 | -------------------------------------------------------------------------------- /sources/variables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/echo "This file is sourced, not run" 2 | 3 | # Avoid trouble from unexpected environment settings by unsetting all 4 | # environment variables that we don't know about, in case some crazy 5 | # person already exported $CROSS_COMPILE, $ARCH, $CDPATH, or who knows 6 | # what else. It's hard to know what might drive some package crazy, 7 | # so use a whitelist. 8 | 9 | if [ -z "$NO_SANITIZE_ENVIRONMENT" ] 10 | then 11 | # Which variables are set in config? 12 | 13 | TEMP=$(echo $(sed -n 's/.*export[ \t]*\([^=]*\)=.*/\1/p' config) | sed 's/ /,/g') 14 | 15 | # What other variables should we keep? 16 | 17 | TEMP="$TEMP,LANG,PATH,SHELL,TERM,USER,USERNAME,LOGNAME,PWD,EDITOR,HOME" 18 | TEMP="$TEMP,DISPLAY,_,TOPSHELL,START_TIME,STAGE_NAME,TOOLCHAIN_PREFIX" 19 | TEMP="$TEMP,HOST_ARCH,WRAPPY_LOGPATH,OLDPATH,http_proxy,ftp_proxy" 20 | TEMP="$TEMP,https_proxy,no_proxy,TEMP,TMPDIR,FORK,MUSL" 21 | 22 | # Unset any variable we don't recognize. It can screw up the build. 23 | 24 | for i in $(env | sed -n 's/=.*//p') 25 | do 26 | is_in_list $i "$TEMP" && continue 27 | [ "${i:0:7}" == "DISTCC_" ] && continue 28 | [ "${i:0:7}" == "CCACHE_" ] && continue 29 | 30 | unset $i 2>/dev/null 31 | done 32 | fi 33 | 34 | # Assign (export) a variable only if current value is blank 35 | 36 | export_if_blank() 37 | { 38 | [ -z "$(eval "echo \"\${${1/=*/}}\"")" ] && export "$1" 39 | } 40 | 41 | # List of fallback mirrors to download package source from 42 | 43 | export_if_blank MIRROR_LIST="http://landley.net/code/aboriginal/mirror http://127.0.0.1/code/aboriginal/mirror" 44 | 45 | # Where are our working directories? 46 | 47 | export_if_blank TOP=`pwd` 48 | export_if_blank SOURCES="$TOP/sources" 49 | export_if_blank SRCDIR="$TOP/packages" 50 | export_if_blank PATCHDIR="$SOURCES/patches" 51 | export_if_blank BUILD="$TOP/build" 52 | export_if_blank SRCTREE="$BUILD/packages" 53 | export_if_blank HOSTTOOLS="$BUILD/host" 54 | export_if_blank WRAPDIR="$BUILD/record-commands" 55 | 56 | [ ! -z "$MY_PATCH_DIR" ] && export MY_PATCH_DIR="$(readlink -e "$MY_PATCH_DIR")" 57 | 58 | # Set a default non-arch 59 | 60 | export WORK="${BUILD}/host-temp" 61 | export ARCH_NAME=host 62 | 63 | # What host compiler should we use? 64 | 65 | export_if_blank CC=cc 66 | 67 | # How many processors should make -j use? 68 | 69 | MEMTOTAL="$(awk '/MemTotal:/{print $2}' /proc/meminfo)" 70 | if [ -z "$CPUS" ] 71 | then 72 | export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w) 73 | [ "$CPUS" -lt 1 ] && CPUS=1 74 | 75 | # If we're not using hyper-threading, and there's plenty of memory, 76 | # use 50% more CPUS than we actually have to keep system busy 77 | 78 | [ -z "$(cat /proc/cpuinfo | grep '^flags' | head -n 1 | grep -w ht)" ] && 79 | [ $(($CPUS*512*1024)) -le $MEMTOTAL ] && 80 | CPUS=$((($CPUS*3)/2)) 81 | fi 82 | 83 | export_if_blank STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'` 84 | [ ! -z "$BUILD_VERBOSE" ] && VERBOSITY="V=1" 85 | 86 | export_if_blank BUILD_STATIC=busybox,toybox,binutils,gcc-core,gcc-g++,make 87 | 88 | # If record-commands.sh set up a wrapper directory, adjust $PATH. 89 | 90 | export PATH 91 | if [ -z "$OLDPATH" ] 92 | then 93 | export OLDPATH="$PATH" 94 | [ -z "$BUSYBOX" ] || BUSYBOX=busybox 95 | [ -f "$HOSTTOOLS/${BUSYBOX:-toybox}" ] && 96 | PATH="$(hosttools_path)" || 97 | PATH="$(hosttools_path):$PATH" 98 | 99 | if [ -f "$WRAPDIR/wrappy" ] 100 | then 101 | OLDPATH="$PATH" 102 | mkdir -p "$BUILD/logs" 103 | [ $? -ne 0 ] && echo "Bad $WRAPDIR" >&2 && dienow 104 | PATH="$WRAPDIR" 105 | fi 106 | fi 107 | export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.$ARCH_NAME.early" 108 | -------------------------------------------------------------------------------- /system-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Combine filesystem images, kernel, and emulator launch scripts 4 | # into something you can boot and run. 5 | 6 | source sources/include.sh || exit 1 7 | 8 | # We do our own dependency checking (like host-tool.sh) so don't delete stage 9 | # dir when parsing sources/targets/$1 10 | 11 | KEEP_STAGEDIR=1 load_target "$1" 12 | 13 | # Is $1 newer than cross compiler and all listed prerequisites ($2...)? 14 | 15 | is_newer() 16 | { 17 | X="$1" 18 | shift 19 | [ ! -e "$X" ] && return 0 20 | [ "$(which "${CC_PREFIX}cc")" -nt "$X" ] && return 0 21 | while [ ! -z "$1" ] 22 | do 23 | [ ! -z "$(find "$1" -newer "$X" 2>/dev/null)" ] && return 0 24 | shift 25 | done 26 | 27 | echo "Keeping $(basename "$X")" 28 | return 1 29 | } 30 | 31 | # Provide qemu's common command line options between architectures. 32 | 33 | qemu_defaults() 34 | { 35 | echo -n "-nographic -no-reboot -kernel linux" 36 | [ "$SYSIMAGE_TYPE" != "rootfs" ] && echo -n " -initrd rootfs.cpio.gz" 37 | echo -n " -append \"panic=1 console=$CONSOLE HOST=$ARCH \$KERNEL_EXTRA\"" 38 | echo -n " \$QEMU_EXTRA" 39 | } 40 | 41 | # Write out a script to call the appropriate emulator. We split out the 42 | # filesystem, kernel, and base kernel command line arguments in case you want 43 | # to use an emulator other than qemu, but put the default case in qemu_defaults 44 | 45 | cat > "$STAGE_DIR/run-emulator.sh" << EOF && 46 | #!/bin/bash 47 | 48 | # Boot the emulated system to a shell prompt. 49 | 50 | ARCH=$ARCH 51 | run_emulator() 52 | { 53 | [ ! -z "\$DEBUG" ] && set -x 54 | cd "\$(dirname "\$0")" && 55 | $(emulator_command) 56 | } 57 | 58 | if [ "\$1" != "--norun" ] 59 | then 60 | run_emulator 61 | fi 62 | EOF 63 | chmod +x "$STAGE_DIR/run-emulator.sh" && 64 | 65 | # Write out development wrapper scripts, substituting INCLUDE lines. 66 | 67 | for FILE in dev-environment.sh native-build.sh 68 | do 69 | (export IFS="$(echo -e "\n")" 70 | cat "$SOURCES/toys/$FILE" | while read -r i 71 | do 72 | if [ "${i:0:8}" == "INCLUDE " ] 73 | then 74 | cat "$SOURCES/toys/${i:8}" || dienow 75 | else 76 | # because echo doesn't support --, that's why. 77 | echo "$i" || dienow 78 | fi 79 | done 80 | ) > "$STAGE_DIR/$FILE" 81 | 82 | chmod +x "$STAGE_DIR/$FILE" || dienow 83 | done 84 | 85 | # Package root-filesystem into cpio file for initramfs 86 | 87 | if is_newer "$STAGE_DIR/rootfs.cpio.gz" "$BUILD/root-filesystem-$ARCH" 88 | then 89 | SYSIMAGE_TYPE=cpio image_filesystem "$BUILD/root-filesystem-$ARCH" \ 90 | "$STAGE_DIR/temp" && 91 | mv -f "$STAGE_DIR"/{temp,rootfs}.cpio.gz || dienow 92 | [ "$SYSIMAGE_TYPE" == rootfs ] && rm -f "$STAGE_DIR/linux" 93 | fi 94 | 95 | # Package native-compiler into squashfs for /dev/hda mount 96 | 97 | if [ -e "$BUILD/native-compiler-$ARCH" ] && 98 | is_newer "$STAGE_DIR/toolchain.sqf" "$BUILD/native-compiler-$ARCH" 99 | then 100 | SYSIMAGE_TYPE=squashfs image_filesystem "$BUILD/native-compiler-$ARCH" \ 101 | "$STAGE_DIR/temp" && 102 | mv -f "$STAGE_DIR"/{temp,toolchain}.sqf || dienow 103 | fi 104 | 105 | # Build linux kernel for the target 106 | 107 | if is_newer "$STAGE_DIR/linux" "$BUILD/root-filesystem-$ARCH" \ 108 | $(package_cache linux) 109 | then 110 | setupfor linux 111 | echo "# make allnoconfig ARCH=${BOOT_KARCH:-$KARCH} KCONFIG_ALLCONFIG=mini.config" \ 112 | > $STAGE_DIR/mini.config 113 | getconfig linux >> "$STAGE_DIR"/mini.config 114 | [ "$SYSIMAGE_TYPE" == rootfs ] && 115 | echo -e "CONFIG_INITRAMFS_SOURCE=\"$STAGE_DIR/rootfs.cpio.gz\"\n" \ 116 | >> "$STAGE_DIR"/mini.config 117 | make allnoconfig ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS \ 118 | KCONFIG_ALLCONFIG="$STAGE_DIR"/mini.config >/dev/null && 119 | make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY && 120 | cp "$KERNEL_PATH" "$STAGE_DIR/linux" 121 | cleanup 122 | fi 123 | 124 | # Tar it up. 125 | 126 | ARCH="$ARCH_NAME" create_stage_tarball 127 | 128 | announce "Packaging complete" 129 | -------------------------------------------------------------------------------- /more/miniconfig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # miniconfig.sh copyright 2005 by Rob Landley 4 | # Licensed under the GNU General Public License version 2. 5 | 6 | # Run this in the linux kernel build directory with a starting file, and 7 | # it creates a file called mini.config with all the redundant lines of that 8 | # .config removed. The starting file must match what the kernel outputs. 9 | # If it doesn't, then run "make oldconfig" on it to get one that does. 10 | 11 | # A miniconfig file is essentially the list of symbols you'd have to switch 12 | # on if you started from "allnoconfig" and then went through menuconfig 13 | # selecting what you wanted. It's just the list of symbols you're interested 14 | # in, without including the ones set automatically by dependency checking. 15 | 16 | # To use a miniconfig: make allnoconfig KCONFIG_ALLCONFIG=/path/to/mini.conf 17 | 18 | # Miniconfig is more easily human-readable than a full .config file, and in 19 | # some ways more version-independent than full .config files. On the other 20 | # hand, when you update to a new kernel it won't get default values for newly 21 | # created symbols (they'll be off if they didn't exist before and thus weren't 22 | # in your "I need this and this and this" checklist), which can cause problems. 23 | 24 | # See sources/more/migrate_kernel.sh for a script that expands a miniconfig 25 | # to a .config under an old kernel version, copies it to a new version, 26 | # runs "make oldconfig" to update it, creates a new mini.config from the 27 | # result, and then shows a diff so you can see whether you want the new symbols. 28 | 29 | export KCONFIG_NOTIMESTAMP=1 30 | 31 | if [ $# -ne 1 ] 32 | then 33 | echo "Usage: miniconfig.sh configfile" 34 | exit 1 35 | fi 36 | 37 | if [ ! -f "$1" ] 38 | then 39 | echo "Couldn't find "'"'"$1"'"' 40 | exit 1 41 | fi 42 | 43 | if [ "$1" == ".config" ] 44 | then 45 | echo "It overwrites .config, rename it and try again." 46 | exit 1 47 | fi 48 | 49 | make allnoconfig KCONFIG_ALLCONFIG="$1" > /dev/null 50 | # Shouldn't need this, but kconfig goes "boing" at times... 51 | yes "" | make oldconfig > /dev/null 52 | if ! cmp .config "$1" 53 | then 54 | echo Sanity test failed, normalizing starting configuration... 55 | diff -u "$1" .config 56 | fi 57 | cp .config .big.config 58 | 59 | # Speed heuristic: remove all blank/comment lines 60 | grep -v '^[#$]' .config | grep -v '^$' > mini.config 61 | # This should never fail, but kconfig is so broken it does sometimes. 62 | make allnoconfig KCONFIG_ALLCONFIG=mini.config > /dev/null 63 | if ! cmp .config "$1" 64 | then 65 | echo Insanity test failed: reversing blank line removal heuristic. 66 | cp .big.config mini.config 67 | fi 68 | #cp .config mini.config 69 | 70 | echo "Calculating mini.config..." 71 | 72 | LENGTH=`cat mini.config | wc -l` 73 | OLDLENGTH=$LENGTH 74 | 75 | # Loop through all lines in the file 76 | I=1 77 | while true 78 | do 79 | [ $I -gt $LENGTH ] && break 80 | sed -n "$I,$(($I+${STRIDE:-1}-1))!p" mini.config > .config.test 81 | # Do a config with this file 82 | rm .config 83 | make allnoconfig KCONFIG_ALLCONFIG=.config.test 2>/dev/null | head -n 1000000 > /dev/null 84 | # Compare. Because we normalized at the start, the files should be identical. 85 | if cmp -s .config .big.config 86 | then 87 | # Found unneeded line(s) 88 | mv .config.test mini.config 89 | LENGTH=$(($LENGTH-${STRIDE:-1})) 90 | # Cosmetic: if stride tests off the end don't show total length less 91 | # than number of entries found. 92 | [ $I -gt $LENGTH ] && LENGTH=$(($I-1)) 93 | # Special case where we know the next line _is_ needed: stride 2 failed 94 | # but we discarded the first line 95 | [ -z "$STRIDE" ] && [ ${OLDSTRIDE:-1} -eq 2 ] && I=$(($I+1)) 96 | STRIDE=$(($STRIDE+1)) 97 | OLDSTRIDE=$STRIDE 98 | else 99 | # That hunk was needed 100 | if [ ${STRIDE:-1} -le 1 ] 101 | then 102 | I=$(($I+1)) 103 | OLDSTRIDE= 104 | fi 105 | STRIDE= 106 | fi 107 | echo -n -e "\r[${STRIDE:-1}] $[$I-1]/$LENGTH lines $(cat mini.config | wc -c) bytes $[100-((($LENGTH-$I)*100)/$OLDLENGTH)]% " 108 | done 109 | rm .big.config 110 | echo 111 | -------------------------------------------------------------------------------- /sources/utility_functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/echo "This file is sourced, not run" 2 | 3 | # This file contains generic functions, presumably reusable in other contexts. 4 | 5 | # Create a blank directory at first argument, deleting existing contents if any 6 | 7 | blank_tempdir() 8 | { 9 | # sanity test: never rm -rf something we don't own. 10 | [ -z "$1" ] && dienow 11 | touch -c "$1" || dienow 12 | 13 | # Delete old directory, create new one. 14 | [ -z "$NO_CLEANUP" ] && rm -rf "$1" 15 | mkdir -p "$1" || dienow 16 | } 17 | 18 | # output the sha1sum of a file 19 | 20 | sha1file() 21 | { 22 | sha1sum /dev/null "$@" | tail -n +2 | awk '{print $1}' 23 | } 24 | 25 | # dienow() is an exit function that works properly even from a subshell. 26 | # (actually_dienow is run in the parent shell via signal handler.) 27 | 28 | actually_dienow() 29 | { 30 | echo -e "\n\e[31mExiting due to errors ($ARCH_NAME $STAGE_NAME $PACKAGE)\e[0m" >&2 31 | exit 1 32 | } 33 | 34 | trap actually_dienow SIGUSR1 35 | TOPSHELL=$$ 36 | 37 | dienow() 38 | { 39 | kill -USR1 $TOPSHELL 40 | exit 1 41 | } 42 | 43 | # Turn a bunch of output lines into a much quieter series of periods, 44 | # roughly one per screenfull 45 | 46 | dotprogress() 47 | { 48 | x=0 49 | while read i 50 | do 51 | x=$[$x + 1] 52 | if [[ "$x" -eq 25 ]] 53 | then 54 | x=0 55 | echo -n . 56 | fi 57 | done 58 | echo 59 | } 60 | 61 | # Announce an action to the world 62 | 63 | announce() 64 | { 65 | # Write a line to the log file with easily greppable header 66 | echo -e "\n=== $1 ($ARCH_NAME $STAGE_NAME)" 67 | 68 | # Set the title bar of the current xterm 69 | [ -z "$NO_TITLE_BAR" ] && echo -en "\033]2;$ARCH_NAME $STAGE_NAME $1\007" 70 | } 71 | 72 | # Filter out unnecessary noise, keeping just lines starting with "===" 73 | 74 | maybe_quiet() 75 | { 76 | [ -z "$FORK" ] && cat || grep "^===" 77 | } 78 | 79 | # Run a command background if FORK is set, in foreground otherwise 80 | 81 | maybe_fork() 82 | { 83 | [ -z "$BUILD_VERBOSE" ] || echo "$*" 84 | 85 | if [ -z "$FORK" ] 86 | then 87 | eval "$*" 88 | else 89 | eval "$*" & 90 | fi 91 | } 92 | 93 | # Kill a process and all its decendants 94 | 95 | killtree() 96 | { 97 | local KIDS="" 98 | 99 | while [ $# -ne 0 ] 100 | do 101 | KIDS="$KIDS $(pgrep -P$1)" 102 | shift 103 | done 104 | 105 | KIDS="$(echo -n $KIDS)" 106 | if [ ! -z "$KIDS" ] 107 | then 108 | # Depth first kill avoids reparent_to_init hiding stuff. 109 | killtree $KIDS 110 | kill $KIDS 2>/dev/null 111 | fi 112 | } 113 | 114 | # Search a colon-separated path for files matching a pattern. 115 | 116 | # Arguments are 1) path to search, 2) pattern, 3) command to run on each file. 117 | # During command, $DIR/$FILE points to file found. 118 | 119 | path_search() 120 | { 121 | # For each each $PATH element, loop through each file in that directory, 122 | # and create a symlink to the wrapper with that name. In the case of 123 | # duplicates, keep the first one. 124 | 125 | echo "$1" | sed 's/:/\n/g' | while read DIR 126 | do 127 | find "$DIR/" -maxdepth 1 -mindepth 1 -name "$2" | sed 's@.*/@@' | \ 128 | while read FILE 129 | do 130 | eval "$3" 131 | 132 | # Output is verbose. Pipe it to dotprogress. 133 | 134 | echo $FILE 135 | done 136 | done 137 | } 138 | 139 | # Abort if we haven't got a prerequisite in the $PATH 140 | 141 | check_prerequisite() 142 | { 143 | if [ -z "$(which "$1")" ] 144 | then 145 | [ -z "$FAIL_QUIET" ] && echo No "$1" in '$PATH'. >&2 146 | dienow 147 | fi 148 | } 149 | 150 | # Search through all the files under a directory and collapse together 151 | # identical files into hardlinks 152 | 153 | collapse_hardlinks() 154 | { 155 | SHA1LIST="" 156 | find "$1" -type f | while read FILE 157 | do 158 | echo "$FILE" 159 | SHA1=$(sha1file "$FILE") 160 | MATCH=$(echo "$SHA1LIST" | grep "^$SHA1") 161 | if [ -z "$MATCH" ] 162 | then 163 | # Yes, the quote spanning two lines here is intentional 164 | SHA1LIST="$SHA1LIST 165 | $SHA1 $FILE" 166 | else 167 | FILE2="$(echo "$MATCH" | sed 's/[^ ]* //')" 168 | cmp -s "$FILE" "$FILE2" || continue 169 | ln -f "$FILE" "$FILE2" || dienow 170 | fi 171 | done 172 | } 173 | 174 | # Check if $1 is in the comma separated list $2 175 | 176 | is_in_list() 177 | { 178 | [ "$2" == all ] || [ ! -z "$(echo ,"$2", | grep ,"$1",)" ] 179 | } 180 | -------------------------------------------------------------------------------- /sources/patches/uClibc-mips-siginfo.patch: -------------------------------------------------------------------------------- 1 | Backport commit a1b88fe87a9d: 2 | 3 | mips: rename siginfo _timer members 4 | 5 | Rename _timer[12] to si_tid and si_overrun to fix compilation of 6 | strace-4.9+ 7 | 8 | Signed-off-by: Bernhard Reutner-Fischer 9 | 10 | diff --git a/libc/sysdeps/linux/mips/bits/siginfo.h b/libc/sysdeps/linux/mips/bits/siginfo.h 11 | index a6e4135..5199d4d 100644 12 | --- a/libc/sysdeps/linux/mips/bits/siginfo.h 13 | +++ b/libc/sysdeps/linux/mips/bits/siginfo.h 14 | @@ -69,6 +69,22 @@ typedef struct siginfo 15 | __uid_t si_uid; /* Real user ID of sending process. */ 16 | } _kill; 17 | 18 | + /* POSIX.1b timers. */ 19 | + struct 20 | + { 21 | + int si_tid; /* Timer ID. */ 22 | + int si_overrun; /* Overrun count. */ 23 | + sigval_t si_sigval; /* Signal value. */ 24 | + } _timer; 25 | + 26 | + /* POSIX.1b signals. */ 27 | + struct 28 | + { 29 | + __pid_t si_pid; /* Sending process ID. */ 30 | + __uid_t si_uid; /* Real user ID of sending process. */ 31 | + sigval_t si_sigval; /* Signal value. */ 32 | + } _rt; 33 | + 34 | /* SIGCHLD. */ 35 | struct 36 | { 37 | @@ -83,29 +99,15 @@ typedef struct siginfo 38 | struct 39 | { 40 | void *si_addr; /* Faulting insn/memory ref. */ 41 | + short int si_addr_lsb; /* Valid LSB of the reported address. */ 42 | } _sigfault; 43 | 44 | /* SIGPOLL. */ 45 | struct 46 | { 47 | - int si_band; /* Band event for SIGPOLL. */ 48 | + long int si_band; /* Band event for SIGPOLL. */ 49 | int si_fd; 50 | } _sigpoll; 51 | - 52 | - /* POSIX.1b timers. */ 53 | - struct 54 | - { 55 | - unsigned int _timer1; 56 | - unsigned int _timer2; 57 | - } _timer; 58 | - 59 | - /* POSIX.1b signals. */ 60 | - struct 61 | - { 62 | - __pid_t si_pid; /* Sending process ID. */ 63 | - __uid_t si_uid; /* Real user ID of sending process. */ 64 | - sigval_t si_sigval; /* Signal value. */ 65 | - } _rt; 66 | } _sifields; 67 | } siginfo_t; 68 | 69 | @@ -113,6 +115,8 @@ typedef struct siginfo 70 | /* X/Open requires some more fields with fixed names. */ 71 | # define si_pid _sifields._kill.si_pid 72 | # define si_uid _sifields._kill.si_uid 73 | +# define si_timerid _sifields._timer.si_tid 74 | +# define si_overrun _sifields._timer.si_overrun 75 | # define si_status _sifields._sigchld.si_status 76 | # define si_utime _sifields._sigchld.si_utime 77 | # define si_stime _sifields._sigchld.si_stime 78 | @@ -120,6 +124,7 @@ typedef struct siginfo 79 | # define si_int _sifields._rt.si_sigval.sival_int 80 | # define si_ptr _sifields._rt.si_sigval.sival_ptr 81 | # define si_addr _sifields._sigfault.si_addr 82 | +# define si_addr_lsb _sifields._sigfault.si_addr_lsb 83 | # define si_band _sifields._sigpoll.si_band 84 | # define si_fd _sifields._sigpoll.si_fd 85 | 86 | @@ -142,13 +147,14 @@ enum 87 | # define SI_ASYNCIO SI_ASYNCIO 88 | SI_QUEUE, /* Sent by sigqueue. */ 89 | # define SI_QUEUE SI_QUEUE 90 | - SI_USER, /* Sent by kill, sigsend, raise. */ 91 | + SI_USER, /* Sent by kill, sigsend. */ 92 | # define SI_USER SI_USER 93 | SI_KERNEL = 0x80 /* Send by kernel. */ 94 | #define SI_KERNEL SI_KERNEL 95 | }; 96 | 97 | 98 | +# if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 99 | /* `si_code' values for SIGILL signal. */ 100 | enum 101 | { 102 | @@ -207,10 +213,16 @@ enum 103 | # define BUS_ADRALN BUS_ADRALN 104 | BUS_ADRERR, /* Non-existant physical address. */ 105 | # define BUS_ADRERR BUS_ADRERR 106 | - BUS_OBJERR /* Object specific hardware error. */ 107 | + BUS_OBJERR, /* Object specific hardware error. */ 108 | # define BUS_OBJERR BUS_OBJERR 109 | + BUS_MCEERR_AR, /* Hardware memory error: action required. */ 110 | +# define BUS_MCEERR_AR BUS_MCEERR_AR 111 | + BUS_MCEERR_AO /* Hardware memory error: action optional. */ 112 | +# define BUS_MCEERR_AO BUS_MCEERR_AO 113 | }; 114 | +# endif 115 | 116 | +# ifdef __USE_XOPEN_EXTENDED 117 | /* `si_code' values for SIGTRAP signal. */ 118 | enum 119 | { 120 | @@ -219,7 +231,9 @@ enum 121 | TRAP_TRACE /* Process trace trap. */ 122 | # define TRAP_TRACE TRAP_TRACE 123 | }; 124 | +# endif 125 | 126 | +# if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 127 | /* `si_code' values for SIGCHLD signal. */ 128 | enum 129 | { 130 | @@ -253,6 +267,7 @@ enum 131 | POLL_HUP /* Device disconnected. */ 132 | # define POLL_HUP POLL_HUP 133 | }; 134 | +# endif 135 | 136 | # undef __need_siginfo_t 137 | #endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ 138 | -------------------------------------------------------------------------------- /sources/toys/dev-environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Wrapper around run-emulator.sh that sets up a reasonable development 4 | # environment. 5 | 6 | # Allocates more physical memory, adds a 2 gigabyte ext3 image (hdb.img) 7 | # mounted on /home to provide persistent writeable space, and sets up and 8 | # distcc acceleration (if both the the cross compiler and distccd 9 | # are available in the host's $PATH). 10 | 11 | # The following environment variables affect the behavior of this script: 12 | 13 | # HDA - Image file to use for -hda on /usr/hda (spliced into / with cp -s) 14 | # HDB - Image file to use for -hdb on /home (creates a new hdb.img if blank) 15 | # HDBMEGS - Size (in decimal megabytes) when creating hdb.img 16 | # HDC - Image file to use for -hdc on /mnt (none of blank) 17 | # QEMU_MEMORY - number of megabytes of memory for qemu (defaults to 256) 18 | 19 | INCLUDE unique-port.sh 20 | INCLUDE make-hdb.sh 21 | 22 | source ./run-emulator.sh --norun || exit 1 23 | 24 | [ -z "$QEMU_MEMORY" ] && QEMU_MEMORY=256 25 | QEMU_EXTRA="-m $QEMU_MEMORY $QEMU_EXTRA" 26 | 27 | [ -z "$HDA" ] && HDA=toolchain.sqf 28 | 29 | # Should we set up an ext3 image as a second virtual hard drive for /home? 30 | 31 | if [ "$HDBMEGS" != "0" ] 32 | then 33 | [ -z "$HDB" ] && HDB=hdb.img 34 | if [ ! -e "$HDB" ] 35 | then 36 | 37 | # If we don't already have an hdb image, should we set up a sparse file and 38 | # format it ext3? 39 | 40 | [ -z "$HDBMEGS" ] && HDBMEGS=2048 41 | 42 | make_hdb 43 | fi 44 | fi 45 | 46 | # Setup distcc 47 | 48 | # If the cross compiler isn't in the $PATH, look for it in the current 49 | # directory, the parent directory, and the user's home directory. 50 | 51 | DISTCC_PATH="$(which $ARCH-cc 2>/dev/null | sed 's@\(.*\)/.*@\1@')" 52 | 53 | if [ -z "$DISTCC_PATH" ] 54 | then 55 | for i in {"$(pwd)/","$(pwd)/../","$HOME"/}{,simple-}cross-compiler-"$ARCH"/bin 56 | do 57 | [ -f "$i/$ARCH-cc" ] && DISTCC_PATH="$i" && break 58 | done 59 | fi 60 | 61 | [ -z "$(which distccd)" ] && [ -e ../host/distccd ] && 62 | PATH="$PATH:$(pwd)/../host" 63 | 64 | if [ -z "$(which distccd)" ] 65 | then 66 | echo 'No distccd in $PATH, acceleration disabled.' 67 | elif [ -z "$DISTCC_PATH" ] 68 | then 69 | echo "No $ARCH-cc in "'$PATH'", acceleration disabled." 70 | else 71 | 72 | # Populate a directory full of symlinks to the cross compiler using the 73 | # unprefixed names distccd will try to use. 74 | 75 | mkdir -p "distcc_links" && 76 | for i in $(cd "$DISTCC_PATH"; ls $ARCH-* | sed "s/^$ARCH-//" ) 77 | do 78 | ln -sf "$DISTCC_PATH/$ARCH-$i" "distcc_links/$i" 79 | done 80 | if [ -e "$DISTCC_PATH/$ARCH-rawgcc" ] 81 | then 82 | for i in cc gcc g++ c++ 83 | do 84 | ln -sf "$DISTCC_PATH/$ARCH-rawgcc" distcc_links/$i 85 | done 86 | fi 87 | 88 | # Run the distcc daemon on the host system with $PATH restricted to the 89 | # cross compiler binaries. 90 | 91 | # Note that we tell it --no-detach and background it ourselves so jobs -p can 92 | # find it later to kill it after the emulator exits. 93 | 94 | PORT=$(unique_port) 95 | if [ -z "$CPUS" ] 96 | then 97 | # Current parallelism limits include: 98 | # - memory available to emulator (most targets max at 256 megs, which 99 | # gives about 80 megs/instance). 100 | # - speed of preprocessor (tcc -E would be faster than gcc -E) 101 | # - speed of virtual network (switch to virtual gigabit cards). 102 | # 103 | # CPUS=$(($(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)*2)) 104 | CPUS=3 105 | fi 106 | PATH="$(pwd)/distcc_links" "$(which distccd)" --no-detach --daemon \ 107 | --listen 127.0.0.1 -a 127.0.0.1 -p $PORT --jobs $CPUS \ 108 | --log-stderr --verbose 2>distccd.log & 109 | 110 | DISTCC_PID="$(jobs -p)" 111 | # Clean up afterwards: Kill child processes we started (I.E. distccd). 112 | trap "kill $DISTCC_PID" EXIT 113 | 114 | # When background processes die, they should do so silently. 115 | disown $DISTCC_PID 116 | 117 | # Let the QEMU launch know we're using distcc. 118 | 119 | echo "distccd pid $DISTCC_PID port $PORT" 120 | KERNEL_EXTRA="DISTCC_HOSTS=10.0.2.2:$PORT/$CPUS $KERNEL_EXTRA" 121 | fi 122 | 123 | [ -z "$CPUS" ] && CPUS=1 124 | KERNEL_EXTRA="CPUS=$CPUS $KERNEL_EXTRA" 125 | 126 | # Kill our child processes on exit. 127 | 128 | trap "pkill -P$$" EXIT 129 | 130 | # The actual emulator invocation command gets appended here by system-image.sh 131 | 132 | [ ! -z "$HDC" ] && QEMU_EXTRA="-hdc $HDC $QEMU_EXTRA" 133 | [ ! -z "$HDB" ] && QEMU_EXTRA="-hdb $HDB $QEMU_EXTRA" 134 | [ ! -z "$HDA" ] && QEMU_EXTRA="-hda $HDA $QEMU_EXTRA" 135 | 136 | run_emulator 137 | -------------------------------------------------------------------------------- /sources/patches/gcc-core-musl.patch: -------------------------------------------------------------------------------- 1 | Build against musl (or current glibc) using the standard name instead of the random implementation detail leakage. 2 | 3 | And on powerpc gcc assumes the existence of a nonstandard symbol (__libc_stack_end) which musl hasn't got. 4 | 5 | diff -ruN gcc-core/gcc/config/i386/linux-unwind.h gcc-core.bak/gcc/config/i386/linux-unwind.h 6 | --- gcc-core/gcc/config/i386/linux-unwind.h 2006-02-27 11:26:26.000000000 -0600 7 | +++ gcc-core.bak/gcc/config/i386/linux-unwind.h 2014-07-02 18:27:17.931529601 -0500 8 | @@ -137,9 +137,9 @@ 9 | { 10 | struct rt_sigframe { 11 | int sig; 12 | - struct siginfo *pinfo; 13 | + siginfo_t *pinfo; 14 | void *puc; 15 | - struct siginfo info; 16 | + siginfo_t info; 17 | struct ucontext uc; 18 | } *rt_ = context->cfa; 19 | /* The void * cast is necessary to avoid an aliasing warning. 20 | diff -ru gcc-core.bak/gcc/config/alpha/linux-unwind.h gcc-core/gcc/config/alpha/linux-unwind.h 21 | --- gcc-core.bak/gcc/config/alpha/linux-unwind.h 2014-07-02 13:51:18.938839448 -0500 22 | +++ gcc-core/gcc/config/alpha/linux-unwind.h 2014-07-04 12:27:31.215361161 -0500 23 | @@ -54,7 +54,7 @@ 24 | else if (pc[1] == 0x201f015f) /* lda $0,NR_rt_sigreturn */ 25 | { 26 | struct rt_sigframe { 27 | - struct siginfo info; 28 | + siginfo_t info; 29 | struct ucontext uc; 30 | } *rt_ = context->cfa; 31 | sc = &rt_->uc.uc_mcontext; 32 | diff -ru gcc-core.bak/gcc/config/ia64/linux-unwind.h gcc-core/gcc/config/ia64/linux-unwind.h 33 | --- gcc-core.bak/gcc/config/ia64/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 34 | +++ gcc-core/gcc/config/ia64/linux-unwind.h 2014-07-04 12:27:31.215361161 -0500 35 | @@ -51,7 +51,7 @@ 36 | struct sigframe { 37 | char scratch[16]; 38 | unsigned long sig_number; 39 | - struct siginfo *info; 40 | + siginfo_t *info; 41 | struct sigcontext *sc; 42 | } *frame_ = (struct sigframe *)context->psp; 43 | struct sigcontext *sc = frame_->sc; 44 | @@ -130,7 +130,7 @@ 45 | struct sigframe { 46 | char scratch[16]; 47 | unsigned long sig_number; 48 | - struct siginfo *info; 49 | + siginfo_t *info; 50 | struct sigcontext *sc; 51 | } *frame = (struct sigframe *)context->psp; 52 | struct sigcontext *sc = frame->sc; 53 | diff -ru gcc-core.bak/gcc/config/mips/linux-unwind.h gcc-core/gcc/config/mips/linux-unwind.h 54 | --- gcc-core.bak/gcc/config/mips/linux-unwind.h 2006-05-19 07:52:26.000000000 -0500 55 | +++ gcc-core/gcc/config/mips/linux-unwind.h 2014-07-04 12:27:31.211361161 -0500 56 | @@ -77,7 +77,7 @@ 57 | { 58 | struct rt_sigframe { 59 | u_int32_t trampoline[2]; 60 | - struct siginfo info; 61 | + siginfo_t info; 62 | _sig_ucontext_t uc; 63 | } *rt_ = context->ra; 64 | sc = &rt_->uc.uc_mcontext; 65 | diff -ru gcc-core.bak/gcc/config/pa/linux-unwind.h gcc-core/gcc/config/pa/linux-unwind.h 66 | --- gcc-core.bak/gcc/config/pa/linux-unwind.h 2005-11-17 21:22:18.000000000 -0600 67 | +++ gcc-core/gcc/config/pa/linux-unwind.h 2014-07-04 12:27:31.195361161 -0500 68 | @@ -63,7 +63,7 @@ 69 | int i; 70 | struct sigcontext *sc; 71 | struct rt_sigframe { 72 | - struct siginfo info; 73 | + siginfo_t info; 74 | struct ucontext uc; 75 | } *frame; 76 | 77 | diff -ru gcc-core.bak/gcc/config/sh/linux-unwind.h gcc-core/gcc/config/sh/linux-unwind.h 78 | --- gcc-core.bak/gcc/config/sh/linux-unwind.h 2014-07-02 13:51:18.930839444 -0500 79 | +++ gcc-core/gcc/config/sh/linux-unwind.h 2014-07-04 12:27:31.207361161 -0500 80 | @@ -82,9 +82,9 @@ 81 | && (*(unsigned long *) (pc+11) == 0x6ff0fff0)) 82 | { 83 | struct rt_sigframe { 84 | - struct siginfo *pinfo; 85 | + siginfo_t *pinfo; 86 | void *puc; 87 | - struct siginfo info; 88 | + siginfo_t info; 89 | struct ucontext uc; 90 | } *rt_ = context->cfa; 91 | /* The void * cast is necessary to avoid an aliasing warning. 92 | @@ -181,7 +181,7 @@ 93 | && (*(unsigned short *) (pc+14) == 0x00ad)))) 94 | { 95 | struct rt_sigframe { 96 | - struct siginfo info; 97 | + siginfo_t info; 98 | struct ucontext uc; 99 | } *rt_ = context->cfa; 100 | /* The void * cast is necessary to avoid an aliasing warning. 101 | diff -ru gcc-core/gcc/config/rs6000/linux-unwind.h gcc-core.bak/gcc/config/rs6000/linux-unwind.h 102 | --- gcc-core/gcc/config/rs6000/linux-unwind.h 2007-01-03 17:47:14.000000000 -0600 103 | +++ gcc-core.bak/gcc/config/rs6000/linux-unwind.h 2014-07-04 18:15:48.935951119 -0500 104 | @@ -188,6 +188,7 @@ 105 | static long 106 | ppc_linux_aux_vector (long which) 107 | { 108 | +#ifdef __GLIBC__ 109 | /* __libc_stack_end holds the original stack passed to a process. */ 110 | extern long *__libc_stack_end; 111 | long argc; 112 | @@ -212,6 +213,10 @@ 113 | if (auxp->a_type == which) 114 | return auxp->a_val; 115 | return 0; 116 | +#else 117 | + /* pretend we have everything, save it all */ 118 | + return -1; 119 | +#endif 120 | } 121 | 122 | /* Do code reading to identify a signal frame, and set the frame 123 | -------------------------------------------------------------------------------- /sources/patches/uClibc-mmu.patch: -------------------------------------------------------------------------------- 1 | diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch 2 | index 8a02cb1..4679517 100644 3 | --- a/extra/Configs/Config.in.arch 4 | +++ b/extra/Configs/Config.in.arch 5 | @@ -93,7 +93,7 @@ if ARCH_HAS_NO_MMU 6 | comment "Target CPU lacks a memory management unit (MMU)" 7 | endif 8 | 9 | -config ARCH_HAS_MMU 10 | +config ARCH_USE_MMU 11 | bool "Target CPU has a memory management unit (MMU)" 12 | depends on !ARCH_HAS_NO_MMU 13 | default y 14 | @@ -102,13 +102,6 @@ config ARCH_HAS_MMU 15 | then answer N here. Normally, Linux runs on systems with an MMU. 16 | If you are building a uClinux system, answer N. 17 | 18 | - Most people will answer Y. 19 | - 20 | -config ARCH_USE_MMU 21 | - bool "Do you want to utilize the MMU?" 22 | - depends on ARCH_HAS_MMU 23 | - default y 24 | - help 25 | If your target CPU has a MMU, and you wish to actually utilize it, 26 | then answer Y here. Normal Linux requires an MMU. 27 | 28 | diff -ru uClibc.bak/extra/Configs/Config.alpha uClibc/extra/Configs/Config.alpha 29 | --- uClibc.bak/extra/Configs/Config.alpha 2011-12-30 05:11:07.000000000 -0600 30 | +++ uClibc/extra/Configs/Config.alpha 2012-01-28 21:51:10.555746374 -0600 31 | @@ -11,6 +11,5 @@ 32 | bool 33 | default y 34 | select ARCH_LITTLE_ENDIAN 35 | - select ARCH_HAS_MMU 36 | select ARCH_HAS_NO_LDSO 37 | select UCLIBC_HAS_LFS 38 | diff -ru uClibc.bak/extra/Configs/Config.avr32 uClibc/extra/Configs/Config.avr32 39 | --- uClibc.bak/extra/Configs/Config.avr32 2011-12-30 05:11:07.000000000 -0600 40 | +++ uClibc/extra/Configs/Config.avr32 2012-01-28 21:51:10.575746540 -0600 41 | @@ -19,7 +19,6 @@ 42 | 43 | config CONFIG_AVR32_AP7 44 | bool "AVR32 AP7" 45 | - select ARCH_HAS_MMU 46 | 47 | endchoice 48 | 49 | diff -ru uClibc.bak/extra/Configs/Config.cris uClibc/extra/Configs/Config.cris 50 | --- uClibc.bak/extra/Configs/Config.cris 2011-12-30 05:11:07.000000000 -0600 51 | +++ uClibc/extra/Configs/Config.cris 2012-01-28 21:51:10.534804397 -0600 52 | @@ -24,11 +24,9 @@ 53 | - CRISv32 Support for Axis' CRISv32 architecture. 54 | 55 | config CONFIG_CRIS 56 | - select ARCH_HAS_MMU 57 | bool "CRIS" 58 | 59 | config CONFIG_CRISV32 60 | - select ARCH_HAS_MMU 61 | bool "CRISv32" 62 | 63 | endchoice 64 | diff -ru uClibc.bak/extra/Configs/Config.hppa uClibc/extra/Configs/Config.hppa 65 | --- uClibc.bak/extra/Configs/Config.hppa 2011-12-30 05:11:07.000000000 -0600 66 | +++ uClibc/extra/Configs/Config.hppa 2012-01-28 21:51:10.575746540 -0600 67 | @@ -11,7 +11,6 @@ 68 | bool 69 | default y 70 | select ARCH_BIG_ENDIAN 71 | - select ARCH_HAS_MMU 72 | select HAS_NO_THREADS 73 | select ARCH_HAS_NO_LDSO 74 | select HAVE_NO_SSP 75 | diff -ru uClibc.bak/extra/Configs/Config.i386 uClibc/extra/Configs/Config.i386 76 | --- uClibc.bak/extra/Configs/Config.i386 2011-12-30 05:11:07.000000000 -0600 77 | +++ uClibc/extra/Configs/Config.i386 2012-01-28 21:51:10.575746540 -0600 78 | @@ -11,7 +11,6 @@ 79 | bool 80 | default y 81 | select ARCH_LITTLE_ENDIAN 82 | - select ARCH_HAS_MMU 83 | 84 | choice 85 | prompt "Target x86 Processor Family" 86 | diff -ru uClibc.bak/extra/Configs/Config.ia64 uClibc/extra/Configs/Config.ia64 87 | --- uClibc.bak/extra/Configs/Config.ia64 2011-12-30 05:11:07.000000000 -0600 88 | +++ uClibc/extra/Configs/Config.ia64 2012-01-28 21:51:10.575746540 -0600 89 | @@ -11,5 +11,4 @@ 90 | bool 91 | default y 92 | select ARCH_LITTLE_ENDIAN 93 | - select ARCH_HAS_MMU 94 | select ARCH_HAS_NO_LDSO 95 | diff -ru uClibc.bak/extra/Configs/Config.powerpc uClibc/extra/Configs/Config.powerpc 96 | --- uClibc.bak/extra/Configs/Config.powerpc 2011-12-30 05:11:07.000000000 -0600 97 | +++ uClibc/extra/Configs/Config.powerpc 2012-01-28 21:51:10.565745340 -0600 98 | @@ -11,7 +11,6 @@ 99 | bool 100 | default y 101 | select ARCH_BIG_ENDIAN 102 | - select ARCH_HAS_MMU 103 | 104 | choice 105 | prompt "Target Processor Type" 106 | diff -ru uClibc.bak/extra/Configs/Config.sh uClibc/extra/Configs/Config.sh 107 | --- uClibc.bak/extra/Configs/Config.sh 2011-12-30 05:11:07.000000000 -0600 108 | +++ uClibc/extra/Configs/Config.sh 2012-01-28 21:51:10.555746374 -0600 109 | @@ -37,7 +37,6 @@ 110 | bool "SH2" 111 | 112 | config CONFIG_SH3 113 | - select ARCH_HAS_MMU 114 | bool "SH3" 115 | 116 | config CONFIG_SH4 117 | diff -ru uClibc.bak/extra/Configs/Config.sh64 uClibc/extra/Configs/Config.sh64 118 | --- uClibc.bak/extra/Configs/Config.sh64 2011-12-30 05:11:07.000000000 -0600 119 | +++ uClibc/extra/Configs/Config.sh64 2012-01-28 21:51:10.546326182 -0600 120 | @@ -25,7 +25,6 @@ 121 | - "SH5" SuperH SH-5 101, 103 122 | 123 | config CONFIG_SH5 124 | - select ARCH_HAS_MMU 125 | select UCLIBC_HAS_LFS 126 | bool "SH5" 127 | 128 | diff -ru uClibc.bak/extra/Configs/Config.x86_64 uClibc/extra/Configs/Config.x86_64 129 | --- uClibc.bak/extra/Configs/Config.x86_64 2011-12-30 05:11:07.000000000 -0600 130 | +++ uClibc/extra/Configs/Config.x86_64 2012-01-28 21:51:10.575746540 -0600 131 | @@ -11,4 +11,3 @@ 132 | bool 133 | default y 134 | select ARCH_LITTLE_ENDIAN 135 | - select ARCH_HAS_MMU 136 | -------------------------------------------------------------------------------- /download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Download all the source tarballs we haven't got up-to-date copies of. 4 | 5 | # The tarballs are downloaded into the "packages" directory, which is 6 | # created as needed. 7 | 8 | source sources/include.sh || exit 1 9 | 10 | mkdir -p "$SRCDIR" || dienow 11 | 12 | echo "=== Download source code." 13 | 14 | # Note: set SHA1= blank to skip checksum validation. 15 | 16 | # A blank SHA1 value means accept anything, and the download script 17 | # prints out the sha1 of such files after downloading it. So to update to 18 | # a new version of a file, set SHA1= and update the URL, run ./download.sh, 19 | # then cut and paste the sha1 from the output and run it again to confirm. 20 | 21 | # Building a cross compile toolchain requires linux headers, uClibc, 22 | # binutils, and gcc. 23 | 24 | URL=http://uclibc.org/downloads/uClibc-0.9.33.2.tar.bz2 \ 25 | SHA1=4d8d67d6754409bd10015d67d1ce7a04c0b001ba \ 26 | maybe_fork "download || dienow" 27 | 28 | URL=http://www.musl-libc.org/releases/musl-1.1.12.tar.gz \ 29 | SHA1=e098ce88e7dd4398c178240b4c380771c5b4fe6b \ 30 | maybe_fork "download || dienow" 31 | 32 | URL=ftp://kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.gz \ 33 | SHA1=309d9bedd8c9ef4a79695f04dcf65c0b551d784c \ 34 | maybe_fork "download || dienow" 35 | 36 | 37 | # 2.17 was the last GPLv2 release of binutils, but git commit 38 | # 397a64b350470350c8e0adb2af84439ea0f89272 was the last GPLv2 39 | # _version_ of binutils. This tarball has prebuilt release files 40 | # so it builds without optional dependencies such as lex and yacc. 41 | 42 | URL=http://landley.net/aboriginal/mirror/binutils-397a64b3.tar.bz2 \ 43 | SHA1=f74f1ce2e62c516ba832f99a94289930be7869cf \ 44 | maybe_fork "download || dienow" 45 | 46 | # elf2flt needed for nommu targets which can't mmap() the elf segments. 47 | # From git://git.sourceforge.jp/gitroot/uclinux-h8/elf2flt.git branch h8300 48 | 49 | URL=http://landley.net/aboriginal/mirror/elf2flt-332e3d67e763.tar.gz \ 50 | SHA1=23279cdd550f557cef8e83e0e0f3e33d04b1d1bd \ 51 | maybe_fork "download || dienow" 52 | 53 | # 4.2.1 was the last GPLv2 release of gcc 54 | 55 | URL=ftp://ftp.gnu.org/gnu/gcc/gcc-4.2.1/gcc-core-4.2.1.tar.bz2 \ 56 | SHA1=43a138779e053a864bd16dfabcd3ffff04103213 \ 57 | maybe_fork "download || dienow" 58 | 59 | # The g++ version must match gcc version. 60 | 61 | URL=http://ftp.gnu.org/gnu/gcc/gcc-4.2.1/gcc-g++-4.2.1.tar.bz2 \ 62 | SHA1=8f3785bd0e092f563e14ecd26921cd04275496a6 \ 63 | maybe_fork "download || dienow" 64 | 65 | # Building a native root filesystem requires linux and uClibc (above) plus 66 | # BusyBox. Adding a native toolchain requires binutils and gcc (above) plus 67 | # make and bash. 68 | 69 | URL=http://landley.net/toybox/downloads/toybox-0.6.1.tar.gz \ 70 | SHA1=7bdf7253d5a5dbf7073e8f5ca0999a7928a63dae \ 71 | maybe_fork "download || dienow" 72 | 73 | URL=http://www.busybox.net/downloads/busybox-1.24.1.tar.bz2 \ 74 | SHA1=157d14d24748b4505b1a418535688706a2b81680 \ 75 | maybe_fork "download || dienow" 76 | 77 | URL=ftp://ftp.gnu.org/gnu/make/make-3.81.tar.bz2 \ 78 | SHA1=41ed86d941b9c8025aee45db56c0283169dcab3d \ 79 | maybe_fork "download || dienow" 80 | 81 | # This version of bash is ancient, but it provides everything most package 82 | # builds need and is less than half the size of current versions. Eventually, 83 | # either busybox ash or toysh should grow enough features to replace bash. 84 | 85 | URL=http://ftp.gnu.org/gnu/bash/bash-2.05b.tar.gz \ 86 | SHA1=b3e158877f94e66ec1c8ef604e994851ee388b09 \ 87 | maybe_fork "download || dienow" 88 | 89 | # These are optional parts of the native root filesystem. 90 | 91 | URL=http://cxx.uclibc.org/src/uClibc++-0.2.2.tar.bz2 \ 92 | SHA1=f5582d206378d7daee6f46609c80204c1ad5c0f7 \ 93 | maybe_fork "download || dienow" 94 | 95 | URL=http://distcc.googlecode.com/files/distcc-3.1.tar.bz2 \ 96 | SHA1=30663e8ff94f13c0553fbfb928adba91814e1b3a \ 97 | maybe_fork "download || dienow" 98 | 99 | # The following packages are built and run on the host only. (host-tools.sh 100 | # also builds host versions of many packages in the native root filesystem, 101 | # but the following packages are not cross compiled for the target, and thus 102 | # do not wind up in the system image.) 103 | 104 | URL=http://downloads.sf.net/genext2fs/genext2fs-1.4.1.tar.gz && 105 | SHA1=9ace486ee1bad0a49b02194515e42573036f7392 \ 106 | maybe_fork "download || dienow" 107 | 108 | URL=https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.13/e2fsprogs-1.42.13.tar.gz \ 109 | SHA1=5205e5e55ca6602fc273a03123262e96405b430c \ 110 | maybe_fork "download || dienow" 111 | 112 | URL=http://zlib.net/zlib-1.2.7.tar.bz2 \ 113 | SHA1=858818fe6d358ec682d54ac5e106a2dd62628e7f \ 114 | maybe_fork "download || dienow" 115 | 116 | URL=http://downloads.sf.net/squashfs/squashfs4.2.tar.gz \ 117 | SHA1=e0944471ff68e215d3fecd464f30ea6ceb635fd7 \ 118 | RENAME="s/(squashfs)(.*)/\1-\2/" \ 119 | maybe_fork "download || dienow" 120 | 121 | rm -f "$SRCDIR"/MANIFEST # So cleanup_oldfiles doesn't warn about it. 122 | cleanup_oldfiles 123 | 124 | echo === Got all source. 125 | 126 | # Create a MANIFEST file listing package versions. 127 | 128 | # This can optionally call source control systems (git, hg and svn) to get 129 | # version information for the packages and build scripts. These 130 | # are intentionally excluded from the new path setup by host-tools.sh, so 131 | # just in case we've already run that use $OLDPATH for this. 132 | 133 | PATH="$OLDPATH" do_manifest > "$SRCDIR"/MANIFEST || dienow 134 | -------------------------------------------------------------------------------- /sources/baseconfig-busybox: -------------------------------------------------------------------------------- 1 | # busybox internal administrative symbols: 2 | CONFIG_DESKTOP=y 3 | CONFIG_LFS=y 4 | CONFIG_SHOW_USAGE=y 5 | CONFIG_FEATURE_VERBOSE_USAGE=y 6 | CONFIG_LONG_OPTS=y 7 | 8 | # low hanging fruit: 9 | 10 | CONFIG_BUNZIP2=y 11 | CONFIG_BZIP2=y 12 | CONFIG_GUNZIP=y 13 | CONFIG_GZIP=y 14 | CONFIG_UNXZ=y 15 | 16 | CONFIG_TAR=y 17 | CONFIG_FEATURE_TAR_CREATE=y 18 | CONFIG_FEATURE_TAR_AUTODETECT=y 19 | CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y 20 | CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y 21 | CONFIG_FEATURE_TAR_LONG_OPTIONS=y 22 | CONFIG_FEATURE_TAR_FROM=y 23 | CONFIG_FEATURE_SEAMLESS_BZ2=y 24 | CONFIG_FEATURE_SEAMLESS_GZ=y 25 | CONFIG_FEATURE_SEAMLESS_XZ=y 26 | 27 | CONFIG_DD=y 28 | CONFIG_FEATURE_DD_SIGNAL_HANDLING=y 29 | 30 | CONFIG_EXPR=y 31 | CONFIG_EXPR_MATH_SUPPORT_64=y 32 | 33 | CONFIG_TR=y 34 | 35 | CONFIG_DIFF=y 36 | CONFIG_FEATURE_DIFF_DIR=y 37 | 38 | CONFIG_TEST=y 39 | CONFIG_FEATURE_TEST_64=y 40 | 41 | CONFIG_ROUTE=y 42 | 43 | # shell 44 | 45 | CONFIG_HUSH=y 46 | CONFIG_HUSH_BASH_COMPAT=y 47 | CONFIG_HUSH_BRACE_EXPANSION=y 48 | CONFIG_HUSH_HELP=y 49 | CONFIG_HUSH_INTERACTIVE=y 50 | CONFIG_HUSH_SAVEHISTORY=y 51 | CONFIG_HUSH_JOB=y 52 | CONFIG_HUSH_TICK=y 53 | CONFIG_HUSH_IF=y 54 | CONFIG_HUSH_LOOPS=y 55 | CONFIG_HUSH_CASE=y 56 | CONFIG_HUSH_FUNCTIONS=y 57 | CONFIG_HUSH_LOCAL=y 58 | CONFIG_HUSH_RANDOM_SUPPORT=y 59 | CONFIG_HUSH_EXPORT_N=y 60 | CONFIG_HUSH_MODE_X=y 61 | CONFIG_FEATURE_SH_IS_HUSH=y 62 | CONFIG_FEATURE_BASH_IS_NONE=y 63 | 64 | CONFIG_SH_MATH_SUPPORT=y 65 | CONFIG_SH_MATH_SUPPORT_64=y 66 | CONFIG_FEATURE_SH_EXTRA_QUIET=y 67 | 68 | CONFIG_FEATURE_EDITING=y 69 | CONFIG_FEATURE_TAB_COMPLETION=y 70 | CONFIG_FEATURE_EDITING_FANCY_PROMPT=y 71 | CONFIG_FEATURE_EDITING_ASK_TERMINAL=y 72 | 73 | # Giant hairball 74 | 75 | CONFIG_AWK=y 76 | 77 | # LFS build 78 | 79 | # Network stuff 80 | 81 | CONFIG_FTPD=y 82 | CONFIG_FEATURE_FTP_WRITE=y 83 | CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y 84 | 85 | CONFIG_FTPGET=y 86 | CONFIG_FTPPUT=y 87 | 88 | CONFIG_WGET=y 89 | CONFIG_FEATURE_WGET_STATUSBAR=y 90 | 91 | CONFIG_PING=y 92 | 93 | # Not net 94 | 95 | CONFIG_LESS=y 96 | 97 | CONFIG_PGREP=y 98 | CONFIG_PKILL=y 99 | 100 | CONFIG_SHA512SUM=y 101 | 102 | CONFIG_FDISK=y 103 | CONFIG_FEATURE_FDISK_WRITABLE=y 104 | CONFIG_FEATURE_FDISK_ADVANCED=y 105 | 106 | # Giant hairball: 107 | 108 | CONFIG_VI=y 109 | CONFIG_FEATURE_VI_COLON=y 110 | CONFIG_FEATURE_VI_YANKMARK=y 111 | CONFIG_FEATURE_VI_SEARCH=y 112 | CONFIG_FEATURE_VI_USE_SIGNALS=y 113 | CONFIG_FEATURE_VI_DOT_CMD=y 114 | CONFIG_FEATURE_VI_READONLY=y 115 | CONFIG_FEATURE_VI_SETOPTS=y 116 | CONFIG_FEATURE_VI_SET=y 117 | CONFIG_FEATURE_VI_WIN_RESIZE=y 118 | CONFIG_FEATURE_VI_ASK_TERMINAL=y 119 | CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y 120 | 121 | # ======================================================================= 122 | 123 | # Stuff in toybox 124 | 125 | CONFIG_CAT=y 126 | CONFIG_CHROOT=y 127 | CONFIG_CMP=y 128 | CONFIG_DIRNAME=y 129 | CONFIG_DMESG=y 130 | CONFIG_ECHO=y 131 | CONFIG_FEATURE_FANCY_ECHO=y 132 | 133 | CONFIG_ENV=y 134 | CONFIG_ID=y 135 | CONFIG_LN=y 136 | 137 | CONFIG_MDEV=y 138 | 139 | CONFIG_NC=y 140 | CONFIG_NC_SERVER=y 141 | CONFIG_NC_EXTRA=y 142 | 143 | CONFIG_PATCH=y 144 | CONFIG_PWD=y 145 | CONFIG_RMDIR=y 146 | CONFIG_SHA1SUM=y 147 | CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y 148 | CONFIG_SLEEP=y 149 | CONFIG_SORT=y 150 | CONFIG_FEATURE_SORT_BIG=y 151 | 152 | CONFIG_TRUE=y 153 | CONFIG_UNAME=y 154 | CONFIG_WC=y 155 | CONFIG_WHICH=y 156 | CONFIG_XARGS=y 157 | CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y 158 | CONFIG_YES=y 159 | 160 | CONFIG_UNIQ=y 161 | CONFIG_KILL=y 162 | CONFIG_KILLALL=y 163 | 164 | CONFIG_LS=y 165 | CONFIG_FEATURE_AUTOWIDTH=y 166 | # host-tools.sh uses ls -tc to check for tarballs 167 | CONFIG_FEATURE_LS_SORTFILES=y 168 | CONFIG_FEATURE_LS_TIMESTAMPS=y 169 | CONFIG_FEATURE_LS_USERNAME=y 170 | CONFIG_BASENAME=y 171 | CONFIG_CHMOD=y 172 | CONFIG_MKDIR=y 173 | CONFIG_MKTEMP=y 174 | 175 | CONFIG_MOUNTPOINT=y 176 | CONFIG_TAC=y 177 | CONFIG_TAIL=y 178 | CONFIG_WHOAMI=y 179 | 180 | CONFIG_OD=y 181 | CONFIG_DATE=y 182 | 183 | CONFIG_CHOWN=y 184 | 185 | CONFIG_CUT=y 186 | CONFIG_HOSTNAME=y 187 | CONFIG_RM=y 188 | CONFIG_SWITCH_ROOT=y 189 | CONFIG_TOUCH=y 190 | CONFIG_CP=y 191 | CONFIG_MV=y 192 | CONFIG_LOSETUP=y 193 | 194 | CONFIG_READLINK=y 195 | CONFIG_FEATURE_READLINK_FOLLOW=y 196 | CONFIG_TIME=y 197 | 198 | CONFIG_IFCONFIG=y 199 | CONFIG_FEATURE_IFCONFIG_STATUS=y 200 | CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y 201 | CONFIG_FEATURE_IFCONFIG_HW=y 202 | CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y 203 | 204 | CONFIG_STAT=y 205 | CONFIG_FEATURE_STAT_FORMAT=y 206 | 207 | CONFIG_GREP=y 208 | CONFIG_FEATURE_GREP_EGREP_ALIAS=y 209 | CONFIG_FEATURE_GREP_FGREP_ALIAS=y 210 | 211 | CONFIG_UMOUNT=y 212 | CONFIG_FEATURE_UMOUNT_ALL=y 213 | 214 | CONFIG_SYNC=y 215 | CONFIG_HEAD=y 216 | CONFIG_CHGRP=y 217 | CONFIG_COMM=y 218 | CONFIG_LOGNAME=y 219 | CONFIG_SPLIT=y 220 | CONFIG_TEE=y 221 | 222 | CONFIG_CPIO=y 223 | CONFIG_FEATURE_CPIO_O=y 224 | CONFIG_FEATURE_CPIO_P=y 225 | 226 | CONFIG_FIND=y 227 | CONFIG_FEATURE_FIND_PRINT0=y 228 | CONFIG_FEATURE_FIND_TYPE=y 229 | CONFIG_FEATURE_FIND_XDEV=y 230 | CONFIG_FEATURE_FIND_NOT=y 231 | CONFIG_FEATURE_FIND_PAREN=y 232 | CONFIG_FEATURE_FIND_PRUNE=y 233 | CONFIG_FEATURE_FIND_PATH=y 234 | CONFIG_FEATURE_FIND_MAXDEPTH=y 235 | CONFIG_FEATURE_FIND_EXEC=y 236 | 237 | CONFIG_LSPCI=y 238 | 239 | CONFIG_INSTALL=y 240 | CONFIG_FEATURE_PRESERVE_HARDLINKS=y 241 | 242 | CONFIG_MOUNT=y 243 | CONFIG_FEATURE_MOUNT_FLAGS=y 244 | CONFIG_FEATURE_MOUNT_FSTAB=y 245 | CONFIG_FEATURE_MOUNT_LOOP=y 246 | CONFIG_FEATURE_MOUNT_LOOP_CREATE=y 247 | 248 | CONFIG_SED=y 249 | 250 | CONFIG_PS=y 251 | CONFIG_FEATURE_PS_TIME=y 252 | CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y 253 | -------------------------------------------------------------------------------- /sources/sections/gcc.sh: -------------------------------------------------------------------------------- 1 | # Build binutils, c wrapper, and uClibc++ 2 | 3 | # TOOLCHAIN_PREFIX affects the name of the generated tools, ala "${ARCH}-". 4 | 5 | # Force gcc to build, largely against its will. 6 | 7 | setupfor gcc-core 8 | [ -z "$NO_CPLUSPLUS" ] && REUSE_CURSRC=1 setupfor gcc-g++ 9 | 10 | blank_workdir build-gcc 11 | 12 | # GCC tries to "help out in the kitchen" by screwing up the kernel include 13 | # files. Surgery with sed to cut out that horrible idea throw it away. 14 | 15 | sed -i 's@^STMP_FIX.*@@' "${CURSRC}/gcc/Makefile.in" || dienow 16 | 17 | # The gcc ./configure manages to make the binutils one look sane. Again, 18 | # wrap it so we can call it with different variables to beat sense out of it. 19 | 20 | function configure_gcc() 21 | { 22 | # Are we building C only, or C and C++? 23 | [ -z "$NO_CPLUSPLUS" ] && 24 | STUFF="--enable-languages=c,c++ --disable-libstdcxx-pch" || 25 | STUFF="--enable-languages=c" 26 | 27 | # Configure gcc 28 | "$CURSRC/configure" --target="$CROSS_TARGET" --prefix="$STAGE_DIR" \ 29 | --disable-multilib --disable-nls --enable-c99 --enable-long-long \ 30 | --enable-__cxa_atexit $STUFF --program-prefix="$TOOLCHAIN_PREFIX" \ 31 | "$@" $GCC_FLAGS && 32 | 33 | # Provide xgcc as a symlink to the target compiler, so gcc doesn't waste 34 | # time trying to rebuild itself with itself. (If we want that, we'll do it 35 | # ourselves via canadian cross.) 36 | mkdir -p gcc && 37 | ln -s "$(which ${CC_FOR_TARGET:-cc})" gcc/xgcc || dienow 38 | } 39 | 40 | if [ -z "$HOST_ARCH" ] 41 | then 42 | # Produce a standard host->target cross compiler, which does not include 43 | # thread support or libgcc_s.so to make it depend on the host less. 44 | 45 | # The only prerequisite for this is binutils, above. (It doesn't even 46 | # require a C library for the target to exist yet, which is good because you 47 | # have a chicken and egg problem otherwise. What would you have compiled 48 | # that C library _with_?) 49 | 50 | AR_FOR_TARGET="${CC_PREFIX}ar" configure_gcc \ 51 | --disable-threads --disable-shared --host="$CROSS_HOST" 52 | else 53 | # Canadian cross a compiler to run on $HOST_ARCH as its host and output 54 | # binaries for $ARCH as its target. 55 | 56 | # GCC has some deep assumptions here, which are wrong. Lots of redundant 57 | # corrections are required to make it stop. 58 | 59 | [ -z "$ELF2FLT" ] && X=--enable-shared || X=--disable-shared 60 | CC="${HOST_ARCH}-cc" AR="${HOST_ARCH}-ar" AS="${HOST_ARCH}-as" \ 61 | LD="${HOST_ARCH}-ld" NM="${HOST_ARCH}-nm" \ 62 | CC_FOR_TARGET="${CC_PREFIX}cc" AR_FOR_TARGET="${CC_PREFIX}ar" \ 63 | NM_FOR_TARGET="${CC_PREFIX}nm" GCC_FOR_TARGET="${CC_PREFIX}cc" \ 64 | AS_FOR_TARGET="${CC_PREFIX}as" LD_FOR_TARGET="${CC_PREFIX}ld" \ 65 | CXX_FOR_TARGET="${CC_PREFIX}c++" \ 66 | ac_cv_path_AR_FOR_TARGET="${CC_PREFIX}ar" \ 67 | ac_cv_path_RANLIB_FOR_TARGET="${CC_PREFIX}ranlib" \ 68 | ac_cv_path_NM_FOR_TARGET="${CC_PREFIX}nm" \ 69 | ac_cv_path_AS_FOR_TARGET="${CC_PREFIX}as" \ 70 | ac_cv_path_LD_FOR_TARGET="${CC_PREFIX}ld" \ 71 | configure_gcc --enable-threads=posix $X \ 72 | --build="$CROSS_HOST" --host="${CROSS_TARGET/unknown-elf/walrus-elf}" 73 | fi 74 | 75 | # Now that it's configured, build and install gcc 76 | 77 | make -j $CPUS configure-host && 78 | make -j $CPUS all-gcc LDFLAGS="$STATIC_FLAGS" && 79 | 80 | mkdir -p "$STAGE_DIR"/cc/lib || dienow 81 | 82 | if [ ! -z "$HOST_ARCH" ] && [ -z "$NO_CPLUSPLUS" ] 83 | then 84 | # We also need to beat libsupc++ out of gcc (which uClibc++ needs to build). 85 | # But don't want to build the whole of libstdc++-v3 because 86 | # A) we're using uClibc++ instead, B) the build breaks. 87 | 88 | # The libsupc++ ./configure dies if run after the simple cross compiling 89 | # ./configure, because gcc's build system is overcomplicated crap, so skip 90 | # the uClibc++ build first time around and only do it for the canadian cross 91 | # builds. (The simple cross compiler still needs basic C++ support to build 92 | # the C++ libraries with, though.) 93 | 94 | make -j $CPUS configure-target-libstdc++-v3 SHELL=sh && 95 | cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ && 96 | make -j $CPUS && 97 | mv .libs/libsupc++.a "$STAGE_DIR"/cc/lib && 98 | cd ../../.. || dienow 99 | fi 100 | 101 | # Work around gcc bug during the install: we disabled multilib but it doesn't 102 | # always notice. 103 | 104 | ln -s lib "$STAGE_DIR/lib64" && 105 | make -j $CPUS install-gcc && 106 | rm "$STAGE_DIR/lib64" || dienow 107 | 108 | # Move the gcc internal libraries and headers somewhere sane 109 | 110 | rm -rf "$STAGE_DIR"/lib/gcc/*/*/install-tools 2>/dev/null 111 | mv "$STAGE_DIR"/lib/gcc/*/*/include "$STAGE_DIR"/cc/include && 112 | mv "$STAGE_DIR"/lib/gcc/*/*/* "$STAGE_DIR"/cc/lib && 113 | 114 | # Move the compiler internal binaries into "tools" 115 | ln -s "$CROSS_TARGET" "$STAGE_DIR/tools" && 116 | cp "$STAGE_DIR/libexec/gcc/"*/*/c* "$STAGE_DIR/tools/bin" && 117 | rm -rf "$STAGE_DIR/libexec" || dienow 118 | 119 | # collect2 is evil, kill it. 120 | # ln -sf ../../../../tools/bin/ld ${STAGE_DIR}/libexec/gcc/*/*/collect2 || dienow 121 | 122 | # Prepare for ccwrap 123 | 124 | mv "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}gcc" "$STAGE_DIR/tools/bin/cc" && 125 | ln -sf "${TOOLCHAIN_PREFIX}cc" "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}gcc" && 126 | ln -s cc "$STAGE_DIR/tools/bin/rawcc" && 127 | 128 | # Wrap C++ too. 129 | 130 | if [ -z "$NO_CPLUSPLUS" ] 131 | then 132 | mv "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}g++" "$STAGE_DIR/tools/bin/c++" && 133 | ln -sf "${TOOLCHAIN_PREFIX}cc" "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}g++" && 134 | ln -sf "${TOOLCHAIN_PREFIX}cc" "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}c++" && 135 | ln -s c++ "$STAGE_DIR/tools/bin/raw++" || dienow 136 | fi 137 | 138 | # Make sure "tools" has everything distccd needs. 139 | 140 | cd "$STAGE_DIR/tools" || dienow 141 | ln -s cc "$STAGE_DIR/tools/bin/gcc" 2>/dev/null 142 | [ -z "$NO_CPLUSPLUS" ] && ln -s c++ "$STAGE_DIR/tools/bin/g++" 2>/dev/null 143 | 144 | rm -rf "${STAGE_DIR}"/{lib/gcc,libexec/gcc/install-tools,bin/${ARCH}-unknown-*} 145 | 146 | # Call binary package tarball "gcc", not "gcc-core". 147 | 148 | PACKAGE=gcc cleanup 149 | --------------------------------------------------------------------------------