Skip to content

Commit 71f574d

Browse files
authored
Merge pull request #283 from rust-osdev/release
Prepare for v0.11 release and fix remaining issues
2 parents 4e2b8d7 + c716ac8 commit 71f574d

File tree

20 files changed

+289
-74
lines changed

20 files changed

+289
-74
lines changed

Diff for: .github/workflows/release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
release:
10+
name: "Release"
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
environment: crates_io_release
14+
15+
steps:
16+
- name: "Checkout Repository"
17+
uses: actions/checkout@v1
18+
19+
- run: cargo publish -p bootloader_api
20+
env:
21+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
22+
23+
- run: cargo publish -p bootloader-x86_64-bios-common
24+
env:
25+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
26+
- run: cargo publish -p bootloader-x86_64-common
27+
env:
28+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
29+
30+
- run: cargo publish -p bootloader-x86_64-bios-boot-sector --no-verify
31+
env:
32+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
33+
- run: cargo publish -p bootloader-x86_64-bios-stage-2 --no-verify
34+
env:
35+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
36+
- run: cargo publish -p bootloader-x86_64-bios-stage-3 --no-verify
37+
env:
38+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
39+
- run: cargo publish -p bootloader-x86_64-bios-stage-4 --no-verify
40+
env:
41+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
42+
43+
- run: cargo publish -p bootloader-x86_64-uefi --no-verify
44+
env:
45+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
46+
47+
- run: cargo publish -p bootloader
48+
env:
49+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Diff for: .github/workflows/trigger-release.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Trigger Release
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
check:
10+
name: Trigger Release
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: "Install Python Libraries"
18+
run: python -m pip install --user -r .github/workflows/trigger-release/requirements.txt
19+
20+
- name: "Run release script"
21+
run: "python3 .github/workflows/trigger-release/trigger-release.py"
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/trigger-release/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
toml

Diff for: .github/workflows/trigger-release/trigger-release.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import toml
2+
import requests
3+
import subprocess
4+
5+
cargo_toml = toml.load("Cargo.toml")
6+
crate_version = cargo_toml["workspace"]["package"]["version"]
7+
print("Detected crate version " + crate_version)
8+
9+
api_url = "https://crates.io/api/v1/crates/bootloader/" + crate_version
10+
released_version = requests.get(api_url).json()
11+
12+
if "version" in released_version:
13+
version = released_version["version"]
14+
assert (version["crate"] == "bootloader")
15+
assert (version["num"] == crate_version)
16+
print("Version " + crate_version + " already exists on crates.io")
17+
18+
else:
19+
print("Could not find version " + crate_version +
20+
" on crates.io; creating a new release")
21+
22+
tag_name = "v" + crate_version
23+
print(" Tagging commit as " + tag_name)
24+
sha = subprocess.run(["git", "rev-parse", "HEAD"], check=True,
25+
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
26+
subprocess.run([
27+
"gh", "api", "/repos/rust-osdev/x86_64/git/refs",
28+
"-X", "POST", "-H", "Accept: application/vnd.github.v3+json",
29+
"-F", "ref=refs/tags/" + tag_name,
30+
"-F", "sha="+sha
31+
])
32+
33+
subprocess.run([
34+
"gh", "api", "--method", "POST", "-H", "Accept: application/vnd.github+json",
35+
"/repos/rust-osdev/bootloader/releases",
36+
"-f", f"tag_name='{tag_name}'", "-f", f"target_commitish='{sha}'",
37+
"-f", f"name='{tag_name}'",
38+
"-f", "body='[Changelog](https://github.com/rust-osdev/bootloader/blob/main/Changelog.md)'",
39+
"-F", "draft=false", "-F", "prerelease=false", "-F", "generate_release_notes=false",
40+
])
41+
42+
print(" Done")

Diff for: Cargo.lock

+29-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+19-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ cargo-features = ["profile-rustflags"]
22

33
[package]
44
name = "bootloader"
5-
version = "0.11.0-alpha"
6-
authors = ["Philipp Oppermann <[email protected]>"]
7-
license = "MIT/Apache-2.0"
85
description = "An experimental x86_64 bootloader that works on both BIOS and UEFI systems."
9-
repository = "https://github.com/rust-osdev/bootloader"
6+
license.workspace = true
7+
version.workspace = true
8+
repository.workspace = true
9+
authors = ["Philipp Oppermann <[email protected]>"]
1010
edition = "2021"
1111

1212
[workspace]
@@ -26,12 +26,21 @@ members = [
2626
]
2727
exclude = ["examples/basic", "examples/test_framework"]
2828

29+
[workspace.package]
30+
version = "0.11.0-beta.4"
31+
license = "MIT/Apache-2.0"
32+
repository = "https://github.com/rust-osdev/bootloader"
33+
34+
[workspace.dependencies]
35+
bootloader_api = { version = "0.11.0-beta.4", path = "api" }
36+
bootloader-x86_64-common = { version = "0.11.0-beta.4", path = "common" }
37+
bootloader-x86_64-bios-common = { version = "0.11.0-beta.4", path = "bios/common" }
2938

3039
[dependencies]
3140
anyhow = "1.0.32"
3241
fatfs = "0.3.4"
3342
gpt = "3.0.0"
34-
mbrman = "0.4.2"
43+
mbrman = "0.5.1"
3544
tempfile = "3.3.0"
3645

3746
[dev-dependencies]
@@ -50,6 +59,7 @@ lto = false
5059
debug = true
5160
overflow-checks = true
5261

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

71+
# duplicated from `bios/stage-2/Cargo.toml`
6172
[profile.stage-2]
6273
inherits = "release"
6374
opt-level = "s"
6475
codegen-units = 1
6576
debug = false
6677
overflow-checks = true
6778

79+
# duplicated from `bios/stage-3/Cargo.toml`
6880
[profile.stage-3]
6981
inherits = "release"
7082
debug = true
7183
overflow-checks = true
7284

85+
# duplicated from `bios/stage-4/Cargo.toml`
7386
[profile.stage-4]
7487
inherits = "release"
7588
debug = true
@@ -93,7 +106,7 @@ rustflags = [
93106
llvm-tools = "0.1.1"
94107

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

98111
[package.metadata.release]
99112
dev-version = false

Diff for: Changelog.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Unreleased
22

3+
Major rewrite of the `bootloader` crate with various breaking changes:
4+
5+
- **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.
6+
- **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.
7+
- **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.
8+
- **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.
9+
- **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.
10+
11+
See our [migration guides](docs/migration/README.md) for details.
12+
313
# 0.10.13 – 2022-09-25
414

515
- Add dynamic range configuration ([#229](https://github.com/rust-osdev/bootloader/pull/229))

Diff for: api/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[package]
22
name = "bootloader_api"
3-
version = "0.1.0-alpha.0"
3+
license.workspace = true
4+
version.workspace = true
5+
repository.workspace = true
46
edition = "2021"
57
description = "Makes a kernel compatible with the bootloader crate"
6-
license = "MIT/Apache-2.0"
78

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

0 commit comments

Comments
 (0)