Skip to content

Commit 134e998

Browse files
Gregor RichardsGregor Richards
authored andcommitted
Initial import of core things.
0 parents  commit 134e998

File tree

12 files changed

+6604
-0
lines changed

12 files changed

+6604
-0
lines changed

core/binutils-2.22-musl.diff

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/config.sub b/config.sub
2+
--- a/config.sub
3+
+++ b/config.sub
4+
@@ -125,6 +125,7 @@
5+
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
6+
case $maybe_os in
7+
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
8+
+ linux-musl* | \
9+
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
10+
knetbsd*-gnu* | netbsd*-gnu* | \
11+
kopensolaris*-gnu* | \
12+
@@ -1335,6 +1336,7 @@
13+
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
14+
| -mingw32* | -linux-gnu* | -linux-android* \
15+
| -linux-newlib* | -linux-uclibc* \
16+
+ | -linux-musl* \
17+
| -uxpv* | -beos* | -mpeix* | -udk* \
18+
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
19+
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \

core/build-gcc-deps.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash -x
2+
# Build deps for GCC
3+
4+
if [ ! "$SNOWFLAKE_BASE" ]
5+
then
6+
SNOWFLAKE_BASE="$PWD"
7+
fi
8+
9+
# Fail on any command failing:
10+
set -e
11+
12+
. "$SNOWFLAKE_BASE"/defs.sh
13+
14+
# Switch to the CC prefix for all of this
15+
PREFIX="$CC_PREFIX/$TRIPLE"
16+
17+
GMP_VERSION=5.0.4
18+
MPFR_VERSION=3.1.0
19+
MPC_VERSION=0.9
20+
21+
# GMP
22+
fetchextract ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/ gmp-$GMP_VERSION .tar.bz2
23+
cp -f config.sub gmp-$GMP_VERSION/configfsf.sub
24+
buildinstall '' gmp-$GMP_VERSION --host="$TRIPLE" --enable-static --disable-shared
25+
26+
# MPFR
27+
fetchextract http://www.mpfr.org/mpfr-current/ mpfr-$MPFR_VERSION .tar.bz2
28+
cp -f config.sub mpfr-$MPFR_VERSION/config.sub
29+
buildinstall '' mpfr-$MPFR_VERSION --host="$TRIPLE" --enable-static --disable-shared CC="$TRIPLE-gcc"
30+
31+
# MPC
32+
fetchextract http://www.multiprecision.org/mpc/download/ mpc-$MPC_VERSION .tar.gz
33+
cp -f config.sub mpc-$MPC_VERSION/config.sub
34+
buildinstall '' mpc-$MPC_VERSION --host="$TRIPLE" --enable-static --disable-shared

