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 Mon 22 Dec 2014, 20:59
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
Install Puppy to non-root location at USB stick
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [24 Posts]   Goto page: 1, 2 Next
Author Message
Toxic

Joined: 14 Dec 2008
Posts: 9

PostPosted: Sun 14 Dec 2008, 19:49    Post subject:  Install Puppy to non-root location at USB stick  

I have USB stick with several live distros and other stuff (like Win PE, etc).
I have working GRUB (grub4dos 0.4.4, to be precise) on USB device. I need Puppy to run from non-root directory, e.g. /boot/distros/puppy. I've tried some options to grub but still with no results. Here's what I have in GRUB:
Code:

title Puppy Linux 4.1.2
root (hd0,0)
kernel /boot/distros/puppy/vmlinuz root=/dev/ram0 pmedia=usbstorage psubdir=boot/distros/puppy
initrd /boot/distros/puppy/initrd.gz
boot


Grub starts to load kernel, but it always says pup_412.sfs not found..., however it's in /boot/distros/puppy/pup_412.sfs
I've tried to change pmedia param (usbstorage, usbflash, usbhd) - no luck.

Any suggestions?
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9376
Location: Stratford, Ontario

PostPosted: Sun 14 Dec 2008, 20:37    Post subject:  

I'm not sure if the psubdir argument is able to drill that far down into your subfolder. I would try putting everything in a /puppy folder instead.

Then use:

Code:
title Puppy Linux 4.1.2
root (hd0,0)
kernel /puppy/vmlinuz pmedia=usbflash psubdir=puppy
initrd /puppy/initrd.gz
Back to top
View user's profile Send private message 
Toxic

Joined: 14 Dec 2008
Posts: 9

PostPosted: Mon 15 Dec 2008, 03:36    Post subject:  

Ok, will try. However it's not my goal...
Back to top
View user's profile Send private message 
ICPUG

Joined: 24 Jul 2005
Posts: 1290
Location: UK

PostPosted: Mon 15 Dec 2008, 08:57    Post subject:  

To confirm rcrsn51's thoughts.

Puppy's init script is written to drill down only one directory when looking for the Puppy files.

If you want to go further down you have to modify that script.
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11131
Location: The Peoples Republic of California

PostPosted: Mon 15 Dec 2008, 09:13    Post subject:  

There have been no demands or even requests for nesting Puppy any deeper.

In the absence of reasons, demand or requests, it won't likely happen.

But this is open source, and one of things I like about it is: you can make it behave as you wish, providing it is technically feasible. What you want is technically feasible as far as I can see.

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Toxic

Joined: 14 Dec 2008
Posts: 9

PostPosted: Mon 15 Dec 2008, 17:19    Post subject:  

Well, It did boot from /puppy, as I expected.

Where should I make a request about nested drill?

Besides, I'm win32 programmer myself, so if you point me how to extract and then repack desired file I might try to edit it myself. Articles are welcome too.
Back to top
View user's profile Send private message 
ICPUG

Joined: 24 Jul 2005
Posts: 1290
Location: UK

PostPosted: Tue 16 Dec 2008, 08:33    Post subject:  

toxic,

the init script is in initrd.gz.

Pizzasgood made instructions for unpacking this file and repacking it here:

http://www.murga-linux.com/puppy/viewtopic.php?t=25645

This was for Puppy series 3. I have not seen anything since. I presume it is the same for series 4.

The init file is in /sbin/init I think
Back to top
View user's profile Send private message 
Toxic

Joined: 14 Dec 2008
Posts: 9

PostPosted: Sun 04 Jan 2009, 19:21    Post subject:  

Well, I did it by changing only few bytes:
Quote:
FND_INITRDGZ="`find /mnt/data -maxdepth 4 -mount -type f -name initrd.gz | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
FND_PUPXXXSFS="`find /mnt/data -maxdepth 4 -mount -type f -name pup_${PUPPYVERSION}*.sfs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
FND_ZDRVSFS="`find /mnt/data -maxdepth 4 -mount -type f -name zdrv_${PUPPYVERSION}.sfs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
FND_PUPSAVE2FS="`find /mnt/data -maxdepth 4 -mount -type f -name pup_save*.[23]fs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
FND_SWAPFILEPUP="`find /mnt/data -maxdepth 4 -mount -type f -name pupswap.swp | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"

