Themes / Apps / Mods [DEV] Kernel Flasher

Search This thread

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
kernel-flasher-1.jpg
kernel-flasher-2.jpg
kernel-flasher-3.jpg


Kernel Flasher is an Android app to flash, backup, and restore kernels.

Features
  • Flash AK3 kernel zips
  • Backup and Restore kernel partitions
  • Mount, Map, and Resize vendor_dlkm
  • Save dmesg and logcat

Planned and Potential Features
  • Keep original AK3 zip filename during flash (useful when viewing logs)
  • Add support for FKM update json format
  • Periodically check update json URLs automatically in the background?
  • Move backups to a folder in the sdcard root (breaking change)
  • Allow selective backup and restoration of raw partitions
  • Create and display hashes for all partitions
  • Verify hashes after backup and restoration?
  • Add a setting for preferred hashing algorithms?
  • Named backups? notes?
  • Reallow flashing to the inactive slot?
  • Attempt to fallback on resize when there is no room for replace
  • Provide multiple reboot options

Notes

When making a backup of the active slot, to save time, it is assumed that the kernel on disk is the same as the running kernel. The Check Kernel Version button can retrieve it from disk prior to backup.

After restore (or flash from AK3), the updated contents of vendor_dlkm can't immediately be backed up. Unmounting, unmapping, then remapping it can make it available for backup.

AK3 helper modules are not backed up. Flashing the AK3 zip is preferable. The backup function is mostly intended for stock.


Credits

@osm0sis for AK3, feedback, and general guidance
@eng.stk & @Freak07 for feedback, advice, and encouragement
@phhusson for lptools
@topjohnwu for Magisk and libsu


Latest Update

2022-08-07 v1.0.0-alpha08
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
Can you please leave the kernel installation log opened after the process ends with an error? Currently it's impossible to see what went wrong since the log disappears instantly and is being replaced by an error screen.
That is already done in my own personal test version of the app, but I haven't had a chance to clean it up and get it released. I'll make an effort to get that done this evening.

I've got several other enhancements planned, but most of my focus has been on Hashtree Patcher lately, though I think that is nearly wrapped up. I'll try to get the installation log issue fixed asap, then I'll work on the rest over the next few days.
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
I pushed a new build that resolves the installation log issue. Here is the full changelog:

added option to backup AK3 zips
disabled flash and restore on inactive slot
added save ramoops button
added stderr to AK3 logs
added .log file extension to log files
filtered ui_print and progress in AK3 logs
sorted backups

I also added a list of planned and potential features to the OP. If you've got some interest in seeing any of them or anything I may have missed in a future build, feel free to note it here. If the list gets to be too big of a pain to maintain here, I may request that they go to the issue tracker, instead. Note that I don't currently plan to add kernel tweaks to the app.

Edit: There was a bug in the v1.0.0-alpha03 build that caused it to crash frequently. This has been fixed in v1.0.0-alpha04.
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
Alpha 4 seems like a bad upload? I have downloaded it a couple times but Android just reports "There was a problem parsing the package"
I have that checksum too but it's not working, maybe it's minimum Android 12?
Yes, I was playing with the new Splashscreen API, which requires Android 12, and I don't have an Android 11 device to test on, so I just set minSdk to 31. I'll see if I can get it to build against something lower.
 
Last edited:
  • Like
Reactions: eng.stk and osm0sis

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
I pushed a new build that will hopefully work on Android 11. Here are the changes:

lowered minSdk to 30
added vbmeta to raw partition backups
fixed vendor_dlkm map and mount

Note: With verity enabled, you may have to unmap vendor_dlkm twice, once for the verity device and again for the actual partition. The partition is remounted without verity, though I'm not sure there's a scenario where it's necessary to remount it at all.
 
Last edited:
  • Like
Reactions: eng.stk and osm0sis

osm0sis

Senior Recognized Developer / Contributor
Mar 14, 2012
15,016
34,059
Halifax
GT-i9250
Google Nexus 4
I pushed a new build that will hopefully work on Android 11. Here are the changes:



Note: With verity enabled, you may have to unmap vendor_dlkm twice, once for the verity device and again for the actual partition. The partition is remounted without verity, though I'm not sure there's a scenario where it's necessary to remount it at all.
Thanks! Crashes after the splash screen on my OP8T on OOS11, not seeing anything in the logcat however..🤔
 
  • Like
Reactions: capntrips

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
Thanks! Crashes after the splash screen on my OP8T on OOS11, not seeing anything in the logcat however..🤔
I pushed a new build that hopefully fixes the issue. It now makes it to the point where it requires root to continue on an Android 11 AVD. I assume if it makes it to that point, the rest will work as expected. Anything beyond that, and I'll have to root the AVD to test it (though I did see an article about that a few weeks back, and it seemed simple enough).
 
  • Like
