I'm using Buildroot 2018.02 to create a custom Linux to run my raspberry pi 3.
I'm trying to display a pygame window on the external hdmi screen from command line.
So far, I've been able to boot the pi3 with the default configuration running make raspberrypi3_defconfig
, I've just changed the toolchain to use glibc
instead of uClibc-ng
.
Flashing the first default configuration
make raspberrypi3_defconfig
make menuconfig
make
dd if=output/images/sdcard.img of=/dev/sdb bs=4M
The rpi boot well, I can log as root using a FTDI cable.
Adding pygame ans ssh support
I run make menuconfig
to select both open-ssh
and python3
packages and I select the external python3 package python-pygame
After reflashing, the rpi boots well and I can connect through ssh.
At this moment nothing is printed on the hdmi screen. If I open a pygame window running a python3 shell nothing happens.
# python3
Python 3.6.3 (default, Jun 17 2018, 20:05:31)
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> screen = pygame.display.set_mode((300, 200))
>>> pygame.display.flip()
>>> quit()
#
Adding X.org support
I have then enabled X.org X Window System
with the following configuration.
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
At this moment, when the rpi3 boot, I can see kernel logs on the hdmi screen. If I run startx
from command line, several windows appear as follow
However if I run again the python instructions above, the screen become totally black.
If I quit the python shell, the screen returns to the picture state.
I have also tried after exporting display with export DISPLAY=:0.0
but with the same result.
If I don't run startx
the result is the same except that console log replace the windows on the picture.
What else could I do to be able to display a pygame window from command line ?