LaylaOS is a hobby operating system with a kernel that is written in C. The project started around 2015 and took almost 9 years to reach a stable point where I felt it could be shared with the world. It is meant as a learning tool to better understand the internal workings of an Operating System's kernel, how system calls work and how to implement a Graphical User Interface (GUI) environment.
This OS has been tested on:
- Bochs
- QEmu
- Oracle VM VirtualBox
- Real hardware (Toshiba Satellite Pro, Intel i3, 500GB HDD, 8GB RAM)
This OS is definitely not a system meant for everyday use (not yet, at least).
The project's features include:
- 64 bit monolithic multitasking pre-emptive kernel written in C (the 32 bit code is included here but is not fully functional)
- Symmetric Multiprocessing (SMP), supports up to 32 cores
- Multiuser support
- USB support (UHCI/OHCI/EHCI)
- Network stack (TCP, UDP, raw and Unix sockets, IPv4)
- PCI and PCIe support
- ATA/ATAPI and AHCI support
- Basic Intel HDA sound support
- PS2 keyboard and mouse
- Virtual consoles
- Virtual Dynamic Shared Object (vdso)
- Interprocess Communication (IPC) facilities in the form of shared memory, semaphores and message queues
- Page cache for demand loading of pages
- Loopback devices (loopback)
- Builtin filesystem support for Ext2, FAT12/16 and VFAT
- ACPI support via ACPICA
- C library (currently using musl)
- Ports of 3rd party software (GNU coreutiles, inetutils, bash, several image and audio/video decoding libraries, etc.)
- Graphical desktop with many (mostly demonstrative) applications
- SDL2
- Qt5.12
- OpenTTD
- A fork of SDL2 DOOM
This is mostly to keep track of where we are at and what needs to be done next:
- Add IPv6 support to the network stack
- More syscalls including POSIX message queues syscalls
- More GUI functionality (text editor, screenshot facility, paint program, desktop themes, archiver, web browser, etc.)
- Ext3, Ext4, NFS filesystem support (maybe NTFS at some point)
- Kernel logging and perhaps a syslogd server
- Swap support
- USB xHCI support
LaylaOS has multiuser support. If you want to log in as a normal user, the username and password are both user. If you want to log in as root, the username and password as both root.
You can either try the Live CD, the bootable disk image, or build LaylaOS from source. The following sections give more detail on each one of these options.
Here is how you can run the Live CD image of LaylaOS:
- Download the Live CD image from the releases page.
- To run under Bochs:
-
Download the
bochsrcfile from the build-scrpits folder. -
In the
bochsrcfile you just downloaded, comment these lines (i.e. put a leading#at the beginning of the line):ata0-master: type=disk, path="/DOWNLOADS_PATH/bootable_disk.img", mode=flat, translation=auto boot: disk -
Uncomment these lines (i.e. remove the leading
#), replacing DOWNLOADS_PATH with the actual path where you downloaded the Live CD image:#ata0-master: type=cdrom, path="/DOWNLOADS_PATH/laylaos.iso", status=inserted #boot: cdrom -
Change to the directory where you downloaded the image and type:
bochs -q
-
- To run under QEmu:
- Change to the directory where you downloaded the image and type this command, replacing DOWNLOADS_PATH with the actual path where you downloaded the Live CD image:
qemu-system-x86_64 -accel tcg,thread=single -cpu core2duo \ -m 2048 -M pc -no-reboot -no-shutdown \ -drive format=raw,file=/DOWNLOADS_PATH/bootable_disk.img,index=0,media=disk \ -boot d -serial stdio \ -smp 1 -usb -vga std \ -device intel-hda,debug=4 -device hda-duplex -audiodev id=pa,driver=pa,server=/run/user/$(id -u)/pulse/native
- Change to the directory where you downloaded the image and type this command, replacing DOWNLOADS_PATH with the actual path where you downloaded the Live CD image:
You can download a prebuilt bootable disk image that includes everything (including the ported software) from the releases page. Be mindful, however, that the unzipped disk image is likely to be big (6+ GiB in size). You can use this image to run LaylaOS under Bochs or QEmu.
Here is how you can run the Bootable Disk Image of LaylaOS:
- Download the disk image from the releases page.
- To run under Bochs:
-
Download the
bochsrcfile from the build-scrpits folder. -
Find the following line, and replace DOWNLOADS_PATH with the actual path where you downloaded the Live CD image:
ata0-master: type=disk, path="/DOWNLOADS_PATH/bootable_disk.img", mode=flat, translation=auto -
Change to the directory where you downloaded the image and type:
bochs -q
-
- To run under QEmu, use the same command at the end of the last section.
- To run under Oracle VM VirtualBox, see the next section.
To run LaylaOS under Oracle VM VirtualBox, you will need to convert the bootable disk image into a VDI image. This can be done by running the following command from the directory where you downloaded the disk image:
VBoxManage convertfromraw bootable_disk.img bootable_disk.vdi
You can then create a new virtual machine under VirtualBox using the disk image. You will probably face a problem as the image contains two files (/boot/grub/grub.cfg and /etc/fstab) with a hardcoded boot device name (something like /dev/hda4).
To be able to use this disk as a SATA (or AHCI) disk under VirtualBox you need to either:
- Edit these two files in the disk image you downloaded and change the device name to
/dev/sda4(assuming you connect the disk at SATA port 0; the image contains 4 partitions) - Build LaylaOS from source and create the bootable disk image using:
./create_bootable_disk.sh rootdev sda4
To build LaylaOS from source:
- Download this repository and unzip the zip file
- Change directory to the unzipped source directory, e.g.
cd ~/downloads/laylaos-master - Change directory to the
build-scriptssubdirectory in the source tree:cd build-scripts - To run the build (this has to be done from the
build-scriptsdirectory):./buildos.sh - Go grab a coffee or better yet, have some lunch. It takes a little over 3 hours to build the whole project!
- Oh, and you need internet connection to download the sources of ported software!
- When the build is done, create a bootable harddisk image by running:
./create_bootable_disk.sh - The bootable disk image is named
bootable_disk.imgand is created by default in the current working directory (you can run./create_bootable_disk.sh helpto see the list of options) - A
bochsrcfile is automatically created alongsidebootable_disk.img(you might want to fix the name of the wireless device you use in the file). You can now run Bochs:bochs -q - Another script called
qemu.shis also created to let you test the OS under QEmu. However, you need a TUN/TAP network device to run LaylaOS under QEmu using the provided script. You need to first runsudo ./netprep.shto create the network device, then you can proceed with runningqemu.sh
-
LaylaOS is released under GPL v3.
-
ACPICA is released under a dual Intel and Unix-compatible licenses.
-
Timidity files (needed for sound in DOOM) are in the public domain (see their
copyright.txtfile). -
The monospace font used in the system console and the GUI terminal is Dina font, which is released under a free license.
-
libaelf32.a and libaelf64.a are part of asmlib, the software optimisation library by Agner Fog, which is released under GPL.
-
All other ported software come with their respective licenses.
