LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Puppy (https://www.linuxquestions.org/questions/puppy-71/)
-   -   Puppy on a USB key. (https://www.linuxquestions.org/questions/puppy-71/puppy-on-a-usb-key-500023/)

zaxonus 11-09-2006 06:16 AM

Puppy on a USB key.
 
Hi,

I have installed Puppy on a USB key, a few times. But now I would like to put the file PUP_xxx.SFS (PUP_211.SFS for version 2.11) in a directory of my choice; that is not necessarily the root directory, of the partition where Puppy is installed. Does anyone know how to do that ?

When I tried to move the file some where else it didn't work. Appearently the place where the file PUP_xxx.SFS is stored has to be specified somehow. And this is what I need to know.

Michel

billstclair 11-09-2006 06:32 AM

The /sbin/init script in initrd.gz looks for pup_$PUPPYVERSION.sfs in the top-level of each partition. You could change it to look wherever you want. The important thing is to set the PUPSFS variable, which is used later in the script to copy the pup_xxx.sfs file to the RAM disk.

You can look at the script in an existing Puppy at /initrd/sbin/init .

Remastering isn't hard, gunzip a copy of initrd.gz, mount -o loop it, make changes to $MOUNT_POINT/sbin/init, umount it, gzip it again, and aim your bootstrap loader at it.

The vmlinuz and initrd.gz files can be called whatever your want, as long as you tell the boot loader where they are.

zaxonus 11-11-2006 08:12 PM

This information is great and puts me on the track. Thanks :)

I followed the suggestions without any problems. But did not find out yet exactly how to modify the script. I found the PUPSFS variable, and changed the line :
PUPSFS="pup_$PUPPYVERSION.sfs"
to :
PUPSFS="MyNewDir/pup_$PUPPYVERSION.sfs"

When I tried to reboot on the USB key (after updating and moving pup_211.sfs to the adequate directory of course) I still got the message :

ERROR, cannot find Puppy on '$PMEDIA' boot media." >/dev/console
.....
the Linux-guru can now debug, 'e3' editor is available)


which is displayed by the /initrd/sbin/init.

This is a fairly long script, I only had a glance at it before making the change.
I need to take a closer look to see what is happening in more details and then make more appropriate modifications.

If someone knows about some good tutorials concerning this initrd thing I am interested.

marksouth2000 11-13-2006 12:39 PM

What was the value of PMEDIA (echo $PMEDIA) at that stage?

zaxonus 11-25-2006 10:05 PM

I have set :
PMEDIA=usbflash
at the GRUB level.

I have also been able to go a little further by trying to see in the script where the pup_$PUPPYVERSION.sfs file is refered to and change the script consequently.
Nevertheless I cannot make a complete boot yet. At some point it still cannot find what it is supposed to.

I am sure I can do what I want. Though the init script does not seem to have bee written in on order to make this easy.

zaxonus 11-25-2006 11:12 PM

Here is where I am at this point :

The boot process starts OK.
The following line (in loadpupsfsfunc()) is as far as I can tell, seing the boot messages, executing OK.
"Creating tmpfs for myDirectory/pup_211.sfs on (/initrd)/mnt/tmpfs... "

But problems start to happen with this one :
"Copying myDirectory/pup_211.sfs to tmpfs... mounting on (/initrd)/pup_ ,,,,"
where I get a failure.

Then after a couple of other various messages; I get this one :
"/mnt/tmpfs/myDirectory/pup_211.sfs : No such file or directoty"

Something has obviously been lost on the way.

Any help from Puppy or other experts in the field is welcome.

Thanks in advance.

alred 11-27-2006 11:27 AM

you can probably try creating the directory of "/mnt/tmpfs/myDirectory" inside the initrd.gz of your puppy first

and/or/may need

change your tmpfs variable to "/mnt/tmpfs/myDirectory" ...

but i'm not sure how well your variables stay throughout your puppy bootup and its session ...


if somehow you managed to get it works with whatever method , let know ... probably i may need that too ...



.

alred 11-28-2006 08:02 AM

this seems to work for me ...

at around lines 290 on my editor ::

if [ -f /mnt/data/000/pup_$PUPPYVERSION.sfs ];then
PUPSFS="000/pup_$PUPPYVERSION.sfs"


and inside that loadpupsfsfunc() after the copying of PUPSFS to tmpfs , i need to reset the variable back to just "pup_$PUPPYVERSION.sfs" ::

...
cp -f ${1}/$PUPSFS /mnt/tmpfs/
sync
PUPSFS="pup_$PUPPYVERSION.sfs"
...


ofcourse , as i mentioned , this probably only works on my puppy and it could break things , may need to check the PUPMODE/PUPSTATE case block at around lines 930 ... so beware ...



.

alred 12-01-2006 01:20 AM

ok , actually you can create and pass your own parameters from grub , and maybe also any other booting cfg file on your whatever disk ... like ::

PUPSFSDIR=/SFS
EXTRASFSDIR=/EXTRA

but you have to handle these parameters yourself as an enviroment variables passed into the init script ...



//just another possible way of doing things ...


.

zaxonus 12-01-2006 07:31 PM

Hi,

It finally worked following your advice (not the last one, the one before) thanks a lot.

I have the feeling it would be useful to spend some time trying to understand how the /sbin/init (inside Puppy-initrd) is working.

Bye

alred 12-02-2006 09:22 AM

glad to know that you finally get it to work but i think the second method one would be better because we are not hard-coding something into the init script , we do it from the "outside" which is either grub or maybe other *.cfg files on disk ... probably by that way we can have different multiple configurations on only one same init script with some ease ...

>> "trying to understand how the /sbin/init (inside Puppy-initrd) is working ..."

frankly speaking , i can only do guessing on it most of the time for i'm not really into linux scripting in anyway ...



.

alred 12-04-2006 02:36 AM

ok , finally found a way to do that grub thing ...

against the original init script ::

line 267 ::
Code:

  if [ -f /mnt/data${PUPSFSDIR}/pup_$PUPPYVERSION.sfs ];then
  PUPSFS="${PUPSFSDIR}/pup_$PUPPYVERSION.sfs"

line 541 ::
Code:

  cp -f ${1}$PUPSFS /mnt/tmpfs/
  sync
  PUPSFS="pup_$PUPPYVERSION.sfs"

after line 1061(i'm not too sure about this one , probably dont need it) ::
Code:

if [ ! "$EXTRASFSDIR" = "" ];then
 EXTRASFS="${EXTRASFS}$EXTRASFSDIR"
fi

line 232 ::
Code:

CHOICES3FS="`ls -1 /mnt/data$PUPSAVEDIR/pup_save*.3fs 2>/dev/null | sed -e 's/\/mnt\/data\///g'`"
after 766 ::
Code:

if [ ! "$PDEV1" = "" ];then
    findpupfunc $PDEV1
    else
...
...
...
# and on line 840 , double check this one , i can be wrong ...

fi


PUPSFSDIR = /SFS
EXTRASFSDIR = /EXTRA
PUPSAVE = ext3,hdf3,/pup_save_crypt-hdf3-212.3fs
or
PUPSAVEDIR = /PUPSAVE
PDEV1 = hde1


note :: these seems to work ok *only* on my puppy but i cant and donno how to test it on every possible PUPSTATE scenario and that ntfs stuffs , so it is not "robust" and its still kind of "hard-coded" with mistakes ... beware , backup your previous working init script oftenly when you edit ...


.


All times are GMT -5. The time now is 10:01 PM.