Ubuntu 16.04 host, Buildroot 2017.02

Current Buildroot has an X11 package which makes things "easy" for us: https://github.com/buildroot/buildroot/tree/2016.05/package/x11r7
This repo builds the entire system for you in a single command: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/b134f3958884ce1fce2dd9d31d19ab0c0fbe9089#x11
Alternatively, here is a pre-parared .config
file: https://github.com/cirosantilli/buildroot-configs/blob/44b45b5c7f68e44abcda360a2b980f8301901a9a/qemu_x86_64_x11_defconfig
This is the minimal X11 specific configurations I managed get away with is:
BR2_PACKAGE_XAPP_TWM=y
BR2_PACKAGE_XAPP_XCALC=y
BR2_PACKAGE_XAPP_XCLOCK=y
BR2_PACKAGE_XAPP_XEYES=y
BR2_PACKAGE_XAPP_XINIT=y
BR2_PACKAGE_XDRIVER_XF86_INPUT_KEYBOARD=y
BR2_PACKAGE_XDRIVER_XF86_INPUT_MOUSE=y
BR2_PACKAGE_XDRIVER_XF86_VIDEO_CIRRUS=y
BR2_PACKAGE_XDRIVER_XF86_VIDEO_FBDEV=y
BR2_PACKAGE_XDRIVER_XF86_VIDEO_VESA=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XSERVER_XORG_SERVER=y
BR2_PACKAGE_XTERM=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_USE_WCHAR=y
Here is how you can add those options to your existing .config
: Is it possible to use config fragments with Buildroot's .config? | Stack Overflow
How I found the options out: make menuconfig
, search option names with /
, then work backwards dependes
from xeyes
.
Unfortunately, you still need to know what you are doing, mainly because of situations where two different packages implement an interface (e.g. X.Org Modular vs KDrive both of which implement an X11 server), and none is selected by default.
This article helped a lot:
Building a tiny X.Org Linux System using Buildroot | agentoss.wordpress.com
Then just the usual:
make BR2_JLEVEL=$(nproc)
qemu-system-x86_64 \
-enable-kvm \
-M pc \
-m 512 \
-kernel output/images/bzImage \
-drive file=output/images/rootfs.ext2,if=virtio,format=raw \
-append root=/dev/vda \
-net nic,model=virtio \
-net user
And from inside QEMU:
root
startx
Image size: 28M.
Outcome
An archaic X11 system!
And it behaves just like on this video: https://upload.wikimedia.org/wikipedia/commons/transcoded/5/52/TWM_without_configuration.ogv/TWM_without_configuration.ogv.480p.webm
In particular, this archaic window manager does not have an X close button on menu bars: you had to:
- click on the desktop
- select "kill" from a menu
- select the window you want to kill
startx
then passes /etc/X11/xinit/xinitrc
to xinit
, which calls it after starting up the GUI. The default xinitrc
contains:
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login
which starts our window manager twm
(try changing it for one of the other managers for which Buildroot has packages), and the programs we see on the screen. TODO what is that exec xterm
part? Why the exec
?
x11vnc

When you move away from the emulator to a real device, x11vnc
dispenses you from buying a display: it opens the screen as a window in your host, and can even send mouse clicks to the device.
Enable the x11vnc
package on Buildroot and rebuild.
To test on QEMU first, use the options (see also How to SSH from host to guest using QEMU? | Unix & Linux Stack Exchange
):
-net nic,model=virtio \
-net user,hostfwd=tcp::5901-:5900
then on guest startx
, and run:
x11vnc
And back on host:
sudo apt-get install vinagre
vinagre localhost::5901
Outcome:
- on left, QEMU running X11, x11vnc and glmark2
- on right, vinagre on host, showing the exact same thing
- I can click and interact with either one, and the other updates instantly
See also: How to set up Raspberry Pi without a monitor? | Raspberry Pi Stack Exchange
Display manager (failed attempt)

If you want to forget about the terminal completely, also enable:
- Target packages
- Graphic libraries and applications
X.Org X Window System
: both click y
and then enter
to go in
X11R7 Applications
xconsole
(run by xdm
by default)
xdm
Now when you start QEMU, you are presented with a graphical login screen like "modern" distros:
TODO: cannot login. Username root
/ empty password was working for me on another test with ALL X11 packages installed. xdm
puts logs under /var/log/xdm.log
, and you can get a TTY shell to inspect it with: How can I ctrl-alt-f# to get to a TTY in a QEMU session? | Ask Ubuntu
The call chain that starts the display manager is:
/init
(provided by BusyBox)
/etc/inittab
line ::sysinit:/etc/init.d/rcS
/etc/init.d/rcS
/etc/init.d/S99xdm
/usr/bin/xdm