diff options
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | .vars | 5 | ||||
| -rw-r--r-- | inc | 15 | ||||
| -rw-r--r-- | readme.md | 34 | ||||
| -rw-r--r-- | scripts/build.sh | 6 | ||||
| -rw-r--r-- | scripts/destroy.sh | 3 | ||||
| -rw-r--r-- | scripts/get_sources.sh | 7 | ||||
| -rw-r--r-- | scripts/mksh.sh | 13 | ||||
| -rw-r--r-- | scripts/musl.sh | 9 | ||||
| -rw-r--r-- | scripts/sbase.sh | 14 | ||||
| -rw-r--r-- | scripts/ubase.sh | 15 | ||||
| -rw-r--r-- | sources.lst | 3 |
12 files changed, 127 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0c8216f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build +pfx +distfiles @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +set -x + +. ./inc @@ -0,0 +1,15 @@ +#!/bin/sh + +base_dir="$(pwd)" +# So we can source this and use it in the shell +export prefix="$(pwd)/pfx" +dist_dir="$(pwd)/distfiles" +build_dir="$(pwd)/build" + +if ! [ -d $build_dir ] ; then mkdir $build_dir; fi +if ! [ -d $prefix ] ; then mkdir $prefix; fi + +# Reset our PATH +. /etc/profile + +PATH="$prefix/usr/local/musl/bin:$prefix/usr/sbin:$prefix/usr/bin:$prefix/bin:$prefix/sbin:${PATH}" diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..803d9ba --- /dev/null +++ b/readme.md @@ -0,0 +1,34 @@ +# *MIN*imum system + +A small set of scripts to build an absolutely minimalist system using +the `musl` `libc`, `mksh`, the "one true awk", and other tools. + +I'm purposely trying to avoid large or complex projects such as Busybox. +Not that they don't have their place, or that there's anything wrong with +them, but IMO they take the fun out of it because they have absolutely +everything you need. The Linux Kernel will be the glaring exception here. + +Currently it's just building a minimal set of tools into `pfx/` eventually +the scripts will encompass building a virtual machine image with a boot +loader and all the bells and whistles. ( if I get around to it ha ha ) + +## Will your system include a compiler? + +Probably not, but I've thought about this one, it'd be cool to make it +"self-hosting" in a sense. + +## What Linux distribution are you building this on? + +Gentoo at the moment, it should work on any Linux distribution. + +## Why? + +I want to learn more about how operating systems are built and doing something +that someone else has already laid out for you ( such as the LFS project ) is +just too tedious and boring for me, I'd rather do something different. + + +## The process so far: + +Run `scripts/get_sources.sh` and then `scripts/build.sh` It's rather important +to run them from the `min` directory so the paths and imports will be correct. diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..c96f1cb --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,6 @@ +#!/bin/sh +shell="/bin/sh" +$shell scripts/musl.sh +$shell scripts/mksh.sh +$shell scripts/sbase.sh +$shell scripts/ubase.sh diff --git a/scripts/destroy.sh b/scripts/destroy.sh new file mode 100644 index 0000000..91b4d94 --- /dev/null +++ b/scripts/destroy.sh @@ -0,0 +1,3 @@ +#!/bin/sh +set -x +rm -rf build pfx diff --git a/scripts/get_sources.sh b/scripts/get_sources.sh new file mode 100644 index 0000000..946c288 --- /dev/null +++ b/scripts/get_sources.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +set -x +cd ${dist_dir} +wget -i sources.lst +git clone git://git.suckless.org/sbase +git clone git://git.suckless.org/ubase diff --git a/scripts/mksh.sh b/scripts/mksh.sh new file mode 100644 index 0000000..e4dcd59 --- /dev/null +++ b/scripts/mksh.sh @@ -0,0 +1,13 @@ +#!/bin/sh +. ./.vars +VERSION="R56c" +cd $build_dir +tar xfzv ${dist_dir}/mksh-$VERSION.tgz +cd mksh +export LDFLAGS="-static" +export CC="musl-gcc" +sh ./Build.sh +install -d $prefix/bin +install -m 555 mksh $prefix/bin/sh +ln $prefix/bin/sh $prefix/bin/ksh +ln $prefix/bin/sh $prefix/bin/mksh diff --git a/scripts/musl.sh b/scripts/musl.sh new file mode 100644 index 0000000..2ad8b0e --- /dev/null +++ b/scripts/musl.sh @@ -0,0 +1,9 @@ +#!/bin/sh +. ./.vars +VERSION="1.1.19" +cd $build_dir +tar xzvf ${dist_dir}/musl-$VERSION.tar.gz +cd musl-$VERSION +./configure --prefix=$prefix/usr/local/musl --enable-static +make -j$(nproc) +make install diff --git a/scripts/sbase.sh b/scripts/sbase.sh new file mode 100644 index 0000000..ec5b7d2 --- /dev/null +++ b/scripts/sbase.sh @@ -0,0 +1,14 @@ +#!/bin/sh +. ./.vars +export DESTDIR=$prefix +git clone --depth=1 ${dist_dir}/sbase ${build_dir}/sbase +cd $build_dir/sbase +cp config.mk config.mk.bak +sed \ + -e's@^PREFIX = .*$@PREFIX = /@' \ + -e's@^MANPREFIX = .*$@MANPREFIX = /usr/share/man@' \ + -e's/^CC.*$/CC = musl-gcc/' \ + -e'/^LDFLAGS/ s/$/ -static/' \ + < config.mk.bak > config.mk +make +make install diff --git a/scripts/ubase.sh b/scripts/ubase.sh new file mode 100644 index 0000000..36bc064 --- /dev/null +++ b/scripts/ubase.sh @@ -0,0 +1,15 @@ +#!/bin/sh +. ./.vars +export DESTDIR=$prefix +git clone ${dist_dir}/ubase ${build_dir}/ubase +cd ${build_dir}/ubase +cp config.mk config.mk.bak +sed \ + -e's@^PREFIX = .*$@PREFIX = /@' \ + -e's@^MANPREFIX = .*$@MANPREFIX = /usr/share/man@' \ + -e's/^CC.*$/CC = musl-gcc/' \ + -e'/^LDFLAGS/ s/$/ -static/' \ + < config.mk.bak > config.mk +rm config.mk.bak +make +make install diff --git a/sources.lst b/sources.lst new file mode 100644 index 0000000..cd541d2 --- /dev/null +++ b/sources.lst @@ -0,0 +1,3 @@ +https://www.musl-libc.org/releases/musl-1.1.19.tar.gz +http://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R56c.tgz +http://www.cs.princeton.edu/~bwk/btl.mirror/awk.tar.gz |
