diff --git a/AGENTS.md b/AGENTS.md index 8ddfe35..94d55f4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,8 +9,7 @@ Tab Active SM-T365 (codename `rubenslte`, Qualcomm MSM8926, Linux kernel 3.4). ``` 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 the TWRP build -shell_los.nix same package set + host gcc (kernel kconfig `conf`) +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) @@ -21,12 +20,22 @@ important_files/ webview.apk restore point (do not delete) twrp-build/ los-build/ .ccache/ .jack-repository/ (gitignored workspaces) ``` -Five cooperating repos each build consumes (device/vendor/kernel from gitea via -`local_manifests/rubenslte.xml` for LOS; device tree + kernel shallow clones for -TWRP): `twrp_device_samsung_rubenslte`, `android_kernel_samsung_rubenslte` -(shared), `device_samsung_rubenslte`, `android_vendor_samsung_rubenslte`, plus -the shared millet forks those LOS trees pull in -(device/samsung/millet-common, kernel/samsung/millet-common etc.). +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`) + +| 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 build = shallow clones of `twrp_device_samsung_rubenslte` + the kernel. +- LOS build = `repo sync` of the cm-14.1 manifest + `local_manifests/rubenslte.xml`. ## Commands @@ -49,16 +58,91 @@ 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. +## 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. + +Final artifacts at the repo root: `recovery.img` (TWRP, currently 10,479,632 +bytes) and, after bacon, +`los-build/out/target/product/rubenslte/lineage_rubenslte-*.zip`. + +## Image layout (shipped `recovery.img`) + +``` +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 +``` + +`build_twrp.sh` prints the image size and sha256 at the end (`verify_image` in +`lib/common.sh`). + +## Flashing / testing + +- 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). + +## WebView provider + +`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. + ## How to work here -- Builds only run inside the nix-shell FHS environments (`shell.nix`, - `shell_los.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). +- 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 @@ -122,6 +206,9 @@ LOS: 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 @@ -130,9 +217,26 @@ LOS: 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. -For the full background: `README.md` (this repo), `patches/README.md`, -`twrp_device_samsung_rubenslte/README.md`, `local_manifests/rubenslte.xml`. \ No newline at end of file +## 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`. diff --git a/README.md b/README.md index 5d8190c..72f03c1 100644 --- a/README.md +++ b/README.md @@ -1,163 +1,36 @@ # builders\_rubenslte -Build scripts for **TWRP recovery** and a **LineageOS 14.1 ROM** for the -Samsung Galaxy Tab Active SM-T365 (codename `rubenslte`, Qualcomm MSM8926). - -This repo only orchestrates the builds. The actual device configuration lives in -other repos: - -| Repo | Contents | -|------|----------| -| `twrp_device_samsung_rubenslte` | TWRP device tree (BoardConfig.mk, mkbootimg.mk, dtbtool, recovery.fstab) | -| `android_kernel_samsung_rubenslte` | Samsung msm8226 stock kernel (Linux 3.4), built from source | -| `device_samsung_rubenslte` | LineageOS 14.1 device tree | -| `android_vendor_samsung_rubenslte` | LOS vendor blobs / proprietary files | -| `android_kernel_samsung_rubenslte` (shared) | the same gitea kernel clone | -| this repo | `build_twrp.sh` / `build_los.sh` (drivers), `shell.nix` / `shell_los.nix` (envs), `patches/`, docs | - -The LOS device/vendor/kernel trees come in via `local_manifests/rubenslte.xml` -against the cm-14.1 manifest (the milletwifi/milletlte forks from -git.cfpi-fpsi.eu provide the shared trees). +Build drivers for **TWRP recovery** and **LineageOS 14.1** for the Samsung +Galaxy Tab Active SM-T365 (codename `rubenslte`, Qualcomm MSM8926). ## Quick start -Requirements: a NixOS system (or Nix with `nix-shell`) with network access and -`nix` in your user's `allowed-users` / `trusted-users`. - -### TWRP recovery +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 sources +./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 - -``` +# 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). - -## How the builds work - -1. **Environment** — everything runs inside a nix-shell FHS environment: - `shell.nix` for TWRP, `shell_los.nix` for LOS (same package set + host gcc, - which the kernel kconfig host tools need). `nix-shell --run` is unreliable - here because the shellHook does `exec android-env`, so the scripts re-enter - the environment by piping their body into `nix-shell` (see - `reenter_build_env` in `lib/common.sh`). -2. **Sources** — `repo init/sync` fetches the omni `twrp-5.1` manifest for TWRP - and the cm-14.1 manifest + `local_manifests/rubenslte.xml` for LOS. The - device tree(s) and kernel are shallow clones from gitea and refreshed on each - full build. -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`. LOS uses the tree - prebuilts. -5. **Compiler (LOS)** — Jack only. The 14.1 javac fallback is incomplete - (dangling `with-local/classes.dex` intermediates) and can't build bacon. - Jack runs in-process (`JACK_NO_SERVER=1`); the separate Jack server is - disabled (`JACK_SERVER=false`) because its curl admin TLS (try `curl` - against 0.0.0.0:8077: `SSL routines::unexpected eof`) can't handshake with - the Java 8 server on this host, and jack_server_setup.mk's mandatory - server-start ninja edge (`update jack ... || exit 47`) hard-aborts ninja. - Jack jars are seeded from the tree into `.jack-repository/`. -6. **Kernel** — built from source via the omni/lineage kernel build rules. The - variant defconfig only enables `CONFIG_MACH_RUBENSLTE_OPEN` (EUR). -7. **dt.img** — `dtbToolLineage` packs the compiled `.dtb` files; the bootloader - selects the right one for the hardware. -8. **Recovery ramdisk** — the stock minigzip ramdisk overflows the 10,485,248 - byte partition, so `mkbootimg.mk` replaces the core ramdisk 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. - -Final artifacts at the repo root: `recovery.img` (TWRP, currently 10,479,632 -bytes) and, after bacon, `los-build/out/target/product/rubenslte/lineage_rubenslte-*.zip`. - -## Image layout (shipped `recovery.img`) - -``` -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 -``` - -`build_twrp.sh` prints the image size and sha256 at the end (`verify_image` in -`lib/common.sh`). +`RB_CMD=` overrides the LOS subcommand (used by relaunch helpers). ## Flashing -Enter Download mode: **Volume Down + Home + Power**, then confirm with -**Volume Up**. - -- Odin 3.x: flash `recovery.img` in the **AP** slot (leave BL/CP/CSC empty). -- Heimdall: `heimdall flash --RECOVERY recovery.img --no-reboot` - -Boot into TWRP with **Volume Up + Home + Power**. Note: the bootloader sets the -KNOX warranty bit on flashing — irreversible on this device. - -`recovery-stock.img` (in this directory, git-ignored) is the stock recovery -image dumped from the device; flash it back to restore the factory recovery. - -The ROM zip is flashed from TWRP (it does not touch the bootloader), 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). - -## WebView provider (webview.apk) - -The device's WebView (com.android.webview) lives in the vendor tree. If you wipe -or replace it, the system can fall back to a broken `com.android.webview`. -Restore point `/system/app/webview/webview.apk`; a safely-stripped variant sits -in `important_files/` if you need to re-add it. - -## Device notes - -- **dt.img is EUR-only.** The kernel is built with `CONFIG_MACH_RUBENSLTE_OPEN`, - 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, no F2FS.** The kernel has no F2FS driver, so the f2fs - tools are excluded. 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` 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" not - found`. The in-TWRP terminal (Advanced → Terminal) always works. - -## Troubleshooting - -- `make: *** [.../mkbootimg.mk:24: /dt.img] Błąd 255` (TWRP) — the custom - bootimg rules are included before the kernel tasks define their paths; the - recursive variables in BoardConfig.mk are what keep `/dt.img` from collapsing - to an absolute base path. Don't "simplify" them to `:=`. -- 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/`. -- `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. -- Jack complaints "not readable" about `jack-3.36.CANDIDATE.jar` — the - `.jack-repository/` seed is incomplete; `seed_jack_repository` re-copies from - `los-build/prebuilts/sdk/tools/jacks/` (keep jills too). -- `curl` TLS error against the Jack server — 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. +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). ## Device information @@ -184,10 +57,16 @@ in `important_files/` if you need to re-add it. ## Links -- https://git.cfpi-fpsi.eu/rubenslte/twrp_device_samsung_rubenslte +### Kernel, vendor & device trees - https://git.cfpi-fpsi.eu/rubenslte/android_kernel_samsung_rubenslte -- https://git.cfpi-fpsi.eu/rubenslte/device_samsung_rubenslte - https://git.cfpi-fpsi.eu/rubenslte/android_vendor_samsung_rubenslte -- https://github.com/matteo0026/android_device_samsung_rubenslte +- https://git.cfpi-fpsi.eu/rubenslte/android_device_samsung_rubenslte +- 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 -- https://github.com/matteo0026/twrp_device_samsung_matisselte \ No newline at end of file +- https://github.com/matteo0026/twrp_device_samsung_matisselte + diff --git a/build_los.sh b/build_los.sh index 29231fb..0360167 100755 --- a/build_los.sh +++ b/build_los.sh @@ -1,6 +1,6 @@ #!/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_los.nix). +# 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); @@ -24,7 +24,7 @@ CMD="${RB_CMD:-${1:-bootimage}}" [ $# -gt 1 ] && echo "warning: ignoring extra args: $*" reenter_build_env \ - "$SCRIPT/shell_los.nix" \ + "$SCRIPT/shell.nix" \ RUBENSLTE_LOS_IN_ENV \ "export RB_CMD='$CMD'" diff --git a/shell.nix b/shell.nix index c08e33a..c9627ae 100644 --- a/shell.nix +++ b/shell.nix @@ -1,9 +1,12 @@ -# Build environment for the SM-T365 TWRP build (omni twrp-5.1, GCC 4.8-era). +# 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"; @@ -16,17 +19,18 @@ let 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 - python2 # omni-5.1 era build scripts expect python2 + 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 in build_twrp.sh + 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 needs java <=8 (signapk, dx) - schedtool # legacy tool invoked by some omni scripts + 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 @@ -60,4 +64,4 @@ in pkgs.stdenv.mkDerivation { fi exec android-env ''; -} \ No newline at end of file +} diff --git a/shell_los.nix b/shell_los.nix deleted file mode 100644 index a9c3fea..0000000 --- a/shell_los.nix +++ /dev/null @@ -1,61 +0,0 @@ -# FHS build environment for the LineageOS 14.1 (rubenslte) build. -# Same package set as shell.nix (TWRP env) plus a host gcc: the kernel kconfig -# host tools (`conf`) and kernel/scripts are compiled with the host compiler -# during the LOS build, while the omni 5.1 TWRP build only needs them from the -# device's arm-eabi toolchain. -# -# Intentionally kept as a separate file: the TWRP build is device-tested, so -# shell.nix is not touched. Keep the two packages sets in sync where possible. -let - pkgs = import (fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/nixos-22.11.tar.gz"; - }) {}; - - fhs = pkgs.buildFHSUserEnv { - name = "android-env"; - - targetPkgs = pkgs: with pkgs; [ - git # the device/kernel clones (and `repo` plumbing) - gitRepo # AOSP `repo` multi-repo tool - gnumake # `mka` -> make for the bacon build - gcc # host C compiler for kernel kconfig host tools - python2 # cm-14.1 era build scripts expect python2 - python3 # modern `repo` runs under python3 - curl # tarball downloads - 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 # 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 - 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 - gnupg # gpg for repo manifest verification (optional) - nettools # minor networking helpers used by host scripts - ]; - - multiPkgs = pkgs: with pkgs; [ - zlib - ncurses5 - pkgsi686Linux.gcc9 - pkgsi686Linux.libstdcxx5 - ]; - - runScript = "bash"; - profile = "export ANDROID_JAVA_HOME=${pkgs.jdk8.home}"; - }; -in pkgs.stdenv.mkDerivation { - name = "android-env-shell"; - nativeBuildInputs = [ fhs ]; - shellHook = '' - if [ -n "$BASH_EXECUTION_STRING" ]; then - exec android-env -c "$BASH_EXECUTION_STRING" - fi - exec android-env - ''; -} \ No newline at end of file