From 43cba2c7a738ec0ffa6dcce9539dacc2f507219b Mon Sep 17 00:00:00 2001 From: Dirk Date: Thu, 27 Sep 2012 17:01:34 +0200 Subject: New build_core script for creating the initial ramfs from different sources. --- server/build_core | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ server/mkinitramfs | 27 ----------------------- 2 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 server/build_core delete mode 100644 server/mkinitramfs diff --git a/server/build_core b/server/build_core new file mode 100644 index 00000000..e761eb2e --- /dev/null +++ b/server/build_core @@ -0,0 +1,64 @@ +#!/bin/bash +# Copyright (c) 2012 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# +# Server side script to generate stage3.1,2 initial ramfses for OpenSLX Linux +# stateless clients +############################################################################# + +# first parameter is a hash pointing to the target directory +# /srv/openslx/build + +# in the future the prefix should be set via slxsettings ... +SLXPREFIX=/srv/openslx +IRTARGET=${SLXPREFIX}/build/$1 + +# add openslx distro (in)dependent data to the initramfs target +DISTRONAME=ubuntu +DISTROVER=12.04 + +for content in ${SLXPREFIX}/core/base + ${SLXPREFIX}/core/${DISTRONAME}/base + ${SLXPREFIX}/core/${DISTRONAME}/${DISTROVER} ; do + cp -a $content ${IRTARGET} +done + +# add kernel stuff to the initramfs target +KERNELVER= +mkdir -p ${IRTARGET}/lib/modules +cp -a ${SLXPREFIX}/kernel/${KERNELVER}/modules \ + ${IRTARGET}/lib/modules/${KERNELVER} + +# produce stage3.1 +mkdir -p ${IRTARGET}/stage3.1 + +# create the base directory structure for stage3.1 +mkdir -p ${IRTARGET}/stage3.1/{bin,dev,proc,run,lib,etc,mnt,sys} +cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ + ${IRTARGET}/stage3.1/dev +cp ${IRTARGET}/openslx/bin/busybox ${IRTARGET}/stage3.1/bin + +# link the required busybox applets for stage3.1 +for app in insmod modprobe mount mkdir umount sh switch_root ; do + ln -s /bin/busybox ${IRTARGET}/stage3.1/bin/${app} +done + +# add the static stuff for stage3.1 +cp -a ${SLXPREFIX}/core/stage3.1 ${IRTARGET}/stage3.1 + +# finalize the initramfs target +which mksquashfs 2>&1>/dev/null || { echo "Please install SquashFS utilities" ; exit 1 } + +mksquashfs -ef ${IRTARGET}/stage3.1 ${IRTARGET} \ + ${IRTARGET}/stage3.1/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null + +(cd ${IRTARGET}/stage3.1; find . | cpio --format="newc" --create | gzip -9 > ${IRTARGET}/initramfs) + + diff --git a/server/mkinitramfs b/server/mkinitramfs deleted file mode 100644 index df6174cf..00000000 --- a/server/mkinitramfs +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright (c) 2012 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your feedback to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org -# -# Server side script to generate stage3.1,2 initial ramfses for OpenSLX Linux -# stateless clients -############################################################################# - -# fetch stage 3.1/2 stuff from the template system to the initramfs target - -# add openslx distro independent data to the initramfs target - -# add kernel stuff to the initramfs target - -# finalize the initramfs target -which mksquashfs 2>&1>/dev/null || { echo "Please install SquashFS utilities" ; exit 1 } -mksquashfs target/stage3.2/* target/stage3.1/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null -(cd target/stage3.1; find . | cpio --format="newc" --create | gzip -9 > /srv/openslx/tftpboot/initramfs-test) - - -- cgit v1.2.3-55-g7522