This patchset makes the cross compilation of rt-app with static linkage easier by updating the conditional dependency of rt-app of library and fixing some aarch64 issue
Vincent Guittot (5): rt-app: add json bits header file rt-app: remove conditional dependency with libjson-c rt-app: conditionally compile libdl rt-app: fix syscall number definition rt-app: Add static cross compilation description
Makefile.am | 5 +++++ configure.ac | 22 ++++++---------------- doc/tutorial.txt | 25 ++++++++++++++++++++++++- libdl/dl_syscalls.h | 28 ++++++++++++++++++++++++++-- src/Makefile.am | 5 ++++- src/rt-app_parse_config.c | 2 +- 6 files changed, 66 insertions(+), 21 deletions(-)
when we execute 'make' command, we meet error message as follows.
./rt-app/src/rt-app_parse_config.c:773: undefined reference to `is_error'
Let's append <json-c/bits.h> header file into rt-app_parse_config.c
Signed-off-by: Geunsik Lim geunsik.lim@samsung.com [fix minor typo] [use json-c path instead of json] Signed-off-by: Vincent Guittot vincent.guittot@linaro.org
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- src/rt-app_parse_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index f4ac5cf..ef802f1 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include <json-c/bits.h> #include "rt-app_parse_config.h"
#define PFX "[json] "
rt-app can't run any more without using libjson-c since json file is the only way to provide the description of a use case
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- configure.ac | 12 +----------- src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac index 50d6f76..6b24f11 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,7 @@ AC_HEADER_STDC AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([m], [round]) AC_CHECK_LIB([rt], [clock_gettime]) +AC_CHECK_LIB([json-c], [json_object_from_file])
AC_ARG_WITH([deadline], [AS_HELP_STRING([--with-deadline], @@ -23,17 +24,6 @@ AS_IF([test "x$with_deadline" != xno], [AC_DEFINE([DLSCHED], [1], [Define if you have SCHED_DEADLINE support]) ])
-LIBJSON= - AC_CHECK_LIB([json-c], [json_object_from_file], - [AC_SUBST([LIBJSON], ["-ljson-c"]) - AC_DEFINE([JSON], [1], [Define if you have libjson-c]) - ], - [AC_MSG_FAILURE([libjson-c test failed (use --without-json-c to disable or install json-c)])], - [-ljson-c] - ) - -AM_CONDITIONAL([AMJSON], [ test x$with_json != xno]) - AC_ARG_VAR([LOGLVL], [verbosity level, from 0 to 100. 100 is very verbose])
if test -z "${LOGLVL}";then diff --git a/src/Makefile.am b/src/Makefile.am index ca734d2..9bca1dc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,5 +3,5 @@ AM_CPPFLAGS = -I$(srcdir)/../libdl/ bin_PROGRAMS = rt-app rt_app_SOURCES= rt-app_types.h rt-app_args.h rt-app_utils.h rt-app_utils.c rt-app_args.c rt-app.h rt-app.c rt_app_SOURCES += rt-app_parse_config.h rt-app_parse_config.c -rt_app_LDADD = $(QRESLIB) ../libdl/libdl.a $(LIBJSON) +rt_app_LDADD = $(QRESLIB) ../libdl/libdl.a dist_bin_SCRIPTS = $(srcdir)/../doc/workgen
sched_setattr syscall has been added in v3.14 with deadline scheduler. This new syscall is not always implemented in the lib and libdl is used in this case.
We add a test on the presence of sched_setattr in the system environment and compile libdl iff sched_setattr has not been already defined by another library
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- Makefile.am | 5 +++++ configure.ac | 10 +++++----- src/Makefile.am | 5 ++++- 3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 3e4d129..ad50fa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,6 @@ +if SET_DLSCHED SUBDIRS = libdl src +else +SUBDIRS = src +endif + diff --git a/configure.ac b/configure.ac index 6b24f11..d4d3df8 100644 --- a/configure.ac +++ b/configure.ac @@ -9,20 +9,20 @@ AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/rt-app.c]) AC_HEADER_STDC + AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([m], [round]) AC_CHECK_LIB([rt], [clock_gettime]) AC_CHECK_LIB([json-c], [json_object_from_file]) +AC_CHECK_FUNCS(sched_setattr, [], [])
AC_ARG_WITH([deadline], [AS_HELP_STRING([--with-deadline], - [Add support for SCHED_DEADLINE])], - [], + [Add support for SCHED_DEADLINE])], + [AC_DEFINE([DLSCHED], [1], [Define if you have SCHED_DEADLINE support])], [with_deadline=no])
-AS_IF([test "x$with_deadline" != xno], - [AC_DEFINE([DLSCHED], [1], [Define if you have SCHED_DEADLINE support]) - ]) +AM_CONDITIONAL([SET_DLSCHED], [test x$with_deadline != xno && test !HAVE_SCHED_SETATTR])
AC_ARG_VAR([LOGLVL], [verbosity level, from 0 to 100. 100 is very verbose])
diff --git a/src/Makefile.am b/src/Makefile.am index 9bca1dc..1fe362d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,5 +3,8 @@ AM_CPPFLAGS = -I$(srcdir)/../libdl/ bin_PROGRAMS = rt-app rt_app_SOURCES= rt-app_types.h rt-app_args.h rt-app_utils.h rt-app_utils.c rt-app_args.c rt-app.h rt-app.c rt_app_SOURCES += rt-app_parse_config.h rt-app_parse_config.c -rt_app_LDADD = $(QRESLIB) ../libdl/libdl.a +rt_app_LDADD = $(QRESLIB) +if SET_DLSCHED +rt_app_LDADD += ../libdl/libdl.a +endif dist_bin_SCRIPTS = $(srcdir)/../doc/workgen
add syscall numbers for aarch64 in libdl
define syscall number in internal libdl header file iff they are not already defined by another lib
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- libdl/dl_syscalls.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/libdl/dl_syscalls.h b/libdl/dl_syscalls.h index 8d70056..27cbfe1 100644 --- a/libdl/dl_syscalls.h +++ b/libdl/dl_syscalls.h @@ -24,21 +24,45 @@ #define SCHED_DEADLINE 6
/* XXX use the proper syscall numbers */ + +/* __NR_sched_setattr number */ +#ifndef __NR_sched_setattr #ifdef __x86_64__ #define __NR_sched_setattr 314 -#define __NR_sched_getattr 315 #endif
#ifdef __i386__ #define __NR_sched_setattr 351 -#define __NR_sched_getattr 352 #endif
#ifdef __arm__ #define __NR_sched_setattr 380 +#endif + +#ifdef __aarch64__ +#define __NR_sched_setattr 274 +#endif +#endif + +/* __NR_sched_getattr number */ +#ifndef __NR_sched_getattr +#ifdef __x86_64__ +#define __NR_sched_getattr 315 +#endif + +#ifdef __i386__ +#define __NR_sched_getattr 352 +#endif + +#ifdef __arm__ #define __NR_sched_getattr 381 #endif
+#ifdef __aarch64__ +#define __NR_sched_getattr 275 +#endif +#endif + #define SF_SIG_RORUN 2 #define SF_SIG_DMISS 4 #define SF_BWRECL_DL 8
Add a How to cross-compile rt-app with static linkage
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- doc/tutorial.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 9c47178..c1be953 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -20,10 +20,33 @@ events e.g. a sequence of multiple sleep and run events. - Some values can be omitted and workgen will add them when it parses the file before starting the use case.
+**** Compiling and cross-compiling rt-app **** +rt-app uses libjson-c to parse the .json file +You can either install the libjson-c2 and libjson-c-dev deb packages or compile +from source code available here: https://github.com/json-c/json-c + +The following sequence can be used to cross compile rt-app with static linkage +for aarch64: + +For libjson-c: + +export ac_cv_func_malloc_0_nonnull=yes +export ac_cv_func_realloc_0_nonnull=yes +./autogen.sh +./configure --host=aarch64-linux-gnu --disable-shared --enable-static +make + +For rt-app: + +export ac_cv_lib_json_c_json_object_from_file=yes +./autogen.sh +./configure --host=aarch64-linux-gnu LDFLAGS=" --static -L<path to parent of json repo>/json-c/. libs/" CFLAGS="-I<path to parent of json repo>" --with-deadline +make + **** json file skeleton ****
The json file that describes a workload is made on 3 main objects: tasks, -resources and global objects. Only task object is mandatory; default value will +resources and global objects. Only tasks object is mandatory; default value will be used if global object is not defined and resources object is kept for backward compatibility with old version of rt-app but it doesn't give any benefit to declare it as the resources are now dynamically created by rt-app
On 23 October 2015 at 00:18, Vincent Guittot vincent.guittot@linaro.org wrote:
This patchset makes the cross compilation of rt-app with static linkage easier by updating the conditional dependency of rt-app of library and fixing some aarch64 issue
Vincent Guittot (5): rt-app: add json bits header file rt-app: remove conditional dependency with libjson-c rt-app: conditionally compile libdl rt-app: fix syscall number definition rt-app: Add static cross compilation description
Makefile.am | 5 +++++ configure.ac | 22 ++++++---------------- doc/tutorial.txt | 25 ++++++++++++++++++++++++- libdl/dl_syscalls.h | 28 ++++++++++++++++++++++++++-- src/Makefile.am | 5 ++++- src/rt-app_parse_config.c | 2 +- 6 files changed, 66 insertions(+), 21 deletions(-)
For the series,
Tested-by: Lisa Nguyen lisa.nguyen@linaro.org
Thanks for fixing the cross-compliation issue!