Building a tiny X.Org Linux System using Buildroot

This is my 3rd Buildroot howto, please read the previous ones in order to get started!


This howto was made using a Debian Squeeze 6.0 build host, with Buildroot 2011.02 (latest snapshot from the git repository)
Download and configure Buildroot :

Get the latest Buildroot and start configuring it (as a regular user)
$ cd
$ git clone git://
$ cd buildroot && make menuconfig

Toolchain —>
[X] Enable large file (files > 2 GB) support
[X] Enable WCHAR support
[X] Enable C++ support

Package Selection for the target —>
Graphic libraries and applications (graphic/text) —>
[X] X Window System, X11R7, release 7.5 —>
X Window System server type  —>
[X] Modular

X11R7 Applications —>
[X] setxkbmap        // optional, but useful if you want to use another keymap than the ‘us’ default
[X] twm
[X] xclock
[X] xinit
[X] xinput        // optional, may be useful for finding problems with input devices
[X] xkbcomp

X11R7 Drivers —>
[X] xf86-input-evdev
[X] xf86-input-keyboard
[X] xf86-input-mouse
[X] xf86-video-cirrus    // NOTE : this one is needed by qemu as it emulates a cirrus graphics board
[X] xf86-video-fbdev
[X] xf86-video-vesa

(for best compatibility, you may check all the drivers.)

[X] Liberation (Free fonts)
[X] xterm

Libraries –>
Text and terminal handling —>
[X] ncurses        // needed dependency for xterm, see

Hardware handling —>
[*] udev

Kernel —>
[X] Linux Kernel
Defconfig name : i386

Target filesystem options —>
[X] iso image (optional, only if you want to burn on a CD)
[X] initramfs for initial ramdisk of linux kernel
uncheck others

then launch the first build, will take some (damn!) time…
$ make

and test the system with qemu if build succeeded (notice the 256 megs of RAM)
$ qemu -kernel output/images/bzImage -m 256

Log in (root / no password) then
# startx

After a few seconds (X.Org tries to automatically detect the system configuration), you should be presented with the default twm desktop.

TODO : with qemu, mouse cursor movement is buggy under X, buttons work OK (may need the hal package?)

On a real machine, my USB mouse works well.

for help with input devices :

Now we can add framebuffer support for wider range of hardware in the kernel :

$ make linux-menuconfig

Let’s include them all for better compatibility

Device drivers —>
Graphics support —>
Support for frame buffer devices —>
Check everything

Rebuild and test
$ make && qemu -kernel output/images/bzImage -m 256

(Please notice, Tux now appears since we added the framebuffer drivers)

launching X again
# startx


For debugging purposes you may need to manually create an xorg.conf
# X -configure
# mkdir -p /etc/X11
# cp /etc/X11/xorg.conf
# vi /etc/X11/xorg.conf

TIP : to restore the CTRL-ALT-BACKSPACE hotkey to kill X (disabled by default), add in your xorg.conf, in the keyboard section :
Option  “XkbOptions” “terminate:ctrl_alt_bksp”

and add in a ServerFlags section :

Section “ServerFlags”
Option          “DontZap”       “false”


But we need something (a little bit) fancier!

Adding a lightweight window manager : Blackbox

on the build host
$ make menuconfig

Package Selection for the target —>
Graphic libraries and applications (graphic/text) —>
[X] blackbox

NOTE : Blackbox default configuration uses the “Bitstream Vera 9” font. If they are not included, Blackbox will terminate!
That’s why we include the “Liberation Fonts” in our system. With them it will work.

re-generate and test again
$ make && qemu -kernel output/images/bzImage -m 256

(Click on the right mouse button on the desktop for the Blackbox menu to appear)

Some more improvements, preparation of the rootfs :

$ cd <your buildroot home>/output/target

(optional) create and copy a keymap for busybox (here: french keymap file, fr.kmap) in etc
$ sudo busybox dumpkmap >etc/fr.kmap

adapt our init script etc/init.d/rcS :
$ nano etc/init.d/rcS

# load your keymap (optional)
loadkmap </etc/fr.kmap

# start X