core/buildcc.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash -x
2+
# Build a cross-compiler
3+
4+
if [ ! "$SNOWFLAKE_BASE" ]
5+
then
6+
SNOWFLAKE_BASE="$PWD"
7+
fi
8+
9+
# Fail on any command failing:
10+
set -e
11+
12+
. "$SNOWFLAKE_BASE"/defs.sh
13+
14+
# Switch to the CC prefix for all of this
15+
PREFIX="$CC_PREFIX"
16+
17+
BINUTILS_VERSION=2.22
18+
GCC_VERSION=4.7.0
19+
MUSL_VERSION=0.8.10
20+
LINUX_VERSION=3.3.4
21+
22+
# binutils
23+
fetchextract http://ftp.gnu.org/gnu/binutils/ binutils-$BINUTILS_VERSION .tar.bz2
24+
buildinstall 1 binutils-$BINUTILS_VERSION --target=$TRIPLE
25+
26+
# gcc 1
27+
fetchextract http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/ gcc-$GCC_VERSION .tar.bz2
28+
buildinstall 1 gcc-$GCC_VERSION --target=$TRIPLE \
29+
--enable-languages=c --with-newlib --disable-multilib --disable-libssp \
30+
--disable-libquadmath --disable-threads --disable-decimal-float \
31+
--disable-shared --disable-libmudflap --disable-libgomp
32+
33+
# linux headers
34+
fetchextract http://www.kernel.org/pub/linux/kernel/v3.0/ linux-$LINUX_VERSION .tar.bz2
35+
cp linux.config linux-$LINUX_VERSION/.config
36+
if [ ! -e linux-$LINUX_VERSION/installedheaders ]
37+
then
38+
pushd linux-$LINUX_VERSION
39+
make headers_install INSTALL_HDR_PATH="$CC_PREFIX/$TRIPLE"
40+
touch installedheaders
41+
popd
42+
fi
43+
44+
# musl in CC prefix
45+
PREFIX="$CC_PREFIX/$TRIPLE"
46+
export PREFIX
47+
fetchextract http://www.etalabs.net/musl/releases/ musl-$MUSL_VERSION .tar.gz
48+
cp musl.config.mak musl-$MUSL_VERSION/config.mak
49+
buildmake musl-$MUSL_VERSION
50+
doinstall '' musl-$MUSL_VERSION
51+
unset PREFIX
52+
PREFIX="$CC_PREFIX"
53+
54+
# gcc 2
55+
buildinstall 2 gcc-$GCC_VERSION --target=$TRIPLE \
56+
--enable-languages=c --disable-multilib --disable-libmudflap
57+
58+
# un"fix" headers
59+
rm -rf "$CC_PREFIX/lib/gcc/$TRIPLE"/*/include-fixed/

core/buildroot.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash -x
2+
# Build a cross-compiler
3+
4+
if [ ! "$SNOWFLAKE_BASE" ]
5+
then
6+
SNOWFLAKE_BASE="$PWD"
7+
fi
8+
9+
# Fail on any command failing:
10+
set -e
11+
12+
. "$SNOWFLAKE_BASE"/defs.sh
13+
14+
BINUTILS_VERSION=2.22
15+
GCC_VERSION=4.7.0
16+
MUSL_VERSION=0.8.10
17+
BUSYBOX_VERSION=1.19.4
18+
QUICKLINK_VERSION=0.1
19+
20+
# base files
21+
mkdir -p "$SNOWFLAKE_PREFIX"
22+
if [ ! -e "$SNOWFLAKE_PREFIX/usr" ]
23+
then
24+
for i in bin etc include lib libexec sbin
25+
do
26+
ln -s usr/$i "$SNOWFLAKE_PREFIX/$i"
27+
done
28+
for i in boot dev pkg proc sys usr
29+
do
30+
mkdir -p "$SNOWFLAKE_PREFIX/$i"
31+
done
32+
fi
33+
34+
# musl
35+
if [ ! -e "$SNOWFLAKE_PREFIX/pkg/musl/$MUSL_VERSION/usr/lib/libc.so" ]
36+
then
37+
rm -f musl-$MUSL_VERSION/installed # Force it to reinstall
38+
fi
39+
PREFIX="/"
40+
export PREFIX
41+
fetchextract http://www.etalabs.net/musl/releases/ musl-$MUSL_VERSION .tar.gz
42+
cp musl.config.mak musl-$MUSL_VERSION/config.mak
43+
buildmake musl-$MUSL_VERSION
44+
doinstall '' musl-$MUSL_VERSION DESTDIR="$SNOWFLAKE_PREFIX/pkg/musl/$MUSL_VERSION/usr"
45+
rm -rf "$SNOWFLAKE_PREFIX/pkg/musl/$MUSL_VERSION/usr/bin" # No musl-gcc needed or wanted
46+
unset PREFIX
47+
48+
# busybox
49+
fetchextract http://busybox.net/downloads/ busybox-$BUSYBOX_VERSION .tar.bz2
50+
cp busybox.config busybox-$BUSYBOX_VERSION/.config
51+
buildmake busybox-$BUSYBOX_VERSION LDFLAGS=-static \
52+
CFLAGS_busybox="-Wl,-z,muldefs" HOSTCC=gcc CC="$TRIPLE-gcc"
53+
doinstall '' busybox-$BUSYBOX_VERSION LDFLAGS=-static \
54+
CFLAGS_busybox="-Wl,-z,muldefs" HOSTCC=gcc CC="$TRIPLE-gcc" \
55+
CONFIG_PREFIX="$SNOWFLAKE_PREFIX/pkg/busybox/$BUSYBOX_VERSION/usr"
56+
57+
# quicklink
58+
if [ ! -e "$SNOWFLAKE_PREFIX/pkg/quicklink/$QUICKLINK_VERSION/usr/bin/snowflake-quicklink" ]
59+
then
60+
mkdir -p "$SNOWFLAKE_PREFIX/pkg/quicklink/$QUICKLINK_VERSION/usr/bin"
61+
cp snowflake-quicklink "$SNOWFLAKE_PREFIX/pkg/quicklink/$QUICKLINK_VERSION/usr/bin/"
62+
fi
63+
64+
# binutils
65+
PREFIX="/usr"
66+
fetchextract http://ftp.gnu.org/gnu/binutils/ binutils-$BINUTILS_VERSION .tar.bz2
67+
nolib64 "$SNOWFLAKE_PREFIX/pkg/binutils/$BINUTILS_VERSION/usr"
68+
MAKEFLAGS="$MAKEFLAGS DESTDIR=$SNOWFLAKE_PREFIX/pkg/binutils/$BINUTILS_VERSION" \
69+
buildinstall root binutils-$BINUTILS_VERSION --host=$TRIPLE --target=$TRIPLE \
70+
--disable-werror
71+
nolib64end "$SNOWFLAKE_PREFIX/pkg/binutils/$BINUTILS_VERSION/usr"
72+
unset PREFIX
73+
74+
# gcc
75+
PREFIX="/usr"
76+
fetchextract http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/ gcc-$GCC_VERSION .tar.bz2
77+
nolib64 "$SNOWFLAKE_PREFIX/pkg/gcc/$GCC_VERSION/usr"
78+
MAKEFLAGS="$MAKEFLAGS DESTDIR=$SNOWFLAKE_PREFIX/pkg/gcc/$GCC_VERSION" \
79+
buildinstall root gcc-$GCC_VERSION --host=$TRIPLE --target=$TRIPLE \
80+
--enable-languages=c --disable-multilib --disable-libmudflap
81+
nolib64end "$SNOWFLAKE_PREFIX/pkg/gcc/$GCC_VERSION/usr"
82+
unset PREFIX
83+
84+
# un"fix" headers
85+
rm -rf "$SNOWFLAKE_PREFIX/pkg/gcc/$GCC_VERSION/usr/lib/gcc/$TRIPLE"/*/include-fixed/
86+
87+
# actually perform the linking
88+
$SUDO chroot "$SNOWFLAKE_PREFIX" /pkg/busybox/$BUSYBOX_VERSION/usr/bin/sh \
89+
/pkg/quicklink/$QUICKLINK_VERSION/usr/bin/snowflake-quicklink \
90+
binutils/$BINUTILS_VERSION gcc/$GCC_VERSION

