Themes / Apps / Mods [DEV] Kernel Flasher

Search This thread

capntrips

Senior Member
Aug 29, 2020
221
433
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
  • Add support for FKM update json format
  • Allow selective backup and restoration of raw partitions
  • Display hashes for all partitions
  • Add a log to the restore command
  • Periodically check update json URLs automatically in the background?
  • Verify hashes after backup and restoration?
  • Add a setting for preferred hashing algorithms?
  • Named backups? notes?
  • Reallow flashing to the inactive slot?
  • Backup helper modules?

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-10 v1.0.0-alpha09
 
Last edited:

capntrips

Senior Member
Aug 29, 2020
221
433
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
221
433
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
221
433
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
221
433
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,023
34,065
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
221
433
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,023
34,065
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
221
433
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,041
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

  • There are no posts matching your filters.
  • 6
    A new build is up, It adds the ability to check for and download updates from FKM style update URLs. There are still a few things that need to be added in a future build:
    • it does not provide the option to flash directly
    • it does not check for updates automatically (either on-load or in the background)
    • it does not validate the input in the url field
    I'm still undecided on doing periodic checks in the background. If this is something you want, feel free to comment.

    I'm planning to add manual image flashing next.
    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
    Code:
    /dev/block/by-name
    /dev/block/bootdevice/by-name
    /dev/block/platform/*/*/by-name
    /dev/block/platform/*/by-name

    Probably Qualcomm or whoever defined these at some point, especially the old platform ones, then the bootdevice and direct by-name one were created by Google, Qualcomm or someone to simplify accessing them on newer devices.

    But the fstab is only for things with somewhat defined mount points I guess?

    I was looking more for where they are defined offline.

    I suppose they could just be directly from the partition table. I'll see if that turns up anything.

    Ah I see boot, dtbo recovery and vbmeta are indeed backed up, but there's no indication in the app what partitions are present in a backup.

    I'm planning to add on-screen logging and the save capability to the backup and restore functions, as with flash. I'm planning to display the partition and image hashes somehow, as well.
    4
    I pushed a new build, and here are the changes:

    added fstab entries as primary source of block devices
    added resize fallback when not enough room for temporary partition
    moved backups to /sdcard/KernelFlasher
    replaced backup prop metadata with json and data classes
    added backup partition hashes to backup metadata
    restored AK3 zip filename to flash log
    added advanced reboot menu

    There were significant changes to the backup and restore functions, most notably they moved to /sdcard/KernelFlasher for ease of access from a file manager, and the metadata file is now JSON. As this breaks the old backups, I added a Migrate button on the Backups page, which I'll drop when the app goes stable.

    I finally got around to reading the libsu 5.0.0 changelog and javadoc, and SuFile is eventually going away, so I started migrating to ExtendedFile. This is still a WIP, but all of the pieces are there.

    I ended up doing basically all of the planned features except the ones I had previously planned to work on. Assuming this build doesn't crash and burn, once I get the remaining features added, I'll probably mark the next build as beta or rc.

    P.S. I got a Pixel 6a today, so I'll likely make my Pixel 6 my daily driver (a year later) and the 6a my primary development device.

    There are lots of things not in the fstab, so those fallback paths are important for sure.

    Any idea where/how those partitions are defined?
    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. 😋
  • 29
    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
    • Add support for FKM update json format
    • Allow selective backup and restoration of raw partitions
    • Display hashes for all partitions
    • Add a log to the restore command
    • Periodically check update json URLs automatically in the background?
    • Verify hashes after backup and restoration?
    • Add a setting for preferred hashing algorithms?
    • Named backups? notes?
    • Reallow flashing to the inactive slot?
    • Backup helper modules?

    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-10 v1.0.0-alpha09
    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 new build is up, It adds the ability to check for and download updates from FKM style update URLs. There are still a few things that need to be added in a future build:
    • it does not provide the option to flash directly
    • it does not check for updates automatically (either on-load or in the background)
    • it does not validate the input in the url field
    I'm still undecided on doing periodic checks in the background. If this is something you want, feel free to comment.

    I'm planning to add manual image flashing next.
    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.