mripard / sunxi-mali

GNU General Public License v2.0
100 stars 54 forks source link

missing cma.h #31

Closed lucascastro closed 6 years ago

lucascastro commented 6 years ago

tried to build KERVERSION = 4.14.0-0.bpo.3-armmp-lpae but also tried on 4.9 4.9.0-5-armmp-lpae

sunxi-mali/r6p2/src/devicedrv/mali/platform/sunxi/sunxi.c:24:23: fatal error: ../mm/cma.h: No such file or directory

include <../mm/cma.h>

                   ^

compilation terminated. /usr/src/linux-headers-4.9.0-5-common/scripts/Makefile.build:298: recipe for target '/home/lucas/build/sunxi-mali/r6p2/src/devicedrv/mali/platform/sunxi/sunxi.o' failed

giuliobenetti commented 6 years ago

Hi @lucascastro,

did you use build.sh script to build or did you build by issuing make inside driver folder? Also, it seems you're pointing to host includes instead of an entire kernel with KDIR.

mm/cma.h is different from include/linux/cma.h, so that #include <../mm/cma.h> tries to include linux/mm/cma.h

Can you pastebin the entire build log?

Thanks

lucascastro commented 6 years ago

Just as HOWTO, ./build.sh -r $VERSION -b and I looked ./build.sh and tried just apply the patched to check if the file would be created and nothing about cma.h file. I tried on more than one branch.

lucascastro commented 6 years ago

later I'll post the build log.

lucascastro commented 6 years ago

the complete build log

http://paste.debian.net/1010990/

lucascastro commented 6 years ago

lucas@arm-dev:~/build/sunxi-mali$ find . -name "*cma*" lucas@arm-dev:~/build/sunxi-mali$

giuliobenetti commented 6 years ago

I think you're missing to pass a KDIR. Maybe you are using headers only instead of entire kernel. cma.h exists under include/linux/cma.h from version >= 4.4 or before. Instead driver needs also mm/cma.h that is not provided by headers only. At this point I suggest you to get entire kernel sources and point KDIR to that path. This way mm/cma.h can be found. Try to double check for include/linux/cma.h it must exist in your headers.

lucascastro commented 6 years ago

Yes, it's that. I thought it was a file in sunxi-mali tree.

lucascastro commented 6 years ago

So, I can't build against running kernel just as kernel doc? Because cma.h exist at /usr/src/linux-headers-4.9.0-4-armmp-lpae/include/config/cma.h

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

giuliobenetti commented 6 years ago

There are 2 different cma.h files. One under include/linux the other under mm/ and they are different

giuliobenetti commented 6 years ago

As I know you can't. You need the entire kernel.

lucascastro commented 6 years ago

I don't think so, everything you may need is the headers. As the doc I had posted, the Kernel doc show how to compile against the running kernel.

giuliobenetti commented 6 years ago

Yes, but as you can see in the source where mm/cma.h is included there is a comment about it, that define it a hack and need a fix. So I tell you again you need entire kernel sources. If you have an idea how to fix it on code feel free to PR with a patch.

lucascastro commented 6 years ago

I'm already doing that way. Just posting to be noted because I took some time to notice that.

giuliobenetti commented 6 years ago

Ok, let's try to think about a workaround, if possible. It should compile as a normal module.

mripard commented 6 years ago

It should be fixed by 2d997d5f2e01

lucascastro commented 6 years ago

I didn't have time to test that yet. I guess in two weeks I'm gonna back to work on that.

mripard commented 6 years ago

Any update?