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
This commit is contained in:
Nigel Barink 2023-02-02 14:59:42 +01:00
parent 364d10d02e
commit 891085e151
4 changed files with 97 additions and 0 deletions

View File

@ -60,6 +60,9 @@ test:
test_iso:
$(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)
$(CC) -T $(SRC_DIR)/kernel/linker.ld -o $(BUILD_DIR)/myos.bin \

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