Skip to content

Commit

Permalink
Makefile.toml: Download 'towbootctl' from GitHub releases
Browse files Browse the repository at this point in the history
  • Loading branch information
fruhland committed Jun 26, 2024
1 parent 3378ecd commit 8fd6ba0
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 71 deletions.
102 changes: 39 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,26 @@ jobs:
with:
apt: build-essential nasm

- name: Install Rust for x86_64 Linux
uses: actions-rs/toolchain@v1
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
override: true
target: x86_64-unknown-linux-gnu
components: rust-src
- name: Install Rust for i686 UEFI
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: i686-unknown-uefi
- name: Install Rust for x86_64 UEFI
uses: actions-rs/toolchain@v1
components: "rust-src"

- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
toolchain: nightly
target: x86_64-unknown-uefi
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
cache-all-crates: true
cache-on-failure: true

- name: Install cargo-make
run: cargo install --no-default-features cargo-make

- name: Install towbootctl
run: cargo install --git https://github.com/hhuOS/towboot --features=binary -Z bindeps towbootctl

- name: Build
run: cargo make --no-workspace image
uses: clechasseur/rs-cargo@v2
with:
command: make
args: --no-workspace image

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -55,32 +49,26 @@ jobs:
with:
brew: x86_64-elf-binutils nasm

- name: Install Rust for x86_64 MacOS
uses: actions-rs/toolchain@v1
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
override: true
target: x86_64-apple-darwin
components: rust-src
- name: Install Rust for i686 UEFI
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: i686-unknown-uefi
- name: Install Rust for x86_64 UEFI
uses: actions-rs/toolchain@v1
components: "rust-src"

- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
toolchain: nightly
target: x86_64-unknown-uefi
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
cache-all-crates: true
cache-on-failure: true

- name: Install cargo-make
run: cargo install --no-default-features cargo-make

- name: Install towbootctl
run: cargo install --git https://github.com/hhuOS/towboot --features=binary -Z bindeps towbootctl

- name: Build
run: cargo make --no-workspace image
uses: clechasseur/rs-cargo@v2
with:
command: make
args: --no-workspace image

build-on-apple-silicon-mac:
runs-on: macos-14
Expand All @@ -92,35 +80,23 @@ jobs:
with:
brew: x86_64-elf-binutils nasm

- name: Install Rust for AArch64 MacOS
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
target: aarch64-apple-darwin
components: rust-src
- name: Install Rust for x86_64 MacOS
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: x86_64-apple-darwin
components: rust-src
- name: Install Rust for i686 UEFI
uses: actions-rs/toolchain@v1
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
target: i686-unknown-uefi
- name: Install Rust for x86_64 UEFI
uses: actions-rs/toolchain@v1
components: "rust-src"

- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
toolchain: nightly
target: x86_64-unknown-uefi
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
cache-all-crates: true
cache-on-failure: true

- name: Install cargo-make
run: cargo install --no-default-features cargo-make

- name: Install towbootctl
run: cargo install --git https://github.com/hhuOS/towboot --features=binary -Z bindeps towbootctl

- name: Build
run: cargo make --no-workspace image
uses: clechasseur/rs-cargo@v2
with:
command: make
args: --no-workspace image
26 changes: 21 additions & 5 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
BOOTLOADER_DIRECTORY = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/loader"
INITRD_DIRECTORY = "${BOOTLOADER_DIRECTORY}/initrd"
OVMF_URL = "https://retrage.github.io/edk2-nightly/bin/RELEASEX64_OVMF.fd"
TOWBOOT_VERSION = "0.9.0"
TOWBOOT_URL = "https://github.com/hhuOS/towboot/releases/download/v${TOWBOOT_VERSION}/towbootctl-v${TOWBOOT_VERSION}"
LINKER = "ld"
LINKER_MAC = "x86_64-elf-ld"
PATH = "${PATH}:~/.cargo/bin"

[tasks.default]
alias = "qemu"
Expand Down Expand Up @@ -39,7 +40,6 @@ args = [ "-machine", "q35,pcspk-audiodev=audio0", "-m", "128M", "-cpu", "qemu64"
[tasks.qemu-no-compile.mac]
args = [ "-machine", "q35,pcspk-audiodev=audio0", "-m", "128M", "-cpu", "qemu64", "-bios", "RELEASEX64_OVMF.fd", "-boot", "d", "-vga", "std", "-rtc", "base=localtime", "-drive", "driver=raw,node-name=boot,file.driver=file,file.filename=d3os.img", "-audiodev", "id=audio0,driver=coreaudio" ]


[tasks.ovmf]
command = "wget"
args = [ "-N", "${OVMF_URL}" ]
Expand All @@ -66,9 +66,24 @@ command = "gtar"

[tasks.image]
cwd = "${BOOTLOADER_DIRECTORY}"
command = "towbootctl"
command = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/towbootctl"
args = [ "image", "--target", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/d3os.img", "--", "-config", "towboot.toml"]
dependencies = [ "link-members", "initrd" ]
dependencies = [ "link-members", "initrd", "towbootctl" ]

[tasks.towbootctl-download]
condition = { files_not_exist = [ "towbootctl" ] }
command = "wget"
args = [ "-O", "towbootctl", "${TOWBOOT_URL}-x86_64-linux" ]

[tasks.towbootctl-download.mac]
condition = { files_not_exist = [ "towbootctl" ] }
command = "wget"
args = [ "-O", "towbootctl", "${TOWBOOT_URL}-macos.-macos" ]

[tasks.towbootctl]
command = "chmod"
args = [ "+x", "towbootctl" ]
dependencies = [ "towbootctl-download" ]

# Cleanup tasks

Expand All @@ -82,7 +97,8 @@ args = [ "-rf",
"${BOOTLOADER_DIRECTORY}/kernel.elf",
"${BOOTLOADER_DIRECTORY}/initrd.tar",
"${INITRD_DIRECTORY}",
"RELEASEX64_OVMF.fd" ]
"RELEASEX64_OVMF.fd",
"towbootctl"]

[tasks.clean-members]
run_task = { name = "clean", fork = true }
2 changes: 1 addition & 1 deletion os/application/date/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ runtime = { path = "../../library/runtime" }
io = { path = "../../library/io" }
time = { path = "../../library/time" }

chrono = { version = "0.4.34", default-features = false, features = ["alloc"] }
chrono = { version = "0.4.38", default-features = false, features = ["alloc"] }
4 changes: 2 additions & 2 deletions os/kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ syscall = { path = "../library/syscall" }
spin = "0.9.8"
x86_64 = "0.15.1"
linked_list_allocator = { version = "0.10.5", features = ["alloc_ref"] }
multiboot2 = "0.20.0"
multiboot2 = "0.20.2"
ps2 = "0.2.0"
pc-keyboard = "0.7.0"
anstyle-parse = "0.2.4"
Expand All @@ -36,7 +36,7 @@ uefi = { version = "0.28.0", features = ["alloc"] }
log = "0.4.20"
goblin = { version = "0.8.2", default-features = false, features = ["elf32", "elf64", "endian_fd"]}
tar-no-std = "0.3.1"
pci_types = "0.9.1"
pci_types = "0.10.0"

[build-dependencies]
built = { version = "0.7.3", features = ["chrono", "git2"] }
Binary file added towbootctl
Binary file not shown.

0 comments on commit 8fd6ba0

Please sign in to comment.