# Linux Kernel Module Cheat

##### 17.13.1.1. CONFIG_PROC_EVENTS aarch64

0111ca406bdfa6fd65a2605d353583b4c4051781 was failing with:

    >>> kernel_modules 1.0 Building
    /usr/bin/make -j8 -C '/linux-kernel-module-cheat//out/aarch64/buildroot/build/kernel_modules-1.0/user' BR2_PACKAGE_OPENBLAS="" CC="/linux-kernel-module-cheat//out/aarch64/buildroot/host/bin/aarch64-buildroot-linux-uclibc-gcc" LD="/linux-kernel-module-cheat//out/aarch64/buildroot/host/bin/aarch64-buildroot-linux-uclibc-ld"
    /linux-kernel-module-cheat//out/aarch64/buildroot/host/bin/aarch64-buildroot-linux-uclibc-gcc  -ggdb3 -fopenmp -O0 -std=c99 -Wall -Werror -Wextra -o 'proc_events.out' 'proc_events.c'
    In file included from /linux-kernel-module-cheat//out/aarch64/buildroot/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/signal.h:329:0,
                     from proc_events.c:12:
    /linux-kernel-module-cheat//out/aarch64/buildroot/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/sys/ucontext.h:50:16: error: field ‘uc_mcontext’ has incomplete type
         mcontext_t uc_mcontext;
                    ^~~~~~~~~~~

so we commented it out.

Related threads:

- https://mailman.uclibc-ng.org/pipermail/devel/2018-January/001624.html

- https://github.com/DynamoRIO/dynamorio/issues/2356

If we try to naively update uclibc to 1.0.29 with `buildroot_override`, which contains the above mentioned patch, clean `aarch64` test build fails with:

    ../utils/ldd.c: In function 'elf_find_dynamic':
    ../utils/ldd.c:238:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         return (void *)byteswap_to_host(dynp->d_un.d_val);
                ^
    /tmp/user/20321/cciGScKB.o: In function `process_line_callback':
    msgmerge.c:(.text+0x22): undefined reference to `escape'
    /tmp/user/20321/cciGScKB.o: In function `process':
    msgmerge.c:(.text+0xf6): undefined reference to `poparser_init'
    msgmerge.c:(.text+0x11e): undefined reference to `poparser_feed_line'
    msgmerge.c:(.text+0x128): undefined reference to `poparser_finish'
    collect2: error: ld returned 1 exit status
    Makefile.in:120: recipe for target '../utils/msgmerge.host' failed
    make[2]: *** [../utils/msgmerge.host] Error 1
    make[2]: *** Waiting for unfinished jobs....
    /tmp/user/20321/ccF8V8jF.o: In function `process':
    msgfmt.c:(.text+0xbf3): undefined reference to `poparser_init'
    msgfmt.c:(.text+0xc1f): undefined reference to `poparser_feed_line'
    msgfmt.c:(.text+0xc2b): undefined reference to `poparser_finish'
    collect2: error: ld returned 1 exit status
    Makefile.in:120: recipe for target '../utils/msgfmt.host' failed
    make[2]: *** [../utils/msgfmt.host] Error 1
    package/pkg-generic.mk:227: recipe for target '/data/git/linux-kernel-module-cheat/out/aarch64/buildroot/build/uclibc-custom/.stamp_built' failed
    make[1]: *** [/data/git/linux-kernel-module-cheat/out/aarch64/buildroot/build/uclibc-custom/.stamp_built] Error 2
    Makefile:79: recipe for target '_all' failed
    make: *** [_all] Error 2

Buildroot master has already moved to uclibc 1.0.29 at f8546e836784c17aa26970f6345db9d515411700, but it is not yet in any tag…​ so I’m not tempted to update it yet just for this.