Skip to content

Instantly share code, notes, and snippets.

View IsHacker003's full-sized avatar

IsHacker IsHacker003

View GitHub Profile
@IsHacker003
IsHacker003 / oneplus_compile.md
Last active May 22, 2026 19:54 — forked from einyx/oneplus_compile.txt
compile android kernel with clang

Background

Google compiles the Pixel 2 kernel with Clang. They shipped the device on Android 8.0 with a kernel compiled with Clang 4.0 (build.config commit and prebuilt kernel commit) and upgraded to Android 8.1 with a kernel compiled with Clang 5.0 (build.config commit and prebuilt kernel commit).

Google uses Clang's link-time optimization and control flow integrity in the Pixel 3 kernel, hardening it against return oriented programming attacks (LTO commit, [CFI commit](https://android.googlesource.com/kernel/msm/+/4ca69fba29179

#!/bin/bash
# Detect tethering interface name on the phone (rndis0 or usb0)
intf_cmd=$(adb shell "su -c 'if [ -e \"/sys/class/net/usb0\" ]; then echo \"Tethering interface: usb0\"; elif [ -e \"/sys/class/net/rndis0\" ]; then echo \"Tethering interface: rndis0\"; else echo \"Unable to find tethering interface.\"; fi'")
if [ "$intf_cmd" == "Tethering interface: usb0" ]
then
echo "$intf_cmd"
intf="usb0"