Skip to content
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

Prepare for v0.11 release and fix remaining issues #283

Merged
merged 21 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a3aee58
Set version numbers
phil-opp Nov 13, 2022
e97fa4f
Set license and repository link for all crates
phil-opp Nov 13, 2022
852320f
Add a description for BIOS boot sector crate
phil-opp Nov 13, 2022
c920a5a
Duplicate profile in sub-crate for publishing
phil-opp Nov 13, 2022
c09aca8
Add descriptions for BIOS crates
phil-opp Nov 13, 2022
2572926
Duplicate profile sections in BIOS sub-crate for publishing
phil-opp Nov 13, 2022
b285e67
Update dependency versions in build script
phil-opp Nov 13, 2022
6ae1660
Set up dummy build script for docs.rs
phil-opp Nov 14, 2022
c242c84
Bump version to v0.11.0-beta.1
phil-opp Nov 14, 2022
4c5a4a0
Shrink down boot sector
phil-opp Nov 26, 2022
11736be
Remove some `rerun-if-changed` commands to fix #286
phil-opp Nov 26, 2022
1480098
Use unified version across all sub-crates to simplify release process
phil-opp Nov 27, 2022
aed9462
Add a release CI job
phil-opp Nov 27, 2022
c15405c
Bump version to v0.11.0-beta.2
phil-opp Nov 27, 2022
d8d9086
Replace `mbrman` with fork to avoid yanked `funty` version
phil-opp Nov 27, 2022
35b78b3
Add a `docs/README.md` overview page
phil-opp Nov 27, 2022
95d046a
Create a changelog entry
phil-opp Nov 27, 2022
85b6b0f
Use package version for dependencies in `build.rs`
phil-opp Nov 27, 2022
c0d4486
Bump version to v0.11.0-beta.4
phil-opp Nov 27, 2022
7fca949
Switch back to upstream `mbrman` crate again and update to `v0.5.1`
phil-opp Dec 1, 2022
c716ac8
Create CI script to trigger a release on new version in Cargo.toml
phil-opp Dec 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
release:
types:
- published

jobs:
release:
name: "Release"
runs-on: ubuntu-latest
timeout-minutes: 15
environment: crates_io_release

steps:
- name: "Checkout Repository"
uses: actions/checkout@v1

- run: cargo publish -p bootloader_api
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- run: cargo publish -p bootloader-x86_64-bios-common
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- run: cargo publish -p bootloader-x86_64-common
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- run: cargo publish -p bootloader-x86_64-bios-boot-sector --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- run: cargo publish -p bootloader-x86_64-bios-stage-2 --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- run: cargo publish -p bootloader-x86_64-bios-stage-3 --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- run: cargo publish -p bootloader-x86_64-bios-stage-4 --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- run: cargo publish -p bootloader-x86_64-uefi --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- run: cargo publish -p bootloader
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/trigger-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Trigger Release

on:
push:
branches:
- "main"

jobs:
check:
name: Trigger Release
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3

- name: "Install Python Libraries"
run: python -m pip install --user -r .github/workflows/trigger-release/requirements.txt

- name: "Run release script"
run: "python3 .github/workflows/trigger-release/trigger-release.py"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/trigger-release/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
toml
42 changes: 42 additions & 0 deletions .github/workflows/trigger-release/trigger-release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import toml
import requests
import subprocess

cargo_toml = toml.load("Cargo.toml")
crate_version = cargo_toml["workspace"]["package"]["version"]
print("Detected crate version " + crate_version)

api_url = "https://crates.io/api/v1/crates/bootloader/" + crate_version
released_version = requests.get(api_url).json()

if "version" in released_version:
version = released_version["version"]
assert (version["crate"] == "bootloader")
assert (version["num"] == crate_version)
print("Version " + crate_version + " already exists on crates.io")

else:
print("Could not find version " + crate_version +
" on crates.io; creating a new release")

