-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
103 lines (76 loc) · 4.07 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
This is Snowflake, a highly experimental Linux distribution based on the musl C
library, with a per-process view of the /usr filesystem, such that users may
choose to have different perceptions of which packages are available on the
system. Snowflake runs on i[3456]86, x86_64 and ARM.
Within Snowflake, users may choose to change their view of which packages and
versions are installed. For instance, if you do not expose gcc in the default
set of packages, a user may compile packages like so:
$ gcc
sh: gcc: not found
$ with gcc
$ which gcc
/usr/bin/gcc
$ gcc test.c
$ ./a.out
Hello, world!
To build snowflake, make a config.sh (or use the existing one), and run
build.sh (in core/). Building a Snowflake root filesystem does not require
root. It runs the following sub-scripts, in this order:
* ./buildcc.sh: Builds a cross-compiler targeting linux-musl. Due to a
confluence of bugs, including possibly a bug in my GCC patch (which I'm
investigating) as well as a pseudo-bug in GCC (GCC 4.7.0 can only be
cross-built with GCC >=4.7.0), you currently need a cross-compiler for
linux-musl. It's generally a good idea since it avoids pollution anyway. If
at some point I figure out how to get GCC 4.7.0 to reliably compile with the
musl-gcc wrapper instead of a cross-compiler, this step will not be strictly
necessary, but will still be recommended. As a point of comparison, note that
most other musl distributions require that you compile GCC 3.6 for musl
before compiling GCC 4, so the number of GCC compiles is the same.
* ./build-gcc-deps.sh: Builds prerequisites to build GCC for the guest. This
needs to be done after buildcc and before buildroot.
* ./buildroot.sh: Builds a Snowflake root filesystem. This is the only
necessary step if building Snowflake on a native musl system.
It is mandatory to build out-of-source. To do so, put config.sh in a directory
of your choosing, then simply run the scripts out of the core/ directory.
Once you have the root filesystem set up, write it to an HD image:
* ./mk-hd-image.sh: Builds a Snowflake HD image from a root filesystem. This
requires root, but for very silly reasons (it needs fdisk and loop mounting).
If you don't have root, you can work around that requirement with, e.g.,
https://bitbucket.org/GregorR/umlbox . In that case, run it as `umlbox -fw /
-s ./mk-hd-image.sh`.
You may also chroot directly into the root filesystem, if your host kernel has
aufs. The first time you do so, you will have to run the init script, which
does in-tree configuration:
$ chroot root /usr/bin/init
That step is done automatically if you run Snowflake in a VM or a real machine,
it is only necessary if you use chroot.
Once you're in the Snowflake filesystem, the final step is to bootstrap the
last few packages.
$ /src/bootstrap.sh
Snowflake supports the NetBSD pkgsrc as a source of packages. The integration
is imperfect but working. To include pkgsrc, set WITH_PKGSRC=yes in your
config.sh. To use it, just `with pkgsrc` then build in /var/pkgsrc.
Installation will automatically go into separated packages in /pkg.
The default root password is "snowflake".
Snowflake can run on ARM, MIPS and PowerPC, though these ports are considerably
less tested. Currently pkgsrc does not work on musl+MIPS, but other
combinations seems to work. A native compile on one of these systems should
work just like a native compile on any other system. To cross-compile Snowflake
for them:
* Your config.sh must specify one of
ARCH=arm
ARCH=mips
ARCH=powerpc
* On MIPS, config.sh must additionally specify
MPFR_VERSION=3.1.1
MPC_VERSION=1.0
* On PowerPC, config.sh must additionally specify
GCC_BOOTSTRAP_CONFFLAGS="--with-long-double-64 --enable-secureplt"
GCC_CONFFLAGS="--with-long-double-64 --enable-secureplt"
* Up to buildroot is as normal. After buildroot asks you to sudo, it will have
some errors. These are normal.
* Use mk-hd-image.sh to create an image, even though it hasn't been finalized
or bootstrapped.
* The image should be usable in qemu. Example commands are provided in
core/qemu.
* Run /src/bootstrap.sh to finish bootstrapping.