1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00
upx/misc/test-qemu-with-podman/README.md
2023-07-09 17:36:24 +02:00

52 lines
2.1 KiB
Markdown

test-qemu-with-podman
=====================
This directory provides scripts for creating and running rather small Alpine Linux container
images, intended for testing statically-linked Linux executables with qemu-user.
Very short usage instructions follow.
### Where do I get statically-linked Linux binaries:
- all recent official UPX linux release binaries are statically linked
- the `zigcc linux-musl` artifacts as created by our GitHub Actions CI
- many other `linux-musl` binaries are statically linked
- many `Go` and some `Rust` programs are statically linked
### PREPARATION OUTSIDE THE CONTAINER:
```sh
cd your-upx-top-level-directory
mkdir -p tmp
cd tmp
# download official UPX release binaries
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-amd64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-arm64_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-armeb_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-arm_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-i386_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-mipsel_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-mips_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-powerpc64le_linux.tar.xz
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-powerpc_linux.tar.xz
# and unpack all .tar.xz files
for f in ./upx*.tar.xz; do tar -xJf $f; done
```
### INSIDE THE CONTAINER:
```sh
cd /home/upx/src/upx/tmp
# check that the official binaries do work
qemu-i386 ./upx-4.0.2-i386_linux/upx --version
qemu-mips ./upx-4.0.2-mips_linux/upx --version
# ...same for more architectures
# use qemu-mips to unpack the arm64 binary, and then run the unpacked arm64 binary:
qemu-mips ./upx-4.0.2-mips_linux/upx -d upx-4.0.2-arm64_linux/upx -o upx-arm64-unpacked
qemu-aarch64 ./upx-arm64-unpacked --version
# ...same for more architectures
```