topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
48.51k stars 12.41k forks source link

Magiskboot doesn't properly alter files or missing step #2954

Closed enovella closed 4 years ago

enovella commented 4 years ago

Hi all,

I've been attempting to achieve a repacked boot image that comes rooted and with developer options enabled (adb_enable). For doing so, I've decided to employ magiskboot to add a modified default.prop file into the ramdisk.cpio. Important to mention that the boot.img provided was previously rooted by Magisk. Modified files were successfully included in the ramdisk.cpio because they were extracted after adding them to verify the correctness. Therefore, the only missing goal was to get adb enabled after booting.

During the way, I encountered different issues regarding some bootloader flags. However, this didn't affect me much so I won't enter in any debate about it.

Setup

my_default.prop

My modifications were these two lines in default.prop:

persist.sys.usb.config=adb,mtp
persist.service.adb.enable=1

Ramdisk patching via Magiskboot

${BOOTIMAGE} used was an already Magisk-patched boot.image.

# Unpack boot.img in current folder
./magiskboot unpack "${BOOTIMAGE}" || abort "! Unable to unpack boot image!"

# Patch ramdisk
./magiskboot cpio ramdisk.cpio "add 750 prop.default my_default.prop"  # Overwrite with my default.pro (symlinked to prop.default)

# Repack the boot image
./magiskboot repack $BOOTIMAGE || abort "! Unable to repack boot image!"

Questions

  1. Any bug in Magiskboot with this file? Is this file read-only? read from different location at boot?
  2. Why did the changes not affect the Android properties?
  3. Is there anything else to modify on the system/data partition?
  4. Is there any missing step on my bootpatching's process?

Any feedback you can come up is for sure helpful. Many thanks in advance.

topjohnwu commented 4 years ago

@enovella the ramdisk in your device is the recovery ramdisk, Pixel 3a is using system-as-root. Altering files in a SAR setup is complicated, read more about overlay.d in docs

FossPrime commented 3 years ago

pixel 3a "no valid slot to boot" issues were probably due to me not having space to spare... you need around 12GB of free fast, and reliable storage to get the job done. Don't use your SD card, the web flasher is worse than local, it doesn't give proper errors.

I managed to Symlink all the images from my Downloads folder and ln -s Downloads/bonito/* . to save spare. Also don't use ChromeOS's zip tool... it is exotic in annoying ways

https://www.reddit.com/r/GooglePixel/comments/cpx2oe/tried_rooting_a_pixel_3a_and_ended_up_stuck_in_a/

I was close to declaring this thing a paper weight