Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
374a14a
feat: add linker base for aarch64
SergioRibera Feb 16, 2025
42d3669
feat: add linker base for riscv64
SergioRibera Feb 16, 2025
e3ab5f9
feat: update just file to build isos
SergioRibera Feb 16, 2025
b56b69c
ci: update workflow to build and deploy iso variants
SergioRibera Feb 16, 2025
1dc4ee4
feat: make the nix more flexible
SergioRibera Feb 16, 2025
ba304a0
fix: format and clippy toolchain
SergioRibera Feb 16, 2025
29db93e
fix: try to fix nix
SergioRibera Feb 16, 2025
648b474
feat: add variable to build into release
SergioRibera Feb 17, 2025
2a36e83
fix: name of generated iso
SergioRibera Feb 17, 2025
aa536d0
refactor: move variables as env vars
SergioRibera Feb 17, 2025
84b2f11
ci: install just
SergioRibera Feb 17, 2025
16a89f2
feat: op codes support aarch64 and riscv64
SergioRibera Feb 17, 2025
3dee261
feat: get information of cpu for aarch64 and riscv64
SergioRibera Feb 17, 2025
4bf5f7b
feat: add more vendors
SergioRibera Feb 17, 2025
eb7eeea
ci: add as check for pull requests and remove fail-fast
SergioRibera Feb 17, 2025
a403a34
fix: scripts improvements
SergioRibera Feb 17, 2025
5e11cdf
feat: support to run and build with nix
SergioRibera Feb 17, 2025
5f7520e
refactor: remove not supported ovmf
SergioRibera Feb 17, 2025
a9e3129
fix: build iso with nix
SergioRibera Feb 17, 2025
1500185
ci: use nixos to build isos
SergioRibera Feb 17, 2025
61f8d0c
ci: add params to nix action
SergioRibera Feb 17, 2025
5dd25bb
ci: fix generation of image name
SergioRibera Feb 17, 2025
db6bf9f
fix: unclosed parenthesis
SergioRibera Feb 17, 2025
aad0380
fix: upload artifacts
SergioRibera Feb 17, 2025
f903b18
fix: qemu run app
SergioRibera Feb 17, 2025
83ccf8d
refactor: change the linker files to be more suitable for limine
Juanperias Feb 17, 2025
7e47d8f
refactor: change the linker files to be more suitable for limine
Juanperias Feb 17, 2025
b1ed3b0
refactor: remove format in the build rule
Juanperias Feb 17, 2025
a8da558
fix: nix cargo run
SergioRibera Feb 18, 2025
b76289a
fix: rust toolchain
SergioRibera Feb 18, 2025
77be405
feat: support to run with nix
SergioRibera Feb 18, 2025
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
99 changes: 76 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,78 @@ name: Release Build and Publish

permissions:
contents: write
pull-requests: read

on:
push:
tags:
- "v*"
pull_request:
workflow_dispatch:
inputs:
release_name:
description: "Name of release"
description: "Name of release (optional)"
required: false
default: ""
create_release:
description: "Create a GitHub release? (true/false)"
required: false
default: "false"

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: "x86_64"
rust_target: "x86_64-unknown-none"
name: "x86_64"
- arch: "aarch64"
rust_target: "aarch64-unknown-none"
name: "aarch64"
- arch: "aarch64"
rust_target: "aarch64-unknown-uefi"
name: "aarch64-uefi"
- arch: "riscv64"
rust_target: "riscv64imac-unknown-none-elf"
name: "riscv64-imac"
- arch: "riscv64"
rust_target: "riscv64gc-unknown-none-elf"
name: "riscv64-gc"
env:
RUST_PROFILE: "release"
ARCH: "${{ matrix.arch }}"
RUST_TARGET: "${{ matrix.rust_target }}"
IMAGE_NAME: "memsos_${{ matrix.name }}-${{ github.event.inputs.release_name || (github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref_name) }}"

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Build release
run: cargo build --release

- name: Install xorriso
run: sudo apt-get install xorriso
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
experimental-features = nix-command flakes

- name: Convert BIOS image to ISO
- name: Normalize IMAGE_NAME
run: |
mkdir -p isos
cp target/bios.img isos/bios.img
xorriso -as mkisofs -o isos/bios.iso isos/bios.img
IMAGE_NAME=$(echo "${{ env.IMAGE_NAME }}" | tr -cd '[:alnum:]._-')
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV

- name: Convert UEFI image to ISO
- name: Build with Nix
run: |
cp target/uefi.img isos/uefi.img
xorriso -as mkisofs -o isos/uefi.iso isos/uefi.img
echo "Building for ${{ matrix.arch }} with target ${{ matrix.rust_target }}..."
nix build .#${{ matrix.name }}

- name: Get tag or manual release name
id: tag_name
mkdir -p isos
cp result/memsos-${{ matrix.name }}.iso isos/${{ env.IMAGE_NAME }}.iso

