summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authornatrixaeria <upezu@student.kit.edu>2019-10-24 18:54:12 +0200
committernatrixaeria <upezu@student.kit.edu>2019-10-24 18:54:12 +0200
commit579d96f06f94a77363d467789ff95fcf5ed281b8 (patch)
tree0c847d3f300f4afd023c4fa5f31c940155a7d30d /kernel
parenteeaeee4b78982692dac2642b1fbf8cdfd5cd3513 (diff)
Build things only if necessary in build script
Diffstat (limited to 'kernel')
-rwxr-xr-xkernel/build.sh30
1 files changed, 21 insertions, 9 deletions
diff --git a/kernel/build.sh b/kernel/build.sh
index 530c253..919951b 100755
--- a/kernel/build.sh
+++ b/kernel/build.sh
@@ -30,7 +30,10 @@ build_kernel_elf() {
cleanup_temp
}
-build_kernel_iso_from_elf() {
+build_kernel_iso() {
+ if test ! -e $TARGET_PATH/kernel.bin; then
+ build_kernel_elf
+ fi
create_target
mkdir $TMP_PATH/isofiles &> /dev/null
mkdir $TMP_PATH/isofiles/boot &> /dev/null
@@ -38,17 +41,24 @@ build_kernel_iso_from_elf() {
cp $TARGET_PATH/kernel.bin $TMP_PATH/isofiles/boot &> /dev/null
cp $GRUB_CFG_PATH $TMP_PATH/isofiles/boot/grub/grub.cfg &> /dev/null
grub-mkrescue -d /usr/lib/grub/i386-pc -o $TARGET_PATH/uff.iso $TMP_PATH/isofiles
-}
-
-build_kernel_iso() {
- build_kernel_elf
- build_kernel_iso_from_elf
+ cleanup_temp
}
build_init() {
create_target
}
+build_launch() {
+ qemu-system-x86_64 -cdrom $TARGET_PATH/uff.iso
+}
+
+build_run() {
+ if test ! -e $TARGET_PATH/uff.iso; then
+ build_kernel_iso
+ fi
+ build_launch
+}
+
build_clean() {
remove_target
}
@@ -62,9 +72,10 @@ not_exec=true
for arg in "$@"; do
case "$arg" in
"kernel-elf") build_kernel_elf;;
- "kernel-iso-from-elf") build_kernel_iso_from_elf;;
"kernel-iso") build_kernel_iso;;
"init") build_init;;
+ "launch") build_launch;;
+ "run") build_run;;
"clean") build_clean;;
"all") build_all;;
*)
@@ -80,10 +91,11 @@ print_help() {
echo "options: "
echo " init initialise directory"
echo " clean cleanup binaries"
+ echo " launch launch iso in qemu"
+ echo " run creates iso if necessary and runs it in qemu"
echo
echo " kernel-elf build the kernel-elf"
- echo " kernel-iso-from-elf build the kernel-iso from an existing kernel-elf"
- echo " kernel-iso build the kernel-elf and the kernel-iso"
+ echo " kernel-iso build the kernel-elf if necessary and the kernel-iso"
echo " all build kernel"
}