Difference between revisions of "Linux"

From SizeCoding
Jump to: navigation, search
Line 10: Line 10:
  
 
* Suggested Distributions : Any X86-based Linux distribution that allows for execution of 32-bit executables.
 
* Suggested Distributions : Any X86-based Linux distribution that allows for execution of 32-bit executables.
* Assembler: NASM
+
* Assembler: NASM (or any other linux compatible 32-bit X86 assembler)
  
 
Furthermore, it is important that the user has access to the dev/fbo framebuffer.
 
Furthermore, it is important that the user has access to the dev/fbo framebuffer.
 
This can be achieved by launching a virtual (fullscreen) console using CTRL-F3/F4 in most distributions, login and making sure the user has access to the video group. If this is not the case for some reason, you can add your user to the videogroup like so:
 
This can be achieved by launching a virtual (fullscreen) console using CTRL-F3/F4 in most distributions, login and making sure the user has access to the video group. If this is not the case for some reason, you can add your user to the videogroup like so:
  
 +
<syntaxhighlight>
 
sudo usermod -a -G video username
 
sudo usermod -a -G video username
 +
</syntaxhighlight
  
 
=== ELF Header Information ===
 
=== ELF Header Information ===

Revision as of 06:19, 8 August 2021

Introduction

For X86 related information, please check the main pages on this website, as a lot of the same tricks will also work with X86 linux sizecoding. This page goes into the specifics of getting small binaries on linux.


Linux system

This section of the sizecoding.org wiki targets 32-bit X86 based Linux binaries (ELF format).

Setting up

Setting up your development platform for Linux development:

  • Suggested Distributions : Any X86-based Linux distribution that allows for execution of 32-bit executables.
  • Assembler: NASM (or any other linux compatible 32-bit X86 assembler)

Furthermore, it is important that the user has access to the dev/fbo framebuffer. This can be achieved by launching a virtual (fullscreen) console using CTRL-F3/F4 in most distributions, login and making sure the user has access to the video group. If this is not the case for some reason, you can add your user to the videogroup like so:

<syntaxhighlight> sudo usermod -a -G video username </syntaxhighlight

ELF Header Information

To be added.

System Calls

Interaction with the Linux OS is mostly done via int 0x80 system calls. This usually includes dealing with opening files/framebuffer/audio and handling timers.

A full list of system calls and their expected register arguments is available at: https://syscalls32.paolostivanin.com/

Self compilation

To be added.

Accessing video

Accessing video

Getting something on screen

To be added soon.


Sound

It is possible to output digital audio by binding the the aplay command into your intro. APLAY is available on most of the Linux distributions and can be tested by running:

   $ aplay -c8 /dev/urandom


Make some noise

To be added soon.

Additional Resources