Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 04 Jul 2015, 07:52
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Avoid "Searching for Puppy files" during bootup - revisited
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [29 Posts]   Goto page: 1, 2 Next
Author Message
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Thu 25 Jun 2015, 05:27    Post subject:  Avoid "Searching for Puppy files" during bootup - revisited
Subject description: now at version 3
 

This has been inspired by Wognath's topic by a very very similar name, http://www.murga-linux.com/puppy/viewtopic.php?t=99212.
In particular his comment "The idea is that once Puppy has been run, all the info found in the Searching... section is recorded in PUPSTATE."
However I've implemented the concept in a rather different way, hence the different topic.

The most significant difference is that the "init" script is patched from the start. It continues to work just like the standard "init" until you specify a "pupsave" boot parameter. e.g "pupsave=sda3:/tahr/tahrsave.2fs".
Then it uses the specified file/directory as the savefile/savefolder, bypasses the "Searching for Puppy files" code, and includes the "/etc/rc.d/PUPSTATE" file from the savefile/savefolder, thus setting all the relevant variables that are usually set via the "Searching for Puppy files" code.
At least 1 boot must be done with the savefile/savefolder in place to ensure that "PUPSTATE" is appropriately setup, before the "pupsave" boot parameter is specified.

The "init" script will revert to normal processing, if the "pupsave" boot parameter is removed, or "pfix=ram" is specified.
So if you want to add a ydrv, move the ydrv file into the frugal install directory, reboot without the "pupsave" parameter, reboot with the "pupsave" parameter.

You don't need to patch the "init" script yourself, you only need a patched "initrd.gz" for your particular puppy.

This has been tested in pupmode=12.
It should work in pupmode=13, and might work in pupmode=6 and pupmode=7.

Patched "initrd.gz" files for tahrpup 6.0.2 are available here:
noPAE: nitrd_nosearch_nopae.gz
PAE: initrd_nosearch_pae.gz
Edit: these have been withdrawn, they crash if the specified file does not exist.
Please use version 3.

I have also attached a gziped patch file for the "init" script in "initrd.gz".
Download, gunzip to produce "init.nosearch-2.diff", extract "init" from "initrd.gz", patch "init" with "init.nosearch-2.diff", re-compress "initrd.gz" containing patched "init", reboot.
Edit: Uploaded new version of patch, see later post for more info.

Edit: Uploaded version 3 of patch, see later post for more info. A major rewrite to avoid extra mount and umount.
Patched "initrd.gz" files for tahrpup 6.0.2 are available here:
noPAE: http://www.fishprogs.software/puppy/tahr602/initrd_nosearch_nopae-3.gz
PAE: http://www.fishprogs.software/puppy/tahr602/initrd_nosearch_pae-3.gz
Download, rename to "initrd.gz", move to frugal install directory, reboot.

gyro
init.nosearch-3.diff.gz
Description  gunzip to produce file "init.nosearch-3.diff"
gz

 Download 
Filename  init.nosearch-3.diff.gz 
Filesize  1.8 KB 
Downloaded  6 Time(s) 
init.nosearch-2.diff.gz
Description  gunzip to produce file "init.nosearch-2.diff"
gz

 Download 
Filename  init.nosearch-2.diff.gz 
Filesize  1.29 KB 
Downloaded  8 Time(s) 

Last edited by gyro on Mon 29 Jun 2015, 23:47; edited 6 times in total
Back to top
View user's profile Send private message 
Keef


Joined: 20 Dec 2007
Posts: 703
Location: Staffordshire

PostPosted: Thu 25 Jun 2015, 15:42    Post subject:  

Just tested the tahrpup noPAE initrd.gz on an internal HDD install, using a save folder. Found it instantly.
Nothing else to add really - it does wot it says on the tin.
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 3155
Location: New Zealand

PostPosted: Thu 25 Jun 2015, 18:56    Post subject:  

Do you think this method could work if identifying the partition by UUID number rather than sdx number?
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 2284

PostPosted: Fri 26 Jun 2015, 03:51    Post subject:  

