WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Source code for TinyCore and CorePlus  (Read 5758 times)

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Source code for TinyCore and CorePlus
« on: March 19, 2013, 03:21:13 PM »
Hi

In an effort to better understand Linux, I have been doing some static and dynamic linking and looking at the startup times versus executable sizes.
I also use dlopen ("/path/to/some/lib.so", RTLD_LAZY) to call/use functions in libs.
To then use the actual functions, I call them with dlsym(handle, "TheFunction") however I will need to know what these functions
are called, what parameters and variable types they use.
I'm assuming the only way to get these is to look at the source, hence my question, where can one get the source for TinyCore and CorePlus?

Thanks.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Source code for TinyCore and CorePlus
« Reply #1 on: March 19, 2013, 03:48:25 PM »
Source of what?  The kernel source is nothing special.  Most of the core init functions are simple shell scripts which you can view from any core installation.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Source code for TinyCore and CorePlus
« Reply #2 on: March 19, 2013, 04:01:21 PM »
Hi gerald_clark

OK, I thought perhaps the kernel had been recompiled with some tweaks and/or extra boot options.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Source code for TinyCore and CorePlus
« Reply #3 on: March 19, 2013, 04:05:21 PM »
config and patches are in repo, start from Download page.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Source code for TinyCore and CorePlus
« Reply #4 on: March 19, 2013, 04:06:01 PM »
The startup code and extra boot code are in /etc/init.d/tc-config.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Source code for TinyCore and CorePlus
« Reply #5 on: March 19, 2013, 05:46:41 PM »
Thank you.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Source code for TinyCore and CorePlus
« Reply #6 on: March 20, 2013, 12:04:35 AM »
Hi Paulo
If you don't mind my asking, why are you using  dlopen? I've never used it myself, so I did some quick reading
on the function. From what I read, that function is used to allow you to check for the availability of libraries and
check them for functions and objects to add additional functions to a program. An example of that might be an
audio program that makes certain controls available depending on which audio libraries it finds.
Unless you have a real need to implement  this type of capability, I think you might be better off linking dynamically
and including any extra libraries as dependencies.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Source code for TinyCore and CorePlus
« Reply #7 on: March 20, 2013, 01:02:58 PM »
Hi Rich

You are 100% correct in what you say about dynamic linking however I was just trying to learn about both ways
in which to compile binary executables and their pros and cons.

The big advantage of dynamic linking is the resulting smaller file size, however static linking also has an advantage of
reducing the dependency issues as everything required is "built-in".

Using strip helps in reducing the binaries size so does passing the parameter --as-needed to ld via gcc.

« Last Edit: March 20, 2013, 01:08:57 PM by Paulo »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Source code for TinyCore and CorePlus
« Reply #8 on: March 20, 2013, 01:20:25 PM »
Hi /optional
I guess the point I was really trying to make is that you don't need to use  dlopen  just because you are
linking dynamically.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Source code for TinyCore and CorePlus
« Reply #9 on: March 20, 2013, 01:36:06 PM »
Hi Rich

OK, I just thought it was the easiest way and it seems to work with both static and dynamic.
What alternative would you recommend as coming from the Windows environment this is all new to me and quite confusing at times.

Basically what I'm trying to achieve is minimizing the dependency headaches between the three distros I use, namely TC, Puppy and Mint.
So if I compile something say in Puppy (CLI apps), it will pretty much work on all three.
Static linking seems to work best for this.
« Last Edit: March 20, 2013, 01:44:10 PM by Paulo »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Source code for TinyCore and CorePlus
« Reply #10 on: March 20, 2013, 02:22:10 PM »
Hi Paulo
If you are just compiling CLI apps, and not linking to any external development packages, you should have no
dependencies except for the standard C libraries, which should always be installed as part of the OS.
Compile one of your programs dynamically and copy it to your other two systems. Then run:
Code: [Select]
ldd ./ProgramNameThis will show you its dependencies and if any could not be found. If your machines all have the same version
of libc (and maybe libm) and all you use are standard C library calls, you should be OK.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Source code for TinyCore and CorePlus
« Reply #11 on: March 20, 2013, 02:26:06 PM »
Great, thanks Rich.