Thursday 28 April 2016

Misc. configuration

We now have all the bricks for our lovely gaming system. A little tweaking and configuration, and everything will be perfect :-)

Configure startup resolution

For display on a HD TV, I recommend a 1280x720 resolution, which is more than enough for all the nice pixels you will display, low enough not to make the BeagleBone suffer, and standard enough to ensure that you will be able to actually have something on screen!

Edit your /boot/uboot/uEnv.txt file and simply edit/add the kms_force_mode variable as follows:
 kms_force_mode=video=HDMI-A-1:1280x720@60e  

Configure system startup

We now want to make sure that the BeagleBone Blacks starts the GPIO handling process and the GUI automatically.

The environment variables and the device tree overlay are set up with the file /etc/profile.d/pixbox.sh, as follows:
 #!/bin/bash  
 export LD_LIBRARY_PATH=/media/BBB/lib:  
 export PATH=/media/BBB/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  
 export SLOTS=/sys/devices/bone_capemgr.9/slots  
 export PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins  
 export CFLAGS="-O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=vfpv3-d16 -ffast-math"  
 export CXXFLAGS="$CFLAGS"  
 export SDL_VIDEODRIVER=fbcon  
 echo PixBox > $SLOTS  
Don't forget to make it executable (chmod a+x /etc/profile.d/pixbox.sh).

To start the GUI automatically, create the file /etc/init.d/pixbox.sh (make it executable too):
 #!/bin/bash  
 # The following part carries out specific functions depending on arguments.  
 case "$1" in  
  start)  
     if [ `cat /sys/class/net/eth0/carrier` -eq "0" ]  
     then  
         source /etc/profile.d/pixbox.sh  
         export USER=root  
         export SHELL=/bin/bash  
         export PWD=/media/BBB/pixbox/pixbox42  
         export HOME=/root  
         export NO_MENU=1  
         /media/BBB/pixbox/service/pixIo_mmap &  
         /media/BBB/pixbox/pixbox42/pixbox_gui  
     fi  
   ;;  
  stop)  
   ;;  
  *)  
   exit 1  
   ;;  
 esac  
 exit 0  
Very simple pseudo-service, but with a nice twist: we check that no carrier if found on eth0 to start the GUI. This makes things simpler for remote connection to the device: if plugged at startup, we are in "normal Linux/maintenance" mode, no GUI is started. Otherwise, start GUI.

By the way, feel free to tweak the network setup scripts to reduce startup delay (no DHCP if you wish - see /etc/networks/interfaces - , or reduce DHCP timeout - see /etc/dhcp/dhclient.conf).

Final words

This should cover most of my work, feel free to contact me if you have specific questions or if I have been too quick on some info. I will probably edit and enrich my articles as I continue fiddling with my system!

Cheers!

1 comment:

  1. Great job Alban..!! Thank you so much for all these infos..!!

    ReplyDelete