29 | |
30 | News
31 |
34 | Documentation
35 |
44 | Download
45 |
49 |
50 | Development
51 |
60 | Control Images
61 |
62 | |
63 | |
64 |
65 |
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 |
--------------------------------------------------------------------------------
|