From 9ed7bc9c1f3292d755058810cfc5d73ecaaba624 Mon Sep 17 00:00:00 2001 From: Emil Kosz Date: Sat, 5 Sep 2026 17:49:07 +0200 Subject: [PATCH] general: document f2fs cleanup; NO_SYNC non-default --- AGENTS.md | 10 ++++++++-- README.md | 37 ++++++++++++++++++++++--------------- build_twrp.sh | 2 +- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0dc7b82..c0a3f8e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,7 +13,7 @@ Three repos cooperate: | `rubenslte/android_kernel_samsung_rubenslte` | Samsung msm8226 stock kernel, built from source | This drive builds from **source**: kernel, dt.img and ramdisk are all produced, -never prebuilt. The artifact is `recovery.img` (currently 10,407,952 bytes, +never prebuilt. The artifact is `recovery.img` (currently 10,366,992 bytes, TWRP 3.7.0_9-0) and has passed on-device tests on real hardware. ## Commands @@ -56,7 +56,9 @@ Verification without nix (cheap): `bash -n build_twrp.sh`. the image under the 10,485,248-byte partition. Changing compression or adding `twres/`/`system/` files can overflow it — always re-check image size. - **F2FS is off.** The kernel has no F2FS driver. Never re-add - `TARGET_USERIMAGES_USE_F2FS`. + `TARGET_USERIMAGES_USE_F2FS`. `mkbootimg.mk` also deletes the f2fs tools from + the ramdisk (the format menu hides the option automatically when + `/sbin/mkfs.f2fs` is absent — see `gui/action.cpp:944` in the omni tree). - **dt.img is EUR-only** (`CONFIG_MACH_RUBENSLTE_OPEN`). Other hardware variants (T365Y/AUS, T365M/KOR) need their `CONFIG_MACH_RUBENSLTE_*` enabled + rebuild. @@ -70,6 +72,10 @@ Verification without nix (cheap): `bash -n build_twrp.sh`. has no Android root. Mount System in TWRP, or use the in-TWRP terminal. - `make: ... [/dt.img] Błąd 255` — the lazy-variable/`INSTALLED_KERNEL_TARGET` dependency is broken; restore it per the invariants above. +- f2fs tools reappear in the ramdisk — stale copies under + `out/target/product/rubenslte/root/sbin/` from a past f2fs-enabled build; the + core recovery rule `cp -R`s that directory without wiping. Delete the + binaries (and `recovery/root.ts`); `mkbootimg.mk` strips them anyway. - Multi-variant boot failures — dt.img lacks the device's DTB; rebuild with the right `CONFIG_MACH_RUBENSLTE_*`. diff --git a/README.md b/README.md index 643c53d..24e1801 100644 --- a/README.md +++ b/README.md @@ -48,26 +48,25 @@ much faster. The final artifact is `recovery.img` at the repo root. selects the right one for the hardware. 7. **Recovery ramdisk** — the stock minigzip ramdisk overflows the 10,485,248 byte partition, so `mkbootimg.mk` replaces the core ramdisk rules: drops - tzdata, keeps only `en.xml`/`pl.xml` languages, and compresses with LZMA - (`CONFIG_RD_LZMA=y` in the rubenslte kernel). + tzdata and the f2fs tools, keeps only `en.xml`/`pl.xml` languages, and + compresses with LZMA (`CONFIG_RD_LZMA=y` in the rubenslte kernel). -Image layout of the shipped `recovery.img`: +Image layout of the shipped `recovery.img` (verified component sizes; exact +offsets are 2048-byte aligned by the bootloader): ``` -offset size content -0 2,048 boot image header (base 0x0, pagesize 2048) -2,048 7,223,736 zImage (kernel) -7,225,744 1,608 padding -7,227,352 2,882,224 ramdisk, LZMA-compressed (gzip would overflow) -10,109,576 1,360 padding -10,110,936 296,960 dt.img (QCDT: two EUR dtbs, r02+r03) -10,407,896 56 SEANDROIDENFORCE trailer +boot image header (base 0x0, pagesize 2048) +zImage 7,223,736 kernel +ramdisk 2,841,269 LZMA-compressed (gzip would overflow) +dt.img 296,960 QCDT: two EUR dtbs, r02 + r03 +SEANDROIDENFORCE trailer +total 10,366,992 fits the 10,485,248 byte partition ``` Artifact facts: -- `recovery.img` — 10,407,952 bytes (fits the 10,485,248 byte partition) -- sha256 `add52ab4d7ccbedd24ad08a89fe075c3cf918646bf6e77c6d610bcabd86a6b5b` +- `recovery.img` — 10,366,992 bytes (fits the 10,485,248 byte partition) +- sha256 `cf8c711afeb5636f6b01ee253d0643d380f127e7e71e8c1d3a163a148ab97703` - TWRP **3.7.0_9-0**, Linux kernel 3.4.x from Samsung source, built for Android 5.1.1 (omni twrp-5.1) @@ -91,8 +90,12 @@ image dumped from the device; flash it back to restore the factory recovery. so dt.img carries only the two EUR DTBs (r02/r03). SM-T365Y (AUS) / SM-T365M / KOR units need the corresponding `CONFIG_MACH_RUBENSLTE_*` enabled and a rebuild, otherwise the device may not boot from this kernel. -- **`/data` is ext4.** The kernel has no F2FS driver, so do not format `Data` - as F2FS in TWRP. The `TARGET_USERIMAGES_USE_F2FS` flag is deliberately unset. +- **`/data` is ext4, no F2FS.** The kernel has no F2FS driver, so the f2fs + tools are excluded (`TARGET_USERIMAGES_USE_F2FS` unset in BoardConfig.mk, and + `mkbootimg.mk` deletes them from the ramdisk defensively — they can linger in + `out/.../root/sbin/` from older f2fs-enabled builds). TWRP's format menu only + offers F2FS when `/sbin/mkfs.f2fs` is present, so the option is hidden + automatically. Do not format `Data` as F2FS. - **`adb shell` needs `/system` mounted.** `adb` itself works in recovery, but the device-side shell is `/system/bin/sh`; until you check **Mount → System** in TWRP you'll see `CANNOT LINK EXECUTABLE DEPENDENCIES: library "libc.so" @@ -106,6 +109,10 @@ image dumped from the device; flash it back to restore the factory recovery. absolute base path. Don't "simplify" them to `:=`. - Image won't fit the partition — the ramdisk must stay LZMA and trimmed; re-check `mkbootimg.mk` if you add files under `twres/` or `system/`. +- `mkfs.f2fs` reappears in the ramdisk after a rebuild — stale copy in + `out/target/product/rubenslte/root/sbin/` (the core rule `cp -R`s the boot + root into the recovery root without wiping it first). Delete them and + `recovery/root.ts`; `mkbootimg.mk` strips them from the packed image anyway. - `nix-shell --run ...` produces no output — known limitation of the `exec android-env` shellHook; use `./build_twrp.sh` or `./build_twrp.sh env`. - Parallel `nix-shell` invocations can deadlock on the nix store — run builds diff --git a/build_twrp.sh b/build_twrp.sh index b342d90..cc56e70 100755 --- a/build_twrp.sh +++ b/build_twrp.sh @@ -101,7 +101,7 @@ do_build() { if [ ! -d .repo ]; then repo init --depth 1 -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH" fi - if [ -z "${NO_SYNC:-}" ]; then + if [ "$NO_SYNC" -eq 0 ]; then repo sync -c -j"$(nproc)" clone_or_update "device tree" "$DEVICE_TREE_URL" device/samsung/rubenslte clone_or_update "kernel" "$KERNEL_URL" kernel/samsung/rubenslte