WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Extracting X extensions into base  (Read 2989 times)

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Extracting X extensions into base
« on: July 11, 2012, 07:47:21 AM »
So my goal is to load 3 different variations of TC that perform different functions. Ok, simple enough. My idea was to have the original core.gz untouched, and dynamically remaster it by chainloading 3 different customize.gz images along with it (so EXTLINUX's first entry would be something like APPEND initrd=/boot/core.gz,/boot/customize.gz, second would be APPEND initrd=/boot/core.gz,customize2.gz and so on, so that when new versions of TCL come out, I can simply replace core.gz). I like to extract all the tcz's right into the customize initrd so that bootups are faster. However, when I try to do this to load TC with a UI (I unsquashfs all the X and windows manager related extensions: Xvesa.tcz, Xlibs.tcz, Xprogs.tcz, fltk-1.10.tcz, flwm_topside.tcz, flwm.tcz, wbar.tcz), it should load normally just as TC does, but it stays in the terminal and doesn't seem to be loading the startup scripts. When loaded as extensions on bootup (with extensions in /tmp/builtin), it works fine, but when I do this and extract them into an initrd to load on boot, it does not. What am I missing?

Also, would this be the best and most flexible way to load three modified versions of TC? I could not come up with a better way.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: Extracting X extensions into base
« Reply #1 on: July 11, 2012, 07:49:00 AM »
If you extract a tcz, you also need to make sure the startup script gets run at the proper time. Some can be run before packing, some need to run at runtime (bootlocal.sh?).
The only barriers that can stop you are the ones you create yourself.

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Extracting X extensions into base
« Reply #2 on: July 11, 2012, 07:55:42 AM »
If you extract a tcz, you also need to make sure the startup script gets run at the proper time. Some can be run before packing, some need to run at runtime (bootlocal.sh?).
I see, that's what I figured ... how would I do this then? I thought I could simply extract the tcz's as they are simply squashed files, but looks like there is a dependency on when and how they run (don't the startup scripts also get extracted and placed in the proper locations when the tcz is extracted?). How do I also copy over the startup stuff? I'd like to get away from using ezremaster if possible since I am using a separate initrd.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Extracting X extensions into base
« Reply #3 on: July 11, 2012, 08:18:48 AM »
Scripts get executed during loading.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Extracting X extensions into base
« Reply #4 on: July 11, 2012, 10:06:35 AM »
Scripts get executed during loading.
During the loading of the tcz extensions? So there is no way to extract the extensions into the initrd but at the same time, preserve the execution of the scripts? If so, how, because I am not sure how to do it.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Extracting X extensions into base
« Reply #5 on: July 11, 2012, 10:38:59 AM »
The proper way - without circumventing the load mechanism and resorting to hackery - is to include extensions in a cpio archive (this is documented in wiki).
You can use the "copy2fs.flg" to extract the content of extensions upon loading.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: Extracting X extensions into base
« Reply #6 on: July 11, 2012, 11:43:53 AM »
The order is usually not important. As mentioned, you can run all installed scripts from bootlocal.sh from example.
The only barriers that can stop you are the ones you create yourself.

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Extracting X extensions into base
« Reply #7 on: July 11, 2012, 12:46:07 PM »
The proper way - without circumventing the load mechanism and resorting to hackery - is to include extensions in a cpio archive (this is documented in wiki).
You can use the "copy2fs.flg" to extract the content of extensions upon loading.
Yes, that's how I had it before ... basically all my extensions were in /tmp/builtin along with my other customized files in customize.gz (a cpio archive) and I loaded it this way vs. extracting the extensions into it. I guess this is the only way to do it. Here is my concern though: so I load core.gz and load customize.gz ... these will extract, then the extensions will load and extract the content of the extensions. Will the content of the extensions overwrite my customized files in customize.gz? (let's say I wanted my own autostart routine for openbox and had autostart.sh in my customize.gz, will openbox.tcz overwrite this on extraction?). If not, I guess I can deal with the slightly slower bootup time of the extensions vs. just extracting them in the initrd.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Extracting X extensions into base
« Reply #8 on: July 11, 2012, 01:36:13 PM »
One approach to have full control over order would be to separate your extensions and your customized config files into 2 cpio archives and load them in the appropriate order.
An alternative approach could be to store customized files in a backup, as backup gets loaded in a later stage.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: Extracting X extensions into base
« Reply #9 on: July 11, 2012, 01:38:47 PM »
No, extensions won't overwrite files. (unless especially made to do so)
The only barriers that can stop you are the ones you create yourself.

Offline ixbrian

  • Administrator
  • Sr. Member
  • *****
  • Posts: 436
Re: Extracting X extensions into base
« Reply #10 on: July 11, 2012, 08:56:17 PM »
In my experience and testing some extensions require that everything is extracted in the correct order based on the dependencies (ezremaster will extract them in the same order as Tiny Core would have loaded them)

Take a look at the ezremaster "remaster.sh" script to see how it handles extracting tcz's and handles the startup scripts.   Maybe you can modify this to fit your needs?

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Extracting X extensions into base
« Reply #11 on: July 12, 2012, 06:00:10 AM »
In my experience and testing some extensions require that everything is extracted in the correct order based on the dependencies (ezremaster will extract them in the same order as Tiny Core would have loaded them)

Take a look at the ezremaster "remaster.sh" script to see how it handles extracting tcz's and handles the startup scripts.   Maybe you can modify this to fit your needs?
Thanks ixbrian. I know you've done extensive work on ezremaster and appreciate your efforts on this. It will probably be difficult to sift through the complexity of ezremaster and how it handles tcz's and startup scripts, but at least that is a good starting point. If I can't get it working, then I will simply load them as tcz's I guess, which I did not want to do since this is an embedded system and I wanted the most static method (extracting extensions into the initrd) and fastest boot up time possible.

curaga, that is good to know about extensions not overwriting files, this will help, thanks.