-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild_user_program.sh
More file actions
executable file
·47 lines (35 loc) · 930 Bytes
/
Copy pathbuild_user_program.sh
File metadata and controls
executable file
·47 lines (35 loc) · 930 Bytes
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
#!/bin/bash
# KaguOS User Program Builder
# Compiles a user-space .kga source file with kagu_asm -u
# Output goes to build/user.disk
#
# Usage: ./build_user_program.sh <source.kga>
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
cd "$(dirname "$0")"
error() {
echo -e "${RED}ERROR: $1${NC}" >&2
exit 1
}
info() {
echo -e "${GREEN}$1${NC}"
}
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <source.kga>"
echo " Compiles a user-space program for KaguOS."
echo " Output: build/user.disk"
exit 1
fi
SRC="$1"
if [[ ! -f "$SRC" ]]; then
error "Source file not found: $SRC"
fi
if [[ ! -x ./kagu_asm ]]; then
error "kagu_asm not found. Build it first with: cmake --build build/"
fi
info "Compiling user program: $SRC"
./kagu_asm -u "$SRC"
info "Done! User program compiled to: build/user.disk"
info "Copy it to a disk with: ./copy_file_to_disk.sh build/user.disk main.disk <start> <end>"