No description
  • C 84.7%
  • C++ 4.1%
  • Python 3%
  • Makefile 2.8%
  • Assembly 1.9%
  • Other 3.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Remco Jongschaap ba900372da amazon: trona: boot header v3/v4 images
LK only parses boot image headers v0-v2, and its header loaders accept
page sizes up to 0x800. A v3/v4 image (GKI style, here without
vendor_boot) has the v1 layout with 4096-byte pages: the header in the
first page, then the kernel and the ramdisk, each padded to 4096.

LK reads the header from flash in several places: the early DTB lookup,
the boot and recovery header loaders, and the image loaders' read
wrapper (Amazon's signature hash). Route every partition_read call
through a shim that rewrites a v3/v4 header read from offset 0 into the
equivalent v1 header (4096-byte pages, the load addresses our v1 images
use, the command line split 512 + 1024 as mkbootimg does), using the
on-disk v1 offsets (LK's header buffer is exactly 1648 bytes). Raise both
page size checks to 0x1000: every later use of the page size in the
loaders is a partition offset or an offset into LK's 144 MiB scratch
buffer. Other reads, and v0-v2 images, are unchanged.

Tested on trona: v1 boot/recovery, v4 recovery and v4 boot images boot.

Signed-off-by: Remco Jongschaap <hey@dougley.com>
2026-11-06 12:44:53 +01:00
.devcontainer kaeru: Add Development Container Template 2026-07-27 19:45:16 +02:00
.github kaeru: Add a CI job to build all devices 2026-09-23 19:22:43 +02:00
arch lib: Register fastboot commands from a table 2026-09-01 02:48:33 +02:00
board amazon: trona: boot header v3/v4 images 2026-11-06 12:44:53 +01:00
configs lib: Commonize fastboot fetch 2026-10-13 13:14:11 +02:00
drivers drivers: Fix mtk_wdt_reset() hang 2026-10-05 01:19:41 +02:00
include wasp: Restore off-mode charging 2026-10-14 19:25:44 +02:00
lib wasp: Restore off-mode charging 2026-10-14 19:25:44 +02:00
main kaeru: The end of the non-stage1 era 2026-09-23 19:48:17 +02:00
scripts kconfig: Convert xfgets() to ANSI C function definition 2026-02-07 13:09:49 +01:00
soc soc: Add support for MediaTek MT8188 2026-08-27 22:38:13 +02:00
stage1 kaeru: Improve lkloader readability 2026-10-09 19:09:31 +02:00
utils utils: Ignore empty LK_PART_HDR_NAME 2026-10-04 23:09:36 +02:00
.clang-format kaeru: Initial code upload 2025-05-17 21:32:29 +02:00
.gitattributes kaeru: Add in a minimal .gitattributes 2026-04-13 12:04:50 +02:00
.gitignore kaeru: Add a CI job to build all devices 2026-09-23 19:22:43 +02:00
build.sh kaeru: The end of the non-stage1 era 2026-09-23 19:48:17 +02:00
docker_run.sh kaeru: Refactor docker script into a build wrapper 2026-07-28 01:02:59 +02:00
Dockerfile kaeru: Append git SHA to version string 2026-06-21 02:24:30 +02:00
flake.lock kaeru: Update flake.nix 2026-09-19 01:13:02 +02:00
flake.nix kaeru: Update flake.nix 2026-09-19 01:13:02 +02:00
format.sh kaeru: Fix shebangs for bash scripts 2025-12-04 00:45:59 +01:00
Kconfig arch: Refactor cache maintenance APIs 2026-04-11 17:46:21 +02:00
LICENSE kaeru: Initial code upload 2025-05-17 21:32:29 +02:00
Makefile kaeru: Trim kernel-era cruft from the Makefile 2026-09-23 20:01:42 +02:00
README.md kaeru: Update my own contact mail 2026-05-23 16:41:44 +02:00
README_ja-JP.md kaeru: Update my own contact mail 2026-05-23 16:41:44 +02:00
setup.sh kaeru: Fix shebangs for bash scripts 2025-12-04 00:45:59 +01:00

🐸 かえる

Language: 日本語

This repository contains an ARMv7 payload that provides arbitrary code execution on MediaTek bootloaders (LK).

Overview

Caution

If you don't know what you're doing, you can brick your device. This is not a beginner's project. Please READ THE DOCUMENTATION carefully and understand the implications of modifying your bootloader.

Given a bootloader image, this tool will output a patched version that can be flashed to the device. The patched image will contain a custom payload that allows you to run arbitrary code during the boot process.

Things to keep in mind:

  • This payload is designed for devices using an ARMv7 Little Kernel (LK) as their bootloader.
  • Offsets and addresses are specific to the device and bootloader version. You may need to adjust them for your specific device and bootloader version.

The following list showcases the most common use cases for kaeru:

  • Advanced debugging: Use the payload to debug the boot process of your device by hooking into the bootloader's functions and variables.
  • Custom fastboot commands: Add your own fastboot commands to the bootloader.
  • Remap button combinations: You can set up custom boot modes and key combinations to enter different modes (e.g., recovery, fastboot, etc.).
  • Remove bootloader warnings: Remove the "unlocked bootloader" warning that appears when the device is booted with an unlocked bootloader.

... and much more!

Wiki

An elaborate wiki with multiple guides and notes has been provided to help you understand how kaeru works. Please refer to it to learn how to build, add support for a new device, and more:

  1. Table of contents
  2. Introduction
  3. Can I use kaeru on my device?
  4. Porting kaeru to a new device
  5. Customization and kaeru APIs

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

Key points to be aware of:

  • You are free to use, modify, and distribute the software.
  • If you modify and use the software publicly, you must release your source code.
  • You must retain the same license (AGPL-3.0) when redistributing modified versions.
  • You cannot keep modifications private if the software is used to provide a networked service.

For full details, please refer to the LICENSE file.

Acknowledgments

Linux

Some of the Makefile and build-related scripts were adapted from the Linux kernel source code.

Linux which is licensed under the GNU General Public License v2.

© The Linux Foundation and contributors.

Original source: https://github.com/torvalds/linux

nanoprintf

This project includes nanoprintf, a minimal implementation of printf-style formatting designed for embedded systems.

nanoprintf is dual-licensed under the Unlicense and the Zero-Clause BSD (0BSD).

© 2019 Charles Nicholson.

Original source: https://github.com/charlesnicholson/nanoprintf

libsej

This project includes libsej, a library for interacting with MediaTek's Security Engine (SEJ/HACC) hardware.

libsej is licensed under the GNU General Public License v3.

© 2024 B.Kerler, 2025 Shomy.

Original source: https://github.com/shomykohai/mtk-payloads/tree/main/libsej

Disclaimer

This software is provided "as is" without any warranty of any kind, express or implied. By using this tool, you acknowledge that:

  • Modifying the bootloader or flashing modified images carries a high risk of permanently damaging your device (bricking).
  • You are solely responsible for any consequences resulting from the use, misuse, or inability to use this software.
  • The maintainers and contributors of this project are not liable for any damage, data loss, device malfunction, or legal issues that may arise.
  • This project is intended for educational and research purposes only. It is not intended for illegal or unauthorized use.

Proceed only if you fully understand the risks and implications.