From 09522e8344d5ab36fc3aad53443abc059a4413db Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Wed, 30 Jun 2021 11:29:51 +0900 Subject: [PATCH] chore(kernel): avoid to compile `build.rs` wrongly (#84) Without specifying a target, `build.rs` will also be compiled with the same codegen options. See: https://github.com/rust-lang/cargo/issues/6375#issuecomment-444900324 --- Makefile | 2 +- kernel/.cargo/config.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 395c72f1..77239173 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ KERNEL_SRCS = $(shell find $(KERNEL_DIR) -name *.rs) KERNEL_SRCS += $(KERNEL_DIR)/Cargo.toml KERNEL_SRCS += $(KERNEL_DIR)/.cargo/config.toml KERNEL_SRCS += $(KERNEL_DIR)/kernel.ld -KERNEL = target/debug/kernel +KERNEL = target/$(ARCH)-unknown-linux-gnu/debug/kernel ISO_FILE = $(BUILD_DIR)/antei.iso diff --git a/kernel/.cargo/config.toml b/kernel/.cargo/config.toml index f6f8e89e..0b454e1b 100644 --- a/kernel/.cargo/config.toml +++ b/kernel/.cargo/config.toml @@ -1,4 +1,7 @@ [build] +target = "x86_64-unknown-linux-gnu" + +[target.x86_64-unknown-linux-gnu] rustflags = [ "-C", "code-model=kernel", "-C", "link-args=-T kernel/kernel.ld",