Skip to content

Instantly share code, notes, and snippets.

View nathanchance's full-sized avatar
🛠️
Trying not to drown in bugs

Nathan Chancellor nathanchance

🛠️
Trying not to drown in bugs
View GitHub Profile
wget https://www.samba.org/ftp/ccache/ccache-3.3.4.tar.gz && tar -xvf ccache-3.3.4.tar.gz && cd ccache-3.3.4 && ./configure && sudo make -j$( grep "^processor" /proc/cpuinfo | wc -l ) install && cd .. && rm -rf ccache-3.3.4*
git clone https://github.com/ninja-build/ninja && cd ninja && ./configure.py --bootstrap && sudo cp -v ninja /usr/local/bin && cd .. && rm -rf ninja
which ninja && which ccache
ccache -V && ninja --version
@nathanchance
nathanchance / gitfu
Last active September 18, 2020 23:45
Reset all files that conflict but keep the non-conflicted ones:
for i in $(git status | grep "both modified" | awk '{print $3}'); do git reset HEAD $i && git checkout -- $i; done
Delete all branches but one
for i in $(git ls-remote -q | grep "refs/head" | cut -d '/' -f 3 | awk '!(/^<BRANCH_NAME_TO_KEEP>$/)'); do git push origin :$i; done

Introduction

Google has traditionally been against upgrading the compiler as it comes with new warnings and potentially changes behavior. However, these are actually good reasons to upgrade, they help shake out undefined behavior.

Process

In order to compile with a newer version of GCC, you'll need to do a few modifications to your kernel in addition to a new toolchain. I recommend using the ones available from Bootlin.

  1. Remove gcc-wrapper and any instances of -Werror: gcc-wrapper is CAF's shitty way of enabling -Werror, which is unnecessary since regular -Werror will suffice. We need to remove it for the time being because there will be new warnings to fix. Pick Google's revert of it (3.18, 4.4) then remove any other instances of -Werror (such as in prima, qcacld-2.0, and qc
Starting TWRP 3.2.2-0-fac1b383 on Thu Apr 23 02:59:46 1970
(pid 447)
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:Found brightness file at '/sys/class/leds/lcd-backlight/brightness'
I:Got max brightness 255 from '/sys/class/leds/lcd-backlight/max_brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:LANG: en
I:AB_OTA_UPDATER := true
Starting the UI...
Starting TWRP 3.2.2-0-fac1b383 on Thu Apr 23 03:14:37 1970
(pid 447)
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:Found brightness file at '/sys/class/leds/lcd-backlight/brightness'
I:Got max brightness 255 from '/sys/class/leds/lcd-backlight/max_brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:LANG: en
I:AB_OTA_UPDATER := true
Starting the UI...
Starting TWRP 3.2.2-0-fac1b383 on Tue Feb 10 04:24:12 1970
(pid 515)
BOARD_HAS_NO_REAL_SDCARD := true
RECOVERY_SDCARD_ON_DATA := true
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness
I:Specified brightness file '/sys/class/leds/lcd-backlight/brightness' not found.
I:Found brightness file at '/sys/devices/platform/soc/ae00000.qcom,mdss_mdp/backlight/panel0-backlight/brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 100
Starting TWRP 3.2.2-0-fac1b383 on Tue Feb 10 04:36:16 1970
(pid 512)
BOARD_HAS_NO_REAL_SDCARD := true
RECOVERY_SDCARD_ON_DATA := true
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness
I:Specified brightness file '/sys/class/leds/lcd-backlight/brightness' not found.
I:Found brightness file at '/sys/devices/platform/soc/ae00000.qcom,mdss_mdp/backlight/panel0-backlight/brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 100
Starting TWRP 3.2.2-0-fac1b383 on Fri Jan 2 01:16:48 1970
(pid 576)
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:Find_File: Error opening '/sys/class/backlight'
I:Found brightness file at '/sys/class/leds/lcd-backlight/brightness'
I:Got max brightness 255 from '/sys/class/leds/lcd-backlight/max_brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:TW_EXCLUDE_MTP := true
I:LANG: en
Starting TWRP 3.2.2-0-fac1b383 on Fri Jan 2 01:25:03 1970
(pid 580)
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:Find_File: Error opening '/sys/class/backlight'
I:Found brightness file at '/sys/class/leds/lcd-backlight/brightness'
I:Got max brightness 255 from '/sys/class/leds/lcd-backlight/max_brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:TW_EXCLUDE_MTP := true
I:LANG: en