Skip to content

Commit

Permalink
Test ci (#1)
Browse files Browse the repository at this point in the history
* update Makefile for github CI on loongarch64

* update example/Makefile for github ci

* update Makefile for github CI

* update Makefile for github CI

---------

Co-authored-by: chyyuu <[email protected]>
  • Loading branch information
chyyuu and chyyuu-tsinghua-cs authored May 4, 2024
1 parent 7b4825b commit a1f632c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
# Building
ARCH := riscv64
QEMU_EXEC := timeout 40


ifeq ($(ARCH), x86_64)
TARGET := x86_64-unknown-none
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-x86_64 \
-machine q35 \
-kernel $(KERNEL_ELF) \
-cpu IvyBridge-v2
BUS := pci
else ifeq ($(ARCH), riscv64)
TARGET := riscv64gc-unknown-none-elf
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-$(ARCH) \
-machine virt \
-kernel $(KERNEL_BIN)
else ifeq ($(ARCH), aarch64)
TARGET := aarch64-unknown-none-softfloat
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-$(ARCH) \
-cpu cortex-a72 \
-machine virt \
-kernel $(KERNEL_BIN)
else ifeq ($(ARCH), loongarch64)
TARGET := loongarch64-unknown-none
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-$(ARCH) -kernel $(KERNEL_ELF)
BUILD_ARGS += -Z build-std=core,alloc
BUS := pci
else
$(error "ARCH" must be one of "x86_64", "riscv64", "aarch64" or "loongarch64")
endif

KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin

# Binutils
OBJDUMP := rust-objdump --arch-name=riscv64
OBJCOPY := rust-objcopy --binary-architecture=riscv64
Expand All @@ -54,15 +62,16 @@ clean:

run: run-inner

QEMU_EXEC += -nographic -smp 1
QEMU_EXEC += -nographic -smp 1 >output.log 2>&1

run-inner: build
$(QEMU_EXEC)
$(QEMU_EXEC) || echo "QEMU exited"
grep "\[kernel\] Hello, world!" output.log

test:
make ARCH=aarch64 run
make ARCH=riscv64 run
make ARCH=x86_64 run
# make ARCH=loongarch64 run
make ARCH=loongarch64 run

.PHONY: build env kernel clean run-inner

0 comments on commit a1f632c

Please sign in to comment.