This page contains a step-by-step guide to porting the original Doom game (whose sources were released by Id Software) to the Jobo Giga Vu Pro device.
It is intended as a tutorial for hobbyists wishing to extend or replace the functionality of their devices in the hope that they will share their own experiences by contributing their custom applications to the community by means of this site. Be sure to also read the documentation.
DISCLAIMER: follow these steps at your own risk. I (or Jobo for that matter) will not be held responsible if you screw up your device.
Step 1: Getting the Files
You will need the following:
- crosscompiler
- linux kernel
- barebones filesystem
- massstorage program
- tutorial files
These can all be found here. We suggest you untar them all in the following directory: /opt/SDK. Note that you will need about 500 MB of free disk space during the build process.
Step 2: Installing the Cross Compiler
Create the following directory: /usr/local/arm/. Untar the arm-linux-gcc-2.95.3.tar.gz in this directory. Next, add /usr/local/arm/2.95.3/bin to your PATH. Test that everything is installed correctly by typing:
# arm-linux-gcc -v gcc version 2.95.3 20010315 (release)
Step 3: Compiling the Kernel
Untar the linux-2.4.19-rmk4-pxa2-xsilo1_src.tar.gz into /opt/SDK/linux and type the following:
# cd /opt/SDK/linux # make pdsl_p4_xsilo_config
# make oldconfig
# make dep
# make zImage
The compiled kernel image is now in /opt/SDK/linux/arch/arm/boot/zImage.
Step 4: Building DOOM Filesystems
Untar the tutorial_files.tar.gz into /opt/SDK/tutorial. This tarball contains the following packages you need to build the DOOM filesystem:
- Xwindows
- smpeg
- SDL
- SDL_mixer
- SDL_net
- prboom
It also contains a patch for Xwindows and for prboom that adds support for the Giga Vu Pro output and input devices.
If you wish to build everything in one go you can simply type:
# cd /opt/SDK/tutorial
# ./buildscript
This should produce the doom filesystem images (filesystem.cramfs and storage.jffs2). See the documentation if you do not know what these files are.
However, if you wish to learn how this was done you can follow these steps instead (basically the contents of the buildscript):
Build X windows
First untar it:
# tar -zxf X430src-1.tgz
# tar -zxf X430src-2.tgz
# tar -zxf X430src-3.tgz
Then patch it:
# patch -p0 < X430.patch
and finally crosscompile it:
# cd xc
# make World
# cd ..
you will see a lot of output messages; just ignore them and proceed to the second step when done building.
Build SDL
First untar it:
# tar -zxf SDL-1.2.5.tar.gz
Then crosscompile it:
# cd SDL-1.2.5
# NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --enable-cdrom=no --enable-alsa=no --enable-esd=no --enable-arts=no --enable-nas=no --enable-diskaudio=no --enable-mintaudio=no --enable-nasm=no --enable-video-x11=yes --enable-video-fbcon=no --enable-video-directfb=no --enable-video-ps2gs=no --enable-video-xbios=no arm-unknown-linux-gnu --prefix=/opt/SDK/built/ --with-x --x-includes=/opt/SDK/xc/exports/include/ --x-libraries=/opt/SDK//xc/exports/lib
# make
# make install
# cd ..
Build smpeg
First untar it:
# tar -zxf smpeg-0.4.4.tar.gz
Then crosscompile it:
# cd smpeg-0.4.4
# LDFLAGS="-Wl,-rpath-link,/opt/SDK/xc/exports/lib" NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --prefix=/opt/SDK/built/ --with-sdl-prefix=/opt/SDK/built/ arm-unknown-linux-gnu --disable-sdltest --enable-gtk-player=no
# make
# make install
# cd ..
Build SDL_mixer
First untar it:
# tar -zxf SDL_mixer-1.2.5.tar.gz
Then crosscompile it:
# cd SDL_mixer-1.2.5
# LDFLAGS="-Wl,-rpath-link,/opt/SDK/xc/exports/lib" NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --prefix=/opt/SDK/built/ --with-sdl-prefix=/opt/SDK/built/ arm-unknown-linux-gnu --disable-sdltest --with-smpeg-prefix=/opt/SDK/built/ --disable-smpegtest
# make
# make install
# cd ..
Build SDL_net
First untar it:
# tar -zxf SDL_net-1.2.5.tar.gz
Then crosscompile it:
# cd SDL_net-1.2.5
# LDFLAGS="-Wl,-rpath-link,/opt/SDK/xc/exports/lib" NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --prefix=/opt/SDK/built/ --with-sdl-prefix=/opt/SDK/built/ arm-unknown-linux-gnu --disable-sdltest --enable-gui=no
# make
# make install
# cd ..
Build prboom
First untar it:
# tar -zxf prboom-2.2.3.tar.gz
Then patch it:
#
patch -p0 < prboom-2.2.3.patch
Then crosscompile it:
# cd prboom-2.2.3
# LDFLAGS="-Wl,-rpath-link,/opt/SDK/xc/exports/lib" NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --prefix=/opt/SDK/built/ --with-sdl-prefix=/opt/SDK/built/ arm-unknown-linux-gnu --disable-sdltest --disable-i386-asm --disable-highres --without-x
# make
# make install
# cd ..
Download Id software Doom Shareware Levels
Download the DOOM shareware levels from Id Software. As they are not open source we can not distribute them via sourceforge:
# wget ftp://ftp.idsoftware.com/idstuff/doom/win95/doom95.zip
# unzip -qq -d doom95 doom95.zip Build DOOM Filesystems
First untar the barebones filesystems:
# tar -zxf barebones_filesystems.tar.gz
#
mv barebones_filesystems filesystems
Next, put the required libs and binaries you just built at the right locations:
# cp -dpR built/games filesystems/ro/usr/
# cp -dpR built/lib/lib*.so* filesystems/ro/usr/lib/
# mkdir filesystems/ro/usr/share
# cp -dpR built/share/games/ filesystems/ro/usr/share
# cp doom95/DOOM1.WAD filesystems/ro/usr/share/games/doom/doom1.wad
# tar -zxf timidity.tar.gz
# mkdir filesystems/ro/usr/local/lib
# mv timidity filesystems/ro/usr/local/lib/
# cp -dpR xc/lib/X11/libX11.so* filesystems/ro/usr/lib/
# cp -dpR xc/lib/Xext/libXext.so* filesystems/ro/usr/lib/
# cp -dpR xc/lib/freetype2/libfreetype.so* filesystems/ro/usr/lib/
# cp -dpR xc/programs/Xserver/Xfbdev filesystems/ro/usr/bin/
# ldconfig -r filesystems/ro
Next, make a startup script called /etc/init.d/rc.launch which will be called at startup from /etc/init.d/rc.sysinit:
# echo -e "#!/bin/sh\nexport DISPLAY=\":0.0\"\n/usr/bin/Xfbdev -noreset -screen 240x320@270 -br -s 0 &\n/usr/games/prboom &\n" > filesystems/ro/etc/init.d/rc.launch
# chmod a+x filesystems/ro/etc/init.d/rc.launch
And finally, build the filesystem images:
# mkfs.cramfs filesystems/ro filesystem.cramfs
# mkfs.jffs2 -d filesystems/rw -e 0x00040000 -o storage.jffs2 -p 0x00060000 -l
Step 5: Flashing the DOOM Application
As described in the documentation to flash the Giga Vu Pro device you just have to put the zImage, filesystem.cramfs and storage.jffs2 images on the hard disk and reboot the device.
Update: some devices also need to the MD5 checksums of the files in order to flash the new images. You can create these by typing "md5sum -b filename > filename.md5" where filename is zImage, filesytem.cramfs and storage.jffs2.
The upgrade mechanism looks for those files and will flash them over the original application. You can always go back to the original application by putting the firmware files from Jobo's site back on the hard disk (see also important note about USB Mass Storage Switch below !).
Other Steps:
The following steps were already done in step 4 when building the DOOM filesystems but if you wish to build your own filesystems you should always follow at least these two.
Building USB Mass Storage Switch
WARNING: If you build your own filesystem you will have to call "massstorage on" in order to disconnect the hard disk from the xscale processor and enable USB Mass Storage functionality. If you fail to do so you will no longer be able to put new images on the hard disk via USB from the PC and will thus no longer be able to flash new images or revert to the original application! See also the RS232 page for a way to recover from this.
Since the DOOM filesystem has no use for the hard disk, the "massstorage on" call is made right in the startup script (/etc/init.d/rc.sysinit). If your application uses the harddisk you should foresee a user initiated action that calls the code in massstorage.c when you wish to switch from normal hard disk operation to USB mass storage operation. This way you will have an opportunity to transfer files to and from PC, including new images to be flashed. Should you forget this step, you will have to open the device, get the hard disk out and put it in a PC in order to get the new image files in there or solder a serial connection.
To build massstorage, untar massstorage.tar.gz into /opt/SDK/massstorage and type:
# cd /opt/SDK/massstorage # make
You can now copy the executable to the barebones filesystem below.
Building from Barebones Filesystem
This filesystem has two components: a read-only located in the ro subdirectory and a read-write in the rw subdirectory. At run-time the rw subdirectory is mounted to the /rw directory of the read-only filesystem (see ro/etc/fstab).
The filesystem has just the bare necessities. You can add your own applications to it and launch them from ro/etc/init.d/rc.sysinit.
To build the filesystems, untar barebones_filesystems.tar.gz into /opt/SDK/barebones_filesystems and type:
# mkcramfs barebones_filesystems/ro filesystem.cramfs
# mkfs.jffs2 -d filesystems/rw -e 0x00040000 -o storage.jffs2 -p 0x00060000 -l
The filesystem image is now located in /opt/SDK/filesystem.cramfs. The storage image is now located in /opt/SDK/storage.jffs2. See the documentation if you do not know what these files are.
|