diff options
| author | Michael Neves | 2012-11-08 18:08:17 +0100 |
|---|---|---|
| committer | Michael Neves | 2012-11-08 18:08:17 +0100 |
| commit | 11ecc4883c01700d3142cec813363f7016f06ecd (patch) | |
| tree | 3935bf9b28d600423d4928755cb2f256279852e3 | |
| parent | build_core (diff) | |
| download | tm-scripts-11ecc4883c01700d3142cec813363f7016f06ecd.tar.gz tm-scripts-11ecc4883c01700d3142cec813363f7016f06ecd.tar.xz tm-scripts-11ecc4883c01700d3142cec813363f7016f06ecd.zip | |
missing ld-linux fix
| l--------- | data/stage3.1/bin/chroot | 1 | ||||
| -rwxr-xr-x | data/stage3.1/bin/ldd | 193 | ||||
| l--------- | data/stage3.1/bin/setsid | 1 | ||||
| -rwxr-xr-x | data/stage3.1/init | 3 | ||||
| -rw-r--r-- | remote/1 | 28 | ||||
| -rwxr-xr-x | remote/setup-tools.sh | 14 | ||||
| -rw-r--r-- | remote/tools/busybox/busybox.conf | 2 | ||||
| -rw-r--r-- | server/build_core.old | 64 |
8 files changed, 292 insertions, 14 deletions
diff --git a/data/stage3.1/bin/chroot b/data/stage3.1/bin/chroot new file mode 120000 index 00000000..c3fa8102 --- /dev/null +++ b/data/stage3.1/bin/chroot @@ -0,0 +1 @@ +busybox
\ No newline at end of file diff --git a/data/stage3.1/bin/ldd b/data/stage3.1/bin/ldd new file mode 100755 index 00000000..53a6d08b --- /dev/null +++ b/data/stage3.1/bin/ldd @@ -0,0 +1,193 @@ +#! /bin/bash +# Copyright (C) 1996-2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + + +# This is the `ldd' command, which lists what shared libraries are +# used by given dynamically-linked executables. It works by invoking the +# run-time dynamic linker as a command and setting the environment +# variable LD_TRACE_LOADED_OBJECTS to a non-empty value. + +# We should be able to find the translation right at the beginning. +TEXTDOMAIN=libc +TEXTDOMAINDIR=/usr/share/locale + +RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2" +warn= +bind_now= +verbose= + +while test $# -gt 0; do + case "$1" in + --vers | --versi | --versio | --version) + echo 'ldd (Ubuntu EGLIBC 2.13-20ubuntu5.2) 2.13' + printf $"Copyright (C) %s Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +" "2011" + printf $"Written by %s and %s. +" "Roland McGrath" "Ulrich Drepper" + exit 0 + ;; + --h | --he | --hel | --help) + printf $"Usage: ldd [OPTION]... FILE... + --help print this help and exit + --version print version information and exit + -d, --data-relocs process data relocations + -r, --function-relocs process data and function relocations + -u, --unused print unused direct dependencies + -v, --verbose print all information +" + printf $"For bug reporting instructions, please see: +%s. +" "<http://www.debian.org/Bugs/>" + exit 0 + ;; + -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \ + --data-rel | --data-relo | --data-reloc | --data-relocs) + warn=yes + shift + ;; + -r | --f | --fu | --fun | --func | --funct | --functi | --functio | \ + --function | --function- | --function-r | --function-re | --function-rel | \ + --function-relo | --function-reloc | --function-relocs) + warn=yes + bind_now=yes + shift + ;; + -v | --verb | --verbo | --verbos | --verbose) + verbose=yes + shift + ;; + -u | --u | --un | --unu | --unus | --unuse | --unused) + unused=yes + shift + ;; + --v | --ve | --ver) + echo >&2 $"ldd: option \`$1' is ambiguous" + exit 1 + ;; + --) # Stop option processing. + shift; break + ;; + -*) + echo >&2 'ldd:' $"unrecognized option" "\`$1'" + echo >&2 $"Try \`ldd --help' for more information." + exit 1 + ;; + *) + break + ;; + esac +done + +nonelf () +{ + # Maybe extra code for non-ELF binaries. + return 1; +} + +add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now" +add_env="$add_env LD_LIBRARY_VERSION=\$verify_out" +add_env="$add_env LD_VERBOSE=$verbose" +if test "$unused" = yes; then + add_env="$add_env LD_DEBUG=\"$LD_DEBUG${LD_DEBUG:+,}unused\"" +fi + +# The following use of cat is needed to make ldd work in SELinux +# environments where the executed program might not have permissions +# to write to the console/tty. But only bash 3.x supports the pipefail +# option, and we don't bother to handle the case for older bash versions. +if x=`set -o` && test "$x" != "${x#*pipefail}" && set -o pipefail ; then + try_trace() { + eval $add_env '"$@"' | cat + } +else + try_trace() { + eval $add_env '"$@"' + } +fi + +case $# in +0) + echo >&2 'ldd:' $"missing file arguments" + echo >&2 $"Try \`ldd --help' for more information." + exit 1 + ;; +1) + single_file=t + ;; +*) + single_file=f + ;; +esac + +result=0 +for file do + # We don't list the file name when there is only one. + test $single_file = t || echo "${file}:" + case $file in + */*) : + ;; + *) file=./$file + ;; + esac + if test ! -e "$file"; then + echo "ldd: ${file}:" $"No such file or directory" >&2 + result=1 + elif test ! -f "$file"; then + echo "ldd: ${file}:" $"not regular file" >&2 + result=1 + elif test -r "$file"; then + RTLD= + ret=1 + for rtld in ${RTLDLIST}; do + if test -x $rtld; then + verify_out=`${rtld} --verify "$file"` + ret=$? + case $ret in + [02]) RTLD=${rtld}; break;; + esac + fi + done + case $ret in + 0|2) + try_trace "$RTLD" "$file" || result=1 + ;; + 1|126) + # This can be a non-ELF binary or no binary at all. + nonelf "$file" || { + echo $" not a dynamic executable" + result=1 + } + ;; + *) + echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2 + exit 1 + ;; + esac + else + echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2 + result=1 + fi +done + +exit $result +# Local Variables: +# mode:ksh +# End: diff --git a/data/stage3.1/bin/setsid b/data/stage3.1/bin/setsid new file mode 120000 index 00000000..c3fa8102 --- /dev/null +++ b/data/stage3.1/bin/setsid @@ -0,0 +1 @@ +busybox
\ No newline at end of file diff --git a/data/stage3.1/init b/data/stage3.1/init index d25d205d..33d5b7b3 100755 --- a/data/stage3.1/init +++ b/data/stage3.1/init @@ -40,4 +40,5 @@ done #/bin/sh unset BOOT_IMAGE initrd # new style of pivoting (switch_root or run-init) -exec /sbin/switch_root -c dev/console /mnt /usr/lib/systemd/systemd +exec /sbin/switch_root -c /dev/console /mnt /usr/lib/systemd/systemd +setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' diff --git a/remote/1 b/remote/1 new file mode 100644 index 00000000..9fd65f79 --- /dev/null +++ b/remote/1 @@ -0,0 +1,28 @@ +execve("stage3.2/openslx/bin/busybox", ["stage3.2/openslx/bin/busybox", "2"], [/* 51 vars */]) = 0 +brk(0) = 0x85d0000 +access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) +mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb771a000 +access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +open("/etc/ld.so.cache", O_RDONLY) = 3 +fstat64(3, {st_mode=S_IFREG|0644, st_size=96487, ...}) = 0 +mmap2(NULL, 96487, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7702000 +close(3) = 0 +access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) +open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY) = 3 +read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\222\1\0004\0\0\0"..., 512) = 512 +fstat64(3, {st_mode=S_IFREG|0755, st_size=1568968, ...}) = 0 +mmap2(NULL, 1579544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7580000 +mmap2(0xb76fc000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17c) = 0xb76fc000 +mmap2(0xb76ff000, 10776, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb76ff000 +close(3) = 0 +mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb757f000 +set_thread_area({entry_number:-1 -> 6, base_addr:0xb757f8d0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 +mprotect(0xb76fc000, 8192, PROT_READ) = 0 +mprotect(0x80d2000, 4096, PROT_READ) = 0 +mprotect(0xb773b000, 4096, PROT_READ) = 0 +munmap(0xb7702000, 96487) = 0 +getuid32() = 1000 +write(2, "2", 12) = 1 +write(2, ": applet not found\n", 19: applet not found +) = 19 +exit_group(1) = ? diff --git a/remote/setup-tools.sh b/remote/setup-tools.sh index a345293d..e61d8903 100755 --- a/remote/setup-tools.sh +++ b/remote/setup-tools.sh @@ -79,19 +79,9 @@ copyfileswithdependencies () done # fast hack - LDLINUX=$(ldd $FILE | grep ld-linux | awk '{print $1}' |cut -c2-) + LDLINUX=$(ldd $FILE | grep ld-linux | awk '{print $1}' |cut -c2-) echo "/$LDLINUX" >> $COPYFILES_LIST - tar -cpv $(readlink "/$LDLINUX") | tar -xpv -C $INIT_DIR - case $LDLINUX in - *lib/*) - #cp -a /lib/ld-* $INIT_DIR/lib/ ;; - #tar -cpv $(readlink "/$LDLINUX") | tar -xpv -C $INIT_DIR - ;; - *lib64/*) - #cp -a /lib64/ld-* $INIT_DIR/lib64/ ;; - #tar -cpv "/lib64/ld-*" | tar -xpv -C $INIT_DIR - ;; - esac + tar -cpv $(readlink -f "/$LDLINUX") | tar -xpv -C $INIT_DIR for FILENAME in $REQUIRED_FILES do diff --git a/remote/tools/busybox/busybox.conf b/remote/tools/busybox/busybox.conf index d4a8cccf..612541c4 100644 --- a/remote/tools/busybox/busybox.conf +++ b/remote/tools/busybox/busybox.conf @@ -2,4 +2,4 @@ GIT=git://git.openslx.org/openslx/tools/busybox DEPS="" TARGET_DIR="openslx" REQUIRED_BINARIES="busybox" -REQUIRED_FILES="addgroup cp echo ip login mt rm sync adduser cpio egrep ipaddr ls mv rmdir tar ash date false iplink lsattr netstat run-parts touch dd fdflush iproute lsblk nice sed true cat delgroup fgrep iprule mkdir pidof setarch umount catv deluser getopt iptunnel mknod ping setserial uname chattr df grep kill mktemp pipe_progress sh usleep chgrp dmesg gunzip linux32 more printenv sleep vi chmod gzip mount ps linux64 stty watch chown dnsdomainname dumpkmap hostname ln mountpoint pwd su zcat [ [[ ar arping awk basename chrt chsum clear cmp crontab cut dc diff dirname dos2unix du eject env expr ether-wake fdformat find fold free fuser head hostid id install killall killall5 last less logname lsof lspci md5sum mesg microcom mkfifo nohup nslookup od passwd patch printf readlink realpath reset resize seq sha1sum sha256sum sha512sum sort strings tail tee telnet test tftp time top tr traceroute tty uniq unix2dos unzip uptime uudecode uuencode vlock wc wget which who whoami xargs yes pivot_root rtstat runlevel udhcpc insmod halt getty devmem fsck hdparm ifconfig ifdown ifup klogd loadkmap losetup lsmod makedevs mdev modprobe nameif rmmod route setconsole start-stop-daemon sulogin swapoff swapon switch_root sysctl syslogd vconfig watchdog loadfont rdate setlogcons chroot crond dnsd inetd dnbd3" +REQUIRED_FILES="setsid addgroup cp echo ip login mt rm sync adduser cpio egrep ipaddr ls mv rmdir tar ash date false iplink lsattr netstat run-parts touch dd fdflush iproute lsblk nice sed true cat delgroup fgrep iprule mkdir pidof setarch umount catv deluser getopt iptunnel mknod ping setserial uname chattr df grep kill mktemp pipe_progress sh usleep chgrp dmesg gunzip linux32 more printenv sleep vi chmod gzip mount ps linux64 stty watch chown dnsdomainname dumpkmap hostname ln mountpoint pwd su zcat [ [[ ar arping awk basename chrt chsum clear cmp crontab cut dc diff dirname dos2unix du eject env expr ether-wake fdformat find fold free fuser head hostid id install killall killall5 last less logname lsof lspci md5sum mesg microcom mkfifo nohup nslookup od passwd patch printf readlink realpath reset resize seq sha1sum sha256sum sha512sum sort strings tail tee telnet test tftp time top tr traceroute tty uniq unix2dos unzip uptime uudecode uuencode vlock wc wget which who whoami xargs yes pivot_root rtstat runlevel udhcpc insmod halt getty devmem fsck hdparm ifconfig ifdown ifup klogd loadkmap losetup lsmod makedevs mdev modprobe nameif rmmod route setconsole start-stop-daemon sulogin swapoff swapon switch_root sysctl syslogd vconfig watchdog loadfont rdate setlogcons chroot crond dnsd inetd dnbd3" diff --git a/server/build_core.old b/server/build_core.old new file mode 100644 index 00000000..e761eb2e --- /dev/null +++ b/server/build_core.old @@ -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) + + |
