Page 1 of 3

Add a "pfix=noram" option to your Puppy

Posted: Thu 27 Dec 2007, 15:50
by Pizzasgood
I was making a custom Puppy for someone and they wanted a pfix=noram option, to prevent pup_xxx.sfs from loading into ram even when there's enough available. I've seen another person say it would be nice to have, so here's how to do it. These directions assume you're using Puppy 3.01 with an unmodified initrd.gz file. For 3.00, or if you changed initrd.gz a little, they should still apply, but the line numbers will likely be off.

Also note: this involves editing initrd.gz, so if you're booting from a CD you'll have to re-burn it with the new initrd.gz file. USB and Frugal users can just drop in the new version.

First, put initrd.gz somewhere on a Linux filesystem (I tend to use /tmp/NewDir). Open a terminal there and do this to extract it:

Code: Select all

mkdir initrd-tree
cd initrd-tree/
zcat ../initrd.gz | cpio -i -d
Now the contents are inside initrd-tree/. Open init as text. At line 104 add

Code: Select all

   noram) NORAM="yes";;  prevents pup_xxx.sfs from loading to ram
At line 771 (772 after the above edit), change

Code: Select all

 if [ $RAMSIZE -gt 230000 ];then #256MB system. note, only checking physical ram.
to

Code: Select all

 if [ $RAMSIZE -gt 230000 ] && [ ! "$NORAM" = "yes" ];then #256MB system. note, only checking physical ram.
Then rebuild the initrd.gz by opening a terminal inside initrd-tree and running this:

Code: Select all

rm ../initrd.gz
find . | cpio -o -H newc | gzip -9 > ../initrd.gz
Now just replace the original initrd.gz file with the new one. You can now use the pfix=noram option to boot without loading the pup_xxx.sfs file to ram, regardless of how much you have.


By the way, up where you edited line 771/772, you can change the "230000" to set the minimum amount of ram before Puppy automatically loads the pup_xxx.sfs file into ram when not using the pfix=noram option. That's good to know if you're making a puplet that's bigger than the standard Puppy.

Posted: Fri 28 Dec 2007, 00:12
by JB4x4
Need to edit your example -

Code: Select all

nosplash) NOSPLASH="yes";;     #prevent bootsplash from running
to

Code: Select all

nosplash) NORAM="yes";;     #prevent pup_xxx.sfs from loading to ram
I had also put together an initrd.gz for Puppy 3.01 using "noramsfs"

http://www.murga-linux.com/puppy/viewto ... 74&t=24044

JB

Posted: Fri 28 Dec 2007, 00:38
by Bruce B
Pizzasgood,

Good work! I'll make the initrd.gz and post it on my little known website for people who may need or want something like this.

I use a free Linux application called TreePad™
for keeping things like this. See screen shot below. Posted as a program preview for anyone who needs a similar application.

mcewanw - also good post, that's a keeper also.

Bruce

Posted: Fri 28 Dec 2007, 23:12
by Pizzasgood
JB4x4 wrote:Need to edit your example -

Code: Select all

nosplash) NOSPLASH="yes";;     #prevent bootsplash from running
to

Code: Select all

nosplash) NORAM="yes";;     #prevent pup_xxx.sfs from loading to ram
Good catch (though I also needed to change the nosplash) to noram) ). I had also added Pebble to that project, and the nosplash option is right next to the noram option. So it was really easy to copy the wrong one.

@Bruce B: Don't forget to correct my error in there! Unless that's just an old screenshot.

Posted: Thu 20 Nov 2008, 22:08
by disciple
Do you know how to take the 4.1.1 initrd.gz apart? That cpio command doesn't work.
I thought I'd look at it to see if I could figure out why pfix=noram doesn't actually work...

Posted: Thu 20 Nov 2008, 23:26
by jcoder24
Compliments MU

Code: Select all