And since PSUBDIR parameter is used as regular expression pattern I've escaped '/' character in command line. In result, I have following command line:
Code:
label puppy
kernel boot/puppy/vmlinuz
append initrd=boot/puppy/initrd.gz pmedia=cd psubdir=boot\/puppy

So, almighty developers, can you please increase value for maxdepth parameter in default init script? It will solve nested root location problem.
Back to top
View user's profile Send private message 
Crash


Joined: 09 Dec 2005
Posts: 432
Location: Garland, TX

PostPosted: Mon 05 Jan 2009, 00:38    Post subject:  

ICPUG-

Thanks for remembering a post that is almost a year old. And thanks to Pizzasgood for providing the instructions. Anything like this helps us Linux newbees (You'd think I would have progressed farther in three years Smile).

Toxic-

Nice hack of initrd.gz. Doesn't look like a difficult thing to change.

The nesting four deep has its good points and bad. I like to hide versions of Puppy on my hard drive when I am testing out a new media such as SD card, and do so by moving the files two levels down in the directory structure. I suppose I could move them down five levels, but it would take some getting used to.

Also, I think the bootup may be slow if you have a lot of stuff on your hard drive and the search is four levels deep, but I don't know that for sure. Anyway, booting Puppy to a subdirectory is relatively new, since about version 3.01 or so. It works good for me as-is, but I don't have as many different distros on my hard drive as you do.
Back to top
View user's profile Send private message 
Toxic

Joined: 14 Dec 2008
Posts: 9

PostPosted: Mon 05 Jan 2009, 04:03    Post subject:  

Agree. Drilling 4 dirs depth is a very time-consuming when you have partitions with a complex directory structure. Easiest way is to add another kernel parameter which will allow user to specify desired depth level.
However, I think there should be more straight and simple lookup method, like in Parted Magic distro, for example:
Code:
for devices in sd* hd*
do
  echo /dev/$devices | cat >> /tmp/device_list
done

for devices in $(cat /tmp/device_list)
do
  clear
  echo Scanning device: $devices
  mount -n $devices /livemnt >/dev/null 2>&1
  if [ -e /livemnt/${LOCATION}/pmagic/pmodules/pmagic.7z ]; then
    PMAGIC_USB_DEVICE="$devices"
    echo "$PMAGIC_USB_DEVICE" | cat > /tmp/pmagic_device
    break
  fi
  umount -n /livemnt >/dev/null 2>&1
done

Where LOCATION variable is a counterpart of PSUBDIR in Puppy.
Back to top
View user's profile Send private message 
Crash


Joined: 09 Dec 2005
Posts: 432
Location: Garland, TX

PostPosted: Wed 07 Jan 2009, 02:19    Post subject:  

I'm still analyzing the code here, and can't yet make comments on the actual implementation, but it seems like there are reasonable solutions. My thought was to have a boot parameter "MAX_DEPTH" or some such name that would define the subdirectory search depth on boot-up. It would have 2 as default and have some upper bound so things wouldn't go crazy if you entered "100", for instance. But tying it to PSUBDIR seems more elegant.

Toxic wrote:
So, almighty developers, can you please...

There was a TV three part series called The Martian Chronicles that came out in 1980, based on Ray Bradbury's novel. I don't know how well it followed the book, not having read it, but I remember the end quite well. Rock Hudson invites his family on a picnic to "meet the Martians", who are pretty elusive by this time. The family is at the edge of a pond and they look in at their reflections. Rock Hudson says "Those are the Martians".
Back to top
View user's profile Send private message 
Toxic

Joined: 14 Dec 2008
Posts: 9

PostPosted: Wed 07 Jan 2009, 04:58    Post subject:  

Well, this code is simple. It first retrieves a list of available sd? and hd? devices, then it mounts each of them and searches for specific file at specific path on that device. It works much faster because it doesn't iterate through entire filesystem as find function does.
Back to top
View user's profile Send private message 
ICPUG

Joined: 24 Jul 2005
Posts: 1290
Location: UK

PostPosted: Wed 07 Jan 2009, 08:38    Post subject:  

Crash

Your story about the Martian Chronicles ending was SO appropriate and made me smile!

With Free Software we can, with the necessary skills, all become developers.

It seems my little memory jogger has triggered some very useful investigation. Can't wait to see the outcome of your and Toxic's labours.
Back to top
View user's profile Send private message 
Crash


Joined: 09 Dec 2005
Posts: 432
Location: Garland, TX

PostPosted: Thu 08 Jan 2009, 23:31    Post subject:  

IPUG-

Thanks for the support. I'm sure something will come out of this.

Toxic-

I agree the Parted Magic code is straightforward - it's the init code that I need to analyze.

I'm just transitioning over to doing Linux (Bourne?) shell scripts, so this will take a little while. Compared to DOS batch code, I find it to be far more powerful but it can get me into trouble faster, too. So I have to take it kind of easy.

So far, all I am using to do the inquiry is ROX, Rxvt, and Geany. That's about all I need - makes a quite powerful development environment.
Back to top
View user's profile Send private message 
Crash


Joined: 09 Dec 2005
Posts: 432
Location: Garland, TX

PostPosted: Fri 16 Jan 2009, 23:43    Post subject:  

I found that the following code allows you to boot Puppy Linux several levels deep to the path specified by the psubdir parameter. I added a new flag, "psubok=TRUE", which tells init that you really, really think the subdirectory is OK to use and it contains all the Puppy files. If psubok is not set to "TRUE", the original code executes intact. Here is the code:

Code:
 [ $psubok ] && PSUBOK=$psubok #All puppy files in PSUBDIR. ex: TRUE
 if [ "$PSUBOK" == "TRUE" ]; then
 FND_INITRDGZ="`find /mnt/data/$PSUBDIR -maxdepth 1 -mount -type f -name initrd.gz | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 #v3.01 '*' means zero or more extra characters. this is for custom naming...
 FND_PUPXXXSFS="`find /mnt/data/$PSUBDIR -maxdepth 1 -mount -type f -name pup_${PUPPYVERSION}*.sfs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 FND_ZDRVSFS="`find /mnt/data/$PSUBDIR -maxdepth 1 -mount -type f -name zdrv_${PUPPYVERSION}.sfs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 FND_PUPSAVE2FS="`find /mnt/data/$PSUBDIR -maxdepth 1 -mount -type f -name pup_save*.[23]fs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 else
 FND_INITRDGZ="`find /mnt/data -maxdepth 2 -mount -type f -name initrd.gz | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 #v3.01 '*' means zero or more extra characters. this is for custom naming...
 FND_PUPXXXSFS="`find /mnt/data -maxdepth 2 -mount -type f -name pup_${PUPPYVERSION}*.sfs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 FND_ZDRVSFS="`find /mnt/data -maxdepth 2 -mount -type f -name zdrv_${PUPPYVERSION}.sfs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 FND_PUPSAVE2FS="`find /mnt/data -maxdepth 2 -mount -type f -name pup_save*.[23]fs | grep -v ' ' | sed -e 's%^/mnt/data%%g' | tr '\n' ' '`"
 fi

Essentially, all that is changed is the $PSUBDIR parameter being appended to the "find" directory path, and the maxdepth being set to 1 instead of 2. This forces find to only search in the PSUBDIR directory.

I didn't modify the search for pupswap.swp since I don't know enough about it to know where people commonly locate it. It could just as easily be included inside the modified code.

I haven't any idea what the MULTIFOLDER search does, so I didn't touch it either.

I am using linld to boot Puppy from DOS in a FAT file system. The code I use is as follows:

Contents of boot script:

Code:
LINLD.COM image=D:\linux\puppy\p412\vmlinuz initrd=D:\linux\puppy\p412\initrd.gz cl=@D:\PUPPY.LIN

Contents of puppy.lin file:

Code:
root=/dev/ram0
pmedia=idehd
acpi=on
psubok=TRUE
psubdir=linux/puppy/p412

This is a great tool for learning. I am now much more familiar with some basic shell features such as the do loop, if statement, the find utility, and regular expressions. I gain as much out of this type of exercise as the utility it may provide to others.

/// Edited Jan 18

Small change to code to reflect ideas discussed later in post.

///
init.gz
Description  Modified init file from Puppy V4.12 initrd.gz
gz

 Download 
Filename  init.gz 
Filesize  16.79 KB 
Downloaded  235 Time(s) 

Last edited by Crash on Sun 18 Jan 2009, 01:04; edited 2 times in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [24 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
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.0949s ][ Queries: 12 (0.0048s) ][ GZIP on ]