RUNNING JSDL AT THE LINUX CONSOLE

Big Questions

Why? Because I want to do non-X console guis in java.

Why not j2se1.4 java2d Fullscreen? Because I wanted to do non-X console guis in java without any real/fake X server running.

Can it work for embedded java GUI, games and media players? Maybe, depends what you call embedded and what your constraints are.

Why not Java ported to Microwin? Because its DOG SLOW, has a poor widget set and locks the framebuffer for you. What if I wanted to run mplayer in Microwin?

Why not SDL for Perl or Python? Just Because.

Why not a new GraphicsDevice for J2se1.4 instead of a custom gui engine? Good idea. We couldn't do it with 1.2, because even if you successfully registered a new GraphicsDevice, GraphicsContext, etc, you still could not affect java.awt.Graphics. There would be no way to make a component paint(java.awt.Graphics g) to your device. However, if we can now in 1.4, porting Swing would become a non issue.

Why not java for FBDev? Hmmm... I like it, but what about audio?

To get demo to work at the framebuffer console (without Xwindows), see the HOWTO doc on getting SDL to run from the console. I got this console stuff working ONLY with Redhat, not my favorite Linux "Mandrake".


here's an old copy of my doc


RUNNING JSDL FROM THE CONSOLE
---------------------------
 

 SDL offers a single API that can render graphics in both a Windowing 
 environment and directly to a graphics device.  While SDL seems to 
 work fine in X-Windows, I had to do extra configuration to make it 
 work at the console.

 WHY WOULD YOU CARE? 
 
 If you want to have java graphics programs come up at the console 
 without having a real or psudo x server running. This is
 pretty interesting for set top boxes, embedded applications, 
 gui installers, etc.
 

 INITIALIZING FRAMEBUFFER

 The first step to getting JSDL to run without a windowing system 
 is setting the video mode in the kernel.  I have been able to run 
 JSDL applications at the console *only* after configuring the kernel 
 to boot with a specific framebuffer VESA video mode.  For the sake of 
 this explanation, I will use Redhat 7.2 and the Grub boot loader 
 (Since they're the only one's I've tried :) ).

 WHAT DOES THIS MEAN?

 When you boot Redhat, you'll notice the console has a picture at the 
 top and text in small letters scrolling by. This is because this part 
 of the boot sequence is set to run in a specific VESA mode.   However at 
 some point during the system boot, the picture disappears and the font 
 size goes back that of a normal VGA console.  What I've had to do is 
 set Redhat to always finish booting in some arbitrary VESA framebuffer mode.
  

  COMMON VESA MODES
  Below is a list of some of the VESA modes available with most 
  video card framebuffers.  You're available modes may differ 
  depending on your video adapter card / driver's capabilities.  
  In this example lets stick to 1024x768 with 64k colors.
   

   # VESA framebuffer console @ 1024x768x64k
   vga = 791
   # Normal VGA console
   # vga = normal
   # VESA framebuffer console @ 1024x768x64k
   # vga=791
   # VESA framebuffer console @ 1024x768x32k
   # vga=790
   # VESA framebuffer console @ 1024x768x256
   # vga=773
   # VESA framebuffer console @ 800x600x64k
   # vga=788
   # VESA framebuffer console @ 800x600x32k
   # vga=787
   # VESA framebuffer console @ 800x600x256
   # vga=771
   # VESA framebuffer console @ 640x480x64k
   # vga=785
   # VESA framebuffer console @ 640x480x32k
   # vga=784
   # VESA framebuffer console @ 640x480x256
   # vga=769
    

    CONFIGURING THE KERNEL AT BOOT - GRUB

    Boot loaders are able to set many of  bootup options for your kernel.  
    I will use GRUB for the sake of my examples.

    Remember this value ---  "vga=791"

    * CONFIGURING GRUB

    Grub's primary configuration file "/boot/grub/grub.conf" will 
    look very similar to the following after install.

    default=0
    timeout=10
    splashimage=(hd0,0)/grub/splash.xpm.gz
    title Red Hat Linux (2.4.18-3)
            root (hd0,0)
            kernel /vmlinuz-2.4.18-3 ro root=/dev/hda2
            initrd /initrd-2.4.18-3.img

    Notice the line specifying which kernel file to load.  Your 
    root device (/dev/hda2)  will likely be different than mine.

*  SETTING THE VESA MODE IN GRUB

As mentioned earlier, I chose to use 1024x768x64k mode.  (vga=791)
Your video card may not like this mode and will not be able to set this 
on boot.   If that is the case, you should try another of the 
many  VESA modes available (and not limit your testing to small set 
of choices above.)
			     
Simply change the kernel line
from:
	kernel /vmlinuz-2.4.18-3 ro root=/dev/hda2
to:
	kernel /vmlinuz-2.4.18-3 ro root=/dev/hda2 vga=791
and save the file.

* TESTING THE CHANGES TO GRUB

At this point, you simply reboot linux and get out your reading glasses 
to read the small fonts.

* TESTING JSDL

Now that the Framebuffer has been initialized, you should be 
able to try some cool stuff.  Find a JSDL example that you got 
working last time you were Xwindows.  Execute that from the command 
line without bringing up X windows.