builders_rubenslte

Build scripts for TWRP recoveries (and, eventually, ROMs) for the Samsung Galaxy Tab Active SM-T365 (codename rubenslte, Qualcomm MSM8926).

This repo only orchestrates the build. The actual device configuration lives in two other repos:

Repo Contents
rubenslte/twrp_device_samsung_rubenslte TWRP device tree (BoardConfig.mk, mkbootimg.mk, dtbtool, recovery.fstab)
rubenslte/android_kernel_samsung_rubenslte Samsung msm8226 stock kernel (Linux 3.4), built from source
this repo build_twrp.sh (driver), shell.nix (nix-shell env), patches/ (fixes), docs

Quick start

Requirements: a NixOS system (or Nix with nix-shell) with network access and nix in your user's allowed-users / trusted-users.

./build_twrp.sh               # full build -> recovery.img
./build_twrp.sh --no-sync     # rebuild without re-syncing/re-patching sources
./build_twrp.sh clean         # delete twrp-build/ and recovery.img
./build_twrp.sh env           # interactive shell inside the build env

The first run downloads the omni twrp-5.1 manifest source (~2-3 GB with the kernel and toolchain) and can take over an hour; later --no-sync rebuilds are much faster. The final artifact is recovery.img at the repo root.

How the build works

  1. Environment — everything runs inside the nix-shell FHS environment (shell.nix). nix-shell --run is unreliable here because the shellHook does exec android-env, so build_twrp.sh re-enters the environment by piping its own body into nix-shell (see reenter_build_env).
  2. Sources — repo init/sync fetches the omni twrp-5.1 manifest; the device tree and kernel are shallow clones from gitea (and refreshed on each full build).
  3. Patches — patches/*.patch fix the old 5.1 codebase for modern host tools (see patches/README.md). Applied idempotently.
  4. Toolchain — arm-eabi-4.8 (gcc 4.8, the same one stock builds used) is downloaded from Android's googlesource and put on PATH.
  5. Kernel — built from source via the omni kernel build rules (base defconfig + rubenslte variant + selinux defconfigs). The variant defconfig only enables CONFIG_MACH_RUBENSLTE_OPEN (see caveats).
  6. dt.img — dtbToolLineage packs the compiled .dtb files; the bootloader 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 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 (verified component sizes; exact offsets are 2048-byte aligned by the bootloader):

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,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)

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.

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 (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" not found. The in-TWRP terminal (Advanced → Terminal) always works.

Troubleshooting

  • make: *** [.../mkbootimg.mk:24: /dt.img] Błąd 255 — 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 — 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 -Rs 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 sequentially.

Device information

Basic Spec sheet
Name Galaxy Tab Active
Model SM-T365
Codename rubenslte
CPU Quad-core 1.2 GHz Cortex A-7
Chipset Qualcomm Snapdragon 400 (MSM8926, LTE)
ro.board.platform msm8226
ro.product.board MSM8926
GPU Qualcomm Adreno 305
Memory 1.5 GB
Shipped Android Android 4.4
Latest Android Android 5.1.1
Storage 16 GB
MicroSD 64 GB
Battery 4450 mAh
Display 800x1280 px
Rear camera 3.1 Mpx
Front camera 1.2 Mpx
Similar devices milletlte, matisselte, motorola_thea
S
Description
No description provided
Readme GPL-3.0
321 KiB
Languages
Shell 71.6%
Nix 28.4%