wip: refactor build system
Reduce redundancy, make naming more clear. Add ttt target.
This commit is contained in:
parent
a1b62fbd54
commit
c6e466e914
|
@ -3,6 +3,8 @@
|
|||
#
|
||||
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
#
|
||||
# Global workspace configuration
|
||||
#
|
||||
[config]
|
||||
min_version = "0.32.0"
|
||||
default_to_workspace = true
|
||||
|
@ -84,30 +86,36 @@ KERNEL_BIN = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/nucleus.bin"
|
|||
CHAINBOOT_SERIAL = "/dev/tty.SLAB_USBtoUART"
|
||||
CHAINBOOT_BAUD = 115200
|
||||
|
||||
#
|
||||
# === Base reusable commands ===
|
||||
#
|
||||
[tasks.default]
|
||||
alias = "all"
|
||||
|
||||
[tasks.all]
|
||||
dependencies = ["kernel-binary"]
|
||||
dependencies = ["kernel-binary", "chainboot", "chainofcommand", "ttt"]
|
||||
|
||||
[tasks.modules]
|
||||
command = "cargo"
|
||||
args = ["modules", "tree"]
|
||||
|
||||
[tasks.do-build]
|
||||
# Disable build in the root by default.
|
||||
[tasks.build]
|
||||
clear = true
|
||||
alias = "empty"
|
||||
|
||||
# Run a target build with current platform configuration.
|
||||
[tasks.build-target] # do-build
|
||||
command = "cargo"
|
||||
args = ["build", "@@split(PLATFORM_TARGET, )", "@@split(RUST_STD, )", "--release"]
|
||||
|
||||
[tasks.build]
|
||||
disabled = true
|
||||
|
||||
[tasks.build-device]
|
||||
env = { "TARGET_FEATURES" = "${TARGET_BOARD}" }
|
||||
run_task = "do-build"
|
||||
run_task = "build-target"
|
||||
|
||||
[tasks.build-qemu]
|
||||
env = { "TARGET_FEATURES" = "${QEMU_FEATURES}" }
|
||||
run_task = "do-build"
|
||||
run_task = "build-target"
|
||||
|
||||
[tasks.qemu-runner]
|
||||
dependencies = ["build-qemu", "kernel-binary"]
|
||||
|
@ -120,8 +128,9 @@ script = [
|
|||
]
|
||||
|
||||
[tasks.qemu]
|
||||
disabled = true
|
||||
alias = "empty"
|
||||
|
||||
# @todo Should be expand-target (since it's not for a host platform)
|
||||
[tasks.expand]
|
||||
env = { "TARGET_FEATURES" = "" }
|
||||
command = "cargo"
|
||||
|
@ -145,7 +154,7 @@ args = ["clippy", "@@split(PLATFORM_TARGET, )", "@@split(RUST_STD, )", "@@remove
|
|||
# These tasks are written in cargo-make's own script to make it portable across platforms (no `basename` on Windows)
|
||||
|
||||
## Copy and prepare a given ELF file. Convert to binary output format.
|
||||
[tasks.custom-binary]
|
||||
[tasks.build-custom-binary]
|
||||
env = { "BINARY_FILE" = "${BINARY_FILE}" }
|
||||
script_runner = "@duckscript"
|
||||
script = [
|
||||
|
@ -223,7 +232,26 @@ script = [
|
|||
"diskutil ejectAll ${VOLUME}"
|
||||
]
|
||||
|
||||
#
|
||||
# Per-workspace commands, disabled in the root by efault.
|
||||
#
|
||||
# Tasks for chainboot
|
||||
[tasks.chainboot]
|
||||
dependencies = ["build-device", "kernel-binary"]
|
||||
command = "echo"
|
||||
args = ["\n***===***\n", "🏎️ Run the following command in your terminal:\n", "🏎️ ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/debug/chainofcommand ${CHAINBOOT_SERIAL} ${CHAINBOOT_BAUD} --kernel ${KERNEL_BIN}\n", "***===***\n\n"]
|
||||
|
||||
[tasks.cb-eject]
|
||||
alias = "empty"
|
||||
|
||||
# Tasks for chainofcommand
|
||||
[tasks.chainofcommand]
|
||||
alias = "empty"
|
||||
|
||||
# Tasks for ttt
|
||||
[tasks.ttt]
|
||||
alias = "empty"
|
||||
|
||||
# Tasks for nucleus
|
||||
[tasks.hopper]
|
||||
alias = "empty"
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
#
|
||||
# SPDX-License-Identifier: BlueOak-1.0.0
|
||||
#
|
||||
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
#
|
||||
# Build chainboot binary
|
||||
#
|
||||
[env]
|
||||
CHAINBOOT_ELF = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${TARGET}/release/chainboot"
|
||||
CHAINBOOT_BIN = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/chainboot.bin"
|
||||
|
||||
[tasks.kernel-binary]
|
||||
[tasks.build-kernel-binary]
|
||||
env = { "BINARY_FILE" = "${CHAINBOOT_ELF}" }
|
||||
run_task = "custom-binary"
|
||||
|
||||
[tasks.chainofcommand]
|
||||
disabled = true
|
||||
|
||||
[tasks.hopper]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-nucleus]
|
||||
disabled = true
|
||||
run_task = "build-custom-binary"
|
||||
|
||||
[tasks.zellij-cb]
|
||||
env = { "KERNEL_BIN" = "${CHAINBOOT_BIN}", "QEMU_OPTS" = "${QEMU_OPTS} ${QEMU_DISASM_OPTS}" }
|
||||
|
@ -23,15 +21,6 @@ run_task = "zellij-config"
|
|||
env = { "KERNEL_BIN" = "${CHAINBOOT_BIN}", "QEMU_OPTS" = "${QEMU_OPTS} ${QEMU_DISASM_OPTS} ${QEMU_GDB_OPTS}", "TARGET_BOARD" = "rpi3", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
|
||||
run_task = "zellij-config"
|
||||
|
||||
[tasks.nm]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-cb]
|
||||
env = { "QEMU_RUNNER_OPTS" = "${QEMU_DISASM_OPTS} -serial pty", "KERNEL_BIN" = "${CHAINBOOT_BIN}", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
|
||||
extend = "qemu-runner"
|
||||
|
@ -40,18 +29,15 @@ extend = "qemu-runner"
|
|||
env = { "QEMU_RUNNER_OPTS" = "${QEMU_DISASM_OPTS} ${QEMU_GDB_OPTS} -serial pty", "KERNEL_BIN" = "${CHAINBOOT_BIN}", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
|
||||
extend = "qemu-runner"
|
||||
|
||||
[tasks.gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb-cb]
|
||||
dependencies = ["build", "kernel-binary", "gdb-config"]
|
||||
dependencies = ["build", "build-kernel-binary", "gdb-config"]
|
||||
env = { "RUST_GDB" = "${GDB}" }
|
||||
script = [
|
||||
"exec < /dev/tty && rust-gdb -x ${GDB_CONNECT_FILE} ${CHAINBOOT_ELF}"
|
||||
]
|
||||
|
||||
[tasks.sdcard]
|
||||
dependencies = ["build", "kernel-binary"]
|
||||
dependencies = ["build", "build-kernel-binary"]
|
||||
script_runner = "@duckscript"
|
||||
script = [
|
||||
'''
|
||||
|
@ -62,4 +48,8 @@ script = [
|
|||
]
|
||||
|
||||
[tasks.cb-eject]
|
||||
clean = true
|
||||
alias = "cb-eject-chainboot"
|
||||
|
||||
[tasks.cb-eject-chainboot]
|
||||
dependencies = ["sdeject"]
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
#
|
||||
# SPDX-License-Identifier: BlueOak-1.0.0
|
||||
#
|
||||
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
#
|
||||
# Build chainofcommand tool
|
||||
#
|
||||
[tasks.build]
|
||||
command = "cargo"
|
||||
args = ["build"]
|
||||
|
||||
[tasks.chainofcommand]
|
||||
dependencies = ["build"]
|
||||
|
||||
[tasks.build-device]
|
||||
disabled = true
|
||||
alias = "build"
|
||||
|
||||
[tasks.test]
|
||||
command = "cargo"
|
||||
|
@ -15,42 +19,3 @@ args = ["test"]
|
|||
[tasks.clippy]
|
||||
command = "cargo"
|
||||
args = ["clippy", "--", "-D", "warnings"]
|
||||
|
||||
[tasks.hopper]
|
||||
disabled = true
|
||||
|
||||
[tasks.kernel-binary]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-nucleus]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-cb-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.nm]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.sdcard]
|
||||
disabled = true
|
||||
|
||||
[tasks.cb-eject]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb-cb]
|
||||
disabled = true
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
[tasks.qemu-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.hopper]
|
||||
disabled = true
|
||||
|
||||
[tasks.kernel-binary]
|
||||
disabled = true
|
||||
#
|
||||
# SPDX-License-Identifier: BlueOak-1.0.0
|
||||
#
|
||||
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
#
|
||||
# Build nucleus library
|
||||
#
|
||||
# No special configuration needed.
|
||||
|
|
|
@ -3,48 +3,35 @@
|
|||
#
|
||||
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
#
|
||||
[tasks.kernel-binary]
|
||||
# Build nucleus
|
||||
#
|
||||
[tasks.build-kernel-binary]
|
||||
env = { "BINARY_FILE" = "${KERNEL_ELF}" }
|
||||
run_task = "custom-binary"
|
||||
run_task = "build-custom-binary"
|
||||
|
||||
[tasks.qemu]
|
||||
clear = true
|
||||
alias = "qemu-kernel"
|
||||
|
||||
[tasks.qemu-kernel]
|
||||
env = { "QEMU_RUNNER_OPTS" = "${QEMU_SERIAL_OPTS}", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
|
||||
extend = "qemu-runner"
|
||||
disabled = false
|
||||
|
||||
[tasks.qemu-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-gdb]
|
||||
env = { "QEMU_RUNNER_OPTS" = "${QEMU_SERIAL_OPTS} ${QEMU_DISASM_OPTS} ${QEMU_GDB_OPTS}", "TARGET_DTB" = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/targets/bcm2710-rpi-3-b-plus.dtb" }
|
||||
extend = "qemu-runner"
|
||||
|
||||
[tasks.qemu-cb-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.chainofcommand]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-nucleus]
|
||||
env = { "KERNEL_BIN" = "${KERNEL_BIN}" }
|
||||
run_task = "zellij-config"
|
||||
|
||||
[tasks.zellij-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-cb-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb]
|
||||
dependencies = ["build", "kernel-binary", "gdb-config"]
|
||||
dependencies = ["build", "build-kernel-binary", "gdb-config"]
|
||||
env = { "RUST_GDB" = "${GDB}" }
|
||||
script = [
|
||||
"exec < /dev/tty && pipx run gdbgui -g \"rust-gdb -x ${GDB_CONNECT_FILE} ${KERNEL_ELF}\""
|
||||
]
|
||||
|
||||
[tasks.gdb-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.install-nm]
|
||||
install_crate = { crate_name = "cargo-binutils", binary = "rust-nm", test_arg = ["--help"] }
|
||||
|
||||
|
@ -57,22 +44,23 @@ script = [
|
|||
"${NM} ${KERNEL_ELF} | sort -k 1 | rustfilt"
|
||||
]
|
||||
|
||||
[tasks.sdcard]
|
||||
dependencies = ["build", "kernel-binary"]
|
||||
[tasks.sdcard] # kernel-sdcard ?
|
||||
dependencies = ["build", "build-kernel-binary"]
|
||||
script_runner = "@duckscript"
|
||||
script = [
|
||||
'''
|
||||
kernelImage = set "kernel8.img"
|
||||
cp ${KERNEL_BIN} ${VOLUME}/${kernelImage}
|
||||
echo "Copied nucleus to ${VOLUME}/${kernelImage}"
|
||||
echo "Copied nucleus to ${VOLUME}/${kernelImage}" # TODO add emoji
|
||||
'''
|
||||
]
|
||||
|
||||
[tasks.cb-eject]
|
||||
disabled = true
|
||||
|
||||
[tasks.hopper]
|
||||
dependencies = ["build", "kernel-binary"]
|
||||
clear = true
|
||||
alias = "kernel-hopper"
|
||||
|
||||
[tasks.kernel-hopper]
|
||||
dependencies = ["build", "build-kernel-binary"]
|
||||
# The cmd line below causes a bug in hopper, see https://www.dropbox.com/s/zyw5mfx0bepcjb1/hopperv4-RAW-bug.mov?dl=0
|
||||
#"hopperv4 --loader RAW --base-address 0x80000 --entrypoint 0x80000 --file-offset 0 --plugin arm --cpu aarch64 --variant generic --contains-code true --executable ${KERNEL_BIN}"
|
||||
script = [
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
#
|
||||
# SPDX-License-Identifier: BlueOak-1.0.0
|
||||
#
|
||||
# Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
#
|
||||
# Build ttt tool
|
||||
#
|
||||
[tasks.build]
|
||||
clear = true
|
||||
alias = "ttt"
|
||||
|
||||
[tasks.ttt]
|
||||
clear = true
|
||||
alias = "ttt-binary"
|
||||
|
||||
[tasks.ttt-binary]
|
||||
env = { "TARGET_FEATURES" = "${TARGET_BOARD}" }
|
||||
command = "cargo"
|
||||
args = ["build"]
|
||||
|
||||
[tasks.chainofcommand]
|
||||
dependencies = ["build"]
|
||||
|
||||
[tasks.build-device]
|
||||
disabled = true
|
||||
args = ["build", "--features=${TARGET_FEATURES}"]
|
||||
|
||||
[tasks.test]
|
||||
command = "cargo"
|
||||
|
@ -16,41 +26,5 @@ args = ["test"]
|
|||
command = "cargo"
|
||||
args = ["clippy", "--", "-D", "warnings"]
|
||||
|
||||
[tasks.hopper]
|
||||
disabled = true
|
||||
|
||||
[tasks.kernel-binary]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-nucleus]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.zellij-cb-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.nm]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.qemu-cb]
|
||||
disabled = true
|
||||
|
||||
[tasks.sdcard]
|
||||
disabled = true
|
||||
|
||||
[tasks.cb-eject]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb]
|
||||
disabled = true
|
||||
|
||||
[tasks.gdb-cb]
|
||||
disabled = true
|
||||
#[tasks.build-kernel-binary] # Invert this, kernel binary shall depend on ttt-binary availability
|
||||
#dependencies = ["build"]
|
||||
|
|
Loading…
Reference in New Issue