Pascal Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
No edit summary
Line 489: Line 489:
<source lang="bash">qemu-system-i386 pascal-kernel.iso</source>
<source lang="bash">qemu-system-i386 pascal-kernel.iso</source>


=== Alternative compiling: Makefile ===

Accumulating the lines from previous part we can make a '''Makefile''':
<source lang="bash">
# Freepascal BareboneOS
# Makefile
# 2019
# by: furaidi <iluatitok@gmail.com>
# License: Public domain

NASMPARAMS = -f elf32 -o stub.o
LDPARAMS = -A elf-i386 --gc-sections -s -Tlinker.script -o kernel.obj
TMPISO = iso
TMPBOOT = $(TMPISO)/boot
TMPGRUB = $(TMPBOOT)/grub
TMPCFG = $(TMPGRUB)/grub.cfg

objects = stub.o kernel.o multiboot.o console.o system.o

_FPC:
# Compile kernel
fpc $(FPCPARAMS) kernel.pas
_NASM:
# Compile stub
nasm $(NASMPARAMS) stub.asm

_LD:
# Link them together
i686-elf-ld $(LDPARAMS) $(objects)

all: _FPC _NASM _LD

install:
mkdir $(TMPISO)
mkdir $(TMPBOOT)
mkdir $(TMPGRUB)
cp kernel.obj $(TMPBOOT)/kernel.obj
echo 'set timeout=0' > $(TMPCFG)
echo 'set default =0' >> $(TMPCFG)
echo '' >> $(TMPCFG)
echo 'menuentry "Pascal Bare" {' >> $(TMPCFG)
echo ' multiboot /boot/kernel.obj' >> $(TMPCFG)
echo ' boot' >> $(TMPCFG)
echo '}' >> $(TMPCFG)
grub-mkrescue --output=pascal-kernel.iso $(TMPISO)
rm -rf $(TMPISO)
clean:
rm -rf $(TMPISO)
rm -f *.o
rm -f *.ppu

</source>


[[Category:Bare bones tutorials]]
[[Category:Bare bones tutorials]]