general: restructuring after branchout

This commit is contained in:
2026-09-13 22:53:45 +02:00
parent 2a12828ef6
commit 2a0405da32
14 changed files with 11 additions and 372 deletions
-130
View File
@@ -1,130 +0,0 @@
# AGENTS.md — builders_rubenslte
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
```
build_twrp.sh TWRP -> recovery.img (omni twrp-5.1)
build_los-14.1.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 post-sync fixes
local_manifests/ los-14.1.xml + twrp.xml
twrp-build/ los-build/ .ccache/ .jack-repository/ (gitignored workspaces)
```
## Repos
Everything rubenslte lives on gitea, fetched anonymously over https:
`https://git.cfpi-fpsi.eu/rubenslte`.
- `twrp_device_samsung_rubenslte` — TWRP device tree, **self-contained**
(own BoardConfig.mk / mkbootimg.mk / dtbtool, no platform imports).
- `android_kernel_samsung_msm8226-rubenslte` — S3NEO msm8226 kernel
fork, built from source
- `android_device_samsung_rubenslte` — LOS device tree; inherits the shared
msm8226-common / qcom-common platform layers (cm-14.1)
- `android_vendor_samsung_rubenslte` — LOS proprietary blobs.
`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
Both scripts are console-style with `getopts`; the only flag is `-h` (usage).
Every build runs a full `repo sync` first, so in-tree edits are always wiped
and re-patched — there is no skip-sync mode.
```bash
./build_twrp.sh -h # usage
./build_twrp.sh build # full build -> recovery.img at repo root
./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-14.1.sh bootimage # build boot.img (kernel + dt.img + ramdisk, fast gate)
./build_los-14.1.sh bacon # full build -> lineage_rubenslte-*.zip
./build_los-14.1.sh clean # mka clean
./build_los-14.1.sh prune # remove all of los-build
```
Cheap checks without nix: `bash -n common.sh build_twrp.sh build_los.sh`.
Patch check: `patch -p1 --dry-run -d <workspace> < patches/<dir>/<file>`.
Flashing / boot keys: README.md.
## How the builds work
- **Env**: everything runs inside the nix-shell FHS env (`shell.nix`). Run
`nix-shell` first, then invoke the scripts.
- **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`.
- **LOS sources**: `repo init` of cm-14.1 (`LineageOS/android`) +
`local_manifests/rubenslte.xml` copied in before `repo sync -c -j$(nproc)`.
- **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` (the sync
fetches 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.
- **SEANDROIDENFORCE**: `build_los.sh` appends the trailer to the LOS boot.img
(`append_seandroidenforce`) — required by Samsung bootloaders.
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`.
## Invariants — do not "simplify"
- `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.
- **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).
## Gotchas
- **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).
- `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).
## Why local_manifests
`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,
every build re-copies them.)
# Else
For depth: `patches/README.md`, `twrp_device_samsung_rubenslte/README.md`,
`local_manifests/rubenslte.xml`.
+2 -43
View File
@@ -1,50 +1,9 @@
# builders\_rubenslte
Build scripts and patches for TWRP and LineageOS 14.1 for the Samsung
Galaxy Tab Active SM-T365 (`rubenslte`).
Build scripts and utilities for rubenslte TWRP builds.
## Quick start
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
| 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
| 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 |
nix-shell. Then, run `./build.sh -h` to figure out how to build.
+9 -5
View File
@@ -3,13 +3,13 @@ set -euo pipefail
readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
source 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"
readonly RECOVERY_BUDGET=10485248
rlte_print() { printf '\033[34m[%s] %s\033[0m\n' "$0" "$*" ; }
rlte_error() { printf '\033[31m[%s] error: %s\033[0m\n' "$0" "$*" >&2 ; exit 1; }
rlte_ok() { printf '\033[32m[%s] ok: %s\033[0m\n' "$0" "$*" ; exit 0; }
usage() {
cat <<EOF
@@ -34,7 +34,7 @@ do_build() {
rlte_print "Setting up repo"
repo init --depth 1 -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH"
mkdir -p .repo/local_manifests
cp "$ROOT/$MANIFEST_LOCAL" .repo/local_manifests/
cp "$ROOT/manifest.xml" .repo/local_manifests/
fi
if [ ! -v "NO_SYNC" ]; then
@@ -43,7 +43,11 @@ do_build() {
fi
rlte_print "Applying patches"
apply_patches "$ROOT/patches/twrp"
for p in "$ROOT"/*.patch; do
[ -e "$p" ] || continue
patch -p1 --forward --batch --dry-run < "$p" || continue
patch -p1 --batch < "$p"
done
export LC_ALL=C LANG=C LC_CTYPE=C TOP="$PWD"
-99
View File
@@ -1,99 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
source common.sh
readonly MANIFEST_URL="https://github.com/LineageOS/android.git"
readonly MANIFEST_BRANCH="cm-14.1"
readonly MANIFEST_LOCAL="local_manifests/los-14.1.xml"
usage() {
cat <<EOF
usage: $0 [-hn] [bootimage|bacon|clean|prune]
flags:
-h show this help
-n don't sync
commands:
bootimage build boot.img (kernel + dt.img + ramdisk, fast gate)
bacon full build -> lineage_rubenslte-*.zip
clean mka clean
prune remove all of los-build
EOF
}
append_seandroidenforce() {
local img="$1"
[ -f "$img" ] || return
tail -c 16 "$img" | grep -q "SEANDROIDNEFORCE" || \
printf 'SEANDROIDENFORCE' >> "$img"
}
do_build() {
mkdir -p los-build
cd los-build
if [ ! -d .repo ]; then
rlte_print "Setting up repo"
repo init --depth 1 -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH"
mkdir -p .repo/local_manifests
cp "$ROOT/$MANIFEST_LOCAL" .repo/local_manifests/
fi
if [ ! -v "NO_SYNC" ]; then
rlte_print "Syncing repositories"
repo sync -c -j"$(nproc)"
fi
rlte_print "Applying patches"
apply_patches "$ROOT/patches/los"
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="$PWD"
mkdir -p "$ROOT/.jack-repository"
cp -n "$TOP"/prebuilts/sdk/tools/jacks/jack-*.jar "$ROOT/.jack-repository"
cp -n "$TOP"/prebuilts/sdk/tools/jills/jill-*.jar "$ROOT/.jack-repository"
set +eu
source build/envsetup.sh
lunch lineage_rubenslte-userdebug
set -e
if [ -z "${TARGET_PRODUCT:-}" ]; then
rlte_error "lunch failed - TARGET_PRODUCT not set"
exit 1
fi
rlte_print "Commencing build (command: $CMD)"
mka "$CMD"
if [ "$CMD" != "clean" ]; then
rlte_print "Appending SEANDROIDENFORCE"
append_seandroidenforce "$ROOT/los-build/out/target/product/rubenslte/boot.img"
fi
rlte_ok "Done."
}
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
-15
View File
@@ -1,15 +0,0 @@
#!/usr/bin/env bash
rlte_print() { printf '\033[34m[%s] %s\033[0m\n' "$0" "$*" ; }
rlte_error() { printf '\033[31m[%s] error: %s\033[0m\n' "$0" "$*" >&2 ; exit 1; }
rlte_ok() { printf '\033[32m[%s] ok: %s\033[0m\n' "$0" "$*" ; exit 0; }
apply_patches() {
local dir="$1"
for p in "$dir"/*.patch; do
[ -e "$p" ] || continue
patch -p1 --forward --batch --dry-run < "$p" || continue
patch -p1 --batch < "$p"
done
}
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="gitea" fetch="https://git.cfpi-fpsi.eu/rubenslte" />
<remote name="los" fetch="https://github.com/LineageOS" />
<project path="device/qcom/common"
name="android_device_qcom_common"
remote="los" revision="cm-14.1" />
<project path="device/samsung/qcom-common"
name="android_device_samsung_qcom-common"
remote="los" revision="cm-14.1" />
<project path="device/samsung/msm8226-common"
name="android_device_samsung_msm8226-common"
remote="gitea" revision="lineage-14.1" />
<project path="device/samsung/rubenslte"
name="android_device_samsung_rubenslte"
remote="gitea" revision="lineage-14.1" />
<project path="kernel/samsung/rubenslte"
name="android_kernel_samsung_msm8226-rubenslte"
remote="gitea" revision="lineage-14.1-rubenslte" />
<project path="vendor/samsung/rubenslte"
name="android_vendor_samsung_rubenslte"
remote="gitea" revision="main" />
<!-- LineageOS prebuilts are broken. Instead, we pull from AOSP. -->
<project path="external/chromium-webview"
name="platform/external/chromium-webview"
remote="aosp" revision="nougat-mr1.2-release" />
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_arm" />
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_arm64" />
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_x86" />
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_x86_64" />
</manifest>
-16
View File
@@ -1,16 +0,0 @@
# Patches
These patches make the 2015-era sources build on a modern host toolchain.
## TWRP / omni 5.1 (`patches/twrp/`)
| Patch | File(s) | Problem fixed |
|-------|---------|---------------|
| `0001-host-cflags-suppress-stringop-truncation.patch` | `build/core/combo/HOST_linux-x86*.mk` | `-Werror=stringop-truncation` errors with host GCC >= 8 |
| `0002-build-core-fix-ar-absolute-paths.patch` | `build/core/definitions.mk` | host `ar`/absolute path handling in whole-archive extraction breaks with newer binutils; extract to a temp dir instead |
| `0003-recovery-add-std-gnu++11-for-nullptr-support.patch` | `bootable/recovery/Android.mk` | adds `-std=gnu++11` for `nullptr` under the recovery Clang build |
| `0004-build-core-combo-remove-icf-safe-for-BFD-ld.patch` | `build/core/combo/TARGET_linux-arm.mk` | `-Wl,--icf=safe` is gold-only; commented out for the BFD linker supplied by the toolchain download |
| `0005-build-core-tasks-kernel-fix-KERNEL_CONFIG_OVERRIDE-ordering-and-passthrough.patch` | `build/core/tasks/kernel.mk` | applies the additional config before the override, drops the clobbering `oldconfig` after override, and passes the override on the kernel build command line |
These target the omni `twrp-5.1` manifest sources — they only apply inside the
repo workspace, not on a host.
@@ -1,29 +0,0 @@
From: rubenslte-builder <builder@rubenslte>
Date: Sat, 13 Sep 2026 21:00:00 +0200
Subject: [PATCH 1/1] art-mem-map-fix-mmap-on-kernel-518
Workaround for mmap error when building on Linux kernel 5.18+.
Adds MAP_FIXED_NOREPLACE in MapFileAtAddress (host builds only,
guarded by #if !defined(ART_TARGET)), forcing the kernel to honor
the expected address instead of mapping at a different one.
Fixes: android-review.googlesource.com/c/platform/art/+/673bd2c638ed82bbe71cf7d645d433973a624e4f
Bug: 23318356
---
diff --git a/art/runtime/mem_map.cc b/art/runtime/mem_map.cc
index b9d51c1..f034a3d 100644
--- a/art/runtime/mem_map.cc
+++ b/art/runtime/mem_map.cc
@@ -393,7 +393,12 @@
DCHECK(ContainedWithinExistingMap(expected_ptr, byte_count, error_msg))
<< ((error_msg != nullptr) ? *error_msg : std::string());
flags |= MAP_FIXED;
+#if !defined(ART_TARGET)
+ } else if (expected_ptr) {
+#define MAP_FIXED_NOREPLACE 0x100000
+ flags |= MAP_FIXED_NOREPLACE;
+#endif
} else {
CHECK_EQ(0, flags & MAP_FIXED);
// Don't bother checking for an overlapping region here. We'll
// check this if required after the fact inside CheckMapRequest.