GithubHelp home page GithubHelp logo

snowflake's Introduction

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.

snowflake's People

Contributors

gregorr avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.