Skip to content

shoily/xis

Repository files navigation

XIS kernel needs only 2MB of memory to run.

Instructions for building kernel -
as --32 boot32.S -o boot32.o
gcc -m32 -std=gnu99 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -ffreestanding -fno-pic -Wall -Wextra -Werror -c util.c -o util.o
gcc -m32 -std=gnu99 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -ffreestanding -fno-pic -Wall -Wextra -Werror -c system.c -o system.o
as --32 handlr32.S -o handlr32.o
gcc -m32 -std=gnu99 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -ffreestanding -fno-pic -Wall -Wextra -Werror -c setup32.c -o setup32.o
gcc -m32 -std=gnu99 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -ffreestanding -fno-pic -Wall -Wextra -Werror -c start.c -o start.o

ld -static -T kernel32.ld -m elf_i386 -nostdlib --nmagic boot32.o util.o system.o setup32.o handlr32.o start.o -o xiskernel.elf
objcopy -O binary xiskernel.elf xiskernel.bin

Instructions for building boot loader -
echo ".equ KERNEL_SIZE, `ls -l xiskernel.bin | cut -f5 -d\ `" > krnlsize.h
as --32 bootldr.S -o bootldr.o
ld -static -T bootldr.ld -m elf_i386 -nostdlib --nmagic -o bootldr.elf bootldr.o
objcopy -O binary bootldr.elf bootldr.bin

Creating QEMU image -
dd if=bootldr.bin of=hda.raw
dd if=xiskernel.bin of=hda.raw seek=1
qemu-img convert -O qcow2 hda.raw hda.qcow2

Running using QEMU -
sudo qemu-system-i386 -hda hda.qcow2 -m 2 --enable-kvm -cpu host

Contact -

[email protected]