Editing Huawei Ascend P1 (U9200) boot.img - Huawei Ascend P1

I'm trying to make insecure boot.img for U9200 for my firmware version (V100R001C185B104). Unpacking original boot.img and ramdisk goes OK. After making changes to defult.prop I do the following:
mkbootfs ./ramdisk | gzip > ramdisk-new.gz
mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-new.gz --base 0x80000000 --cmdline "console=ttyGS2,115200n8 mem=1G vmalloc=768M omap_wdt.timer_margin=30 mmcparts=mmcblk015(splash)" --board omap4 -o tools/flash/boot.img
New boot.img is successfuly created but doesn't boot (fastboot boot boot.img). What am I doing wrong?
I've got parameters using bootimg.exe and I think they are OK. There's nothing about them on the net
EDIT:
I made it using other mkbootimg.exe. This one accept more input parameters. This time I use bootimg.exe for upacking bootimg and unpacking and packing ramdisk. I did:
>bootimg.exe --unpack-bootimg
>bootimg.exe --unpack-ramdisk
Do changes at default.prop.
>bootimg.exe --repack-ramdisk
>mkdir flash\
>mkbootimg --kernel kernel --ramdisk ramdisk.cpio.gz --cmdline "console=ttyGS2,115200n8 mem=1G vmalloc=768M omap_wdt.timer_margin=30 mmcparts=mmcblk015(splash)" --board omap4 --base 0x80000000 --pagesize 2048 -o flash\boot.img
Reboot to bootloader:
>adb reboot bootloader
Test if you have good drivers installed:
>fastboot devices
If OK, test your new boot.img without flashing it:
>fastboot boot boot.img
If device boots and you want to have this image permanant flash it with:
>fastboot flash boot.img.
I've attached the tools that worked for me. I'm coplete noob in Android cooking, this is my first steps. There are lot about editing boot.img on the internet but nothing about my device so I decided to start a new topic if someone is also interested in.

also cracking my U9500. Have you done with your problems?
i use bootimg.exe to unpack & repack the img file, using same parameters and nothing modified to the extracted files,
but,
the new & old boot.img(should be same) are not same using binary compare.
according to a file that describes how boot.img is structured, i found that some key parameters are different in these two img file.
I don't know why ....
so if you have succeeded, PLZ tell me ..
contact me qq 6777711 if you're Chinese. or mail me: 6777711 AT qq.com

Nice one. I'll take a look at this aswell.

Related

Why don't my boot.img files boot?

Ok so I customized a boot.img (init.rc file) and repacked it using mkbootfs and mkbootimg. For the life of me, I can't get these boot imgs to boot. Any ideas why? The same exact stuff worked fine on my Hero.
chuckhriczko said:
Ok so I customized a boot.img (init.rc file) and repacked it using mkbootfs and mkbootimg. For the life of me, I can't get these boot imgs to boot. Any ideas why? The same exact stuff worked fine on my Hero.
Click to expand...
Click to collapse
well some more detail would be really helpful in troubleshooting. hopefully you're able to get something ... im still new to the style HTC uses for their kernels.
is the kernel booting and not loading the init.rc properly (possible adb output?) or is the kernel not even loading properly? how far along with the boot screens do you get?
are you using --cmdline and --base?
Good call. I should probably post the commands I used. lol
Ok so I did change my init.rc but for testing purposes I just unpacked the stock boot.img and immediately repacked it. the commands are as follows:
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
Then generates a boot.img file successfully but it still does not boot. Any ideas?
Edit: And of course I renamed newBoot.img to boot.img and included it in an update.zip which all flashed with no errors. Just never gets past the first HTC Evo 4G boot screen
chuckhriczko said:
Edit: And of course I renamed newBoot.img to boot.img and included it in an update.zip which all flashed with no errors.
Click to expand...
Click to collapse
im still beginning in building boot.img files for HTC android phones. my experience is with building a straight zImage kernel file with an initramfs compiled into the zImage kernel file for a Samsung android phone.
hopefully somebody can comment with some better insight, on mkbootfs, etc as I'm also very curious what the best command is for our EVO.
my only comment is a side note to the flashing process and hopefully this method will speed up testing for you and everybody else. i wrote the commands ROM and recovery/normal android mode independent. this is how i would quickly test kernels on my samsung android based phone, assuming it works the same on HTC?
adb push boot.img /sdcard/boot.img
adb push flash_image /sdcard/flash_image (only have to do once)
cat /sdcard/flash_image > /data/flash_image (only have to do once)
chmod 755 /data/flash_image (only have to do once)
/data/flash_image boot /sdcard/boot.img
reboot the phone to test ... hopefully that simplifies the kernel testing process!
thanks for posting up all your detail, its insightful and helpful!
--base 0x20000000 <~ change to
btw moving thread to q&a
toastcfh said:
--base 0x20000000 <~ change to
btw moving thread to q&a
Click to expand...
Click to collapse
Worked perfectly. Thanks Toast.

[Q] how could i boot with fastboot?

i can't boot with fastboot if i specify separate kernel and ramdisk image:
fastboot -c "no_console_suspend=1 console=null" boot boot.img-kernel boot.img-ramdisk.gz
but works well if i use all in one boot.img:
fastboot -c "no_console_suspend=1 console=null" boot boot.img

[Q] UnPacking&Packing&Repacking Boot/Recovery.img?

