M
ModdingMyMind
Guest
OP updated with version 2.7.0.2d. See Changelog.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
OP updated with version 2.7.0.2d. See Changelog.
I feel like everyday you release a new version of recovery lol
I'm actually working on a kernel completely separate from this project right now.
For this device?
Thank you for all your hard work. Greatly appreciated.OP updated with version 2.7.0.2d. See Changelog.
Thank you for all your hard work. Greatly appreciated.
I tried to "fastboot boot TWRP.img" this version. Still doesn't work that way-still need to flash it to recovery. Any ideas why?
Is that something inside the TWRP image file, or is that a parameter we must put in the fastboot command line?It's the bootloader. Not the recovery. Have to boot it another way using a different command which specifies the kernel, however, I havent figured out the precise command yet. When I do, I will share it. One if the Nexus devices has the same issue but they already figured out the command to get around the problem.
Is that something inside the TWRP image file, or is that a parameter we must put in the fastboot command line?
boot <kernel> [ <ramdisk> ] download and boot kernel
Well, I put your latest TWRP release through unpackbootimg and then tried fastboot boot /path/to/zImage /path/to/ramdisk.gz but all that did was freeze the device, requiring a battery pull. The boot command's parameters are:
Code:boot <kernel> [ <ramdisk> ] download and boot kernel
fastboot -c "lge.kcal=0|0|0|x" boot customrecovery.img

#!/system/bin/sh
#
# This script has six optional parameters:
#
tools=/data/tmp/tools;
binaries=/data/tmp/binaries;
scripts=/data/tmp/tools/scripts;
working=/data/tmp/prebuilt/working_folder;
prebuilt=/data/tmp/prebuilt/kernel;
chown -R root root /data/tmp
chmod -R 0775 /data/tmp
# Get the file descriptor for output
# to communicate back to the recovery
OUTFD=$($tools/busybox ps | $tools/busybox grep -v "grep" | $tools/busybox grep -o -E "updater(.*)" | $tools/busybox cut -d " " -f 3);
# Same as the ui_print command in updater_script, for example:
#
# ui_print "hello world!"
#
# will output "hello world!" to recovery, while
#
# ui_print
#
# outputs an empty line
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD;
echo "ui_print " 1>&$OUTFD;
else
echo "${1}";
fi;
}
#
# Check for strange boot.img header
#
check_header=`$tools/busybox od -A n -h -j 0 -N 8 $working/boot.img | sed 's/ //g'`
if [ "$check_header" != "4e415244494f2144" ]
then
ui_print;
ui_print "Android 'magic' header not found at start of boot.img";
ui_print "Checking if it exists elsewhere ...";
# Searching for the headers hex offset
hex_offset=`$tools/busybox od -x -A x $working/boot.img | grep -m 1 "4e41 [ ]*5244 [ ]*494f [ ]*2144" | sed -e 's/ .*//'`
if [ "$hex_offset" != "" ]
then
#
# Remove leading bytes before the Android header
#
dec_offset=`printf "%d" 0x$hex_offset`
ui_print "Android header found at offset $dec_offset";
ui_print "Removing extra stuff before it so boot.img can be read properly ...";
dd if=$working/boot.img of=$working/modboot.img bs=1 skip=$dec_offset
rm -f $working/boot.img
mv $working/modboot.img $working/newboot.img
ui_print;
dump_boot() {
cd $working;
$binaries/unmkbootimg -i $working/newboot.img >> $working/repackbootimg.txt;
rm $working/kernel;
rm $working/newboot.img;
mv $prebuilt/zImage $working/kernel;
}
prep_boot() {
echo \#!/sbin/sh > $working/createnewboot.sh;
sed -n 5,10p $working/repackbootimg.txt >> $working/createnewboot.sh;
chown root root $working/createnewboot.sh;
chmod 775 $working/createnewboot.sh;
sh $working/createnewboot.sh;
}
dump_boot;
prep_boot;
return $?
exit 0
else
ui_print "Warning: Android header not found in boot.img (unsupported format)";
return $?
exit 1
fi
fi
mv $working/boot.img $working/newboot.img
rm -f $working/boot.img
dump_boot() {
cd $working;
$binaries/unmkbootimg -i $working/newboot.img >> $working/repackbootimg.txt;
rm $working/kernel;
rm $working/newboot.img;
mv $prebuilt/zImage $working/kernel;
}
prep_boot() {
echo \#!/sbin/sh > $working/createnewboot.sh;
sed -n 5,10p $working/repackbootimg.txt >> $working/createnewboot.sh;
chown root root $working/createnewboot.sh;
chmod 775 $working/createnewboot.sh;
sh $working/createnewboot.sh;
}
dump_boot;
prep_boot;
return $?
exit 0

