|
| 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