Reactions: osm0sis and shoey63

osm0sis

Senior Recognized Developer / Contributor
Mar 14, 2012
15,016
34,059
Halifax
GT-i9250
Google Nexus 4
A few random thoughts/ideas while testing on my 8T :):

Got some errors trying to backup on my 8T since there's no vendor_boot, so I guess some logic will be needed for whether they exist.

Probably the feature should be like "backup slot" and save init_boot, boot, vendor_boot, dtbo, recovery, vendor_dlkm and vbmeta from the chosen slot if any of them exist.

If vendor_dlkm doesn't exist on an older device it doesn't make sense to show "Not Found" all over the place, nor offer to allow me to map it, it should hide those messages/buttons and just only show boot or whatever other partitions exist on the device.

If the reboot button had a ... to reveal an advanced reboot menu (menu items like the Magisk app) that would be excellent!


Overall looking really good! Exciting to see a well written free alternative. 🤘
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
218
417
OnePlus 6T
Google Pixel 6
When you have time to work on the next update, would it be possible to make boot image flashing possible (External ones, not just saved backups), as well as zips?
The backup format is very basic. You could easily drop the image you want into the backup folder and create the properties file. I'll take a look at adding something to simplify direct flashing in the next few revisions. I'm out of pocket through the weekend and will probably need a few days of catch-up when I get back.
 
  • Like
Reactions: shoey63 and osm0sis

Enddo

Senior Member
Oct 31, 2013
2,040
864
Atlanta, Ga.
www.youtube.com
can I flash an uncompressed boot.img file with this app? the github only mentions flashing an AK3 zip file, so I was curious

sorry, I see the other reply. I'm hoping this app gets this feature in a future update soon. making a video about this app right now :)
 
Last edited:

