Boot boot.img and recovery.img from U-boot? - Android Software/Hacking General [Developers Only]

I don't know if I can get an answer here, but is there any source files for U-boot to let me able to boot boot.img and recovery.img directly? Currently I can only manually pack uImages for kernel and ramdisk and boot them using bootm command.
P.S. I am the project leader of ipaq214android

Related

"android magic not found in boot.img"

When im trying to add init.d support to a kernel, and i make a ramdisk out of my boot.img i get this error:
"android magic not found in boot.img. giving up"
I took the boot.img from the latest firmware.zip from the OTA.
Can somebody help me?
The first 7 letters of your boot.img file should read ANDROID

[Q] Boot custom image without flashing it

This may seem an already (10 times) solved question, but I'm unable to boot my Mogo G with a custom boot.img instead of the one flashed on the device.
The phone is an XT1032, currently running KitKat 4.4.4, and I use the latest SDK tools.
I download the stock firmware from sbf.droid-developers.org/phone.php, where I choose RETAIL-FR_FALCON_KLB20.9-1.10-1.24-1.1_cid7_CFC_1FF_SVC.xml.zip
I extract the boot.img file using standard unzip tools, and the zImage and initrd.img files using abootimg
Code:
adb reboot-bootloader
The phone reboots and gets to the fastboot menu
Code:
fastboot boot zImage initrd.img
The console output seems right:
Code:
creating boot image...
creating boot image - 6975488 bytes
downloading 'boot.img'...
OKAY [ 0.336s]
booting...
OKAY [ 0.244s]
finished. total time: 0.580s
The device tries to reboot, but stops at the first "M Powered by Android" splash screen
I wait one minute
I hard reboot the device by holding the power button
The device reboots, but has to pass an unusual step, "Updating Android/Optimization application ..."
I'm quite sure the same method was successful a few months ago, so what has since changed:
The device's firmware was upgraded from 4.4.3 to 4.4.4
The SDK tools were upgraded from ? to 23.0.2
I don't remember whether the firmware was available as a tar.gz or a xml.zip file, but I think it was a tar.gz, and I'm near certain I then used the SDK provided fastboot tool. Today, the firmware is available as an xml.zip file, and I think I have to use the Motorola specific fastboot tool (anyway I've tried both, for identical results)
Could anyone point me toward what I'm missing or doing wrong ?
Thanks.
Why did u extract the boot.img?
Maybe wrong kernel?
And whats about the kernel modules of your custom kernel?
sub77 said:
Why did u extract the boot.img?
Click to expand...
Click to collapse
I simply want a basic way to boot a custom initial ramdisk, without flashing it to the device. So I download the stock firmware archive, unzip it, extract the initial ramdisk (initrd.img) from the boot image, modify it, and repack it using abootimg.
And then:
Code:
fastboot boot zImage initrd.img
For me, this command conform to both the SDK provided fastboot and the Motorola specific one shows in it's help message:
Code:
boot <kernel> [ <ramdisk> ]
I'm not sure anymore of the above command's correctness:
Some information may be missing, as when you expand the boot image (boot.img) you get three files : a kernel (zImage), an initial ramdisk (initrd.img), but also some metadata (in bootimg.cfg); and this metadata is lost when I use "fastboot boot zImage initrd.img". I may try to give this information using additional fastboot options
I even suspect that a few months ago, I used fastboot with a full boot.img image as parameter, though this does not seem to fit the help message above
sub77 said:
Maybe wrong kernel?
And whats about the kernel modules of your custom kernel?
Click to expand...
Click to collapse
As I told you, I'm not currently working on the kernel, and I'm testing with _unmodified_ kernel image (zImage) and initial ramdisk (initird.img), as extracted by "abootimg -x".
Again, any idea is welcome.

How to flash a kernel on android device with two boot partitions.

Hi,
I have an android device and its kernel source code. I am able to compile the kernel source code and get "Image.gz-dtb" image file.
Now I need to flash it on my android device.
As per my knowledge the step required to flashing a kernel image on android device is as following:
Android Image Kitchen
Pull your device's boot image from the latest image available for your device (whether it be a ROM or stock)
Download the latest Android Image Kitchen from this thread.
Run the following with the boot image:
Code:
unpackimg.sh <image_name>.img
Locate the zImage file and replace it with your kernel image (rename it to what came out of the boot image)
Run the following to repack:
Code:
repackimg.sh
Flash the new boot image with fastboot or TWRP!
These steps are copied from:
https://forum.xda-developers.com/an...oid-kernel-t3627297/post72806131#post72806131
I am facing a problem in following these steps because the device I am using has two boot partitions i.e.
boot_a -> /dev/block/sde11
boot_b -> /dev/block/sde39
So I am not able to proceed with the first step to pull the boot image.
I can pull both image with dd command i.e. `dd if=/dev/block/sde11 of=/sdcard/boot_a.img` and `dd if=/dev/block/sde39 of=/sdcard/boot_b.img` but I don't know what should I do after that because I have only single image file generated from the source code.
I searched over the internet for A/B partitioning and I found that these are used for seamless updates i.e. One partition is active at a time and another partition which is inactive can be used to flash the update. On reboot, another partition will become active and One partition will become inactive. More Info: https://www.xda-developers.com/how-...ess-updates-affect-custom-development-on-xda/
If my understanding is true then I just need to follow following steps to find the correct image to be used at the first step of flashing the kernel:
1. fastboot getvar all | grep “current-slot”
2. dd if=<path to boot of active slot> of=/sdcard/boot.img
3. Continue with boot.img and flash the kernel with above written steps for flashing a kernel.
Anyone who has this knowledge, please confirm. I will be very thankful to you.

CrashDump mode after flashing blue_spark kernel r112

Hey folks,
I have rooted (magisk) OnePlus 8 phone with Android 11, w/o TWRP recovery. I'm trying to replace kernel with one of blue_spark, here's what I'm doing
1. Download zip file from https://github.com/engstk/op8/releases/tag/r112
2. Extract and unpack Image.gz
3. Unpack Magisk patched boot.img to /tmp (magiskboot unpack boot.img)
4. Replace kernel with unpacked Image (cp Image /tmp/kernel)
5. Repack boot.img (magiskboot repack boot.img boot-new.img)
6. Boot with boot-new.img (fastboot boot boot-new.img)
And here is when I'm getting into "QUALCOMM CrashDump Mode"
The same result if I build kernel from sources. Repacking boot.img with original kernel works, so problem is unlikely in magiskboot.
I'm trying to figure out the problem, but without kernel logs it's troublesome. Any ideas?
Thanks.
Hm... It looks like, I also have to update DTB. After that device boots successfully. Seems a bit strange to me. What's the difference in supported devices between blu_spark and stock kernel?
Ok, turned out AVB was enabled in the original device tree:
fsmgr_flags = "wait,slotselect,avb";
Switching it off fixes boot process.

Extract recovery from boot.img

If I run
Code:
fastboot boot twrp.img
Spoiler
TWRP
my 7Pro boots into TWRP
But if I run
Code:
fastboot boot lineagerecovery.img
Spoiler
Lineage Recovery
it boots the ROM; I think because this image file include a Kernel but the TWRP img file not.
I would like to get the same behavior of TWRP img file with Lineage Recovery img file.
So, presuming I'm right, there is any way to make a recovery.img file, extracting it from a boot.img file?

Categories

Resources