add stddef cuz yup fix up write.sh again! and begin allocator

This commit is contained in:
Tyler McGurrin 2025-08-22 15:19:32 -04:00
parent 56ebdc2184
commit 082eb0554d
5 changed files with 90 additions and 11 deletions

View File

@ -0,0 +1,16 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2024|
|Tyler McGurrin |
\*----------------*/
#include "allocator.h"
#include <stdint.h>
#include <stddef.h>
#include <dri/serial.h>
extern uint16_t DEBUG_COM_PORT;
void alloc(size_t size) {
}

View File

@ -0,0 +1,14 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2024|
|Tyler McGurrin |
\*----------------*/
#pragma once
#include <stddef.h>
struct memory_block {
size_t size;
char free;
struct memory_block *next_free;
};

13
src/kernel/stddef.h Normal file
View File

@ -0,0 +1,13 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#pragma once
#include <stdint.h>
#define NULL ((void*)0)
typedef unsigned int size_t;

View File

@ -6,4 +6,4 @@
#pragma once #pragma once
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n" #define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
#define VERSION "RD-00050" #define VERSION "RD-00051"

View File

@ -1,21 +1,57 @@
echo ------------ read -p "Do you want to write the IMG to A Disk? [Requires sudo] (y/n) " yn
echo COMPILING OS echo ------------
echo ------------ echo COMPILING OS
echo ------------
make
echo ---------
echo Finished!
echo ---------
echo -------------------------
echo Installing GRUB To Image!
echo -------------------------
sudo losetup -d /dev/loop800
dd if=/dev/zero of=build/main.img bs=512 count=50000
mkdir -p build/mnt
sudo losetup -P /dev/loop800 build/main.img
sudo parted /dev/loop800 mktable msdos
sudo parted /dev/loop800 mkpart primary fat16 2048s 100%
sudo parted /dev/loop800p1 set 1 boot on
sudo mkfs.fat -F16 /dev/loop800p1
sudo mount /dev/loop800p1 build/mnt
sudo mkdir build/mnt/boot
sudo mkdir build/mnt/boot/grub
sudo mkdir build/mnt/misc
sudo mkdir build/mnt/misc/src
sudo cp -r src/* build/mnt/src
sudo cp -r grub/* build/mnt/boot/grub
sudo cp build/nanite.bin build/mnt/boot/nanite
sudo grub-install \
--modules="part_msdos" \
--boot-directory=build/mnt/boot \
--target=i386-pc \
--bootloader-id=GRUB \
/dev/loop800 -v
sudo umount build/mnt
sudo losetup -d /dev/loop800
echo ---------
echo Finished!
echo ---------
make
echo ---------
echo Finished!
echo ---------
read -p "Do you want to write the IMG to Floppy? (/dev/sdb) (y/n) " yn
case $yn in case $yn in
y ) y )
read -p "What Drive? (ex: /dev/sda) " disk
echo --------------------- echo ---------------------
echo Writing IMG to Floppy echo Writing IMG to Disk
echo --------------------- echo ---------------------
sudo dd if=./build/main_floppy.img of=/dev/sdb status=progress sudo dd if=./build/main.img of=$disk status=progress
echo --------- echo ---------
echo Finished! echo Finished!