Gentoo Forums
Gentoo Forums
Quick Search: in
[unsolved] dosbox on i686-pc-linux-uclibc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
DOSBoy
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2005
Posts: 84

PostPosted: Sun Jun 15, 2008 11:58 am    Post subject: [unsolved] dosbox on i686-pc-linux-uclibc Reply with quote

I've found myself at wit's end trying to make dosbox run with sound on i686-pc-linux-uclibc.

Here's the scenario: I'm trying to build a minimal linux image for the playing of dos games. I have a (mostly) working setup involving alsa-lib, alsa-utils, busybox, dosbox, ncurses, sdl, sdl-net, sdl-sound, uclibc and udev (+ some other gaftape and bubblegum holding it all together). It works until I try to turn on sound. Then dosbox locks up the system when I try to start it. I know dosbox works, because I can run it (it even works with nosound=true in dosbox.conf, and sound compiled in). I know alsa works because I can get sound with `cat /dev/urandom | aplay -t raw -`, or by running aplay on a .wav. I can't get any diagnostics from the console because sdl takes over. I've tried piping the output to netcat but I don't get anything before the system locks up. Hence, I'm out of ideas.

If anyone feels brave enough to tackle this, I have uploaded my buildscripts:
http://rapidshare.de/files/39725201/dosgamer-kernel-0.01.tar.bz2.html
You'll need to emerge crossdev and run `crossdev -t i686-pc-linux-uclibc` before you begin, but then ./configure && make dosgamer.bzImage will (eventually) produce a kernel image. The configure script can be used to select mirrors.

If there's more information I can provide to help, please let me know.


Last edited by DOSBoy on Sun Jun 22, 2008 12:57 am; edited 1 time in total
Back to top
View user's profile Send private message
freelight
Apprentice
Apprentice


Joined: 12 Jun 2004
Posts: 295
Location: NYC, NY, USA

PostPosted: Sun Jun 15, 2008 4:26 pm    Post subject: Reply with quote

If you're going for minimal, why not just use FreeDOS?
If you do need to use Linux, try following these instructions rather than using crossdev. If you intend to do this without hosing your current installation, use a chroot jail or a virtual machine.
_________________
"If ignorance is bliss, why aren't more people happy?" --Thomas Jefferson

"Let the gremlins eat your soul... it's invigorating." --LD
Back to top
View user's profile Send private message
DOSBoy
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2005
Posts: 84

PostPosted: Sun Jun 15, 2008 10:24 pm    Post subject: Reply with quote

freelight wrote:
If you're going for minimal, why not just use FreeDOS?

Because nobody makes sound drivers or network drivers (well, there is an UNDI version of the network driver but I'd like sound) any more. The point behind all this is to be able to boot a lightweight image at my uni's computer labs to play games. I've had this setup 'working' with a DOS before, but then there is also the IPX problem. All the networking programs seem to be really fragile (e.g., Kahn (an IPX-over-TCP/IP tunnel) is the only one I've found that works, but I only have the windows version of the server, the website is long gone and even that breaks on some games in my setup.)

freelight wrote:
If you do need to use Linux, try following these instructions rather than using crossdev. If you intend to do this without hosing your current installation, use a chroot jail or a virtual machine.

That's not really the problem. I've got a working toolchain and I can build running code. It's just that there's some weirdness between alsa-lib, SDL_sound and dosbox. Or am I misunderstanding you?

If anyone knows how I can get some better log info, I'd be happy to try and help myself.

Thanks for the suggestions.
Back to top
View user's profile Send private message
DOSBoy
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2005
Posts: 84

PostPosted: Tue Jun 17, 2008 12:09 am    Post subject: Reply with quote

It looks like SDL_sound is (one of) the culprit(s). If I put a wav in the initramfs and try to play it, it'll work fine with aplay (modulo a lot of underruns) but playsound will just segfault. Any ideas on how to track it down further?
Back to top
View user's profile Send private message
DOSBoy
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2005
Posts: 84

PostPosted: Tue Jun 17, 2008 10:59 pm    Post subject: Reply with quote

The plot thickens...

I threw together this quick test based on the SDL examples:
Code:

#include <SDL.h>
extern void fill_audio(void *udata, Uint8 *stream, int len);
static Uint8 *audio_chunk;
static Uint32 audio_len;
static Uint8 *audio_pos;
int main(int argc, char *argv[]){
  SDL_AudioSpec wanted;
  SDL_AudioSpec wav_spec;
  SDL_AudioCVT cvt;
  SDL_Init(SDL_INIT_AUDIO);
  wanted.freq = 44100;
  wanted.format = AUDIO_S16;
  wanted.channels = 2;    /* 1 = mono, 2 = stereo */
  wanted.samples = 1024;  /* Good low-latency value for callback */
  wanted.callback = fill_audio;
  wanted.userdata = NULL;
  if ( SDL_OpenAudio(&wanted, NULL) < 0 ) {
    fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
    return -1;
  }
  SDL_PauseAudio(1);
  if(SDL_LoadWAV("test.wav", &wav_spec, &audio_chunk,
                 &audio_len) == NULL){
    fprintf(stderr, "SDL_LoadWAV H8S U: %s\n", SDL_GetError());
    return -1;
  }
  SDL_BuildAudioCVT(&cvt, wav_spec.format, wav_spec.channels, wav_spec.freq,
                    wanted.format, wanted.channels, wanted.freq);
  cvt.buf = malloc(audio_len * cvt.len_mult);
  memcpy(cvt.buf, audio_chunk, audio_len);
  SDL_ConvertAudio(&cvt);
  SDL_FreeWAV(audio_chunk);
  audio_pos = cvt.buf;
  SDL_PauseAudio(0);
  while ( audio_len > 0 ) {
    SDL_Delay(100);         /* Sleep 1/10 second */
  }
  SDL_CloseAudio();
  SDL_Quit();
  return 0;
}
void fill_audio(void *udata, Uint8 *stream, int len)
{
  if ( audio_len == 0 )
    return;
  len = ( len > audio_len ? audio_len : len );
  SDL_MixAudio(stream, audio_pos, len, SDL_MIX_MAXVOLUME);
  audio_pos += len;
  audio_len -= len;
}

It works fine on my x86_64-unknown-linux-gnu system, but segfaults on my i686-pc-linux-gnu system. Anyone have an idea on how to get more detailed information on what's going wrong?
Back to top
View user's profile Send private message
DOSBoy
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2005
Posts: 84

PostPosted: Sun Jun 22, 2008 12:57 am    Post subject: Reply with quote

In the end, I gave up and switched to glibc.
Back to top
View user's profile Send private message
wah_wah_69
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2003
Posts: 139

PostPosted: Sun Jun 22, 2008 8:27 am    Post subject: Reply with quote

I know I'm late but...

Was libsdl compiled too with uclibc?

Because maybe the problem wasn't in that code you posted but in the sdl implementantion.
_________________
Be good and if you can't be good, be careful.
emerge -p rootkit
Back to top
View user's profile Send private message
DOSBoy
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2005
Posts: 84

PostPosted: Sun Jun 22, 2008 10:27 pm    Post subject: Reply with quote

Yeah, I configured libSDL with --host=i686-pc-linux-uclibc. That worked fine; I could run SDL apps (even dosbox) with sound disabled.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum