forked from inferno-os/inferno-os
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild-linux-arm64.sh
More file actions
executable file
·95 lines (83 loc) · 2.4 KB
/
build-linux-arm64.sh
File metadata and controls
executable file
·95 lines (83 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
#
# Build script for InferNode on Linux ARM64 (Jetson, Raspberry Pi 4, etc.)
#
# This builds a headless Inferno emulator for ARM64 Linux systems.
#
# Prerequisites:
# - GCC (build-essential)
# - make (optional, we use mk)
#
# Usage:
# ./build-linux-arm64.sh
#
set -e
ROOT="$(cd "$(dirname "$0")" && pwd)"
export ROOT
echo "=== InferNode Linux ARM64 Build ==="
echo "ROOT=$ROOT"
echo ""
# Check for ARM64
ARCH=$(uname -m)
if [[ "$ARCH" != "aarch64" ]]; then
echo "Warning: This script is intended for ARM64 systems (detected: $ARCH)"
echo "You may need to cross-compile or adjust the build configuration."
echo ""
fi
# Set up environment for Linux ARM64
export SYSHOST=Linux
export OBJTYPE=arm64
export PATH="$ROOT/Linux/arm64/bin:$PATH"
echo "Building for: SYSHOST=$SYSHOST OBJTYPE=$OBJTYPE"
echo ""
# Check if mk exists
if [[ ! -x "$ROOT/Linux/arm64/bin/mk" ]]; then
echo "Note: mk not found in $ROOT/Linux/arm64/bin/"
echo "You may need to bootstrap the build tools first."
echo ""
echo "To bootstrap on a working system:"
echo " 1. Build mk from utils/mk/ using make"
echo " 2. Copy to Linux/arm64/bin/"
echo ""
# Try to build mk if we have a working build system
if command -v make &> /dev/null && [[ -f "$ROOT/utils/mk/Makefile" ]]; then
echo "Attempting to bootstrap mk..."
mkdir -p "$ROOT/Linux/arm64/bin"
cd "$ROOT/utils/mk"
make clean 2>/dev/null || true
make CC=gcc CFLAGS="-I$ROOT/Linux/arm64/include -I$ROOT/include"
cp mk "$ROOT/Linux/arm64/bin/"
echo "mk bootstrapped successfully"
cd "$ROOT"
else
echo "Please bootstrap mk manually and re-run this script."
exit 1
fi
fi
echo "=== Building Libraries ==="
# Build order matters - dependencies first
for lib in lib9 libbio libmp libsec libmath libfreetype libmemdraw libmemlayer libdraw libinterp libkeyring; do
if [[ -d "$ROOT/$lib" ]]; then
echo "Building $lib..."
cd "$ROOT/$lib"
mk install || { echo "Error: $lib build failed" >&2; exit 1; }
fi
done
echo ""
echo "=== Building Emulator (headless) ==="
cd "$ROOT/emu/Linux"
# Use mkfile-g for headless build
if [[ -f mkfile-g ]]; then
mk -f mkfile-g
else
mk
fi
echo ""
echo "=== Build Complete ==="
echo ""
echo "Emulator built: $ROOT/emu/Linux/o.emu"
echo ""
echo "To run:"
echo " cd $ROOT"
echo " ./emu/Linux/o.emu -r."
echo ""