diff options
author | Jonathan Bauer | 2012-12-13 14:49:20 +0100 |
---|---|---|
committer | Jonathan Bauer | 2012-12-13 14:49:20 +0100 |
commit | e466e0812ec5b0504d8dc77328b906e1e2516053 (patch) | |
tree | ad6369489e4dc5ccfe56ebc546def7be20384984 /server | |
parent | plymouth usr/ prefix fix, systemd conditional adding of repository, and minor... (diff) | |
download | tm-scripts-e466e0812ec5b0504d8dc77328b906e1e2516053.tar.gz tm-scripts-e466e0812ec5b0504d8dc77328b906e1e2516053.tar.xz tm-scripts-e466e0812ec5b0504d8dc77328b906e1e2516053.zip |
generation of stage 3.1 (init is under data/stage3.1
Diffstat (limited to 'server')
-rwxr-xr-x | server/build_core | 76 |
1 files changed, 47 insertions, 29 deletions
diff --git a/server/build_core b/server/build_core index e1f1e7d1..e1bc4611 100755 --- a/server/build_core +++ b/server/build_core @@ -21,48 +21,66 @@ ROOT_DIR=$(dirname $(readlink -f $0)) SELF=$(readlink -f $0) -if [ "x$(whoami)" != "xroot" ]; then - echo "ERROR: You need to have root rights to install packages." - exit 1 -fi - -# add openslx distro (in)dependent data to the initramfs target -DISTRONAME=ubuntu -DISTROVER=12.04 - +STAGE31_STATIC_DIR=${ROOT_DIR}/../data/stage3.1 STAGE31_DIR=${ROOT_DIR}/stage3.1 STAGE32_DIR=${ROOT_DIR}/../remote/stage3.2 -# produce stage3.1 -#mkdir -p ${STAGE31_DIR} - -#Copy Busybox to Stage3.1 -#[ ! -e ${STAGE32_DIR/openslx/bin/busybox} ] && echo "Busybox not found under stage3.2/openslx. Please run setup_tools first." && return +# initial checks +if [ "x$(whoami)" != "xroot" ]; then + echo "ERROR: You need to have root rights to install packages." + exit 1 +fi -#cp ${STAGE32_DIR}/openslx/bin/busybox ${STAGE31_DIR}/bin +if [ ! -d ${STAGE32_DIR} ]; +then + echo "No stage3.2 directory found. Please run setup_tools first." + exit 1 +fi -# 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 +if [ ! -e ${STAGE32_DIR}/openslx/bin/busybox ]; +then + echo "Busybox not found, run setup_tools first." + exit 1 +fi -# copy stage3.1 base from data directory -[ ! -d ${ROOT_DIR}/../data/stage3.1 ] && echo "No stage3.1 directory found." && exit 1 -cp -a ${ROOT_DIR}/../data/stage3.1 ${ROOT_DIR} +if [ -z $(which mksquashfs) ]; +then + echo "mksquashfs not found, please install squashfs-tools first." + exit 1 +fi -# create the base directory structure for stage3.2 -#mkdir -p ${STAGE32_DIR}/{bin,dev,proc,run/shm,lib,etc,mnt,sys,var,var/lock,var/run,run,} -#cp -a /dev/{console,kmsg,mem,null,shm,tty,tty0,tty1,tty9,fb0,urandom,zero} \ -# ${STAGE32_DIR}/dev +# produce stage3.1 +[ ! -d ${STAGE31_DIR} ] && mkdir -p ${STAGE31_DIR} + +# create basic directory structure +mkdir -p ${STAGE31_DIR}/{bin,dev,proc,run,lib,etc,mnt,sys} + +# copy device files from running system +cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ + ${STAGE31_DIR}/dev + +# copy busybox, its libs and static data to stage3.1 +cp -r ${STAGE32_DIR}/openslx/* ${STAGE31_STATIC_DIR}/* ${STAGE31_DIR} + +# fetch the libraries needed for busybox +BASICLIBS="" +for i in $(ldd ${STAGE31_DIR}/bin/busybox); +do + if [ $(echo $i | grep '^/' | grep -c ld) -eq 1 \ + -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ]; + then + echo $i + BASICLIBS="$BASICLIBS $i $(readlink -f "$i")" + fi +done +tar cpv $BASICLIBS | tar xpv -C ${STAGE31_DIR} &>/dev/null # finalize the initramfs target -which mksquashfs 2>&1>/dev/null || echo "Please install SquashFS utilities" - [ ! -d ${STAGE32_DIR} ] && echo "No stage3.2 directory found. Please run setup_tools first." && exit 1 - [ -e ${STAGE31_DIR}/mnt/openslx.sqfs ] && rm ${STAGE31_DIR}/mnt/openslx.sqfs mksquashfs ${STAGE32_DIR} ${STAGE31_DIR}/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null cd ${STAGE31_DIR} find . | cpio --format="newc" --create | gzip -9 > ${ROOT_DIR}/initramfs +cd - &>/dev/null |