blob: 71430a42bfc16d4590487a9c7c125032bb0e1e6c (
plain) (
blame)
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
|
#!/usr/bin/env bash
#
# scripts/build.sh — compile the kernel and every external binary.
#
# The only cargo invocation in the project. One pass builds the kernel
# (rsdos.efi) and all /bin binaries (bins/*.efi), which is exactly what
# the system image stages.
#
# Usage:
# ./scripts/build.sh release (default — what the image uses)
# ./scripts/build.sh --debug debug profile (slower guest, GDB symbols)
# ./scripts/build.sh --help
#
# Output:
# target/x86_64-unknown-uefi/<profile>/rsdos.efi kernel
# target/x86_64-unknown-uefi/<profile>/<name>.efi /bin binaries
#
# Typical flow:
# ./scripts/build.sh && ./scripts/run.sh
#
set -euo pipefail
usage() {
awk 'NR > 1 && /^#/ { sub(/^# ?/, ""); print; next } NR > 1 { exit }' "$0"
}
# PROFILE is read by lib.sh (it derives OUT_DIR/KERNEL from it), so parse
# before sourcing.
while [ $# -gt 0 ]; do
case "$1" in
--debug) PROFILE="debug" ;;
--release) PROFILE="release" ;;
--help | -h)
usage
exit 0
;;
*)
echo "build.sh: unknown argument: $1" >&2
exit 1
;;
esac
shift
done
# shellcheck source=lib.sh
source "$(dirname "$0")/lib.sh"
build_all
echo "kernel: $KERNEL"
|