Compare commits
No commits in common. "0485052b1150e9e59a50ad4ea7d29ac53900f0ee" and "1afc66acb18f670c9c1c9c2f629e53889217df7f" have entirely different histories.
0485052b11
...
1afc66acb1
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
/build
|
/iso
|
||||||
|
/gila.iso
|
38
Makefile
38
Makefile
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
TARGET ?= "x86_64-unknown-none"
|
|
||||||
|
|
||||||
all: clean prepare gila iso run
|
|
||||||
|
|
||||||
# Prepare toolchain
|
|
||||||
prepare:
|
|
||||||
rustup install nightly
|
|
||||||
rustup target add $(TARGET)
|
|
||||||
|
|
||||||
# Run the ISO in an emulator.
|
|
||||||
run: build/gila.iso
|
|
||||||
qemu-system-x86_64 -drive file=build/gila.iso,format=raw,index=0,media=disk
|
|
||||||
|
|
||||||
# Build the bootable kernel image.
|
|
||||||
.PHONY: build/iso/gila
|
|
||||||
gila: prepare $(wildcard src/*.rs)
|
|
||||||
mkdir -p build/iso/
|
|
||||||
cargo build --release -Z unstable-options --target=$(TARGET) --artifact-dir build/iso/
|
|
||||||
|
|
||||||
# Build a bootable ISO and install Limine.
|
|
||||||
.PHONY: build/gila.iso
|
|
||||||
iso: build/iso/gila gila limine.conf
|
|
||||||
mkdir -p build/iso/limine
|
|
||||||
mkdir -p build/iso/EFI/BOOT
|
|
||||||
cp ./limine.conf build/iso/
|
|
||||||
cp /usr/share/limine/limine-bios.sys build/iso/limine/
|
|
||||||
cp /usr/share/limine/limine-bios-cd.bin build/iso/limine/
|
|
||||||
cp /usr/share/limine/limine-uefi-cd.bin build/iso/limine/
|
|
||||||
xorriso -as mkisofs -b limine/limine-bios-cd.bin -no-emul-boot \
|
|
||||||
-boot-load-size 4 -boot-info-table --efi-boot \
|
|
||||||
limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image \
|
|
||||||
--protective-msdos-label build/iso -o build/gila.iso
|
|
||||||
limine bios-install build/gila.iso
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf build
|
|
||||||
cargo clean
|
|
13
README.md
13
README.md
@ -28,21 +28,12 @@ Licensed under the GNU Public License v3. See [LICENSE](LICENSE) for details.
|
|||||||
|
|
||||||
To build an ISO image that you can boot, there are several prerequisites:
|
To build an ISO image that you can boot, there are several prerequisites:
|
||||||
|
|
||||||
- `rustup` command installed
|
|
||||||
- `limine` command installed
|
- `limine` command installed
|
||||||
- `xorriso` command installed
|
- `xorriso` command installed
|
||||||
- `make` command installed
|
|
||||||
- `qemu-system-x86_64` command installed (for running)
|
|
||||||
|
|
||||||
Then run `make` to invoke the [Makefile](Makefile).
|
Then run the [build_iso.sh](build_iso.sh) script. It will generate `gila.iso`.
|
||||||
|
|
||||||
- `make prepare`: Installs needed Rust toolchain.
|
Running the kernel requires `qemu-system-{ARCH}`.
|
||||||
- `make clean`: Cleans all built files.
|
|
||||||
- `make gila`: Builds the kernel ELF file.
|
|
||||||
- `make iso`: Builds the bootable ISO with Limine installed.
|
|
||||||
- `make run`: Builds the ISO and boots it in QEMU.
|
|
||||||
|
|
||||||
TODO: This build setup is not compatible with anything other than `x86_64`.
|
|
||||||
|
|
||||||
You can install all these dependencies automatically by using `nix-shell` and
|
You can install all these dependencies automatically by using `nix-shell` and
|
||||||
supplying [shell.nix](shell.nix) as an argument.
|
supplying [shell.nix](shell.nix) as an argument.
|
||||||
|
31
build_iso.sh
Executable file
31
build_iso.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Argument 1 must be the Rust target triple."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1 ; pwd -P )"
|
||||||
|
cd "$SCRIPTPATH" || exit 1
|
||||||
|
|
||||||
|
rm -rf ./iso/
|
||||||
|
rm ./gila.iso
|
||||||
|
#cargo clean
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
mkdir -p ./iso/limine/
|
||||||
|
cp ./limine.conf ./iso/
|
||||||
|
cp /usr/share/limine/limine-bios.sys ./iso/limine/
|
||||||
|
cp /usr/share/limine/limine-bios-cd.bin ./iso/limine/
|
||||||
|
cp /usr/share/limine/limine-uefi-cd.bin ./iso/limine/
|
||||||
|
|
||||||
|
cargo build --target="$1" --release
|
||||||
|
cp target/"$1"/release/gila ./iso/
|
||||||
|
|
||||||
|
xorriso -as mkisofs -b limine/limine-bios-cd.bin -no-emul-boot \
|
||||||
|
-boot-load-size 4 -boot-info-table --efi-boot \
|
||||||
|
limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image \
|
||||||
|
--protective-msdos-label iso -o gila.iso
|
||||||
|
|
||||||
|
limine bios-install gila.iso
|
@ -16,7 +16,6 @@ pkgs.mkShell {
|
|||||||
xorriso
|
xorriso
|
||||||
rustup
|
rustup
|
||||||
qemu
|
qemu
|
||||||
make
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![allow(unused_variables)]
|
|
||||||
|
|
||||||
use vga;
|
use vga;
|
||||||
pub use vga::writers::TextWriter;
|
pub use vga::writers::TextWriter;
|
||||||
|
Loading…
Reference in New Issue
Block a user