aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-01-12 22:45:32 +0100
committerMarvin Borner2020-01-12 22:45:32 +0100
commit65f64cbd57d6aaf1a2c25613a7cdb2dbafb5589f (patch)
tree3d503eec6aa1dcc65f27e10ca1184ee1d3441417
parent0579330b3999c28a843688dac08f4c712685dbdf (diff)
Improved installation boot && test
-rw-r--r--.github/workflows/build.yml2
-rwxr-xr-xrun26
-rw-r--r--src/kernel/fs/install.c3
3 files changed, 27 insertions, 4 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 231b257..90e7cfa 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -16,6 +16,8 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libcloog-isl-dev libisl-0.18-dev curl nasm genisoimage qemu qemu-kvm mtools
- name: Build
run: sh run build
+ - name: Test install
+ run: sh run image
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
diff --git a/run b/run
index da8beac..bc97abf 100755
--- a/run
+++ b/run
@@ -4,11 +4,16 @@ mode="${1}"
network="rtl8139"
qemu_with_flags() {
- SDL_VIDEO_X11_DGAMOUSE=0 qemu-system-i386 -enable-kvm -cpu host -no-reboot -vga std -smp "$(nproc)" -serial stdio -rtc base=localtime -m 256M -net nic,model=${network},macaddr=42:42:42:42:42:42 -net user "$@"
+ if [ "${mode}" = "image" ] || [ "${mode}" = "image_debug" ]; then
+ # TODO: Find out why kvm install is incredibly slow
+ SDL_VIDEO_X11_DGAMOUSE=0 qemu-system-i386 -no-reboot -vga std -smp "$(nproc)" -serial mon:stdio -rtc base=localtime -m 256M -net nic,model=${network},macaddr=42:42:42:42:42:42 -net user "$@"
+ else
+ SDL_VIDEO_X11_DGAMOUSE=0 qemu-system-i386 -enable-kvm -cpu host -no-reboot -vga std -smp "$(nproc)" -serial stdio -rtc base=localtime -m 256M -net nic,model=${network},macaddr=42:42:42:42:42:42 -net user "$@"
+ fi
}
compile_with_flags() {
- if [ "${mode}" = "image" ]; then
+ if [ "${mode}" = "image" ] || [ "${mode}" = "image_debug" ]; then
i686-elf-gcc -std=gnu99 -ffreestanding -nostdlib -Wall -Wextra -Wno-unused-parameter -D INSTALL_MELVIX "$@"
else
i686-elf-gcc -std=gnu99 -ffreestanding -nostdlib -Wall -Wextra -Wno-unused-parameter "$@"
@@ -129,11 +134,21 @@ make_debug() {
qemu_with_flags -s -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw
}
-make_image() {
+make_image_debug() {
qemu_with_flags -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw
qemu_with_flags -drive file=./build/hdd10M.img,format=raw
}
+make_image() {
+ start=$(date +%s.%N)
+ qemu_with_flags -nographic -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw >install.log
+ end=$(date +%s.%N)
+ cat install.log
+ printf "[LOG END]\n\n"
+ tail install.log | grep -q "Installation successful!" && echo Booted and installed within "$(echo "$end - $start" | bc -l)" seconds || echo Installation failed!
+ rm install.log
+}
+
make_clean() {
rm -rf ./build ./iso
}
@@ -153,6 +168,11 @@ elif [ "${mode}" = "test" ]; then
make_test
elif [ "${mode}" = "debug" ]; then
make_debug
+elif [ "${mode}" = "image_debug" ]; then
+ make_cross
+ make_clean
+ make_build
+ make_image_debug
elif [ "${mode}" = "image" ]; then
make_cross
make_clean
diff --git a/src/kernel/fs/install.c b/src/kernel/fs/install.c
index 8a687d7..af148c8 100644
--- a/src/kernel/fs/install.c
+++ b/src/kernel/fs/install.c
@@ -6,6 +6,7 @@
#include <kernel/lib/stdlib.h>
#include <kernel/acpi/acpi.h>
#include <kernel/lib/stdio.h>
+#include <kernel/timer/timer.h>
void install_melvix()
{
@@ -83,7 +84,7 @@ void install_melvix()
kfree(font_e);
info("Installation successful!");
- serial_printf("Installation successful!\nRebooting...");
+ serial_printf("Installation successful! (in %d ticks)", get_time());
// timer_wait(200);
acpi_poweroff();
halt_loop();