mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
JIANT runs under the boot head of V15 and of V16, while V15's app under V16's head is untested; the rescue never writes the head, so an FM-1 that came with V16 is restored to JIANT. The android workflow puts the public JIANT package in the APK (android/rescue/fetch_jiant.py, same checks as make_site.py, GPL + Apache-2.0 notices). The app offers JIANT (default), the official V15 (downloaded once) or a .fwsc of your own; the web page and make_uf2.mjs accept JIANT packages too (identity FM-1_9xx, flash.bin exactly 0x93000, Felucca loader inside). Tested with a package made by tools/fm1pkg_make.py: Java, JS and the page agree byte for byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UVqsRpwNe3f8G3bWubf9TX
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
// SPDX-License-Identifier: MIT
|
|
// Command-line version of fm1-rescue.html:
|
|
// node rescue/make_uf2.mjs BASE.uf2 FM-1.fwsc wl82loader.bin OUT.uf2 [REGION_OUT.bin]
|
|
// REGION_OUT.bin (optional): the V15 region 0x4000..0x92FFF, for test/run.sh.
|
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
import { buildRescueUf2, checkPackage } from "./builder.js";
|
|
|
|
const [base, fwsc, loader, out, regionOut] = process.argv.slice(2);
|
|
if (!out) {
|
|
console.error("usage: node make_uf2.mjs BASE.uf2 FM-1.fwsc wl82loader.bin OUT.uf2 [REGION_OUT.bin]");
|
|
process.exit(2);
|
|
}
|
|
try {
|
|
const pkg = new Uint8Array(readFileSync(fwsc));
|
|
const r = await buildRescueUf2({
|
|
baseUf2: new Uint8Array(readFileSync(base)),
|
|
fwsc: pkg,
|
|
loader: new Uint8Array(readFileSync(loader)),
|
|
});
|
|
writeFileSync(out, r.uf2);
|
|
if (regionOut) writeFileSync(regionOut, (await checkPackage(pkg)).region);
|
|
console.log(`${out}: ${r.uf2.length} bytes (${r.identity}${r.official ? ", official V15" : ", JIANT"})`);
|
|
} catch (e) {
|
|
console.error("refused: " + e.message);
|
|
process.exit(1);
|
|
}
|