ugtrain: move OS specific code to system_l.c