Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The built boot file is too large. #23055

Open
topcoco opened this issue Jan 28, 2025 · 2 comments
Open

The built boot file is too large. #23055

topcoco opened this issue Jan 28, 2025 · 2 comments

Comments

@topcoco
Copy link

topcoco commented Jan 28, 2025

./build-bootstraps.sh --architectures aarch64
I have successfully built the "./termux-packages/bootstrap-aarch64.zip",
but its size is about 242MB, while the bootstrap-aarch64.zip in releases page(https://github.com/termux/termux-packages/releases/tag/bootstrap-2022.09.18-r1%2Bapt-android-7) is only 25MB,

Is there a special building parameter for the slim recipe?

@2096779623
Copy link
Member

2096779623 commented Jan 29, 2025

  • ./scripts/generate-bootstraps.sh: Generate bootstrap archive for Termux app from published apt repo.

  • ./scripts/build-bootstraps.sh: Build bootstrap archive for Termux app from local package sources.

@robertkirkman
Copy link
Contributor

robertkirkman commented Feb 5, 2025

@topcoco

build-bootstraps.sh from F-Droid Termux (this repository) is not currently used regularly in any specific CI workflow. This means that it can take some adjustments and manual massaging to achieve the exact goals you would like, and the script is not regularly tested against the current status of the repository.

Specifically, this issue is partly caused by the phenomenon that many build-only dependencies are also included in the bootstrap, without considering the difference between build-only dependencies and runtime dependencies.

The way that I usually work around this problem, somewhat unoptimally, but effective as a band-aid solution, is, first, I use apt list --installed in a clean installed, fully updated normal Termux app to get a list of all the packages that should be present in a normal bootstrap (there are also several other ways to programmatically obtain similar lists, but that is just an example),

then, I edit this part of the script to add a condition that "skips" all packages that are not in this list, during the extract_debs() function of the build-bootstraps.sh. This ensures that all unnecessary packages are skipped while massaging your custom bootstrap.

if [[ "$current_package_arch" != "$package_arch" ]] && [[ "$current_package_arch" != "all" ]]; then
echo "[*] Skipping incompatible package '$deb' for target '$package_arch'..."
continue
fi
if [[ "$current_package_name" == *"-static" ]]; then
echo "[*] Skipping static package '$deb'..."
continue
fi
if [[ " ${EXTRACTED_PACKAGES[*]} " == *" $current_package_name "* ]]; then
echo "[*] Skipping already extracted package '$current_package_name'..."
continue
fi

In the future, changes might eventually come that improve this situation and make it easier to compile the custom bootstraps you would like. In the mean time, if you give some clarification about what exact goals you have in mind for the changes you would like to make to your bootstrap, for example,

  • would you like to add or remove some specific packages to or from the bootstrap?
  • would you like to add custom bashrc or other startup programs to the bootstrap?
  • would you like to change the TERMUX_APP_PACKAGE variable in your custom bootstrap from com.termux to something else?

the alternative generate-bootstraps.sh script is capable of helping with the first two tasks, but if you also need to change TERMUX_APP_PACKAGE, at this time F-Droid Termux's generate-bootstraps.sh does not provide this functionality, so you would have to use build-bootstraps.sh, or write your own fully custom wrapper script.

If you let me know what the end goal is for your custom bootstrap and what requirements it needs to fulfill, I could probably give you some tips on the fastest ways to get there in an F-Droid-Termux-based codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants