[TOOLS] Necessary tools for building the Pixel 2 (XL) Kernel

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,116
0
THIS IS NOT A "HOW TO BUILD A KERNEL" POST

The Pixel 2, unlike other phones I've worked with, requires two extra tools: dtc (Device Tree Compiler) and mkdtimg.
Yes, dtc is available in the main repos for most linux distros, but the Pixel 2 kernel requires the AOSP modified version of dtc.

First, grab the Pixel 2 + XL Unified kernel source (wahoo) from https://android.googlesource.com/kernel/msm/+/android-msm-wahoo-4.4-oreo-dr1

Then download wahoo-kernel-tools.zip file attatched to this post and unzip it. Make sure that the 2 files in the bin folder are available in your path (possibly by moving them to ~/bin) and symlink or move the libc++.so into an included library directory, such as /lib, /usr/lib, or /usr/local/lib.

These specific binaries were compiled on Arch Linux by me, so they may not work on every system. To build binaries compatible with your system, sync any android oreo source (AOSP, Lineage, Carbon, etc.) and run "make dtc mkdtimage -jX" instead of "make bacon" or your normal command. The binaries will be located in out/host/linux-x86/.

This is tested and working with the stock google 4.9 toolchain and the initial source as of Oct 23rd, 2017.
 

Attachments

DespairFactor

Recognized Developer / Recognized Contributor
Mar 13, 2013
5,786
12,338
0
Toronto
THIS IS NOT A "HOW TO BUILD A KERNEL" POST

The Pixel 2, unlike other phones I've worked with, requires two extra tools: dtc (Device Tree Compiler) and mkdtimg.
Yes, dtc is available in the main repos for most linux distros, but the Pixel 2 kernel requires the AOSP modified version of dtc.

First, grab the Pixel 2 + XL Unified kernel source (wahoo) from https://android.googlesource.com/kernel/msm/+/android-msm-wahoo-4.4-oreo-dr1

Then download wahoo-kernel-tools.zip file attatched to this post and unzip it. Make sure that the 2 files in the bin folder are available in your path (possibly by moving them to ~/bin) and symlink or move the libc++.so into an included library directory, such as /lib, /usr/lib, or /usr/local/lib.

These specific binaries were compiled on Arch Linux by me, so they may not work on every system. To build binaries compatible with your system, sync any android oreo source (AOSP, Lineage, Carbon, etc.) and run "make dtc mkdtimage -jX" instead of "make bacon" or your normal command. The binaries will be located in out/host/linux-x86/.

This is tested and working with the stock google 4.9 toolchain and the initial source as of Oct 23rd, 2017.
Thanks for the files dude, you saved me some serious time since I don't need to sync AOSP
 

skaforey

Senior Member
Nov 5, 2009
569
364
83
San Diego, CA
Forgive me for being a noob, but would these new requirements for the Pixel 2 cause existing tools used to pack/unpack the boot image fail or at least partially fail? I'm wondering if this is why we can't get Magisk to work

edit: to be clear, when I unpack the boot.img file all I see are kernel and ramdisk. When I unpack the boot.img from the Pixel 1 XL, I see those same 2 files along with devicetree.dtb and kernelimage
 
Last edited:

nathanchance

Senior Recognized Developer / Recognized Contribut
Jul 22, 2015
13,748
49,943
263
25
Mesa, AZ
Forgive me for being a noob, but would these new requirements for the Pixel 2 cause existing tools used to pack/unpack the boot image fail or at least partially fail? I'm wondering if this is why we can't get Magisk to work

edit: to be clear, when I unpack the boot.img file all I see are kernel and ramdisk. When I unpack the boot.img from the Pixel 1 XL, I see those same 2 files along with devicetree.dtb and kernelimage
Maybe? It doesn't seem like how the boot image is packed has been changed, just how the actual kernel image is put together.
 

skaforey

Senior Member
Nov 5, 2009
569
364
83
San Diego, CA
Maybe? It doesn't seem like how the boot image is packed has been changed, just how the actual kernel image is put together.
Strange. Thanks for the response though. In the Magisk thread here, someone has posted a boot image that was simply unpacked/repacked (no changes) and we can't get it to boot. I don't want to derail this thread any further though.
 

DespairFactor

Recognized Developer / Recognized Contributor
Mar 13, 2013
5,786
12,338
0
Toronto
Forgive me for being a noob, but would these new requirements for the Pixel 2 cause existing tools used to pack/unpack the boot image fail or at least partially fail? I'm wondering if this is why we can't get Magisk to work

edit: to be clear, when I unpack the boot.img file all I see are kernel and ramdisk. When I unpack the boot.img from the Pixel 1 XL, I see those same 2 files along with devicetree.dtb and kernelimage
Strange. Thanks for the response though. In the Magisk thread here, someone has posted a boot image that was simply unpacked/repacked (no changes) and we can't get it to boot. I don't want to derail this thread any further though.
No they don't, these just build the dtb/dtbo. The magisk issue is with patching sepolicy likely.
 
  • Like
Reactions: frap129

ryanbg

Inactive Recognized Developer
Jan 3, 2008
855
1,735
0
movr0.com
No problemo, I figured I'd post this since my fastboot is being retarded and I can't do much else
Did you try to flash a factory image and get stuck in the bootloader? If so, extract 'image-walleye-[build number].zip' and flash each image manually. fastboot -w update doesn't work for some reason. After you flash all the images, do fastboot format userdata, and you should be back to normal. Took me a couple hours to figure this out.
 
Last edited:

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,116
0
Did you try to flash a factory image and get stuck in the bootloader? If so, extract 'image-walleye-[build number].zip' and flash each image manually. fastboot -w update doesn't work for some reason. After you flash each image, do fastboot format userdata, and you should be back to normal. Took me a couple hours to figure this out.
Thanks! I don't get stuck in the bootloader, but it won't let me flash boot images. Fastboot either hangs or spits out "remote: error: max size not reported"
 
  • Like
Reactions: ryanbg