Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 60333d6

Browse files
committed
build: remove lines about the debug build
Still this OS cannot build in the debug mode because of compiler's bugs. rust-lang/compiler-builtins#327
1 parent 5e25f3d commit 60333d6

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

Makefile

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ OVMF_VARS := OVMF_VARS.fd
3636

3737
# If you change values of `iobase` and `iosize`, don't forget to change the corresponding values in `kernel/src/lib.rs`!
3838
VIEWERFLAGS := -drive if=pflash,format=raw,file=$(OVMF_CODE),readonly=on -drive if=pflash,format=raw,file=$(OVMF_VARS),readonly=on -drive format=raw,file=$(IMG_FILE) -no-reboot -m 4G -d int -device isa-debug-exit,iobase=0xf4,iosize=0x04 -device qemu-xhci,id=xhci -device usb-kbd --trace events=trace.event -drive id=disk,file=$(FAT_IMG),if=none,format=raw -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -device usb-mouse
39-
40-
# This is a workaround for `compiler_builtins` crate which is supported only for optimized build.
41-
RELEASE_FLAGS := --release
39+
RUSTCFLAGS := --release
4240

4341
LDFLAGS := -nostdlib -T $(LD_SRC)
4442

45-
.PHONY:all copy_to_usb run test_general test release_test release clippy clean
43+
.PHONY:all copy_to_usb run test clippy clean
4644

4745
.SUFFIXES:
4846

@@ -63,21 +61,13 @@ endif
6361
run:$(IMG_FILE) $(OVMF_VARS) $(OVMF_CODE) $(FAT_IMG) $(INITRD)
6462
$(VIEWER) $(VIEWERFLAGS) -no-shutdown -monitor stdio
6563

66-
test_general:$(INITRD) $(FAT_IMG) $(OVMF_VARS) $(OVMF_CODE)
67-
make $(IMG_FILE) RELEASE_FLAGS=$(RELEASE_FLAGS) TEST_FLAG=--features=qemu_test -B
64+
test:
65+
make clean
66+
make $(IMG_FILE) TEST_FLAG=--features=qemu_test
6867
$(VIEWER) $(VIEWERFLAGS) -nographic; if [[ $$? -eq 33 ]];\
6968
then echo "Booting test succeed! ($(TEST_MODE) mode)"; exit 0;\
7069
else echo "Booting test failed ($(TEST_MODE) mode)"; exit 1;fi
7170

72-
test:
73-
# For some reasons, without `make clean`, consecutive testing will go into the infinite loop.
74-
make clean
75-
make test_general TEST_MODE=debug
76-
77-
release_test:
78-
make clean
79-
make test_general TEST_MODE=release RELEASE_FLAGS=--release
80-
8171
$(IMG_FILE):$(KERNEL_FILE) $(HEAD_FILE) $(EFI_FILE) $(INITRD)
8272
dd if=/dev/zero of=$@ bs=1k count=28800
8373
mformat -i $@ -h 200 -t 500 -s 144::
@@ -93,27 +83,21 @@ $(IMG_FILE):$(KERNEL_FILE) $(HEAD_FILE) $(EFI_FILE) $(INITRD)
9383
$(FAT_IMG):$(IMG_FILE)
9484
cp $^ $@
9585

96-
release:
97-
make RELEASE_FLAGS=--release -B
98-
99-
release_run:
100-
make release && make run
101-
10286
$(KERNEL_FILE):$(LIB_FILE) $(LD_SRC)|$(BUILD_DIR)
10387
$(LD) $(LDFLAGS) -o $@ $(LIB_FILE)
10488

10589
$(LIB_FILE): $(RUST_SRC) $(COMMON_SRC) $(COMMON_SRC_DIR)/$(CARGO_TOML) $(KERNEL_DIR)/$(CARGO_TOML) $(KERNEL_DIR)/$(CARGO_JSON) $(CONFIG_TOML)|$(BUILD_DIR)
10690
# FIXME: Currently `cargo` tries to read `$(pwd)/.cargo/config.toml`, not
10791
# `$(dirname argument_of_--manifest-path)/.cargo/config.toml`.
10892
# See: https://github.com/rust-lang/cargo/issues/2930
109-
cd $(KERNEL_DIR) && $(RUSTCC) build --out-dir ../$(BUILD_DIR) -Z unstable-options $(RELEASE_FLAGS) $(TEST_FLAG)
93+
cd $(KERNEL_DIR) && $(RUSTCC) build --out-dir ../$(BUILD_DIR) -Z unstable-options $(TEST_FLAG) $(RUSTCFLAGS)
11094

11195
%.fd:
11296
@echo "$@ not found"
11397
exit 1
11498

11599
$(EFI_FILE):$(EFI_SRC) $(COMMON_SRC) $(COMMON_SRC_DIR)/$(CARGO_TOML) $(EFI_DIR)/$(CARGO_TOML)|$(BUILD_DIR)
116-
cd $(EFI_DIR) && $(RUSTCC) build --out-dir=../$(BUILD_DIR) -Z unstable-options $(RELEASE_FLAGS)
100+
cd $(EFI_DIR) && $(RUSTCC) build --out-dir=../$(BUILD_DIR) -Z unstable-options $(RUSTCFLAGS)
117101

118102
$(INITRD):|$(BUILD_DIR)
119103
tar cf $@ $(BUILD_DIR)

kernel/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ license = "GPL-3.0-or-later"
99
default = []
1010
qemu_test = []
1111

12-
[profile.dev]
13-
opt-level = 0
14-
15-
# I don't know why lto = false causes some problems like not printing correct words on the screen.
16-
lto = true
17-
1812
[profile.release]
1913
opt-level = 3
2014
lto = true

0 commit comments

Comments
 (0)