add README, LICENSE, and changed how building works

This commit is contained in:
Zoe
2023-06-25 21:06:14 -05:00
parent 42b857ecf3
commit 3aa4b47b30
5 changed files with 73 additions and 14 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/target /target
/bin

21
LICENSE Normal file
View File

@@ -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.

View File

@@ -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: build-os-image:
dd if=target/x86_64-unknown-none/release/bootloader.bin conv=notrunc of=os-image bs=512 rm bin/${IMAGE_NAME}
dd if=target/x86_64-unknown-none/release/operating-system.bin conv=notrunc of=os-image bs=512 seek=1 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: 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-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: compile-kernel:
cp bootloader/bootloader.bin target/x86_64-unknown-none/release/bootloader.bin cargo build --release --target x86_64-unknown-none.json
cargo-build: run: build
cargo rustc --release --target x86_64-unknown-none.json qemu-system-x86_64 -drive format=raw,file=bin/${IMAGE_NAME} -serial mon:stdio -s
run: all
qemu-system-x86_64 -drive format=raw,file=os-image -serial mon:stdio -s
clean: clean:
cargo clean cargo clean
rm -f os-image bootloader/bootloader.bin rm -rf bin

34
README.md Normal file
View File

@@ -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`.
<br/>
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.

Binary file not shown.