diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 index 3d0ee31..e097347 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017, Danila Suslov +Copyright (c) 2018, Danila Suslov Permission to use, copy, modify, and/or distribute this software, with or without modifications, for any purpose with or without fee is hereby granted, provided that the above diff --git a/README.md b/README.md new file mode 100755 index 0000000..58fa435 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# HELPERS + +### ```My scripts. Developed to make kernel and android development easier``` + +``` How to Use ``` + +> ### For Parsing DTS From Stock DTB : + ./dts.sh markw Image.gz-dtb + markw = my device name here + Image.gz-dtb = my kernel name in this directory! + +> ### For comparing Defconfigs : + python compare_defconfig.py mido_defconfig mido1_defconfig > Difference.txt + mido_defconfig & mido1_defconfig = name of defconfig to compare! + Difference.txt = Difference between two defconfig! + +> ### For Repacking ( boot.img & recovery.img ) : + python repack_images.py stock.img folderwithkernels/ + + +```contributors ``` + +* @assusdan +* @yuvraj99 diff --git a/compare_defconfig.py b/compare_defconfig.py old mode 100644 new mode 100755 index 7d58cdf..c45bf8d --- a/compare_defconfig.py +++ b/compare_defconfig.py @@ -1,6 +1,3 @@ -# Usage: -# python compare_defconfig.py defconfigA defconfigB > difference.txt -# # Compare two defconfigs and add difference in file import sys diff --git a/dtc b/dtc old mode 100644 new mode 100755 diff --git a/dts.sh b/dts.sh new file mode 100755 index 0000000..03845d1 --- /dev/null +++ b/dts.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# +# Copyright (c) 2018 - 2019 Danya Suslov +# https://github.com/assusdan +# + +# Don't Touch This + +DEVICE=$1 +DTBIMG=$2 +ARG_COUNT="$#" + +# ARGS + +if [ $ARG_COUNT -lt "2" ] +then + echo "Not enough arguments were specified, run the script again with proper arguments" + exit 1 +fi + +# Start Parsing + +DTBSIG="00 00 d0 0d fe ed" +DTBSIGOFF=2 +rm -rf ./$DEVICE_$(date +%Y%m%d) +mkdir -p $DEVICE_$(date +%Y%m%d) +hexdump -v -e "1/1 \"%02x \"" $DTBIMG >./$DEVICE_$(date +%Y%m%d)/$DEVICE_hex.txt +unset OFFSETS +unset SIZES +declare -a OFFSETS +declare -a SIZES +BCNT=0 +for OFF in `grep -oba "$DTBSIG" ./$DEVICE_$(date +%Y%m%d)/$DEVICE_hex.txt | awk -F':' '{print $1}'`; \ +do \ + let "SIGOFF = OFF/3 + DTBSIGOFF"; \ + let "OFFSETS[BCNT] = SIGOFF"; \ + if [[ $BCNT > 0 ]]; then let "SIZES[BCNT-1] = SIGOFF - OFFSETS[BCNT-1]"; fi; \ + let "BCNT += 1"; \ +done +rm ./$DEVICE_$(date +%Y%m%d)/$DEVICE_hex.txt +ACNT=0 +for OFF in "${OFFSETS[@]}"; \ +do \ + DTNAME=$(printf "./$DEVICE_$(date +%Y%m%d)/dt_%02d" $ACNT); \ + if [[ $ACNT == $(($BCNT-1)) ]]; then \ + dd if=$DTBIMG of=$DTNAME.bin ibs=1 skip=$(($OFF)); \ + else \ + dd if=$DTBIMG of=$DTNAME.bin ibs=1 skip=$(($OFF)) count=$((${SIZES[$ACNT]})); \ + fi; \ + ./dtc -I dtb $DTNAME.bin -O dts -o $DTNAME.dts; \ + rm $DTNAME.bin; \ + let "ACNT += 1"; \ +done + +# Unsetting variables +unset DEVICE +unset DTBIMG +unset ARG_COUNT diff --git a/mailru.sh b/mailru.sh deleted file mode 100644 index 2d6991f..0000000 --- a/mailru.sh +++ /dev/null @@ -1,6 +0,0 @@ -URL=$1 -FILENAME=$2 -URLPART0=$(wget --quiet -O - $URL | grep -o '"weblink_get":\[[^]]\+\]' | sed 's/.*"url":"\([^"]\+\)".*/\1/') -URLPART1=$(echo $URL | awk -F '/public/' '{print $2}') -URLPART2=$(wget --quiet -O - "https://cloud.mail.ru/api/v2/tokens/download" | sed 's/.*"token":"\([^"]\+\)".*/\1/') -wget --no-check-certificate --referer=$URL "$URLPART0/$URLPART1/$FILENAME?key=$URLPART2" -O $FILENAME diff --git a/repack_images.py b/repack_images.py old mode 100644 new mode 100755 index 52343c7..b5cc972 --- a/repack_images.py +++ b/repack_images.py @@ -1,8 +1,4 @@ -# Usage: -# python repack_images.py stock.img folderwithkernels/ -# -# Repacks your boot/recovery image with all kernels from folderwithkernels/ dir. -# Uses tool.exe for repacking +# Start Repacking Image import sys from shutil import copyfile diff --git a/sc.sh b/sc.sh deleted file mode 100644 index 4f8f224..0000000 --- a/sc.sh +++ /dev/null @@ -1,32 +0,0 @@ -DTBIMG=dtb.img -DTBSIG="00 00 d0 0d fe ed" -DTBSIGOFF=2 -rm -rf ./phone_dts -mkdir -p phone_dts -hexdump -v -e "1/1 \"%02x \"" $DTBIMG >./phone_dts/dtb_hex.txt -unset OFFSETS -unset SIZES -declare -a OFFSETS -declare -a SIZES -BCNT=0 -for OFF in `grep -oba "$DTBSIG" ./phone_dts/dtb_hex.txt | awk -F':' '{print $1}'`; \ -do \ - let "SIGOFF = OFF/3 + DTBSIGOFF"; \ - let "OFFSETS[BCNT] = SIGOFF"; \ - if [[ $BCNT > 0 ]]; then let "SIZES[BCNT-1] = SIGOFF - OFFSETS[BCNT-1]"; fi; \ - let "BCNT += 1"; \ -done -rm ./phone_dts/dtb_hex.txt -ACNT=0 -for OFF in "${OFFSETS[@]}"; \ -do \ - DTNAME=$(printf "./phone_dts/dt_%02d" $ACNT); \ - if [[ $ACNT == $(($BCNT-1)) ]]; then \ - dd if=$DTBIMG of=$DTNAME.bin ibs=1 skip=$(($OFF)); \ - else \ - dd if=$DTBIMG of=$DTNAME.bin ibs=1 skip=$(($OFF)) count=$((${SIZES[$ACNT]})); \ - fi; \ - ./dtc -I dtb $DTNAME.bin -O dts -o $DTNAME.dts; \ - rm $DTNAME.bin; \ - let "ACNT += 1"; \ -done \ No newline at end of file diff --git a/tool.exe b/tool.exe old mode 100644 new mode 100755