Can anyone give me a tutorial specifically to the Samsung Galaxy Gio (5660m) on how to UnPack, Pack and Repack the boot.img and or recovery.img (<-- mostly this)and then back to the IMG File(RePack)?
I know when you create a repack (to IMG) command you include a BASE, PAGESIZE(maybe), cmdline, kernel, ramdisk, and -o repackedboot.img
This is why it must be specifically to Gio (in my case 5660M) becasue of the base and cmdline (I think! I'm not sure) BECAUSE when i made a custom recovery.img based on Clockworkmod (I replaced GIO.rle with the stock recovery to make the CWM boot show its 5660M) my phone wouldn't boot up!
So I flash stock rom (Odin) again LOL and now I want to be safer this time.
Thanks for reading! I need help! Here is my code that made my non-bootable recovery.img:
*NOTE: I use CYGWIN on Windows
Code:
Repack to IMG
./mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel recovery.img-kernel --ramdisk ramdisk-new.gz -o recovery-new.img

[Q] Can't boot with custom Ramdisk (resolved)

I dumped my boot device which i believe is /dev/mtd/mtd2 according to /proc/mtd
#cat /dev/mtd/mtd2 > boot.img
I took that image and ran the split_bootimg perl script on it to separate the kernel and ramdisk images.
#split_bootimg boot.img
Then I just tried to recombine them with mkbootimg without making any modifications.
#mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel boot.img-kernel --ramdisk ramdisk-new.gz -o boot-new.img
* I also tried an image with identical boot options as I found the stock kernel has
I then copied and erased/flashed the new image
#cat /dev/zero > /dev/mtd/mtd2
#flash_image boot boot-new.img
The phone just sits at the HTC screen forever when I try and boot it.
If I reboot into recovery and flash the original "boot.img" backup using the same method it boots OK.
What is it I'm missing? thanks!
I tried dumping the new base.img I made
Original from ROM for comparison:
Page size: 2048 (0x00000800)
Kernel size: 2271684 (0x0022a9c4)
Ramdisk size: 167343 (0x00028daf)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend=1
Repacked:
Page size: 2048 (0x00000800)
Kernel size: 2271684 (0x0022a9c4)
Ramdisk size: 167343 (0x00028daf)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend=1
I also downloaded the kernel source for the incredible and tried to find the base address and used 0x10000000 on the mkbootimg command no to avail.
I did notice new image is smaller than the old by ~1MB! Even though when I unpack it still shows them as the same size.
3145728 boot.img
2443264 newboot.img
Any help here is very appreciated.
I found the solution. I was using the wrong base address on mkbootimg command
I found the proper base address by downloading the kernel source for the droid incredible.
(DROID Incredible by HTC (Verizon) – GB MR - 2.6.35 kernel source code)
Then I looked up the processor used in the incredible hardware in the file referenced below and got the proper offset. It's boot up now
arch\arm\mach-msm\include\mach\memory.h

booting custom kernel

SOLVED: I was using the G980F boot.img instead of G985F image. THANKS everyone
The device won't reboot if I unpack and repack the boot.img on S20
Did someone else here succeed in flashing a new boot.img ? THANKS
Code:
[email protected]:~/GS20_kernel_build$ unpackbootimg -i boot.img
BOARD_KERNEL_CMDLINE androidboot.hardware=exynos990
BOARD_KERNEL_BASE 10000000
BOARD_PAGE_SIZE 2048
[email protected]:~/GS20_kernel_build$ mkbootimg --kernel boot.img-zImage --ramdisk boot.img-ramdisk.gz -o boot_repacked.img
[email protected]:~/GS20_kernel_build$ heimdall flash --BOOT ./boot_repacked.img
[...]
Downloading device's PIT file...
PIT file download successful.
Uploading BOOT
100%
BOOT upload successful
Ending session...
Rebooting device...
modem__ said:
The device won't reboot if I unpack and repack the boot.img on S20
Did someone else here succeed in flashing a new boot.img ? THANKS
Code:
[email protected]:~/GS20_kernel_build$ unpackbootimg -i boot.img
BOARD_KERNEL_CMDLINE androidboot.hardware=exynos990
BOARD_KERNEL_BASE 10000000
BOARD_PAGE_SIZE 2048
[email protected]:~/GS20_kernel_build$ mkbootimg --kernel boot.img-zImage --ramdisk boot.img-ramdisk.gz -o boot_repacked.img
[email protected]:~/GS20_kernel_build$ heimdall flash --BOOT ./boot_repacked.img
[...]
Downloading device's PIT file...
PIT file download successful.
Uploading BOOT
100%
BOOT upload successful
Ending session...
Rebooting device...
Click to expand...
Click to collapse
You need to make a tar file containing the img and flash it with odin. You need a Windows computer for that. Linux won't do sadly
If you don't feel like making a flashable zip file you can just use dd to install it from within TWRP (via terminal on console or ADB) if you have that installed:
dd if=boot_repacked.img of=/dev/block/by-name/boot
No Windows/Odin required.
sjevtic said:
If you don't feel like making a flashable zip file you can just use dd to install it from within TWRP (via terminal on console or ADB) if you have that installed:
dd if=boot_repacked.img of=/dev/block/by-name/boot
No Windows/Odin required.
Click to expand...
Click to collapse
dd always scares me lol.
You sure this works with S20? Even Fastboot fllashing doesn't work so I doubt this will
JanBoyGamer23 said:
dd always scares me lol.
You sure this works with S20? Even Fastboot fllashing doesn't work so I doubt this will
Click to expand...
Click to collapse
My phone wouldn't boot last night after I tried flashing my own boot image and this was how I put the previous one back. It booted right up.

Categories

Resources