0

I downloaded PrimeOS' kernel from https://github.com/primebook/android_kernel_common. I just need to replace a single .c file in /drivers/platform/x86. Here's what I tried doing:-

  1. Replaced .c
  2. make clean && make mrproper
  3. Copied arch//configs/android-x86_deconfig to linux source root folder as .config
  4. fakeroot make kernel -j4

The command runs but stops abruptly and the terminal shows the $ localhost as if the task is finished. Can you tell me where I went wrong.

Update Here's the place where the issue comes:-

  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c

..............................................................

  CC      kernel/time/timeconv.o
In file included from ./arch/x86/include/asm/string.h:3,
                 from ./include/linux/string.h:20,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/mm.h:10,
                 from ./include/linux/ring_buffer.h:5,
                 from kernel/trace/trace.c:15:
In function ‘ftrace_dump’,
    inlined from ‘ftrace_dump’ at kernel/trace/trace.c:8269:6:
./arch/x86/include/asm/string_32.h:325:29: warning: ‘__builtin_memset’ offset [8297, 8336] from the object at ‘iter’ is out of the bounds of referenced subobject ‘seq’ with type ‘struct trace_seq’ at offset 4176 [-Warray-bounds]
  325 | #define memset(s, c, count) __builtin_memset(s, c, count)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace.c:8347:3: note: in expansion of macro ‘memset’
 8347 |   memset(&iter.seq, 0,
      |   ^~~~~~
  CC      kernel/time/timecounter.o

..............................................................

   AR      kernel/built-in.a
   $

Full Log: https://pastebin.com/8T3G3Uyc

So, it just comes back to $ as if the process completed at kernel/built-in.a. This is the file where every time it stops. Even if I compile the kernel without any changes, it still stops at kernel/built-in.a BTW, I am just using the source I downloaded from primebook and installed the necessary packages for recompiling the kernel. Should I be doing something else too.

UPDATE 1 I tried running make -j4 bzImage modules but this again stops at

    AR      drivers/video/built-in.a
    AR      drivers/built-in.a

Even this doesn't compile a bzImage

UPDATE 2 I tried running make kernel on a Linux source (5.4.0) and even that stops at built-in.a

UPDATE 3 I tried running make bzImage modules without -j4 and I get a new error now

    sound/soc/codecs/es8316.c:766:1: note: in expansion of macro ‘module_i2c_driver’
    766 | module_i2c_driver(es8316_i2c_driver);
    | ^~~~~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    make[3]: *** [scripts/Makefile.build:304: sound/soc/codecs/es8316.o] Error 1
    make[2]: *** [scripts/Makefile.build:544: sound/soc/codecs] Error 2
    make[1]: *** [scripts/Makefile.build:544: sound/soc] Error 2
    make: *** [Makefile:1050: sound] Error 2 

Full log: https://pastebin.com/JJeh4QTk

UPDATE 4 make bzImageworks and outputs the bzImage as expected.

Noob YT
  • 23
  • 1
  • 1
  • 6
  • 1
    Show the change, show the error! – 0andriy Jun 02 '20 at 06:30
  • i would recommend check that in two steps. First is check the build without your changes, second check with your changes. – blandger Jun 02 '20 at 06:47
  • @0andriy I am sorry I just added the data you asked. – Noob YT Jun 02 '20 at 07:20
  • @blandger I face the same issues. It still stops at the same line built-in.a even without any changes – Noob YT Jun 02 '20 at 07:21
  • `In function ‘ftrace_dump’, ..............................................................` what happened here? What is in that function? What do those dots represent? Are the dots part of `make` output?? When in doubt, post ALL the output, not some random snippets of it.. – KamilCuk Jun 02 '20 at 07:23
  • @NoobYT so your problem is just build that sources first. I'm not a experienced C user, I can just advice you to 'check twice sources consistency', if they were NOT broken during downloading/copying. – blandger Jun 02 '20 at 07:33
  • @KamilCuk Again, sorry new to this. I just have the whole log on pastebin - https://pastebin.com/8T3G3Uyc – Noob YT Jun 02 '20 at 07:41
  • @blandger Okay, I will try that – Noob YT Jun 02 '20 at 07:41
  • 1
    You compiled the kernel successfully - this is a warning, not an error. Did you expect something else? You said it "stops abruptly" - it compiles and then stops, doesn't seem to be "abruptly" to me. The warning is still concerning nonetheless. – KamilCuk Jun 02 '20 at 07:44
  • But, I don't see the compiled Kernel file anywhere. – Noob YT Jun 02 '20 at 07:46
  • 1
    `I don't see` How do you "see" it? What are you expecting to find? (Please be specific) Didn't you want to `make all` instead of `make kernel`? I think `make kernel` only builds the things in `kernel/*`, so they got compiled (but maybe i'm wrong). – KamilCuk Jun 02 '20 at 07:51
  • @KamilCuk I am looking for a file named kernel as my output. But, it's nowhere to be seen. After the make kernel command, if I am not wrong, a file named kernel should be produced, as seen here - https://groups.google.com/forum/#!topic/Android-x86/x5aBNnK4Ols. But, I dont get it. Please correct me if I am wrong. I am pretty new to Android x86 kernels, though have some experience with Linux kernels – Noob YT Jun 02 '20 at 08:00
  • @blandger I redownloaded the repo and it still doesn't work. It doesn't output the kernel file anywhere. – Noob YT Jun 02 '20 at 08:46
  • @KamilCuk It somehow keeps stopping at a built-in.a file without any output whatsoever. Please check the update – Noob YT Jun 02 '20 at 13:34
  • It means that the error is not what you posted. Run `make -j1 ...` instead of simple `make ...` to see it. – 0andriy Jun 02 '20 at 17:33
  • @0andriy Again it stopped at built-in.a without any output. It always stops at a built-in.a file though I have been able to compile a Linux kernel on this machine successfully Please also check Update 2 – Noob YT Jun 03 '20 at 02:16
  • @0andriy Check UPDATE 3 please. This time I get a new error – Noob YT Jun 03 '20 at 04:32

1 Answers1

0

Fix for kernel compilation stopping at make a built-in.a file

Use make bzImage or make bzImage modules instead of make kernel
Update - In my case the error was with the ES8316.c which was causing the compilation to stop. Go to your config file and delete the lines pertaining to ES8316 and the build went through successfully.

Fix for other Errors in the question

For the codec issue and for any other conflicting module, go to your config file and search for it, for eg:- i had issue with the module for ES8316. To fix it, remove the line corresponding to ES8316 in your config file or add a # infront of it. You may also try to debug the problem if you really need that driver.

Other things that you could try

  • I had gcc-9 installed and installing gcc-8 did help at times.
Noob YT
  • 23
  • 1
  • 1
  • 6