Tiny Core Linux

Tiny Core Base => Micro Core => Topic started by: Rup on August 10, 2010, 02:08:30 PM

Title: Micro Core with 16 MB of RAM
Post by: Rup on August 10, 2010, 02:08:30 PM
Hi all,

I've been trying to run Micro Core v3 in a VirtualBox VM with the bare minimum of RAM to get it booting. So far, it succeeded with 28 MB, not less. The thing is, i've only 16mb to play with but can't get Micro Core booting at all with 16 MB. With anything between 16 MB and 28 MB i get a Kernel Panic.
Once booted with 28 MB (as seen in Virtual Box config), free says there is 23482 total ram and 14052 used.

I think i could strip out unneeded modules from the kernel, especially those battery/laptop-related.
My system will have an ethernet card and a 4 GB hard disk. USB support would be a plus.

Do you know where to start in my quest for a 16 MB Micro Core? The kernel ? Everything around it?

Cheers

Title: Re: Micro Core with 16 MB of RAM
Post by: bmarkus on August 10, 2010, 02:19:16 PM
My honest opinion that no way with 16M. It is not enough for the system and consider resource requirement of your applications too.
Title: Re: Micro Core with 16 MB of RAM
Post by: hiro on August 10, 2010, 02:28:41 PM
You should consider using some other distribution, loading all the os into ram is quite a step backward if you only have 16mb, don't you think?
Title: Re: Micro Core with 16 MB of RAM
Post by: danielibarnes on August 10, 2010, 02:39:38 PM
You'll likely need to rebuild your kernel to get it that small. The Linux Tiny (http://elinux.org/Linux_Tiny) project is a good place to start. Some of its tips may be outdated, so it'll take some work to sort through it all. Please let us know if you succeed, even for less than 28MB. This is very interesting to me, but I've not had the time to pursue it.
Title: Re: Micro Core with 16 MB of RAM
Post by: tinypoodle on August 10, 2010, 03:12:03 PM
I suspect that free shows as "used" only what's available memory, i.e not including memory usage of kernel and whatever memory is reserved for some purpose, and that is why "total" of free usually does show less than nominal RAM installed.
I had a fourmeg-box and total of free would change with size of kernel, never exceeding 2700 KB (and that with a kernel < 500 Kb).
Agreeing in spirit with bmarkus and hiro - except if you see this as an academical challenge of proof of concept.
More extended talk about what to do with a box of 16MB besides from attempting to run microcore would be in the wrong section of the forum here, i'd guess.
Title: Re: Micro Core with 16 MB of RAM
Post by: ixbrian on August 10, 2010, 04:37:49 PM
Would the "embed" boot code help?  Take a look at /init, I think "embed" will cut down your bootup memory requirements as the root filesystem won't be copied to a tmpfs filesystem which temporarily requires twice the memory of how big the root filesystem is from what I underestand. 

Brian
Title: Re: Micro Core with 16 MB of RAM
Post by: curaga on August 11, 2010, 12:29:45 AM
I have to agree, while you can get there, it will take work. Not even scatter mode will work in 16m, it's not enough ram to start udev. It will run in 20mb, but you'd still need swap to do anything useful. If you used static devices, scatter mode and removed udev, maybe MC would boot in 16mb.

Weigh in your requirements; if you don't need something recent on the base such as Microcore, you'd be much better off with a floppy distro or one designed for 4mb (basic linux?). Those ultra-low-ram ones will let your app have more free ram.
Title: Re: Micro Core with 16 MB of RAM
Post by: Rup on August 11, 2010, 01:29:56 AM
Thanks for your quick replies folks !

I intend to make the computer diskless and headless. I see it this way : boot from cdrom, tce-load -wi an ssh server and a web server, wget and untar the content of the website and then sleep.
There's no real purpose in this project, only to revive this old hardware i found in an attic.
I chose micro core because it's modern, still in dev, and quite friendly. But as some of you said, it doesn't seem the best option given my configuration (althought it might work with some efforts).

So, i'm gonna try and find some other solution (basic linux first) best suited to my vast amount of ram and come back to micro core later.

Thanks again !
Title: Re: Micro Core with 16 MB of RAM
Post by: SvOlli on August 11, 2010, 09:58:19 AM
There's no real purpose in this project, only to revive this old hardware i found in an attic.
For most projects I'll take it the other way round: I ask myself what will I use this hardware for, once I've done the revive? If I can't find a suitable answer, I'll go on to do something else. Of cause there are projects that I just do for the fun of doing it, but then I'll do it as a proof of concept and go on after that.

There are so many cool things one can do and so little time, asking the "what will I do with it, when it's done?"-question helped me a lot of times. ;)
Title: Re: Micro Core with 16 MB of RAM
Post by: Rup on August 11, 2010, 12:23:12 PM
Proof of concept it is good sir  ;)
Title: Re: Micro Core with 16 MB of RAM
Post by: PIRAT507 on October 16, 2010, 06:21:27 PM
About floppy distro's. Trinux is the best IMHO.
It loads from one floppy and is able to load the rest of the OS from the net / your ftp or http server.
Mister Franz has done a miracle.
All in RAM. Fast! booting.
I once made a netbootable version. Not very useable nowadays, as it does not support USB mice, keyboards. (new kernel needed)
Trinux has three floppies. It will fit in 16Mb of RAM, even far less.
Now I have a netbootable TinyCore. It reminds me of those good old Trinux days.
OS in RAM is the way to go!
Title: Re: Micro Core with 16 MB of RAM
Post by: PIRAT507 on October 16, 2010, 06:39:07 PM
Trinux was made on Slackware 7.2 (nowadays 10.3 is current)
Title: Re: Micro Core with 16 MB of RAM
Post by: tinypoodle on October 16, 2010, 07:23:32 PM
Umm, that would be 13.1
Title: Re: Micro Core with 16 MB of RAM
Post by: PIRAT507 on October 16, 2010, 08:29:37 PM
You are right. I made a mistake.
13.1 is right. Do excuse me please.
(I do have the iso's including sources.)
I still have 7.2 in a chroot.
Title: Re: Micro Core with 16 MB of RAM
Post by: Wayne on October 19, 2010, 12:29:03 AM
hello guys..
thanks for sharing information..
Title: Re: Micro Core with 16 MB of RAM
Post by: tinypoodle on October 19, 2010, 02:39:01 PM
technosaurus,

most interesting info indeed  :)

