Port Nokia 800 Tough (nokia-coconut), fix microSD detection, and stage upcoming a1120 (cocojamboo) build

- Migrate nokia-tough to canonical nokia-coconut while keeping CLI aliases, add layered bootloader/lk2nd/nokia-coconut.patch, bootfs/bootimg validators, and offline scripts/inspect-stock-msm8905-dump.py

- Complete nokia-coconut Stage 2 hardware bring-up: wire 6-column 22-key keypad (gpio0, gpio3, gpio7, gpio99, gpio6, gpio1), gpio98 KEY_POWER, and pon@800:resin KEY_DOWN (0x6c); split leds-msm8905-torch into GPIO_13 white:torch (dedicated top-edge flashlight) and GPIO_32 camera:flash (rear camera flash for camera.so and bananarchy-photo)

- Restore sdhci@7864000 non-removable across all six DTS/DTB targets, remove unwired gpio38 cd-gpios/sdc2-cd-* states, and harden sxmo_sdcard.sh under flock

- Register upcoming build a1120 (cocojamboo) in scripts/version.sh, scripts/check-rebuild.sh, CHANGELOG.md, AGENTS.md, README.md, and MANUAL.md with verified hashes across nokia-argon, nokia-beatles, and nokia-coconut
This commit is contained in:
Luxferre committed 2026-11-15 18:00:10 +02:00
1 parent fc5c4282f5
commit ab53423e33
60 files changed
+2669 -453

No files matched your search

