React Native, Hermes bytecode, and the Kindle homepage

Sighery1 pts0 comments

React Native, Hermes bytecode, and the Kindle homepage | RinconEstimated reading time: 35 minutes<br>React Native, Hermes bytecode, and the Kindle homepage<br>June 8, 2026<br>Why are there ads on my Kindle homepage?<br>Ever wondered what powers the Kindle&rsquo;s homepage? Turns out, since<br>5.14.2 (February 2022), Kindles use React Native<br>for their homepage app.<br>Before this the homepage used to be written in Java. Back then, some smart<br>people in the Mobileread forums figured out how to<br>patch the Java bytecode. If you have ever used Revanced, this was<br>similar.<br>Sadly, JBPatch has seen no development for well over a decade. Even if it did,<br>most of the previous Java stack—which was used for both the homepage and<br>readers—has since been replaced with a combination of React Native and C++.<br>Before I continue, I would like to thank Marek for writing the first<br>version of KPP_Patch, a program to patch the Kindle&rsquo;s homepage React<br>Native app, which I later contributed to. Also hexpwn, active in the<br>Kindle modding scene, who contributed some fixes to make the specific Kindle&rsquo;s<br>React Native version supported in the disassembler we use.<br>React Native<br>React Native—RN for short—allows the same JavaScript code to run on<br>multiple platforms, using native APIs. Although the official support is<br>limited to Android and iOS, there are community<br>implementations for other platforms like<br>macOS, visionOS, and tvOS among others.<br>There is also Skia which promises Linux support, but I<br>have not been able to confirm this is what Amazon is using for the Kindle.<br>A while back, Lukas1h figured out how to make<br>custom React Native apps that could run on the Kindle.<br>I have not tried this, and it was last tested with a PW3 on 5.13.7—2021, so<br>mileage might vary on newer devices and firmware versions.<br>Regardless, this article will not cover React Native, but rather will focus on<br>Hermes, a new JavaScript engine developed by Facebook. Since 2022, it has<br>also become the default engine for React<br>Native applications.<br>Hermes not only supports running JavaScript code, but can also precompile<br>JavaScript into bytecode ahead of time, and then execute that bytecode. This<br>allows for smaller bundle sizes and faster start-up times. It also makes<br>reverse engineering and modding React Native applications that much harder.<br>Effectively, to patch a React Native application, you will need to modify the<br>Hermes bytecode.<br>Hermes bytecode<br>Initially I was planning on just getting the latest React Native and writing a<br>simple app, to disassembling the bytecode and learn off that. This already<br>proved challenging, as there is no official Linux target. But that wasn&rsquo;t the<br>only issue.<br>The Hermes bytecode is not yet stable. The bytecode is only runnable by the<br>same Hermes version that produced it. At the time of writing, Hermes is on<br>bytecode version 99. Meanwhile, the Kindle&rsquo;s homepage<br>is still using version 84:<br>[root@kindle root]$ file /app/KPPMainApp/js/KPPMainApp.js.hbc<br>/app/KPPMainApp/js/KPPMainApp.js.hbc: Hermes JavaScript bytecode, version 84

So not only would I need React Native plus Skia for the Linux target, but I<br>would need specifically React Native with an old Hermes engine using bytecode<br>version 84, which also supports Skia. Clearly, this wasn&rsquo;t going to work.<br>Instead I decided to focus on getting the compatible Hermes engine built,<br>since I mostly care about Hermes bytecode, not so much the React Native APIs.<br>Turns out, other than a<br>relatively heavy C++ build setup, it is pretty<br>simple to build and run Hermes. This includes a compiler and a disassembler,<br>as well as the engine that runs both JavaScript and bytecode.<br>Sadly you cannot just build the latest Hermes version. Like I mentioned<br>before, bytecode is only runnable for the Hermes version that built it. The<br>latest Hermes that supports bytecode version 84 is v0.11.0<br>from 2021. This version proved more challenging to build, as it used different<br>instructions, and an older CMake version.<br>Here are the v0.11.0 build instructions.<br>If you use Nix, I already did the work of<br>building a derivation. For this, I needed to use an old<br>CMake version—3.07—from 2017. If you are using a normal distribution,<br>hopefully the build instructions plus the CMake version tip will help you.<br>$ nix build "github:Sighery/hermes_84-nix"

$ ls ./result/bin/<br>hbcdump hdb hermes hermesc hvm

$ echo "print('Hello Hermes');" > sample.js<br>$ ./result/bin/hermes -emit-binary -out sample.hbc sample.js<br>$ file sample.hbc<br>sample.hbc: Hermes JavaScript bytecode, version 84<br>$ ./result/bin/hermes sample.hbc<br>Hello Hermes

There are no platform APIs in Hermes. Those are implemented in React Native<br>and executed in Hermes through JSI. I have not compiled JSI, nor tried to<br>integrate it with my bare Hermes build. Hermes provides a single undocumented<br>print function—no console.log. This I have found enough for simple<br>programs.<br>You can check Hermes&rsquo; current ECMAScript feature support<br>here.<br>Picking a disassembler<br>The scene is not super mature, but...

hermes native react bytecode version kindle

Related Articles