lithium

A hobby OS (currently just a kernel). It is inspired by Unix, but does not follow existing standards.

building

You will need:

The code can be viewed online or downloaded here, and is kept in a fossil repo.
Alternatively, you can get the source via fossil:

fossil clone https://tty0.xyz/fossil/lithium lithium.fossil
mkdir lithium
cd lithium
fossil open ../lithium.fossil

Once you have the source, you must configure the build by creating config.mk:

ARCH = x86
PREFIX = i686-elf-

CC = $(PREFIX)gcc
CFLAGS = -ffreestanding -Os

CPP = $(PREFIX)cpp
CPPFLAGS =

AS = $(PREFIX)as
AFLAGS =

AR = $(PREFIX)ar
ARFLAGS =

LD = $(PREFIX)ld
LDFLAGS =
LIBS = $(shell $(CC) -print-libgcc-file-name)

After that, it can be built simply by running make.

running

In QEMU:

qemu-system-i386 -kernel kernel

Lithium can be loaded by any Multiboot-compliant bootloader, most commonly SYSLINUX or GRUB. This is needed to run Lithium on real hardware, or most emulation software other than QEMU.

Example SYSLINUX config:

LABEL lithium
    KERNEL /mboot.c32
    APPEND /lithium

Example GRUB config:

menuentry "Lithium" {
    multiboot /lithium
    boot
}

ISOLINUX can be used to create a bootable CD image (also suitable for writing to a flash drive):

mkdir iso
cp kernel iso/
for f in isolinux.bin ldlinux.c32 libcom32.c32 mboot.32
do
    cp /usr/lib/syslinux/$f iso/
done

cat > iso/isolinux.cfg << EOF
DEFAULT lithium
LABEL lithium
    KERNEL /mboot.c32
    APPEND /kernel
EOF

xorrisofs \
  -o lithium.iso \
  -b isolinux.bin -c boot.cat \
  -no-emul-boot \
  -boot-load-size 4 -boot-info-table \
  -R \
  iso

isohybrid lithium.iso

tty0 | void | nginx | CC-BY | 2020