# Root of the isofs
isofs=$PWD/build/isofs
-# Build reference image if it does not exist. This should only need to
-# be executed once at build time, never at run time.
-if [ ! -f $isofs/bootcd.img ] ; then
- ./prep.sh
+# The reference image is expected to have been built by prep.sh (see .spec)
+# we disable the initial logic that called prep.sh if that was not the case
+# this is because prep.sh needs to know pldistro
+if [ ! -f $isofs/bootcd.img -o ! -f build/version.txt ] ; then
+ echo "you have to run prep.sh prior to calling $0 - exiting"
+ exit 1
fi
# build/version.txt written by prep.sh
echo "* Building images for $FULL_VERSION_STRING"
-# From within a myplc chroot /tmp is too small to build
-# all possible images, whereas /data is part of the host
+# From within a myplc chroot /usr/tmp is too small
+# to build all possible images, whereas /data is part of the host
# filesystem and usually has sufficient space. What we
# should do is check whether the expected amount of space
# is available.
-[ -d /data ] && BUILDTMP=/data || BUILDTMP=/tmp
+BUILDTMP=/usr/tmp
+if [ -d /data ] ; then
+ isreadonly=$(mktemp /data/isreadonly.XXXXXX || /bin/true)
+ if [ -n "$isreadonly" ] ; then
+ rm -f "$isreadonly"
+ BUILDTMP=/data
+ fi
+fi
# Root of the ISO and USB images
echo "* Populating root filesystem..."
# update etc/inittab to start with pl_rsysinit
sed -i 's,pl_sysinit,pl_rsysinit,' etc/inittab
+# modify inittab to have a serial console
+echo "T0:23:respawn:/sbin/agetty -L ttyS0 9600 vt100" >> etc/inittab
+# and let root log in
+echo "ttyS0" >> etc/securetty
+
#calculate the size of /tmp based on the size of /etc & /var + 8MB slack
etcsize=$(du -s ./etc | awk '{ print $1 }')
varsize=$(du -s ./etc | awk '{ print $1 }')
let msize=($vsize+$esize+8192)/1024
+
# generate pl_rsysinit
cat > etc/rc.d/init.d/pl_rsysinit <<EOF
#!/bin/sh
# Use syslinux instead of isolinux to make the image bootable
cat >$tmp/syslinux.cfg <<EOF
-SERIAL 0 115200
+SERIAL 0 9600
PROMPT 0
TIMEOUT 120
DISPLAY pl_version
DEFAULT serial
LABEL serial
KERNEL kernel
- APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro console=ttyS0,115200n8
+ APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro console=ttyS0,9600n8
EOF
umount $tmp
rmdir $tmp