[Shield Android TV Q&A, Help & Troubleshooting] runnirr:
I am trying to compile the 8.2.0 Kernel for my Shield TV 2017. I am hoping to adding the Wireguard kernel module.

I downloaded the source linked from https://developer.nvidia.com/shield-open-source following the instructions links here https://nv-tegra.nvidia.com/gitweb/...7;hb=1a508fa42d6ae55ee0fe62a3e07559a484794108

The source code checks out fine. I set up my cross compiler by setting these environment variables

ARCH=arm64
SUBARCH=arm64
CROSS_COMPILE=/absolute/path/shield-open-source/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-

I removed the CONFIG_SYSTEM_TRUSTED_KEYS="signing_key.x509" from the tegra_android_defconfig file

I then went to ~/shield-open-source/kernel/kernel-4.9 and ran

make mrproper
make tegra_android_defconfig
make -j4

There were a few warnings that got flagged as errors and caused the build to failed. I modified the make files so the warnings wouldn't be flagged as errors (ex: ccflags-y += -Wno-error=maybe-uninitialized)

There is one more error with ~/shield-open-source/hardware/nvidia/platform/t210b01/ers/kernel-dts/ers-platforms/tegra210b01-ers-common.dtsi in that it can't find <tegra210b01-cpufreq.dtsi>. I changed this to include "darcy-platforms/tegra210b01-darcy-cpufreq.dtsi"

I also added Wireguard by following the kernel instructions from https://xdaforums.com/android/development/wireguard-rom-integration-t3711635

At this point I am able build the Image.gz file. I took the boot.img from the recovery images that NVidia provides and used AndroidImageKitchen (https://xdaforums.com/showthread.php?t=2073775) to unpack the boot.img, swap out boot.img-Image.gz with the one Image.gz that I compiled and re-packed the boot.img I flashed this boot.img to my device using fastboot, and the device never boots.

I have some logs from the bootloop - here is the snipit that seems most relevant but I don't really know what I am looking for or how to determine what needs to change

09-12 22:00:42.120 3384 3384 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 1
09-12 22:00:42.120 3384 3384 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 1
09-12 22:00:42.120 3383 3383 E Netd : cannot find interface dummy0
09-12 22:00:42.120 3383 3383 I Netd : Initializing RouteController: 1.3ms
09-12 22:00:42.120 3384 3384 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 3384 (surfaceflinger), pid 3384 (surfaceflinger)
09-12 22:00:42.120 3383 3383 D XfrmController: Sending Netlink XFRM Message: XFRM_MSG_FLUSHSA
09-12 22:00:42.120 3383 3383 D XfrmController: Sending Netlink XFRM Message: XFRM_MSG_FLUSHPOLICY
09-12 22:00:42.120 3383 3383 I Netd : Initializing XfrmController: 0.2ms
09-12 22:00:42.121 3383 3383 I Netd : Registering NetdNativeService: 0.5ms
09-12 22:00:42.122 3383 3383 I Netd : Starting CommandListener: 0.1ms
09-12 22:00:42.123 3383 3383 I Netd : Registering NetdHwService: 1.0ms
09-12 22:00:42.123 3383 3383 I Netd : Netd started in 219ms
09-12 22:00:42.132 3378 3378 D Zygote : begin preload
09-12 22:00:42.132 3378 3378 I Zygote : Installing ICU cache reference pinning...
09-12 22:00:42.132 3378 3378 I Zygote : Preloading ICU data...
09-12 22:00:42.135 3379 3379 I Zygote : Accepting command socket connections
09-12 22:00:42.138 3378 3378 I Zygote : Preloading classes...
09-12 22:00:42.140 3436 3436 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
09-12 22:00:42.140 3184 3184 I /system/bin/tombstoned: received crash request for pid 3384
09-12 22:00:42.141 3436 3436 I crash_dump64: performing dump of process 3384 (target tid = 3384)
09-12 22:00:42.143 3436 3436 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-12 22:00:42.143 3436 3436 F DEBUG : Build fingerprint: 'NVIDIA/darcy/darcy:9/PPR1.180610.011/4079208_2235.1395:user/release-keys'
09-12 22:00:42.143 3436 3436 F DEBUG : Revision: '0'
09-12 22:00:42.143 3436 3436 F DEBUG : ABI: 'arm64'
09-12 22:00:42.143 3436 3436 F DEBUG : pid: 3384, tid: 3384, name: surfaceflinger >>> /system/bin/surfaceflinger <<<
09-12 22:00:42.143 3436 3436 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
09-12 22:00:42.143 3436 3436 F DEBUG : Cause: null pointer dereference
09-12 22:00:42.143 3436 3436 F DEBUG : x0 0000000000000000 x1 0000000000000000 x2 0000000000000000 x3 00000025b1c537d0
09-12 22:00:42.143 3436 3436 F DEBUG : x4 0000000000000000 x5 0000007fe38db898 x6 0000000000000000 x7 0000000000000030
09-12 22:00:42.143 3436 3436 F DEBUG : x8 0101010101010101 x9 b72fc0062f2280b8 x10 000000005f647079 x11 0000000000000000
09-12 22:00:42.143 3436 3436 F DEBUG : x12 0000000000000001 x13 0000000000000000 x14 0000000000000001 x15 00000025b1c81a88
09-12 22:00:42.143 3436 3436 F DEBUG : x16 000000252f3b9e58 x17 00000025307de610 x18 0000000000000001 x19 00000025b1c537d0
09-12 22:00:42.143 3436 3436 F DEBUG : x20 0000000000000000 x21 0000000000000000 x22 000000252ed0c5e0 x23 0000000000000000
09-12 22:00:42.143 3436 3436 F DEBUG : x24 0000000000000001 x25 0000007fe38dbb00 x26 00000000000f4240 x27 0000007fe38dbb00
09-12 22:00:42.143 3436 3436 F DEBUG : x28 0000007fe38dba90 x29 0000007fe38db900
09-12 22:00:42.143 3436 3436 F DEBUG : sp 0000007fe38db8e0 lr 000000252f396f78 pc 00000025307de620
09-12 22:00:42.146 3378 3378 I PackageBackwardCompatibility: Loaded android.content.pm.OrgApacheHttpLegacyUpdater

Any pointers to what I am doing wrong, or how to further debug would be appreciated.

Also if there is already a kernel built with Wireguard support, a reference to that would be :good: