Author Topic: [SOLVED] Copy2RAM on PCLOS - a discussion  (Read 2132 times)

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
[SOLVED] Copy2RAM on PCLOS - a discussion
« on: November 11, 2010, 03:16:15 AM »
The following are thoughts at this time and not written in stone. They are open to correction and change as better understanding of the processes at play are achieved (by me particularly).  ;)

As some reading will be aware, I have an interest in using removable media for booting the various versions of the PCLOS releases. This has been ongoing for the past few years.
At this time, the liveusb creator project covers most of the options that might be needed, including storing lots of different versions on one device or partition on a device, to allow choice of booting whichever suits a particular situation.

The "livecd=" boot option has allowed us to rename the OS files and just edit this boot option to reflect that change, and thus boot whichever version we wish. So livecd=kde  or livecd=lxde  are valid options where the original livecd.sqfs file has been renamed to kde.sqfs or lxde.sqfs.

When it comes to the 'copy2ram' boot code, it appears that such variation in the name used for the livecd do not transfer to this boot option.
This results in a renamed .sqfs file not being recognised or used by the 'copy2ram' boot option.
The copy2ram boot option always wants to find a file named 'livecd.sqfs' and not one which has been renamed.

My suggestion to overcome this limitation of the present 'copy2ram' boot option would be to change it so that it is tied to the file name used for 'livecd=' boot option, or alternatively, to change the option to allow specifying the .sqfs by name in the boot stanza.
Whichever of those options is easier to implement would have, I think, the desired effect.
For future-proofing, it might be best to have the .sqfs specified when calling the 'copy2ram' boot option. Just because I cannot presently imagine a situation where one might want to call a different .sqfs file to that used for standard booting in a particular boot stanza does not mean there might not be a reason .....  now or in the future.
So maybe changing the 'copy2ram' boot code to 'copy2ram=' would be the better option. Default options would then be
livecd=livecd
copy2ram=livecd
Those could then be easily changed in a situation where the OS files have been renamed.

***

Now it may be that using copy to ram when booting from a fast device is not much of a gain .....  and this will likely be even more prevelant when we have USB 3 devices and connections attached to our PCs.
For a lot of us that time is a few years hence, so I believe there is still value in attempting this change.

***

How to do it?

This is where I am on really unsafe ground   :D   but I do have some thoughts to share .....

It seems that all this part of the boot process is controlled by the 'linuxrc' file.
The copy2ram boot option is specified in that file (actually it is the same as 'toram=yes' ).

Where the decision is taken to copy to ram, based on the presence of 'copy2ram' in the boot line, the "livecd.sqfs" is copied to ram.
I am hopeful that changing this "livecd.sqfs" hardcoded name to some variable that can hold whatever name the user determines, would achieve the goal.

This is what I am referring to ....

Quote
# copy the livecd.sqfs image to a tmpfs directory to be used as the new MNTCDROM
                                                        echo -n
                                                        echo -n " Copying to memory, please stand by..."
                                                        cp -R $MNTCDROM/livecd.sqfs $RAMDIR

If that specified file (livecd.sqfs) was some variable which held the name of the .sqfs file the user wished to use, then any renamed .sqfs file could be used for 'copy2ram'.
OK, there are likely other locations in the script where it would need to be changed also etc etc ....  the above is just by way of explanation.

That variable could be either tied to the same name as the 'livecd' variable, or it could be given another variable for even more potential options in the future, as mentioned above. The default of course would always be "livecd.sqfs" so that nothing that uses that at present would get upset by the change.

***

OK so!

This has gone on way too long.

Those are my thoughts presently.

All I ask is that the reader accept that although they may not use such things as different boot media and different boot options, there are quite a number of users who do and probably more who would like to, if the application of those options was simpler to achieve.

I guess the main point of this discussion should be any negative effects this might have on other parts of the booting system.
A secondary discussion point might be if it is easily achievable as I obviously think it is at present.

If the results from the above two are positive we then come to the question ......  is there someone who would like to get involved in looking at this with a view to implementing it?

It would be my wish/hope that this might be achievable and tested in preparation for the next quarterly releases of the PCLOS ISOs.

