7

I have developed my own tiny linux file system using buildroot and busybox. I used linux-2.6.38.8 kernel configured and cross-compiled for target system(X86) according to needs.Now the filesystem is built but it has only busybox shell and it doesn't support GUI.It does not have any package-manager too.Now I want to enable GUI on it. I checked /etc but there was not any x11 directory or x11.conf file.It does not support startx too.

How can I install x11(XFree86 or Xorg) on my system Explicitly.

I also want to install a package-manager for my system.

How can this be achieved?

5

You will have to build X on your own. Begin by reading this X.Org wiki entry.

This guide is for developers who wish to build the X Window System from source. If your area of interest is limited to a single package, like a driver or an application, check with your O/S first for development facilities.

As for a package manager, you will need to choose one, satisfy all needed dependencies and then package stuff for it (just because you chose dpkg/rpm/whatever, does not mean that deb/RPM/... packages will magically work with your distro). Pacman, from Arch Linux, looks easy enough to build.

5

Ubuntu 16.04 host, Buildroot 2017.02

enter image description here

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

enter image description here

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)

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.