diff options
-rw-r--r-- | base-system-x86_32-generic.morph | 2 | ||||
-rw-r--r-- | build-essential.morph | 19 | ||||
-rw-r--r-- | busybox-init.configure | 145 | ||||
-rw-r--r-- | minimal-system-deploy.morph | 14 | ||||
-rw-r--r-- | minimal-system-x86_32-generic.morph | 19 | ||||
-rw-r--r-- | minimal-system-x86_64-generic.morph | 19 |
6 files changed, 214 insertions, 4 deletions
diff --git a/base-system-x86_32-generic.morph b/base-system-x86_32-generic.morph index a1eff551..e53b2d97 100644 --- a/base-system-x86_32-generic.morph +++ b/base-system-x86_32-generic.morph @@ -5,7 +5,7 @@ configuration-extensions: - simple-network - nfsboot - install-files -description: The set of strata required to have a minimal system for a 32-bit x86 +description: The set of strata required to have a basic system for a 32-bit x86 system. kind: system name: base-system-x86_32-generic diff --git a/build-essential.morph b/build-essential.morph index c6e7ba2c..b5a92359 100644 --- a/build-essential.morph +++ b/build-essential.morph @@ -31,6 +31,11 @@ description: | stage2-fhs-dirs.morph for details. Basically, /bin is a symlink to /tools/bin during stage 2 but in stage 3 it becomes a real directory again. +products: +- artifact: build-essential-minimal + include: + - fhs-dirs-.* + - busybox-.* chunks: - name: stage1-binutils repo: upstream:binutils-redhat @@ -179,7 +184,7 @@ chunks: prefix: /usr - name: eglibc repo: upstream:eglibc2 - ref: 43ee5d250ad47d2bee8ec17954efb7f22d2b804c + ref: baserock/richardmaw/S10786-finer-splitting-v2 unpetrify-ref: baserock/2.15-build-essential build-depends: - stage2-binutils @@ -193,10 +198,14 @@ chunks: - stage2-reset-specs - linux-api-headers build-mode: staging + artifacts: + eglibc-gconv: build-essential-runtime + eglibc-libs: build-essential-minimal + eglibc-nss: build-essential-runtime prefix: /usr - name: zlib repo: upstream:zlib - ref: db3aed6856d7a23186844fdf93105cad2fcf2f2f + ref: baserock/richardmaw/S10786-finer-splitting unpetrify-ref: baserock/build-essential build-depends: - stage2-binutils @@ -210,6 +219,8 @@ chunks: - stage2-reset-specs - eglibc build-mode: staging + artifacts: + zlib-libs: build-essential-minimal prefix: /usr - name: binutils repo: upstream:binutils-redhat @@ -265,7 +276,7 @@ chunks: prefix: /usr - name: gcc repo: upstream:gcc-tarball - ref: dd78b627480ed8d3c135271cd627096ae76fa5fc + ref: baserock/richardmaw/S10786-finer-splitting unpetrify-ref: baserock/build-essential build-depends: - stage2-binutils @@ -280,6 +291,8 @@ chunks: - eglibc - zlib build-mode: staging + artifacts: + gcc-libs: build-essential-minimal prefix: /usr - name: make repo: upstream:make diff --git a/busybox-init.configure b/busybox-init.configure new file mode 100644 index 00000000..c7dba3b9 --- /dev/null +++ b/busybox-init.configure @@ -0,0 +1,145 @@ +#!/bin/sh +# +# Copyright (C) 2014 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# This is a "morph deploy" configuration extension to configure a system +# to use busybox for its init, if INIT_SYSTEM=busybox is specified. +# +# As well as checking INIT_SYSTEM, the following variables are used. +# +# Getty configuration: +# * CONSOLE_DEVICE: Which device to spawn a getty on (default: ttyS0) +# * CONSOLE_BAUDRATE: Baud rate of the console (default: 115200) +# * CONSOLE_MODE: What kind of terminal this console emulates +# (default: vt100) + +if [ "$INIT_SYSTEM" != busybox ]; then + echo Not configuring system to use busybox init. + exit 0 +fi + +set -e +echo Configuring system to use busybox init + +RUN_SCRIPT=/etc/rcS +INIT_SCRIPT=/sbin/init + +install_mdev_config(){ + install -D -m644 /dev/stdin "$1" <<'EOF' +# support module loading on hotplug +$MODALIAS=.* root:root 660 @modprobe "$MODALIAS" + +# null may already exist; therefore ownership has to be changed with command +null root:root 666 @chmod 666 $MDEV +zero root:root 666 +full root:root 666 +random root:root 444 +urandom root:root 444 +hwrandom root:root 444 +grsec root:root 660 + +kmem root:root 640 +mem root:root 640 +port root:root 640 +# console may already exist; therefore ownership has to be changed with command +console root:root 600 @chmod 600 $MDEV +ptmx root:root 666 +pty.* root:root 660 + +# Typical devices + +tty root:root 666 +tty[0-9]* root:root 660 +vcsa*[0-9]* root:root 660 +ttyS[0-9]* root:root 660 + +# block devices +ram[0-9]* root:root 660 +loop[0-9]+ root:root 660 +sd[a-z].* root:root 660 +hd[a-z][0-9]* root:root 660 +md[0-9]* root:root 660 +sr[0-9]* root:root 660 @ln -sf $MDEV cdrom +fd[0-9]* root:root 660 + +# net devices +SUBSYSTEM=net;.* root:root 600 @nameif +tun[0-9]* root:root 600 =net/ +tap[0-9]* root:root 600 =net/ +EOF +} + +install_start_script(){ + install -D -m755 /dev/stdin "$1" <<'EOF' +#!/bin/sh +mount -t devtmpfs devtmpfs /dev +mount -t proc proc /proc +mount -t sysfs sysfs /sys +mkdir -p /dev/pts +mount -t devpts devpts /dev/pts + +echo /sbin/mdev >/proc/sys/kernel/hotplug +mdev -s + +hostname -F /etc/hostname + +run-parts -a start /etc/init.d +EOF +} + +install_inittab(){ + local inittab="$1" + local dev="$2" + local baud="$3" + local mode="$4" + install -D -m644 /dev/stdin "$1" <<EOF +::sysinit:$RUN_SCRIPT + +::askfirst:-/bin/cttyhack /bin/sh +::askfirst:/sbin/getty -L $dev $baud $mode + +::ctrlaltdel:/sbin/reboot +::shutdown:/sbin/swapoff -a +::shutdown:/bin/umount -a -r +::restart:/sbin/init +EOF +} + +install_init_symlink(){ + local initdir="$(dirname "$1")" + local initname="$(basename "$1")" + mkdir -p "$initdir" + cd "$initdir" + for busybox_dir in . ../bin ../sbin ../usr/bin ../usr/sbin; do + local busybox="$busybox_dir/busybox" + if [ ! -x "$busybox" ]; then + continue + fi + ln -sf "$busybox" "$initname" + return 0 + done + echo Unable to find busybox >&2 + exit 1 +} + +install_mdev_config "$1/etc/mdev.conf" + +install_start_script "$1$RUN_SCRIPT" + +install_inittab "$1/etc/inittab" "${CONSOLE_DEV-ttyS0}" \ + "${CONSOLE_BAUD-115200}" "${CONSOLE_MODE-vt100}" + +install_init_symlink "$1$INIT_SCRIPT" diff --git a/minimal-system-deploy.morph b/minimal-system-deploy.morph new file mode 100644 index 00000000..f6213c39 --- /dev/null +++ b/minimal-system-deploy.morph @@ -0,0 +1,14 @@ +name: minimal-system-deploy +kind: cluster +description: | + Deploy a minimal system to a system running KVM +systems: +- morph: minimal-system-x86_32-generic + deploy: + vm: + type: kvm + location: kvm+ssh://192.168.122.1/tiny-x86_32/srv/VMs/tiny-x86_32.img + HOSTNAME: tiny-x86_32 + DISK_SIZE: 512M + RAM_SIZE: 512M + INIT_SYSTEM: busybox diff --git a/minimal-system-x86_32-generic.morph b/minimal-system-x86_32-generic.morph new file mode 100644 index 00000000..b9e9b9e9 --- /dev/null +++ b/minimal-system-x86_32-generic.morph @@ -0,0 +1,19 @@ +arch: x86_32 +configuration-extensions: +- set-hostname +- simple-network +- nfsboot +- install-files +- busybox-init +description: The set of strata required to have a minimal system for a 32-bit x86 + system. +kind: system +name: minimal-system-x86_32-generic +strata: +- morph: build-essential + artifacts: + - build-essential-minimal +- morph: bsp-x86_32-generic + # Don't include kernel headers in the system + artifacts: + - bsp-x86_32-generic-runtime diff --git a/minimal-system-x86_64-generic.morph b/minimal-system-x86_64-generic.morph new file mode 100644 index 00000000..9ead85e8 --- /dev/null +++ b/minimal-system-x86_64-generic.morph @@ -0,0 +1,19 @@ +arch: x86_64 +configuration-extensions: +- set-hostname +- simple-network +- nfsboot +- install-files +- busybox-init +description: The set of strata required to have a minimal system for a 64-bit x86 + system. +kind: system +name: minimal-system-x86_64-generic +strata: +- morph: build-essential + artifacts: + - build-essential-minimal +- morph: bsp-x86_64-generic + # Don't include kernel headers in the system + artifacts: + - bsp-x86_64-generic-runtime |