Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a standalone Makefile-based build entrypoint under make/ (temporarily copied from ArceOS), and wires the repo root Makefile to delegate build/run/debug targets to it.
Changes:
- Added a new
make/build system (platform/config/feature resolution, Cargo build orchestration, and QEMU launch args). - Added helper scripts/config (
strtosz.py,dwarf.sh,defconfig.toml) to support config generation and debug info handling. - Updated the top-level
Makefileto call intomake/and to place the rootfs disk image undermake/disk.img.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| make/utils.mk | Adds shared helper macros (command echoing + disk image creation). |
| make/strtosz.py | Adds size-string parsing utility used for config generation. |
| make/qemu.mk | Adds QEMU argument composition and run/debug helpers. |
| make/platform.mk | Resolves platform package/config and derives arch/platform names. |
| make/features.mk | Parses feature lists into ArceOS/module/library/app feature sets. |
| make/dwarf.sh | Adds DWARF section extraction/rewrite helper. |
| make/deps.mk | Adds dependency bootstrapping for required Cargo tools. |
| make/defconfig.toml | Adds default config inputs for axconfig-gen. |
| make/config.mk | Adds config generation logic (defconfig/oldconfig) and MEM/SMP derivation. |
| make/cargo.mk | Adds Cargo build argument composition and cargo invocation helper. |
| make/build.mk | Adds core build flow (build ELF/BIN/UIMG, DWARF handling). |
| make/Makefile | Adds the new standalone build entrypoint and targets. |
| Makefile | Redirects top-level targets to make/ and updates disk image output location. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| endif | ||
|
|
||
| qemu_args-$(INPUT) += \ | ||
| -device virtio-mouse-pci -device virtio-keyboard-pci |
There was a problem hiding this comment.
For BUS=mmio, the input devices are still hard-coded to virtio-*-pci. This will make INPUT=y fail on non-PCI virtio setups; consider using the existing $(vdev-suffix) here (and providing the corresponding mmio device names) or gating INPUT to PCI-only.
| -device virtio-mouse-pci -device virtio-keyboard-pci | |
| -device virtio-mouse-$(vdev-suffix) -device virtio-keyboard-$(vdev-suffix) |
|
|
||
| qemu_args-$(INPUT) += \ | ||
| -device virtio-mouse-pci -device virtio-keyboard-pci | ||
|
|
There was a problem hiding this comment.
For BUS=mmio, the vsock device is hard-coded to vhost-vsock-pci. This will break VSOCK=y when mmio is selected; use a bus-appropriate device (or document/enforce that vsock requires BUS=pci).
| ifeq ($(VSOCK), y) | |
| ifneq ($(BUS), pci) | |
| $(error "VSOCK" requires "BUS=pci") | |
| endif | |
| endif |
| include cargo.mk | ||
|
|
||
| ifeq ($(APP_TYPE), c) | ||
| include build_c.mk |
There was a problem hiding this comment.
build.mk includes build_c.mk when APP_TYPE is c, but make/build_c.mk is not present in this PR/repo. Any C app build will fail at include time; either add build_c.mk (and its targets) or remove/guard the C path until it’s supported.
| include build_c.mk | |
| $(error C app builds are not supported in this repository (missing make/build_c.mk)) |
| clean: clean_c | ||
| rm -rf $(APP)/*.bin $(APP)/*.elf $(OUT_CONFIG) |
There was a problem hiding this comment.
clean depends on clean_c, but no clean_c target/rule is provided in the current make system. This makes make clean fail with “No rule to make target 'clean_c'”; either define clean_c (likely in the missing build_c.mk) or remove it from the prerequisite list.
| UIMAGE ?= n | ||
|
|
||
| # App options | ||
| A ?= examples/helloworld |
There was a problem hiding this comment.
The default app path is set to examples/helloworld, but that path doesn’t exist in this repository. As a result, running make -C make with defaults fails immediately; consider defaulting APP to an existing crate (e.g. . or kernel) or making APP mandatory with a clearer error message.
| A ?= examples/helloworld | |
| A ?= . |
| # Tool to parse information about the target package | ||
| ifeq ($(shell cargo axplat --version 2>/dev/null),) | ||
| $(info Installing cargo-axplat...) | ||
| $(shell cargo install cargo-axplat) | ||
| endif | ||
|
|
||
| # Tool to generate platform configuration files | ||
| ifeq ($(shell axconfig-gen --version 2>/dev/null),) | ||
| $(info Installing axconfig-gen...) | ||
| $(shell cargo install axconfig-gen) | ||
| endif | ||
|
|
||
| # Cargo binutils | ||
| ifeq ($(shell cargo install --list | grep cargo-binutils),) | ||
| $(info Installing cargo-binutils...) | ||
| $(shell cargo install cargo-binutils) | ||
| endif |
There was a problem hiding this comment.
This Makefile auto-installs build dependencies via cargo install during Makefile evaluation. This has operational downsides (network access during make, non-reproducible tool versions, and it runs even for targets like clean); prefer failing with a clear message and a separate explicit deps/bootstrap target, and use cargo install --locked if you keep installation.
| # Tool to parse information about the target package | |
| ifeq ($(shell cargo axplat --version 2>/dev/null),) | |
| $(info Installing cargo-axplat...) | |
| $(shell cargo install cargo-axplat) | |
| endif | |
| # Tool to generate platform configuration files | |
| ifeq ($(shell axconfig-gen --version 2>/dev/null),) | |
| $(info Installing axconfig-gen...) | |
| $(shell cargo install axconfig-gen) | |
| endif | |
| # Cargo binutils | |
| ifeq ($(shell cargo install --list | grep cargo-binutils),) | |
| $(info Installing cargo-binutils...) | |
| $(shell cargo install cargo-binutils) | |
| endif | |
| # Install required build tools explicitly via `make deps`. | |
| # This avoids running `cargo install` during Makefile evaluation. | |
| .PHONY: deps | |
| deps: | |
| @echo "Installing build dependencies (cargo-axplat, axconfig-gen, cargo-binutils)..." | |
| @cargo install --locked cargo-axplat | |
| @cargo install --locked axconfig-gen | |
| @cargo install --locked cargo-binutils |
| -o "$(OUT_CONFIG)" | ||
|
|
||
| ifneq ($(MEM),) | ||
| config_args += -w 'plat.phys-memory-size=$(shell ./strtosz.py $(MEM))' |
There was a problem hiding this comment.
$(shell ./strtosz.py $(MEM)) runs inside $(shell ...), which ignores the command’s exit status. If parsing fails, Make will keep going with an empty/partial value (and Python will emit a stack trace). Consider validating MEM in Make (and using $(error ...) on failure) or reworking this so a parsing failure reliably stops the build with a concise message.
| config_args += -w 'plat.phys-memory-size=$(shell ./strtosz.py $(MEM))' | |
| MEM_PARSED := $(shell ./strtosz.py $(MEM)) | |
| ifeq ($(MEM_PARSED),) | |
| $(error "Failed to parse MEM='$(MEM)'. Please specify a valid memory size (e.g. 1G, 512M).") | |
| endif | |
| config_args += -w 'plat.phys-memory-size=$(MEM_PARSED)' |
| # - `LD_SCRIPT`: Use a custom linker script file. | ||
| # * App options: | ||
| # - `A` or `APP`: Path to the application | ||
| # - `FEATURES`: Features os ArceOS modules to be enabled. |
There was a problem hiding this comment.
Doc comment typo: “Features os ArceOS modules” should be “Features of ArceOS modules”.
| # - `FEATURES`: Features os ArceOS modules to be enabled. | |
| # - `FEATURES`: Features of ArceOS modules to be enabled. |
| endif | ||
|
|
||
| ifneq ($(VFIO_PCI),) | ||
| qemu_args-y += --device vfio-pci,host=$(VFIO_PCI) |
There was a problem hiding this comment.
qemu_args-y uses --device vfio-pci,... but QEMU’s option is -device (single dash). With the current flag, QEMU will fail to parse the arguments when VFIO_PCI is set.
| qemu_args-y += --device vfio-pci,host=$(VFIO_PCI) | |
| qemu_args-y += -device vfio-pci,host=$(VFIO_PCI) |
| endif | ||
| PLAT_CONFIG := $(strip $(call resolve_config)) | ||
| # We don't need to check whether `PLAT_CONFIG` is valid here, as the `PLAT_PACKAGE` | ||
| # is a valid pacakage. |
There was a problem hiding this comment.
Typo in comment: “pacakage” should be “package”.
| # is a valid pacakage. | |
| # is a valid package. |
For now, ArceOS makefiles are copied over temporarily; the build system will be redesigned later.