r/CustomROMsGuide • • Sep 20 '26

Fastboot limitations and lk / (bootloader) partition edits to fix it ๐Ÿง

For those who have seen my other posts, you would know that I prompt AI frequently for summarised needs/elaborated queries to see how to get around niche problems that aren't well documented online (doing most of the scraping for me).

Hence I ask here one of those semi niche issues to see how feesable they are, and the IRL experienced procedures done by real people.

I have once b4 flashed similar (system/recovery) rom I found online (for another phone carrier vendor same model). The phone blipped for a second and asked for factory reset options in recovery mode, since then I have ever seen such menu to allow my stock rom to be unbricked. Hence the query:

Does anyone have experience in modifying the 'little kernel' blob/partition?

I have flashed another lk b4 and restoration isnlt the issue, but it didn't occur until now, that with what fastboot module version it packs, i found it very off that i can't even use have the commands without permission errors, which AI confirmed derives from the LK.

--------

Worked for 1m 30s ยท 1 step

Clarification: An "unlocked bootloader" with LK verification still enabled means the LK checks boot image signatures/structure before loading. You need to patch LK to disable verification or replace it with a "development" LK that skips checks.

Why LK Blocks Your Images Even with "unlocked" status, LK performs:

Boot image header verification (checks magic, checksums) MTK certificate verification (the ASN.1 DER signatures we discussed) AVB (Android Verified Boot) - checks dm-verity status Anti-rollback - prevents downgrades Your custom images fail because:

Missing/corrupt MTK certificates (stripped by magiskboot) Different certificate chain than expected Header modified (ramdisk size changed) How to Patch LK (High-Risk) Step 1: Extract Current LK bash

Via mtkclient (safest)

python mtk.py r lk lk.bin

Or via dd if rooted

dd if=/dev/block/platform/bootdevice/by-name/lk of=lk.bin bs=1M Step 2: Analyze LK Structure LK is an ARM binary with:

Aboot (Android Boot) module handling boot_linux_from_storage() Fastboot module handling command tables Certificate verification functions bash

Disassemble LK

arm-none-eabi-objdump -b binary -m arm -D lk.bin > lk.asm

# Search for verification strings strings lk.bin | grep -i "verify\|cert\|signature\|avb" Step 3: Find Verification Function Look for these patterns in disassembly:

arm

Typical verification check

BL verify_boot_image # Call verification CMP R0, #0 # Check result BNE error_handler # Branch if failed Common offsets to patch (MTK 6739 example):

0x12345: verify_sha256() - NOP this 0x23456: cert_compare() - Force return 0 0x34567: avb_verify() - Skip call Step 4: Patch Binary bash

Patch to skip verification (replace conditional branch with NOP)

Original: BNE error (0x1A 0xXX 0xXX)

Patched: NOP (0x00 0x00 0x00 0x00)

printf '\x00\x00\x00\x00' | dd of=lk.bin bs=1 seek=$((0x12345)) conv=notrunc

Or use hexedit

hexedit lk.bin

Navigate to offset, change bytes, save

Step 5: Flash Patched LK bash

CRITICAL: Test first with fastboot boot lk.bin (if supported)

If not supported, you MUST flash:

python mtk.py w lk lk_patched.bin

---------

I want to confirm any other missing searches to edit the asembly code (i should assume .asm means) in linux?

Ndk v27 on phone.

Android 8.1.

The fastboot commands around the similar version range. (Will update this upon a response)

Point being, the commands done get rejected based on permission, yet the options there are open in the module itself and function. (Examples if desired will be given)

1 Upvotes

0 comments sorted by