From c3e21615adcbc5aa513f582057bbf42f73350f22 Mon Sep 17 00:00:00 2001 From: Emil Kosz Date: Wed, 9 Sep 2026 11:37:14 +0200 Subject: [PATCH] general: devibecode --- AGENTS.md | 374 ++++++++---------- README.md | 44 +-- build_los.sh | 144 ++++--- build_twrp.sh | 140 +++---- common.sh | 11 + lib/common.sh | 103 ----- local_manifests/rubenslte.xml | 56 +-- local_manifests/twrp.xml | 11 + patches/README.md | 10 +- ...device-millet-common-allow-rubenslte.patch | 12 - ...sdk-droiddoc-support-libs-classpath.patch} | 4 +- shell.nix | 73 ++-- 12 files changed, 398 insertions(+), 584 deletions(-) create mode 100644 common.sh delete mode 100644 lib/common.sh create mode 100644 local_manifests/twrp.xml delete mode 100644 patches/los/0001-device-millet-common-allow-rubenslte.patch rename patches/los/{0002-vendor-cmsdk-droiddoc-support-libs-classpath.patch => 0001-vendor-cmsdk-droiddoc-support-libs-classpath.patch} (84%) diff --git a/AGENTS.md b/AGENTS.md index 94d55f4..36e449d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,242 +1,200 @@ # AGENTS.md — builders_rubenslte -What this repo is: build drivers + documentation for producing **TWRP -recovery** (`recovery.img`) and a **LineageOS 14.1 ROM** for the Samsung Galaxy -Tab Active SM-T365 (codename `rubenslte`, Qualcomm MSM8926, Linux kernel 3.4). +Build drivers + docs for **TWRP recovery** (`recovery.img`) and a +**LineageOS 14.1 ROM** for the Samsung Tab Active SM-T365 (`rubenslte`, +Qualcomm MSM8926 / msm8226, Linux kernel 3.4). -## Layout / getting your bearings +## Layout ``` -build_twrp.sh TWRP driver -> recovery.img (omni twrp-5.1) -build_los.sh LOS driver -> boot.img / lineage zip (cm-14.1, Jack) -shell.nix nix-shell FHS env for both TWRP and LOS builds -lib/common.sh shared: env re-entry, patch apply, trailer, image check -patches/ - twrp/ omni 5.1 workspace fixes (applied by build_twrp.sh) - kernel/ kernel fixes, shared by BOTH builds - los/ cm-14.1 workspace fixes (applied by build_los.sh) -local_manifests/ rubenslte.xml -> device/vendor/kernel/@ gitea -important_files/ webview.apk restore point (do not delete) +build_twrp.sh TWRP -> recovery.img (omni twrp-5.1) +build_los.sh LOS -> boot.img / lineage_rubenslte-*.zip (cm-14.1, Jack) +common.sh shared: apply_patches (idempotent patch application) +shell.nix nix-shell FHS env for both builds (nixpkgs 22.11 pinned) +patches/{twrp,kernel,los} post-sync fixes; kernel/ is shared by both builds +local_manifests/ rubenslte.xml (LOS overlay) + twrp.xml (TWRP overlay) twrp-build/ los-build/ .ccache/ .jack-repository/ (gitignored workspaces) ``` -There used to be a separate `shell_los.nix`; it was merged into `shell.nix` -(the single FHS env now serves both builds). - ## Repos -gitea: `https://git.cfpi-fpsi.eu/rubenslte` (ssh `ssh://gitea@git.cfpi-fpsi.eu:1337/rubenslte`) +Everything rubenslte lives on gitea, fetched anonymously over https: +`https://git.cfpi-fpsi.eu/rubenslte`. -| Repo | Role | -|------|------| -| `twrp_device_samsung_rubenslte` | TWRP device tree, **self-contained** (no platform-tree imports): BoardConfig.mk, mkbootimg.mk, dtbtool, recovery.fstab | -| `android_kernel_samsung_rubenslte` | Samsung msm8226 stock kernel (Linux 3.4), built from source, shared by both builds | -| `android_device_samsung_rubenslte` | LineageOS 14.1 device tree (inherits millet-common/msm8226-common/qcom-common) | -| `android_vendor_samsung_rubenslte` | LOS vendor blobs / proprietary files | +- `twrp_device_samsung_rubenslte` — TWRP device tree, **self-contained** + (own BoardConfig.mk / mkbootimg.mk / dtbtool, no platform imports). +- `android_kernel_samsung_rubenslte` — stock msm8226 kernel, built from + source, shared by both builds. +- `android_device_samsung_rubenslte` — LOS device tree; inherits the shared + msm8226-common / qcom-common platform layers (cm-14.1). rubenslte is its own + device family, so the former millet-common family layer is gone and the + family bits are owned in-tree (`rootdir/`, `init/`, `liblights/`, + `libshims/`, `keylayout/`, `audio/`, `wifi/`). +- `android_vendor_samsung_rubenslte` — LOS proprietary blobs. -- TWRP build = shallow clones of `twrp_device_samsung_rubenslte` + the kernel. -- LOS build = `repo sync` of the cm-14.1 manifest + `local_manifests/rubenslte.xml`. +`android_device_samsung_msm8226-common` lives on gitea too (cm-14.1) — a mirror +of the maintainer fork that produced the matisse family (LineageOS org has no +cm-14.1 for it). The two qcom-common platform layers come straight from +LineageOS (`device/samsung/qcom-common`, `device/qcom/common`, both cm-14.1). ## Commands -```bash -# TWRP recovery -./build_twrp.sh # full build -> recovery.img at repo root -./build_twrp.sh --no-sync # iteration: skip repo sync / tree refresh / patches -./build_twrp.sh clean # remove twrp-build/ and recovery.img -./build_twrp.sh env # interactive shell inside the nix-shell FHS env +Both scripts are console-style with `getopts :hn`: -# LineageOS 14.1 -./build_los.sh # boot.img (kernel + dt.img + ramdisk), fast gate -./build_los.sh bacon # full build -> lineage_rubenslte-*.zip -./build_los.sh clean # mka clean -./build_los.sh env # interactive shell inside the build env -# RB_CMD= overrides the subcommand (used by relaunch helpers) +```bash +./build_twrp.sh -h # usage +./build_twrp.sh build # full build -> recovery.img at repo root +./build_twrp.sh -n build # skip repo sync / tree refresh / patches, rebuild +./build_twrp.sh clean # remove twrp-build/out and recovery.img +./build_twrp.sh prune # remove all of twrp-build and recovery.img + +./build_los.sh bootimage # build boot.img (kernel + dt.img + ramdisk, fast gate) +./build_los.sh bacon # full build -> lineage_rubenslte-*.zip +./build_los.sh -n bacon # skip repo sync / tree refresh / patches +./build_los.sh clean # mka clean +./build_los.sh prune # remove all of los-build ``` -Verification without nix (cheap): `bash -n lib/common.sh build_twrp.sh -build_los.sh`. For patch-level verification: -`patch -p1 --dry-run -d los-build < patches/los/0001-*.patch` etc. +`-n` is a proper skip-sync flag, not a separate command: run +`./build_los.sh -n bootimage` to iterate on an existing tree. + +Cheap checks without nix: `bash -n common.sh build_twrp.sh build_los.sh`. +Patch check: `patch -p1 --dry-run -d < patches//`. +Flashing / boot keys: README.md. ## How the builds work -1. **Environment** — everything runs inside a nix-shell FHS env: `shell.nix` - (combined: TWRP + LOS package set, incl. host gcc for kernel kconfig host - tools; the TWRP build just doesn't use the host gcc). `nix-shell --run` is - unreliable because the shellHook does `exec android-env`, so the scripts - re-enter via a stdin pipe (`reenter_build_env` in `lib/common.sh`). -2. **Sources** — TWRP: `repo init/sync` of the omni `twrp-5.1` manifest - (`platform_manifest_twrp_omni`, branch `twrp-5.1`) + shallow device-tree and - kernel clones from gitea, refreshed on each full build. LOS: cm-14.1 - manifest + `local_manifests/rubenslte.xml` for the gitea device/vendor/ - kernel and the shared millet/msm8226/qcom cm-14.1 trees. -3. **Patches** — `patches/{twrp,kernel,los}/*.patch` fix the old 5.1/14.1 - codebase for modern host tools (see `patches/README.md`). Applied - idempotently so `repo sync` wipes are harmless. -4. **Toolchain (TWRP)** — arm-eabi-4.8 (gcc 4.8, same as stock builds) is - downloaded from Android's googlesource and put on `PATH` - (`fetch_toolchain`). LOS uses the tree's own prebuilts. -5. **Compiler (LOS)** — Jack only, in-process (`JACK_SERVER=false - JACK_NO_SERVER=1`, jars seeded into `.jack-repository/`). The 14.1 javac - fallback is broken (dangling `with-local/classes.dex`) and the Jack server - path aborts ninja on this host (see "How to work here"). -6. **Kernel** — built from source via the omni/lineage kernel build rules. The - variant defconfig (`msm8926-sec_rubenslte_defconfig`) enables only - `CONFIG_MACH_RUBENSLTE_OPEN` (EUR); base + selinux configs come from the - millet kernel settings (LOS) or are inlined in BoardConfig (TWRP). -7. **dt.img** — `dtbToolLineage` packs the compiled `.dtb` files; the - bootloader selects the right DTB per hardware. -8. **Recovery ramdisk** — the stock minigzip ramdisk overflows the 10,485,248 - byte partition, so `mkbootimg.mk` replaces the core recovery rules: drops - tzdata and the f2fs tools and compresses with LZMA - (`CONFIG_RD_LZMA=y` in the rubenslte kernel). All 19 common TWRP language - packs ship as-is. +- **Env**: everything runs inside the nix-shell FHS env (`shell.nix`). Run + `nix-shell` first, then invoke the scripts — they do **not** self-re-enter + the env anymore. Don't rely on `nix-shell --run` (the shellHook does + `exec android-env`); don't run two nix-shells at once (nix store deadlock). +- **TWRP sources**: `repo init` of omni `twrp-5.1` + (`platform_manifest_twrp_omni`) + `local_manifests/twrp.xml` copied into + `.repo/local_manifests/` before `repo sync -c -j$(nproc)`, then + `apply_patches patches/twrp` and `apply_patches patches/kernel`. +- **LOS sources**: `repo init` of cm-14.1 (`LineageOS/android`) + + `local_manifests/rubenslte.xml` copied in before `repo sync -c -j$(nproc)`, + then `apply_patches patches/kernel` and `apply_patches patches/los`. + Sync wipes in-tree edits; `apply_patches` is idempotent so re-applying each + full build is harmless. +- **Patches**: `common.sh::apply_patches` dry-runs each patch with `LC_ALL=C` + first. An already-applied patch makes GNU patch (2.8, from the nix env) + report `Reversed (or previously applied) patch detected` on the forward dry + run — that output, not the exit code, is what skips it. Warnings print the + patch log but don't abort the build. +- **Toolchain (TWRP)**: arm-eabi-4.8 (gcc 4.8, matches stock) is checked out + by `repo sync` — the omni twrp-5.1 manifest already declares + `prebuilts/gcc/linux-x86/arm/arm-eabi-4.8` at the default revision + `refs/tags/android-5.1.1_r28` (aosp remote). It lands at + `prebuilts/gcc/linux-x86/arm/arm-eabi-4.8` and is put on `PATH`; a `-n` run + errors out if it's missing (run a full build to fetch it). LOS uses the + tree's own prebuilts. +- **Compiler (LOS)**: Jack only, in-process (`JACK_SERVER=false + JACK_NO_SERVER=1`); the jack/jill jars are seeded into `.jack-repository/` + from `prebuilts/sdk/tools/jacks/` with `cp -n`. +- **Kernel**: built from source via the omni/lineage kernel build rules. The + variant defconfig (`msm8926-sec_rubenslte_defconfig`) enables only + `CONFIG_MACH_RUBENSLTE_OPEN` (EUR); dtbTool packs dt.img for the bootloader. +- **Recovery ramdisk**: the stock minigzip ramdisk overflows the 10,485,248 B + partition, so `mkbootimg.mk` drops tzdata + f2fs tools and compresses with + **LZMA**. Result: 10,479,632 B, 19-language TWRP. +- **SEANDROIDENFORCE**: `build_los.sh` appends the trailer to the LOS boot.img + (`append_seandroidenforce`) — required by Samsung bootloaders. -Final artifacts at the repo root: `recovery.img` (TWRP, currently 10,479,632 -bytes) and, after bacon, +Artifacts: `recovery.img` (repo root; `build_twrp.sh` checks it against +`RECOVERY_BUDGET=10485248` and errors if it exceeds the partition) and `los-build/out/target/product/rubenslte/lineage_rubenslte-*.zip`. -## Image layout (shipped `recovery.img`) +## Invariants — do not "simplify" -``` -boot image header (base 0x0, pagesize 2048) -zImage kernel -ramdisk LZMA-compressed, 19-language TWRP 3.7.0_9-0 -dt.img QCDT: two EUR dtbs, r02 + r03 -SEANDROIDENFORCE trailer -total 10,479,632 fits the 10,485,248 byte partition -``` +- `BoardConfig.mk`: `INSTALLED_DTIMAGE_TARGET` + `BOARD_MKBOOTIMG_ARGS` stay + *recursive* (`=`, expanded after `PRODUCT_OUT`/`KERNEL_OUT` exist) — never `:=`. +- `mkbootimg.mk`: the dt.img rule depends on `INSTALLED_KERNEL_TARGET`; the + ramdisk must stay LZMA + trimmed or the image overflows the partition. +- **F2FS is off** (no kernel driver): never re-add + `TARGET_USERIMAGES_USE_F2FS`. The LOS `rootdir/etc/fstab.qcom` is EXT4-only + and TWRP's mkbootimg strips f2fs tools from the ramdisk. +- dt.img is **EUR-only** (`CONFIG_MACH_RUBENSLTE_OPEN`); other variants + (T365Y/T365M) need their `CONFIG_MACH_RUBENSLTE_*` enabled. +- **SEANDROIDENFORCE** trailer + `--dt` are required for Samsung bootloaders + (`append_seandroidenforce` appends it to LOS boot.img). +- LOS is Jack-only and the ROM is **bare** (no GApps, `/data` ext4). +- Kernel fixes go in `patches/kernel/` and must apply in **both** `twrp-build/` + and `los-build/`. -`build_twrp.sh` prints the image size and sha256 at the end (`verify_image` in -`lib/common.sh`). +## Gotchas -## Flashing / testing +- **The env deliberately has no 64-bit host gcc**: PATH `gcc` is the genuine + 32-bit `pkgsi686Linux.gcc9` from `multiPkgs`, because omni/TWRP host tools + are compiled as obj32 (`-m32`) and only work against a real 32-bit compiler. + Adding `gcc` to `targetPkgs` regresses the TWRP build with the classic + `gnu/stubs-32.h: No such file or directory` (x86_64 nixpkgs gcc has no + 32-bit multilib headers). +- **repo launcher warning**: the nix-provided `gitRepo` launcher is read-only + and warns that it can't auto-update to a newer repo version — harmless. +- Don't switch LOS off Jack or re-enable the Jack server (host TLS breaks the + server path and aborts the build). +- **LOS family bits in the device tree are ported Samsung msm8926-tablet + baselines, not device-extracted data**: `audio/mixer_paths.xml`, + `wifi/WCNSS_*`, `keylayout/*`, and the bootloader-match table in + `init/init_rubenslte.cpp` come from the matisse/millet cm-14.1 trees. + They build and boot (per the platform), but re-verify against stock + rubenslte `/system/etc` before trusting camera/audio/wifi calibration; only + `rootdir/etc/fstab.qcom` is rubens-extracted (partition map from stock + recovery.fstab). +- `repo sync` wipes in-tree edits — expected. Prefer editing the **device + repos**, not patching; patches are only for upstream 5.1/14.1 sources that + can't live in the device tree. +- Commit style: short lowercase-imperative subject, no body. Stage with + `git add -A` (images and workspaces are gitignored). -- Download mode: **Volume Down + Home + Power**, confirm with **Volume Up**. - - Odin 3.x: flash `recovery.img` in the **AP** slot. - - Heimdall: `heimdall flash --RECOVERY recovery.img --no-reboot`. -- Boot TWRP: **Volume Up + Home + Power**. -- **KNOX**: flashing a recovery sets the KNOX warranty bit — irreversible. -- `recovery-stock.img` (git-ignored, repo root) is the stock recovery dump; - flash it back to restore factory recovery. -- The ROM zip is flashed from TWRP (it does not touch the bootloader), - optionally followed by `lineage-*-kernel`, or extract `boot.img` (with the - SEANDROIDENFORCE trailer) from the zip. The ROM is bare — no GApps — and - `/data` is ext4 (F2FS off). +## Why local_manifests -## WebView provider +`repo` auto-imports every `.xml` in `.repo/local_manifests/` on top of the +primary manifest, so both builds get their rubenslte bits without forking the +whole manifest. (`repo` reads the copy the build script drops into +`twrp-build/` / `los-build/.repo/local_manifests/` — edit the source files, +a full non-`-n` build re-copies them.) -`important_files/` holds a safely-stripped `webview.apk` restore point — **do -not delete**. The device's WebView (`com.android.webview`) lives at -`/system/app/webview/webview.apk` in the vendor tree; wiping or replacing it -can leave the system with a broken WebView. +- **`twrp.xml`** (TWRP): gitea `twrp_device_samsung_rubenslte` + + `android_kernel_samsung_rubenslte` (both `main`). The omni twrp-5.1 manifest + has no rubenslte entries, hence the overlay; the arm-eabi-4.8 toolchain is + already in the primary manifest (default `r28`), so no override is needed. +- **`rubenslte.xml`** (LOS): the cm-14.1 manifest is LineageOS's shared + project list — no rubenslte entries, no gitea remote, and it pins + chromium-webview prebuilts that fail to clone from GitHub (repos packed over + GitHub's object limits). The overlay adds: + - gitea device/vendor/kernel (`main`) + - `device/samsung/msm8226-common` (gitea, `cm-14.1`) + the two qcom-common + layers (LineageOS, `cm-14.1`) + - ``s the four broken `chromium-webview_prebuilt_*` repos and + adds the intact AOSP copy instead: `external/chromium-webview` + (`platform/external/chromium-webview` on `nougat-mr1.2-release`, via the + primary manifest's `aosp` remote). -## How to work here +## Troubleshooting (most likely first) -- Builds only run inside the nix-shell FHS environment (`shell.nix`). The - scripts re-enter via a stdin pipe (`reenter_build_env`); **do not rely on - `nix-shell --run`** (the `exec android-env` shellHook swallows it) and do - not run two nix-shells at once (nix store lock deadlock). -- A full build is slow (repo sync downloads GBs; kernel + recovery / bacon - compile takes a while). Iterate with `./build_twrp.sh --no-sync` against the - existing `twrp-build/` tree; `./build_los.sh bootimage` gates the kernel fast. -- **Gotcha:** `--no-sync` passed on the *outer* invocation is silently dropped - on nix-shell re-entry (`reenter_build_env` does not forward args) — pass it - from inside `./build_twrp.sh env`, or just run a full build. -- Prefer editing the *device tree repos* (BoardConfig.mk / mkbootimg.mk / - device tree mk) over patching trees post-sync. Only use `patches/` for fixes - to upstream 5.1/14.1 sources that cannot live in the device tree. Kernel - fixes go in `patches/kernel/` (shared by both builds); tree-specific fixes in - `patches/twrp/` or `patches/los/`. Add a row to `patches/README.md`. -- `repo sync` and `clone_or_update` wipe in-tree edits — patches are re-applied - idempotently each full build; on `--no-sync` iters only the `twrp-build/` - tree state matters. -- LOS builds use **Jack only** and in-process (`JACK_SERVER=false - JACK_NO_SERVER=1` with jars seeded into `.jack-repository/`). Do not try to - switch to the javac fallback — it is broken on cm-14.1 (dangling - `with-local/classes.dex`, inspect `build/core/java.mk`), - and do not re-enable the Jack server — the host curl/OpenSSL cannot TLS- - handshake with the Java 8 jack server, and the mandatory server ninja edge - aborts the whole build. -- Console log noise: the old `warning: command substitution: ignored null byte` - should not appear anymore (trailer is appended via a pipeline, see - `append_seandroidenforce`). If it returns, the trailer check was changed. -- Commit style in this repo: short lowercase-imperative subject, no body - (`Refactor build_twrp.sh and document the recovery build`). Stage with - `git add -A`; `recovery.img`/`recovery-stock.img` and the workspaces are - intentionally untracked (gitignored). +- `repo sync` fails `remote already exists with different + attributes` — a local-manifest `` redeclares a remote the primary + manifest already defines with different attributes (only `aosp` shares the + primary's remote name; as long as no local `` is added + it resolves from `default.xml`). The primary `aosp` remote has absolute + fetch, unlike `github` (`fetch=".."`), which is why that one gets a local + `los` remote alias instead. +- adb `CANNOT LINK ... libc.so` — `/system` isn't mounted in recovery; normal. + Mount System in TWRP. +- `make: ... [/dt.img] Błąd 255` — the recursive-variable / + `INSTALLED_KERNEL_TARGET` invariant broke; restore per above. +- Recovery image won't fit — ramdisk isn't LZMA/trimmed; check `mkbootimg.mk`. +- f2fs tools reappear in the ramdisk — stale + `out/target/product/rubenslte/root/sbin/` from a past build; delete + `root.ts`. +- Jack jar "not readable" — re-seed `.jack-repository/` from + `los-build/prebuilts/sdk/tools/jacks/` (`cp -n jack-*.jar jill-*.jar`). +- Bacon JVM SIGSEGV in libconscrypt — host OpenSSL ABI in the FHS env; known, + unrelated to the scripts. -## Invariants — do not "simplify" these +Device: SM-T365, MSM8926, Adreno 305, 1.5 GB/16 GB, recovery partition +10,485,248 B; similar devices: milletlte, matisselte, motorola_thea. -TWRP: - -- **`BoardConfig.mk`**: `INSTALLED_DTIMAGE_TARGET` and `BOARD_MKBOOTIMG_ARGS` - must stay *recursive* (`=`, never `:=`). They are expanded after - `PRODUCT_OUT`/`KERNEL_OUT` exist; see the `mkbootimg.mk` header comment for - the include-order reasoning. -- **`mkbootimg.mk`**: the dt.img rule depends on `INSTALLED_KERNEL_TARGET` - (not `TARGET_PREBUILT_INT_KERNEL`), and the recovery-ramdisk override - (drop tzdata + f2fs tools, **LZMA** compression) is what keeps the image - under the 10,485,248-byte partition. All 19 common TWRP language packs are - shipped as-is (10,479,632 packed). 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`. `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. -- **SEANDROIDENFORCE** trailer and `--dt` are required on boot/recovery images - for Samsung bootloaders; the stock core rules don't add them - (`append_seandroidenforce` in `lib/common.sh` appends it to LOS boot.img). - -LOS: - -- **Jack is the only compile path** for the dex phases (see above). -- **Kernel patches are shared**: anything touching `android_kernel_samsung_*` - goes in `patches/kernel/` and must apply in *both* `twrp-build/` and - `los-build/` workspaces. Verify with `patch -p1 --dry-run` in each. -- **The ROM is bare** — no GApps, `/data` ext4. Don't add GApps packaging. - -## Troubleshooting the image - -- `adb shell` fails with `CANNOT LINK EXECUTABLE DEPENDENCIES: library - "libc.so" not found` — normal: `/system` is not mounted in recovery; the ramdisk - 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. -- Image won't fit the partition (TWRP) — the ramdisk must stay LZMA and - trimmed; re-check `mkbootimg.mk` if you add files under `twres/` or - `system/`. -- 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_*`. -- Jack "not readable" jar error — re-seed `.jack-repository/` from - `los-build/prebuilts/sdk/tools/jacks/` (and jills) — see `seed_jack_repository`. -- `curl` TLS error against the Jack admin socket (`SSL routines::unexpected - eof` on 0.0.0.0:8077) — expected; Jack runs in-process, the server path is - disabled on purpose. -- `nix-shell --run ...` produces no output — known limitation of the - `exec android-env` shellHook; use the wrapper scripts or `... env`. -- Parallel `nix-shell` invocations can deadlock on the nix store — run builds - sequentially. -- Bacon JVM SIGSEGV in `host/linux-x86/lib64/libconscrypt_openjdk_jni.so` - (`OpenSSLX509Certificate.fromX509PemInputStream`) — host OpenSSL ABI - mismatch in the FHS env; known non-trivial, unrelated to the scripts here. - -## Device information - -| | | -|---|---| -| Model | SM-T365 (Galaxy Tab Active), codename `rubenslte` | -| SoC | Qualcomm MSM8926 (board platform `msm8226`), quad Cortex-A7 1.2 GHz, Adreno 305 | -| RAM / Storage | 1.5 GB / 16 GB | -| Recovery partition | 10,485,248 bytes | -| Similar devices | milletlte, matisselte, motorola_thea | - -For the full background: `patches/README.md`, -`twrp_device_samsung_rubenslte/README.md`, `local_manifests/rubenslte.xml`. +For depth: `patches/README.md`, `twrp_device_samsung_rubenslte/README.md`, +`local_manifests/rubenslte.xml`. \ No newline at end of file diff --git a/README.md b/README.md index 72f03c1..006c5f6 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,29 @@ # builders\_rubenslte -Build drivers for **TWRP recovery** and **LineageOS 14.1** for the Samsung -Galaxy Tab Active SM-T365 (codename `rubenslte`, Qualcomm MSM8926). +Build scripts and patches for TWRP and LineageOS 14.1 for the Samsung +Galaxy Tab Active SM-T365 (`rubenslte`). ## Quick start -Requirements: a NixOS system (or Nix) with network access and `nix` in your -user's `allowed-users` / `trusted-users`. - -``` -# TWRP recovery -./build_twrp.sh # full build -> recovery.img -./build_twrp.sh --no-sync # rebuild without re-syncing/re-patching -./build_twrp.sh clean # delete twrp-build/ and recovery.img -./build_twrp.sh env # interactive shell inside the build env - -# LineageOS 14.1 -./build_los.sh # boot.img: kernel + dt.img + ramdisk (fast gate) -./build_los.sh bacon # full build -> lineage_rubenslte-*.zip -./build_los.sh clean # mka clean -./build_los.sh env # interactive shell inside the build env -``` - -`RB_CMD=` overrides the LOS subcommand (used by relaunch helpers). +Requirements: either a NixOS system (or Nix), or a set up on some +other distro with all required packages. First (if on Nix), run +`nix-shell`. Then, there are two main scripts: `./build_twrp.sh` and +`./build_los.sh`. Run each one with `-h` to figure out how to use +them. ## Flashing -Download mode: **Volume Down + Home + Power**, confirm with **Volume Up**. Flash -`recovery.img` in the **AP** slot (Odin) or via -`heimdall flash --RECOVERY recovery.img --no-reboot`. Boot into TWRP with -**Volume Up + Home + Power**. **Note:** flashing sets the irreversible KNOX -warranty bit. Details in [AGENTS.md](AGENTS.md). +| Mode | Key combo | +|----------|---------------------| +| Recovery | Vol+ & Home & Power | +| Download | Vol- & Home & Power | + +First, flash TWRP using either Odin (Windows) or Heimdall. For the +latter, use `heimdall flash --RECOVERY recovery.img --no-reboot` while +in download mode. + +Then, you can boot into TWRP using the recovery key combination, +factory reset, then flash the ROM zip. ## Device information @@ -64,7 +57,6 @@ warranty bit. Details in [AGENTS.md](AGENTS.md). - https://git.cfpi-fpsi.eu/rubenslte/twrp_device_samsung_rubenslte ### Similar device trees - - https://github.com/matteo0026/android_device_samsung_msm8226-common - https://github.com/matteo0026/android_device_samsung_matisse-common - https://github.com/matteo0026/twrp_device_samsung_milletlte diff --git a/build_los.sh b/build_los.sh index 0360167..f92f2a0 100755 --- a/build_los.sh +++ b/build_los.sh @@ -1,80 +1,96 @@ #!/usr/bin/env bash -# Build LineageOS 14.1 for the Samsung Galaxy Tab Active SM-T365 (rubenslte, -# msm8226) inside the nix-shell FHS environment (shell.nix). -# -# The LOS 14.1 source tree is a cm-14.1 repo manifest with local manifests -# (device/vendor/kernel from git.cfpi-fpsi.eu, millet forks for shared trees); -# see los-build/.repo/local_manifests/rubenslte.xml and README.md. -# -# Usage: -# ./build_los.sh build boot.img (kernel + dt.img + ramdisk, fast gate) -# ./build_los.sh bacon full build -> lineage_rubenslte-*.zip -# ./build_los.sh clean mka clean (no jack --config clean: no server) -# ./build_los.sh env interactive shell inside the build env -# -# Also honors RB_CMD= as an override (used by relaunch helpers). set -euo pipefail -SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "$SCRIPT" +readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$ROOT" +source common.sh -source lib/common.sh +readonly MANIFEST_URL="https://github.com/LineageOS/android.git" +readonly MANIFEST_BRANCH="cm-14.1" +readonly MANIFEST_LOCAL="local_manifests/rubenslte.xml" -CMD="${RB_CMD:-${1:-bootimage}}" -[ $# -gt 1 ] && echo "warning: ignoring extra args: $*" +usage() { + cat < lineage_rubenslte-*.zip + clean mka clean + prune remove all of los-build +EOF +} -# ccache (prebuilt from the tree) to speed up rebuild cycles. -export USE_CCACHE=1 -export CCACHE_DIR="$SCRIPT/.ccache" +append_seandroidenforce() { + local img="$1" + + [ -f "$img" ] || return + [ tail -c 16 "$img" | grep -q "SEANDROIDNEFORCE" ] || \ + printf 'SEANDROIDENFORCE' >> "$img" +} -# Jack compile, as the LOS 14.1 javac fallback leaves dangling with-local -# intermediates (build/core/java.mk) and cannot build bacon. -# The jack-admin TLS is broken here (curl TLS1.3 vs Java 8 server), so -# JACK_SERVER=false disables jack_server_setup.mk's mandatory server-start -# ninja edge (its "update jack ... || exit 47" aborts ninja), and -# JACK_NO_SERVER=1 runs Jack in-process for the actual compile. -export JACK_SERVER=false -export JACK_NO_SERVER=1 -export JACK_REPOSITORY="$SCRIPT/.jack-repository" -seed_jack_repository "$JACK_REPOSITORY" "$SCRIPT/los-build/prebuilts/sdk/tools/jacks" +do_build() { + mkdir -p los-build + cd los-build -cd "$SCRIPT/los-build" + echo "[$0] Setting up or syncing repositories" + + if [ ! -d .repo ]; then + repo init --depth 1 -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH" + fi -# Re-apply any source-tree patches lost on repo sync (idempotent). -apply_patches patches/kernel -apply_patches patches/los + if [ ! -v "NO_SYNC" ]; then + mkdir -p .repo/local_manifests + cp "$ROOT/$MANIFEST_LOCAL" .repo/local_manifests/ + repo sync -c -j"$(nproc)" + apply_patches "$ROOT/patches/kernel" + apply_patches "$ROOT/patches/los" + fi -export TOP="$PWD" -export ANDROID_BUILD_TOP="$TOP" + export LC_ALL=C LANG=C USE_CCACHE=1 CCACHE_DIR="$ROOT/.ccache" \ + JACK_SERVER=false JACK_NO_SERVER=1 \ + JACK_REPOSITORY="$ROOT/.jack-repository" TOP="$PWD" \ + ANDROID_BUILD_TOP="$TOP" + + mkdir -p "$ROOT/.jack-repository" + cp -n "$PWD/prebuilts/sdk/tools/jacks/jack-*.jar" "$ROOT/.jack-repository" + cp -n "$PWD/prebuilts/sdk/tools/jacks/jill-*.jar" "$ROOT/.jack-repository" -set +eu -source build/envsetup.sh >/dev/null 2>&1 -lunch lineage_rubenslte-userdebug >/dev/null 2>&1 -set -e + set +eu + source build/envsetup.sh + lunch lineage_rubenslte-userdebug + set -e -if [ -z "${TARGET_PRODUCT:-}" ]; then - echo "[!] lunch failed - TARGET_PRODUCT not set" - exit 1 -fi + if [ -z "${TARGET_PRODUCT:-}" ]; then + echo "[$0] ERROR: lunch failed - TARGET_PRODUCT not set" + exit 1 + fi -case "$CMD" in - clean) mka clean ;; - env) exec bash ;; - *) mka "$CMD" ;; + echo "[$0] Commencing build (command: $CMD)" + mka "$CMD" + + if [ "$CMD" != "clean" ]; then + echo "[$0] Appending SEANDROIDENFORCE" + append_seandroidenforce "$ROOT/los-build/out/target/product/rubenslte/boot.img" + fi +} + +while getopts ":hn" opt; do + case "$opt" in + h) usage; exit 0 ;; + n) NO_SYNC=1 ;; + *) usage; exit 1 ;; + esac +done + +shift $((OPTIND - 1)) + +case "${1:-}" in + bootimage|bacon|clean) CMD="${1:-}"; do_build ;; + prune) rm -rf los-build ;; + *) usage; exit 1 ;; esac -RC=$? - -# Samsung bootloaders require the SEANDROIDENFORCE trailer on boot images. -BOOT_IMG="$SCRIPT/los-build/out/target/product/rubenslte/boot.img" -if [ "$RC" -eq 0 ] && [ "$CMD" != "clean" ]; then - append_seandroidenforce "$BOOT_IMG" -fi - -exit "$RC" \ No newline at end of file diff --git a/build_twrp.sh b/build_twrp.sh index e115dde..1639d6f 100755 --- a/build_twrp.sh +++ b/build_twrp.sh @@ -1,116 +1,88 @@ #!/usr/bin/env bash -# Build a TWRP recovery image for the Samsung Galaxy Tab Active SM-T365 -# (codename rubenslte, msm8226) inside the nix-shell FHS environment (shell.nix). -# -# Usage: -# ./build_twrp.sh build recovery.img (default) -# ./build_twrp.sh --no-sync skip repo sync / tree updates (fast iteration) -# ./build_twrp.sh clean remove twrp-build/ and recovery.img -# ./build_twrp.sh env drop into the interactive nix-shell build env -# -# `nix-shell --run` cannot be relied on here, so when invoked from the host the -# script re-executes itself *inside* the env via a stdin pipe. set -euo pipefail -SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "$SCRIPT" +readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$ROOT" +source common.sh -source lib/common.sh +readonly MANIFEST_URL="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git" +readonly MANIFEST_BRANCH="twrp-5.1" +readonly MANIFEST_LOCAL="local_manifests/twrp.xml" -RECOVERY_PARTITION_SIZE=10485248 - -MANIFEST_URL="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git" -MANIFEST_BRANCH="twrp-5.1" -DEVICE_TREE_URL="https://git.cfpi-fpsi.eu/rubenslte/twrp_device_samsung_rubenslte" -KERNEL_URL="https://git.cfpi-fpsi.eu/rubenslte/android_kernel_samsung_rubenslte" -TOOLCHAIN_URL="https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/+archive/refs/tags/android-5.1.1_r38.tar.gz" -TOOLCHAIN_DIR="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" +readonly RECOVERY_BUDGET=10485248 usage() { - usage_from_header -} + cat </dev/null || true ;; - env) shift 2>/dev/null || true ;; - build) shift 2>/dev/null || true ;; - --*) cmd=build ;; - *) usage >&2; exit 2 ;; -esac - -NO_SYNC=0 -for a in "$@"; do - case "$a" in - --no-sync) NO_SYNC=1 ;; - *) usage >&2; exit 2 ;; +while getopts ":hn" opt; do + case "$opt" in + h) usage; exit 0 ;; + n) NO_SYNC=1 ;; + *) usage; exit 1 ;; esac done -case "$cmd" in - build) reenter_build_env "$SCRIPT/shell.nix" RUBENSLTE_BUILD_IN_ENV; do_build ;; - clean) do_clean ;; - env) do_env ;; -esac \ No newline at end of file +shift $((OPTIND - 1)) + +case "${1:-}" in + build) do_build ;; + clean) rm -rf twrp-build/out recovery.img ;; + prune) rm -rf twrp-build recovery.img ;; + *) usage; exit 1 ;; +esac diff --git a/common.sh b/common.sh new file mode 100644 index 0000000..1d9c6ec --- /dev/null +++ b/common.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +apply_patches() { + local dir="$1" + for p in "$dir"/*.patch; do + [ -e "$p" ] || continue + patch -p1 --forward --batch --dry-run >/dev/null || continue + patch -p1 --batch < "$p" + done +} + diff --git a/lib/common.sh b/lib/common.sh deleted file mode 100644 index bd665ad..0000000 --- a/lib/common.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env bash -# Shared helpers for the builders_rubenslte build scripts. -# Source after setting `SCRIPT` to the repo root and `set -euo pipefail`. -# Every function is idempotent so iteration (`--no-sync`, re-runs) is safe. - -# Print the script's usage() from its header comments (lines 2-9). -usage_from_header() { - sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//' -} - -# Re-execute the current script inside the nix-shell FHS build environment. -# `env_file` - nix expression (absolute path, e.g. "$SCRIPT/shell.nix") -# `in_env_var` - name of the env var that marks "already inside" (prevents recursion) -# `pre_exec` - optional shell snippet (e.g. export RB_CMD=...) echoed before re-entry -# -# `nix-shell --run` cannot be used here: shell.nix's shellHook `exec`s into the -# FHS env and swallows any `--run` argument, so we feed the command via stdin. -reenter_build_env() { - local env_file="$1" in_env_var="$2" pre_exec="${3:-}" - if [ -z "${!in_env_var:-}" ]; then - echo "[*] Re-entering build inside the nix-shell FHS env: $(basename "$env_file") ..." - local script_path - case "$0" in - /*) script_path="$0" ;; - *) script_path="$SCRIPT/$(basename "$0")" ;; - esac - { - printf 'export %s=1\n' "$in_env_var" - [ -n "$pre_exec" ] && printf '%s\n' "$pre_exec" - printf 'bash "%s"\n' "$script_path" - } | nix-shell "$env_file" - exit $? - fi - echo "[*] Already inside the nix-shell FHS env." -} - -# Apply every *.patch under `dir_pattern` (repo-root-relative, e.g. -# "patches/twrp") from the current working directory (the tree root), using -# `patch -p1`. Checked reverse-first so re-running is a true no-op: GNU patch -# can otherwise *re-apply* an already-applied hunk (duplicating it) and still -# exit 0. Never run the real forward apply when the change is already present. -apply_patches() { - local dir_pattern="$1" p log - for p in "$SCRIPT"/"$dir_pattern"/*.patch; do - [ -e "$p" ] || continue - if patch -p1 -s -R --dry-run < "$p" >/dev/null 2>&1; then - echo "[*] Already applied: $dir_pattern/$(basename "$p")" - elif patch -p1 -s --dry-run < "$p" >/dev/null 2>&1; then - patch -p1 -s < "$p" - echo "[*] Applied $dir_pattern patch: $(basename "$p")" - else - log="$(mktemp)" - patch -p1 -s < "$p" >"$log" 2>&1 || true - echo "[!] WARNING: patch failed: $dir_pattern/$(basename "$p")" - cat "$log" - rm -f "$log" - fi - done -} - -# Samsung bootloaders require the SEANDROIDENFORCE trailer on boot/recovery -# images. Appends it if missing. Never uses command substitution on the image -# (avoids bash "ignored null byte" warnings) - a pipeline test is enough. -append_seandroidenforce() { - local img="$1" - [ -f "$img" ] || return 0 - if tail -c 16 "$img" | grep -q 'SEANDROIDENFORCE'; then - echo "[*] $img already has the SEANDROIDENFORCE trailer" - else - echo "[*] Appending SEANDROIDENFORCE trailer to $img" - printf 'SEANDROIDENFORCE' >> "$img" - fi -} - -# Check an image exists, report size vs the partition budget (if given) and -# fail loudly on overflow (TWRP omni overflows the recovery partition easily). -verify_image() { - local img="$1" budget="${2:-}" - [ -f "$img" ] || { echo "ERROR: $img was not produced" >&2; exit 1; } - local size - size="$(stat -c%s "$img")" - if [ -n "$budget" ]; then - echo "[*] $img: $size bytes (partition budget: $budget)" - if [ "$size" -gt "$budget" ]; then - echo "ERROR: $img exceeds the partition budget" >&2 - exit 1 - fi - else - echo "[*] $img: $size bytes" - fi - sha256sum "$img" - echo "Done: $img" -} - -# Populate JACK_REPOSITORY if empty. In-process Jack (JACK_NO_SERVER=1) only -# runs when the repository holds the jack/jill jars; a repo sync replaces the -# prebuilts so we (re)seed it with -n (never overwrite a valid copy). -seed_jack_repository() { - local repo="$1" src="$2" - mkdir -p "$repo" - cp -n "$src"/jack-*.jar "$repo/" 2>/dev/null || true - cp -n "$src"/jill-*.jar "$repo/" 2>/dev/null || true -} \ No newline at end of file diff --git a/local_manifests/rubenslte.xml b/local_manifests/rubenslte.xml index 20cace1..9afaeac 100644 --- a/local_manifests/rubenslte.xml +++ b/local_manifests/rubenslte.xml @@ -1,50 +1,32 @@ - - + + - - - - - - - - + + + - + - - - - - - - + + + diff --git a/local_manifests/twrp.xml b/local_manifests/twrp.xml new file mode 100644 index 0000000..703701c --- /dev/null +++ b/local_manifests/twrp.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/patches/README.md b/patches/README.md index 2bffcd4..a7c59cf 100644 --- a/patches/README.md +++ b/patches/README.md @@ -44,9 +44,11 @@ script. Shared by both builds. | Patch | File(s) | Problem fixed | |-------|---------|---------------| -| `0001-device-millet-common-allow-rubenslte.patch` | `device/samsung/millet-common/Android.mk` | include the sub-makefiles for rubenslte (the millet-common shared tree only guards `milletwifi millet3g milletlte`) | -| `0002-vendor-cmsdk-droiddoc-support-libs-classpath.patch` | `vendor/cmsdk/Android.mk` | droiddoc crash `java.lang.NullPointerException` in `ExecutableMemberDocImpl.position` ("Class android.support.annotation.RestrictTo not found"): put `android-support-annotations` (and `$(cmsdk_LOCAL_JAVA_LIBRARIES)`) on the docs classpath | +| `0001-vendor-cmsdk-droiddoc-support-libs-classpath.patch` | `vendor/cmsdk/Android.mk` | droiddoc crash `java.lang.NullPointerException` in `ExecutableMemberDocImpl.position` ("Class android.support.annotation.RestrictTo not found"): put `android-support-annotations` (and `$(cmsdk_LOCAL_JAVA_LIBRARIES)`) on the docs classpath | -Anything needed from the shared millet kernel/device trees that can't be +(The former `0001-device-millet-common-allow-rubenslte.patch` was deleted: millet-common +is no longer part of this LOS tree — rubenslte owns its family layer in-tree.) + +Anything needed from the shared kernel/device trees that can't be expressed in a device repo should go under `patches/kernel/` (kernel) or -`patches/los/` (other millet-common/vendor trees). \ No newline at end of file +`patches/los/` (other LOS vendor trees). \ No newline at end of file diff --git a/patches/los/0001-device-millet-common-allow-rubenslte.patch b/patches/los/0001-device-millet-common-allow-rubenslte.patch deleted file mode 100644 index 73335fb..0000000 --- a/patches/los/0001-device-millet-common-allow-rubenslte.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/device/samsung/millet-common/Android.mk b/device/samsung/millet-common/Android.mk -index ec6b235..00644d8 100644 ---- a/device/samsung/millet-common/Android.mk -+++ b/device/samsung/millet-common/Android.mk -@@ -16,6 +16,6 @@ - - LOCAL_PATH := $(call my-dir) - --ifneq ($(filter milletwifi millet3g milletlte,$(TARGET_DEVICE)),) -+ifneq ($(filter milletwifi millet3g milletlte rubenslte,$(TARGET_DEVICE)),) - include $(call all-subdir-makefiles,$(LOCAL_PATH)) - endif \ No newline at end of file diff --git a/patches/los/0002-vendor-cmsdk-droiddoc-support-libs-classpath.patch b/patches/los/0001-vendor-cmsdk-droiddoc-support-libs-classpath.patch similarity index 84% rename from patches/los/0002-vendor-cmsdk-droiddoc-support-libs-classpath.patch rename to patches/los/0001-vendor-cmsdk-droiddoc-support-libs-classpath.patch index 1d2a136..56638b3 100644 --- a/patches/los/0002-vendor-cmsdk-droiddoc-support-libs-classpath.patch +++ b/patches/los/0001-vendor-cmsdk-droiddoc-support-libs-classpath.patch @@ -1,8 +1,8 @@ diff --git a/vendor/cmsdk/Android.mk b/vendor/cmsdk/Android.mk -index dc2b714..3eff5ef 100644 +index dc2b714..984bbbf 100644 --- a/vendor/cmsdk/Android.mk +++ b/vendor/cmsdk/Android.mk -@@ -207,7 +207,8 @@ cmplat_docs_src_files := \ +@@ -207,7 +207,9 @@ cmplat_docs_src_files := \ $(call all-html-files-under, $(cyanogenmod_sdk_src)) cmplat_docs_java_libraries := \ diff --git a/shell.nix b/shell.nix index c9627ae..d8c4e98 100644 --- a/shell.nix +++ b/shell.nix @@ -1,12 +1,3 @@ -# Build environment for the SM-T365 builds (TWRP recovery and LineageOS 14.1). -# This combines the FHS environments from the previous separate shell.nix and -# shell_los.nix into a single file. The package set includes both the omni 5.1 -# (TWRP) and cm-14.1 (LOS) requirements. For TWRP builds the host gcc is unused, -# for LOS builds it is needed for the kernel kconfig host tools. -# -# nixpkgs 22.11 is pinned because this old toolchain only links against legacy -# host libraries (ncurses5, 32-bit libstdc++, old glibc layout). buildFHSUserEnv -# synthesises those paths so AOSP prebuilt host binaries run unpatched. let pkgs = import (fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/nixos-22.11.tar.gz"; @@ -14,39 +5,41 @@ let fhs = pkgs.buildFHSUserEnv { name = "android-env"; - - # Tools called directly on PATH by the build and by the user. targetPkgs = pkgs: with pkgs; [ - git # the device/kernel clones (and `repo` plumbing) - gitRepo # AOSP `repo` multi-repo tool - gnumake # `mka` -> make for the omni build (TWRP) / bacon build (LOS) - python2 # omni-5.1 / cm-14.1 era build scripts expect python2 - python3 # modern `repo` runs under python3 - curl # toolchain tarball download (TWRP) / tarball downloads (LOS) - openssl # used by a few AOSP host tools - procps # `ps`/`pidof` referenced by build scripts - util-linux # uuidgen and friends used during image building - android-tools # adb / fastboot for flashing and testing - jdk8 # 5.1 / 14.1 needs java <=8 (signapk, dx, jack) - schedtool # legacy tool invoked by some build scripts - m4 gperf bison flex # classic AOSP host toolchain - which # jack-admin / diagnose helpers probe PATH (LOS) - perl # kernel/scripting helper (timeconst.pl, etc.) - libxml2 # xml libs used by host tools - zip unzip # packaging - lzop # legacy lzo support - xz # LZMA ramdisk compression (mkbootimg.mk) - gnupg # gpg for repo manifest verification (optional) - nettools # minor networking helpers used by host scripts + android-tools + bison + ccache + curl + flex + git + gitRepo + gnumake + gnupg + gperf + jdk8 + libxml2 + lzop + m4 + nettools + ninja + openssl + perl + procps + python2 + python3 + schedtool + unzip + util-linux + which + xz + zip ]; - # Multilib: the 5.1 ia32 host tools need 32-bit libstdc++ and zlib; - # ncurses5 is required by older host builds. multiPkgs = pkgs: with pkgs; [ - zlib ncurses5 pkgsi686Linux.gcc9 pkgsi686Linux.libstdcxx5 + zlib ]; runScript = "bash"; @@ -55,13 +48,5 @@ let in pkgs.stdenv.mkDerivation { name = "android-env-shell"; nativeBuildInputs = [ fhs ]; - shellHook = '' - # `nix-shell --run "cmd"` is unreliable here: the unconditional - # `exec android-env` would swallow the command, so forward it explicitly. - # build_twrp.sh still uses a stdin pipe because it is the tested path. - if [ -n "$BASH_EXECUTION_STRING" ]; then - exec android-env -c "$BASH_EXECUTION_STRING" - fi - exec android-env - ''; + shellHook = "exec android-env"; }