FORUMS

[DEV][TEMPLATE] AnyKernel3 - Easily Mod ROM Ramdisk + Pack Image.gz [Flashable Zip]

13,899 posts
Thanks Meter: 30,848
 
By osm0sis, Recognized Developer / Recognized Contributor on 5th March 2014, 03:32 AM
Post Reply Email Thread
6th January 2020, 08:49 PM |#881  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,848
 
Donate to Me
More
Quote:
Originally Posted by kevp75

@osm0sis
Having a minor issue on a xiaomi mi9t (davinci), wondering if you can point me in the right direction...

debug log shows:


Code:
I:operation_start: 'Flashing'
Installing zip file '/sdcard/Download/Test-debugging.zip'
Checking for Digest file...
I:Update binary zip
Verifying package compatibility...
Package doesn't contain compatibility.zip entry
I:Extracting updater binary 'META-INF/com/google/android/update-binary'
I:Zip does not contain SELinux file_contexts file in its root.
I:Legacy property environment not used in updater.
 
Archive:  /sdcard/Download/Test-debugging.zip
  inflating: tools/ak3-core.sh
  inflating: tools/magiskboot
  inflating: META-INF/com/google/android/updater-script
  inflating: META-INF/com/google/android/update-binary
  inflating: anykernel.sh
  inflating: tools/busybox
  inflating: sbin/busybox
  inflating: tools/magiskpolicy
KevP75-Davinci
 
AnyKernel3 by osm0sis @ xda-developers
 
 
mount: can't find /system in /etc/fstab
Checking device...
davinci
 