+127 -58
View File
@@ -35,11 +35,21 @@ from Library.firehose import qualcomm_firehose, xmlparser
DEVICE_LABELS = {
"nokia-argon": "Nokia 8110 4G (nokia-argon)",
"nokia-beatles": "Nokia 2720 Flip (nokia-beatles)",
"nokia-tough": "Nokia 800 Tough (nokia-coconut)",
"nokia-coconut": "Nokia 800 Tough (nokia-coconut)",
"nokia-sparkler": "Nokia 8000 4G (nokia-sparkler)",
"nokia-leo": "Nokia 6300 4G (nokia-leo)",
}
DEVICE_ALIASES = {
"argon": "nokia-argon",
"beatles": "nokia-beatles",
"coconut": "nokia-coconut",
"nokia-tough": "nokia-coconut",
"tough": "nokia-coconut",
"sparkler": "nokia-sparkler",
"leo": "nokia-leo",
}
# Firehose programmers are signed for one root of trust, so the PBL rejects a
# mismatched one in Sahara. Never silently fall back to the 8110 programmer
# for a different target; --loader is the explicit escape hatch.
@@ -49,7 +59,7 @@ DEVICE_LABELS = {
DEVICE_LOADERS = {
"nokia-argon": "8110.mbn", # legacy generic MSM8905 programmer
"nokia-beatles": "2720.mbn", # Nokia_beatles
"nokia-tough": "800t.mbn", # Nokia_coconut
"nokia-coconut": "800t.mbn", # Nokia_coconut
"nokia-sparkler": "8k.mbn", # Nokia_leo root, shared with 6300 4G
"nokia-leo": "8k.mbn", # Nokia_leo
}
@@ -61,7 +71,7 @@ DEVICE_LOADER_VARIANTS = {
DEVICE_LOADER_IDENTITIES = {
"nokia-argon": "",
"nokia-beatles": "Nokia_beatles",
"nokia-tough": "Nokia_coconut",
"nokia-coconut": "Nokia_coconut",
"nokia-sparkler": "Nokia_leo",
"nokia-leo": "Nokia_leo",
}
@@ -82,10 +92,10 @@ EDL_PIDS = (0x9008, 0x900E, 0x9006)
# and cmdline lk2nd.compatible=nokia,beatles. aboot hands off to lk2nd, lk2nd
# brings up the 240x320 RGB565 main panel and boots Bananarchy from userdata
# via extlinux.conf. This is the default path on nokia-beatles.
BOOT_IMAGE_DEVICES = ("nokia-beatles",)
# Stock 2720 aboot has secure boot enabled and devinfo is locked. Writing a
BOOT_IMAGE_DEVICES = ("nokia-beatles", "nokia-coconut")
# Stock 2720/800 Tough aboot has secure boot enabled and devinfo is locked. Writing a
# custom boot.img (lk2nd or mainline) is rejected unless devinfo.is_unlocked=1.
UNLOCK_DEFAULT_DEVICES = ("nokia-beatles",)
UNLOCK_DEFAULT_DEVICES = ("nokia-beatles", "nokia-coconut")
DEVINFO_MAGIC = b"ANDROID-BOOT!"
DEVINFO_UNLOCKED_OFFSET = 13
DEVINFO_TAMPERED_OFFSET = 14
@@ -94,10 +104,15 @@ DEVINFO_TAMPERED_OFFSET = 14
# the authoritative RPMB devinfo; eMMC devinfo alone is not enough.
OEM_UNLOCK_PARTITIONS = ("config", "frp")
OEM_UNLOCK_FLAG_OFFSET = -1
# Rebuild the source port with scripts/build-lk2nd-beatles.sh after changing
# bootloader/lk2nd/nokia-beatles.patch; never binary-patch the prebuilt
# bootloader/lk2nd-msm8909.img.
# Rebuild the source port with scripts/build-lk2nd-beatles.sh or
# scripts/build-lk2nd-coconut.sh after changing bootloader/lk2nd patches; never
# binary-patch the prebuilt bootloader/lk2nd-msm8909.img.
BEATLES_LK2ND_IMAGE = "images/boot-lk2nd-nokia-beatles-display.img"
COCONUT_LK2ND_IMAGE = "images/boot-lk2nd-nokia-coconut-display.img"
DEVICE_LK2ND_IMAGES = {
"nokia-beatles": BEATLES_LK2ND_IMAGE,
"nokia-coconut": COCONUT_LK2ND_IMAGE,
}
BOOT_METHOD_PARTITIONS = {
"lk2nd": "boot", # lk2nd image into boot
"boot": "boot", # raw Bananarchy boot.img into boot (normal power-on)
@@ -598,33 +613,26 @@ def resolve_beatles_lk2nd_image():
return os.path.join(BASE_DIR, BEATLES_LK2ND_IMAGE)
def resolve_device_lk2nd_image(device):
rel = DEVICE_LK2ND_IMAGES.get(device, "")
return os.path.join(BASE_DIR, rel) if rel else ""
def parse_args():
parser = argparse.ArgumentParser(
description="Automated EDL Flasher for Bananarchy Linux (MSM8909 / Sxmo)"
)
valid_targets = list(DEVICE_LABELS.keys()) + list(DEVICE_ALIASES.keys())
parser.add_argument(
"device_pos",
nargs="?",
choices=[
"sxmo",
"nokia-argon",
"nokia-beatles",
"nokia-tough",
"nokia-sparkler",
"nokia-leo",
],
choices=["sxmo"] + valid_targets,
default=None,
help="Target device to flash (default: nokia-argon)",
)
parser.add_argument(
"--device",
choices=[
"nokia-argon",
"nokia-beatles",
"nokia-tough",
"nokia-sparkler",
"nokia-leo",
],
choices=valid_targets,
default="nokia-argon",
help="Target MSM8909 device (default: nokia-argon)",
)
@@ -653,8 +661,8 @@ def parse_args():
choices=["lk2nd", "boot", "recovery", "both"],
default="",
help="Boot method (default: lk2nd for all targets). On nokia-beatles "
"lk2nd is written to boot and recovery; both writes the mainline "
"boot.img to both slots; recovery needs Volume Up",
"and nokia-coconut lk2nd is written to boot and lk2nd, mainline "
"boot.img to recovery; both writes boot.img to boot and recovery",
)
parser.add_argument(
"--boot-image",
@@ -665,9 +673,8 @@ def parse_args():
parser.add_argument(
"--lk2nd-image",
default="",
help="Override the nokia-beatles lk2nd boot.img written to 'boot' "
"(e.g. images/boot-lk2nd-nokia-beatles-diagnostic.img for the "
"forced-fastboot/on-screen-log diagnostic build)",
help="Override the nokia-beatles/nokia-coconut lk2nd boot.img written to 'boot' "
"(e.g. images/boot-lk2nd-nokia-coconut-diagnostic.img for diagnostic logs)",
)
parser.add_argument(
"--variant",
@@ -716,8 +723,8 @@ def parse_args():
parser.add_argument(
"--unlock-bootloader",
action="store_true",
help="Set devinfo.is_unlocked=1 (default on nokia-beatles; needed for "
"the locked stock aboot to accept an unsigned boot.img)",
help="Set devinfo.is_unlocked=1 (default on nokia-beatles/nokia-coconut; "
"needed for locked stock aboot to accept an unsigned boot.img)",
)
parser.add_argument(
"--no-unlock-bootloader",
@@ -727,7 +734,7 @@ def parse_args():
parser.add_argument(
"--enable-oem-unlock",
action="store_true",
help="Patch config/frp allow-unlock flag (default on nokia-beatles). "
help="Patch config/frp allow-unlock flag (default on nokia-beatles/nokia-coconut). "
"Required before 'fastboot oem unlock-go' can write RPMB devinfo",
)
parser.add_argument(
@@ -740,6 +747,11 @@ def parse_args():
action="store_true",
help="Only patch eMMC devinfo and config/frp and exit without flashing",
)
parser.add_argument(
"--only-backup",
action="store_true",
help="Back up GPT and stock partitions to --backup-dir and exit without modifying eMMC",
)
parser.add_argument(
"--wipe-system",
action="store_true",
@@ -779,7 +791,8 @@ def main():
args = parse_args()
if args.list_loaders:
return list_loaders()
device = args.device_pos if args.device_pos and args.device_pos != "sxmo" else args.device
raw_device = args.device_pos if args.device_pos and args.device_pos != "sxmo" else args.device
device = DEVICE_ALIASES.get(raw_device, raw_device)
device_label = DEVICE_LABELS.get(device, device)
method = resolve_boot_method(device, args.method)
boot_img = os.path.abspath(args.boot_image or resolve_recovery_image(device))
@@ -789,7 +802,11 @@ def main():
else os.path.abspath(resolve_default_image(device))
)
bootloader_img = os.path.abspath(args.bootloader)
beatles_lk2nd_img = os.path.abspath(args.lk2nd_image or resolve_beatles_lk2nd_image())
device_lk2nd_img = (
os.path.abspath(args.lk2nd_image or resolve_device_lk2nd_image(device))
if (args.lk2nd_image or device in DEVICE_LK2ND_IMAGES)
else ""
)
mainline_img = boot_img
loader_mbn = os.path.abspath(
args.loader or resolve_default_loader(device, args.variant))
@@ -816,7 +833,9 @@ def main():
print(f" Verify Writes : {'yes' if args.verify else 'no (--verify to enable)'}")
print(f" Unlock Bootloader: {'yes (devinfo)' if unlock_bootloader else 'no'}")
print(f" Enable OEM Unlock: {'yes (config/frp)' if oem_unlock_enabled else 'no'}")
if args.only_unlock:
if args.only_backup:
print(" Mode : backup only (no partitions modified)")
elif args.only_unlock:
print(" Mode : prepare unlock only (no images flashed)")
if method in ("boot", "recovery", "both"):
print(f" Boot Image : {boot_img}")
@@ -832,8 +851,8 @@ def main():
"[!] Warning: %s is signed for %s, expected %s for %s. "
"Verify on hardware or pass --loader." % (
os.path.basename(loader_mbn), ident, expected, device))
if method == "lk2nd" and device == "nokia-beatles":
print(f" LK2ND (boot) : {beatles_lk2nd_img} (nokia-beatles source port)")
if method == "lk2nd" and device in DEVICE_LK2ND_IMAGES:
print(f" LK2ND (boot) : {device_lk2nd_img} ({device} source port)")
print(f" Boot Image (rec) : {mainline_img}")
print(f" Bootloader (boot): {bootloader_img}")
print(f" System (userdata): {userdata_img}")
@@ -852,17 +871,22 @@ def main():
print(" Run './flash-edl.sh --list-loaders' or pass --loader PATH.")
sys.exit(1)
required_files = [
("Firehose programmer", loader_mbn),
("System userdata image", userdata_img),
]
if method in ("boot", "recovery", "both"):
required_files.append(("Boot image", boot_img))
if args.only_backup or args.only_unlock:
required_files = [
("Firehose programmer", loader_mbn),
]
else:
required_files.append(("lk2nd bootloader image", bootloader_img))
if method == "lk2nd" and device == "nokia-beatles":
required_files.append(("nokia-beatles lk2nd image", beatles_lk2nd_img))
required_files.append(("Recovery boot image", mainline_img))
required_files = [
("Firehose programmer", loader_mbn),
("System userdata image", userdata_img),
]
if method in ("boot", "recovery", "both"):
required_files.append(("Boot image", boot_img))
else:
required_files.append(("lk2nd bootloader image", bootloader_img))
if method == "lk2nd" and device in DEVICE_LK2ND_IMAGES:
required_files.append((f"{device} lk2nd image", device_lk2nd_img))
required_files.append(("Recovery boot image", mainline_img))
for label, path in required_files:
if not os.path.isfile(path) or os.stat(path).st_size == 0:
print(f"[!] Error: {label} not found or empty at: {path}")
@@ -933,7 +957,7 @@ def main():
system_part = find_partition(guid_gpt.partentries, "system")
target_names = BOOT_METHOD_TARGETS[method]
if method == "lk2nd" and device == "nokia-beatles":
if method == "lk2nd" and device in DEVICE_LK2ND_IMAGES:
# Match the 8110/Argon shape: lk2nd in boot, mainline boot.img in
# recovery (Volume Up fallback). Also refresh the separate 512 KiB
# lk2nd partition so "Reboot to loader" cannot chain-load a stale
@@ -943,23 +967,25 @@ def main():
for name in target_names:
part = find_partition(guid_gpt.partentries, name)
if not part:
if name == "lk2nd" and method == "lk2nd" and device == "nokia-beatles":
if name == "lk2nd" and method == "lk2nd" and device in DEVICE_LK2ND_IMAGES:
print(f"[!] Warning: optional partition '{name}' not found; skipping.")
continue
if args.only_backup:
continue
print(f"[!] Error: Partition '{name}' not found in device GPT.")
sys.exit(1)
target_parts.append((name, part))
def source_for(name):
if method == "lk2nd" and device == "nokia-beatles":
if method == "lk2nd" and device in DEVICE_LK2ND_IMAGES:
if name in ("boot", "lk2nd"):
return beatles_lk2nd_img
return device_lk2nd_img
return mainline_img
if method == "lk2nd":
return bootloader_img
return boot_img
if not userdata_part:
if not userdata_part and not args.only_backup:
print("[!] Error: Partition 'userdata' not found in device GPT.")
sys.exit(1)
@@ -969,15 +995,58 @@ def main():
f"{boot_part.sectors} sectors "
f"({(boot_part.sectors * fh.cfg.SECTOR_SIZE_IN_BYTES) / (1024 * 1024):.1f} MiB)"
)
print(
f"[+] Found 'userdata' : sector {userdata_part.sector}, "
f"{userdata_part.sectors} sectors "
f"({(userdata_part.sectors * fh.cfg.SECTOR_SIZE_IN_BYTES) / (1024 * 1024):.1f} MiB)"
)
if userdata_part:
print(
f"[+] Found 'userdata' : sector {userdata_part.sector}, "
f"{userdata_part.sectors} sectors "
f"({(userdata_part.sectors * fh.cfg.SECTOR_SIZE_IN_BYTES) / (1024 * 1024):.1f} MiB)"
)
if args.dump_diagnostics:
dump_diagnostics(fh, args.lun, guid_gpt.partentries, backup_dir)
if args.only_backup:
os.makedirs(backup_dir, exist_ok=True)
gpt_backup_path = os.path.join(backup_dir, "gpt.bin")
if args.force_backup or not os.path.exists(gpt_backup_path):
with open(gpt_backup_path, "wb") as wf:
wf.write(gpt_raw)
print(f"[+] Saved GPT backup: {gpt_backup_path}")
device_named = {"boot", "recovery", "aboot", "devinfo", "config", "splash", "lk2nd"}
backup_parts = [
"fsc", "fsg", "modemst1", "modemst2", "persist",
"boot", "recovery", "aboot", "devinfo", "config", "splash", "lk2nd",
]
if args.backup_modem:
backup_parts.append("modem")
for pname in backup_parts:
part = find_partition(guid_gpt.partentries, pname)
if not part:
print(f"[!] Warning: Partition '{pname}' not found in GPT; skipping backup.")
continue
dest_name = f"{pname}-{device}.img" if pname in device_named else f"{pname}.img"
dest_file = os.path.join(backup_dir, dest_name)
if (
not args.force_backup
and os.path.exists(dest_file)
and os.stat(dest_file).st_size > 0
):
print(f"[*] Backup already exists for '{pname}' ({dest_file}); skipping.")
continue
if not dump_partition(fh, args.lun, part, dest_file):
sys.exit(1)
print("\n============================================================")
print(" STOCK PARTITION BACKUP COMPLETE")
print("============================================================")
print(f" Saved backups to: {backup_dir}")
print(" No eMMC partitions were modified.")
print("============================================================")
if not args.no_reset:
fh.cmd_reset()
return 0
if args.only_unlock:
ok = True
if unlock_bootloader:
@@ -1057,7 +1126,7 @@ def main():
for name, part in target_parts:
source = source_for(name)
if method == "lk2nd" and source != mainline_img and (
source == bootloader_img or source == beatles_lk2nd_img):
source == bootloader_img or source == device_lk2nd_img):
print("\n[*] Step 1/3: Flashing lk2nd secondary bootloader to '%s'..." % name)
else:
print("\n[*] Step 1/3: Flashing Bananarchy boot.img to '%s'..." % name)