summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/.cargo/config8
-rw-r--r--kernel/Cargo.toml3
-rwxr-xr-xkernel/run41
3 files changed, 21 insertions, 31 deletions
diff --git a/kernel/.cargo/config b/kernel/.cargo/config
index 4a80025..520097b 100644
--- a/kernel/.cargo/config
+++ b/kernel/.cargo/config
@@ -2,5 +2,9 @@
target = "x86_64-uff.json"
rustflags = ["-Clink-arg=-r","-Clink-dead-code"]
-[target.'cfg(target_os = "none")']
-runner = "./run test -serial -test"
+[target.'cfg(all(target_os = "none", feature = "testing_qemu"))']
+runner = "./run -test -serial"
+
+[target.'cfg(all(target_os = "none", not(feature = "testing_qemu")))']
+runner = "./run -test"
+
diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml
index 1baefdb..75f5503 100644
--- a/kernel/Cargo.toml
+++ b/kernel/Cargo.toml
@@ -13,6 +13,9 @@ harness = false
name = "stack_overflow"
harness = false
+[features]
+testing_qemu = []
+
[package.metadata.cargo-xbuild]
sysroot_path = "target/sysroot"
diff --git a/kernel/run b/kernel/run
index 8c52bd9..a1add1b 100755
--- a/kernel/run
+++ b/kernel/run
@@ -8,7 +8,7 @@ onerr() {
trap onerr ERR
name="uff"
-build_mode=release
+build_mode=debug
action=help
target=x86_64
test_mode=false
@@ -28,19 +28,16 @@ function define_vars() {
define_vars
print_help() {
- echo "usage: $0 (options) [action]"
+ echo "usage: $0 (options) [Path]"
+ echo " build and lauch the iso in qemu"
+ echo
echo "options:"
echo " -name=<str> set application name (standard: $name)"
echo " -mode=<str> set build mode (standard: $build_mode)"
echo " -target=<str> set target (standard: $target)"
echo " -test enable test mode (standard: disabled)"
echo " -serial enable serial mode (standard: disabled)"
- echo
- echo "actions:"
- echo " build build the iso"
- echo " run build and lauch the iso in qemu"
- echo " test build iso in test mode and run it in qemu"
- echo " help show this help message"
+ echo " -help show this help message"
exit
}
@@ -76,14 +73,6 @@ build() {
if test ! -d "$iso_path/isofiles"; then
prepare_iso
fi
- #if $test_mode; then
- # RUSTFLAGS="-Clink-arg=-r -Clink-dead-code" cargo xtest --no-run
- #else
- # cargo xbuild
- #fi
- if ! $test_mode; then
- cargo xbuild "--$build_mode"
- fi
build_iso
}
@@ -93,9 +82,9 @@ run() {
qemu="qemu-system-x86_64 -cdrom $iso_path/$name.iso"
if $test_mode; then
qemu="$qemu -device isa-debug-exit,iobase=0xf4,iosize=0x04 -serial stdio -no-reboot "
- if $serial_mode; then
- qemu="$qemu -display none"
- fi
+ fi
+ if $serial_mode; then
+ qemu="$qemu -display none"
fi
$qemu
case "$?" in
@@ -122,21 +111,15 @@ for arg in "$@"; do
test_mode=true; define_vars;;
-serial)
serial_mode=true; define_vars;;
- "run") action=run;;
- "build") action=build;;
- "test") action=test;;
- "help") action=help;;
+ -help)
+ print_help;;
*)
# echo "warn: ignoring unknown option '$arg'"
kernel_libary=$arg;;
esac
done
-case "$action" in
- "help") print_help;;
- "build") build;;
- "test") test_mode=true; build; run;;
- "run") build; run;;
-esac
+build
+run
echo -e "\x1b[1;32mdone\x1b[m"