Installing...
chmod: /tmp/anykernel/ramdisk/*: No such file or directory
chown: /tmp/anykernel/ramdisk/*: No such file or directory
Starting Patch
128+0 records in
128+0 records out
134217728 bytes (128.0MB) copied, 0.408021 seconds, 313.7MB/s
Parsing boot image: [/tmp/anykernel/boot.img]
HEADER_VER      [1]
KERNEL_SZ       [16166989]
RAMDISK_SZ      [350172]
SECOND_SZ       [0]
EXTRA_SZ        [0]
RECOV_DTBO_SZ   [0]
DTB             [0]
OS_VERSION      [10.0.0]
OS_PATCH_LEVEL  [2019-12]
PAGESIZE        [4096]
NAME            []
CMDLINE         [console=ttyMSM0,115200n8 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 androidboot.usbcontroller=a600000.dwc3 earlycon=msm_geni_serial,0x880000 loop.max_part=7 buildvariant=user]
CHECKSUM        [8ea6a4643b58c751dc11a1eb02f181767536a5ba]
KERNEL_DTB      [2474670]
KERNEL_FMT      [gzip]
RAMDISK_FMT     [raw]
Ramdisk is uncompressed or not a supported compressed type!
cp: can't create '/tmp/anykernel/ramdisk/sbin/': No such file or directory
chmod: /tmp/anykernel/ramdisk/sbin/busybox: No such file or directory
cp: '/tmp/anykernel/split_img/kernel' and 'kernel' are the same file
cp: '/tmp/anykernel/split_img/ramdisk.cpio' and 'ramdisk.cpio' are the same file
Parsing boot image: [/tmp/anykernel/boot.img]
HEADER_VER      [1]
KERNEL_SZ       [16166989]
RAMDISK_SZ      [350172]
SECOND_SZ       [0]
EXTRA_SZ        [0]
RECOV_DTBO_SZ   [0]
DTB             [0]
OS_VERSION      [10.0.0]
OS_PATCH_LEVEL  [2019-12]
PAGESIZE        [4096]
NAME            []
CMDLINE         [console=ttyMSM0,115200n8 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 androidboot.usbcontroller=a600000.dwc3 earlycon=msm_geni_serial,0x880000 loop.max_part=7 buildvariant=user]
CHECKSUM        [8ea6a4643b58c751dc11a1eb02f181767536a5ba]
KERNEL_DTB      [2474670]
KERNEL_FMT      [gzip]
RAMDISK_FMT     [raw]
Repack to boot image: [/tmp/anykernel/boot-new.img]
HEADER_VER      [1]
KERNEL_SZ       [16166989]
RAMDISK_SZ      [350172]
SECOND_SZ       [0]
EXTRA_SZ        [0]
RECOV_DTBO_SZ   [0]
DTB             [0]
OS_VERSION      [10.0.0]
OS_PATCH_LEVEL  [2019-12]
PAGESIZE        [4096]
NAME            []
CMDLINE         [console=ttyMSM0,115200n8 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 androidboot.usbcontroller=a600000.dwc3 earlycon=msm_geni_serial,0x880000 loop.max_part=7 buildvariant=user]
CHECKSUM        [8ea6a4643b58c751dc11a1eb02f181767536a5ba]
Ending Patch


At this point, all I am trying to do is see if it works, and I can make some potential ramdisk modifications. Am I seeing this right? As the device does not have a ramdisk?

Looks like it's got a cpio ramdisk, likely from being rooted by Magisk. So that'd mean there was none to begin with since it's a system-as-root device and modifications are only possible when rooted.

See the links in the OP for lots of info on how to go about that.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
7th January 2020, 01:44 AM |#882  
Jonas Cardoso's Avatar
Senior Member
Flag São José dos Campos
Thanks Meter: 2,783
 
Donate to Me
More
hey @osm0sis, have any way to keep magisk after flash? I recently started using your package and I have this little problem. I dont changed anything basically from the original
Android 10 ARM64 device
https://github.com/JonasCardoso/AnyK...commits/master
7th January 2020, 02:57 AM |#883  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,848
 
Donate to Me
More
Quote:
Originally Posted by Jonas Cardoso

hey @osm0sis, have any way to keep magisk after flash? I recently started using your package and I have this little problem. I dont changed anything basically from the original
Android 10 ARM64 device
https://github.com/JonasCardoso/AnyK...commits/master

Those same links in the OP explain the current root retention solutions.
7th January 2020, 03:27 AM |#884  
Jonas Cardoso's Avatar
Senior Member
Flag São José dos Campos
Thanks Meter: 2,783
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

Those same links in the OP explain the current root retention solutions.

I didn't understand how I should use the feature to retain magisk installation
7th January 2020, 03:42 AM |#885  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,848
 
Donate to Me
More
Quote:
Originally Posted by Jonas Cardoso

I didn't understand how I should use the feature to retain magisk installation

Here's a step by step:
1) Read the OP.
2) Follow the link that mentions root retention.
3) Read the post about root retention.
4) Follow the instructions in the root retention post.





Hint: It's under the Edit 3 heading.
7th January 2020, 02:10 PM |#886  
kevp75's Avatar
Recognized Contributor
Flag MA
Thanks Meter: 7,183
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

Looks like it's got a cpio ramdisk, likely from being rooted by Magisk. So that'd mean there was none to begin with since it's a system-as-root device and modifications are only possible when rooted.
See the links in the OP for lots of info on how to go about that.

Awesome. Appreciate it mate.
14th January 2020, 11:10 PM |#887  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,848
 
Donate to Me
More
It's a new year and it's time for some new features for AK3! First up, with massive thanks and full credit to @Zackptg5, we can now run /system/bin commands in recovery during flash on Android 10 that require the APEX com.android.runtime libc to be mounted. Next I have also fixed AVBv1 signing on Android 10 since upstream AOSP removed one of the command-line options we were using for the dalvikvm invocation; this should still work on older devices without issue from my testing. Lastly (for now ), thanks to @topjohnwu adding my long-time request for Image.*-dtb splitting to magiskboot, AK3 now can finally automatically repatch the new kernel during flash to keep root if Magisk is detected!

My development work on my many projects comes out of my free time, so if you enjoy this project or anything else I've done on xda, please consider sponsoring my ongoing work using my GitHub Sponsors profile. For a one-time donation you can hit the donate link from my profile. Thank you for your support!

tools: update magisk utils to v20.2(20200) stable:
https://github.com/osm0sis/AnyKernel...c522256a11952c

Add apex mount/umount (#48):
https://github.com/osm0sis/AnyKernel...c3a3dfc694995a

Should only run in recovery:
https://github.com/osm0sis/AnyKernel...e09ef330ba6d4f

tools: update magisk utils to v20.3(20300) stable:
https://github.com/osm0sis/AnyKernel...df24e76181c5e4

Backend: APEX mounts support improvements:
https://github.com/osm0sis/AnyKernel...d209318bea307d

AK3: auto split Image.*-dtb to kernel/kernel_dtb + re-patch for Magisk:
https://github.com/osm0sis/AnyKernel...b4a87ff934bc31

AK3: fix AVBv1 signing on Android 10:
https://github.com/osm0sis/AnyKernel...201c9ce55fac20

AK3: only attempt fallback kernel decompression if format was identified:
https://github.com/osm0sis/AnyKernel...4ab05db41fa728

AK3: auto kernel patch improvements:
https://github.com/osm0sis/AnyKernel...093faf9da1a4ef

AK3: only attempt to dump .magisk config if patch found:
https://github.com/osm0sis/AnyKernel...3b5b6c90420e90

AK3: fix false positive Magisk detection after reset_ak:
https://github.com/osm0sis/AnyKernel...3b6f6319ffceb5

Backend: don't attempt to unmount /system_root when booted:
https://github.com/osm0sis/AnyKernel...3bba28223bf6cc

Backend: fix dalvikvm execution in recovery on Android 10:
https://github.com/osm0sis/AnyKernel...d344c8ed5be771

AK3: clean up and simplify Magisk patch logic:
https://github.com/osm0sis/AnyKernel...3e0c635112bb91

AK3: add stderr hints for signing debugging:
https://github.com/osm0sis/AnyKernel...31c1d5d4fa6671

Old workarounds, like having a kernel folder with Image.* and dtb folder with *.dtb, are no longer necessary, including the formerly best-practice scripts that go with them, and people may finally move on from competing hacks like adding the skip_override patch/cmdline. All you need now is back to the basic, original setup of placing the final kernel build output of Image.*-dtb in the root of the AK3 zip.

For any devs transitioning from skip_override I recommend adding the following after unpack to their anykernel.sh for awhile:
Code:
# remove old root patch avoidance hack
patch_cmdline "skip_override" "";
The best-practice documentation linked in the OP has been updated with this as well. Happy hacking!
The Following 10 Users Say Thank You to osm0sis For This Useful Post: [ View ]
20th January 2020, 09:04 PM |#888  
Pierre2324's Avatar
Senior Member
Thanks Meter: 1,631
 
Donate to Me
More
normally,
every init.something.rc files in ramdisk/overlay.d/ should append to init files
and
every .sh files in ramdisk/overlay.d/sbin/ should be runnable from rc files with this:
exec u:r:magisk:s0 root root -- /sbin/theFile.sh

right? Is that the correct way to do it or something else is better?

thanks
The Following User Says Thank You to Pierre2324 For This Useful Post: [ View ] Gift Pierre2324 Ad-Free
20th January 2020, 09:35 PM |#889  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,848
 
Donate to Me
More
Quote:
Originally Posted by Pierre2324

normally,
every init.something.rc files in ramdisk/overlay.d/ should append to init files
and
every .sh files in ramdisk/overlay.d/sbin/ should be runnable from rc files with this:
exec u:r:magisk:s0 root root -- /sbin/theFile.sh

right? Is that the correct way to do it or something else is better?

That's the way! Check out blu_spark op7x r75 for a current, working example: https://github.com/engstk/op7/releases
The Following 2 Users Say Thank You to osm0sis For This Useful Post: [ View ]
21st January 2020, 12:30 AM |#890  
Pierre2324's Avatar
Senior Member
Thanks Meter: 1,631
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

That's the way! Check out blu_spark op7x r75 for a current, working example: https://github.com/engstk/op7/releases

Okay thanks, that's what I use and it's working nicely!

From what I saw in blu_spark op7, he uses:
sleep 30 inside his .sh and the .sh is run
on property:vendor.post_boot.parsed=1

This is also used in his init.rc

on property:sys.post_boot.parsed=1
setprop vendor.post_boot.parsed 1


Maybe I should ask the dev directly for that, but still trying myself here before.

Wondering if/why the above sleep and on property are needed?

Thanks for the hint!
24th January 2020, 08:59 PM |#891  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,848
 
Donate to Me
More
Next up!

My development work on my many projects comes out of my free time, so if you enjoy this project or anything else I've done on xda, please consider sponsoring my ongoing work using my GitHub Sponsors profile. For a one-time donation you can hit the donate link from my profile. Thank you for your support!

AK3+Backend: introduce systemless kernel modules support:
- with do.systemless prop enabled in anykernel.sh, will push the contents of modules/ to create a simple "ak3-helper" Magisk module, where testing on devices thus far shows it loads early enough that even replacement kernel object .ko modules will get loaded
- the ak3-helper module info is populated from the kernel.string and parsed kernel version from the kernel being flashed, and if at boot time a different kernel is detected the module automatically removes itself before being loaded to avoid conflicts
- since logical partitions and ext4-dedup on Android 10 now prevent mounting /system or /vendor rw under any circumstances, this feature gives kernel developers back the freedom they had before all this to improve kernel .ko modules, .conf files, etc. with the added bonus of it cleaning up after itself

https://github.com/osm0sis/AnyKernel...e711dad4848690

anykernel: add do.systemless:
https://github.com/osm0sis/AnyKernel...f59c4b8bee2410

README: document do.systemless, update and sync with XDA thread:
https://github.com/osm0sis/AnyKernel...cc6e649db19421

Backend: fix link restoration post-install:
https://github.com/osm0sis/AnyKernel...74c776e0b86f37

Backend: overdue clean up and refactor:
https://github.com/osm0sis/AnyKernel...a86c041623c0f8

Backend: work around ongoing TWRP SAR support fragmentation:
https://github.com/osm0sis/AnyKernel...092f09e380e825

Backend: put debugging down where it belongs too:
https://github.com/osm0sis/AnyKernel...c6200f68ea7dbf

Backend: fixes for mounting system on Lineage Recovery:
https://github.com/osm0sis/AnyKernel...8c9eb386c322a6

Thanks @eng.stk for his extensive time and help testing out whether replacing .ko files would even work during the development of this feature!

Happy hacking!
The Following 6 Users Say Thank You to osm0sis For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
anykernel, flashable zip, kernel, scripting, template

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes