Skip to content

Developing for ELKS on Windows

toncho11 edited this page Apr 10, 2024 · 35 revisions

You can clone and compile ELKS inside WSL2 (Windows Subsystem for Linux). It works perfectly.

Compile your program in ELKS

Example: ../cross/bin/ia16-elf-gcc ./vgatest.c -o vgatest -melks-libc -mcmodel=small

Edit source code

Mode 1

You can do the compilation inside WSL2 and access your C files with your favorite Windows editor by using: \\wsl.localhost\ or \\wsl$.

Mode 2

Using VS Code with WSL2 plugin

Mode 3

Using MS Visual Studio with remote execution plugin through SSH.

Execute

You can copy an image to Windows using: cp ./image/fd1440-fat.img /mnt/c/Temp to c:\temp Or use:

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, copy your executable (vgatest), unmount it 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.