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

FreeBSD/Arm Static Build? #53

Closed
bradleyf opened this issue Feb 14, 2021 · 16 comments · Fixed by #66
Closed

FreeBSD/Arm Static Build? #53

bradleyf opened this issue Feb 14, 2021 · 16 comments · Fixed by #66
Assignees
Labels
enhancement New feature or request

Comments

@bradleyf
Copy link

Looking to make this work on a Netgate SG-3100
[https://store.netgate.com/SG-3100.aspx]

@synfinatic
Copy link
Owner

Yeah, that would be nice. Unfortunately, cross-compiling on FreeBSD is stupid hard it seems... at least a lot harder than on most Linux distros. Anyways, if you know how to cross compile on FreeBSD or how to get Qemu working on MacOS with FreeBSD/ARM that would help a lot. Otherwise, honestly, this issue probably going to just sit here.

@synfinatic
Copy link
Owner

@jrc2139
Copy link

jrc2139 commented Aug 3, 2021

managed to cross compile freebsd 12.2 arm64 via qemu!

followed: freebsd qemu wiki
downloaded: freebsd 12.2 arm64

# terminal 1
$ brew install qemu telnet
$ qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt  \
        -bios edk2-aarch64-code.fd -serial telnet::4444,server -nographic \
        -drive if=none,file=~/Downloads/FreeBSD-12.2-RELEASE-arm64-aarch64.qcow2,id=hd0 \
        -device virtio-blk,drive=hd0 \
        -device virtio-net,netdev=net0 \
        -netdev user,id=net0
# terminal 2
$ telnet localhost 4444
$ pkg install git gmake libpcap go
$ git clone https://github.com/synfinatic/udp-proxy-2020.git
$ cd udp-proxy-2020
$ CGO_ENABLED=1
$ go build -o udp-proxy-2020 cmd/*.go
$ scp udp-proxy-2020 root@router.ip

thanks for this great project!

@synfinatic
Copy link
Owner

Neat. Thank you @jrc2139 . I'll see if I can take this and make regular FreeBSD/arm releases.

@jrc2139
Copy link

jrc2139 commented Aug 4, 2021

Neat. Thank you @jrc2139 . I'll see if I can take this and make regular FreeBSD/arm releases.

thanks! i did come across some docker qemu options.. but i had already spent so much time trying other things, i just wanted to get it working 😅

@bradleyf
Copy link
Author

bradleyf commented Aug 4, 2021

@jrc2139: Would you please post your binary so I can try it?

@jrc2139
Copy link

jrc2139 commented Aug 5, 2021

@jrc2139: Would you please post your binary so I can try it?

freedbsd12.2_arm64.zip

@bradleyf
Copy link
Author

bradleyf commented Aug 5, 2021

@jrc2139: Thank you!

@bradleyf
Copy link
Author

bradleyf commented Aug 5, 2021

@jrc2139: Unfortunately I'm getting "./udp-proxy-2020: Exec format error. Binary file not executable"

I'm trying it on a Netgate SG-3100 running pfSense+ 21.05-RELEASE (arm) on an ARM Cortex-A9 r4p1 running FreeBSD 12.2-STABLE. The ARM Cortex-A9 is a 32 bit processor, so that's the problem. Could you generate a 32-bit build?

@jrc2139
Copy link

jrc2139 commented Aug 5, 2021

@jrc2139: Unfortunately I'm getting "./udp-proxy-2020: Exec format error. Binary file not executable"

I'm trying it on a Netgate SG-3100 running pfSense+ 21.05-RELEASE (arm) on an ARM Cortex-A9 r4p1 running FreeBSD 12.2-STABLE. The ARM Cortex-A9 is a 32 bit processor, so that's the problem. Could you generate a 32-bit build?

did you give my instructions a try? just download the arm flavor of freebsd 12.2

@bradleyf
Copy link
Author

bradleyf commented Aug 5, 2021

@jrc2139 : I'm not able to do that. I'd need somebody to build it for 32 bit ARM. Here is the link for qemu recipies for armv7
https://wiki.freebsd.org/QemuRecipes
And use the Pandaboard ISO from Here: https://download.freebsd.org/ftp/releases/arm/armv7/ISO-IMAGES/12.1/
(because it's based on the Cortex-A9)

@jrc2139
Copy link

jrc2139 commented Aug 5, 2021

@jrc2139 : I'm not able to do that. I'd need somebody to build it for 32 bit ARM. Here is the link for qemu recipies for armv7
https://wiki.freebsd.org/QemuRecipes
And use the Pandaboard ISO from Here: https://download.freebsd.org/ftp/releases/arm/armv7/ISO-IMAGES/12.1/
(because it's based on the Cortex-A9)

oh that's a bummer that there's no vm-image for arm

@synfinatic
Copy link
Owner

synfinatic commented Sep 29, 2021

Okay, I have some binaries for testing:

The binaries from this comment have been deleted. Please download from the official releases tab on github.

synfinatic added a commit that referenced this issue Sep 29, 2021
Add support for building FreeBSD binaries targeting:
- ARM64 (aarch64)
- ARMv6
- ARMv7

Fixes: #53
@bradleyf
Copy link
Author

bradleyf commented Sep 29, 2021 via email

synfinatic added a commit that referenced this issue Sep 29, 2021
Add support for building FreeBSD binaries targeting:
- ARM64 (aarch64)
- ARMv6
- ARMv7

Fixes: #53
@synfinatic synfinatic self-assigned this Sep 29, 2021
@synfinatic synfinatic added the enhancement New feature or request label Sep 29, 2021
@bradleyf
Copy link
Author

bradleyf commented Sep 29, 2021 via email

@synfinatic
Copy link
Owner

glad to hear it!

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

Successfully merging a pull request may close this issue.

3 participants