-
Notifications
You must be signed in to change notification settings - Fork 108
Developing for ELKS on Windows
You can clone and compile ELKS inside WSL2 (Windows Subsystem for Linux). It works perfectly.
Example: ../cross/bin/ia16-elf-gcc ./vgatest.c -o vgatest -melks-libc -mcmodel=small
You can do the compilation inside WSL2 and access your C files with your favorite Windows editor by using: \\wsl.localhost\
or \\wsl$
.
Using VS Code with WSL2 plugin to run GCC as explained here: https://code.visualstudio.com/docs/cpp/config-wsl. If you can not run the step code .
then you can try /mnt/c/users/YOUR_USER/AppData/Local/Programs/Microsoft\ VS\ Code/bin/code .
. You can use "Open integrated terminal" in VS Code and call Make or your compile script in WSL2. Or you can try to further configure VS Code using the files in .vscode
folder to use the ia16-elf-gcc
(not tried yet). After the initial installation and code .
in WSL2 you should be able to do Edit/Compile without leaving VS Code on Windows. You do not need to start WSL2 either as it will be automatically started by VS Code.
Using MS Visual Studio with remote execution plugin through SSH: https://learn.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer
You can copy an ELKS boot image from inside WSL to your Windows drive using: cp ./image/fd1440-fat.img /mnt/c/Temp
inside WSL. The alternative is to do it inside Windows:
net use y: \\wsl$\Ubuntu-20.04
copy y:\home\YOUR_USER\elks\image\fd1440-fat.img c:\temp
After compilation you can use the following script that will take a newly created 1440-fat ELKS image, mount it, add your executable (vgatest), unmount the image and store it to c:\Temp
.
rm /mnt/c/Temp/fd1440-fat.img
sudo mount -t vfat ../image/fd1440-fat.img /mnt/elksimage
sudo cp vgatest /mnt/elksimage/
sudo umount /mnt/elksimage
cp ../image/fd1440-fat.img /mnt/c/Temp
Note that you will need to adapt this script. Next you can either use qemu to boot the image or write it to a floppy drive.
You can also directly mount the image that is already in c:\test
and add your executable to it:
sudo mount -t vfat /mnt/c/Temp/fd1440-fat.img /mnt/elksimage
sudo cp vgatest /mnt/elksimage/
sudo umount /mnt/elksimage
Download the 64 bit version of QEMU: https://qemu.weilnetz.de/w64/
Next start the image that contains your newly compiled executable from Windows in 386 mode:
C:\Progra~1\qemu\qemu-system-i386w.exe -fda c:\temp\fd1440-fat.img
Enter as user "root" and no password.
You can start your executable with /vgatest
.