├── 0005-dtb-appender
├── catdtb.sh
└── README.md
├── 0004-dtb-dts-converter-reconverter
├── dtbtodts.sh
├── dtstodtb.sh
└── README.md
├── 0002-build-gcc-4.9
├── .gitignore
├── anykernel
│ ├── anykernel.sh
│ └── dtbtool.c
├── README.md
└── build.sh
├── 0006-arm-magisk-patch
├── README.md
└── arm-magisk-patch.sh
├── 0003-clean-dts
├── cleandts.sh
└── README.md
├── 0007-touch-fw-dumper
├── README.md
├── touchfw_uploader.ipynb
├── dump_touch_fw.sh
└── .src
├── 0009-fedora-module-rebuild
├── uvc_driver.patch
└── ec_sys-builder.sh
├── 0001-dtsi_collector
├── dtsi_collector.sh
└── README.md
└── 0008-git-patcheroo
└── patch.sh
/0005-dtb-appender/catdtb.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | for f in $(find . -maxdepth 1 -iname "*.dtb"); do cat $f >> $1; done
3 | mv $1 Image.gz-dtb
4 |
--------------------------------------------------------------------------------
/0004-dtb-dts-converter-reconverter/dtbtodts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | for f in $(find . -maxdepth 1 -iname "*.dtb"); do dtc -I dtb -O dts -o ${f/\.dtb/}_extracted.dts $f; done
3 |
--------------------------------------------------------------------------------
/0004-dtb-dts-converter-reconverter/dtstodtb.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | for f in $(find . -maxdepth 1 -iname "*.dts"); do dtc -I dts -O dtb -o ${f/\.dts/}_recompiled.dtb $f; done
3 |
--------------------------------------------------------------------------------
/0002-build-gcc-4.9/.gitignore:
--------------------------------------------------------------------------------
1 | anykernel/anykernel3
2 | anykernel/anykernel3/Image
3 | anykernel/anykernel3/Image.gz
4 | anykernel/anykernel3/Image.gz-dtb
5 | anykernel/anykernel3/kernel
6 | anykernel/anykernel3/dt.img
7 |
--------------------------------------------------------------------------------
/0006-arm-magisk-patch/README.md:
--------------------------------------------------------------------------------
1 | ## 6. arm-magisk-patch.sh ##
2 |
3 | ### About: ###
4 | boot image magisk patcher for arm devices
5 |
6 | ### Usage: ###
7 |
8 | Assuming boot image name as boot.img
9 |
10 | 1. `curl -LSsO https://github.com/Jebaitedneko/scripts/raw/master/0006-arm-magisk-patch/arm-magisk-patch.sh`
11 | 2. `chmod +x arm-magisk-patch.sh`
12 | 3. `./arm-magisk-patch.sh boot.img`
13 |
14 | Repacked image will be boot_repacked.img
15 |
--------------------------------------------------------------------------------
/0003-clean-dts/cleandts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | clean() {
3 | cp $1 ${1::-4}_diff.dts
4 | sed -i 's/linux\,phandle \= [<]0x[0-9 A-Z a-z]*[>][;]//g' ${1::-4}_diff.dts
5 | sed -i 's/phandle \= [<]0x[0-9 A-Z a-z]*[>][;]//g' ${1::-4}_diff.dts
6 | sed -i 's/0x00/0x0/g' ${1::-4}_diff.dts
7 | sed -i 's/okay/ok/g' ${1::-4}_diff.dts
8 | sed -i 's/fragment@\([0-9]*\)/fragment/g' ${1::-4}_diff.dts
9 | sed -i 's/[ \t]*$//' ${1::-4}_diff.dts
10 | awk 'BEGIN{RS="";ORS="\n\n"}1' ${1::-4}_diff.dts > ${1::-4}_diff_final.dts && rm ${1::-4}_diff.dts && mv ${1::-4}_diff_final.dts ${1::-4}_diff.dts
11 | sed -i 's/[ \t]*$//' ${1::-4}_diff.dts
12 | }
13 |
14 | clean $1
15 |
--------------------------------------------------------------------------------
/0004-dtb-dts-converter-reconverter/README.md:
--------------------------------------------------------------------------------
1 | ## 4. dtstodtb.sh dtbtodts.sh ##
2 |
3 | ### About: ###
4 |
5 | Converts all .dtb in current dir to .dts and .dts in current dir to .dtb
6 |
7 | PS: non-recursive so dw about it going to places you don't want it to go to XD
8 |
9 | ### Usage: ###
10 |
11 | `cd dir_with_dtb_or_dts`
12 | `./dtbtodts.sh`
13 | `./dtstodtb.sh`
14 |
15 | These will output
16 |
17 | your_decompiled_dts_01_extracted.dts
18 | your_decompiled_dts_02_recompiled.dtb
19 |
20 | Respectively.
21 |
22 | Then you can use the 0003-clean-dts script to cleanup the extracted ones for diffing if you want to,
23 |
24 | You can also put this in your bin folder and use it from anywhere
25 |
--------------------------------------------------------------------------------
/0005-dtb-appender/README.md:
--------------------------------------------------------------------------------
1 | ## 5. catdtb.sh ##
2 |
3 | ### About: ###
4 |
5 | Ever had a moment where you forgot to add some overlay change but your kernel build started already and you're too lazy to recompile just to add that one small change ?
6 |
7 | Well look no further lol you can just use this to lazily append the modified dtb to the compiled kernel image (Image.gz)
8 |
9 | ### Usage: ###
10 |
11 | Grab "Image.gz" from out/arch/arm64/boot.
12 |
13 | Redo the build with `make dtbs` command.
14 |
15 | This will only compile the final dtb using the modded overlay.
16 |
17 | Grab the new dtb from out/arch/arm64/boot/dts/qcom/whatever.dtb
18 |
19 | Copy it over to the same dir where you copied Image.gz from earlier.
20 |
21 | Run
22 |
23 | `./catdtb.sh`
24 |
25 | This will output
26 |
27 | Image.gz-dtb
28 |
29 | Aaand there you have it XD flash away and happy building :D
30 |
--------------------------------------------------------------------------------
/0003-clean-dts/README.md:
--------------------------------------------------------------------------------
1 | ## 2. cleandts.sh ##
2 |
3 | ### About: ###
4 |
5 | Cleans decompiled dts files to make it easier to diff between two for getting major changes in devicetree.
6 |
7 | ### Issue addressed: ###
8 |
9 | There will be times when you only have two dtb files and just want to quickly check what's different between them.
10 |
11 | The only issue is that it's riddled with phandles and other addresses which get slightly shifted which completely messes up the diff detection in almost all diffing programs.
12 |
13 | My script just cleans said nuisances and tries to make both of the dts as consistent as possible.
14 |
15 | ### Usage: ###
16 |
17 | `./cleandts.sh your_decompiled_dts_01.dts`
18 | `./cleandts.sh your_decompiled_dts_01.dts`
19 |
20 | These will output
21 |
22 | your_decompiled_dts_01_diff.dts
23 | your_decompiled_dts_02_diff.dts
24 |
25 | Then you can use something like meld to compare the two and get only the relevant changes
26 |
27 | You can also put this in your bin folder and use it from anywhere
28 |
--------------------------------------------------------------------------------
/0002-build-gcc-4.9/anykernel/anykernel.sh:
--------------------------------------------------------------------------------
1 | # AnyKernel3 Ramdisk Mod Script
2 | # osm0sis @ xda-developers
3 | properties() { '
4 | kernel.string=MOCHI
5 | do.devicecheck=0
6 | do.modules=0
7 | do.systemless=0
8 | do.cleanup=1
9 | do.cleanuponabort=0
10 | device.name1=test
11 | device.name2=
12 | device.name3=
13 | device.name4=
14 | device.name5=
15 | supported.versions=
16 | '; }
17 |
18 | block=/dev/block/bootdevice/by-name/boot;
19 | is_slot_device=0;
20 | ramdisk_compression=auto;
21 |
22 | . tools/ak3-core.sh;
23 |
24 | chmod -R 750 $ramdisk/*;
25 | chown -R root:root $ramdisk/*;
26 |
27 | dump_boot;
28 |
29 | ui_print "*******************************************"
30 | ui_print "Updating Kernel and Patching cmdline..."
31 | ui_print "*******************************************"
32 |
33 |
34 | ui_print "*******************************************"
35 | ui_print "Brought to you by MOCHI (TG: @mochi_wwww)"
36 | ui_print "*******************************************"
37 |
38 | patch_cmdline androidboot.selinux androidboot.selinux=permissive
39 |
40 | write_boot;
41 |
--------------------------------------------------------------------------------
/0007-touch-fw-dumper/README.md:
--------------------------------------------------------------------------------
1 | ## 7. dump_touch_fw.sh ##
2 |
3 | ### About: ###
4 | dump touch fw for poco x3 pro from an input direct fastboot rom link
5 |
6 | ### Usage: ###
7 |
8 | 1. `curl -LSsO https://github.com/Jebaitedneko/scripts/raw/master/0007-touch-fw-dumper/dump_touch_fw.sh`
9 | 2. `chmod +x dump_touch_fw.sh`
10 | 3. `./dump_touch_fw.sh direct_rom_link_here`
11 |
12 | ### NOTE ###
13 |
14 | You can provide `u` as second argument to the script to upload each zipped fw
15 |
16 | You can provide `k` as the third argument to the script to keep fw.xxd and kernel image
17 |
18 | #### COLAB INSTANCE ####
19 |
20 |
21 | 1. Run Cell 1
22 | 2. Open Files tab from left sidebar
23 | 3. Drop a file named `.src` with direct links for roms with boot.img, line by line
24 | 4. Run Cell 2
25 | 5. Wait a bit until the fw are zipped and links generated to `links.txt` file
26 |
--------------------------------------------------------------------------------
/0009-fedora-module-rebuild/uvc_driver.patch:
--------------------------------------------------------------------------------
1 | From 1d6eef858e0c5ae4594136df7d6be60bacd442e8 Mon Sep 17 00:00:00 2001
2 | From: Jebaitedneko
3 | Date: Fri, 2 Jun 2023 02:24:03 +0530
4 | Subject: [PATCH] patch
5 |
6 | ---
7 | uvc_driver.c | 10 ++++++++++
8 | 1 file changed, 10 insertions(+)
9 |
10 | diff --git a/uvc_driver.c b/uvc_driver.c
11 | index 7aefa76..723f303 100644
12 | --- a/uvc_driver.c
13 | +++ b/uvc_driver.c
14 | @@ -2402,6 +2402,16 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
15 | * though they are compliant.
16 | */
17 | static const struct usb_device_id uvc_ids[] = {
18 | + /* Quanta ACER HD User Facing */
19 | + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
20 | + | USB_DEVICE_ID_MATCH_INT_INFO,
21 | + .idVendor = 0x0408,
22 | + .idProduct = 0x4035,
23 | + .bInterfaceClass = USB_CLASS_VIDEO,
24 | + .bInterfaceSubClass = 1,
25 | + .bInterfaceProtocol = UVC_PC_PROTOCOL_15,
26 | + .driver_info = (kernel_ulong_t)&(const struct uvc_device_info){.uvc_version = 0x010a,}
27 | + },
28 | /* Quanta USB2.0 HD UVC Webcam */
29 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
30 | | USB_DEVICE_ID_MATCH_INT_INFO,
31 | --
32 | 2.41.0.rc2
33 |
34 |
--------------------------------------------------------------------------------
/0006-arm-magisk-patch/arm-magisk-patch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo -e "\ncarving out headers from ${1}..."
4 | dd if=$1 of=headers bs=1 skip=0 count=$(grep -obaP "\x1F\x8B\x08" $1 | cut -f1 -d ":" | head -n1)
5 |
6 | echo -e "\ncarving out Image.gz-dtb from ${1} ..."
7 | dd if=$1 of=Image.gz-dtb bs=1 skip=$(grep -obaP "\x1F\x8B\x08" $1 | cut -f1 -d ":" | head -n1)
8 |
9 | echo -e "\ncarving out dtbs from ${1} ..."
10 | dd if=$1 of=dtbs bs=1 skip=$(grep -obaP "\xD0\x0D\xFE\xED" Image.gz-dtb | cut -f1 -d ":" | head -n1)
11 |
12 | echo -e "\ngunzip Image.gz-dtb in progress ..."
13 | mv Image.gz-dtb Image.gz && 7z x Image.gz
14 |
15 | echo -e "\npatching for magisk (skip_initramfs -> want_initramfs) ..."
16 | sed -i "s|\x73\x6b\x69\x70\x5f\x69\x6e\x69\x74\x72\x61\x6d\x66\x73|\x77\x61\x6e\x74\x5f\x69\x6e\x69\x74\x72\x61\x6d\x66\x73|g" Image
17 |
18 | echo -e "\ngzip Image in progress ..."
19 | 7z a -mx9 Image.gz Image
20 |
21 | echo -e "\nAppending dtbs to the end of Image.gz ..."
22 | cat dtbs >> Image.gz && rm dtbs && mv Image.gz Image.gz-dtb
23 |
24 | echo -e "\nAppending Image.gz-dtb to the end of arm header ..."
25 | cat Image.gz-dtb >> headers && rm Image.gz-dtb
26 |
27 | echo -e "\nRenaming to ${1::-4}_repacked.img"
28 | mv headers ${1::-4}_repacked.img
29 |
--------------------------------------------------------------------------------
/0002-build-gcc-4.9/README.md:
--------------------------------------------------------------------------------
1 | ## 2. build.sh ##
2 |
3 | ### About: ###
4 |
5 | Build script and zipping script using GCC-4.9 + CCACHE for legacy devices.
6 |
7 | ### Advantage: ###
8 |
9 | We all know GCC-4.9 is painfully slow to compile with. (well it's been well over 7 years since it's release but there are plenty of legacy devices that need to use it even today)
10 | With CCACHE on Arch i was able to get a consecutive build time of 33s.
11 |
12 | ### Usage: ###
13 |
14 | Edit L#18 in build.sh to point to your device defconfig.
15 |
16 | Change L#41 in build.sh to whatever you want the zip name to be.
17 |
18 | Change L#30 in build.sh to get Image, Image.gz, Image.gz-dtb or whichever one you want to use
19 |
20 | L#32 and L#33 uses DTBTOOL to compile dt.img from dts in out/ so you may or may not need it. Configure as needed.
21 |
22 | You can edit anykernel.sh in anykernel dir to change the message to be displayed while flashing (this will be later used instead of the sh in anykernel)
23 |
24 | Build will be timed so you can see the difference in consecutive build.
25 |
26 | Clone to kernel root (might need to merge the gitignore or ignore it and add the entries from here to the ignore in the kernel)
27 |
28 | Run build.sh
29 |
30 | Toolchains will be auto-downloaded to ~/android/TOOLS/GCC by default (you can edit this in build.sh XD)
31 |
--------------------------------------------------------------------------------
/0007-touch-fw-dumper/touchfw_uploader.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "touchfw_uploader.ipynb",
7 | "provenance": [],
8 | "collapsed_sections": []
9 | },
10 | "kernelspec": {
11 | "name": "python3",
12 | "display_name": "Python 3"
13 | },
14 | "language_info": {
15 | "name": "python"
16 | }
17 | },
18 | "cells": [
19 | {
20 | "cell_type": "code",
21 | "metadata": {
22 | "id": "E3RkbppjGSAj"
23 | },
24 | "source": [
25 | "!rm -rf $(pwd)/*"
26 | ],
27 | "execution_count": 18,
28 | "outputs": []
29 | },
30 | {
31 | "cell_type": "code",
32 | "metadata": {
33 | "id": "_SHGC4TM1vAc"
34 | },
35 | "source": [
36 | "!apt install aria2 gcc-avr xxd dos2unix &> /dev/null\n",
37 | "!wget https://github.com/Jebaitedneko/scripts/raw/master/0007-touch-fw-dumper/dump_touch_fw.sh &> /dev/null\n",
38 | "!chmod +x dump_touch_fw.sh\n",
39 | "![ -f .src ] && cat .src | while read f; do bash -c \"nohup bash dump_touch_fw.sh \"$f\" u &\"; done\n",
40 | "![ -f links.txt ] && echo -e \"\\n\" && cat links.txt"
41 | ],
42 | "execution_count": null,
43 | "outputs": []
44 | }
45 | ]
46 | }
--------------------------------------------------------------------------------
/0001-dtsi_collector/dtsi_collector.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ $1 == "" ]]; then
4 | echo -e "\nProvide DTB/DTBO Target Name" && exit
5 | fi
6 |
7 | if [[ $2 == "" ]]; then
8 | echo -e "\nSearching in arch/arm64/boot/dts/qcom by default."
9 | DTS_DIR="qcom"
10 | else
11 | DTS_DIR=$2
12 | fi
13 |
14 | if [[ ! -d "out/arch/arm64/boot/dts/$DTS_DIR" ]]; then
15 | echo "$DTS_DIR is invalid. try again." && exit
16 | fi
17 |
18 | file=""
19 | if [[ $(find out/arch/arm64/boot/dts/$DTS_DIR -type f -iname ".$1.dtbo.d.pre.tmp") ]]; then
20 | echo -e "\nDTBO Target Detected at $DTS_DIR\n"
21 | file=".$1.dtbo.d.pre.tmp"
22 | else
23 | if [[ $(find out/arch/arm64/boot/dts/$DTS_DIR -type f -iname ".$1.dtb.d.pre.tmp") ]]; then
24 | echo -e "\nDTB Target Detected at $DTS_DIR\n"
25 | file=".$1.dtb.d.pre.tmp"
26 | fi
27 | fi
28 |
29 | if [[ $file == "" ]]; then
30 | echo "$1 not found. try again." && exit
31 | fi
32 |
33 | folder=${PWD##*/}_${1}
34 | [ -d ../$folder ] && rm -rf ../$folder && mkdir -p ../$folder || mkdir -p ../$folder
35 |
36 | echo "
37 | $(
38 | cat out/arch/arm64/boot/dts/$DTS_DIR/"$file" | \
39 | cut -f2 -d ':' | \
40 | sed "s/ ..\///g;s/ \///g" | \
41 | cut -f1 -d '\' |
42 | sort -u
43 | )
44 | " | column -t | while read file; do echo -e "Copying $file"; cp --parents $file ../$folder; done
45 |
46 | ( cd ../$folder; git init; git add .; git commit -m "init" ) &> /dev/null
47 |
48 | echo -e "\nInitialized Git Repo Over At $(pwd)/../$folder"
49 |
--------------------------------------------------------------------------------
/0009-fedora-module-rebuild/ec_sys-builder.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x && cd ~
3 | rpmdev-setuptree
4 | [[ ! -f $(cat .kernel-rpm) ]] && yumdownloader --source kernel | grep -oE "kernel-.*.rpm" > .kernel-rpm
5 | sudo yum-builddep $(cat .kernel-rpm)
6 | rpm -Uvh $(cat .kernel-rpm)
7 | cd ~/rpmbuild/SPECS
8 | rpmbuild -bp --target=$(uname -m) kernel.spec > .kernel-rpm-build
9 | cd ~/rpmbuild/BUILD/$(cat .kernel-rpm-build | grep -oE "kernel-.*/linux-.*.x86_64" | tail -n1)
10 |
11 | kver=$(uname -a | cut -f3 -d' ' | cut -f1 -d'-')
12 | version=$(echo $kver | cut -f1 -d.)
13 | patchlevel=$(echo $kver | cut -f2 -d.)
14 | sublevel=$(echo $kver | cut -f3 -d.)
15 | extraver=$(uname -a | cut -f3 -d' ' | cut -f2 -d'-')
16 | sed -i "s/^VERSION =.*/VERSION = ${version}/g" Makefile
17 | sed -i "s/^PATCHLEVEL =.*/PATCHLEVEL = ${patchlevel}/g" Makefile
18 | sed -i "s/^SUBLEVEL =.*/SUBLEVEL = ${sublevel}/g" Makefile
19 | sed -i "s/^EXTRAVERSION =.*/EXTRAVERSION = -${extraver}/g" Makefile
20 | cp configs/kernel-${kver}-x86_64.config .config
21 | echo -e "\nCONFIG_ACPI_EC_DEBUGFS=m" >> .config
22 | make modules_prepare
23 |
24 | xzcat /boot/symvers-$(uname -r).xz | grep "drivers/acpi" > drivers/acpi/Module.symvers
25 | xzcat /boot/symvers-$(uname -r).xz > Module.symvers
26 | make M=drivers/acpi modules
27 | xz -z drivers/acpi/ec_sys.ko
28 | sudo cp drivers/acpi/ec_sys.ko.xz /usr/lib/modules/$(uname -r)/kernel/drivers/acpi
29 |
30 | xzcat /boot/symvers-$(uname -r).xz | grep "drivers/media/usb/uvc" > drivers/media/usb/uvc/Module.symvers
31 | ( cd drivers/media/usb/uvc && patch -Np1 < ~/uvc_driver.patch )
32 | make M=drivers/media/usb/uvc modules
33 | xz -z drivers/media/usb/uvc/uvcvideo.ko
34 | sudo cp drivers/media/usb/uvc/uvcvideo.ko.xz /usr/lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc
35 |
36 | sudo depmod
37 | # make binrpm-pkg
38 | cd ~ && set +x
39 |
--------------------------------------------------------------------------------
/0002-build-gcc-4.9/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | BUILD_START=$(date +"%s")
3 | tcdir=${HOME}/android/TOOLS/GCC
4 | ak_dir=anykernel/anykernel3
5 |
6 | [ -d "out" ] && rm -rf out && mkdir -p out || mkdir -p out
7 |
8 | [ -d $tcdir ] && \
9 | echo "ARM64 TC Present." || \
10 | echo "ARM64 TC Not Present. Downloading..." | \
11 | git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 $tcdir/los-4.9-64
12 |
13 | [ -d $tcdir ] && \
14 | echo "ARM32 TC Present." || \
15 | echo "ARM32 TC Not Present. Downloading..." | \
16 | git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9 $tcdir/los-4.9-32
17 |
18 | make O=out ARCH=arm64 lineageos_a37f_defconfig
19 |
20 | PATH="$tcdir/los-4.9-64/bin:$tcdir/los-4.9-32/bin:${PATH}" \
21 | make O=out \
22 | ARCH=arm64 \
23 | CC="ccache $tcdir/los-4.9-64/bin/aarch64-linux-android-gcc" \
24 | CROSS_COMPILE=aarch64-linux-android- \
25 | CROSS_COMPILE_ARM32=arm-linux-androideabi- \
26 | CONFIG_NO_ERROR_ON_MISMATCH=y \
27 | CONFIG_DEBUG_SECTION_MISMATCH=y \
28 | -j$(nproc --all) || exit
29 |
30 | cp out/arch/arm64/boot/Image $ak_dir
31 |
32 | cc $ak_dir/../dtbtool.c -o out/arch/arm64/boot/dts/dtbtool
33 | ( cd out/arch/arm64/boot/dts; dtbtool -v -s 2048 -o dt.img )
34 |
35 | [ -d $ak_dir ] && echo -e "\nAnykernel 3 Present.\n" \
36 | || mkdir -p $ak_dir \
37 | | git clone --depth=1 https://github.com/osm0sis/AnyKernel3 $ak_dir
38 | rm $ak_dir/anykernel.sh
39 | cp $ak_dir/../anykernel.sh $ak_dir
40 |
41 | ( cd $ak_dir; zip -r ../out/A37F_KERNEL_`date +%d\.%m\.%Y_%H\:%M\:%S`.zip . -x 'LICENSE' 'README.md' 'dtbtool.c' )
42 |
43 | BUILD_END=$(date +"%s")
44 | DIFF=$(($BUILD_END - $BUILD_START))
45 | echo -e "Build completed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
46 |
--------------------------------------------------------------------------------
/0007-touch-fw-dumper/dump_touch_fw.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ROM_LINK="$1"
4 |
5 | ROM_NAME=$(echo "$ROM_LINK" | sed 's/.*\///;s/.zip//g')
6 | ROM_NAME_MIN="$(echo "$ROM_NAME" | sed 's/miui_VAYU//g;s/Global//g;s/^_/GL_/g')"
7 |
8 | if [ ! -d "$ROM_NAME_MIN" ]; then
9 | mkdir -p "$ROM_NAME_MIN"
10 | fi
11 |
12 | if [ ! -f unpack_bootimg.py ]; then
13 | wget "https://android.googlesource.com/platform/system/tools/mkbootimg/+archive/refs/heads/master.tar.gz" &> /dev/null
14 | tar -xf master.tar.gz unpack_bootimg.py && chmod +x unpack_bootimg.py && rm master.tar.gz
15 | fi
16 |
17 | cd "$ROM_NAME_MIN"
18 |
19 | echo "$ROM_NAME" > info.txt
20 |
21 | if [ ! -f "${ROM_NAME}.zip" ]; then
22 | aria2c -j32 -x16 -c -s16 "$ROM_LINK" &> aria.txt
23 | fi
24 |
25 | unzip -p "${ROM_NAME}.zip" boot.img > boot
26 |
27 | python3 "../unpack_bootimg.py" --boot_img boot --out . &> /dev/null
28 |
29 | xxd -g 1 kernel | grep "40 71 02 00" -B1 -A8702 | grep -oE "[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+" > firmware.xxd
30 |
31 | xxd -r -p <(sed -n '1,8704p' firmware.xxd | sed "s/ //g" | tr -d '\n') > j20s_novatek_ts_fw01.bin
32 | xxd -r -p <(sed -n '8705,17408p' firmware.xxd | sed "s/ //g" | tr -d '\n') > j20s_novatek_ts_mp01.bin
33 | xxd -r -p <(sed -n '17409,26112p' firmware.xxd | sed "s/ //g" | tr -d '\n') > j20s_novatek_ts_fw02.bin
34 | xxd -r -p <(sed -n '26113,34816p' firmware.xxd | sed "s/ //g" | tr -d '\n') > j20s_novatek_ts_mp02.bin
35 |
36 | dos2unix ./*.bin
37 |
38 | find . -type f -iname "*.bin" -exec avr-objcopy -I binary -O ihex {} {}.ihex \;
39 |
40 | dos2unix ./*.ihex
41 |
42 | md5sum ./*.bin ./*.ihex >> info.txt
43 |
44 | ZIPNAME="${ROM_NAME_MIN}_TOUCH_FW.zip"
45 | zip -r9 "$ZIPNAME" ./*.bin ./*.ihex info.txt &> /dev/null
46 |
47 | if [[ $3 != '' && $3 == 'k' ]]; then
48 | zip -ur "$ZIPNAME" firmware.xxd kernel
49 | fi
50 |
51 | rm ./*.bin ./*.ihex info.txt dtb ramdisk boot firmware.xxd kernel "${ROM_NAME}.zip"
52 |
53 | if [[ $2 != '' && $2 == 'u' ]]; then
54 | UPLOAD=$(curl -s -F f[]=@"$ZIPNAME" "https://oshi.at" | grep DL | sed 's/DL: //g')
55 | echo -e "$UPLOAD\n" >> ../links.txt
56 | fi
57 |
58 | mv "$ZIPNAME" ../
59 |
60 | cd ../
61 |
62 | rm -rf "$ROM_NAME_MIN"
63 |
64 | echo -e "JOB: $ROM_NAME_MIN DONE\n"
65 |
--------------------------------------------------------------------------------
/0001-dtsi_collector/README.md:
--------------------------------------------------------------------------------
1 | ## 1. dtsi_collector.sh ##
2 |
3 | ### About: ###
4 |
5 | Grabs all the DTSIs used to build a device-specific dtb.
6 |
7 | This makes rebasing DTSI changes to caf way more easier.
8 |
9 | ### Usage: ###
10 |
11 | First compile the kernel source with a bootable defconfig.
12 |
13 | If you're just grabbing from a fresh caf tree, build it using the default CAF defconfig.
14 |
15 | Place this script inside the root directory of kernel source.
16 |
17 | Open a terminal in kernel rootdir.
18 |
19 | `./dtsi_collector.sh dtbname dtsfolder`
20 |
21 | dtsfolder is qcom by default if nothing is passed as the second argument but it may be vendor/qcom for 4.19 and above. pass it as needed.
22 |
23 | A folder with the format KERNEL-DIR-NAME_DTB-NAME would be created outside the kernel dir with all the dtsis used to build that specific dtb.
24 |
25 | If unsure about which is the proper name still, open arch/arm(64)/boot/dts/qcom/Makefile and search for parts of the name you found out earlier from DMESG.
26 |
27 | ### Example: ###
28 |
29 | For msm8953 sd625 mido, the master dts name is `msm8953-qrd-sku3`.
30 |
31 | This can be found out easily by grabbing a DMESG from a normal boot cycle and search for any line with `(DT)` or `MACHINE`.
32 |
33 | You should see a similar string. That is the name of the dtb that the kernel uses to identify the hardware layout and configurations of your device.
34 |
35 | So here, the usage would be:
36 |
37 | `./dtsi_collector.sh msm8953-qrd-sku3`
38 |
39 | ### Backstory: ###
40 |
41 | So my OEM didn't release kernel sources for oreo and there were quite a few differences between the nougat dts and oreo dts when i compared the extracted ones with meld.
42 |
43 | I wanted to create proper overlays by comparing to the DTSIs of best caf base and writing them that way but the dts/qcom folder had way too many DTSIs in there and it was getting difficult to navigate.
44 |
45 | I was poking around in the `out/arch/arm64/boot/dts` folder one day and found this file named `.msm8953-qrd-sku3.dtb.d.pre.tmp`.
46 |
47 | I opened it looking for any useful info and I was pleasantly surprised. It had the list of all the DTSIs which were parsed by DTC to build the final DTB in out/ so I got to work making a script which formats the aforementioned file and grabs the DTSIs and places them to a folder outside the kernel rootdir.
48 |
49 | I did the same with the best caf base for the nougat oem source which i first built with caf defconfig and ran the script with same master dts name as argument. Now I had two folders which had the DTSIs used to build the same dtb in both best caf base and oem base.
50 |
51 | I then opened up Meld and did folder diffing for both of them and was able to plan out the changes from there.
52 |
53 | You can find the process i adopted in this repo: https://github.com/Jebaitedneko/android_kernel_10or_G/commits/3.18-dtsi-new
54 |
--------------------------------------------------------------------------------
/0008-git-patcheroo/patch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | EDITOR_CHOICE=xed
4 |
5 | function gitaliases() {
6 | alias gca='git commit --amend'
7 | alias gcp='git cherry-pick'
8 | alias grc='git rebase --continue'
9 | alias gpf='git push --force'
10 | alias grh='git reset --hard'
11 | alias clr='clear'
12 | }
13 |
14 | function crej() {
15 | find . -type f -iname "*.rej" -delete
16 | find . -type f -iname "*.orig" -delete
17 | }
18 |
19 | function orej() {
20 | find . -type f -iname "*.rej" | while read -r f; do sh -c "$EDITOR_CHOICE $f"; sh -c "$EDITOR_CHOICE ${f/.rej/}"; done
21 | }
22 |
23 | function scrape() {
24 | curl -s "$1/commits" | grep "Copy the full SHA" | grep -oE "[0-9a-f]{40}" &> ./req
25 | first=$(head -n1 < ./req)
26 | i=34; j=$2
27 | while [ $((j)) -gt 0 ]; do
28 | link="$1/commits/$3?after=$first+$i&branch=$3"
29 | echo -e "\n$link"
30 | curl -s "$link" | grep "Copy the full SHA" | grep -oE "[0-9a-f]{40}"
31 | i=$((i+35)); j=$((j-1))
32 | done
33 | rm ./req
34 | }
35 |
36 | function gpatch() {
37 |
38 | # You can export REPO_LINK=https://github.com/torvalds/linux
39 | # for example and then just call gpatch with the commit SHA
40 | # instead of the whole link everytime
41 |
42 | link=$(echo "$1" | cut -f1 -d#)
43 | name=$(echo "$link" | sed "s/.*commit\///g")
44 | ftmp="./$name"
45 | plog="./patch_log"
46 |
47 | [[ $REPO_LINK != "" ]] && link="$REPO_LINK/commit/$1"
48 | curl -s "$link".patch > "$ftmp"
49 | cmtmsg=$(awk '/---/{stop=1} stop==0{print}' < ./"$ftmp" | tail -n+2 | sed "s/\[PATCH\]//g")
50 | newlineys_msg=$(echo "$cmtmsg" | pcregrep -M 'Subject.*\n .*\n')
51 | if [[ $(("${#newlineys_msg}")) -gt 0 ]]; then
52 | corrected_msg=$(echo "$newlineys_msg" | sed ':a;N;$!ba;s/\n//g')
53 | echo "Fixing commit msg newlines"
54 | cmtmsg=$(echo "$cmtmsg" | grep -v "$newlineys_msg")
55 | cmtmsg=$(echo "$cmtmsg" | sed "/Date:.*/a $corrected_msg")
56 | fi
57 | cmtmsg="$2$cmtmsg"
58 | author="${cmtmsg/From: /}"
59 | codate="${cmtmsg/Date: /}"
60 | subjct=$(echo "${cmtmsg/Subject: /}" | tail -n+3)
61 | subjct=$(echo "$2$subjct" | sed "s/^ //g")
62 | patch -Np1 < "$ftmp" > "$plog"
63 |
64 | echo -e "\n\n------------------------------------------------------PATCH DATA START------------------------------------------------------"
65 | echo -e "\n$(cat "$plog")\n"
66 | echo -e "------------------------------------------------------PATCH DATA END--------------------------------------------------------\n\n"
67 |
68 | result="$(( $(grep -oE "*.rej" "$plog" | wc -c) + $(grep -oE "File to patch:" "$plog" | wc -c) ))"
69 | if [[ $result -eq 0 ]]; then
70 | echo -e "\nPatching succeeded. Applying commit from original data. Please review the changes and amend it."
71 | crej; rm "$plog" "$ftmp"
72 | git ls-files -dmo | grep -vE "^out/" | while read -r f; do git add -f "$f"; done
73 | git commit -m "$subjct" --author="$author" -s # --date="$codate"
74 | echo -e "\n" && git log --oneline | head -n3
75 | else
76 | echo -e "\nPatching failed. Saving the original commit info to \$subjct, author data to \$author, date to \$codate."
77 | echo -e "\n\nPlease review the changes and commit it with"
78 | echo -e "\n\ngit commit -m \"\$(echo -e \"\$subjct\")\" --author=\"\$(echo -e \"\$author\")\" --date=\"\$(echo -e \"\$codate\")\"."
79 | echo -e "\n\nRecent commits:"
80 | git log --oneline | head -n3
81 | echo -e "\n"
82 | rm "$plog" "$ftmp"
83 | fi
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/0007-touch-fw-dumper/.src:
--------------------------------------------------------------------------------
1 | https://bigota.d.miui.com/V12.0.1.0.RJUTWXM/miui_VAYUTWGlobal_V12.0.1.0.RJUTWXM_00aa3cfefa_11.0.zip
2 | https://bigota.d.miui.com/V12.0.2.0.RJUTRXM/miui_VAYUTRGlobal_V12.0.2.0.RJUTRXM_9a06cb8258_11.0.zip
3 | https://bigota.d.miui.com/V12.0.2.0.RJUTWXM/miui_VAYUTWGlobal_V12.0.2.0.RJUTWXM_217c95e9d4_11.0.zip
4 | https://bigota.d.miui.com/V12.0.3.0.RJUIDXM/miui_VAYUIDGlobal_V12.0.3.0.RJUIDXM_1511576317_11.0.zip
5 | https://bigota.d.miui.com/V12.0.3.0.RJURUXM/miui_VAYURUGlobal_V12.0.3.0.RJURUXM_f2c7080ff6_11.0.zip
6 | https://bigota.d.miui.com/V12.0.4.0.RJUEUXM/miui_VAYUEEAGlobal_V12.0.4.0.RJUEUXM_9d5ae2d814_11.0.zip
7 | https://bigota.d.miui.com/V12.0.4.0.RJUINXM/miui_VAYUINGlobal_V12.0.4.0.RJUINXM_e54da35521_11.0.zip
8 | https://bigota.d.miui.com/V12.0.4.0.RJUMIXM/miui_VAYUGlobal_V12.0.4.0.RJUMIXM_503a04bdd4_11.0.zip
9 | https://bigota.d.miui.com/V12.0.5.0.RJUEUXM/miui_VAYUEEAGlobal_V12.0.5.0.RJUEUXM_756afb9384_11.0.zip
10 | https://bigota.d.miui.com/V12.0.5.0.RJUINXM/miui_VAYUINGlobal_V12.0.5.0.RJUINXM_17d5ede63d_11.0.zip
11 | https://bigota.d.miui.com/V12.0.6.0.RJUMIXM/miui_VAYUGlobal_V12.0.6.0.RJUMIXM_eccd7da42b_11.0.zip
12 | https://bigota.d.miui.com/V12.0.6.0.RJURUXM/miui_VAYURUGlobal_V12.0.6.0.RJURUXM_55d1244f4a_11.0.zip
13 | https://bigota.d.miui.com/V12.5.1.0.RJUEUXM/miui_VAYUEEAGlobal_V12.5.1.0.RJUEUXM_8f1ef5258e_11.0.zip
14 | https://bigota.d.miui.com/V12.5.1.0.RJUIDXM/miui_VAYUIDGlobal_V12.5.1.0.RJUIDXM_28e1b99312_11.0.zip
15 | https://bigota.d.miui.com/V12.5.1.0.RJUMIXM/miui_VAYUGlobal_V12.5.1.0.RJUMIXM_502138f418_11.0.zip
16 | https://bigota.d.miui.com/V12.5.1.0.RJURUXM/miui_VAYURUGlobal_V12.5.1.0.RJURUXM_cfe292d16a_11.0.zip
17 | https://bigota.d.miui.com/V12.5.1.0.RJUTRXM/miui_VAYUTRGlobal_V12.5.1.0.RJUTRXM_c8e5e7739f_11.0.zip
18 | https://bigota.d.miui.com/V12.5.1.0.RJUTWXM/miui_VAYUTWGlobal_V12.5.1.0.RJUTWXM_1152276715_11.0.zip
19 | https://bigota.d.miui.com/V12.5.2.0.RJUEUXM/miui_VAYUEEAGlobal_V12.5.2.0.RJUEUXM_f042fd8556_11.0.zip
20 | https://bigota.d.miui.com/V12.5.2.0.RJUIDXM/miui_VAYUIDGlobal_V12.5.2.0.RJUIDXM_ccd5ae2bf8_11.0.zip
21 | https://bigota.d.miui.com/V12.5.2.0.RJUMIXM/miui_VAYUGlobal_V12.5.2.0.RJUMIXM_450711067e_11.0.zip
22 | https://bigota.d.miui.com/V12.5.2.0.RJUTRXM/miui_VAYUTRGlobal_V12.5.2.0.RJUTRXM_8b507ca133_11.0.zip
23 | https://bigota.d.miui.com/V12.5.2.0.RJUTWXM/miui_VAYUTWGlobal_V12.5.2.0.RJUTWXM_661e96fd4f_11.0.zip
24 | https://bigota.d.miui.com/V12.5.3.0.RJUEUXM/miui_VAYUEEAGlobal_V12.5.3.0.RJUEUXM_cd87d10d5f_11.0.zip
25 | https://bigota.d.miui.com/V12.5.3.0.RJUINXM/miui_VAYUINGlobal_V12.5.3.0.RJUINXM_eec8e9ea1a_11.0.zip
26 | https://bigota.d.miui.com/V12.5.3.0.RJUMIXM/miui_VAYUGlobal_V12.5.3.0.RJUMIXM_8c9f40a764_11.0.zip
27 | https://bigota.d.miui.com/V12.5.3.0.RJURUXM/miui_VAYURUGlobal_V12.5.3.0.RJURUXM_d2c495362f_11.0.zip
28 | https://bigota.d.miui.com/V12.5.3.0.RJUTRXM/miui_VAYUTRGlobal_V12.5.3.0.RJUTRXM_9ae0c1af71_11.0.zip
29 | https://bigota.d.miui.com/V12.5.3.0.RJUTWXM/miui_VAYUTWGlobal_V12.5.3.0.RJUTWXM_3340f2f777_11.0.zip
30 | https://bigota.d.miui.com/V12.5.4.0.RJUEUXM/miui_VAYUEEAGlobal_V12.5.4.0.RJUEUXM_c58b88dbee_11.0.zip
31 | https://bigota.d.miui.com/V12.5.4.0.RJUIDXM/miui_VAYUIDGlobal_V12.5.4.0.RJUIDXM_a0b73fd4eb_11.0.zip
32 | https://bigota.d.miui.com/V12.5.4.0.RJUINXM/miui_VAYUINGlobal_V12.5.4.0.RJUINXM_a0ae152bd5_11.0.zip
33 | https://bigota.d.miui.com/V12.5.4.0.RJUMIXM/miui_VAYUGlobal_V12.5.4.0.RJUMIXM_d43dee18b9_11.0.zip
34 | https://bigota.d.miui.com/V12.5.4.0.RJURUXM/miui_VAYURUGlobal_V12.5.4.0.RJURUXM_6bf1945100_11.0.zip
35 | https://bigota.d.miui.com/V12.5.4.0.RJUTRXM/miui_VAYUTRGlobal_V12.5.4.0.RJUTRXM_89cdd7fdee_11.0.zip
36 | https://bigota.d.miui.com/V12.5.5.0.RJUEUXM/miui_VAYUEEAGlobal_V12.5.5.0.RJUEUXM_65bf3713de_11.0.zip
37 | https://bigota.d.miui.com/V12.5.5.0.RJUIDXM/miui_VAYUIDGlobal_V12.5.5.0.RJUIDXM_b7bf22385b_11.0.zip
38 | https://bigota.d.miui.com/V12.5.5.0.RJUINXM/miui_VAYUINGlobal_V12.5.5.0.RJUINXM_7c5caa3f0c_11.0.zip
39 | https://bigota.d.miui.com/V12.5.5.0.RJUMIXM/miui_VAYUGlobal_V12.5.5.0.RJUMIXM_9217fed24b_11.0.zip
40 | https://bigota.d.miui.com/V12.5.5.0.RJURUXM/miui_VAYURUGlobal_V12.5.5.0.RJURUXM_eb9fa3c275_11.0.zip
41 | https://bigota.d.miui.com/V12.5.6.0.RJUIDXM/miui_VAYUIDGlobal_V12.5.6.0.RJUIDXM_03f03ad77b_11.0.zip
42 | https://bigota.d.miui.com/V12.5.6.0.RJUINXM/miui_VAYUINGlobal_V12.5.6.0.RJUINXM_448b9400c2_11.0.zip
43 | https://bigota.d.miui.com/V12.5.6.0.RJURUXM/miui_VAYURUGlobal_V12.5.6.0.RJURUXM_c32051259a_11.0.zip
44 | https://bigota.d.miui.com/V12.5.7.0.RJUMIXM/miui_VAYUGlobal_V12.5.7.0.RJUMIXM_9847c652ee_11.0.zip
45 | https://bigota.d.miui.com/V12.5.9.0.RJUMIXM/miui_VAYUGlobal_V12.5.9.0.RJUMIXM_bddf74b11e_11.0.zip
46 | https://bigota.d.miui.com/V13.0.1.0.SJUEUXM/miui_VAYUEEAGlobal_V13.0.1.0.SJUEUXM_7ef0764aa8_12.0.zip
47 | https://bigota.d.miui.com/V13.0.1.0.SJUIDXM/miui_VAYUIDGlobal_V13.0.1.0.SJUIDXM_f50700f4ac_12.0.zip
48 | https://bigota.d.miui.com/V13.0.1.0.SJUINXM/miui_VAYUINGlobal_V13.0.1.0.SJUINXM_b603785914_12.0.zip
49 | https://bigota.d.miui.com/V13.0.1.0.SJURUXM/miui_VAYURUGlobal_V13.0.1.0.SJURUXM_5e4fbb4a70_12.0.zip
50 | https://bigota.d.miui.com/V13.0.1.0.SJUTRXM/miui_VAYUTRGlobal_V13.0.1.0.SJUTRXM_9d7d4ec87e_12.0.zip
51 | https://bigota.d.miui.com/V13.0.1.0.SJUTWXM/miui_VAYUTWGlobal_V13.0.1.0.SJUTWXM_e792e25c9d_12.0.zip
52 | https://bigota.d.miui.com/V13.0.3.0.SJUMIXM/miui_VAYUGlobal_V13.0.3.0.SJUMIXM_7d71e31adb_12.0.zip
--------------------------------------------------------------------------------
/0002-build-gcc-4.9/anykernel/dtbtool.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are
6 | * met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following
11 | disclaimer in the documentation and/or other materials provided
12 | with the distribution.
13 | * Neither the name of The Linux Foundation nor the names of its
14 | contributors may be used to endorse or promote products derived
15 | from this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | */
29 |
30 | #define _GNU_SOURCE
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 |
44 | #define QCDT_MAGIC "QCDT" /* Master DTB magic */
45 | #define QCDT_VERSION 3 /* QCDT version */
46 |
47 | #define QCDT_DT_TAG "qcom,msm-id = <"
48 | #define QCDT_BOARD_TAG "qcom,board-id = <"
49 | #define QCDT_PMIC_TAG "qcom,pmic-id = <"
50 |
51 |
52 | #define PAGE_SIZE_DEF 2048
53 | #define PAGE_SIZE_MAX (1024*1024)
54 |
55 | #define log_err(x...) printf(x)
56 | #define log_info(x...) printf(x)
57 | #define log_dbg(x...) { if (verbose) printf(x); }
58 |
59 | #define COPY_BLK 1024 /* File copy block size */
60 |
61 | #define RC_SUCCESS 0
62 | #define RC_ERROR -1
63 |
64 | struct chipInfo_t {
65 | uint32_t chipset;
66 | uint32_t platform;
67 | uint32_t subtype;
68 | uint32_t revNum;
69 | uint32_t pmic_model[4];
70 | uint32_t oppoId;
71 | uint32_t dtb_size;
72 | char *dtb_file;
73 | struct chipInfo_t *prev;
74 | struct chipInfo_t *next;
75 | struct chipInfo_t *master;
76 | int wroteDtb;
77 | uint32_t master_offset;
78 | struct chipInfo_t *t_next;
79 | };
80 |
81 | struct chipInfo_t *chip_list;
82 |
83 | struct chipId_t {
84 | uint32_t chipset;
85 | uint32_t revNum;
86 | struct chipId_t *next;
87 | struct chipId_t *t_next;
88 | };
89 |
90 | struct chipSt_t {
91 | uint32_t platform;
92 | uint32_t subtype;
93 | uint32_t oppoId;
94 | struct chipSt_t *next;
95 | struct chipSt_t *t_next;
96 | };
97 |
98 | struct chipPt_t {
99 | uint32_t pmic0;
100 | uint32_t pmic1;
101 | uint32_t pmic2;
102 | uint32_t pmic3;
103 | struct chipPt_t *next;
104 | struct chipPt_t *t_next;
105 | };
106 |
107 | char *input_dir;
108 | char *output_file;
109 | char *dtc_path;
110 | char *dt_tag = QCDT_DT_TAG;
111 | int verbose;
112 | int page_size = PAGE_SIZE_DEF;
113 | int version_override = 0;
114 |
115 | void print_help()
116 | {
117 | log_info("dtbTool version %d (kinda :) )\n", QCDT_VERSION);
118 | log_info("dtbTool [options] -o