In my system with 2 disks and 6 partitions $pupsave is 2900-3200msec (depending on mode and partition) faster that the normal init.
One issue that you may want to fix is that it crashes the system if savefile/folder is not found (renamed, misspelled etc). You may want to add a condition that the file/folder/partition exists.

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 10907

PostPosted: Fri 26 Jun 2015, 04:44    Post subject:  

Once again gyro doing what should have been done in the first place Smile

fair play to yer ...

Puppy has a pile of boot options ending up pretty much with the slax approach of configuring the system from the vmlinuz line rather than guessing what it is... so it might as well accept that this is how it is and.... erm stop guessing... give it a profession feel eh and yes sooo much faster... in my case if it IS guessing it limits how much of that is done which at least saves time... guessing is really for first boots and quick tests rather than installed systems after all.

mike
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 08:53    Post subject:  

mavrothal wrote:
In my system with 2 disks and 6 partitions $pupsave is 2900-3200msec (depending on mode and partition) faster that the normal init.
I make no claims about the speed benefit. I just wanted to prove it could be done another way.
mavrothal wrote:
One issue that you may want to fix is that it crashes the system if savefile/folder is not found (renamed, misspelled etc). You may want to add a condition that the file/folder/partition exists.
Thanks, good catch. Yes, in all my testing I always got it right.
Not as simple as it would seem, since no partition mounted at the time the decision is made, but It should be possible, I'll hopefully get back with an updated patch.

My site is currently down, so I probably won't have replacement "initrd.gz" files.

gyro

Last edited by gyro on Fri 26 Jun 2015, 09:04; edited 1 time in total
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 08:59    Post subject:  

Confession:
I forgot to acknowledge technosaurus, who recommended the "pupsfs", "zdrv", "adrv" and "ydrv" boot parameters that are already in "init". My "pupsave" parameter is based on that code, and uses the same format.

gyro
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 2284

PostPosted: Fri 26 Jun 2015, 10:05    Post subject:  

gyro wrote:
the "pupsfs", "zdrv", "adrv" and "ydrv" boot parameters that are already in "init".


And they are also missing any checks, so typos result in broken systems Evil or Very Mad
I guess a test_presence() should be setup to to verify the parameters are valid though this may defy the speed up purpose.

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 11:06    Post subject: updated patch to init.nosearch-2.diff  

I've updated the patch to "init.nosearch-2.diff".
This now checks if the specified savefile/savefolder exists on the specified partition, before skipping "Searching" code.
If the file is not found it writes an error message to the console, and continues on to "Searching" code.

Mounting and umounting a partition just to test the existence of a single file, seems a bit excessive, but that's the obvious way. The decision has to be made before the "Searching" code, (where partitions get mounted).

@mavrothal
The technosaurus parameters setup some variables and then continue into the "Seraching" code, so maybe the testing for the existence of the file could be delayed till after the partition is mounted, but before any "find" commands.
I have not done any testing of these other parameters.

gyro
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 11:14    Post subject:  

greengeek wrote:
Do you think this method could work if identifying the partition by UUID number rather than sdx number?
Theoretically it could, but that would require some script code to translate the UUID into the appropriate sdx.
(I have no enthusiasm for even attempting this.)

gyro
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 11:21    Post subject:  

@Keef
Thanks for testing.
Unfortunately the version you have, crashes if you misspell the name of the file, as mavrothal discovered.
The fixed version is only available as a patch file, since my site is down.

gyro
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 2284

PostPosted: Fri 26 Jun 2015, 11:28    Post subject: Re: updated patch to init.nosearch-2.diff  

gyro wrote:

@mavrothal
The technosaurus parameters setup some variables and then continue into the "Seraching" code, so maybe the testing for the existence of the file could be delayed till after the partition is mounted, but before any "find" commands.
I have not done any testing of these other parameters.

