Makefile and doc improvements
This commit is contained in:
parent
6521d41aa5
commit
204c8e24ae
24
Cargo.lock
generated
24
Cargo.lock
generated
@ -80,9 +80,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "flagset"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec"
|
||||
checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe"
|
||||
|
||||
[[package]]
|
||||
name = "font8x8"
|
||||
@ -125,9 +125,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.26"
|
||||
version = "0.4.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
@ -140,9 +140,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.0"
|
||||
version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
"portable-atomic",
|
||||
@ -156,9 +156,9 @@ checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.94"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -186,9 +186,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
@ -204,9 +204,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.100"
|
||||
version = "2.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
|
||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -6,10 +6,10 @@ edition = "2024"
|
||||
[dependencies]
|
||||
acpi = "5.1.0"
|
||||
enumflags2 = "0.7.11"
|
||||
flagset = "0.4.6"
|
||||
flagset = "0.4.7"
|
||||
limine = "0.4.0"
|
||||
once_cell = { version = "1.20.3", default-features = false, features = ["alloc", "critical-section"] }
|
||||
spin = "0.9.8"
|
||||
spin = "0.10.0"
|
||||
talc = "4.4.2"
|
||||
|
||||
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||
|
@ -44,10 +44,16 @@ script = "rustup install nightly; rustup target add ${TARGET}"
|
||||
command = "rm"
|
||||
args = ["-rf", "build"]
|
||||
|
||||
[tasks.kernel]
|
||||
condition = { files_modified = { input = ["./src/**/*.rs", "./src/**/*.ld"], output = ["./target/${TARGET}/${TARGETDIR}/kernel"] }, fail_message = "(inputs unchanged)"}
|
||||
[tasks.lib]
|
||||
condition = { files_modified = { input = ["./src/lib/**/*.rs"], output = ["./target/${TARGET}/${TARGETDIR}/libgila.rlib"] }, fail_message = "(inputs unchanged)"}
|
||||
dependencies = ["prepare"]
|
||||
command = "cargo"
|
||||
args = ["build", "--lib"]
|
||||
|
||||
[tasks.kernel]
|
||||
condition = { files_modified = { input = ["./src/kernel/**/*.rs", "./src/kernel/**/*.ld", "./target/${TARGET}/${TARGETDIR}/libgila.rlib"], output = ["./target/${TARGET}/${TARGETDIR}/kernel"] }, fail_message = "(inputs unchanged)"}
|
||||
dependencies = ["lib"]
|
||||
command = "cargo"
|
||||
args = ["build", "--profile", "${PROFILE}", "--bin", "kernel"]
|
||||
|
||||
[tasks.iso]
|
||||
@ -65,13 +71,13 @@ script = '''
|
||||
mkdir -p build/iso/boot/limine
|
||||
mkdir -p build/iso/EFI/BOOT
|
||||
|
||||
cp ./limine.conf build/iso/
|
||||
cp ${LIMINEDIR}/limine-bios.sys build/iso/boot/limine/
|
||||
cp ${LIMINEDIR}/limine-bios-cd.bin build/iso/boot/limine/
|
||||
cp ${LIMINEDIR}/limine-uefi-cd.bin build/iso/boot/limine/
|
||||
cp ${LIMINEDIR}/${LIMINEBIN} build/iso/EFI/BOOT
|
||||
cp -f ./limine.conf build/iso/
|
||||
cp -f ${LIMINEDIR}/limine-bios.sys build/iso/boot/limine/
|
||||
cp -f ${LIMINEDIR}/limine-bios-cd.bin build/iso/boot/limine/
|
||||
cp -f ${LIMINEDIR}/limine-uefi-cd.bin build/iso/boot/limine/
|
||||
cp -f ${LIMINEDIR}/${LIMINEBIN} build/iso/EFI/BOOT
|
||||
|
||||
cp target/${TARGET}/${TARGETDIR}/kernel build/iso/boot/
|
||||
cp -f target/${TARGET}/${TARGETDIR}/kernel build/iso/boot/
|
||||
|
||||
mkdir -p build/iso/system/bin
|
||||
mkdir -p build/iso/system/tmp
|
||||
|
19
README.md
19
README.md
@ -58,30 +58,35 @@ Licensed under the GNU Public License v3. See [LICENSE](LICENSE) for details.
|
||||
|
||||
## Building and running
|
||||
|
||||
Building a bootable kernel is easy. All you need to do is run `cargo build gila`, and a valid, bootable Limine executable will be generated. However, it cannot be booted without installing it in a bootable Limine filesystem.
|
||||
Building a bootable kernel is easy. All you need to do is run `cargo build --bin kernel`, and a valid, bootable Limine executable will be generated. However, it cannot be booted without installing it in a bootable Limine filesystem.
|
||||
|
||||
To build an ISO image that you can boot, there are several prerequisites:
|
||||
This project uses [cargo-make](https://github.com/sagiegurari/cargo-make) to handle building ISOs and managing files not associated with Cargo. You need to install it before you can build an ISO automatically. To do so, you can run `cargo install cargo-make`. In addition, you will also need:
|
||||
|
||||
- `rustup` command installed
|
||||
- `limine` command installed
|
||||
- `xorriso` command installed
|
||||
- `cargo-make` command installed (`cargo install cargo-make`)
|
||||
- `qemu-system-{your target architecture}` command installed (for running)
|
||||
|
||||
Then run `cargo make` to invoke the [Makefile.toml](Makefile.toml).
|
||||
|
||||
- `cargo make prepare`: Installs needed Rust toolchain.
|
||||
- `cargo make clean`: Cleans all built binaries, libraries, and ISOs.
|
||||
- `cargo make cleaniso`: Clean only files involved in building the ISO.
|
||||
- `cargo make cleaniso`: Clean only files involved in building the ISO, leave the kernel and library.
|
||||
- `cargo make lib`: Builds `libgila`, the library that the kernel and user code are linked against.
|
||||
- `cargo make kernel`: Builds the kernel ELF file.
|
||||
- `cargo make iso`: Builds the bootable ISO with Limine installed.
|
||||
- `cargo make run`: Builds the ISO and boots it in QEMU.
|
||||
|
||||
To change the target gila will be compiled or run for, supply `TARGET={valid-rustc-targettriple}` as an environment variable to `cargo make`. The default is `x86_64-unknown-none`.
|
||||
You do not need to clean any files after making changes. The `lib`, `kernel`, and `iso` tasks will automatically be rerun if their input files change.
|
||||
|
||||
To change the search path for limine's binaries, supply `LIMINEDIR={/abs/path/no/trailing/slash}` as an environment variable to `cargo make`. The default is `/usr/share/limine`.
|
||||
### Configuration
|
||||
|
||||
To change the development profile from `dev` to `release`, supply `-p {profile}` as an argument to `cargo make` **BEFORE** the task name.
|
||||
- Variable `LIMINEDIR`: Location of binary files for limine. Default is `/usr/share/limine`.
|
||||
- Variable `TARGET`: rustc target triple to compile for. Default is `x86_64-unknown-none`.
|
||||
- Argument `-p`: Rust build profile to use. Default is `dev`. Options are `dev` and `release`.
|
||||
|
||||
> [!NOTE]
|
||||
> The `-p {profile}` argument must go between `cargo make` and the task argument.
|
||||
|
||||
## Kernel Parameters
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user