This repo has a persistent on-disk preset layout. Treat changes in kernel/include/preset.h and tools/preset.h as ABI changes, not normal refactors.
- Do not change
MAP_SYMBOL_NUMcasually. map_symbol_tsits beforeheader_backupinsidesetup_preset_t, so changingMAP_SYMBOL_NUMmovesheader_backupand every field after it.- That offset drift is what broke upgrade parsing across
0.13.1,0.13.2, and newer builds. tools/preset.his the tools-side mirror ofkernel/include/preset.h; keep them in sync when layout changes.
- Official upstream
0.13.0/0.13.1:current_header_backup_offset - 16 - Official upstream
0.13.2and currentmain:current_header_backup_offset current_header_backup_offset - 8is kept only as a fallback for non-official intermediate/local images
tools/patch.c resolves this through preset_header_backup() and validates candidates with the saved primary-entry header.
- Prefer fixed-capacity storage for persistent structs.
- Prefer using reserved space like
__[]for small new metadata. - If a serialized struct must change, add explicit versioned parsing instead of relying on current
offsetof(...).
- Rebuild tools with
wsl -d Ubuntu bash -lc "cd /mnt/e/Project/self/KernelPatch/tools && make". - Re-test upgrade flow with:
- old patched boot -> unpack
- repatch extracted kernel
- repack boot
- unpack repacked boot
- repatch again