How to install X11 on my own Linux Buildroot system?
Solution 1
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 clicky
and thenenter
to go in-
X11R7 Applications
-
xconsole
(run byxdm
by default) xdm
-
-
-
- Graphic libraries and applications
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
Solution 2
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.
Related videos on Youtube
Sunil Chavan
Updated on September 18, 2022Comments
-
Sunil Chavan over 1 year
I am using spring framework 3 in my application. I have list of items to be shown in the dialog using JQuery. This dialog opens on click of link in the jsp page. These items need to be shown in check box list. User can select these items which I need to capture on the page. The item list is dynamic and I can access it using the list(model attribute) on the JSP page. I have code to show jquery dialog but I am stuck at how to show check box list in it. Please suggest some examples to implement this. Below is the code I am using Test.jsp
<script type="text/javascript"> $(document).ready(function() { $('#diseaseGroup_dialog').hide(); } </script> .. .. <form:radiobutton id="showdialog" path="nextAction" value="showdialog" label="show dialog" onclick="javascript: showDiseaseGroupDialog('${dataRequestFormDTO}');"/></span></div> <div id="diseaseGroup_dialog" title="Select Appropriate Disease Group"> <table id="diseaseGroup_dialog_content" class="display"> <tbody style="text-align:left"> <tr> <td>Disease group list</td> </tr> </tbody> </table> </div> .. ..
Common.js
function showDiseaseGroupDialog(dataRequestFormDTO){ $('#diseaseGroup_dialog').dialog({ height: 340, width: 660, minWidth: 650, modal: true, open: function(event, ui) { $('#diseaseGroup_dialog_content').append(" I have added this when it opened"); } }); $('#diseaseGroup_dialog').show(); }
Java beans are passed as Model attribute.
DataRequestFormDTO.java public class DataRequestFormDTO{ private String[] selectedDiseaseGroups; private Map<String, DiseaseGroupDTO> availableDiseaseGroups; public String[] getSelectedDiseaseGroups() { return selectedDiseaseGroups; } public void setSelectedDiseaseGroups(String[] selectedDiseaseGroups) { this.selectedDiseaseGroups = selectedDiseaseGroups; } public Map<String, DiseaseGroupDTO> getAvailableDiseaseGroups() { return availableDiseaseGroups; } public void setAvailableDiseaseGroups( Map<String, DiseaseGroupDTO> availableDiseaseGroups) { this.availableDiseaseGroups = availableDiseaseGroups; } } public class DiseaseGroupDTO { private String id; private String name; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
-
text about 11 yearsMaybe, you'll have to do it from the sources.
-
Renan about 11 yearsYou'll have to build X on your own.
-
Arunesh Singh about 11 yearsYou can suggest any links?
-
Stephan about 11 yearsYou'll need a lot of time on your hands for this.... x.org/wiki
-
Dave C about 11 yearsCan be very very involved but here's XF86: xfree86.org
-
Ciro Santilli Путлер Капут 六四事 almost 8 years@Stephan not any more after an X11 package was added to Buildroot :-) unix.stackexchange.com/a/306116/32558
-
-
Ciro Santilli Путлер Капут 六四事 almost 8 yearsOK, managed to get it working: unix.stackexchange.com/a/306116/32558
-
alexanderzhirov about 2 yearsCan't do the same in the 2022 version unix.stackexchange.com/questions/697669
-
Ciro Santilli Путлер Капут 六四事 about 2 years@alexanderzhirov yes, I had noticed it broke on newer buildroot as well: cirosantilli.com/linux-kernel-module-cheat/… It's just not used enough I guess, since most project users are embedded. I hope one day we'll have a distro builder that works well on both desktop and embedded, including cross arch. I did a bit of investigation at: cirosantilli.com/linux-kernel-module-cheat/linux-distro-choice but didn't find THE ONE yet.