Move toolchain to VirtualBox. qemu is too restrictive :/

This commit is contained in:
Curle 2020-09-29 01:36:05 +01:00
parent 81313cef42
commit 5ad73b7046
Signed by: TheCurle
GPG Key ID: 5942F13718443F79
5 changed files with 20 additions and 51 deletions

View File

@ -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
)

18
post.sh Normal file
View File

@ -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

0
init.sh → pre.sh Executable file → Normal file
View File

1
run.bat Normal file
View File

@ -0,0 +1 @@
vboxmanage startvm "Chroma"

View File

@ -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