-
Notifications
You must be signed in to change notification settings - Fork 218
v0.11
: Redesign config and build system, split into sub-crates, and provide disk image builder
#232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 1 commit
Commits
Show all changes
239 commits
Select commit
Hold shift + click to select a range
15ce095
Create a 16-bit 'Hello World'
phil-opp 87c3723
Remove panic! call since it leads to a too large binary
phil-opp fd1b5be
Enable lto and debug info
phil-opp 37ff520
Split first stage into multiple output sections
phil-opp 9ca6de1
Perform more work in boot.s
phil-opp 1b95736
Set relocation model to static
phil-opp 4d74604
Load a second stage from disk in Rust
phil-opp 2f3bd08
Ignore test.bin
phil-opp cf9517f
wip
phil-opp 34fc6d0
Use localized symbols
phil-opp 8e9f565
Try to link as ELF64
phil-opp 88af668
Some renaming
phil-opp c183314
Fix build instructions in readme
phil-opp 382388e
Use `-Zbuildstd
phil-opp bd12d2c
Create output section of .eh_frame to prevent automatic placing
phil-opp b3df5e8
Create new `bootloader_api` crate that puts config in ELF section
phil-opp 01ab004
Reexport `BootInfo` struct at top level
phil-opp e526844
Run cargo fmt
phil-opp 846105f
Remove commented-out build.rs code
phil-opp b49f018
Replace unstable `split_array` feature with custom function
phil-opp 275e991
Fix import in doc test
phil-opp 14a42c6
The `asm` macro was stabilized as `core::arch::asm`
phil-opp 731d624
Add rustfmt/clippy to rust-toolchain.toml
phil-opp 07781c8
Improve docs
phil-opp 5cd1abf
Fix imports in macro
phil-opp e2612b4
Remove stabilized asm and global_asm features
phil-opp adb6fee
Use `bootloader_api::BootInfo` struct in `bootloader`
phil-opp 8cb6d1a
Start migrating tests and examples to bootloader_api (doesn't work yet)
phil-opp d0f9749
Rename GitHub actions CI workflow file
phil-opp cfa19ad
Add rust-src and llvm-tools-preview components to rust-toolchain file
phil-opp aae7f7d
Remove toolchain install action from CI
phil-opp 577aa9c
Run cargo fmt
phil-opp 611ac54
Enable format on save on VSCode
phil-opp c9adc1d
Document entry point macro and fix macro import
phil-opp c8cc7bb
Remove old entry point macro
phil-opp 8c7e951
Fully document the api crate
phil-opp c2674d6
Set up custom build command for rust-analyzer
phil-opp 4e18af7
Remove bootloader build script
phil-opp 6c43cff
Format Cargo.toml
phil-opp 8f8b5ac
Remove compile-time config and kernel byte array completely
phil-opp db7d4d3
Add and use dependency on api crate
phil-opp 3d169fa
Parse version info in api build script and use it
phil-opp 94c5165
Use `ApiVersion` struct in `BootInfo`
phil-opp 12f2adb
Replace deprecated x86_64 segment methods
phil-opp 33be56e
Use non-exhaustive `api::BootInfo` struct in bootloaader
phil-opp ce7670b
Make `BootInfo `Copy`-able
phil-opp 72c5d45
Rename `PixelFormat` variants and add `Framebuffer::new` constructor
phil-opp 048b6a0
Add kernel struct for passing BootloaderConfig around and use mappings
phil-opp a9c8e9e
First prototype implementation of ELF loading and config parsing in U…
phil-opp 9a3470f
Update Cargo.lock for basic_example
phil-opp e76b7e1
Update builder executable for new bootloader design (UEFI only)
phil-opp 1563a44
First working version of dynamic kernel loading in UEFI bootloader
phil-opp 02d0a0c
Start adjusting first stage for dynamic kernel loading and FAT support
phil-opp 2b7f49e
Move rodata to separate section
phil-opp e918cc1
Add partition table to output file
phil-opp 708ee38
Use opt level s instead of z
phil-opp 226e55d
Make executable smaller and improve screen output
phil-opp a333010
Add a basic Readme with build instructions
phil-opp f6c3d68
Remove unreal mode code from `boot.s`
phil-opp 9b887fc
Merge branch '16-bit-wip' into next
phil-opp a253b3f
Start integrating first-stage executable into bootloader
phil-opp a28bbf1
Only load first sector of partition
phil-opp 9583eaf
Create BIOS disk image from first stage with single FAT partition
phil-opp 8fb5eff
Restructure into sub-crates
phil-opp ee9bf20
Replace artifact dependency with build script
phil-opp aefa4aa
Add function to create UEFI disk image to library
phil-opp 31dc52c
Set subcrate version to 0.1.0-alpha.0
phil-opp a802032
Support both local builds and builds as dependency
phil-opp 6047a89
Comment out main.rs for now
phil-opp 138b198
Update versions in bios impl
phil-opp d30685e
Only build local version if it exists
phil-opp 6e34ad1
Add description and license to crates
phil-opp 8c00c9e
Fix x86_64 dependency of common crate
phil-opp 768f2a7
Merge tag 'v0.10.11' into next
phil-opp 4ecba49
Merge #206 into next
phil-opp 3938b06
Merge PR #213 into next
phil-opp 71accbb
Remove BOOTLOADER_LOCAL_BUILD env variable
phil-opp fd7b2cf
Adjust and merge PR #219 into next
phil-opp fdf9d4b
Integrate latest changes from `main`
phil-opp c7a5b33
Fix: include kernel size in FAT size calculation
phil-opp 4d4b584
Update test framework to rewrite
phil-opp ca53780
Use ovmf-prebuilt crate for running UEFI tests
phil-opp f2a9dec
Remove outdated mods declarations
phil-opp 74e1732
Fix: Don't pass cli arguments to QEMU
phil-opp 302b8ae
CI: Run tests in parallel
phil-opp a4e67f3
Remove fragile framebuffer checks
phil-opp 09fc7bd
Remove examples
phil-opp 3aef58c
Merge PR #229 into next and adjust it to new config system
phil-opp c533bae
Also run tests of api crate on CI
phil-opp 6d9fefe
Increase random config test iterations to 10k
phil-opp 393c308
Fix copy&paste error in `verify_higher_half` test
phil-opp f1bf6de
Merge branch 'main' into next
phil-opp 5dbc503
Remove `uefi` dependency of `common` crate
phil-opp 6134fed
Replace `rand_chacha` with `rand_hc`
phil-opp 0b8f95d
Remove uneeded dependencies
phil-opp eb6d71f
Start integrating BIOS bootloader into build system
phil-opp bf1895b
Fix partition table
phil-opp 0d77948
Simplify MBR code and choose bootable partition
phil-opp 01fdcbc
Move bios boot sector build to top level build script
phil-opp d8b50dc
Refactor FAT creation function to take arbitrary file list
phil-opp 3812a86
Refactor GPT creation and move it to separate module
phil-opp 5310e4b
Integrate BIOS bootsector into build system
phil-opp b14b4e3
Remove some env variables when building boot sector
phil-opp 54adb4c
Rename boot sector linker script
phil-opp b3207db
Build and load a second stage
phil-opp 4d41efe
Use pie relocation model for second stage
phil-opp 5fd3115
Clean up boot sector code
phil-opp 6a014df
update uefi
Freax13 92dd42d
implement UEFI PXE
Freax13 f975de9
add some comments
Freax13 bd2a59d
fix copy-paste error
Freax13 4f6f6bb
Minor docs improvements
phil-opp ca31f96
Remove dead code in PXE boot test runner
phil-opp 47256d8
Merge pull request #237 from Freax13/uefi-pxe
phil-opp 13c4d5e
Replace deprecated `handle_protocol` calls with `open_protocol`
phil-opp 3b6aa00
WIP: try to start loading FAT partition in second stage
phil-opp abfdba5
Start custom FAT implementation bysed on `mini_fat` crate
phil-opp 96d2bdb
Read root dir entries from FAT partition
phil-opp eef2109
Use segment-based addressing for DAP to support loading larger second…
phil-opp 3de1a39
Reorder second stage sections
phil-opp a183966
Use pie relocation model for second stage
phil-opp 1d7ff1f
Implement looking up `kernel-x86_64` file on FAT partition
phil-opp 3e7f6cf
Add TODOs for next steps
phil-opp b12a3cf
Also remove `CARGO_ENCODED_RUSTFLAGS` env variable from build script …
phil-opp 06d3b95
Read FAT clusters of kernel file
phil-opp a958a2b
Return cluster start address and size
phil-opp c8a0c04
Remove some printlns
phil-opp f1f5457
Remove alignment and assert maximum executable size
phil-opp 6e8f9fa
Ensure proper alignment of DAP target buffer
phil-opp de014a9
Remove some printlns to keep binary size down
phil-opp 80de514
Remove some old FAT modules
phil-opp cdfc0c3
Use static relocation model in an attempt to bring binary size down
phil-opp 7a24837
Enter unreal mode
phil-opp 3b83a08
Remove unused module
phil-opp 0df7c07
Move root dir buffer into main.rs to reuse it later
phil-opp 5b257be
Reset buffer limit after reading root dir
phil-opp 785e82a
Update TODOs
phil-opp d16b84b
Fix reuse of bootloader memory areas
phil-opp 73ae143
Allocate UEFI kernel memory using custom memory type
phil-opp e0a0836
Remove copy&pasted comments from second stage linker script
phil-opp 84eea29
Load the kernel into buffer memory
phil-opp 52ad3e2
Copy kernel to protected mode
phil-opp 397a2d0
Enable overflow checks for second stage
phil-opp 955643d
Pass read size directly in `read_exact_into`
phil-opp 66b16a3
Create `load_file` function
phil-opp 5b5c5e6
Fix some warnings
phil-opp 6492eab
Load a third stage
phil-opp 7cf073e
Jump to third stage
phil-opp 6369fae
Verify bytes written to protected mode memory
phil-opp af6d192
Rename bios stages
phil-opp 824786b
Set up paging and enter long mode (compatibility mode)
phil-opp 7c0df39
Delete old real mode test code
phil-opp 83ed2c8
Remove old linker script and target file
phil-opp 39ba526
Create prototype for long mode stage 4 and load it
phil-opp 478ea85
Enable debug symbols for stage 3
phil-opp 18afbb1
Fix: Return correct offset from `read_exact`
phil-opp 830b836
Fix: Seek to start before loading bpb
phil-opp bfffdd3
Add cluster index number to cluster struct
phil-opp 694f81b
Print load addresses in stage 2
phil-opp 29e3200
Read file size from file metadata instead of counting it
phil-opp 0f0eb88
Fix: Keep track of total offset when copying to protected mode
phil-opp 3ce77c5
Pass kernel and stage-4 addresses to stage-3
phil-opp b69f8a7
Add a vga buffer writer to stage 3
phil-opp 5eb8264
Minor target tweaks
phil-opp 9b80050
Minor error message fix
phil-opp cd4ec80
Add vga buffer implementation
phil-opp a167ef2
Reorder stage 2 sections to fix relocation out of range error
phil-opp 6a57e01
Create `Addresses` struct to pass the various memory addresses betwee…
phil-opp 900327d
Link stage-4 statically at predefined address
phil-opp 899cec6
Fix: actually use passed `self` pointer in GDT load function
phil-opp 05130d1
Load long mode GDT and jump to 4th stage
phil-opp e5dddcf
Update stage-4 with VGA printing and handling of Addresses struct
phil-opp d893197
Query vesa modes and filter by resolution
phil-opp d7f8990
Fill in VESA framebuffer info in boot information
phil-opp 80b6bee
Remove old assembly file
phil-opp 557c034
Enable VESA framebuffer and update screen writer in stages 3 and 4
phil-opp 48cd6dc
Load E820 memory map and put everything together
phil-opp 7a1e1a7
Also run UEFI tests again
phil-opp a5fe892
Remove vscode config
phil-opp d983247
Switch stage-4 to logger instead of using custom screen writer
phil-opp b007a6b
Don't use LLVM-reserved registers
phil-opp 4f5b574
Rename struct
phil-opp b937096
Fix warnings
phil-opp 7be9e68
Add TODO for VESA resolution config
phil-opp a4a1fb5
Use new resolver
phil-opp 6c01f45
Fix some more warnings
phil-opp d633408
Fix: `repr(packed)` does not imply `repr(C)`
phil-opp d8943dd
Explain why we need to retain the contents of the `si` register
phil-opp 718b471
Remove commented out code
phil-opp 50e4563
Remove unnecessary reference
phil-opp fdc630f
Make `query_memory_map` unsafe
phil-opp 2eed431
Remove smiley write after entering unreal mode
phil-opp 2215d00
Remove nop instructions and explain why we need inline asm to access …
phil-opp 39b5f16
Let compiler select registers when enabling protected mode
phil-opp b00bf34
Let compiler select register when loading GDT
phil-opp bee20ac
Apply suggestions from code review
phil-opp c1d01d6
Remove `noreturn` option again because it disallows clobbers
phil-opp 48ced39
The second stage-4 argument is no longer needed
phil-opp 2550267
Let the compiler select the register for reloading `ds` etc
phil-opp 26a6aee
Use `ptr::write` for writing page table
phil-opp e62a933
Make `read_exact` function unsafe
phil-opp b0e805e
Revert "The second stage-4 argument is no longer needed"
phil-opp 915c25b
Apply more code review suggestions
phil-opp 960671c
Don't panic if kernel file name is shorter than 11 chars
phil-opp 28bd6ca
Remove accidentally commited `main_bak.rs`
phil-opp 47a4c85
Fix last line check for logger
phil-opp 130d5f0
Fix: also consider bitmap width when decided whether a newline is needed
phil-opp 08e4b58
Allocate kernel as normal UEFI loader data
phil-opp c274be7
Make `add_region` panic on error
phil-opp 667e57f
Preserve `RUNTIME_SERVICES_*` memory regions
phil-opp 454f707
Update usage instructions and architecture description in README
phil-opp 7088b53
Fix: Avoid mutable aliasing in `Framebuffer::buffer`
phil-opp 230da17
Fix typo
phil-opp 74ead92
Rename `VeryUnsafeCell` to `RacyCell`
phil-opp 9cf9c4c
Fix width/height bound checks in stage-3 logger
phil-opp f95e9a9
Hide items generate by `entry_point` macro from static/fn namespace
phil-opp 9e567cc
Test booting a kernel compiled with `lto`
phil-opp 076bea9
Fix `force_use` function by using original slice ptr instead of stack…
phil-opp 9a6c884
Merge branch 'main' into next
phil-opp 2ac7140
Improve error message when bootloader config section is not found
phil-opp 305b7f2
Adjust max dimensions for VESA framebuffer
phil-opp 5f51766
Change version back to v0.11-alpha
phil-opp e997c74
Refactor image creation API
phil-opp aebe0d3
Write location first in panic handler
phil-opp 6eb0abb
Fix: Don't overwrite `es` register
phil-opp a6d69e9
Fix: Add support for segments in video mode ptr
phil-opp 80731d7
Take pixel format into account when determining best VESA mode
phil-opp c78a2f5
Add a log message when loading kernel
phil-opp f0e8be2
remove unnecessary duplicate field
Freax13 c9444f5
make framebuffer optional in `common`
Freax13 d6e0d2b
don't fail when there's no uefi graphics output
Freax13 29b9912
Merge pull request #268 from Freax13/optional-framebuffer
phil-opp e02ead7
Merge branch 'main' into next
phil-opp 7ea5ecf
Add basic error strings for deserialization errors
phil-opp 46c7725
Create migration guides
phil-opp 2ceec8a
Create migration guides and a disk image creation template
phil-opp 9f590dc
Merge pull request #280 from rust-osdev/deserialize-errors
phil-opp bb9e7af
Remove unused imports
phil-opp 2ca6ebd
Resolve all remaining warnings and fix build with `--all-targets`
phil-opp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Start integrating BIOS bootloader into build system
We can use an artifact dependency on the outer level since the x86_64-unknown-none target is Tier 2 and thus requires no -Zbuild-std. For the boot_sector, we need to compile with a specific linker script and profile. We might need to duplicate the profile settings in the boot_sector Cargo.toml when publishing.
- Loading branch information
commit eb6d71f244c54031bddbf87042d710bcdd1aa0bb
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "bootloader_first_stage" | ||
name = "bootloader-x86_64-bios-boot-sector" | ||
version = "0.1.0" | ||
authors = ["Philipp Oppermann <[email protected]>"] | ||
edition = "2021" | ||
|
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use std::path::Path; | ||
|
||
fn main() { | ||
let local_path = Path::new(env!("CARGO_MANIFEST_DIR")); | ||
println!( | ||
"cargo:rustc-link-arg-bins=--script={}", | ||
local_path.join("16-bit-linker.ld").display() | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use std::{ | ||
path::{Path, PathBuf}, | ||
process::Command, | ||
}; | ||
|
||
const BOOTLOADER_X86_64_BIOS_BOOT_SECTOR_VERSION: &str = "0.1.0-alpha.0"; | ||
|
||
fn main() { | ||
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); | ||
|
||
let bios_boot_sector_path = build_bios_boot_sector(&out_dir); | ||
|
||
println!( | ||
"cargo:rustc-env=BIOS_BOOT_SECTOR_PATH={}", | ||
bios_boot_sector_path.display() | ||
); | ||
} | ||
|
||
fn build_bios_boot_sector(out_dir: &Path) -> PathBuf { | ||
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into()); | ||
let mut cmd = Command::new(cargo); | ||
cmd.arg("install").arg("bootloader-x86_64-bios-boot-sector"); | ||
let local_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("boot_sector"); | ||
if local_path.exists() { | ||
// local build | ||
cmd.arg("--path").arg(&local_path); | ||
} else { | ||
cmd.arg("--version") | ||
.arg(BOOTLOADER_X86_64_BIOS_BOOT_SECTOR_VERSION); | ||
} | ||
cmd.arg("--locked"); | ||
cmd.arg("--target").arg("x86-16bit.json"); | ||
cmd.arg("--profile").arg("first-stage"); | ||
cmd.arg("-Zbuild-std=core") | ||
.arg("-Zbuild-std-features=compiler-builtins-mem"); | ||
cmd.arg("--root").arg(out_dir); | ||
let status = cmd | ||
.status() | ||
.expect("failed to run cargo install for bios boot sector"); | ||
if status.success() { | ||
let path = out_dir | ||
.join("bin") | ||
.join("bootloader-x86_64-bios-boot-sector"); | ||
assert!( | ||
path.exists(), | ||
"bios boot sector executable does not exist after building" | ||
); | ||
path | ||
} else { | ||
panic!("failed to build bios boot sector"); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.