Yes they all break the installation.
The following patch works for me, though we could delay the $file.sfs definitions for after ALLPARTS is recorded so the propepart_init call can be avoided. Though as is is not a major delay.
Code:
--- a/init   2015-06-26 18:23:04.840026666 +0300
+++ b/init   2015-06-26 18:20:52.070017775 +0300
@@ -599,12 +599,22 @@
 
 [ $PSUBDIR ] && [ "`echo -n "$PSUBDIR" | cut -c 1`" != "/" ] && PSUBDIR="/${PSUBDIR}" #add leading /.
 
+test_presence() {
+   FILEEXISTS=''
+   PARTITION="$(echo "$1" | cut -f1 -d ':')"
+   FILETOCHECK="$(echo "$1" | cut -f2 -d ':')"
+   FSTYPE=$(probepart_init -k| grep "$PARTITION" | cut -f2 -d '|')
+   mount -t $FSTYPE /dev/$PARTITION /mnt/data
+   [ -e /mnt/data/$FILETOCHECK ] && FILEEXISTS="true"
+   umount /mnt/data
+}
+
 #100915 requested by technosaurus (formats get changed further down)...
-[ $pupsfs ] && PUPSFS=$pupsfs #format partition:<path><filename> ex: sda2:/wary071/wary_071.sfs
-[ $zdrv ] && ZDRV=$zdrv #ex: sda2:/wary071/zdrv_071.sfs
-[ $adrv ] && ADRV=$adrv
-[ $ydrv ] && YDRV=$ydrv
-[ $pupsave ] && PUPSAVE=$pupsave #format partition:<path><filename> ex: sda2:/wary071/warysave.2fs
+[ $pupsfs ] && test_presence $pupsfs && [ "$FILEEXISTS" = "true" ] && PUPSFS=$pupsfs #format partition:<path><filename> ex: sda2:/wary071/wary_071.sfs
+[ $zdrv ] && test_presence $zdrv && [ "$FILEEXISTS" = "true" ] && ZDRV=$zdrv #ex: sda2:/wary071/zdrv_071.sfs
+[ $adrv ] && test_presence $adrv && [ "$FILEEXISTS" = "true" ] && ADRV=$adrv
+[ $ydrv ] && test_presence $ydrv && [ "$FILEEXISTS" = "true" ] && YDRV=$ydrv
+[ $pupsave ] && test_presence $pupsave && [ "$FILEEXISTS" = "true" ] && PUPSAVE=$pupsave #format partition:<path><filename> ex: sda2:/wary071/warysave.2fs
 
 [ $underdog ] && UNDERDOG=$underdog #120130 specify partition for Underdog Linux (refer also underdog.lnx).
 


Ooops, didn't see version 2 Embarassed
Oh well I think all $file.sfs need fixing and my patch is for all of them Wink

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 11:34    Post subject:  

@mavrothal
I shouldn't allow myself to be limited to the obvious.
I think the decision and hence the check of the existence of the file can be delayed until later in the code.
I'll try my idea tomorrow.

gyro
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 772
Location: Brisbane, Australia

PostPosted: Fri 26 Jun 2015, 11:52    Post subject: Re: updated patch to init.nosearch-2.diff  

mavrothal wrote:
though we could delay the $file.sfs definitions for after ALLPARTS is recorded so the propepart_init call can be avoided. Though as is is not a major delay.
If you look at the code for these right at the beginning of the "Searching" section you will see that some of the decoding is already done.

But I want to play with moving the checks even further down into the code that already mounts the partitions.

I thing that it would be nice to have checks for the the sfs file parameters anyway, even if we never bother seriously implementing the "pupsave" parameter.

gyro
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 2284

PostPosted: Fri 26 Jun 2015, 11:58    Post subject:  

gyro wrote:

I'll try my idea tomorrow.

OK.
Another concern is the psavemark. In this case we have to make sure that main sfs etc are still found properly when pupsave is defined (though I just looked at the code to see if/how your change may affect this. Did not tested it)
gyro wrote:
If you look at the code for these right at the beginning of the "Searching" section you will see that some of the decoding is already done

Yes I had seen this though I believe is recorded to /tmp logs at a latter pont

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [29 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0977s ][ Queries: 12 (0.0062s) ][ GZIP on ]