This is an old revision of the document!
What I did!
Bunnie visited and gave us 2 chumby ones. one had no working wifi. the other one seemed to be OK. Using the OK one
Activated it. works OK
ssh in as root, and turn off the control panel (to free up some memory and cycles)
Then make the sshd 'permanent'
Download & install silvermoon dev environment. Chmod +x the shell script and run it. This will take a bit
Download the latest SDL tarball (we used 1.2.14)
./configure --enable-video-fbcon --disable-video-x11 --disable-dga --disable-esd --disable-oss --disable-pulseaudio --disable-joystick --disable-cdrom --without-x make mount -oremount,rw / make install
Ran the test programs. Nothing happened. Kinda disappointed. So now going to backtrack
Download chumby_quake to /mnt/storage and uncompress.
Make my own 'bitops.h' file from kludged together stuff
Go into the SDL directory and run
./configure --enable-alsa --enable-static --disable-oss --disable-esd --disable-pulseaudio --disable-video-x11 --enable-video-fbcon --disable-alsa-shared make make install
run tests. Nothing happens on the display but it -says- it found stuff. Disappointed. backtrack some more
Download chumby quake bins and stick on USB key. plug it in and run from command line. Had to use
to stop mouse complaints Audio is fine, pressing the top button makes the 'gun' fire. But no video. Disappointed. backtrack some more
bunnie suggests maybe the framebuffers are swapped (seems there are two) so tried
dd if=/dev/zero of=/dev/fb0
This wipes the screen (yay) so at least we know that the framebuffer is writable and is at /dev/fb0
Now try to run quake again. Notice that the top line is the only thing that displays (easier to see this if you wipe the screen)
Look at old SDL tests - graywin, for example, 'works' but only displays top line. So its not the quake code and is something either in the library/driver/kernel
OK so looking around some more, it looks like this has come up before - and the answer is the kernel is buggy (?)
So try to install new kernel with composite vid support (hey i might need it eventually) by running the script on the forums
Realise a little too late that this is going to cause the chumby to 'brick' due to the wifi driver having incompatibilities. eit.
Follow the USB update instructions to get the kernel back. Hey its a good thing to know anyways!
So finally I use my reading comprehension to realize that really whats broken is just needing to poke the chip to tell it which FB to use. Following this helpful post I run
wget http://files.chumby.com/hacks/switch_output chmod +x switch_output stop_control_panel /mnt/storage/switch_output -l switch_fb.sh 0
It runs! But it looks like some colorspace swappage is going on. I'll fix it later
Also tried the old SDL tests and they're working good now. yay.
The 'easiest' emulator to port by far is SIemu. Its written in straight-up C, well documented and uses SDL as an underpinning.
OK much success. Now to fix it so audio works. SDL doesnt seem to know about audio device - perhaps we need to install ALSA lib first?
We configure/make'd ALSA
Trying to build SDL with ALSA (unpatched) didnt really work but then but then we realized that OSS is already in there so many we should just rebuild SDL?
Built SDL with following flags
./configure --disable-esd --disable-pulseaudio --disable-video-x11 --enable-video-fbcon --disable-alsa
compiled cleanly, ran test/loopwave and it worked! yay!
unpatched the audio and run it with new SDL that has audio. works! and keyboard works too! kpow kpow. much success.
(note used 'original' SDL not chumbyquake SDL!)
Grab the source, try to build
chumby:/mnt/storage/stella/stella-3.0# ./configure Running Stella configure... ./configure: line 341: printf: not found g++ ./configure: line 363: printf: not found 4.3.3, ok ./configure: line 493: printf: not found linux-gnu ./configure: line 504: printf: not found none found!
OK, grab an updated busybox and install it
Now printf exists, try again
./configure --disable-debugger --disable-cheats make
but gcc dies :(
g++ -Wp,-MMD,"src/emucore/.deps/PropsSet.d",-MQ,"src/emucore/PropsSet.o",-MP -O2 -Wall -Wno-multichar -Wunused -fno-rtti -fomit-frame-pointer -DUNIX -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES -DWINDOWED_SUPPORT -DSOUND_SUPPORT -DSNAPSHOT_SUPPORT -DJOYSTICK_SUPPORT -Isrc/emucore -Isrc/emucore/m6502/src -Isrc/emucore/m6502/src/bspf/src -Isrc/common -Isrc/gui -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Isrc/unix -c src/emucore/PropsSet.cxx -o src/emucore/PropsSet.o g++: Internal error: Killed (program cc1plus) Please submit a full bug report. See <http://gcc.gnu.org/bugs.html> for instructions. make: *** [src/emucore/PropsSet.o] Error 1
dmesg says we're out of memory!
[ 809.010000] ntpd invoked oom-killer: gfp_mask=0x1201d2, order=0, oomkilladj=0 [ 809.010000] [<c02ff9bc>] (dump_stack+0x0/0x14) from [<c00777f4>] (oom_kill_process+0x5c/0x1d8) [ 809.020000] [<c0077798>] (oom_kill_process+0x0/0x1d8) from [<c0077f38>] (out_of_memory+0x1dc/0x254) [ 809.030000] r8:c2aac000 r7:c0445858 r6:000001be r5:c3dec900 r4:c2a68600 [ 809.040000] [<c0077d5c>] (out_of_memory+0x0/0x254) from [<c007ab98>] (__alloc_pages_internal+0x300/0x3bc) [ 809.050000] [<c007a898>] (__alloc_pages_internal+0x0/0x3bc) from [<c007cd6c>] (__do_page_cache_readahead+0x118/0x264) [ 809.060000] [<c007cc54>] (__do_page_cache_readahead+0x0/0x264) from [<c007cf24>] (do_page_cache_readahead+0x6c/0x74) [ 809.070000] [<c007ceb8>] (do_page_cache_readahead+0x0/0x74) from [<c0075168>] (filemap_fault+0x1d8/0x448) [ 809.080000] r7:00000000 r6:c2aac000 r5:00000000 r4:00000000 [ 809.080000] [<c0074f90>] (filemap_fault+0x0/0x448) from [<c0084958>] (__do_fault+0x54/0x488) [ 809.090000] [<c0084904>] (__do_fault+0x0/0x488) from [<c0085bf0>] (handle_mm_fault+0x2f4/0x7c0) [ 809.100000] [<c00858fc>] (handle_mm_fault+0x0/0x7c0) from [<c002da64>] (do_page_fault+0xf0/0x238) [ 809.110000] [<c002d974>] (do_page_fault+0x0/0x238) from [<c002dc34>] (do_translation_fault+0x18/0x80) [ 809.120000] [<c002dc1c>] (do_translation_fault+0x0/0x80) from [<c0026254>] (do_PrefetchAbort+0x18/0x1c) [ 809.130000] r7:00000000 r6:00053790 r5:00052acc r4:ffffffff [ 809.140000] [<c002623c>] (do_PrefetchAbort+0x0/0x1c) from [<c0026dc0>] (ret_from_exception+0x0/0x10) [ 809.150000] Exception stack(0xc2aadfb0 to 0xc2aadff8) [ 809.150000] dfa0: 00000000 00052974 000002f6 000002f7 [ 809.160000] dfc0: 00000000 00052acc 00053790 00000000 00053794 0004ecfc 0005234c bed1bb2c [ 809.170000] dfe0: 00008001 bed1bb00 0002859c 00017608 60000010 ffffffff [ 809.180000] Mem-info: [ 809.180000] Normal per-cpu: [ 809.180000] CPU 0: hi: 18, btch: 3 usd: 10 [ 809.190000] Active_anon:5856 active_file:40 inactive_anon:5862 [ 809.190000] inactive_file:112 unevictable:0 dirty:0 writeback:0 unstable:0 [ 809.190000] free:285 slab:767 mapped:26 pagetables:110 bounce:0 [ 809.210000] Normal free:1140kB min:1016kB low:1268kB high:1524kB active_anon:23424kB inactive_anon:23448kB active_file:160kB inactive_file:448kB unevictable:0kB present:65024kB pages_scanned:14 all_unreclaimable? no [ 809.230000] lowmem_reserve: 0 0 [ 809.230000] Normal: 23*4kB 7*8kB 0*16kB 1*32kB 1*64kB 1*128kB 1*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB = 1140kB [ 809.240000] 377 total pagecache pages [ 809.240000] 0 pages in swap cache [ 809.250000] Swap cache stats: add 0, delete 0, find 0/0 [ 809.250000] Free swap = 0kB [ 809.250000] Total swap = 0kB [ 809.260000] 16384 pages of RAM [ 809.270000] 423 free pages [ 809.270000] 2647 reserved pages [ 809.270000] 630 slab pages [ 809.270000] 108 pages shared [ 809.280000] 0 pages swap cached [ 809.280000] Out of memory: kill process 2683 (g++) score 446 or a child [ 809.290000] Killed process 2684 (cc1plus)
if [ ! -e /mnt/storage/swap ] then echo "Making 256M swapfile" dd if=/dev/zero of=/mnt/storage/swap bs=1M count=256 mkswap /mnt/storage/swap fi swapon /mnt/storage/swap
good news: you can play ROMs if you specify them on the command line. badnews: the ROM launcher not only doesnt work, but if it tries to run it gives some assert error and then http://ladyada.net/wiki/lib/images/smaller.gifdoesnt 'release' the SDL library (or *something*) and it doesnt really work until reboot. :(
commented out the Assert in Rect.h and it all works now - this should of course be fixed but hey!
The ^C problem is discussed here printf!
R and B are swapped in SDL. whyso? Uncommented DEBUG_FBCON in SDL, got this
xres: 320 yres: 240 xres_virtual: 320 yres_virtual: 240 xoffset: 0 yoffset: 0 bits_per_pixel: 16 grayscale: 0 nonstd: 0 activate: 0 height: 240 width: 320 accel_flags: 0 pixclock: 154000 left_margin: 5 right_margin: 4 upper_margin: 3 lower_margin: 3 hsync_len: 40 vsync_len: 2 sync: 0 vmode: 0 red: 5/0 green: 6/5 blue: 5/11 alpha: 0/0