Compare commits

...

2 Commits

Author SHA1 Message Date
891085e151 Successfully able to create a disk-image file
- Created a scripts folder
- Written instructions on how to create the disk image
- Working on a python build script that executes all other scripts

The scripts folder should contain scripts to build a full installation of
our operating system. Scripts like creating a filesystem should be found here
2023-02-02 14:59:42 +01:00
364d10d02e src folder -> source folder; makes merging with dev a bit easier. 2022-09-10 20:06:49 +02:00
80 changed files with 105 additions and 8 deletions

View File

@ -27,7 +27,7 @@ $(BUILD_DIR)/sv-terminal.o \
SRC_DIR = src SRC_DIR = source
BUILD_DIR = build BUILD_DIR = build
CRTBEGIN_OBJ = $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o) CRTBEGIN_OBJ = $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o)
@ -50,7 +50,7 @@ clean_iso:
iso: clean_iso clean build iso: clean_iso clean build
mkdir -p root/boot/grub mkdir -p root/boot/grub
cp build/myos.bin root/boot/myos.bin cp build/myos.bin root/boot/myos.bin
cp src/grub.cfg root/boot/grub/grub.cfg cp source/grub.cfg root/boot/grub/grub.cfg
grub-mkrescue -o build/barinkOS.iso root grub-mkrescue -o build/barinkOS.iso root
run: all run: all
virtualboxvm --startvm "BarinkOS_test" virtualboxvm --startvm "BarinkOS_test"
@ -60,9 +60,12 @@ test:
test_iso: test_iso:
$(EMULATOR) -boot d -cdrom $(BUILD_DIR)/barinkOS.iso -serial stdio -vga std -display gtk -m 2G -cpu core2duo $(EMULATOR) -boot d -cdrom $(BUILD_DIR)/barinkOS.iso -serial stdio -vga std -display gtk -m 2G -cpu core2duo
test_disk:
$(EMULATOR) -boot d -drive format=raw,file=disk.img -serial stdio -vga std -display gtk -m 2G -cpu core2duo
build_kernel: $(OBJ_LINK_LIST) build_kernel: $(OBJ_LINK_LIST)
$(CC) -T $(SRC_DIR)/kernel//linker.ld -o $(BUILD_DIR)/myos.bin \ $(CC) -T $(SRC_DIR)/kernel/linker.ld -o $(BUILD_DIR)/myos.bin \
-ffreestanding -O2 -nostdlib $(OBJ_LINK_LIST) -lgcc -ffreestanding -O2 -nostdlib $(OBJ_LINK_LIST) -lgcc
build_x86_64: build_x86_64:

25
scripts/build.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/python3
import os
import subprocess
print("Building BarinkOS")
# list and run build scripts
print("Running build-scripts")
os.chdir("scripts")
scripts=os.listdir()
currentScript=os.path.basename(__file__)
if currentScript in scripts:
scripts.remove(currentScript)
for script in scripts:
print(os.getcwd())
print("Running:" + script)
subprocess.call(script, cwd=os.getcwd())
os.chdir("..")

View File

@ -0,0 +1,64 @@
#!/bin/bash
#
# How to build a boot image
# NOTE: This script cant run properly yet
# Things described here should be done manually for now
#
# COPYRIGHT © Nigel Barink 2023
#
echo "Building a FAT16 filesystem"
su
# dd if=/dev/zero of=diks.img bs=512 count=131072
# fdisk disk.img
# Use the following options in fdisk (Format Disk Tool)
# We want to create a MBR (NOT GPT) Partition table containing 1 logical disk
# with a primary FAT16 partition marked bootable
#OPTIONs
# Create new DOS disklabel
# o
# Create new partition
# n
# Choose Primary as partition type
# p
# hit enter to choose default for the other options
# Mark partition 1 as bootable
# a
# Change partition type to FAT16
# t
# Choose Partition 1
# 1
# Choose HEX 6 for FAT16
# 6
# Sync and write changes to disk
# w
# Create a "block" device from the disk.img
# losetup /dev/loop9 disk.img
# Format the partition on the disk as FAT16
# mkdosfs -F16 /dev/loop9
# Mount the disk to a folder on our dev machine
# mount /dev/loop9 /mnt
# Install the grub bootloader onto the disk
# grub-install --no-floppy --modules="normal multiboot" /dev/loop9 --target=i386-pc --boot-directory=/mnt/boot --force
# copy the necessary OS files
# cp root/boot/myos.bin /mnt/boot/myos.bin
# cp root/boot/grub/grub.cfg /mnt/boot/grub/grub.cfg
# Unmount the device
# umount /mnt
# Destroy the loop device
# losetup -d /dev/loop9

5
scripts/test.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
start=`date +%s`
end=`date +%s`
echo That took $((end-start)) seconds
date +"%c" -d195440409

View File

@ -21,11 +21,11 @@ stack_bottom:
stack_top: stack_top:
.section .text .section .text
.include "./src/kernel/gdt/gdt.s" .include "./source/kernel/gdt/gdt.s"
.include "./src/kernel/irs_table.s" .include "./source/kernel/irs_table.s"
.include "./src/kernel/irq_table.s" .include "./source/kernel/irq_table.s"
.include "./src/kernel/idt/idt.s" .include "./source/kernel/idt/idt.s"
.include "./src/kernel/memory/paging.s" .include "./source/kernel/memory/paging.s"
.global _start .global _start