Skip to content

Instantly share code, notes, and snippets.

@diyism
Last active December 14, 2023 20:20
Show Gist options
  • Save diyism/7d88d03517c0a26a80b358962087fbfb to your computer and use it in GitHub Desktop.
Save diyism/7d88d03517c0a26a80b358962087fbfb to your computer and use it in GitHub Desktop.
compile termux-bootstraps.zip
#########################################################################################
在Termux+pRoot(AnLinux, Andronix)里跑不起来dockerd进程, 也跑不了任何x64程序/命令,
用alpine-term应用(https://github.com/diyism/alpine-term 578MB,
https://github.com/sylirre/vmConsole 1.01GB)才行,
可以在它的docker里跑x86-64的docker image,用随身的arm64 android手机/平板就可以运行任何x64 docker app了
安装好后在alpine-term应用里执行sudo apk add -u go 会报错 untrsuted signature, 需要先:
sudo apk add -X https://dl-cdn.alpinelinux.org/alpine/v3.18/main -u alpine-keys --allow-untrusted
#########################################################################################
$ wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.18.tgz
$ tar xzvf docker-20.10.18.tgz
$ sudo cp docker/* /usr/bin/
$ sudo nohup dockerd >/dev/null 2>&1 &
$ docker kill $(docker ps -q) #if changed the termux-packages dir, we need remount it into container
$ git clone --depth https://github.com/termux/termux-packages.git
$ cd termux-packages/scripts
$ ./update-docker.sh #the default ndk is r25, should update to r25b
$ nano properties.sh
TERMUX_APP_PACKAGE="termux"
TERMUX_BASE_DIR="/data/local/tmp/${TERMUX_APP_PACKAGE}/files"
TERMUX_CACHE_DIR="/data/local/tmp/${TERMUX_APP_PACKAGE}/cache"
TERMUX_ANDROID_HOME="${TERMUX_BASE_DIR}/home"
TERMUX_APPS_DIR="${TERMUX_BASE_DIR}/apps"
TERMUX_PREFIX="${TERMUX_BASE_DIR}/usr"
TERMUX_REPO_PACKAGE="termux"
$ rm build-bootstraps.sh
$ wget https://raw.githubusercontent.com/termux-pacman/termux-packages/bootstraps/scripts/build-bootstraps.sh
$ chmod 755 build-bootstraps.sh
$ ./run-docker.sh
$ cd scripts
$ sudo bash -c "echo 'nameserver 172.17.0.1' >/etc/resolv.conf" #use the dns on host pc
$ ./setup-android-sdk.sh
$ export NDK="/home/builder/lib/android-ndk-r25b"
$ export TERMUX_NDK_VERSION="25b"
$ apt update ; sudo apt install nano
$ nano ./packages/liblzma/build.sh #TERMUX_PKG_VERSION=5.2.7 TERMUX_PKG_SHA256=8712e9acb0b6b49a97d443458a3067dc5c08a025e02dc5f773176c51dd7cfc69
$./build-bootstraps.sh --architectures aarch64
# to force rebuild all packages: ./build-bootstraps.sh --architectures aarch64 -f
# use bcompare to compare bootstrap-aarch64.zip and the official one(27MB),
# and use "Show no orphans" to overwrite all of the official files to build a customized slim zip file
=====================adjust docker container size from 10GB to 20GB for anddroid sdk/ndk=============================
$ ls -al /dev/mapper/docker* #without "docker kill $(docker ps -q)", the first one, not the "pool" one
$ sudo dmsetup table "docker-0:..."
0 20971520 thin 254:1 44
$ echo 0 83886080 thin 254:1 44 | sudo dmsetup load "docker-0:..."" #83886080x512 means 40GB
$ sudo dmsetup resume "docker-0:..."
$ sudo resize2fs "/dev/mapper/docker-0:..."
# don't stop the container, or else we need redo the "dmsetup load" and "dmsetup resume" and then:
$ docker start <container id>
$ docker exec -it <container id> bash
===============needed and generated files:======================
https://github.com/diyism/termux-packages/releases/tag/for_upload_data_local_tmp_termux_files_usr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment