1

Is there any way to backup/dump kernel image without root or twrp/cwm ?

3

It is possible to dump device partitions without root or custom recovery - if your device has "fastboot" mode and is boot unlocked. I'm not going to describe unlocking the boot loader, but with a fastboot device it is usually pretty easy - search the internet for instructions for your specific device.

You will need a TWRP recovery image for your device, but you don't need to actually install it on the device - we'd just temporarily boot into it to get access to the raw boot partition. Look at https://twrp.me/Devices/ and download the image for your device.

Preparations:

You need to find out which partition you want to backup from the device's storage. Usually there is a by-name directory somewhere under the devices tree that lists all the operating system's partitions with names and physical partition identifiers.

  1. Install ADB and Fastbook command line tools.
  2. On your device, enable "Developer Mode" and then go into the developer settings and enable "USB debugging".
  3. Connect your device to your computer.
  4. On your computer run adb devices and verify your device is listed. You may need to authorize access on the device itself in a popup that will appear.
  5. Run adb shell to go into the device's command line shell
  6. Run find /dev -name 'by-name' 2>/dev/null to find the by-name directory. It should list one, though if there are a couple, it shouldn't be a problem and both should work.
  7. Take the directory name and run ls -la <by-name-directory> (replacing the place holder with the actual directory name)
  8. Find the name of the partition you are interested in - if you want just the kernel, the name is boot, or if your device has multiple slots, it is probably boot_a - and record the physical partition path listed for it. It should be something like /dev/block/mmcblk0p22 (this is on my Mi A1 device - if you have a different one, the number after "p" will be different and possibly even the number before "p").

If you do not have a by-name directory on your device, you might want to search the internet for the correct device name, though there are ways to detect the correct partition from within the device - comment if you need help.

Steps to Backup

  1. Reboot your device to the fastboot boot loader. There's usually a boot time key combination for this, on my Xiaomi Mi A1 its POWER + VOLUME-DOWN, but you can also use ADB to do that: execute adb reboot-bootloader to go directly to fastboot mode.
  2. Use fastboot to boot into the TWRP image you downloaded, without installing it on the device: fastboot boot recovery-3.2.1-1.img . It will take a couple of minutes for the device to boot into TWRP, so be patient.
  3. On your computer, run adb pull /dev/block/mmcblk0p22 boot.img, replacing "mmcblk0p22" with the correct boot device path you found in the preparations stage, and "boot.img" with where you actually want to save the kernel boot image.

If your device has multiple boot slots, its probably a good idea to backup both (on my device, for some reason, after a clean install and update, they are not identical).

Good luck.

  • First to be honest I can't even remember why I needed to dump these images this way. However in your answer you are using twrp (you don't install it but you are using it, we are not lawyers to use loopholes like that :) ), one more thing you have provided a link to download twrp from official site, but much of phones (those not so famous or not high end devices) doesn't even have an unofficial build, so tough luck for a lot of people. However I appreciate the effort, cheers. – Једноруки Крстивоје Jun 1 '18 at 23:02
  • Well, if we can't load any custom boot code, then the answer would have to be "no, you can't". You don't have to use official TWRP - you can use any recovery that offers adb access. You didn't mention which device your using, so I had to go with a generic solution. That being said, I wrote this for my own needs, which BTW is using a Xiaomi Mi A1, that is not a high end not overly famous, and it has a TWRP release. I hope this answer helps other people, and if you still want to try it and your missing something (like a TWRP release) - please give more details on your device and I'll try to help – Guss Jun 1 '18 at 23:40
0

I just used

dd if=/dev/block/mmcblk0p15 of=test_boot.img

and then used adb to download the file for a backup of the boot ramfs

  • 1
    To do this you'd need root access on your device (for raw block access through the device tree), and busybox (for dd) - which you'd also need root access to install, through most rooting manuals and/or "su applications" include it. Also, mmcblk0p15 may be right for your device but is unlikely to be correct for devices from other manufacturers (or even the same manufacturer). In my answer I describe a method to find the correct block device for any Android phone. – Guss Feb 10 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.