As mentioned in my earlier post, I modified the original Carolina initrd.gz to use the 'ramboot' sections from Fluppy (also present in Puppeee). I find this feature useful: other people might too.
I can't seem to upload attachments to this forum, so I've explained how I did it here. The code should actually allow you to add ramboot=1 to almost any other version of Puppy too, though I haven't yet tried that.
Backup everything before you start, and have a spare bootable medium on hand (e.g. USB stick or CD) as this could potentially make your system unbootable if your only running OS is Carolina.
First, make a temporary directory containing a copy of the Carolina initrd.gz. In that directory, do this:
Code: Select all
mkdir initdir
cd initdir
zcat ../initrd.gz | cpio -i -d
Now create a new temp mount-point for the ramboot code to use (note, we're doing this inside the 'initdir' directory, hence the lack of a leading /):
Now you need to edit the 'init' script in your favourite text editor and insert the necessary ramboot code at various points. Hopefully I've included enough of the surrounding code for you to work out where this all goes.
First bit:
Code: Select all
#pmedia= usbflash|usbhd|usbcd|ataflash|atahd|atacd|atazip|scsihd|scsicd|cd
[ $pmedia ] && PMEDIA=$pmedia #boot parameter, broad category of boot media. ex: cd.
[ $pdev1 ] && PDEV1=$pdev1 #boot parameter, partition have booted off. ex: hda3
[ $psubdir ] && PSUBDIR=$psubdir #boot parameter, directory for puppy files. ex: puppy220
[ $pkeys ] && PKEYS=$pkeys #boot parameter, keyboard layout w476
# next bit added for ramboot
[ $ramboot ] && RAMBOOT=yes
Second bit:
Code: Select all
#[ "$REMOVABLEDRVSAVE" = "1" ] && PUPMODE=13
[ "$REMOVABLEDRVSAVE" = "1" -a "$PMEDIA" != "usbhd" ] && PUPMODE=13 #110116 shinobar.
[ "$PMEDIA" = "usbflash" ] && PUPMODE=13 #v404 fix classmate, with internal usb flash.
[ "$PMEDIA" = "ataflash" ] && PUPMODE=13 #w019 constrain writes to internal flash drv.
;;
76) #v3.01 64+8+4 multisession cd.
PUPMODE=77 #yes, want tmpfs top layer.
;;
esac
# next bit added for ramboot
[ "$RAMBOOT" = "yes" ] && PUPMODE=12
Third bit:
Code: Select all
#normal ${DISTRO_FILE_PREFIX}save.2fs file. just mount it from where it is...
echo -n "Loading personal file $PUPSAVEFILE ($PUPSAVEDEV)..." > /dev/console
[ "`echo "$PUPSAVEFS" | grep 'ext[234]'`" != "" ] && echo "/dev/$PUPSAVEDEV /mnt/dev_save $PUPSAVEFS defaults 1 1" >> /etc/fstab #v2.21
# next bit added for ramboot
if [ "$RAMBOOT" = "yes" ] ; then
if [ "$PUPSAVEDEV" = '' ] ; then
echo -e -n " \\033[1;31mError, Save file is required for ramboot option \\033[0;39m"
exit
fi
mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/tmpfs3 noatime
cd /mnt/tmpfs3/${PSUBDIR}
SIZE=0
SIZE=`ls *fs | while read line ; do SIZEK=$(du -k $line| cut -f 1); SIZE=$(expr $SIZE + $SIZEK); echo $SIZE ; done |tail -n 1`
SIZE=`expr $SIZE + 1000`
if [ $SIZE -gt $RAMSIZE ] ; then
echo -e -n " \\033[1;31mError, Files too big to fit in RAM \\033[0;39m" > /dev/consol
exit
fi
mount -t tmpfs -o size=${SIZE}k tmpfs /mnt/dev_save
mkdir /mnt/dev_save/$PSUBDIR
echo -e " \\033[1;35mCopying files to RAM \\033[0;39m" > /dev/console #purple.
echo -e " \\033[1;35m${SIZE}KB RAM will be used\\033[0;39m" > /dev/console
ls *fs |while read line ; do
echo -e -n " \\033[1;35m${line} \\033[0;39m" > /dev/console #purple.
cp -af ${line} /mnt/dev_save/$PSUBDIR > /dev/console 2>&1
done
cd
umntfunc /mnt/tmpfs3
else
mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_save noatime #-t $PUPSAVEFS -o noatime /dev/$PUPS
fi
# above bit added for ramboot (and next line commented out)
# mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_save noatime #-t $PUPSAVEFS -o noatime /dev/$PUPSAVEDEV /mnt/dev_save
Fourth bit:
Code: Select all
if [ "$nocopysfs" = "" ];then
echo -en "\\033[1;35m" >/dev/console #35=purple
echo "'${basepupsfs}' now copying to hard drive (but only available next boot)..." >/dev/console
echo -en "\\033[0;39m" >/dev/console
PPATTERN="/dev/$xPUPSFSDEV "
PUPSFSDEVMNTPT="`mount | grep "$PPATTERN" | cut -f 3 -d ' '`"
# next bit added for ramboot
[ "$RAMBOOT" = "yes" ] && PUPSFSDEVMNTPT=/mnt/dev_save
Fifth bit:
Code: Select all
#100920 decide whether to copy .sfs's to ram (see prior decision above)...
pdPATTERN="`echo "$PUPSFSDEV" | sed -e 's/[0-9]*$//'` "
if [ "$PNOCOPY" != "yes" ];then
[ "`echo -n "$ATADRIVES" | grep "$pdPATTERN"`" = "" ] && COPYCONTENDER='yes' #test if not fast internal drive.
[ $PUPMODE -eq 5 ] && COPYCONTENDER='yes'
[ "$DEV1FS" = "iso9660" ] && COPYCONTENDER='yes'
fi
[ "$PCOPY" = "yes" ] && COPYCONTENDER='yes'
[ "$COPYCONTENDER" = "yes" ] && [ $RAMSIZE -gt 220000 ] && [ $RAMSIZE -gt $MINRAM2CPY ] && COPY2RAM="yes"
# next bit added for ramboot
[ "$RAMBOOT" = "yes" ] && COPY2RAM=""
Once you've done all that, you then rebuild the initrd.gz file:
Code: Select all
find . | cpio -o -H newc | gzip -9 > ../initrd_new.gz
When it's finished, copy the initrd_new.gz file to wherever you boot Carolina from, and rename it to initrd.gz (or you might be able to set up a new entry in your grub/syslinux file to use initrd_new.gz instead of initrd.gz). Booting with the kernel boot parameter 'ramboot=1' should move the Carolina SFSs and save files onto a ramdrive: they must all be in the same directory to start with, and you may need to specify pdev1 and psubdir on the kernel boot line too. And you need enough spare RAM...
Remember, nothing will be saved when you shut down.
If someone tries this code, please let me know if it works OK. It's fine for me, but if it needs any modifications I'll edit this post.