You can use an application like xmodem to transfer file over any terminal. Is the serial port you speak off a terminal, or is it also the kernel console.
If you're kernel is not noisy, then you can use your current connection to make xmodem like transfer. On the host side, you can use kermit, which is nice AND scriptable.
If you want to make your serial port raw, and you have file descriptor ttyfd opened,
here is one way to do it :
struct termios tty, orig_tty;
...
if(tcgetattr(ttyfd, &tty) < 0)
{
// error checking
}
// backup tty, make it raw and apply changes
orig_tty = tty;
cfmakeraw(&tty);
if(tcsetattr(ttyfd, TCSAFLUSH, &tty) < 0)
{
// error checking
}
...
//end of program or error path :
tcsetattr(ttyfd, TCSAFLUSH, &orig_tty)
Don't forget to restore the setting at the end of your program if you still want a good behaved terminal.