prepareBootImage() { dd if=/dev/zero bs=1k count=$BOOTDISKSIZE of=/$MBD_TMPIMAGE 2>/dev/null mount -o loop -t msdos $MBD_TMPIMAGE $MBD_BOOTTREE (cd $BOOTDISKDIR; find . ! -name "*.msg" -maxdepth 1 ! -type d | cpio --quiet -p $MBD_BOOTTREE) cp $MBD_FSIMAGE $MBD_BOOTTREE/initrd.img cp $KERNELROOT/boot/vmlinuz-* $MBD_BOOTTREE/vmlinuz if [ -d $BOOTDISKDIR/$BOOTLANG ]; then # fb console and kon don't get along... for file in $BOOTDISKDIR/$BOOTLANG/*.msg; do filename=`basename $file` sed -e "s/@VERSION@/$VERSION/g" $file > $MBD_BOOTTREE/$filename done if [ $? != 0 ]; then echo $0: Failed to copy messages from $BOOTDISKDIR/$BOOTLANG to $MBD_BOOTTREE. umount $MBD_BOOTTREE rm -rf $MBD_BOOTTREE $MBD_TMPIMAGE exit 1 fi else for file in $BOOTDISKDIR/*.msg; do filename=`basename $file` sed -e "s/@VERSION@/$VERSION/g" $file > $MBD_BOOTTREE/$filename done if [ $? != 0 ]; then echo $0: Failed to copy messages from $BOOTDISKDIR to $MBD_BOOTTREE. umount $MBD_BOOTTREE rm -rf $MBD_BOOTTREE $MBD_TMPIMAGE exit 1 fi fi } makeS390initrd() { EXTRAINITRDPATH="" PCMCIA="" INITRDSIZE="" KEEP="" PADSIZE="" LOADERBIN="" INITRDMODULES="" MODULEBALLNAME="modules.cgz" MYLANGTABLE=$LANGTABLE MYLOADERTR=loader.tr while [ x$(echo $1 | cut -c1-2) = x"--" ]; do if [ $1 = "--initrdto" ]; then EXTRAINITRDPATH=$2 shift; shift continue elif [ $1 = "--pcmcia" ]; then PCMCIA=yes shift continue elif [ $1 = "--keep" ]; then KEEP=yes shift continue elif [ $1 = "--initrdsize" ]; then INITRDSIZE=$2 shift; shift continue elif [ $1 = "--padsize" ]; then PADSIZE=$2 shift; shift continue elif [ $1 = "--loaderbin" ]; then LOADERBIN=$2 shift; shift continue elif [ $1 = "--modules" ]; then LOADERMODULES=$2 shift; shift continue elif [ $1 = "--moduleballname" ]; then MODULEBALLNAME=$2 shift; shift continue fi echo "Unknown option passed to makeS390initrd" exit 1 done if [ -z "$LOADERBIN" ]; then echo "no loader binary specified!" >&2 exit 1 fi if [ -z "$LOADERMODULES" ]; then echo "warning: no loader modules specified!" >&2 fi if [ -z "$INITRDSIZE" ]; then echo "I don't know how big to make the initrd image!" >&2 exit 1 fi MBD_DIR=/tmp/makebootdisk.dir.$$ MBD_FSIMAGE=/tmp/makebootdisk.initrdimage.$$ MBD_MNTPOINT=/tmp/makebootdisk.mount.$$ MBD_TMPIMAGE=/tmp/makebootdisk.image.$$ MBD_BOOTTREE=/tmp/makebootdisk.tree.$$ INITBIN=init rm -rf $MBD_DIR MBD_FSIMAGE mkdir -p $MBD_DIR/modules mkdir -p $MBD_DIR/sbin mkdir -p $MBD_DIR/dev/pts mkdir -p $MBD_DIR/dev/input mkdir -p $MBD_DIR/etc mkdir -p $MBD_DIR/proc mkdir -p $MBD_DIR/tmp mkdir -p $MBD_DIR/etc/terminfo/{a,d,k,l,s,v,x} mkdir -p $MBD_DIR/var/run mkdir -p $MBD_DIR/var/state mkdir -p $MBD_DIR/var/empty/sshd mkdir -p $MBD_DIR/etc/{pam.d,security} mkdir -p $MBD_DIR/$LIBDIR/security ln -s /tmp $MBD_DIR/var/state/xkb if [ -n "$LOADERMODULES" ]; then MODSET=`expandModuleSet "$LOADERMODULES"` makemoduleball --name $MODULEBALLNAME $MBD_DIR/modules "$MODSET" fi cat > $MBD_DIR/etc/passwd << EOF root::0:0:root:/:/sbin/loader debug::0:0:debug shell:/:/bin/bash sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin EOF echo "sshd:x:74:" >> $MBD_DIR/etc/group chmod 111 $MBD_DIR/var/empty/sshd for i in pam_stack.so pam_nologin.so pam_limits.so pam_console.so \ pam_env.so pam_unix.so pam_deny.so \ pam_limits.so; do cp -f $IMGPATH/$LIBDIR/security/$i $MBD_DIR/$LIBDIR/security done for i in sshd other; do cp -f $IMGPATH/etc/pam.d/$i $MBD_DIR/etc/pam.d done cat > $MBD_DIR/etc/pam.d/login << EOF #%PAM-1.0 auth required pam_stack.so service=system-auth auth required pam_nologin.so account required pam_stack.so service=system-auth password required pam_stack.so service=system-auth session required pam_stack.so service=system-auth session optional pam_console.so EOF cat > $MBD_DIR/etc/pam.d/system-auth << EOF #%PAM-1.0 auth required pam_env.so auth sufficient pam_unix.so likeauth nullok auth required pam_deny.so account required pam_unix.so password sufficient pam_unix.so nullok use_authtok md5 shadow password required pam_deny.so session required pam_limits.so session required pam_unix.so EOF cp -f $IMGPATH/etc/security/{limits.conf,pam_env.conf} $MBD_DIR/etc/security/ cp -f $IMGPATH/usr/bin/login $MBD_DIR/sbin/login cp -f $IMGPATH/usr/sbin/sshd $MBD_DIR/sbin/sshd # set up the arch bits echo $arch > $MBD_DIR/etc/arch install -s -m 755 $LOADERBINDIR/$LOADERBIN $MBD_DIR/sbin/loader install -s -m 755 $LOADERBINDIR/shutdown $MBD_DIR/sbin/shutdown #install -s -m 755 $LOADERBINDIR/load_anaconda $MBD_DIR/sbin/loader # install -m 644 $KEYMAPS $MBD_DIR/etc/keymaps.gz # install -m 644 $FONTS $MBD_DIR/etc/fonts.cgz install -m 644 $MYLANGTABLE $MBD_DIR/etc/lang-table install -m 644 $LOADERBINDIR/$MYLOADERTR $MBD_DIR/etc/loader.tr for i in a/ansi d/dumb k/kterm l/linux s/screen v/vt100 v/vt10-nav v/vt102 x/xterm x/xterm-color; do install -m 644 $IMGPATH/usr/share/terminfo/$i $MBD_DIR/etc/terminfo/$i done makeproductfile $MBD_DIR if [ -f $LOADERBINDIR/kon.cfg ]; then mkdir -p $MBD_DIR/etc/terminfo/k install -m 644 $IMGPATH/usr/share/terminfo/k/kon $MBD_DIR/etc/terminfo/k/kon install -m 644 $LOADERBINDIR/kon.cfg $MBD_DIR/etc install -m 644 $LOADERBINDIR/minikon.fnt $MBD_DIR/etc ln -s loader $MBD_DIR/sbin/continue fi for n in insmod rmmod modprobe; do ln -s loader $MBD_DIR/sbin/$n done mkdir -p $MBD_DIR/$LIBDIR $MBD_DIR/mnt1 \ $MBD_DIR/mnt/runtime $MBD_DIR/etc/ssh $MBD_DIR/mnt/source \ $MBD_DIR/usr/$LIBDIR/gconv/ $MBD_DIR/lib $MBD_DIR/etc/xinetd.d for links in X11R6 bin sbin share; do ln -sf /mnt/runtime/usr/$links $MBD_DIR/usr/$links done cp -f $IMGPATH/usr/lib/anaconda-runtime/loader/linuxrc.s390 $MBD_DIR/linuxrc ln -s ../linuxrc $MBD_DIR/sbin/init cp -f $IMGPATH/usr/bin/bash $MBD_DIR/sbin/bash ln -sf bash $MBD_DIR/sbin/sh cp -f $IMGPATH/usr/bin/gawk $MBD_DIR/sbin/awk cp -f $IMGPATH/usr/bin/sort_save $MBD_DIR/sbin/sort cp -f $IMGPATH/usr/sbin/chroot $MBD_DIR/sbin/chroot cp -f $IMGPATH/usr/sbin/mke2fs $MBD_DIR/sbin/mke2fs cp -f $IMGPATH/usr/bin/busybox $MBD_DIR/sbin/busybox for i in cp uname tee rm ps mv more mkdir ls ln hostname head \ lsmod gzip grep dd chmod cat; do ln -sf busybox $MBD_DIR/sbin/$i done cp -f $IMGPATH/usr/X11R6/bin/xauth $MBD_DIR/sbin/xauth cp -f $IMGPATH/usr/bin/sed_save $MBD_DIR/sbin/sed cp -f $IMGPATH/usr/bin/mount $MBD_DIR/sbin/mount cp -f $IMGPATH/usr/bin/umount $MBD_DIR/sbin/umount ln -s gzip $MBD_DIR/sbin/zcat cp -f $IMGPATH/usr/bin/ldd $MBD_DIR/sbin/ldd cp -f $IMGPATH/usr/bin/strace $MBD_DIR/sbin/strace cp -f $IMGPATH/usr/bin/mknod $MBD_DIR/sbin/mknod cp -df $IMGPATH/$LIBDIR/libtermcap* $MBD_DIR/$LIBDIR/ cp -df $IMGPATH/usr/X11R6/$LIBDIR/libX11* $MBD_DIR/$LIBDIR/ cp -df $IMGPATH/usr/X11R6/$LIBDIR/libXmuu* $MBD_DIR/$LIBDIR/ cp -df $IMGPATH/usr/X11R6/$LIBDIR/libXext* $MBD_DIR/$LIBDIR/ cp -df $IMGPATH/usr/X11R6/$LIBDIR/libXt.so* $MBD_DIR/$LIBDIR/ cp -df $IMGPATH/usr/X11R6/$LIBDIR/libSM.so* $MBD_DIR/$LIBDIR/ cp -df $IMGPATH/usr/X11R6/$LIBDIR/libICE.so* $MBD_DIR/$LIBDIR/ install -m 755 $IMGPATH/usr/sbin/dasdfmt $MBD_DIR/sbin/dasdfmt install -m 755 $IMGPATH/usr/sbin/fdasd $MBD_DIR/sbin/fdasd install -m 755 $IMGPATH/usr/sbin/ldconfig $MBD_DIR/sbin/ldconfig cp -f $IMGPATH/usr/sbin/ifconfig $MBD_DIR/sbin/ifconfig cp -f $IMGPATH/usr/sbin/xinetd $MBD_DIR/sbin/xinetd cp -f $IMGPATH/usr/sbin/in.telnetd $MBD_DIR/sbin/in.telnetd cat > $MBD_DIR/etc/xinetd.d/telnet <&/dev/null echo echo -n "Generating SSH2 RSA host key: " /usr/bin/ssh-keygen -q -t rsa -f $MBD_DIR/etc/ssh/ssh_host_rsa_key \ -C '' -N '' >&/dev/null echo echo -n "Generating SSH2 DSA host key: " /usr/bin/ssh-keygen -q -t dsa -f $MBD_DIR/etc/ssh/ssh_host_dsa_key \ -C '' -N '' >&/dev/null echo pwd (cd $MBD_DIR/etc/ssh; \ chmod 600 ssh_host_key ssh_host_rsa_key ssh_host_dsa_key; \ chmod 644 ssh_host_key.pub ssh_host_rsa_key.pub ssh_host_dsa_key.pub; ) pwd cat > $MBD_DIR/etc/ssh/sshd_config < $MBD_DIR/etc/services echo "tcp 6 TCP" > $MBD_DIR/etc/protocols cp -df $IMGPATH/$LIBDIR/libpam.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libpam_misc.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libdl.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libdl-*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libnsl.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libnsl-*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libnss_compat* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libnss_dns* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libnss_files* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libutil.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libutil-*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libcrypt*so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libselinux*so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libattr*so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/usr/$LIBDIR/libwrap*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libc.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libc-*.so* $MBD_DIR/$LIBDIR if [ "$BUILDARCH" = "s390" ]; then cp -df $IMGPATH/$LIBDIR/ld.so* $MBD_DIR/lib else # (s390x) cp -df $IMGPATH/$LIBDIR/ld64.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/lib/ld64.so* $MBD_DIR/lib fi cp -df $IMGPATH/$LIBDIR/ld-*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libresolv.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libresolv-*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libvtoc*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libm.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libm-*.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/usr/$LIBDIR/libz.so* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libssl* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libext2* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libcom_err* $MBD_DIR/$LIBDIR cp -df $IMGPATH/usr/$LIBDIR/libgssapi_krb5* $MBD_DIR/usr/$LIBDIR cp -df $IMGPATH/usr/$LIBDIR/libkrb5.so* $MBD_DIR/usr/$LIBDIR cp -df $IMGPATH/usr/$LIBDIR/libk5crypto.so* $MBD_DIR/usr/$LIBDIR cp -df $IMGPATH/usr/$LIBDIR/libcom_err.so* $MBD_DIR/usr/$LIBDIR cp -df $IMGPATH/$LIBDIR/libe2p* $MBD_DIR/$LIBDIR cp -df $IMGPATH/$LIBDIR/libuuid* $MBD_DIR/$LIBDIR cat >>$MBD_DIR/etc/ld.so.conf < $MBD_DIR/etc/ramfs.img rm -f $MBD_DIR/etc/ramfs.img.big cat > $MBD_DIR/.profile < /dev/null /sbin/mke2fs -F -i 1024 -q $MBD_FSIMAGE $INITRDSIZE #> /dev/null 2>/dev /sbin/tune2fs -c0 -i0 $MBD_FSIMAGE rm -rf $MBD_MNTPOINT mkdir $MBD_MNTPOINT mount -o loop -t ext2 $MBD_FSIMAGE $MBD_MNTPOINT (cd $MBD_DIR; find . | cpio --quiet -p $MBD_MNTPOINT) left=$(df $MBD_MNTPOINT | tail +2) left=$(echo $left | awk '{print $4'}) umount $MBD_MNTPOINT mv -f $MBD_FSIMAGE $MBD_FSIMAGE.uncompressed gzip -9 < $MBD_FSIMAGE.uncompressed > $MBD_FSIMAGE rm -rf $MBD_FSIMAGE.uncompressed $MBD_DIR size=$(du $MBD_FSIMAGE | awk '{ print $1 }') echo "Wrote $MBD_BOOTTREE (${size}k compressed, ${left}k free)" rm -rf $MBD_TMPIMAGE $MBD_BOOTTREE if [ -n "$PADSIZE" ]; then padfile $MBD_FSIMAGE $PADSIZE fi if [ -n "$EXTRAINITRDPATH" ]; then mkdir -p `dirname $EXTRAINITRDPATH` cp -a $MBD_FSIMAGE $EXTRAINITRDPATH fi if [ -z "$KEEP" ]; then rm -rf $MBD_TMPIMAGE $MBD_FSIMAGE $MBD_MNTPOINT $MBD_BOOTTREE fi } if [ $BUILDARCH = "s390x" ]; then LIBDIR=lib64 else LIBDIR=lib fi IDEMODS="" SCSIMODS="" SECSTAGE="$IDEMODS $SCSIMODS md raid0 raid1 raid5 lvm-mod" COMMONMODULES="loop cramfs dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod tape390 isofs ext3" LOCALMODULES="$COMMONMODULES tape390 $IDEMODS $SCSIMODS" NETWORKMODULES="$COMMONMODULES nfs ctc netiucv ipv6 lcs qdio qeth" makeBootImages() { makeS390initrd --initrdto $TOPDESTPATH/images/initrd.img \ --initrdsize 20000 \ --loaderbin loader \ --modules "$NETWORKMODULES" cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img cp -v $BOOTDISKDIR/generic.prm $TOPDESTPATH/images/generic.prm cp -v $BOOTDISKDIR/generic.ins $TOPDESTPATH/generic.ins } makeSecondStage() { makemainmodules "=scsi =net $SECSTAGE" makeinstimage "netstg" "=scsi $SECSTAGE" makeinstimage "hdstg" "=net $SECSTAGE" makemainimage "stage2" "cramfs" }