Skip to content

Commit cbe5cff

Browse files
Gregor RichardsGregor Richards
authored andcommitted
Implemented usrview based on aufs, all the basics of a root FS are in place.
1 parent 134e998 commit cbe5cff

File tree

32 files changed

+722
-22
lines changed

32 files changed

+722
-22
lines changed

core/build-gcc-deps.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ set -e
1414
# Switch to the CC prefix for all of this
1515
PREFIX="$CC_PREFIX/$TRIPLE"
1616

17-
GMP_VERSION=5.0.4
18-
MPFR_VERSION=3.1.0
19-
MPC_VERSION=0.9
20-
2117
# GMP
2218
fetchextract ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/ gmp-$GMP_VERSION .tar.bz2
2319
cp -f config.sub gmp-$GMP_VERSION/configfsf.sub

core/buildcc.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ set -e
1414
# Switch to the CC prefix for all of this
1515
PREFIX="$CC_PREFIX"
1616

17-
BINUTILS_VERSION=2.22
18-
GCC_VERSION=4.7.0
19-
MUSL_VERSION=0.8.10
20-
LINUX_VERSION=3.3.4
21-
2217
# binutils
2318
fetchextract http://ftp.gnu.org/gnu/binutils/ binutils-$BINUTILS_VERSION .tar.bz2
2419
buildinstall 1 binutils-$BINUTILS_VERSION --target=$TRIPLE
@@ -31,11 +26,11 @@ buildinstall 1 gcc-$GCC_VERSION --target=$TRIPLE \
3126
--disable-shared --disable-libmudflap --disable-libgomp
3227

3328
# 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 ]
29+
gitfetchextract 'git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-linux.git' $LINUX_VERSION aufs3-linux-$LINUX_VERSION
30+
cp linux.config aufs3-linux-$LINUX_VERSION/.config
31+
if [ ! -e aufs3-linux-$LINUX_VERSION/installedheaders ]
3732
then
38-
pushd linux-$LINUX_VERSION
33+
pushd aufs3-linux-$LINUX_VERSION
3934
make headers_install INSTALL_HDR_PATH="$CC_PREFIX/$TRIPLE"
4035
touch installedheaders
4136
popd

core/buildroot.sh

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ set -e
1111

1212
. "$SNOWFLAKE_BASE"/defs.sh
1313

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-
2014
# base files
2115
mkdir -p "$SNOWFLAKE_PREFIX"
2216
if [ ! -e "$SNOWFLAKE_PREFIX/usr" ]
@@ -25,7 +19,7 @@ then
2519
do
2620
ln -s usr/$i "$SNOWFLAKE_PREFIX/$i"
2721
done
28-
for i in boot dev pkg proc sys usr
22+
for i in boot dev home local pkg proc root sys tmp usr
2923
do
3024
mkdir -p "$SNOWFLAKE_PREFIX/$i"
3125
done
@@ -61,6 +55,31 @@ then
6155
cp snowflake-quicklink "$SNOWFLAKE_PREFIX/pkg/quicklink/$QUICKLINK_VERSION/usr/bin/"
6256
fi
6357

