Pratyush Landekar
Pratyush Landekar

Reputation: 11

Android Kernel: Getting multiple errors in the file sched/rt.c on redefinitions of functions like rt_task_of and others on compilie

The output of the build using make shows


  CC      kernel/sched/rt.o
kernel/sched/rt.c:223: warning: "rt_entity_is_task" redefined
  223 | #define rt_entity_is_task(rt_se) (1)
      |
In file included from kernel/sched/rt.c:6:
kernel/sched/sched.h:1081: note: this is the location of the previous definition
 1081 | #define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
      |
kernel/sched/rt.c:225:35: error: redefinition of ‘rt_task_of’
  225 | static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
      |                                   ^~~~~~~~~~
kernel/sched/sched.h:1083:35: note: previous definition of ‘rt_task_of’ with type ‘struct task_struct *(struct sched_rt_entity *)’
 1083 | static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
      |                                   ^~~~~~~~~~
kernel/sched/rt.c: In function ‘update_rt_rq_load_avg’:
kernel/sched/rt.c:473:30: error: ‘struct rt_rq’ has no member named ‘rq’
  473 |         struct rq *rq = rt_rq->rq;
      |                              ^~
kernel/sched/rt.c: In function ‘update_rt_load_avg’:
kernel/sched/rt.c:279:37: error: ‘struct sched_rt_entity’ has no member named ‘my_q’
  279 | #define entity_is_task(se)      (!se->my_q)
      |                                     ^~
kernel/sched/rt.c:522:13: note: in expansion of macro ‘entity_is_task’
  522 |         if (entity_is_task(rt_se))
      |             ^~~~~~~~~~~~~~
kernel/sched/rt.c: At top level:
kernel/sched/rt.c:1869:13: warning: ‘attach_task_rt_rq’ defined but not used [-Wunused-function]
 1869 | static void attach_task_rt_rq(struct task_struct *p)
      |             ^~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:278: kernel/sched/rt.o] Error 1
make[1]: *** [scripts/Makefile.build:484: kernel/sched] Error 2
make: *** [Makefile:1043: kernel] Error 2

Some modifications I have made include:

In the /Makefile

     KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
     -fno-strict-aliasing -fno-common \
     -Werror-implicit-function-declaration \
     -Wno-format-security \
     -Werror\  #Removed this line over here as I was getting too many build failures due to warnings treated as errors
     -std=gnu89 $(call cc-option,-fno-PIE)

In scripts/dtc/dtc-lexer.lex.c_shipped.

-- YYLTYPE yylloc;
++ extern YYLTYPE yylloc;

The rest 2 patches in files kernel/Makefile and net/netfilter/xt_qtaguid.c based on this guide.

Is there a way to fix the issue? I have not tampered any other files apart from the mentioned. I do not have any experience in kernel development so I am hesitant in trying to change any code.

Upvotes: 1

Views: 31

Answers (0)

Related Questions