Over to you folks .......  comments, views etc etc ......   ;D
« Last Edit: November 26, 2010, 05:00:48 AM by Just19 »

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Copy2RAM on PCLOS - a discussion
« Reply #1 on: November 16, 2010, 06:45:25 AM »
Perhaps creating a symlink to the renamed .sqfs file would work?


Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #2 on: November 16, 2010, 07:51:32 AM »
Perhaps creating a symlink to the renamed .sqfs file would work?



The link would have to be named "livecd.sqfs" .......  which would not overcome the problem of the booting system using the first such named file it found somewhere on the system .....  which might be some other similarly named file.

The livecd=livecd boot code allows for using a different name .....  livecd=LXDE  or such .....  and it is something similar to this that is really required IMO.

Also, I wonder if Ash is capable of using symlinks .......  I think maybe not ...

regards.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Copy2RAM on PCLOS - a discussion
« Reply #3 on: November 16, 2010, 07:59:43 AM »
So then having livecd.sqfs be a link to lxde.sqfs (for example) would not do what is needed. Hmm......  ??? ??? ???

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #4 on: November 16, 2010, 08:12:31 AM »
So then having livecd.sqfs be a link to lxde.sqfs (for example) would not do what is needed. Hmm......  ??? ??? ???

not if I am reading the situation correctly .......  but one of the purposes of this thread is to correct any false assumprions I may have   ;)

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #5 on: November 21, 2010, 06:27:44 PM »
So then having livecd.sqfs be a link to lxde.sqfs (for example) would not do what is needed. Hmm......  ??? ??? ???

I obviously forgot to mention that in the presence of maybe three PCLOS releases, this would not allow all three to be capable of copy2ram, as there could be only one livecd.sqfs symlink.

So it appears to me that to facilitate the presence of three PCLOS versions, and have them all bootable and using cop2ram, the simplest way would be to somehow tie the name of the loop image that copy2ram uses to that of the "livecd=" boot code. In that way it would always load the correct image.

***

I had hoped this might generate some interest and discussion .....  but it appears it is not a subject that holds much interest for most people.

Oh well!    ;D
« Last Edit: November 23, 2010, 01:45:32 AM by Just19 »

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Copy2RAM on PCLOS - a discussion
« Reply #6 on: November 21, 2010, 11:38:15 PM »
I thought maybe it would generate some discussion, too.

Offline Dragynn

  • Hero Member
  • *****
  • Posts: 1436
  • Abide.
Re: Copy2RAM on PCLOS - a discussion
« Reply #7 on: November 22, 2010, 01:18:36 PM »
Well i'm interested, and I did try copy2ram with the Zen 2010.10, but strangely enough, I didn't really see a speed boost over running as a liveCD, the liveCD was a little slower the first time you opened menus and apps, but after that seemed to work as fast as when running entirely from ram. Seems counter-intuitive, or a huge testament to how well the liveCD is setup....maybe I misunderstand PCLOS's methods of copying to ram.
This aggression will not stand man.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #8 on: November 22, 2010, 03:07:34 PM »
Well for those who may be interested ......  I believe I have cracked it!

I have remastered a KDE Minime with a few edits made to the Linuxrc file and it has booted from USB drive, with renamed OS files as done by the PCLinuxOS-liveusb creator tool.

I will add to this post soon .....  just a few things to be checked ....

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Copy2RAM on PCLOS - a discussion
« Reply #9 on: November 22, 2010, 03:18:31 PM »
Well for those who may be interested ......  I believe I have cracked it!

I have remastered a KDE Minime with a few edits made to the Linuxrc file and it has booted from USB drive, with renamed OS files as done by the PCLinuxOS-liveusb creator tool.

I will add to this post soon .....  just a few things to be checked ....

Great!

Offline Dragynn

  • Hero Member
  • *****
  • Posts: 1436
  • Abide.
Re: Copy2RAM on PCLOS - a discussion
« Reply #10 on: November 22, 2010, 03:29:14 PM »
Well for those who may be interested ......  I believe I have cracked it!

I have remastered a KDE Minime with a few edits made to the Linuxrc file and it has booted from USB drive, with renamed OS files as done by the PCLinuxOS-liveusb creator tool.

I will add to this post soon .....  just a few things to be checked ....

So let me get it straight here, you got MiniMe to load onto a USB stick, and you got it to boot via copy2ram? As in the whole thing loaded into and running strictly in ram?