tag_name = "v" + crate_version
print(" Tagging commit as " + tag_name)
sha = subprocess.run(["git", "rev-parse", "HEAD"], check=True,
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
subprocess.run([
"gh", "api", "/repos/rust-osdev/x86_64/git/refs",
"-X", "POST", "-H", "Accept: application/vnd.github.v3+json",
"-F", "ref=refs/tags/" + tag_name,
"-F", "sha="+sha
])

subprocess.run([
"gh", "api", "--method", "POST", "-H", "Accept: application/vnd.github+json",
"/repos/rust-osdev/bootloader/releases",
"-f", f"tag_name='{tag_name}'", "-f", f"target_commitish='{sha}'",
"-f", f"name='{tag_name}'",
"-f", "body='[Changelog](https://github.com/rust-osdev/bootloader/blob/main/Changelog.md)'",
"-F", "draft=false", "-F", "prerelease=false", "-F", "generate_release_notes=false",
])

print(" Done")
48 changes: 29 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ cargo-features = ["profile-rustflags"]

[package]
name = "bootloader"
version = "0.11.0-alpha"
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
license = "MIT/Apache-2.0"
description = "An experimental x86_64 bootloader that works on both BIOS and UEFI systems."
repository = "https://github.com/rust-osdev/bootloader"
license.workspace = true
version.workspace = true
repository.workspace = true
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
edition = "2021"

[workspace]
Expand All @@ -26,12 +26,21 @@ members = [
]
exclude = ["examples/basic", "examples/test_framework"]

[workspace.package]
version = "0.11.0-beta.4"
license = "MIT/Apache-2.0"
repository = "https://github.com/rust-osdev/bootloader"

[workspace.dependencies]
bootloader_api = { version = "0.11.0-beta.4", path = "api" }
bootloader-x86_64-common = { version = "0.11.0-beta.4", path = "common" }
bootloader-x86_64-bios-common = { version = "0.11.0-beta.4", path = "bios/common" }

[dependencies]
anyhow = "1.0.32"
fatfs = "0.3.4"
gpt = "3.0.0"
mbrman = "0.4.2"
mbrman = "0.5.1"
tempfile = "3.3.0"

[dev-dependencies]
Expand All @@ -50,6 +59,7 @@ lto = false
debug = true
overflow-checks = true

# duplicated from `bios/boot_sector/Cargo.toml`
[profile.stage-1]
inherits = "release"
opt-level = "s"
Expand All @@ -58,18 +68,21 @@ codegen-units = 1
debug = false
overflow-checks = false

# duplicated from `bios/stage-2/Cargo.toml`
[profile.stage-2]
inherits = "release"
opt-level = "s"
codegen-units = 1
debug = false
overflow-checks = true

# duplicated from `bios/stage-3/Cargo.toml`
[profile.stage-3]
inherits = "release"
debug = true
overflow-checks = true

# duplicated from `bios/stage-4/Cargo.toml`
[profile.stage-4]
inherits = "release"
debug = true
Expand All @@ -93,7 +106,7 @@ rustflags = [
llvm-tools = "0.1.1"

[package.metadata.docs.rs]
default-target = "x86_64-unknown-linux-gnu"
rustc-args = ["--cfg", "docsrs_dummy_build"]

[package.metadata.release]
dev-version = false
Expand Down
10 changes: 10 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Unreleased

Major rewrite of the `bootloader` crate with various breaking changes:

- **Separate API crate:** The bootloader is now split into two parts: An API crate to make kernels loadable by the bootloader and the actual bootloader implementation. This makes the build process for kernels much easier and faster.
- **New config system:** Instead of configuring the bootloader via a special table in the `Cargo.toml`, the configuration now happens through a normal Rust struct, which is part of the `entry_point!` macro. The macro then serializes the config struct at compile time and places it in a special ELF output section. The compile time serialization happens through a manually implemented `const fn` of the config struct.
- **Load the kernel at runtime:** The bootloader is now able to load files from FAT partitions at runtime. Thus, we don't need to link the kernel into the bootloader executable anymore. As a result, we don't need to recompile the bootloader on kernel changes anymore. We also load the config at runtime from the kernel's ELF section, which eliminates the second reason for recompiling the bootloader as well.
- **Split into sub-crates:** Since the bootloader build process does not need access to the kernel executable or its `Cargo.toml` anymore, we can build the different parts of the bootloader independently. For example, the BIOS boot sector is now a separate crate, and the UEFI bootloader is too.
- **Library to create disk images:** To create an abstraction the complex build steps of the different bootloader executables, we compile them inside cargo build scripts. At the top level, we provide a `bootloader` _library_ crate, which compiles everything as part of its build script. This library includes functions for creating BIOS and UEFI disk images for a given kernel. These functions can be used e.g. from a builder crate or a build script of the downstream operating system.

See our [migration guides](docs/migration/README.md) for details.

# 0.10.13 – 2022-09-25

- Add dynamic range configuration ([#229](https://github.com/rust-osdev/bootloader/pull/229))
Expand Down
5 changes: 3 additions & 2 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[package]
name = "bootloader_api"
version = "0.1.0-alpha.0"
license.workspace = true
version.workspace = true
repository.workspace = true
edition = "2021"
description = "Makes a kernel compatible with the bootloader crate"
license = "MIT/Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
Loading