ssut / payload-dumper-go

an android OTA payload dumper written in Go
Apache License 2.0
2.33k stars 196 forks source link

Win32 or ARM binary release? #3

Closed osm0sis closed 3 years ago

osm0sis commented 3 years ago

Hi, any chance of a Win32 build? Also curious if it's possible to cross-compile this to arm, since on-device is where payload dumper might be most useful!

osm0sis commented 3 years ago

Following from my build instructions in https://github.com/ssut/payload-dumper-go/issues/1#issuecomment-807586352 I was able to hack my Ubuntu mingw-w64 build environment to make a static Win32 build:

apt-get install mingw-w64
# install include and lib from https://packages.msys2.org/package/mingw-w64-i686-xz to /usr/i686-w64-mingw32

GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go build -a -ldflags '-extldflags "-static -s -w"'

That got me the following: payload-dumper-go_1.0.1_windows_386.zip

I'm still working on arm-v5/7.

@ssut the go-xz dependency also being dependent on the toolchain hopefully containing liblzma (which it usually does not) is extremely problematic and frustrating for cross-compiling. ☹️

osm0sis commented 3 years ago

Got it. NDK gcc wasn't cooperating with go build but, since we're building static, armhf will still work fine on Android:

apt-get install gcc-arm-linux-gnueabihf
# install include and lib from https://launchpad.net/ubuntu/bionic/armhf/liblzma-dev/5.2.2-1.3 to /usr/arm-linux-gnueabihf/

GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go build -a -ldflags '-extldflags "-static -s -w"'

That got me the following: payload-dumper-go_1.0.1_android_arm-v7.zip

ssut commented 3 years ago

Thanks for sharing your work. I have no idea if there is a better way to solve this issue because there were no alternatives to go-xz, I don't remember that well but there were some issues when using https://github.com/ulikunitz/xz for this project.

high3eam commented 3 months ago

@osm0sis Any idea how to build (cross compile) for windows/arm64 on Debian?

osm0sis commented 3 months ago

Probably similar to what I explained above for arm, can't help you beyond that.