core/busybox-1.19.4-musl.diff

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
diff -aur busybox-1.19.2.orig//include/libbb.h busybox-1.19.2//include/libbb.h
2+
--- busybox-1.19.2.orig//include/libbb.h 2011-09-16 01:12:38.000000000 +0000
3+
+++ busybox-1.19.2//include/libbb.h 2011-09-16 01:13:21.000000000 +0000
4+
@@ -37,6 +37,7 @@
5+
#include <sys/mman.h>
6+
#include <sys/socket.h>
7+
#include <sys/stat.h>
8+
+#include <sys/sysinfo.h>
9+
#include <sys/time.h>
10+
#include <sys/types.h>
11+
#ifndef major
12+
Only in busybox-1.19.2//include: libbb.h.orig
13+
diff -aur busybox-1.19.2.orig//include/platform.h busybox-1.19.2//include/platform.h
14+
--- busybox-1.19.2.orig//include/platform.h 2011-09-16 01:12:38.000000000 +0000
15+
+++ busybox-1.19.2//include/platform.h 2011-09-16 01:13:21.000000000 +0000
16+
@@ -443,6 +443,13 @@
17+
# undef HAVE_NET_ETHERNET_H
18+
#endif
19+
20+
+#if defined(__musl__)
21+
+# undef HAVE_SETBIT
22+
+# include <stddef.h>
23+
+# include <termios.h>
24+
+# include <sys/ioctl.h>
25+
+#endif
26+
+
27+
/*
28+
* Now, define prototypes for all the functions defined in platform.c
29+
* These must come after all the HAVE_* macros are defined (or not)
30+
Only in busybox-1.19.2//include: platform.h.orig
31+
diff -aur busybox-1.19.2.orig//miscutils/man.c busybox-1.19.2//miscutils/man.c
32+
--- busybox-1.19.2.orig//miscutils/man.c 2011-09-16 01:12:38.000000000 +0000
33+
+++ busybox-1.19.2//miscutils/man.c 2011-09-16 01:13:21.000000000 +0000
34+
@@ -116,7 +116,7 @@
35+
/* "2>&1" is added so that nroff errors are shown in pager too.
36+
* Otherwise it may show just empty screen */
37+
cmd = xasprintf(
38+
- man ? "gtbl | nroff -Tlatin1 -mandoc 2>&1 | %s"
39+
+ man ? "nroff -Tutf -man 2>&1 | %s"
40+
: "%s",
41+
pager);
42+
system(cmd);
43+
Only in busybox-1.19.2//miscutils: man.c.orig
44+
diff -aur busybox-1.19.2.orig//networking/ifconfig.c busybox-1.19.2//networking/ifconfig.c
45+
--- busybox-1.19.2.orig//networking/ifconfig.c 2011-09-16 01:12:38.000000000 +0000
46+
+++ busybox-1.19.2//networking/ifconfig.c 2011-09-16 01:13:21.000000000 +0000
47+
@@ -56,7 +56,7 @@
48+
#endif
49+
50+
#if ENABLE_FEATURE_IFCONFIG_SLIP
51+
-# include <net/if_slip.h>
52+
+# include <linux/if_slip.h>
53+
#endif
54+
55+
/* I don't know if this is needed for busybox or not. Anyone? */
56+
Only in busybox-1.19.2//networking: ifconfig.c.orig
57+
diff -aur busybox-1.19.2.orig//networking/libiproute/iplink.c busybox-1.19.2//networking/libiproute/iplink.c
58+
--- busybox-1.19.2.orig//networking/libiproute/iplink.c 2011-09-16 01:12:38.000000000 +0000
59+
+++ busybox-1.19.2//networking/libiproute/iplink.c 2011-09-16 01:13:21.000000000 +0000
60+
@@ -5,7 +5,6 @@
61+
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
62+
*/
63+
#include <net/if.h>
64+
-#include <net/if_packet.h>
65+
#include <netpacket/packet.h>
66+
#include <netinet/if_ether.h>
67+
68+
Only in busybox-1.19.2//networking/libiproute: iplink.c.orig
69+
diff -aur busybox-1.19.2.orig//networking/tcpudp.c busybox-1.19.2//networking/tcpudp.c
70+
--- busybox-1.19.2.orig//networking/tcpudp.c 2011-09-16 01:12:38.000000000 +0000
71+
+++ busybox-1.19.2//networking/tcpudp.c 2011-09-16 01:13:21.000000000 +0000
72+
@@ -71,7 +71,7 @@
73+
/* Wants <limits.h> etc, thus included after libbb.h: */
74+
#ifdef __linux__
75+
#include <linux/types.h> /* for __be32 etc */
76+
-#include <linux/netfilter_ipv4.h>
77+
+//#include <linux/netfilter_ipv4.h>
78+
#endif
79+
80+
// TODO: move into this file:
81+
diff -aur busybox-1.19.2.orig//util-linux/fdisk.c busybox-1.19.2//util-linux/fdisk.c
82+
--- busybox-1.19.2.orig//util-linux/fdisk.c 2011-09-16 01:12:38.000000000 +0000
83+
+++ busybox-1.19.2//util-linux/fdisk.c 2011-09-16 01:13:21.000000000 +0000
84+
@@ -550,7 +550,7 @@
85+
{
86+
#if ENABLE_FDISK_SUPPORT_LARGE_DISKS
87+
off64_t off = (off64_t)secno * sector_size;
88+
- if (lseek64(dev_fd, off, SEEK_SET) == (off64_t) -1)
89+
+ if (lseek(dev_fd, off, SEEK_SET) == (off64_t) -1)
90+
fdisk_fatal(unable_to_seek);
91+
#else
92+
uint64_t off = (uint64_t)secno * sector_size;
93+
Only in busybox-1.19.2//util-linux: fdisk.c.orig
94+
Make -p count "path components" not slashes, so broken /blah//thing paths work.
95+
96+
diff --git a/editors/patch.c b/editors/patch.c
97+
index 1f2a49b..b1f51cf 100644
98+
--- a/editors/patch.c
99+
+++ b/editors/patch.c
100+
@@ -482,11 +482,11 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
101+
102+
// handle -p path truncation.
103+
for (i=0, s = name; *s;) {
104+
+ char *temp = name;
105+
+
106+
if ((option_mask32 & FLAG_PATHLEN) && TT.prefix == i) break;
107+
- if (*(s++)=='/') {
108+
- name = s;
109+
- i++;
110+
- }
111+
+ while (*(s++)=='/') name = s;
112+
+ if (temp != name) i++;
113+
}
114+
115+
if (empty) {

0 commit comments

Comments
 (0)