adapt our xinitrc file
$ nano usr/lib/X11/xinit/xinitrc

# comment out the default “twm stuff”

#twm &
#xclock -geometry 50×50-1+1 &
#xterm -geometry 80×50+494+51 &
#xterm -geometry 80×20+494-0 &
#exec xterm -geometry 80×66+0+0 -name login

then add :

# set keymap for the X session (optional)
setxkbmap fr

# start an xterm
xterm &

# use blackbox as window-manager
exec blackbox

TODO : adapt blackbox’s menu

Final rebuild and test
$ cd <your buildroot home>
$ make && qemu -kernel output/images/bzImage -m 256

Now you’ve got a tiny bare X.Org system!


20 thoughts on “Building a tiny X.Org Linux System using Buildroot

  1. Salut,

    Qu’entends-tu par “tiny” ? J’ai un terminal avec 32Mo de flash, est-ce que ça peut passer dessus ?

    Merci par avance.

    • Salut,

      Si on suit le tuto, le noyau généré (contenant donc le système entier en initramfs) pèse environ 16Mo. Mais il n’y a qu’un X.Org de base, avec blackbox et xterm.
      Avec Midori et ses dépendances (gtk2, webkit etc), on approche les 40Mo!

      Donc si tu veux inclure des applis graphiques, il va falloir choisir les plus légères (il n’y a pas un choix exhaustif dans buildroot, mais on peut créer ses propres packages)

      Il est possible d’utiliser un serveur X léger (tinyX) à la place du X.Org complet, mais je ne parviens pas à faire reconnaitre le clavier avec ce système…

      • hi, well, i speak french a little bit (almost forget :D) but i see that in order to get xorg with that linux it needs about 40MB ? well thats pretty nice. and without x even less, just 16, great! i am looking arond for a while and i dont want to build linux from scratch (like that project, lfs) and this can be a way.

        but i have compiled some apps (various servers) for which I have a build scripts in
        bash and i cannot have ulibc or dietlibc … i need regular glibc. it is possible to compile whole linux with glibc? in that case i could just copy over my apps (indeed it mus be compiled for that platform, x86 or so)

        thx for reply! 🙂

  2. Hi, I tried your tutorial but it did not end well. I am using Beagleboard rev C4. System is working good unless when i write “startx” on the console.

    i also used uImage and beagleboard. What should i do? Thank you.

    After that command;

    Fatal server error:
    no screens found

    open /dev/fb0: no such file or directory

    no devices detected

    xinit: no such file or directory(errno 2): unable to connect to Xserver
    xinit: No such process(errno 3): server error.

    • Hi,

      I’m sorry, I don’t own a Beagle board so I’m not able to help much!
      (My tutorial was tailored for standard x86 PC hardware)

      Your Linux kernel seems to be lacking support for the beagleboard’s video framebuffer, try to verify in the kernel drivers section.

      Maybe you can have a look here :
      And try Buildroot’s mailing list

      Good luck

    • Sorry, don’t have it at hand anymore!

      And I’m not even sure it would be useful since Buildroot evolves quite fast, it’s better to start configuration from scratch

  3. Can you please help to configure buildroot to install wine package and to run the windows application.
    Thanks in advance

    • Hi,

      Wine is currently not in Buildroot’s supported packages (remember, buildroot is primarily targeted at the embedded devices).

      I’m sorry I can’t help, I don’t have the time nor the required competences for that.

      But you could ask in the official Buildroot mailing list.

  4. Hi! Let me just say WOW! I’ve been looking for way to build tiny, instead of XVesa or xserver-xfbdev package (on debian. Tiny framebuffer X server implementation based on kdrive X server), because I have light systems that need better than XDirectFB or XVesa – and my better system would not mind having less memory consumed either. The problem with those other solutions I’m using on low end systems now (worst is 75Mhz Pentium w/ 16MB RAM, DSL barely runs with GUI on it, but thanks to XVesa it’s possible, but neither Vesa or fbdev really use the video card to it’s potential, and trust me, with 75Mhz a Matrox Millenium from ’95 makes a big difference with it’s acceleration in use , while on modern system you wouldn’t notice speed difference between Vesa or Matrox driver with it – and for 2D only era card, Matrox was famous for it’s acceleration features.

    Now, this does give the ability to build driver(s) only for specific cards, right? Like, say, Matrox only, or Matrox, vesa and fbdev? And the nVidia proprietary drivers, I assume, can be built for this just as they can for regular build (that’s for my better system)?

    Now I also wonder how much would it take to, instead of using Damn Small Linux on those oldies to build otherwise same kinda system, but like this:
    * 2.6 kernel, but minimal build with all extra left out (as module if must, but with 750MB drive on the P75 it’s not only RAM use that I’m concerned of…). Even for joystick drivers leave only generic analog driver or if exists a one for 90’s Gravis. I have no idea why there would be one though, it works like all 3-button analog joysticks for gameport (also, USB drivers aren’t needed, it’s a P75 from ’95).
    * Some newer and/or different applications – like browser, the P75 probably has to cope with eLinks (text), Links2 (has GUI mode) and Dillo, but the others would like Swiftfox 3.6.x instead of FireFox 2.x on DSL. Larger size is compensated with leaving out applications I don’t need.
    * minimal, but for each system with driver for the card it has! No XVesa or framebuffer X – sloooowwww!

    …DSL has guide on how to build your own version of it, I don’t believe there’s anything here that can’t be applied to that.

    But while this is great for the old systems, buildroot is not really a way to build tiny for my already existing and very much not embedded Debian installation, right? So… how would you go with doing that?

    P.S. About that wine question, does buildroot not have support for adding extra non-supported applications? After all, am I not right that you can modify what’s in the image? Build outside of it if you don’t want build tools in the final image and copy the application in the image – at least that should work if the buildroot has no way to do it, after all you can compile even to whole different arcitechtures, so for different installation shouldn’t be a problem…

    • Hi,

      Lots of questions 🙂

      The 16MB 75MHz Pentium is quite a challenge!

      Yes you could try to generate a system with Buildroot, but with only 16MB RAM you have to choose a 2.6.x kernel (I could boot 2.6.27 with such low RAM if I remember well) and not use an embedded initramfs (not enough RAM to decompress it), but a regular rootfs on your hard drive.

      Also I’m afraid I’m not very savvy about tinyX and other minimal X servers. Forget about proprietary drivers with Buildroot.

      Btw, did you try Slitaz 1.0? (Maybe it would perform better than DSL on your setup)

      • I actually thought using a 2.4 kernel, as it’s fraction of 2.6 size – and of course both can be shrinked by compiling with all default built-in modules that won’t be required by that hardware… Let’s not forget that people used to run Linux with X on systems with only 8MiB RAM, maybe even just 4…. Build it light enough and it will run… Also, I might choose to use, instead of X, SVGAlib, framebuffer (FB) and DirectFB.

        Thanks for your tips on other solutions. I’ll check Slitz.

  5. hi

    i would like to know if it is possible to add a tutorial but using fedora to do the same thing. I have to do an academic work using buildroot and or tinyX or directFB, to do an small system capable of view photos. i would apreciate if u can help me

    • Hi, maybe when I have some time. It’s been a while since I played with Buildroot.
      But you should be able to tinker a bit in the meantime 🙂

  6. I am using the nuildroot tool chain, I am not getting the “Enable WCHAR support” under ToolChanin menu as well as I am not getting xf86-input-evdev under X11R7 Drivers menu. If i compile with the above mentioned config option i am getting following errors.

    Package requirements (xorg-server >= 1.4 xproto inputproto) were not met:

    Package xorg-server was not found in the pkg-config search path.
    Perhaps you should add the directory containing `xorg-server.pc’
    to the PKG_CONFIG_PATH environment variable
    No package ‘xorg-server’ found

    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.

    Alternatively, you may set the environment variables XORG_CFLAGS
    and XORG_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.

    Guide me to resolve the problem

  7. Hi,

    I am using buildroot-2015.11 version, I am able to run the xwindow from root user, but I want it (xwindow and startx) to be run from non root user. I created the guest user using the user_table.txt file. When I will run the startx. I am getting error. I am using the busybox init.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s