Looking at the output of 'ps' of OpenWRT running on my router I notice '/sbin/hotplug2 --override --persistent --max-children'
http://code.google.com/p/hotplug2/
Title: Re: Micro Core with 16 MB of RAM
Post by: curaga on October 22, 2010, 01:20:57 AM
Another - replace busybox with a cutdown version and don't use shared glibc for it- use static uclibc... using shared glibc for busybox is a complete waste of resources as soon as /sbin/init runs.  If you don't believe me run top with glibc shared... remaster and rerun top with a static uclibc build (you can get recent prebuilt versions from impactlinux.com/aboriginal)  ... the difference in ram usage exceeds the difference in size at the first run of any busybox app and since they are both in ram ...

Does this take into account the kernel-level sharing of library pages?
There are other apps linked to glibc, such as udev.

Quote
To go even further, rebuild any busybox applets that run daemonized as individual static uclibc binaries - use allnoconfig and then select only that applet. (aboriginal has a cross compiler for this too) ... or just don't run those daemons. *logd, getty, udev...(aboriginal uses oneit instead of init)

You mention two parts here - uclibc using less ram than glibc, and separation of daemons. Why the separation?

Busybox with one applet would start faster, without the applet name lookup, but lose in size due to the binary sharing. RAM use when separated should be ~the same, if not, that would be a bug.

Quote
there is a new method since 2.6.32 called devtmpfs which is a better, more simplified version of the former devfs (problems with its original incarnation are a big reason the likes of hal and udev even exist) ... the new implementation is only ~300 lines of kernel code, but is supposed to significantly speed up the boot process compared to udev  (this may not be as significant when compared to distros that have a partial static implementation of /dev though)

We took a look in the 3.x development cycle. It proved not to gain much at all, indeed due to our existing static dir.

Quote
<rambling>
.... I really wish they (kernel devs) would pick a name and stick to it though -- ramzswap (ore whatever it was called) is now zram - which conflicts with the naming of a very fast and cheap (to make ... maybe not necessarily to license) alternative cache/ram technology - so it will likely change again.
</rambling>

I understand the rename ramzswap -> zram, since it's no longer limited to swap.
Title: Re: Micro Core with 16 MB of RAM
Post by: tinypoodle on October 22, 2010, 08:12:28 PM
Another - replace busybox with a cutdown version and don't use shared glibc for it- use static uclibc... using shared glibc for busybox is a complete waste of resources as soon as /sbin/init runs.  If you don't believe me run top with glibc shared... remaster and rerun top with a static uclibc build (you can get recent prebuilt versions from impactlinux.com/aboriginal) 

Not sure why one would have to remaster for such.
I downloaded a static uclibc busybox build from that site and ran same applet from both versions side by side for direct comparison, rather impressed by the difference in mem usage.   ;D
Title: Re: Micro Core with 16 MB of RAM
Post by: curaga on October 23, 2010, 12:36:59 AM
Being curious, I did a comparison as well ;)

glibc busybox sleep vs static uclibc busybox sleep from Rob's aboriginal site.

Top did show a difference, but pmap -d showed the glibc sleep using only 32kb more ram. That's small enough to be offset by the library & binary sharing.
Title: Re: Micro Core with 16 MB of RAM
Post by: hiro on October 23, 2010, 04:08:34 AM
How about heirloom.sourceforge.net ?
I'm not completely fond of busybox :D
Title: Re: Micro Core with 16 MB of RAM
Post by: curaga on October 26, 2010, 05:38:19 AM
All applets combined the size is smaller than glibc

Since glibc has to be loaded anyway, this looks like a loss to me. The ram savings < the ram use increase from unsharable pages of the static uclibc.

Quote
If you don't separate them, then each daemon will run in a separate process and use RAM the size of busybox + whatever it needs to be writeable (I did a compromise method and just built daemonized applets as a separate ~80k binary)

No, my understanding is that the kernel shares the binary pages. Not only are they loaded only once, in our case they aren't loaded at all (tmpfs = cache, so busybox is already available without a memory copy).

I tested this by starting four 9.1mb mplayer processes. The ram increase was not 36mb, but 11mb.

Quote
The biggest win would be if it could obsolete udev, which it doesn't seem to do at least yet.

True, if the same functionality was possible without a daemon, great. But the kernel devs have taken the stance that device permissions belong in userspace, and udev is a much better solution than hotplug.
Title: Re: Micro Core with 16 MB of RAM
Post by: danielibarnes on November 04, 2010, 12:26:20 PM
Anyone interested in compiling the tinycore binaries statically against ulibc (where possible)  in order to quantify the difference? I am curious. Any significant gain would be of value if functionality were not affected, even if only available as a "remix."
Title: Re: Micro Core with 16 MB of RAM
Post by: hiro on November 04, 2010, 09:12:26 PM
I don't think stali is usable at all.
But I'm interested in a uclibcore.
I think it should support mips, arm, 64 (I'm missing this in tinycore)