- name: Get release name
id: release_name
run: |
if [ -n "${{ github.event.inputs.release_name }}" ]; then
echo "RELEASE_NAME=${{ github.event.inputs.release_name }}" >> $GITHUB_ENV
Expand All @@ -52,19 +85,39 @@ jobs:
id: commit_history
run: |
if [ -n "${{ github.event.inputs.release_name }}" ]; then
# Si es un lanzamiento manual, muestra los últimos 10 commits
echo "COMMIT_HISTORY=$(git log --pretty=format:'- %s (by @%an)' -n 10)" >> $GITHUB_ENV
else
# Si es un lanzamiento automático, muestra los commits desde el último tag
echo "COMMIT_HISTORY=$(git log --pretty=format:'- %s (by @%an)' $(git describe --tags --abbrev=0)..HEAD)" >> $GITHUB_ENV
fi

- name: Upload ISO as artifact
uses: actions/upload-artifact@v4
with:
name: iso-${{ matrix.name }}
path: isos/${{ env.IMAGE_NAME }}.iso

create-release:
runs-on: ubuntu-latest
needs: build
if: ${{ (github.event.inputs.create_release == 'true' || github.event_name == 'push') && github.event_name != 'pull_request' }}
steps:
- name: Download ISOs
uses: actions/download-artifact@v4
with:
path: isos

- name: Combine ISOs into a single folder
run: |
mkdir -p combined_isos
for iso in isos/iso-*/*.iso; do
cp "$iso" combined_isos/
done

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_NAME }}
name: ${{ env.RELEASE_NAME }}
body: ${{ env.COMMIT_HISTORY }}
tag_name: ${{ needs.build.outputs.RELEASE_NAME }}
name: ${{ needs.build.outputs.RELEASE_NAME }}
body: ${{ needs.build.outputs.COMMIT_HISTORY }}
files: |
isos/bios.iso
isos/uefi.iso
combined_isos/*.iso
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ memfile
limine
iso_root
ovmf
memsos-x86_64.iso
memsos*.iso
34 changes: 17 additions & 17 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2021"
ovmf-prebuilt = "0.1.0-alpha.1"

[workspace]
members = [ "crates/core", "crates/os", "kernel"]
members = ["crates/core", "crates/os", "kernel"]
33 changes: 21 additions & 12 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
QEMU_FLAGS := env_var_or_default("QEMU_FLAGS", "")
IMAGE_NAME := "memsos-x86_64"
# Arch: x86_64, aarch64, riscv64
ARCH := env("ARCH", "x86_64")
RUST_TARGET := env("RUST_TARGET", "x86_64-unknown-none")
IMAGE_NAME := env("IMAGE_NAME", "memsos_" + ARCH)
QEMU_FLAGS := env("QEMU_FLAGS", "")
OVMF_DIR := "ovmf"
LIMINE_DIR := "limine"
ARCH := "x86_64"

# Run vm
# UEFI prefix from ARCH
UEFI_SUFFIX := `\
if [ "{{ARCH}}" = "x86_64" ]; then \
echo "X64"; \
elif [ "{{ARCH}}" = "aarch64" ]; then \
echo "AA64"; \
elif [ "{{ARCH}}" = "riscv64" ]; then \
echo "RISCV64"; \
else \
echo "IA32"; \
fi`

# Run vm
run-uefi: build ovmf
qemu-system-{{ARCH}} \
-M q35 \
Expand All @@ -29,7 +42,6 @@ run-bios: build


# OVMF build

ovmf:
test -d {{OVMF_DIR}} || (mkdir -p {{OVMF_DIR}} && curl -Lo {{OVMF_DIR}}/ovmf-code-{{ARCH}}.fd https://github.com/osdev0/edk2-ovmf-nightly/releases/latest/download/ovmf-code-{{ARCH}}.fd && curl -Lo {{OVMF_DIR}}/ovmf-vars-{{ARCH}}.fd https://github.com/osdev0/edk2-ovmf-nightly/releases/latest/download/ovmf-vars-{{ARCH}}.fd)

Expand All @@ -40,31 +52,28 @@ limine:
make -C {{LIMINE_DIR}}

# Kernel build

kernel:
just kernel/


# Image build

build: limine kernel
rm -rf iso_root
mkdir -p iso_root/boot
cp -v kernel/kernel iso_root/boot/
mkdir -p iso_root/boot/limine
cp -v limine.conf iso_root/boot/limine/
mkdir -p iso_root/EFI/BOOT
mkdir -p iso_root/EFI/BOOT

cp -v limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/boot/limine/
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/
cp -v limine/BOOT{{UEFI_SUFFIX}}.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs -b boot/limine/limine-bios-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot boot/limine/limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o {{IMAGE_NAME}}.iso
./limine/limine bios-install {{IMAGE_NAME}}.iso

./limine/limine bios-install {{IMAGE_NAME}}.iso
rm -rf iso_root

clean:
Expand Down
Loading
Loading