add README, LICENSE, and changed how building works
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/target
|
||||
/bin
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal 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.
|
||||
31
Makefile
31
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
|
||||
rm -rf bin
|
||||
34
README.md
Normal file
34
README.md
Normal 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.
Reference in New Issue
Block a user