From 5dfcf5a3a2de4718dccb5eef817e42ce98c78186 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 25 Jun 2012 17:45:55 +0200 Subject: initial commit --- inc/build.initramfs.sh | 36 ++++++++++++++++++++++++++++++++ inc/build.iso.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++ inc/env.setup-cpio-base.sh | 32 +++++++++++++++++++++++++++++ inc/env.setup-sqfs-base.sh | 46 +++++++++++++++++++++++++++++++++++++++++ inc/env.setup-syslinux.sh | 43 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100755 inc/build.initramfs.sh create mode 100755 inc/build.iso.sh create mode 100755 inc/env.setup-cpio-base.sh create mode 100755 inc/env.setup-sqfs-base.sh create mode 100755 inc/env.setup-syslinux.sh (limited to 'inc') diff --git a/inc/build.initramfs.sh b/inc/build.initramfs.sh new file mode 100755 index 0000000..629ded1 --- /dev/null +++ b/inc/build.initramfs.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..) +SYSLINUX=${ROOT_DIR}/share/contrib/syslinux/latest + +. ${ROOT_DIR}/config/paths.conf + +[ ! -f ${SYSLINUX}/Makefile ] && $ROOT_DIR/inc/env.setup-syslinux.sh + +[ ! -d ${ROOT_DIR}/build/sqfs-base/.setup_finished ] && $ROOT_DIR/inc/env.setup-sqfs-base.sh +[ ! -d ${ROOT_DIR}/build/cpio-base/.setup_finihsed ] && $ROOT_DIR/inc/env.setup-cpio-base.sh + + +########################################################## CREATE # SQFS ##### +cd ${ROOT_DIR}/build + rm -f tmp.sqfs + mksquashfs sqfs-base tmp.sqfs -comp xz -b 1M + mkdir cpio-base/mnt + mv -v tmp.sqfs cpio-base/mnt/openslx.sqfs +cd - + +##################################################### CREATE # INITRAMFS ##### +cd ${ROOT_DIR}/build/cpio-base + + echo -e "[build-initramfs] \t Create initramfs." + find . | cpio --quiet -H newc -o > ../initramfs-default.cpio + cd .. + gzip initramfs-default.cpio + + mv initramfs-default.cpio.gz initramfs-default + INITRAMFS_SIZE=$(stat -c %s ${ROOT_DIR}/build/initramfs-default) + +cd - > /dev/null 2>&1 + +echo -e "[build-initramfs] New initramfs created." +echo -e " Location: ${ROOT_DIR}/build/initramfs-default." diff --git a/inc/build.iso.sh b/inc/build.iso.sh new file mode 100755 index 0000000..2a0e29e --- /dev/null +++ b/inc/build.iso.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..) +SYSLINUX=${ROOT_DIR}/share/contrib/syslinux/latest + +. ${ROOT_DIR}/config/paths.conf + +[ ! -f ${SYSLINUX}/Makefile ] && $ROOT_DIR/inc/env.setup-syslinux.sh + +########################################################### CREATE # ISO ##### + +mkdir -p /tmp/openslx-iso/isolinux + +cp ${BUILDROOT_OUT_PATH}/bzImage /tmp/openslx-iso/isolinux/kernel + +cp $ROOT_DIR/build/initramfs-default /tmp/openslx-iso/isolinux/initramfs + +cp $SYSLINUX/com32/menu/menu.c32 /tmp/openslx-iso/isolinux/ +cp $SYSLINUX/com32/menu/vesamenu.c32 /tmp/openslx-iso/isolinux/ + +# exchange this for another theme +cp ${ROOT_DIR}/config/extlinux/pbs2.png /tmp/openslx-iso/isolinux/ +sed -e "s,USB,ISO," $ROOT_DIR/config/extlinux/extlinux.conf \ + > /tmp/openslx-iso/isolinux/isolinux.cfg + + +# add tools needed for menu setup and ramdisk environment +cp ${SYSLINUX}/core/isolinux.bin ${SYSLINUX}/com32/menu/vesamenu.c32 \ + ${SYSLINUX}/com32/menu/menu.c32 /tmp/openslx-iso/isolinux/ + +# create an autorun.inf file +echo -en "icon=\boot\openslx.ico,0\r\nlabel=OpenSLX PreBoot Linux\r\n" \ + > /tmp/openslx-iso/autorun.inf +cp ${ROOT_DIR}/share/files/COPYING /tmp/openslx-iso/copying.txt + + +cd ${ROOT_DIR} + +# generate the ISO image +echo -e "[make-boot-iso]\t\tGenerating the ISO image" +genisoimage -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \ + -r -J -l -boot-info-table -o ./openslx.iso -hide-list config/hide.conf \ + -abstract /tmp/openslx-iso/isolinux/info.txt -relaxed-filenames \ + -biblio /tmp/openslx-iso/isolinux/info.txt -publisher "OpenSLX GmbH" \ + -p "OpenSLX Project, http://lab.openslx.org, info@openslx.org" \ + -V "OpenSLX PreBoot Linux ISO Image" -input-charset iso8859-1 \ + -volset "PreBoot Linux of the OpenSLX Project" -joliet-long \ + -copyright /tmp/openslx-iso/copying.txt /tmp/openslx-iso/ +#2>/dev/null +echo -e "[make-boot-iso]\t\tOpenSLX PreBoot image created." + diff --git a/inc/env.setup-cpio-base.sh b/inc/env.setup-cpio-base.sh new file mode 100755 index 0000000..ce57097 --- /dev/null +++ b/inc/env.setup-cpio-base.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..) + +. ${ROOT_DIR}/config/paths.conf + +mkdir -p ${ROOT_DIR}/build/cpio-base +cd ${ROOT_DIR}/build/cpio-base + +tar xzf ${ROOT_DIR}/share/files/dev.tgz + +mkdir -p openslx/lib bin sbin + +# copy required links +for f in $(find ${ROOT_DIR}/build/sqfs-base/openslx/lib/{libc\.,ld,libuC}*); do + cp -a $f openslx/lib +done + +cp -a ${ROOT_DIR}/build/sqfs-base/openslx/bin/busybox bin + +# copy required bins +for f in $(find ${ROOT_DIR}/build/sqfs-base/openslx -lname "busybox"); do + cp -a $f bin +done + +# copy required bins +for f in $(find ${ROOT_DIR}/build/sqfs-base/openslx -lname "../bin/busybox"); do + cp -a $f sbin +done + +cp ${ROOT_DIR}/share/files/init.cpio ./init +chmod +x init diff --git a/inc/env.setup-sqfs-base.sh b/inc/env.setup-sqfs-base.sh new file mode 100755 index 0000000..df27355 --- /dev/null +++ b/inc/env.setup-sqfs-base.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..) + +. ${ROOT_DIR}/config/paths.conf + +mkdir -p ${ROOT_DIR}/build/sqfs-base +cd ${ROOT_DIR}/build/sqfs-base + +tar xf ${BUILDROOT_OUT_PATH}/rootfs.tar + +rm run + +tar xzf ${ROOT_DIR}/share/files/dev.tgz + +if [ ! -f .moved_libs ]; then + for f in $(find {lib,usr/lib} |grep "\.so\(\..*\|$\)"); do + targetdir=$(dirname $f) + if [ ! -d openslx/$targetdir ]; then + #echo "creating openslx/$targetdir" + mkdir -p openslx/$targetdir + fi + mv $f openslx/$f + done + touch .moved_libs +fi + +if [ ! -f .create_ld_links ]; then + echo "create ld-*.so links from /lib" + for f in $(ls -1 openslx/lib/ld*); do + ln -sf "../$f" "lib/$(basename $f)" + done + touch .create_ld_links +fi + + +if [ ! -f .moved_bins ]; then + for d in $(find {bin,sbin,usr/bin,usr/sbin,usr/local/bin,usr/local/sbin} -type d); do + #echo $d + mkdir -p "openslx/$d" + mv $d/* openslx/$d/ + done + touch .moved_bins +fi + +ln -sf /usr/lib/systemd/systemd init diff --git a/inc/env.setup-syslinux.sh b/inc/env.setup-syslinux.sh new file mode 100755 index 0000000..9c3989f --- /dev/null +++ b/inc/env.setup-syslinux.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..) + +. $ROOT_DIR/config/setup.conf + +if [ "$syslinux_use_testing" = "1" ]; then + SYSLINUX_URL=$syslinux_testing_url + SYSLINUX_VERSION=$syslinux_testing_version + SYSLINUX_TESTING="x" +else + SYSLINUX_URL=$syslinux_stable_url + SYSLINUX_VERSION=$syslinux_stable_version + SYSLINUX_STABLE="x" +fi + + +get_syslinux () +{ + wget -q $SYSLINUX_URL + tar xjf $SYSLINUX_VERSION.tar.bz2 + rm $SYSLINUX_VERSION.tar.bz2 + rm latest + ln -sf $SYSLINUX_VERSION/ latest +} + + +cd $ROOT_DIR/share/contrib/syslinux + +if [ "x$(readlink -e latest)" != "x" ]; then + if [ "$(basename $(readlink -e latest))" = "$SYSLINUX_VERSION" ]; then + echo -e "[setup-syslinux] \t Found up-to-date syslinux ($SYSLINUX_VERSION)" + else + echo -e "[setup-syslinux] \t Found different syslinux version ($(basename $(readlink -e latest))). Switch to $SYSLINUX_VERSION." + get_syslinux + fi +else + echo -e "[setup-syslinux] \t Install $SYSLINUX_VERSION." + get_syslinux +fi + +cd - 2>&1 > /dev/null + -- cgit v1.2.3-55-g7522