pouët.net

Go to bottom

Small intros on GNU/Linux.

category: general [glöplog]
 
I have been thinking about this for some time now, since all I have seen is
the 128bytes, and 256bytes demos for DOS. You have to go up to 4k to find
demos for Linux. Just wonder if anyone has ever tried making something
below 4k for GNU/Linux. I tried myself to make something small with
svgalib right now, but didn't get it under 1061byte (with lots of compiler
options, stripping, and gzexe) with my assembly knowledge.
Sourcecode below:

Code: main: pushl %ebp movl %esp,%ebp subl $8,%esp call vga_init addl $-12,%esp pushl $5 call vga_setmode addl $16,%esp .L5: jmp .L6 jmp .L4 .L6: jmp .L5 .L4: xorl %eax,%eax

(yes, i guess you know a lot better than the code above)
assemble with
'as source.s -o objfile.o'
compile with
'gcc objfile.o -O3 -s -nostartfiles -nostdlib -lvga'
then i user the program 'sstrip' and 'gzexe' on the binary file.
I guess Linux is just not the OS to make something below 4k on?
added on the 2003-01-01 22:39:00 by scatman scatman
if you are really serious about executables smaller than 4k you need to hack the elf format and not simply count on gzexe and friends..

A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux
added on the 2003-01-01 22:47:07 by _-_-__ _-_-__
I acually read that tutorial a while ago gathered from lnxscene.org (#demoscene @ freenode is a great channel btw), but the way I saw it there
they were able to make it 1/8th the size of the original no-hack-elf file.
If I take the 1061byte svgalib init thing and make it 8 times smaller, I
still only have 132bytes, but then again - I have gone through most of
those steps so it would make it impossible to make it 8 times smaller.
My no-hack-elf file is 4989bytes, which devided on 8 is 623bytes.
That will be around the size I will be able to make it, which it still very large.
added on the 2003-01-01 23:03:10 by scatman scatman
then again you could realize <4k executables are a bit of a silly idea ;) (on anything more than the bootloader that dos is)

i don't know, are there any 256bytes windows executable?
added on the 2003-01-01 23:14:00 by _-_-__ _-_-__
Yes, there is some for Windows. Since I don't have Windows installed I
am not able to test them, but looks like there is, along with a lot from DOS.
http://www.pouet.net/prodlist.php?page=1&type=128b&order=views
added on the 2003-01-01 23:18:42 by scatman scatman
you'll notice they say "MS-Dos, Windows"

which is using the dos executable loader in windows... actually you could
just as well create your own small binary format and make a kernel loader for it ;)
added on the 2003-01-01 23:32:19 by _-_-__ _-_-__
.. or to make it easy, just install windows and start coding DOS demos ;)
added on the 2003-01-02 01:15:05 by scatman scatman
Quote:

just as well create your own small binary format and make a kernel loader for it ;)


that is actually not bad idea. I'm sure you don't need to do anything fancy to get your code booted by lilo or grub. mode 13 and its mode-x friends should work without trouble.

Preferably you should also get back to the bootloader. It would be quite fun to have something fancy (but short) on each boot, only real trouble I guess is if you want sound. (Have fun ripping the emu10k driver from the linux kernel ;).
added on the 2003-01-02 12:25:18 by sang-soo sang-soo
the question still remains why on earth anyone would want to do that.
added on the 2003-01-02 12:58:35 by sofokles sofokles
i made http://www.daimi.au.dk/~kaae/code/small.c this some month ago as a follow up on a local newsgroup-posting at the cs. dept. i attend.
warp: I think you misunderstood the quoted message completely. It's not about writing your own kernel, just a loader for a new binary format, so that you wouldn't have to use ELF.
added on the 2003-01-02 14:18:52 by puterman puterman
If I was doing minimalized executables for unix OSes, I wouldn't be using libraries at all (especially not libraries as lame as SVGAlib). Kernel syscalls are the way. You should access the low-level framebuffer and sound devices directly or use the socket calls to talk raw X11 protocol to the X server. (Yes, X11 protocol is bloat, but a window opener + bufferdrawer is doable in less than 300 bytes in x86/elf)

And do forget those usual linkers and other development tools. They're designed for building "politically correct" binaries with all those empty "just for the looks" segments, debugging info and other bloat.

And yes, doing audiovisually impressive minimalist executables is a lot easier with MS-DOS than with an operating system :)
Yes, good idea to access the linux framebuffer directly, I have been thinking
about that myself. Guess I have to put my head into some documentation
before acting that out. And what is so lame about SVGAlib? It is really
simple, the init code is done by two C lines of svgalib syntaxes, and I
usually only use one syntax for drawing points. It is kind of bad that it does
not run in X-windows, and need root to run it since it needs to write directly
to the hardware, still it was the best thing I found to work with at the time.
added on the 2003-01-03 00:44:50 by scatman scatman
Quote:
It is kind of bad that it does
not run in X-windows, and need root to run it since it needs to write directly
to the hardware, still it was the best thing I found to work with at the time.


Khm, sorry Mr System Administrator, i'd like to watch a demo, could you SU me please? ;)
added on the 2003-01-03 07:24:29 by FooLman FooLman

login

Go to top