#!/bin/bash
gunzip initrd.gz
mkdir puppy-init
cd puppy-init
cat ../initrd | cpio -d -i
leafpad init
find . | cpio -o -H newc | gzip -9 > ../initrd.gz
cd ..
rm -rf puppy-init
rm -f initrd

Posted: Fri 21 Nov 2008, 00:21
by maddox
Hi,
I've tried a slightly different way using 4.11 :
create the new directory , copy the initrd.gz into the new directory, open a console in the new directory, then run the extract command in the new directory.

Code: Select all

zcat ./initrd.gz | cpio -i -d
- Notice there's one dot less between zcat and / , since I'm already in the new directory with the console.
Don't forget to delete the original "initrd.gz" file in the new directory before creating the new one.

Maybe just a problem with where the file is located in respect to the new directory. A dot ./ (run from here) ../ double-dot (go up 1 level)

Posted: Fri 21 Nov 2008, 04:55
by disciple
That's weird - it works now. Before I was in pfix=ram, so maybe I have a different cpio here that came with unrpm or something...

Posted: Sun 14 Feb 2010, 22:50
by steve_s
Ok, I'm waking this thread back up...hopefully I can get Pizzasgood and the crew to help out...

I searched around and found this thread, so if I missed a thread where it is answered then sorry...

I got a remaster I don't want to load to ram. It's a 685mb remaster from a frugal install with a massive save file...I don't want it to load to ram no matter what...I pick the "puppy pfix=noram" option, no go, it loads. I tried to use the stuff from this thread, thought I did it right, apparently I didn't, still picked the "noram" option, but it still loads to ram.

So, what are the changes I need to make to initrd.gz on a 4.2.1 remaster so that it won't load to ram?

Posted: Mon 15 Feb 2010, 14:51
by CatDude
Hello steve_s

Try the one attached below, it was done using the information Pizzasgood gave here

Using the Default initrd.gz with pfix=noram added to the kernel line of the grub entry
showed the following when booting up:
Loading the 'pup_421.sfs' main file...copying to ram
whereas there was no mention of copying to ram when using the Hacked initrd.gz

Here is the results of running free

Default initrd.gz

Code: Select all

# free
              		total         	used         	free       shared      buffers
  Mem:      1035420       286392       749028            0        16784
 Swap:      2104496            		0      2104496
  Total:      3139916       286392      2853524
# 
Hacked initrd.gz

Code: Select all

# free
              		total         	used         	free       shared      buffers
  Mem:      1035420       113852       921568            0        16784
 Swap:      2104496            		0      2104496
  Total:      3139916       113852      3026064
# 
Hope this helps
CatDude
.

Posted: Mon 15 Feb 2010, 17:30
by steve_s
Rockin', CatDude, that should save me a lot of work...

But just to be 100% clear: I am to just substitute this one for the current initrd.gz, correct? Change the name to initrd.gz just replace the current one, right? Just making absolutely certain before I burn another coaster... 8)

Posted: Mon 15 Feb 2010, 22:15
by CatDude
Hello steve
steve_s wrote: But just to be 100% clear: I am to just substitute this one for the current initrd.gz, correct?
That's correct mate.
Just unzip the attached file and you will get a directory called puppy-4.2.1-k2.6.25.16-Hacked_initrd
inside of that is the initrd.gz, no need to rename anything.

CatDude
.

EDIT:

Obviously you will still need to use the puppy pfix=noram at boot up.

how about 431

Posted: Tue 06 Apr 2010, 04:47
by pri
how about puppy 431, how to add pfix=noram

Posted: Wed 07 Apr 2010, 00:38
by Pizzasgood
Same directions for accessing the init script as in the first post. Just make the following edits instead of the edits described there.


At line 247, add this line:

Code: Select all

   noram)   PNORAM="yes";;        #do NOT copy .sfs files into ram.

At line 1055 (after the above change), change the line from this:

Code: Select all

[ $RAMSIZE -gt 220000 -a "$PCOPY" = "yes" ] && COPY2RAM="yes" #note, only checking physical ram.
to this:

