Skip to content

Commit c715412

Browse files
Build native library for freebsd-aarch64
1 parent 8ddaf3a commit c715412

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Next Release (5.15.0)
77

88
Features
99
--------
10+
* [#1578](https://github.com/java-native-access/jna/pull/1578): Add support for FreeBSD aarch64 - [@alexdupre](https://github.com/alexdupre).
1011

1112
Bug Fixes
1213
---------

lib/native/freebsd-aarch64.jar

44.6 KB
Binary file not shown.

www/FreeBSD.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Building JNA for FreeBSD
2+
========================
3+
4+
This recipe was used to build the FreeBSD aarch64 native library on amd64:
5+
6+
```
7+
# Fetch FreeBSD 13.2 image and extract it
8+
wget https://download.freebsd.org/snapshots/VM-IMAGES/13.2-STABLE/aarch64/20231216/FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2.xz
9+
xz -d FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2.xz
10+
11+
# Ensure there is enough space in the image
12+
qemu-img resize FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2 +5G
13+
14+
# Launch aarch64 emulator with downloaded image
15+
qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt \
16+
-bios /usr/lib/u-boot/qemu_arm64/u-boot.bin \
17+
-serial telnet::4444,server -nographic \
18+
-drive if=none,file=PATH_TO_IMAGE/FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2,id=hd0 \
19+
-device virtio-blk-device,drive=hd0 \
20+
-device virtio-net-device,netdev=net0 \
21+
-netdev user,id=net0
22+
23+
# Connect to terminal for emulated system and boot into single user mode with default shell
24+
telnet localhost 4444
25+
26+
# Resize partitions
27+
gpart show /dev/vtbd0
28+
gpart recover /dev/vtbd0
29+
gpart show /dev/vtbd0
30+
gpart resize -i 3 /dev/vtbd0
31+
growfs /
32+
33+
# Exit single user mode (BSD boots to multi-user)
34+
exit
35+
36+
# Login as root
37+
38+
# Install prerequisites - part 1 - java, build system, rsync
39+
pkg install openjdk17 wget automake rsync gmake gcc
40+
# Adjust fstab (optional, only needed if reboot is planned)
41+
# fdesc /dev/fd fdescfs rw 0 0
42+
# proc /proc procfs rw 0 0
43+
44+
# Install prerequisites - part 2 - ant
45+
wget https://dlcdn.apache.org//ant/binaries/apache-ant-1.10.14-bin.zip
46+
unzip apache-ant-1.10.14-bin.zip
47+
48+
# Transfer JNA source code to build environment
49+
rsync -a --exclude=.git USER@BUILD_HOST:src/jnalib/ jnalib/
50+
51+
# Set current date and time (YYYYMMDDHHMM)
52+
date 202312231627
53+
54+
# Build JNA and run unittests
55+
cd jnalib
56+
/root/apache-ant-1.10.14/bin/ant
57+
58+
# Copy jna native library back to host system
59+
60+
```

0 commit comments

Comments
 (0)