Top Liked Posts

  • 1
    I added dtbo, init_boot, and recovery to the optional partitions list.

    Thanks! Not seeing dtbo and recovery get backed up when I make a backup on my 8T though. Both are slotted partitions. Looks like it only backs up boot now. I guess once it's optional this'll all get ironed out. 🤞

    Hopefully advanced reboot menu is still on the to-do as well. 😋
    1
    Thanks! Not seeing dtbo and recovery get backed up when I make a backup on my 8T though. Both are slotted partitions. Looks like it only backs up boot now. I guess once it's optional this'll all get ironed out. 🤞

    It initially looks for boot in /dev/block/by-name, then it looks there for all physical partitions, as well. It looks for all logical partitions in /dev/block/mapper. vendor_dlkm is assumed to be the only logical partition in that list.

    I may need to make some of that more generic. Let me know the details for the 8T, and I'll see what I can do. I've already added Hashtree Patcher to the latest builds, so I may just refactor everything to read from fstab.

    Marking a partition as optional just prevents it from throwing an exception if it doesn't find it.

    Hopefully advanced reboot menu is still on the to-do as well. 😋

    I just gave this a go and it seems to be working fine. I'll clean it up and get it into the next release. The commit message for this didn't give any context and a quick test without it didn't yield any interesting results, so I'm going to ignore it for now.
  • 5
    A new version is up. Here's the changelog:

    added Hashtree Patcher for mount and unmount
    added additional optional partitions
    hid vendor_dlkm elements on devices without

    I didn't make an update post for it, but alpha07 fixed a bug in the flash shell, which affected the newest AK3 on some devices. Also, the splash screen issue in alpha07 has been fixed.

    Kernel update URLs and manual partition flashing are both on my shortlist for the next update.

    Got some errors trying to backup on my 8T since there's no vendor_boot, so I guess some logic will be needed for whether they exist.

    I had vendor_boot set to required, so I made it optional. The whole required/optional thing will go away when I've added partition selection to backup and restore.

    Probably the feature should be like "backup slot" and save init_boot, boot, vendor_boot, dtbo, recovery, vendor_dlkm and vbmeta from the chosen slot if any of them exist.

    I added dtbo, init_boot, and recovery to the optional partitions list.
    1
    I added dtbo, init_boot, and recovery to the optional partitions list.

    Thanks! Not seeing dtbo and recovery get backed up when I make a backup on my 8T though. Both are slotted partitions. Looks like it only backs up boot now. I guess once it's optional this'll all get ironed out. 🤞

    Hopefully advanced reboot menu is still on the to-do as well. 😋
    1
    Thanks! Not seeing dtbo and recovery get backed up when I make a backup on my 8T though. Both are slotted partitions. Looks like it only backs up boot now. I guess once it's optional this'll all get ironed out. 🤞

    It initially looks for boot in /dev/block/by-name, then it looks there for all physical partitions, as well. It looks for all logical partitions in /dev/block/mapper. vendor_dlkm is assumed to be the only logical partition in that list.

    I may need to make some of that more generic. Let me know the details for the 8T, and I'll see what I can do. I've already added Hashtree Patcher to the latest builds, so I may just refactor everything to read from fstab.

    Marking a partition as optional just prevents it from throwing an exception if it doesn't find it.

    Hopefully advanced reboot menu is still on the to-do as well. 😋

    I just gave this a go and it seems to be working fine. I'll clean it up and get it into the next release. The commit message for this didn't give any context and a quick test without it didn't yield any interesting results, so I'm going to ignore it for now.
  • 28
    kernel-flasher-1.jpg
    kernel-flasher-2.jpg
    kernel-flasher-3.jpg


    Kernel Flasher is an Android app to flash, backup, and restore kernels.

    Features
    • Flash AK3 kernel zips
    • Backup and Restore kernel partitions
    • Mount, Map, and Resize vendor_dlkm
    • Save dmesg and logcat

    Planned and Potential Features
    • Keep original AK3 zip filename during flash (useful when viewing logs)
    • Add support for FKM update json format
    • Periodically check update json URLs automatically in the background?
    • Move backups to a folder in the sdcard root (breaking change)
    • Allow selective backup and restoration of raw partitions
    • Create and display hashes for all partitions
    • Verify hashes after backup and restoration?
    • Add a setting for preferred hashing algorithms?
    • Named backups? notes?
    • Reallow flashing to the inactive slot?
    • Attempt to fallback on resize when there is no room for replace
    • Provide multiple reboot options

    Notes

    When making a backup of the active slot, to save time, it is assumed that the kernel on disk is the same as the running kernel. The Check Kernel Version button can retrieve it from disk prior to backup.

    After restore (or flash from AK3), the updated contents of vendor_dlkm can't immediately be backed up. Unmounting, unmapping, then remapping it can make it available for backup.

    AK3 helper modules are not backed up. Flashing the AK3 zip is preferable. The backup function is mostly intended for stock.


    Credits

    @osm0sis for AK3, feedback, and general guidance
    @eng.stk & @Freak07 for feedback, advice, and encouragement
    @phhusson for lptools
    @topjohnwu for Magisk and libsu


    Latest Update

    2022-08-07 v1.0.0-alpha08
    6
    Can you please leave the kernel installation log opened after the process ends with an error? Currently it's impossible to see what went wrong since the log disappears instantly and is being replaced by an error screen.
    That is already done in my own personal test version of the app, but I haven't had a chance to clean it up and get it released. I'll make an effort to get that done this evening.

    I've got several other enhancements planned, but most of my focus has been on Hashtree Patcher lately, though I think that is nearly wrapped up. I'll try to get the installation log issue fixed asap, then I'll work on the rest over the next few days.
    6
    A few random thoughts/ideas while testing on my 8T :)
    All good ideas. Probably good enough to check by path for the existence of a partition, rather than finding and parsing fstab. My next two weeks are brutal, but I'll see if I find some time to fiddle with it in there.
    5
    A new version is up. Here's the changelog:

    added Hashtree Patcher for mount and unmount
    added additional optional partitions
    hid vendor_dlkm elements on devices without

    I didn't make an update post for it, but alpha07 fixed a bug in the flash shell, which affected the newest AK3 on some devices. Also, the splash screen issue in alpha07 has been fixed.

    Kernel update URLs and manual partition flashing are both on my shortlist for the next update.

    Got some errors trying to backup on my 8T since there's no vendor_boot, so I guess some logic will be needed for whether they exist.

    I had vendor_boot set to required, so I made it optional. The whole required/optional thing will go away when I've added partition selection to backup and restore.

    Probably the feature should be like "backup slot" and save init_boot, boot, vendor_boot, dtbo, recovery, vendor_dlkm and vbmeta from the chosen slot if any of them exist.

    I added dtbo, init_boot, and recovery to the optional partitions list.
    4
    I pushed a new build that resolves the installation log issue. Here is the full changelog:

    added option to backup AK3 zips
    disabled flash and restore on inactive slot
    added save ramoops button
    added stderr to AK3 logs
    added .log file extension to log files
    filtered ui_print and progress in AK3 logs
    sorted backups

    I also added a list of planned and potential features to the OP. If you've got some interest in seeing any of them or anything I may have missed in a future build, feel free to note it here. If the list gets to be too big of a pain to maintain here, I may request that they go to the issue tracker, instead. Note that I don't currently plan to add kernel tweaks to the app.

    Edit: There was a bug in the v1.0.0-alpha03 build that caused it to crash frequently. This has been fixed in v1.0.0-alpha04.