Code: Select all

[ $RAMSIZE -gt 220000 -a "$PCOPY" = "yes" -a "$PNORAM" != "yes" ] && COPY2RAM="yes" #note, only checking physical ram.

At lines 1105-1107 (after the above changes), change the code from this:

Code: Select all

 [ "$PUPSFSDEVMNTPT" = "" ] && COPY2RAM="yes"
  #v405 fast media plus more than 256MB ram then definitely worth copying to ram...
 [ "`echo -n "$FASTPARTS0" | grep "$PUPSFSDEV"`" != "" ] && [ $RAMSIZE -gt 280000 ] && COPY2RAM="yes"
to this:

Code: Select all

 [ "$PUPSFSDEVMNTPT" = "" ] && [ "$PNORAM" != "yes" ] && COPY2RAM="yes"
 #v405 fast media plus more than 256MB ram then definitely worth copying to ram...
 [ "`echo -n "$FASTPARTS0" | grep "$PUPSFSDEV"`" != "" ] && [ $RAMSIZE -gt 280000 ] && [ "$PNORAM" != "yes" ] && COPY2RAM="yes"

For reference, I also attached a patch file that does the above changes. You don't need it if you did everything by hand.

Posted: Wed 07 Apr 2010, 15:04
by steve_s
Pizzasgood wrote:....
Thanks, pizzasgood! 8)

Posted: Thu 08 Apr 2010, 08:34
by pri
thanks... pizzasgood now my puppy will be run, even it fat :D.

already have multiuser for easy use too ? :D

Posted: Tue 27 Apr 2010, 22:06
by lee321987
Hello.

Every time I do this (even tried using Pizzasgoods' patch file), the boot screen does this:

Code: Select all

Loading drivers needed to access disk drives....   done
Searching for Puppy files in computer disk drives...pup-431.sfs not found. Dropping out to initial-ramdisk console...
/bin/sh: can't access tty; job control turned off
Any ideas?

Posted: Wed 28 Apr 2010, 01:20
by Pizzasgood
Turns out the problem isn't my changes. For Puppy 4.3.x, it looks like you need to use the -R option when running mkisofs. Otherwise the init script won't be able to locate the pup-431.sfs on the iso you build.

(Thank goodness for Qemu or it would have taken me about ten times as long to figure that out and verify it.)

Puppy apps placed on hard disk

Posted: Wed 28 Apr 2010, 12:31
by gjuhasz
I am happy to find this topic. The pfix=noram option is an ultimate solution if we have little RAM installed. Of course, Puppy becomes slower this case.

But...

What to do if you like some puppy variants, such as Bruno, but they are slow because you have 256 MB of RAM only? In my favorite distros, there are many nice-to-have packages (as parts of the distros' main sfs file) that could be better to lay in the hard disk. Per se, different users want different files to exile to the hard drive. How to replace a subset of files from the read-only sfs with links to the hard disk?

Don't try to move files from the sfs to the hard disk then put links in their original folder. Beyond response time and/or speed issues, Aufs/Unionfs punishes you with more RAM occupied.

A more complex but successful method to delete files from the read-only sfs (then replace them with links of course) is like this:

http://forum.eeeuser.com/viewtopic.php?id=71821 (I don't know whether this method has been applied for Puppies, please advise... I would prefer a simple "drag&drop" utility in the System menu for this purpose.)

A simple workaround is selecting a fat-free puppy then placing static packages (Skype, Zoiper, Opera52, Iron etc.) on the hard drive. This keeps the system being fast and prevents consuming RAM.

I know, dynamic sfs inclusion is well implemented in choicepup. I like it. Choicepup is very flexible, but unfortunately not too comfortable for some users such as my mother-in-low...

mkisofs

Posted: Wed 28 Apr 2010, 14:37
by lee321987
What file do I need to put 'mkisofs -R' in?