From 3aa4b47b304a3937fe237930389e27dddfd61203 Mon Sep 17 00:00:00 2001 From: juls0730 Date: Sun, 25 Jun 2023 21:06:14 -0500 Subject: [PATCH] add README, LICENSE, and changed how building works --- .gitignore | 1 + LICENSE | 21 +++++++++++++++++++++ Makefile | 31 +++++++++++++++++-------------- README.md | 34 ++++++++++++++++++++++++++++++++++ bootloader/bootloader.bin | Bin 512 -> 0 bytes 5 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 LICENSE create mode 100644 README.md delete mode 100644 bootloader/bootloader.bin diff --git a/.gitignore b/.gitignore index ea8c4bf..84a4913 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/bin \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5984e4c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 juls0730 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile index dc7df4b..7999709 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,29 @@ -.PHONY: all clean +IMAGE_NAME = os-image -all: cargo-build compile-bootloader copy-bootloader objcopy-elf-file build-os-image +.PHONY: build clean + +build: make-bin-dir compile-kernel compile-bootloader objcopy-elf-file build-os-image + +make-bin-dir: + mkdir -p bin build-os-image: - dd if=target/x86_64-unknown-none/release/bootloader.bin conv=notrunc of=os-image bs=512 - dd if=target/x86_64-unknown-none/release/operating-system.bin conv=notrunc of=os-image bs=512 seek=1 + rm bin/${IMAGE_NAME} + dd if=bin/bootloader.bin conv=notrunc of=bin/${IMAGE_NAME} bs=512 + dd if=bin/kernel.bin conv=notrunc of=bin/${IMAGE_NAME} bs=512 seek=1 compile-bootloader: - nasm -f bin bootloader/bootloader.asm -o bootloader/bootloader.bin + nasm -f bin bootloader/bootloader.asm -o bin/bootloader.bin objcopy-elf-file: - objcopy -O binary target/x86_64-unknown-none/release/operating-system.elf target/x86_64-unknown-none/release/operating-system.bin + objcopy -O binary target/x86_64-unknown-none/release/operating-system.elf bin/kernel.bin -copy-bootloader: - cp bootloader/bootloader.bin target/x86_64-unknown-none/release/bootloader.bin +compile-kernel: + cargo build --release --target x86_64-unknown-none.json -cargo-build: - cargo rustc --release --target x86_64-unknown-none.json - -run: all - qemu-system-x86_64 -drive format=raw,file=os-image -serial mon:stdio -s +run: build + qemu-system-x86_64 -drive format=raw,file=bin/${IMAGE_NAME} -serial mon:stdio -s clean: cargo clean - rm -f os-image bootloader/bootloader.bin \ No newline at end of file + rm -rf bin \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cdc50af --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Toto OS +Toto OS is a small operating system written in rust. This README will guide you through the process of building and running Toto OS. + +## Prerequisites +Before building Toto OS, make sure you have th following installed on your machine: +- rust (nightly) +- cargo + +If you are interested in running Toto OS with the `make run` command, you will need to install QEMU. + +## Getting started +To build Toto OS, follow these steps: + +1. Clone the repository. + ```BASH + git clone https://github.com/juls0730/toto-os.git + cd toto-os + ``` +2. Build Toto OS using `make` command: + ```BASH + make build + ``` + +You will be able to find the built image in `bin/os-image`. + +
+ +If you instead want to build Toto OS & run it with qemu, you can simply run make like so: +```BASH +make run +``` + +## License +Toto OS is license under the MIT License. Feel free to modify and distribute in accordance with the license. \ No newline at end of file diff --git a/bootloader/bootloader.bin b/bootloader/bootloader.bin deleted file mode 100644 index dd03c243c55bf03cdb75706ca75573249569b583..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 512 zcmeAWtF76~Fro9!7KRN%X9Zp`GrTZj*v%lYjj0PL)A3;|!$zhpOxqaF3Lh3{(63>D zg8%=4j9KRy!1Sc^48Qmp#k6bq6%M2|pJ3!yI`Ar{hJzt(hX6z0jlKhY5Bgs8UD(UO dz{$}0<^{-v7p;^3|9|}tYS<_>P$3Yy3IJ-VGL--T