Troubleshooting:kernel

Here are some common kernel compilation problems listed. For debugging a kernel that compiles, but does not boot, see Troubleshooting:boot.

How to create a patch
Patching a kernel is as simple as putting a  file in your   folder and adding the patch name to the   variable in your   file. See also: Patching.

undefined reference to kgsl_iommu_sync_lock
drivers/built-in.o:(.data.rel+0x68c): undefined reference to kgsl_iommu_sync_lock' drivers/built-in.o:(.data.rel+0x690): undefined reference to kgsl_iommu_sync_unlock' You need to apply the gpu-msm-fix-gcc5-compile.patch patch.

How can I boot the kernel with some specific arguments?
You can configure  so that the arguments are permanent, or change it in boot time using fastboot or pmbootstrap, for example:

fastboot boot -c &quot;console=ttyHSL0,115200,n8&quot; ...

pmbootstrap flasher boot --cmdline &quot;PMOS_NO_OUTPUT_REDIRECT&quot;

MSM framebuffer doesn't work
We found out that removing the 3D driver support makes the MSM framebuffer work. See.

CONFIG_MSM_KGSL=n

PTY allocation request failed
PTY allocation request failed on channel 0 -ash: a: unknown operand Go to kernel configuration, you have probably missed !

Kernel compilation: (some header file): No such file or directory
Busybox's  implementation does not extract symlinks. There are two workarounds. One is to use another archive type (typically kernel sources are downloaded from GitHub, where you can also get the source as  - simply by changing the extension in the URL).

The other workaround is to add  to the makedepends, so it uses the original unzip instead of the busybox version.

(This has been fixed in busybox in the meantime.)

Kernel compilation: linux/types.h: No such file or directory
Add  to makedepends of linux-* APKBUILD.

Kernel compilation: thumb conditional instruction should be in IT block
arch/arm/crypto/aesbs-core.S:449: Error: thumb conditional instruction should be in IT block -- `addeq r6,r6,#0x10' arch/arm/crypto/aesbs-core.S:904: Error: thumb conditional instruction should be in IT block -- `addeq r6,r6,#0x10' arch/arm/crypto/aesbs-core.S:2100: Error: thumb conditional instruction should be in IT block -- `subne r9,#0x10'

You can fix it by disabling  with: Then go to  and disable.

On some other devices, like Huawei P7, you might also need to disable all CRYPTO flags containing ARM, which are ARM NEON optimizations.

This was first noticed in.

Kernel compilation: BusyBox lzma compression fails
In case you get the following output:

LZMA   arch/arm/boot/compressed/piggy.lzma lzma: unrecognized option: 9 BusyBox v1.26.2 (2017-06-11 06:37:13 GMT) multi-call binary.

Usage: lzma -d [-cf] [FILE]...

Decompress FILE (or stdin)

-d     Decompress -c     Write to stdout -f     Force In the BusyBox version shipped with Alpine Linux, only lower compression levels are enabled (to reduce the binary size). The kernel you're building is configured to compress with LZMA at the highest compression level. Pick one of the following solutions:


 * Add  to the   line. Then the &quot;real&quot; lzma binary will be used instead of the Busybox version. This is recommended, because then your kernel will get built most similar to how it is built elsewhere, so you have the lowest risk of introducing a reason for the kernel not to boot (because the kernel is too big in size or something like that)
 * Reduce the compression ratio by adding this patch. This will not introduce any dependency, but increase the kernel size.
 * Use another compression algorithm (run  and change it there). Gzip should work, but will produce a big kernel, because pmbootstrap currently installs a workaround to always use the fastest compression method, when the most compressing one  is chosen. This will increase the kernel size the most.

Kernel compilation: Error: .err encountered in assembler messages
If compilation errors out on something like this in logs: /tmp/ccmAkEIJ.s: Assembler messages: /tmp/ccmAkEIJ.s:2280: Error: .err encountered Then older version of GCC should be used for compilation.

Android Kernel compilation fails on warnings (not on errors) (-Werror)
Don't even bother fixing all those warnings, there are too many of them and we don't want the outdated Android kernels in the long run anyway! When you generate your kernel APKBUILD with, then you should have code in the   that automatically removes the   parameter in all Makefiles.

Example from linux-asus-z00vd:

Building the kernel with Android's build system
It might be useful for debugging to build Android's kernel with Android's build system.

You can follow the LineageOS building guide for your device (see this for titan device as example).

The process should be similar for other devices:

You can check the  environment variable and cd into it. In the case of titan the interesting generated files are:


 * (boot image ready to be flashed: kernel + initramfs)
 * (device trees)
 * (linux image)
 * (compressed initramfs)

The defconfig used is available at

Error: selected processor does not support ARM mode `smc #0'
Try this patch: https://github.com/imoseyon/leanKernel-galaxy-nexus/pull/6

X11 does not work on Qualcomm devices
Try apply this patch.

TLS (SSL/HTTPS) is broken!
If you see messages like these, when trying to access HTTPS pages, read on: Connecting to pastebin.com (104.20.209.21:443) ssl_client: pastebin.com: TLS connect failed wget: error getting response: Connection reset by peer

You are probably running an older kernel (pre 3.17), which does not yet have the "getrandom" syscall. This is required by modern openssl/libressl versions (Alpine was on libressl for a long time, then switched back to openssl). Check your kernel version, and if that is the case, and mainlining is not feasible for you, consider backporting the getrandom syscall like done in. This issue was discussed in.

CROSS_COMPILE_ARM32 not defined or empty
Try unset CONFIG_COMPAT_VDSO from your kernel config.

External resources

 * Halium Docs