KlikaOS is a hobbyist and educational operating system written in C (and some small parts are written in assembly).
You can build KLIKAOS using Vagrant Dev Environment or on your local machine.
Vagrantfile already contains all dependencies needed to build KLIKAOS. To use Vagrant as development environment following dependencies must be installed on your host machine:
brew install qemu)Run following:
vagrant up
vagrant ssh
cd /vagrant
make all run
This will create bootable ISO image and HD image in images folder. To run it, you will need qemu on your local machine. You can run it (FROM YOUR LOCAL MACHINE):
qemu-system-x86_64 -cdrom images/klika-os-x86_64.iso -m 128 -drive file=images/disk.img,format=raw,index=0,media=disk -boot order=d -serial stdio
Most effective way to build and run KLIKAOS is to install GCC cross compiler for your platform. GCC tools must be named using x86_64-elf prefix like:
x86_64-elf-gcc
x86_64-elf-ld
x86_64-elf-as
x86_64-elf-nm
x86_64-elf-objdump
x86_64-elf-objcopy
...
Dependencies:
Easiest way is to look into Vagrantfile and see what needs to be installed.
To build and run with qemu:
make all run
Repostiory already contains pre-built ISO and HD images. Fastest way to run it will be using qemu:
qemu-system-x86_64 -cdrom images/klikaos-x86_64.iso -m 128 -drive file=images/disk.img,format=raw,index=0,media=disk -boot order=d -serial stdio
Convert raw qemu image to .vdi image:
qemu-img convert -O vdi images/disk.img images/disk.vdi
Mount disk.vdi (master) and klikaos-x86_64.iso (slave). Start machine.
Best way to create new app is just to copy simple_win from apps folder. Example for GUI app:
// See ./apps/simple_win
#include <klikaos.h>
#include <windows.h>
#include <stdlib.h>
#define MSG_USER_WIN (WINDOW_USER_MESSAGE + 1)
#define MSG_USER_BTN1 (WINDOW_USER_MESSAGE + 2)
#define MSG_USER_BTN2 (WINDOW_USER_MESSAGE + 3)
#define MSG_USER_LABEL (WINDOW_USER_MESSAGE + 4)
message_t msg;
window_t *window;
window_t *label;
long counter = 0;
void increment_counter(int add) {
char buff[123];
counter += add;
sprintf(buff, "Count: %i", counter);
label_set_text(label, buff);
}
int main() {
int layout_y = WINDOW_BAR_HEIGHT + 10;
window = window_create(100, 100, 300, 300, "Simple Window", MSG_USER_WIN, WINDOW_ATTR_NONE, WINDOW_FRAME_DEFAULT);
button_create(window, 10, layout_y, 100, 30, "Click me +", MSG_USER_BTN1);
button_create(window, 120, layout_y, 100, 30, "Click me -", MSG_USER_BTN2);
label = label_create(window, 10, layout_y + 40, 200, 20, "Number of clicks", MSG_USER_LABEL);
while(window_get_message(window, &msg)) {
switch(msg.message) {
case MSG_USER_BTN1:
increment_counter(1);
break;
case MSG_USER_BTN2:
increment_counter(-1);
break;
}
window_dispatch(window, &msg);
}
return 0;
}/apps folder
Thanks goes to these wonderful people (emoji key):
SamirH |
Ensar Sarajčić |
Almir Hamza |
This project follows the all-contributors specification. Contributions of any kind welcome!