58+
# usrview
59+
if [ ! -e "$SNOWFLAKE_PREFIX/pkg/usrview/$USRVIEW_VERSION/usr/bin/usrview" ]
60+
then
61+
mkdir -p "$SNOWFLAKE_PREFIX/pkg/usrview/$USRVIEW_VERSION/usr/bin"
62+
pushd ../usrview
63+
make clean
64+
make CC="$TRIPLE-gcc -static -s"
65+
popd
66+
cp ../usrview/usrview "$SNOWFLAKE_PREFIX/pkg/usrview/$USRVIEW_VERSION/usr/bin/"
67+
fi
68+
69+
# core files
70+
if [ ! -e "$SNOWFLAKE_PREFIX/pkg/core/1.0/usr/etc" ]
71+
then
72+
mkdir -p "$SNOWFLAKE_PREFIX/pkg/core/1.0/usr/etc"
73+
cp -a etc "$SNOWFLAKE_PREFIX/pkg/core/1.0/"
74+
pushd etc
75+
for i in *
76+
do
77+
ln -s /pkg/core/1.0/etc/$i "$SNOWFLAKE_PREFIX/pkg/core/1.0/usr/etc/$i"
78+
done
79+
popd
80+
ln -s /local "$SNOWFLAKE_PREFIX/pkg/core/1.0/usr/local"
81+
fi
82+
6483
# binutils
6584
PREFIX="/usr"
6685
fetchextract http://ftp.gnu.org/gnu/binutils/ binutils-$BINUTILS_VERSION .tar.bz2
@@ -84,6 +103,18 @@ unset PREFIX
84103
# un"fix" headers
85104
rm -rf "$SNOWFLAKE_PREFIX/pkg/gcc/$GCC_VERSION/usr/lib/gcc/$TRIPLE"/*/include-fixed/
86105

106+
# make usrview setuid-root
107+
$SUDO chown 0:0 "$SNOWFLAKE_PREFIX/pkg/usrview/$USRVIEW_VERSION/usr/bin/usrview"
108+
$SUDO chmod 4755 "$SNOWFLAKE_PREFIX/pkg/usrview/$USRVIEW_VERSION/usr/bin/usrview"
109+
110+
# make everything mountable
111+
for pkg in musl/$MUSL_VERSION busybox/$BUSYBOX_VERSION \
112+
quicklink/$QUICKLINK_VERSION usrview/$USRVIEW_VERSION \
113+
binutils/$BINUTILS_VERSION gcc/$GCC_VERSION
114+
do
115+
$SUDO touch "$SNOWFLAKE_PREFIX/pkg/$pkg/usr/.usr_ok"
116+
done
117+
87118
# actually perform the linking
88119
$SUDO chroot "$SNOWFLAKE_PREFIX" /pkg/busybox/$BUSYBOX_VERSION/usr/bin/sh \
89120
/pkg/quicklink/$QUICKLINK_VERSION/usr/bin/snowflake-quicklink \

core/defs.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ then
1515
exit 1
1616
fi
1717

18+
# Versions of things (do this before config.sh so they can be config'd)
19+
BINUTILS_VERSION=2.22
20+
BUSYBOX_VERSION=1.19.4
21+
MPC_VERSION=0.9
22+
MPFR_VERSION=3.1.0
23+
GCC_VERSION=4.7.0
24+
GMP_VERSION=5.0.4
25+
LINUX_VERSION=6ee00da3eefd493456259fe774a74dfb12c49152
26+
MUSL_VERSION=0.8.10
27+
QUICKLINK_VERSION=0.1
28+
USRVIEW_VERSION=0.1
29+
1830
. "$SNOWFLAKE_BASE"/config.sh
1931

2032
PATH="$CC_PREFIX/bin:$PATH"
@@ -60,6 +72,22 @@ fetchextract() {
6072
extract "$2""$3" "$2"
6173
}
6274

75+
gitfetchextract() {
76+
if [ ! -e "$SRCDIR/$3".tar.gz ]
77+
then
78+
git archive --format=tar --remote="$1" "$2" | \
79+
gzip -c > "$SRCDIR/$3".tar.gz || die "Failed to fetch $3-$2"
80+
fi
81+
if [ ! -e "$3/extracted" ]
82+
then
83+
mkdir -p "$3"
84+
pushd "$3" || die "Failed to pushd $3"
85+
extract "$3".tar.gz extracted
86+
touch extracted
87+
popd
88+
fi
89+
}
90+
6391
patch_source() {
6492
BD="$1"
6593

core/etc/fstab

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# /etc/fstab: static file system information
3+
#
4+
# <file system> <dir> <type> <options> <dump> <pass>
5+
dev /dev devtmpfs defaults 0 0
6+
devpts /dev/pts devpts defaults 0 0
7+
shm /dev/shm tmpfs nodev,nosuid 0 0
8+
proc /proc proc defaults 0 0
9+
sys /sys sysfs defaults 0 0
10+
tmp /tmp tmpfs defaults 0 0

core/etc/group

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
root:x:0:root
2+
nobody:x:99:
3+
users:x:100:

core/etc/hostname

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
snowflake

core/etc/hosts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# /etc/hosts: static lookup table for host names
3+
#
4+
5+
#<ip-address> <hostname.domain.org> <hostname>
6+
127.0.0.1 localhost.localdomain localhost
7+
::1 localhost.localdomain localhost
8+
9+
# End of file

core/etc/inittab

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Note that busybox uses a non-standard inittab.
2+
3+
::sysinit:/etc/rc.boot
4+
::respawn:getty -L 38400 tty1 linux
5+
::respawn:getty -L 38400 tty2 linux
6+
::respawn:getty -L 38400 tty3 linux
7+
::shutdown:/etc/rc.shutdown

core/etc/issue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Snowflake \n (\s \m \r) (\l)
2+

0 commit comments

Comments
 (0)