diff --git a/CMakeLists.txt b/CMakeLists.txt index 62ce278..141b7df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,5 @@ target_link_options(kernel PRIVATE -T linker.ld -ffreestanding -O2 -nostdlib -no add_custom_command( TARGET kernel POST_BUILD - COMMAND cp ${CMAKE_SOURCE_DIR}/kernel ${CMAKE_SOURCE_DIR}/img/boot/exe - COMMAND ${CMAKE_SOURCE_DIR}/mkbootimg chroma.json chroma.img + COMMAND bash post.sh ) \ No newline at end of file diff --git a/post.sh b/post.sh new file mode 100644 index 0000000..8c1e63a --- /dev/null +++ b/post.sh @@ -0,0 +1,18 @@ +cp kernel img/boot/exe +echo "Performing post-boot actions:" +echo "Creating raw img file for writing to a drive:" +./mkbootimg.exe chroma.json chroma.img # for linux remove the .exe + +echo "Checking for VirtualBox management tools" +if [ -x "$(command -v VBoxManage)" ]; then +echo " VBoxManage found.. integrating." +echo " Clearing VirtualBox cache:" +VBoxManage storageattach Chroma --port 0 --storagectl AHCI --medium none # removing a drive in virtualbox = attaching nothing +VBoxManage closemedium disk --delete "`pwd`/chroma.vdi" # remove the existing .vdi image from the registry so we can overwrite it +echo " Creating new VirtualBox VDI image:" +VBoxManage convertfromraw chroma.img --format VDI chroma.vdi # generate the new vdi from the img +echo " Attaching image to the VM." +VBoxManage storageattach Chroma --port 0 --storagectl AHCI --type hdd --medium "`pwd`/chroma.vdi" # attach the new vdi to the vm so we can run it +echo " VirtualBox integrations complete. You may execute run.sh to run your VirtualBox VM." +fi + diff --git a/init.sh b/pre.sh old mode 100755 new mode 100644 similarity index 100% rename from init.sh rename to pre.sh diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..2695248 --- /dev/null +++ b/run.bat @@ -0,0 +1 @@ +vboxmanage startvm "Chroma" diff --git a/setup.bat b/setup.bat deleted file mode 100644 index 3941479..0000000 --- a/setup.bat +++ /dev/null @@ -1,49 +0,0 @@ -# ignore this as it will be deprecated video/tty.c - - - -cd chroma - -# compile all the tings -x86_64-elf-gcc -ffreestanding -O2 -Wall -Wextra -c^ - -I inc^ - kernel.c video/draw.c video/print.c^ - system/memory/paging.c system/memory/physmem.c^ - system/drivers/keyboard.c^ - system/cpu.c system/rw.c system/serial.c - -#gcc will complain about sse instrs if we use intr attr without this flag -x86_64-elf-gcc -ffreestanding -O2 -Wall -Wextra -mgeneral-regs-only -c^ - -I inc^ - system/interrupts.c - - - - -cd .. - -# get our font for linking -x86_64-elf-ld -r -b binary -o font.o font.psf - -# link all the files -x86_64-elf-gcc -T linker.ld -ffreestanding -O2 -nostdlib -lgcc^ - chroma/kernel.o chroma/draw.o chroma/print.o^ - chroma/paging.o chroma/physmem.o^ - chroma/keyboard.o^ - chroma/cpu.o chroma/rw.o chroma/serial.o^ - chroma/interrupts.o^ - font.o^ - -o kernel.elf - -# generate our iso image :D -# copy the elf to where grub wants it -# and delete any old ones for good measure first - -rm iso/boot/kernel.elf -rm chroma.iso -cp kernel.elf iso/boot/initrd - -xorriso -as mkisofs -U -no-emul-boot -b boot/bootloader -hide boot/bootloader -V "Chroma v4a" -iso-level 3 -o chroma.iso iso/ - - -pause \ No newline at end of file