Well, my problem is when i unpack and repack a funtional recovery.img this dont run.
I use this parameters with cygwin:
./split_bootimg.pl recovery.img
./unpack-bootimg.pl recovery.img
Mkdir ramdisk
Cd ramdisk
gzip -dc ../recovery.img-ramdisk.gz | cpio –i
SOURCE CHANGES
Cd ..
Find ./ramdisk | cpio –o –H newc | gzip > newramdisk.cpio.gz
mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel recovery.img-kernel --ramdisk newramdisk.cpio.gz -o recoveryNew.img
If i do changes or not, the result after flash the new recoveryNew.img is a frezzee into logo.
What i doing wrong?
HELP!!!
Related
I am trying to replace the kernel in a boot.img, and then repackage it to a zip that can be flashed. I am trying to follow a guide. Since I am not allowed to post a link, I'll post an excerpt:
E. The Boot.img
We already know that this is the kernel and ramdisk needed to boot up the device. You can pull this apart and swap out the kernel if you would like. For this, you're going to have to run Linux. If you're not able to run Linux natively, download Sun's Virtual Box and an easy to use Linux distro like Ubuntu or Fedora. We will leave custom kernel compilation for another day. To extract and rebuild the Boot.img we need some tools. These are in the attached Boot-tools.zip file found in the first post. Extract the entire zip file into a tools directory in the top level of your working directory. Open your terminal and navigate to your working directory, then enter the following commands:
Code:
/tools/extract-kernel.pl boot.img
/tools/extract-ramdisk.pl boot.img
This will place a copy of the kernel and ramdisk in your working directory. Overwrite the kernel image with the kernel you would like to use. Then re-package everything as so:
Code:
mkbootfs boot.img-ramdisk | gzip > ramdisk-boot
mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o newBoot.img --base 0x19200000
Click to expand...
Click to collapse
I have no problem with the first 3 commands:
extract-kernel.pl boot.img
extract-ramdisk.pl boot.img
mkbootfs boot.img-ramdisk | gzip > ramdisk-boot
But this last command just returns the mkbootimg syntax help blurb:
mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o newBoot.img --base 0x19200000
it returns this:
usage: mkbootimg
--kernel <filename>
--ramdisk <filename>
[ --second <2ndbootloader-filename> ]
[ --cmdline <kernel-commandline> ]
[ --board <boardname> ]
-o|--output <filename>
I noticed that the --base option isn't included in the help, so I left out the "--base 0x19200000". This worked fine and created the newBoot.img file. Will this be safe to use?
Thanks in advance.
i get the boot.img from my sky a800s rom, and use the following code to unpack it :
Code:
./unpackbootimg -i boot.img
it shows:
Code:
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.hardware=qcom loglevel=0
BOARD_KERNEL_BASE 40200000
BOARD_PAGE_SIZE 2048
then i repack the boot without any changes with the command:
Code:
./mkbootimg --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=qcom loglevel=0' --kernel boot.img-zImage --ramdisk boot.img-ramdisk.gz --base 0x40200000 --pagesize 2048 -o boot-sky.img
however, the repacking one boot-sky.img is about half of the original in size, and when i flash the boot-sky.img into my handset, it cannot boot up.
can anyone give me some advice for this strange things?
up, anyone can help me??
@HoaPham98 , @Zaaap72 , @invaderjohn , @siracuervo and other devs
In the last few days I tried to compile TWRP 2.8.3.0 for D620 without success. What I managed to compile, is not working; when I try to enter in recovery the phone enter in fastboot.
My environment was installed like here.
Then I deleted /bootable/recovery (CWM recovery) and I used this command to download TWRP recovery:
git clone git:/github.com/omnirom/android_bootable_recovery.git -b android-4.4 /bootable/recovery
The next thing I did was to download Zaaap72 sources:
Code:
git clone git://github.com/Zaaap/android_device_lge_d620.git -b master device/lge/d620
git clone git://github.com/Zaaap/android_vendor_lge_d620.git -b master vendor/lge/d620
git clone git://github.com/Zaaap/android_kernel_lge_d620.git -b master kernel/lge/d620
Next I used the next command:
.build/tools/device/makerecoveries.sh cm_D620r-eng
source build/envsetup.sh
lunch cm_d620-eng
And to compile the recovery I used:
make clobber - I used this every time I modified BoardConfig.mk
sudo make clean && make -j5 recoveryimage
In the first tests, I had a lot off errors, and I had do delete Zaaap72 Kernel source and I used TARGET_PREBUILT_KERNEL := device/lge/d620/kernel in BoardConfig.mk.
Next, if the settings bellow were set in BoardConfig.mk the compile stop every time and it given me the next error:
make: *** No rule to make target '/home/amd/android/system/out/host/linux-x86/bin/dtbToolCM', needed by '/home/amd/android/system/out/target/product/d620/dt.img'. Stop.
Code:
BOARD_CUSTOM_BOOTIMG_MK := device/lge/d620/mkbootimg.mk
BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_OFFSET := 0x00008000
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01000000 --tags_offset 0x01e00000
If I disabled the settings, the compile was OK, but recovery.img is not booting.
I decompile the recovery.img and the first thing I saw was the missing off twrp.fstab from etc folder.
Next I tried to repack the recovery.img with the next commands:
Code:
./unmkbootimg recovery.img > output.txt - unpack recovery.img
gunzip -c ../initramfs.cpio.gz | cpio -i - unpack ramdisk
mkbootfs ramdisk | gzip > ramdisk-new.gz -repack ramdisk with mkbootfs
or
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz - repack ramdisk
and the command to repack recovery.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot1.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot2.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 --pagesize 2048 --ramdisk_offset 0x01000000 --tags_offset 0x01e00000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot3.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x01e00000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot5.img
All the recovery repack give me the same result, fastboot instead of recovery.
I tested another thing, because I believe the pack of recovery is the problem. I tried to unpack and repack TWRP recovery made by Zaaap72 , and none of my test recovery files are working.
So I think the problem with compilation is with the pack of recovery and I don't know how to fix it, and my method to unpack and repack is not working. I attached my test BoardConfig.mk file.
Can anyone help me with the compile of TWRP 2.8.3.0.
Use stock dtb or https://github.com/Garcia98/android_device_lge_d620/commit/7de7345cf5dbb94f0b7344d0580af66a60cd5cd0
Sent from my D620r [Stock 4.4.2]
I used mkbootimg.mk from Garcia98 and now I am getting a new error:
make: *** No rule to make target '/home/amd/android/system/out/target/product/d620/obj/KERNEL_OBJ/usr', needed by '/home/amd/android/system/out/target/product/d620/dt.img'. Stop.
I think I'm wrong somewhere, because I tried with Zaaap72 source (original and with mkbootimg.mk from Garcia98) and with Garcia98 source, and every time I have a lot of errors.
Should I used to compile recovery with a built kernel extracted from an working recovery, or should I compile recovery with kernel built from source?
And why I can not rebuilt an working recovery with the command displayed in my first post? - The recovery can be repack correctly with Android Image Kitchen.
And what is dt.img? The recovery is composed from dt.img + RAM DISK(TWRP, CWR, PhilZ or stock) + kernel
Sorry for the noob questions, but this things are new to me and I don't know how to move on from this point.
Don't use his file. Just the commit I posted.
Garcia's file is for normal android kernel, not recovery.
Or, you can extract dtb.img from stock recovery using Android Image Kitchen and put it in your recovery (again, using AIK)
Sent from my D620r [Stock 4.4.2]
@Vagelis1608 Thank you very much for your help.
I managed to compile TWRP 2.8.1.0, and after unpackimg and repackimg (I added dtb.img from stock recovery) with Android Image Kitchen my recovery is working (the backup function is working, wipe function is working, and on restore function I only tested data restore).
The only problem remaining is entering in recovery with volume down + power, the recovery factory reset the phone.
On CWM and PhilZ this problem can be fix by editing recovery.c and set wipe_data = wipe_cache = 0.
On TWRP I don't know which file and what I have to edit.
http://forum.xda-developers.com/showthread.php?p=54955945
Sent from my D620r [Stock 4.4.2]
I've read several tutorials both here and elsewhere. I've got a few different methods down using mkbootimg, unpackbootimg, abootimg, the perl scripts, and I have gzip/gunzip/cpio commands down. Splitting and repacking go without errors.
However, I cannot, to save my life, whether I modify something or not, get a boot image that I split and repacked to boot on my device.
I have a G4 H811 the T-Mobile variant. I have been playing with boot images and kernels included with ROMs and a custom kernel, even dd'd the working boot partition from my device. I simply cannot repack something that boots.
Here's an example approach, here I'm using binaries from a custom kernel zip mkbootimg, unpackbootimg, and the busybox included in the zip. I'm doing exactly what the kernel maintainer does to split the image, replace zImage and repack, only manually in a terminal and modifying the ramdisk leaving everything else alone.
mkdir boot
cd boot/
cat /dev/block/bootdevice/by-name/boot >boot.img
chmod 755 busybox
chmod 755 mkbootimg
chmod 755 unpackbootimg
./unpackbootimg -i boot.img
mkdir initrd
cd initrd
cat ../boot.img-ramdisk.gz | ../busybox gunzip | ../busybox cpio -vid
vi init.rc(made changes)
../busybox find . | ../busybox cpio -o -H newc | ../busybox gzip >../myinitrd.img
cd ..
./mkbootimg --kernel boot.img-zImage --ramdisk myinitrd.img --cmdline "$(cat boot.img-cmdline)" --base 0x$(cat boot.img-base) --pagesize 4096 --ramdisk_offset $(cat boot.img-ramdiskoffset) --tags_offset $(cat boot.img-tagsoffset) --output myboot.img
./busybox dd if=myboot.img of=/dev/block/bootdevice/by-name/boot
I end up with with a 26.8MB myboot.img and a bootloop
Here's a really good example, I changed absolutely nothing. After unpacking and repacking I end up with two different size boot images. What am I missing here?
I recently got my hands on a WeTek Hub. All round quite a nice little box, but the default lowmemorykiller settings are a little annoying, and sometimes result in the boot failing because the kernel decided to kill one of the startup processes. I'm trying to modify the settings in the init.rc, but I'm having a spot of trouble with a boot loop after repacking the boot image.
I copied the image off the device by using dd to extract the partition to a file, and then used the built-in FTP server to copy it off the device, and extracted it using unmkbootimg. after unzipping, extracting, modifying, and re-packing, I used mkbootimg to recreate the image, and dd'd it back onto the box (commands below).
Code:
dd if=/dev/block/boot of=/sdcard/boot.img
Code:
./unmkbootimg boot.img
mv initrd.img{,.gz}
gunzip initrd.img.gz
mkdir initrd
cp initrd.img initrd
cd initrd
cpio -i < initrd.img
rm initrd.img
# change stuff here
find . | cpio -o -H newc > ../initrd.cpio
cd ..
gzip initrd.cpio
./mkbootimg --kernel kernel.gz --ramdisk initrd.img.gz -o new_boot.img
Code:
dd if=/sdcard/new_boot.img of=/dev/block/boot
Unfortunately, that left me with a flashing WeTek logo as the it continuously rebooted. examining the logs from u-boot didn't give anything useful, but luckily I was able to get it into recovery and flash Ricardo's Android TV ROM back on there. Unfortunately, I'm still stuck with the original boot failure issue. Any clues as to what I've missed?
I do so
Code:
cd boot
../mkboot boot.img unpaсk
cd unpack/ramdisk
find . | cpio -o -H newc | gzip > ../ramdisk.packed
[I][B]# (edit size ramdisk in /boot/unpack/img_info file)[/B][/I]
cd ../..
../mkboot unpack boot.img
all is working