From 7e5086028ab916758ffafe9717e0c48809e46530 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 04:00:52 +0000 Subject: [PATCH 1/2] Add scripts to support building on Termux via PRoot This commit adds `setup_termux.sh` and `scripts/setup_proot_env.sh` to allow users to easily set up a Debian PRoot environment in Termux with all necessary build dependencies. It also updates `README.md` with instructions on how to use these scripts. Co-authored-by: 0m364 <13804150+0m364@users.noreply.github.com> --- README.md | 22 ++++++++++++++++++++ scripts/setup_proot_env.sh | 10 +++++++++ setup_termux.sh | 42 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100755 scripts/setup_proot_env.sh create mode 100755 setup_termux.sh diff --git a/README.md b/README.md index 270b82c..454c55c 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,28 @@ sysbuild.sh ``` +## Building on Termux (Android) + +It is possible to build the system directly on an Android device using Termux and PRoot. + +1. Clone this repository in Termux. +2. Run the setup script to install `proot-distro`, `debian`, and build dependencies: + ```bash + ./setup_termux.sh + ``` +3. Enter the build environment (follow the instructions printed by the setup script): + ```bash + proot-distro login debian --bind ".:/root/LinuxFromScratch" --cwd /root/LinuxFromScratch + ``` +4. Proceed with the build as usual inside the PRoot environment: + ```bash + ./set_env.sh [TARGET_NAME] + sysbuild.sh + ``` + +Note: Generating the SD card image (`init_sd.sh`) inside Termux is not supported due to lack of root privileges and loop device support. You can copy the generated `root-fs` to a PC to create the image. + + ## Usage To setup the build environnement run from the repository root folder diff --git a/scripts/setup_proot_env.sh b/scripts/setup_proot_env.sh new file mode 100755 index 0000000..77763ce --- /dev/null +++ b/scripts/setup_proot_env.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Install dependencies inside PRoot (Debian/Ubuntu) + +# Update package lists +apt update + +# Install build dependencies +apt install -y build-essential git wget bzip2 file bc unzip rsync python3 cpio libncurses-dev gawk bison flex texinfo patch gzip perl sed tar diffutils grep coreutils make libssl-dev zlib1g-dev libelf-dev + +echo "Dependencies installed." diff --git a/setup_termux.sh b/setup_termux.sh new file mode 100755 index 0000000..0358ee1 --- /dev/null +++ b/setup_termux.sh @@ -0,0 +1,42 @@ +#!/data/data/com.termux/files/usr/bin/bash + +# Check if running in Termux +if [ -z "$TERMUX_VERSION" ]; then + echo "This script is intended for Termux environment." + exit 1 +fi + +echo "Setting up Termux build environment..." + +# Check if proot-distro is installed +if ! command -v proot-distro &> /dev/null; then + echo "Installing proot-distro..." + pkg install -y proot-distro +fi + +# Install debian if not already installed +# proot-distro install checks if it is installed, so we can just run it. +# However, to avoid redownloading/checking every time if it takes long, we can check. +if ! proot-distro list | grep -q "debian (installed)"; then + echo "Installing Debian..." + proot-distro install debian +else + echo "Debian is already installed." +fi + +# Determine repo directory +REPO_DIR=$(pwd) +SCRIPT_PATH="/root/LinuxFromScratch/scripts/setup_proot_env.sh" + +echo "Installing dependencies inside PRoot environment..." +# We bind mount the current directory to /root/LinuxFromScratch +# Run the setup script using bash explicitly +proot-distro login debian --bind "$REPO_DIR:/root/LinuxFromScratch" -- bash "$SCRIPT_PATH" + +echo "Setup complete." +echo "To enter the build environment, run:" +echo "proot-distro login debian --bind \"$REPO_DIR:/root/LinuxFromScratch\" --cwd /root/LinuxFromScratch" +echo "" +echo "Then inside the environment:" +echo "./set_env.sh " +echo "sysbuild.sh" From 5779eb34d727c48a11b7c88f53f7c28c172c7790 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 04:53:25 +0000 Subject: [PATCH 2/2] Add scripts to support building on Termux via PRoot This commit adds `setup_termux.sh` and `scripts/setup_proot_env.sh` to allow users to easily set up a Debian PRoot environment in Termux with all necessary build dependencies. It also updates `README.md` with instructions on how to use these scripts. Co-authored-by: 0m364 <13804150+0m364@users.noreply.github.com>