$binaries/unmkbootimg -i $working/newboot.img >> $working/repackbootimg.txt;
as a flashable zip.Need some assistance possibly... From someone who is really good with scripts? I have been working on a small project which pretty much works now with the exceptions of calling the unmkbootimg binary I have. Keeps giving me problems in my script. Here is what I am working with below. I can also zip it all up and send it your way assuming you know what you are doing. The recovery makes it a pain to use a binary haha.
PHP:#!/system/bin/sh # # This script has six optional parameters: # tools=/data/tmp/tools; binaries=/data/tmp/binaries; scripts=/data/tmp/tools/scripts; working=/data/tmp/prebuilt/working_folder; prebuilt=/data/tmp/prebuilt/kernel; chown -R root root /data/tmp chmod -R 0775 /data/tmp # Get the file descriptor for output # to communicate back to the recovery OUTFD=$($tools/busybox ps | $tools/busybox grep -v "grep" | $tools/busybox grep -o -E "updater(.*)" | $tools/busybox cut -d " " -f 3); # Same as the ui_print command in updater_script, for example: # # ui_print "hello world!" # # will output "hello world!" to recovery, while # # ui_print # # outputs an empty line ui_print() { if [ $OUTFD != "" ]; then echo "ui_print ${1} " 1>&$OUTFD; echo "ui_print " 1>&$OUTFD; else echo "${1}"; fi; } # # Check for strange boot.img header # check_header=`$tools/busybox od -A n -h -j 0 -N 8 $working/boot.img | sed 's/ //g'` if [ "$check_header" != "4e415244494f2144" ] then ui_print; ui_print "Android 'magic' header not found at start of boot.img"; ui_print "Checking if it exists elsewhere ..."; # Searching for the headers hex offset hex_offset=`$tools/busybox od -x -A x $working/boot.img | grep -m 1 "4e41 [ ]*5244 [ ]*494f [ ]*2144" | sed -e 's/ .*//'` if [ "$hex_offset" != "" ] then # # Remove leading bytes before the Android header # dec_offset=`printf "%d" 0x$hex_offset` ui_print "Android header found at offset $dec_offset"; ui_print "Removing extra stuff before it so boot.img can be read properly ..."; dd if=$working/boot.img of=$working/modboot.img bs=1 skip=$dec_offset rm -f $working/boot.img mv $working/modboot.img $working/newboot.img ui_print; dump_boot() { cd $working; $binaries/unmkbootimg -i $working/newboot.img >> $working/repackbootimg.txt; rm $working/kernel; rm $working/newboot.img; mv $prebuilt/zImage $working/kernel; } prep_boot() { echo \#!/sbin/sh > $working/createnewboot.sh; sed -n 5,10p $working/repackbootimg.txt >> $working/createnewboot.sh; chown root root $working/createnewboot.sh; chmod 775 $working/createnewboot.sh; sh $working/createnewboot.sh; } dump_boot; prep_boot; return $? exit 0 else ui_print "Warning: Android header not found in boot.img (unsupported format)"; return $? exit 1 fi fi mv $working/boot.img $working/newboot.img rm -f $working/boot.img dump_boot() { cd $working; $binaries/unmkbootimg -i $working/newboot.img >> $working/repackbootimg.txt; rm $working/kernel; rm $working/newboot.img; mv $prebuilt/zImage $working/kernel; } prep_boot() { echo \#!/sbin/sh > $working/createnewboot.sh; sed -n 5,10p $working/repackbootimg.txt >> $working/createnewboot.sh; chown root root $working/createnewboot.sh; chmod 775 $working/createnewboot.sh; sh $working/createnewboot.sh; } dump_boot; prep_boot; return $? exit 0
Below is the code that is screwing me up. The binary is called but gives me a segmentation fault
Code:$binaries/unmkbootimg -i $working/newboot.img >> $working/repackbootimg.txt;
The concept is similar to Koushes Anykernel but his doesn't work so I am redesigning pretty much the whole concept and by also adding in that the boot.img is checked to see if it can be read and if not then it is fixed before proceeding. Need this to work so I can use it for my kernelsas a flashable zip.
What exactly are you trying to do with this?
EDIT: After reading through the script, I notice that you define both dump_boot() and prep_boot() twice and call both of them twice
I notice the script doesn't make the directories defined in the variables at the top; is that something to be done by the updater-script or some other script and how would I go about testing this.
On a side note, ADB doesn't seem to be working in TWRP (the device isn't detected and the output of lsusb indicates that the device is in "charge mode" which will make it difficult for me to test this at the moment)
Well, technically, it is in charge mode lol. You have it plugged up to a power source.
I will have to checkout adb on my end to confirm that part.

/tmp/tools/scripts # ./check_bootimg_header.sh ../boot.img
chown: root: No such file or directory
chown: /data/tmp: No such file or directory
chmod: /data/tmp: No such file or directory
ash: : unknown operand
ash: : unknown operand
Android 'magic' header not found at start of boot.img
ash: : unknown operand
Checking if it exists elsewhere ...
ash: : unknown operand
Android header found at offset 256
ash: : unknown operand
Removing extra stuff before it so boot.img can be read properly ...
16776960+0 records in
16776960+0 records out
16776960 bytes (16.0MB) copied, 272.457806 seconds, 60.1KB/s
ash: : unknown operand
./check_bootimg_header.sh: line 87: /tmp/binaries/unmkbootimg: not found
rm: can't remove '/tmp/prebuilt/working_folder/kernel': No such file or directory
chown: root: No such file or directory
/tmp/tools/scripts #
See my edit
On a side note, how long should it take for the removal of everything before the Android header?

It takes a bit because it has to use the dd command to remove them.
And yea, adb works lol, I think you used the wrong command initially.
adb sideload filename.zip
Oh, I just flashed it with TWRP