configure: Change "sim" to "uspace", with fallout elsewhere

This commit is contained in:
Jeff Epler 2014-06-23 22:07:03 -05:00
parent 7801534668
commit 1d6c0d0646
13 changed files with 67 additions and 74 deletions

View file

@ -75,7 +75,7 @@ CheckConfig(){
MODULES_LOAD= MODULES_LOAD=
MODULES_UNLOAD= MODULES_UNLOAD=
case $RTPREFIX in case $RTPREFIX in
sim) SHM_DEV=/dev/zero;; uspace) SHM_DEV=/dev/zero;;
*) *)
for MOD in $MODULES ; do for MOD in $MODULES ; do
eval MOD=\${MODPATH_$MOD} eval MOD=\${MODPATH_$MOD}
@ -103,7 +103,7 @@ CheckConfig(){
CheckStatus(){ CheckStatus(){
case $RTPREFIX in case $RTPREFIX in
sim) uspace)
if [ -z "$($PIDOF rtapi_app)" ]; then if [ -z "$($PIDOF rtapi_app)" ]; then
exit 1 exit 1
else else
@ -152,7 +152,7 @@ CheckMem(){
Load(){ Load(){
CheckKernel CheckKernel
case $RTPREFIX in case $RTPREFIX in
sim) uspace)
;; ;;
*) *)
for MOD in $MODULES_LOAD ; do for MOD in $MODULES_LOAD ; do
@ -181,7 +181,7 @@ CheckLoaded(){
Unload(){ Unload(){
CheckKernel CheckKernel
case $RTPREFIX in case $RTPREFIX in
sim) uspace)
rtapi_app exit rtapi_app exit
ipcrm -M 0x48414c32 2>/dev/null ;# HAL_KEY ipcrm -M 0x48414c32 2>/dev/null ;# HAL_KEY
ipcrm -M 0x90280A48 2>/dev/null ;# RTAPI_KEY ipcrm -M 0x90280A48 2>/dev/null ;# RTAPI_KEY

View file

@ -85,7 +85,7 @@ ifeq ($(KERNELRELEASE),)
# The "modules" target is the gateway to the kernel module build. # The "modules" target is the gateway to the kernel module build.
default: configs userspace modules default: configs userspace modules
ifeq ($(RUN_IN_PLACE),yes) ifeq ($(RUN_IN_PLACE),yes)
ifneq ($(BUILD_SYS),sim) ifneq ($(BUILD_SYS),uspace)
@if [ -f ../bin/linuxcnc_module_helper ]; then if ! [ `stat -c %u ../bin/linuxcnc_module_helper` -eq 0 -a -u ../bin/linuxcnc_module_helper ]; then $(VECHO) "You now need to run 'sudo make setuid' in order to run in place."; fi; fi @if [ -f ../bin/linuxcnc_module_helper ]; then if ! [ `stat -c %u ../bin/linuxcnc_module_helper` -eq 0 -a -u ../bin/linuxcnc_module_helper ]; then $(VECHO) "You now need to run 'sudo make setuid' in order to run in place."; fi; fi
endif endif
endif endif
@ -463,7 +463,7 @@ clean: depclean modclean
# So that nothing is built as root, this rule does not depend on the touched # So that nothing is built as root, this rule does not depend on the touched
# files (Note that files in depends/ might be rebuilt, and there's little that # files (Note that files in depends/ might be rebuilt, and there's little that
# can be done about it) # can be done about it)
ifeq ($(BUILD_SYS),sim) ifeq ($(BUILD_SYS),uspace)
setuid: setuid:
@echo "'make setuid' is not needed for the simulator" @echo "'make setuid' is not needed for the simulator"
else else
@ -667,7 +667,7 @@ install-kernel-dep:
$(DESTDIR)$(bindir) \ $(DESTDIR)$(bindir) \
$(DESTDIR)$(sysconfdir)/linuxcnc $(DESTDIR)$(sysconfdir)/linuxcnc
$(FILE) ../rtlib/*$(MODULE_EXT) $(DESTDIR)$(EMC2_RTLIB_DIR) $(FILE) ../rtlib/*$(MODULE_EXT) $(DESTDIR)$(EMC2_RTLIB_DIR)
ifneq "$(BUILD_SYS)" "sim" ifneq "$(BUILD_SYS)" "uspace"
$(FILE) Module.symvers $(DESTDIR)$(EMC2_RTLIB_DIR) $(FILE) Module.symvers $(DESTDIR)$(EMC2_RTLIB_DIR)
$(SETUID) ../bin/linuxcnc_module_helper $(DESTDIR)$(bindir) $(SETUID) ../bin/linuxcnc_module_helper $(DESTDIR)$(bindir)
$(SETUID) ../bin/pci_write $(DESTDIR)$(bindir) $(SETUID) ../bin/pci_write $(DESTDIR)$(bindir)
@ -773,7 +773,7 @@ endif
# find a way around it. # find a way around it.
# Subdirectory: rtapi # Subdirectory: rtapi
ifneq ($(BUILD_SYS),sim) ifneq ($(BUILD_SYS),uspace)
obj-$(CONFIG_RTAPI) += rtapi.o obj-$(CONFIG_RTAPI) += rtapi.o
rtapi-objs := rtapi/$(RTPREFIX)_rtapi.o rtapi-objs := rtapi/$(RTPREFIX)_rtapi.o
endif endif
@ -825,7 +825,7 @@ obj-$(CONFIG_SAMPLER) += sampler.o
sampler-objs := hal/components/sampler.o $(MATHSTUB) sampler-objs := hal/components/sampler.o $(MATHSTUB)
# Subdirectory: hal/drivers # Subdirectory: hal/drivers
ifneq ($(BUILD_SYS),sim) ifneq ($(BUILD_SYS),uspace)
obj-$(CONFIG_HAL_PARPORT) += hal_parport.o obj-$(CONFIG_HAL_PARPORT) += hal_parport.o
hal_parport-objs := hal/drivers/hal_parport.o $(MATHSTUB) hal_parport-objs := hal/drivers/hal_parport.o $(MATHSTUB)
obj-$(CONFIG_PCI_8255) += pci_8255.o obj-$(CONFIG_PCI_8255) += pci_8255.o
@ -977,7 +977,7 @@ motmod-objs += libnml/posemath/_posemath.o
motmod-objs += libnml/posemath/sincos.o $(MATHSTUB) motmod-objs += libnml/posemath/sincos.o $(MATHSTUB)
TORTOBJS = $(foreach file,$($(patsubst %.o,%,$(1))-objs), objects/rt$(file)) TORTOBJS = $(foreach file,$($(patsubst %.o,%,$(1))-objs), objects/rt$(file))
ifeq ($(BUILD_SYS),sim) ifeq ($(BUILD_SYS),uspace)
EXTRA_CFLAGS += -fPIC -Os EXTRA_CFLAGS += -fPIC -Os
RTOBJS := $(sort $(foreach mod,$(obj-m),$(call TORTOBJS,$(mod)))) RTOBJS := $(sort $(foreach mod,$(obj-m),$(call TORTOBJS,$(mod))))
@ -997,7 +997,7 @@ $(sort $(RTOBJS)) : objects/rt%.o : %.c
$(ECHO) Compiling realtime $< $(ECHO) Compiling realtime $<
@rm -f $@ @rm -f $@
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(Q)$(CC) -c $(OPT) $(DEBUG) $(EXTRA_DEBUG) -DSIM -DSIMULATOR -DRTAPI $(EXTRA_CFLAGS) \ $(Q)$(CC) -c $(OPT) $(DEBUG) $(EXTRA_DEBUG) -DRTAPI $(EXTRA_CFLAGS) \
-MP -MD -MF "${@:.o=.d}" -MT "$@" \ -MP -MD -MF "${@:.o=.d}" -MT "$@" \
$< -o $@ $< -o $@
endif endif
@ -1021,8 +1021,8 @@ $(sort $(RTOBJS)) : objects/rt%.o : %.c
$(Q)ld -r -static -S $(LDFLAGS) -o $@ $^ $(EXTRALINK) $(MATHLIB) $(Q)ld -r -static -S $(LDFLAGS) -o $@ $^ $(EXTRALINK) $(MATHLIB)
endif endif
ifneq "$(filter normal sim,$(BUILD_SYS))" "" ifneq "$(filter normal uspace,$(BUILD_SYS))" ""
ifneq "$(BUILD_SYS)" "sim" ifneq "$(BUILD_SYS)" "uspace"
../rtlib/rtapi$(MODULE_EXT): $(addprefix objects/rt,$(rtapi-objs)) ../rtlib/rtapi$(MODULE_EXT): $(addprefix objects/rt,$(rtapi-objs))
endif endif
../rtlib/classicladder_rt$(MODULE_EXT): $(addprefix objects/rt,$(classicladder_rt-objs)) ../rtlib/classicladder_rt$(MODULE_EXT): $(addprefix objects/rt,$(classicladder_rt-objs))

View file

@ -23,8 +23,8 @@
# complex-objs := complex1.o complex2.o complex_main.o # complex-objs := complex1.o complex2.o complex_main.o
# include .../Makefile.modinc # include .../Makefile.modinc
# Currently this Makefile is only suitable for 'kbuild' and 'sim' systems, but # Currently this Makefile is only suitable for 'kbuild' and 'uspace' systems,
# there is no technical reason it cannot be extended to pre-kbuild systems. # but there is no technical reason it cannot be extended to pre-kbuild systems.
# When there is a single module and it consists of a single source file, an # When there is a single module and it consists of a single source file, an
# easier way to build modules is to invoke 'comp': # easier way to build modules is to invoke 'comp':
@ -95,7 +95,7 @@ install:
cp $(patsubst %.o,%.ko,$(obj-m)) $(DESTDIR)$(RTLIBDIR)/ cp $(patsubst %.o,%.ko,$(obj-m)) $(DESTDIR)$(RTLIBDIR)/
endif endif
ifeq ($(BUILDSYS),sim) ifeq ($(BUILDSYS),uspace)
EXTRA_CFLAGS += -DSIM -fPIC EXTRA_CFLAGS += -DSIM -fPIC
allmodules = $(patsubst %.o,%.so,$(obj-m)) allmodules = $(patsubst %.o,%.so,$(obj-m))
modules: $(allmodules) modules: $(allmodules)
@ -125,6 +125,6 @@ IS_POWERPC = test `uname -m` = ppc -o `uname -m` = ppc64
endif endif
ifeq ($(BUILDSYS),normal) ifeq ($(BUILDSYS),normal)
$(error Makefile.modinc is only suitable for 'kbuild' kernels and 'sim' systems) $(error Makefile.modinc is only suitable for 'kbuild' kernels and 'uspace' systems)
endif endif

View file

@ -157,39 +157,30 @@ RTL_MOD=""
# accept --with-realtime=<path> from commandline # # accept --with-realtime=<path> from commandline #
############################################################################## ##############################################################################
RTDIR=""
AC_ARG_ENABLE(simulator, AC_ARG_ENABLE(simulator,
[ --enable-simulator Run as a pure userspace program], [ --enable-simulator Run as a pure userspace program],
[ [
case "$enableval" in case "$enableval" in
Y*|y*) Y*|y*)
SIMULATOR=yes RTS=uspace
RTS=simulator AC_MSG_WARN([--enable-simulator is deprecated. Use --with-realtime=uspace instead.])
BUILD_SYS=sim
MODEXT=.so
MODULE_DIR=${prefix}/lib/linuxcnc/modules
AC_MSG_RESULT([configuring for simulator])
;; ;;
*)
SIMULATOR=no
esac esac
],
[
SIMULATOR=no
]) ])
AC_SUBST(SIMULATOR)
AC_ARG_WITH(realtime, AC_ARG_WITH(realtime,
[ --with-realtime=<path to realtime> Path where RTAI or RTlinux is installed], [ --with-realtime=<path to realtime> Path where RTAI or RTlinux is installed, or "uspace" for POSIX userspace],
[ case "$withval" in [ case "$withval" in
"" | y | ye | yes | n | no) "" | y | ye | yes | n | no)
AC_MSG_ERROR([You must supply a path for --with-realtime.]) ;; AC_MSG_ERROR([You must supply a path or "uspace" for --with-realtime.]) ;;
*) *)
case "$SIMULATOR" in if test ! -z "$RTS"; then
yes) AC_MSG_ERROR([--with-realtime and --enable-simulator are mutually exclusive]) ;; AC_MSG_ERROR([--with-realtime and --enable-simulator are mutually exclusive])
*) RTDIR="$withval" ;; fi
RTS="$withval" ;;
esac esac
;; ])
esac])
############################################################################## ##############################################################################
# Subsection 2.2 # # Subsection 2.2 #
@ -205,19 +196,22 @@ AC_ARG_WITH(realtime,
# rtai-config for RTAI 3.x # # rtai-config for RTAI 3.x #
############################################################################## ##############################################################################
#at this point if RTDIR is empty, we need to find RT ourselves #at this point if RTS is empty, we need to find RT ourselves
if test $SIMULATOR = yes; then if test "$RTS" = uspace ; then
RTS=sim AC_MSG_RESULT([Using userspace realtime]);
AC_PATH_PROG(PTH_CONFIG,pth-config,"") AC_PATH_PROG(PTH_CONFIG,pth-config,"")
if test "$PTH_CONFIG" = ""; then if test "$PTH_CONFIG" = ""; then
AC_MSG_ERROR([GNU PTH library is required: get it with apt-get install libpth-dev]) AC_MSG_ERROR([GNU PTH library is required: get it with apt-get install libpth-dev])
fi fi
elif test -x "$RTS" -a ! -d "$RTS"; then
AC_MSG_RESULT([Using $RTS as configure script for realtime])
else else
if test -z "$RTDIR"; then if test -z "$RTDIR"; then
DIRS="/usr/realtime-`uname -r` /usr/realtime /usr/realtime* /usr /usr/src/rtai*" DIRS="/usr/realtime-`uname -r` /usr/realtime /usr/realtime* /usr /usr/src/rtai*"
else else
DIRS="$RTDIR" DIRS="$RTS"
fi fi
RTS=""
for location in $DIRS; do for location in $DIRS; do
for subdir in . scripts bin; do for subdir in . scripts bin; do
for signature in rtai rtl realtime; do for signature in rtai rtl realtime; do
@ -303,13 +297,16 @@ case $RTS in
RTFLAGS=`$RTS --cflags` RTFLAGS=`$RTS --cflags`
KERNELDIR=`$RTS --linux` KERNELDIR=`$RTS --linux`
;; ;;
sim) uspace)
RTPREFIX=uspace RTPREFIX=uspace
RTDIR=$(pwd -P) RTDIR=$(pwd -P)
RTFLAGS=-DSIMULATOR RTFLAGS=-DUSPACE
BUILD_SYS=uspace
MODEXT=.so
MODULE_DIR=${prefix}/lib/linuxcnc/modules
esac esac
if test $RTS != sim; then if test "$RTS" != uspace; then
AC_MSG_CHECKING([for location of kernel headers]) AC_MSG_CHECKING([for location of kernel headers])
AC_ARG_WITH(kernel-headers, AC_ARG_WITH(kernel-headers,
[ --with-kernel-headers=<directory> Location for kernel headers], [ --with-kernel-headers=<directory> Location for kernel headers],
@ -331,13 +328,14 @@ AC_SUBST([RTFLAGS])
AC_SUBST([RTDIR]) AC_SUBST([RTDIR])
AC_SUBST([RTARCH]) AC_SUBST([RTARCH])
if test $RTPREFIX = sim; then case "$RTPREFIX" in
AC_DEFINE(RTAPI_SIM, [], [Realtime system is simulated]) uspace)
elif test $RTPREFIX = rtai; then AC_DEFINE(RTAPI_USPACE, [], [Realtime system is userspace]) ;;
AC_DEFINE(RTAPI_RTAI, [], [Realtime system is RTAI]) rtai)
elif test $RTPREFIX = rtl; then AC_DEFINE(RTAPI_RTAI, [], [Realtime system is RTAI]) ;;
AC_DEFINE(RTAPI_RTL, [], [Realtime system is RTL]) rtl)
fi AC_DEFINE(RTAPI_RTL, [], [Realtime system is RTL]) ;;
esac
EMC2_HOME=`(cd .. ; pwd)` EMC2_HOME=`(cd .. ; pwd)`
@ -509,7 +507,7 @@ install with "sudo apt-get install libusb-1.0-0-dev" or disable with
# compiled against. # # compiled against. #
############################################################################## ##############################################################################
if test $RTS '!=' sim; then if test $RTS '!=' uspace; then
AC_CHECK_HEADERS([$KERNELDIR/include/linux/version.h],[],[AC_MSG_ERROR([version.h not found - Is the kernel headers package installed ?])]) AC_CHECK_HEADERS([$KERNELDIR/include/linux/version.h],[],[AC_MSG_ERROR([version.h not found - Is the kernel headers package installed ?])])
# Unfortunately, many distributions (redhat, mandrake) have #defines # Unfortunately, many distributions (redhat, mandrake) have #defines
@ -1094,7 +1092,7 @@ AC_SUBST(BUILD_DOCS_HTML)
# tests and linking to mathstubs.o at a later stage. # # tests and linking to mathstubs.o at a later stage. #
############################################################################## ##############################################################################
if test "$SIMULATOR" != "yes" if test $RTS '!=' uspace
then then
AC_MSG_CHECKING([for kernel math support]) AC_MSG_CHECKING([for kernel math support])
USE_LIBM="" USE_LIBM=""
@ -1769,21 +1767,16 @@ echo "# GPL. Check out http://www.linuxcnc.org/ for more details. #"
echo "# #" echo "# #"
echo "# #" echo "# #"
echo "# It seems that ./configure completed successfully. #" echo "# It seems that ./configure completed successfully. #"
if test $SIMULATOR = yes; then
echo "# However, the configuration is for a simulator only, no RT #"
echo "# capabilities will be used. In this mode no control of hardware #"
echo "# is possible. Drivers won't be built. #"
else
echo "# This means that RT is properly installed #" echo "# This means that RT is properly installed #"
fi
echo "# If things don't work check config.log for errors & warnings #" echo "# If things don't work check config.log for errors & warnings #"
echo "# #" echo "# #"
if test "xyes" = "x$RUN_IN_PLACE"; then if test "xyes" = "x$RUN_IN_PLACE"; then
echo "# Next compile by typing #" echo "# Next compile by typing #"
echo "# make #" echo "# make #"
if test $SIMULATOR != yes; then
echo "# sudo make setuid #" echo "# sudo make setuid #"
if test $RTS = uspace; then
echo "# (if realtime behavior and hardware access are required) #"
fi fi
echo "# #" echo "# #"
echo "# Before running the software, set the environment: #" echo "# Before running the software, set the environment: #"

View file

@ -33,7 +33,7 @@ pluto_clean:
# The kernel's build system won't know how to rebuild generated files # The kernel's build system won't know how to rebuild generated files
# so modules must depend on them explicitly # so modules must depend on them explicitly
ifneq ($(BUILD_SYS),sim) ifneq ($(BUILD_SYS),uspace)
modules: \ modules: \
hal/drivers/pluto_servo_rbf.h \ hal/drivers/pluto_servo_rbf.h \
hal/drivers/pluto_step_rbf.h hal/drivers/pluto_step_rbf.h

View file

@ -1148,7 +1148,7 @@ void init_hal(void) {
PyModule_AddIntConstant(m, "HAL_OUT", HAL_OUT); PyModule_AddIntConstant(m, "HAL_OUT", HAL_OUT);
PyModule_AddIntConstant(m, "HAL_IO", HAL_IO); PyModule_AddIntConstant(m, "HAL_IO", HAL_IO);
#ifdef RTAPI_SIM #ifdef RTAPI_USPACE
PyModule_AddIntConstant(m, "is_sim", 1); PyModule_AddIntConstant(m, "is_sim", 1);
PyModule_AddIntConstant(m, "is_rt", 0); PyModule_AddIntConstant(m, "is_rt", 0);
#else #else

View file

@ -1,5 +1,5 @@
ifeq ($(BUILD_SYS),sim) ifeq ($(BUILD_SYS),uspace)
UPARPORT_SRCS := $(addprefix hal/simdrivers/, \ UPARPORT_SRCS := $(addprefix hal/simdrivers/, \
uparport.c) uparport.c)

View file

@ -67,7 +67,7 @@ $(call TOOBJSDEPS, $(HALGTKSRCS)) : EXTRAFLAGS = $(GTK_CFLAGS)
$(call TOOBJS, $(HALGTKSRCS)): Makefile.inc $(call TOOBJS, $(HALGTKSRCS)): Makefile.inc
endif endif
ifneq ($(BUILD_SYS),sim) ifneq ($(BUILD_SYS),uspace)
PCIWRITESRCS := hal/utils/pci_write.c hal/utils/upci.c PCIWRITESRCS := hal/utils/pci_write.c hal/utils/upci.c
USERSRCS += $(PCIWRITESRCS) USERSRCS += $(PCIWRITESRCS)
../bin/pci_write: $(call TOOBJS, $(PCIWRITESRCS)) ../bin/pci_write: $(call TOOBJS, $(PCIWRITESRCS))

View file

@ -518,7 +518,7 @@ int do_newinst_cmd(char *comp_name, char *inst_name) {
return -EINVAL; return -EINVAL;
} }
#if defined(RTAPI_SIM) #if defined(RTAPI_USPACE)
{ {
char *argv[MAX_TOK]; char *argv[MAX_TOK];
int m = 0, result; int m = 0, result;
@ -1062,7 +1062,7 @@ int do_loadrt_cmd(char *mod_name, char *args[])
hal_comp_t *comp; hal_comp_t *comp;
char *argv[MAX_TOK+3]; char *argv[MAX_TOK+3];
char *cp1; char *cp1;
#if defined(RTAPI_SIM) #if defined(RTAPI_USPACE)
argv[m++] = "-Wn"; argv[m++] = "-Wn";
argv[m++] = mod_name; argv[m++] = mod_name;
argv[m++] = EMC2_BIN_DIR "/rtapi_app"; argv[m++] = EMC2_BIN_DIR "/rtapi_app";
@ -1126,7 +1126,7 @@ int do_loadrt_cmd(char *mod_name, char *args[])
if ( retval != 0 ) { if ( retval != 0 ) {
halcmd_error("insmod failed, returned %d\n" halcmd_error("insmod failed, returned %d\n"
#if !defined(RTAPI_SIM) #if !defined(RTAPI_USPACE)
"See the output of 'dmesg' for more information.\n" "See the output of 'dmesg' for more information.\n"
#endif #endif
, retval ); , retval );
@ -1321,7 +1321,7 @@ static int unloadrt_comp(char *mod_name)
int retval; int retval;
char *argv[4]; char *argv[4];
#if defined(RTAPI_SIM) #if defined(RTAPI_USPACE)
argv[0] = EMC2_BIN_DIR "/rtapi_app"; argv[0] = EMC2_BIN_DIR "/rtapi_app";
argv[1] = "unload"; argv[1] = "unload";
#else #else

View file

@ -1131,7 +1131,7 @@ static int doLoadRt(char *mod_name, char *args[], connectionRecType *context)
char *cp1; char *cp1;
const char *nakStr = "SET LOADRT NAK"; const char *nakStr = "SET LOADRT NAK";
#if defined(RTAPI_SIM) #if defined(RTAPI_USPACE)
#if 0 #if 0
argv[m++] = "-Wn"; argv[m++] = "-Wn";
argv[m++] = mod_name; argv[m++] = mod_name;

View file

@ -5,7 +5,7 @@ INCLUDES += rtapi
../include/%.hh: ./rtapi/%.hh ../include/%.hh: ./rtapi/%.hh
cp $^ $@ cp $^ $@
ifeq ($(BUILD_SYS),sim) ifeq ($(BUILD_SYS),uspace)
RTAPI_APP_SRCS := \ RTAPI_APP_SRCS := \
rtapi/uspace_rtapi_app.cc \ rtapi/uspace_rtapi_app.cc \

View file

@ -58,7 +58,7 @@ static pth_uctx_t main_ctx, this_ctx;
/* data for all tasks */ /* data for all tasks */
static struct rtapi_task task_array[MAX_TASKS] = {{0},}; static struct rtapi_task task_array[MAX_TASKS] = {{0},};
/* Priority functions. SIM uses 0 as the highest priority, as the /* Priority functions. USPACE uses 0 as the highest priority, as the
number increases, the actual priority of the task decreases. */ number increases, the actual priority of the task decreases. */
int rtapi_prio_highest(void) int rtapi_prio_highest(void)

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
. rtapi.conf . rtapi.conf
if [ "$RTPREFIX" = sim ]; then if [ "$RTPREFIX" = uspace ]; then
exit 1 exit 1
fi fi