That's hot amigo! Too bad you used the wrong DE though...fanboy. :D
This aggression will not stand man.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #11 on: November 22, 2010, 04:00:10 PM »
Give a guy a chance  :(

 ;D ;D ;D

Here is what SEEMS to have worked for me.
I believe it requires some others to check what I have done so that we can be clear that I am not suggesting something that might have repercussions down the line.

OK, as I posted above, I thought the search for the loop image could use a variable for the name, thus allowing any named loop image to be used, and not be confined to the name "livecd.sqfs".

I did some experiments ...  all of which were failures I might add, for various reasons.

I eventually noticed ( duh! ) that the mounting of the livecd.sqfs file when run normally used a variable for the name.
Having checked what seemed then to be the obvious solution, I tried it.
It worked!
The copy2ram function uses the same named loop image as specified in the "livecd=" boot code.

So the answer appears to be quite simple in the end. Edit the Linuxrc file as follows ....

On lines 414, 420 and 427 where there is use of 'livecd.sqfs' in a command, just replace that with
$BASEIMG$LOOPSEXT

So the lines would now look like the following ....

Line 414
Code: [Select]
  IMAGESIZE=`ls -l $MNTCDROM/$BASEIMG$LOOPSEXT | awk '{print $5+1000000}'`

Line 420
Code: [Select]
 cp -R $MNTCDROM/$BASEIMG$LOOPSEXT $RAMDIR    

Line 427
Code: [Select]
  losetup $DEVLOOP $RAMDIR/$BASEIMG$LOOPSEXT      

The $BASEIMG is the name of the loop file, and the $LOOPSEXT  is the extension of the file (in this case .sqfs)

It really does seem to be that simple.

I cannot say that this IS the cure ........  but it sure looks like it at present.

If it is the cure, it would make one wonder why it was not used originally and the specific file name was used .....  but that is past.

It is my hope that some people reading here will try this in conjunction with the PCLinuxOS-liveusb utility, which does rename the OS files and thus does require this facility for copy2ram to work.

Thanks for your interest folks   ;)

I be happy chappy tonight methinks   ;D

Hopefully it will stand up to testing ......


EDIT
          This is the edited file for those who are too lazy ;D
http://dl.dropbox.com/u/5838889/linuxrc


regards.
« Last Edit: November 23, 2010, 01:47:50 AM by Just19 »

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #12 on: November 22, 2010, 05:35:01 PM »
Well for those who may be interested ......  I believe I have cracked it!

I have remastered a KDE Minime with a few edits made to the Linuxrc file and it has booted from USB drive, with renamed OS files as done by the PCLinuxOS-liveusb creator tool.

I will add to this post soon .....  just a few things to be checked ....

So let me get it straight here, you got MiniMe to load onto a USB stick, and you got it to boot via copy2ram? As in the whole thing loaded into and running strictly in ram?

That's hot amigo! Too bad you used the wrong DE though...fanboy. :D

Don't worry, those poor souls who use Gnome can benefit too!   :P    

 ;D ;D ;D

Oh ....  just in case it is of interest ......  Persistence can also be used with copy2ram .... it loads the changes into ram also, and saves any further changes when shutdown.   ;)
« Last Edit: November 22, 2010, 05:37:32 PM by Just19 »

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Copy2RAM on PCLOS - a discussion
« Reply #13 on: November 23, 2010, 01:38:07 AM »
Quote
So our plan of controlled neglect worked! 

 ;D ;D ;D

Quote
Is that   linuxrc  as in /usr/share/mylivecd/  ?

Yes.

I replaced that file with the edited copy and remastered, then installed the remaster on live usb using the PCLinuxOS-liveUSB creator utility, and afterwards added the 'copy2ram' boot code to the boot stanzas in menu.lst.

The copy2ram function worked both with and without persistence.

I used a couple of the recent mini ISOs to test with ....  installed them on a spare partition and remastered there, doing little else.

I am going to mark the first post (feeling optimistic ;D ) to indicate this thread contains a resolution. Tempting fate I know .....  but heck I can always change it  ;D  ;D

regards.
« Last Edit: November 23, 2010, 01:40:23 AM by Just19 »

uncleV

  • Guest
Re: [RESOLVED] Copy2RAM on PCLOS - a discussion
« Reply #14 on: November 23, 2010, 09:14:20 AM »
How could be this tested? By me to say?

By the way where's JohnBoy? ???
 :P