Boot image modification for Pixel? The usual steps don't work - Google Pixel Questions & Answers

Usually, for modifying boot images, I unpack boot images (either extracted from rooted phone, or from full system image) using Android Image Kitchen, make my changes in the ramdisk directory, repack and flash (using fastboot flash boot <image_new.img>).
However, this doesn't work for Pixel or Pixel XL. I could simply create a new file in the ramdisk directory, but it doesn't reflect in the phone's root directory. I suspect this has something to do with the partitioning changes for this device, although I haven't been able to find a good complete write up about what are the exact changes. I have noticed a few new partitions (like hosd.img, bootlocker.img, hyp.img, keymaster.img, etc) but I am not entirely sure what they are for.
Any ideas how I can make some simple changes to the boot image? I want to make changes to the rc files and add a few shell scripts (for some init.rc services), and make some changes to default.prop.
Edit: I have read a bit more online, and I figured out that the boot image's ramdisk is only used in recovery, and initramfs of the system image is used as the init and the root during the normal phone boot up. So I will be able to do what I want by modifying the system image? I tried going through Chainfire's boot image too, and I am not exactly sure how he manages to modify the content of the system using the boot image.

Related

[Q] Boot Process

I've looked in quite a few threads, including the custom mix ROMs. What I want to know is who has knowledge of how this thing boots? I've noticed on the 2 droids I've messed with you upgrade them with an update.zip and basically an empty file on the SD card.
I'm guessing the update.zip contains a squashfs or something similar along with a kernel, but I don't know for sure. Who can explain exactly what happens on boot, what devices it looks for filesystems/loop filesystems on etc?
muqali said:
I've looked in quite a few threads, including the custom mix ROMs. What I want to know is who has knowledge of how this thing boots? I've noticed on the 2 droids I've messed with you upgrade them with an update.zip and basically an empty file on the SD card.
I'm guessing the update.zip contains a squashfs or something similar along with a kernel, but I don't know for sure. Who can explain exactly what happens on boot, what devices it looks for filesystems/loop filesystems on etc?
Click to expand...
Click to collapse
The best way to learn about this stuff is by tearing down existing .zip flashers and reading about how boot.img files are built and trying to build your own.
The boot process is controlled by the bootloader (the thing that displays the Viewsonic birds logo and decides whether you are trying to boot into recovery, APX mode, or a standard boot).
The ZIP files that you flash actually run a script that writes an .IMG file contents to one or more partitions.
Most ROM flashers have two images they flash - a boot.img and a system.img. The system.img is a filesystem image of the system partition. The boot.img consists of two parts - a kernel and a ramdisk image (well, and a boot header). The kernel is the Linux kernel that's been compiled to provide all the core system functionality for Android. The ramdisk image (which is a GZIPed CPIO file) contains the init.rc file that does all the initialization, mounting of the main filesystem images and so on.
Once everything is mounted and configured, the Android ROM itself boots up.
I recommend reading this page for more info:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
Hope that helps!
That's more or less what I wanted, but for our device do you know the exact boot order? Mtd partitions then SD sd2 and maybe a USB disk? I'd really like to put a custom Roman on the sd2 and leave the rom factory.
muqali said:
That's more or less what I wanted, but for our device do you know the exact boot order? Mtd partitions then SD sd2 and maybe a USB disk? I'd really like to put a custom Roman on the sd2 and leave the rom factory.
Click to expand...
Click to collapse
I *think* (could be wrong) that both the externalSD (/sdcard2) and the USBDISK (/usbdisk) are mounted dynamically, via vold.
At least that's the way I understood it...
There's a thread here in this forum, about (dual) booting Ubuntu, that does something along the lines of what you're asking about...
Jim
rcgabriel said:
The best way to learn about this stuff is by tearing down existing .zip flashers and reading about how boot.img files are built and trying to build your own.
The boot process is controlled by the bootloader (the thing that displays the Viewsonic birds logo and decides whether you are trying to boot into recovery, APX mode, or a standard boot).
The ZIP files that you flash actually run a script that writes an .IMG file contents to one or more partitions.
Most ROM flashers have two images they flash - a boot.img and a system.img. The system.img is a filesystem image of the system partition. The boot.img consists of two parts - a kernel and a ramdisk image (well, and a boot header). The kernel is the Linux kernel that's been compiled to provide all the core system functionality for Android. The ramdisk image (which is a GZIPed CPIO file) contains the init.rc file that does all the initialization, mounting of the main filesystem images and so on.
Once everything is mounted and configured, the Android ROM itself boots up.
I recommend reading this page for more info:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
Hope that helps!
Click to expand...
Click to collapse
rcgabriel,
When you do an nvflash (ala bekit's), does the contents of bootloader.bin end up getting stored permanently on the Gtab's internal SDcard? And, whenever the Gtab is booted, the code in that bootloader is the first code that runs, deciding, as you said, whether or not to do a recovery or execute the boot.img?
Thanks,
Jim
Isn't the bootloader on one of the MTD partitions and not the sdcard? What I'm having the hardest time wrapping my head around is how this system boots in comparison to an x86 Debian 5.0 system.
The basic picture I have is that there is the rom/flash portion of the boot process and then the kernel and real filesystem are loaded and mounted. But using these custom roms, is it changing the flash and bootloader or just the kernel and OS? Meaning where exactly is the first thing the CPU hits to boot? Flash MTD partitions for the bootloader. Then is the kernel on the mtd partitions or on some separate partition on sdcard.
Since you can basically stick 2 files on an external uSD and send it into upgrade mode, can't you customize the filesystem contained in a zip and then stick it in and have a custom system with whatever you wanted added or removed?

[Q] How To Modify default.prop?

Hello Everyone,
Thank you in advance for any help on this item.
I have an HTC Sensation phone which is already S-off and has CWM in it.
It also has "su" previleges in it and I was able to modify CID too.
The ROM inside it is stock ROM.
I have been reading and following several guides on how to modify default.prop for other devices. And from what I gather I have to do the following :
1. Unpack boot.img.
2. Modify default.prop.
3. And repack boot.img.
The problem here is that I tried all sorts of things only to end up failing in the "repacking" stage.
I want to modify default.prop to be able to set adb daemon (adbd) to have root previleges and eventually be able to "inject" into HTC sensation my own custom-made versions of framework.jar and other files.
Is modifying default.prop possible?
Is the method I am using correct?
Is it possible to have my own customized framework.jar inside the HTC Sensation?
I hope you guys can point me to some sites and links which can help me in what I intend to do.
Thank you all very much.
Use dsixda kitchen.
Hello Sebastian,
Thanks for your response.
I also tried to use the dsixda kitchen.
What I did was :
1. Downloaded a backup of my phone using ClockworkMod Recovery.
2. I took the boot.img file from the backup generated.
3. Unpacked boot.img using the kitchen.
4. And then repacked it using the kitchen again.
5. I then flashed the generated boot.img into the phone.
6. The phone went into a forever loop in the start up screen.
Did I do it right?
I am rechecking the notes on the kitchen again though. I might have missed something.
Thanks again.
Upload your boot.img, I'll check it. Do you use fastboot.exe to flash boot?
Hello Again,
Thanks once again for the support Sebastian.
"Upload your boot.img, I'll check it. Do you use fastboot.exe to flash boot?"
I use fastboot.exe first and then try to use the ClockworkMod Recovery Advanced option to update the "boot" only part.
I am attaching here my dsixda-kitchen generated boot.img.
This boot .img was generated with the following steps :
1. Unpack htc stock rom boot.img generated by CWM nandroid backup.
2. No changes were made in the ramdisk nor in the kernel part.
3. Repack the ramdisk and kernel using dsixda kitchen.
4. Used fastboot.exe to flash the boot part. "fastboot flash boot boot.img"
5. Wiped the cache partition of the phone.
6. Wiped the /data/dalvik-cache directory.
7. Restarted phone in normal mode.
8. Phone hanged up in startup image.
Many thanks again and more power.

[Q] Is it safe to flash this?

Hi there XDA! I have a really big question/problem. I want to theme Clockworkmod Recovery with custom pictures/icons/themes and such. So far I installed Ubuntu VM, decompiled the Recovery Image into Kernel and Ramdisk, replaced the pre-loaded icons with my custom icons to the ramdisk. Finally, I recompiled it into a new recovery image!
However, since this program is designed for device boot images, Im still curious, can this be used for recovery images? I haven't editing anything within the kernel, just opened the ramdisk, replaced the /res/images with my own and did abootimg --create newcwm.img.
EDIT : All I know is that in the boot.cfg the boot parameter size has to be exact fit or hardbrick.
so I have attached the 2 files that shows the recovery image data/config of both of them.
Don't worry its just 2 txt files. Inside the other archive has the flash ready images. BOTH OF THEM. Also includes the already decompiled ramdisk and kernel to take a look at. In addition the bootimg.cfg is also in. It has everything you need to know
So, heres the question. If I decide to flash it to mmcblk0p21 which is the verified recovery partition for the GT-i9505, (Info on the partition informations/mount points below
http://forum.xda-developers.com/showthread.php?t=2342841
Then, hopefuly the flash to the recovery partition shouldn't hardbrick my device. Am I right? Or missing something.
I will attach both my image and the cwm recovery Image I decompiled. Please if you can tell me if theres something that has to be fixed to prevent me getting a $700 paperweight.
Note: The layout might be confusing inside the Archive, just please bear with me and just take your time. I can wait
PRESS ME TO DOWNLOAD

Any Recovery Editing program?

Is there any program that can edit / modify recoveries?
I have tried to make cwm and twrp for a Panasonic KX-PRX150 by unpacking replacing files and repacking but nothing the phone's screen remains black when booting to recovery mode.
I have also tried to flash the stock recovery and it is not in recovery.img format but in recovery-from-boot.p and a install-recovery.sh flashing it on recovery mode.
Try this guide. I've never tested it.
How to Create and Port TWRP Recovery to any Android Device
In this tutorial, we will show you detailed steps to create and port TWRP Recovery for any Android Device using Android Image Kitchen tool.
www.droidwin.com
Thank you. But I was thinking about Editing my stock recovery.
I'm fond of my own ImgUtil.exe (in the sig) which can modify boot images without taking them all apart and putting them back.
I usually start with stock recovery and replace adbd with a rooted adbd, add a service for it in init.rc (if there is none).
This should all work fine unless you have issues with AVB.

Modifying system.img

Hello guys. I have a simple question. I am trying to modify ROM for xiaomi a2. I have official .iso images. For test i trying to remove "grep" binary file. I mount system.img, change it, unmount, pack and flash using fastboot. But the file is still is visble using adb.
When i try TWRP file manager, the file is absent. How is it possible?
Then i try to change one file directly in .iso using hex editor, but the changes is not visible. But when i install magisk, all changes became visible. Can android store copy of system.img somewhere else?
Not sure what you have done or what you mean with "official .iso images" but consider three possibilities:
Magisk is systemless-root method, it provides overlay for modifying /system content without modifying system partition
A/B devices have two slots, system_a and system_b partition
dm-verity provides FEC feature to correct modifications on file system

Categories

Resources