diff options
| author | Jonathan Bauer | 2013-03-11 17:32:55 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2013-03-11 17:32:55 +0100 |
| commit | 5bc5e9815fbeb08038fa08ab28f28a29f90e077d (patch) | |
| tree | 38a5937af57aa55078453a16593b41af1495f256 | |
| parent | old files (diff) | |
| download | tm-scripts-5bc5e9815fbeb08038fa08ab28f28a29f90e077d.tar.gz tm-scripts-5bc5e9815fbeb08038fa08ab28f28a29f90e077d.tar.xz tm-scripts-5bc5e9815fbeb08038fa08ab28f28a29f90e077d.zip | |
mltk now uses setup_core
| -rwxr-xr-x | mltk | 7 | ||||
| -rwxr-xr-x | remote/setup_core | 116 | ||||
| -rwxr-xr-x | remote/setup_tools | 2 | ||||
| -rw-r--r-- | remote/tools/base/base.build | 2 | ||||
| -rw-r--r-- | remote/tools/base/base.conf | 4 |
5 files changed, 79 insertions, 52 deletions
@@ -31,6 +31,7 @@ qnd_exit() { . "${ROOT_DIR}/helper/downloader.inc" . "${ROOT_DIR}/helper/fileutil.inc" . "${ROOT_DIR}/helper/binutil.inc" +. "${ROOT_DIR}/helper/system.inc" pinfo "System's packet manager is $PACKET_MANAGER" @@ -84,10 +85,10 @@ initial_checks() { fi # setup_tools and build_core - BUILD_CORE="${ROOT_DIR}/server/build_core" + SETUP_CORE="${ROOT_DIR}/remote/setup_core" SETUP_TOOLS="${ROOT_DIR}/remote/setup_tools" - [ ! -e "${BUILD_CORE}" ] && perror "Missing script build_core, re-clone. Exiting." + [ ! -e "${SETUP_CORE}" ] && perror "Missing script build_core, re-clone. Exiting." [ ! -e "${SETUP_TOOLS}" ] && perror "Missing script setup_tools, re-clone. Exiting." } @@ -177,7 +178,7 @@ run() { if [[ $CORE_CLEAN == 1 || $CORE_BUILD == 1 ]]; then [[ $CORE_DEBUG == 1 ]] && unset_quiet || set_quiet local TOOL_STR="[CORE]" - . "${BUILD_CORE}" || perror "Cannot source ${BUILD_CORE}" + . "${SETUP_CORE}" || perror "Cannot source ${SETUP_CORE}" [[ $CORE_CLEAN == 1 ]] && clean_core [[ $CORE_BUILD == 1 ]] && generate_stage31 fi diff --git a/remote/setup_core b/remote/setup_core index 6888bc07..4f809968 100755 --- a/remote/setup_core +++ b/remote/setup_core @@ -1,33 +1,38 @@ #!/bin/bash - -ROOT_DIR="/home/joe/work/tm-scripts" +# ----------------------------------------------------------------------------- +# +# Copyright (c) 2013 - 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 suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# +# +# Script to create the stage3.1 root file system: +# - generate the rootfs directory structure and copy system devices +# - copies kernel modules and firmware as given in the config +# file (core/core.conf) to be able to load NIC/GFX modules early. +# - compile and include following tools: 'busybox' and 'hwinfo' +# MODULE_DIR="${ROOT_DIR}/remote" STAGE31_DIR="${MODULE_DIR}/stage3.1" -MODULE_LIST="${MODULE_DIR}/core/stage31.modules" -FIRMWARE_LIST="${MODULE_DIR}/core/stage31.firmware" - - -. "${ROOT_DIR}/helper/logging.inc" -. "${ROOT_DIR}/helper/string.inc" -. "${ROOT_DIR}/helper/fileutil.inc" -. "${ROOT_DIR}/helper/system.inc" -. "${ROOT_DIR}/helper/binutil.inc" - initial_checks() { [ ! -z "${KERNEL_VERSION}" ] || perror "No kernel version, cannot proceed." [ ! -z "${ARCH_TRIPLET}" ] || perror "No arch triplet, cannot proceed." - [ -f "${MODULE_LIST}" ] || perror "No list for stage3.1 kernel modules found." - [ -f "${FIRMWARE_LIST}" ] || perror "No list for stage3.1 firmware found." - - [ -d "${STAGE31_DIR}" ] || mkdir -p "${STAGE31_DIR}" [ ! -z "$(which depmod)" ] || perror "No 'depmod' found on this systemd." - [ -d ""${MODULE_DIR}"/tools/busybox/build" ] || perror "No busybox found. Build it first." + [ -d "${MODULE_DIR}"/tools/busybox/build ] \ + || perror "No busybox found, build it with './mltk tools -b busybox'" } read_config() { @@ -36,6 +41,25 @@ read_config() { . "${CORE_CONFIG}" || perror "Sourcing "${MODULE_DIR}"/core/core.conf failed." } +generate_rootfs() { + # create basic directory structure + mkdir -p "${STAGE31_DIR}"/{bin,dev,proc,run,etc,mnt,sys} \ + || perror "Cannot create basic directory structure in '${STAGE31_DIR}'" + + # copy device files from running system + cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ + "${STAGE31_DIR}"/dev || perror "Cannot copy devices from running system" + + # copy libc and ld-linux + tarcopy "$(list_basic_libs)" "${STAGE31_DIR}" + + # copy required files + tarcopy "${REQUIRED_FILES}" "${STAGE31_DIR}" + + # copy static data + cp -r "${MODULE_DIR}"/core/data/* "${STAGE31_DIR}" +} + copy_kernel_modules() { local MODLIST="stage31_modules_list" @@ -64,7 +88,7 @@ copy_kernel_modules() { generate_modules_map_files() { # first strip modules.order of all the modules we don't use - cat /lib/modules/"${KERNEL_VERSION}"/modules.order | grep -E $(tr '\n' '|' < $MODULE_LIST) \ + cat /lib/modules/"${KERNEL_VERSION}"/modules.order | grep -E $(echo ${REQUIRED_MODULES} | tr '\ ' '|') \ >> "${STAGE31_DIR}"/lib/modules/"${KERNEL_VERSION}"/modules.order # copy list of builtin kernel modules @@ -73,7 +97,6 @@ generate_modules_map_files() { depmod -b "${STAGE31_DIR}" } - copy_firmware() { local FWLIST="stage31_firmware_list" @@ -82,7 +105,6 @@ copy_firmware() { local FW_PATH="/lib/firmware" # process firmware list - pinfo "Copying firmware from system..." for FW in ${REQUIRED_FIRMWARE}; do local FOUND=0 if [ -e "${FW_PATH}"/"${FW}" ]; then @@ -105,26 +127,10 @@ copy_firmware() { fi } -generate_rootfs() { - # create basic directory structure - mkdir -p "${STAGE31_DIR}"/{bin,dev,proc,run,etc,mnt,sys} || perror "Cannot create basic directory structure in '${STAGE31_DIR}'" - - # copy device files from running system - cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ - "${STAGE31_DIR}"/dev || perror "Cannot copy devices from running system" - - # copy libc and ld-linux - tarcopy "$(list_basic_libs)" "${STAGE31_DIR}" - # copy required files - tarcopy "${REQUIRED_FILES}" "${STAGE31_DIR}" - - # copy static data - cp -r "${MODULE_DIR}"/core/data/* "${STAGE31_DIR}" -} - -get_basic_tools() { +install_basic_tools() { # get busybox from tools/ we checked earlier if its there. + pinfo "Copying busybox to ${STAGE31_DIR}." cp -r "${MODULE_DIR}"/tools/busybox/build/openslx/* "${STAGE31_DIR}" # get hwinfo and the required libx86emu @@ -132,18 +138,23 @@ get_basic_tools() { cd "${MODULE_DIR}"/core/src # start with libx86emu + pinfo "Cloning 'git://gitorious.org/x86emu/libx86emu.git'..." git clone git://gitorious.org/x86emu/libx86emu.git cd libx86emu - make || perror "[libx86emu] make failed." - #make install || perror "[libx86emu] make install to system failed." - DESTDIR="${MODULE_DIR}"/core/build make install || perror "[libx86emu] make install to "${STAGE31_DIR}" failed." + pinfo "Compiling 'libx86emu'..." + make || perror "libx86emu: make failed." + pinfo "Installing 'libx86emu' in ${MODULE_DIR}/core/build" + DESTDIR="${MODULE_DIR}"/core/build make install || perror "libx86emu: make install to "${STAGE31_DIR}" failed." cd - &> /dev/null # now hwinfo + pinfo "Cloning 'git://gitorious.org/opensuse/hwinfo.git'..." git clone git://gitorious.org/opensuse/hwinfo.git cd hwinfo - make || perror "[hwinfo] make failed." - DESTDIR="${MODULE_DIR}"/core/build make install || perror "[hwinfo] make install failed." + pinfo "Compiling 'hwinfo'..." + make || perror "hwinfo: make failed." + pinfo "Installing 'hwinfo' in ${MODULE_DIR}/core/build" + DESTDIR="${MODULE_DIR}"/core/build make install || perror "hwinfo: make install failed." cd - &> /dev/null # get dependencies of hwinfo @@ -157,14 +168,29 @@ get_basic_tools() { generate_stage31() { + local TOOL_STR="[core]" + pinfo "Generating stage 3.1 file system..." cd "${MODULE_DIR}"/core initial_checks read_config + generate_rootfs copy_kernel_modules generate_modules_map_files copy_firmware - generate_rootfs - get_basic_tools + install_basic_tools cd - &> /dev/null } + +clean_core() { + pinfo "Cleaning '${STAGE31_DIR}'..." + [ -d ${STAGE31_DIR} ] && { rm -rf ${STAGE31_DIR} || perror "rm -rf failed."; } + pinfo "Cleaning '${MODULE_DIR}/core'..." + [ -e ${MODULE_DIR}/core/stage31_modules_list ] && { rm -f ${MODULE_DIR}/core/stage31_modules_list || perror "rm -f failed."; } + [ -e ${MODULE_DIR}/core/stage31_firmware_list ] && { rm -f ${MODULE_DIR}/core/stage31_firmware_list || perror "rm -f failed."; } + pinfo "Cleaning '${MODULE_DIR}/core/build'..." + [ -e ${MODULE_DIR}/core/build ] && { rm -rf ${MODULE_DIR}/core/build || perror "rm -rf failed."; } + pinfo "Cleaning '${MODULE_DIR}/core/src'..." + [ -e ${MODULE_DIR}/core/src ] && { rm -rf ${MODULE_DIR}/core/src || perror "rm -rf failed."; } + +} diff --git a/remote/setup_tools b/remote/setup_tools index fdc2da40..63fa3f09 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -226,7 +226,7 @@ clean_tools() { clean_tool() { TOOLDIR=${TOOL_DIR}/$1 - pinfo "Cleaning ${TOOLDIR}..." + pinfo "Cleaning '${TOOLDIR}'..." #[ -e ${TOOLDIR}/build/list_wanted_stage3.2 ] && cd ${INIT_DIR} \ # && xargs rm < ${TOOLDIR}/build/list_wanted_stage3.2 #[ -d ${TOOLDIR}/data ] && cd ${INIT_DIR} \ diff --git a/remote/tools/base/base.build b/remote/tools/base/base.build index afa82662..e75f8537 100644 --- a/remote/tools/base/base.build +++ b/remote/tools/base/base.build @@ -65,7 +65,7 @@ post_copy() { cp -r "${TOOL_DIR}/${TOOL}"/data/* "${INIT_DIR}" || perror "Copying static files from data/* failed." # copy pam modules - tarcopy "$(dirname $(ldd $SHELL|grep libc | awk -F " " '{print $3}'))"/security "${INIT_DIR}" + tarcopy "/lib/${ARCH_TRIPLET}/security /lib/security" "${INIT_DIR}" # quick fix for /etc/fstab echo "# no configuration" >> "${INIT_DIR}/etc/fstab" diff --git a/remote/tools/base/base.conf b/remote/tools/base/base.conf index 6ad7d0e0..29519edb 100644 --- a/remote/tools/base/base.conf +++ b/remote/tools/base/base.conf @@ -17,7 +17,6 @@ REQUIRED_BINARIES=" bash strace blkid modprobe - rsyslogd ps scp ssh" @@ -53,4 +52,5 @@ REQUIRED_FILES=" /etc/environment /etc/protocols /etc/services /etc/networks - /etc/netconfig" + /etc/netconfig + /etc/modprobe.d/blacklist.conf" |
