Re: Cross compiling user applications for armv7

Warner Losh <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <CANCZdfotyJ4cGJDpJVpYM_TGuGzAGU-CUaqOaWghxm-t3S3A-A@mail.gmail.com>
OK.

So there's a few things you can do.

On a small scale, you can do a 'make buildenv' in a built FreeBSD src tree.
That will give you a shell you can build your kernel modules in that has
all the env vars set up to get the right compiler, the right kernel tree,
etc. this works well for quick debug cycles to copy the .ko to load /
unload / debug on the target. There's some scripting features along with
this so you can build your 'out of tree' modules with the FreeBSD tree as
part of your build orchestration. I can provide more details if need be.
I've been doing this for years...

On the larger scale, you can use poudriere. It supports cross building
ports with its 'bulk' command. If you can wrap your applications inside of
the ports world, then this works out well. It uses qemu bsd-user to emulate
the armv7 environment, but has special compilers it builds that run amd64
binaries to produce armv7 code by default so the building is usually fast,
just the interpretation of binaries use to build would be slower.

https://wiki.freebsd.org/Ports/BuildingPackagesThroughEmulation has some
data, but it's a bit dated (mips and armv6 have aged out of support, for
example).
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-poudriere-build-system-to-create-packages-for-your-freebsd-servers
and
https://phaq.phunsites.net/2015/10/11/freebsd-on-armv6-cross-compile-performance-optimization-for-poudriere/
provide some good background and might be less data, though less targeted
for what you want to do. Googling variations on 'poudriere cross build' may
yield even more results.

Warner


On Fri, Sep 12, 2025 at 10:47 AM Michał Kruszewski <[email protected]>
wrote:

> FreeBSD riis 14.3-RELEASE FreeBSD 14.3-RELEASE
> releng/14.3-n271432-8c9ce319fef7 GENERIC amd64
>
>
> Regards,
> Michał Kruszewski
>
>
> Sent with Proton Mail <https://proton.me/mail/home> secure email.
>
> On Friday, September 12th, 2025 at 6:40 PM, Warner Losh <[email protected]>
> wrote:
>
>
>
> On Fri, Sep 12, 2025 at 10:19 AM Michał Kruszewski <[email protected]>
> wrote:
>
>> Is there any tutorial on how to cross compile custom user application for
>> armv7?
>> I struggle t find any.
>> Cross compiling the system is pretty easy.
>> However, how can one cross compile custom user application or kernel
>> drivers.
>>
>
> What's your host?
>
> Warner
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.