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

Commit 77000ce

Browse files
bors[bot]toku-sa-n
andauthored
Merge #622
622: build: remove lines about the debug build r=toku-sa-n a=toku-sa-n Still this OS cannot build in the debug mode because of compiler's bugs. rust-lang/compiler-builtins#327 bors r+ Co-authored-by: toku-sa-n <[email protected]>
2 parents 5e25f3d + f91e5f3 commit 77000ce

File tree

3 files changed

+11
-37
lines changed

3 files changed

+11
-37
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ jobs:
4343
- name: Copy OVMF_*
4444
run: cp /usr/share/OVMF/OVMF_* .
4545

46-
- name: Test on debug mode
46+
- name: Test
4747
timeout-minutes: 5
4848
run: make test
49-
50-
- name: Test on release mode
51-
timeout-minutes: 5
52-
run: make release_test

Makefile

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ FAT_IMG := $(BUILD_DIR)/fat.img
2727
INITRD := $(BUILD_DIR)/initrd.img
2828

2929
LD := ld
30-
RUSTCC := cargo
30+
RUSTC := cargo
3131
RM := rm -rf
3232
VIEWER := qemu-system-x86_64
3333

@@ -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) && $(RUSTC) 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) && $(RUSTC) build --out-dir=../$(BUILD_DIR) -Z unstable-options $(RUSTCFLAGS)
117101

118102
$(INITRD):|$(BUILD_DIR)
119103
tar cf $@ $(BUILD_DIR)
@@ -126,5 +110,5 @@ clippy:
126110

127111
clean:
128112
$(RM) build
129-
$(RUSTCC) clean --manifest-path=$(KERNEL_DIR)/Cargo.toml
130-
$(RUSTCC) clean --manifest-path=$(EFI_DIR)/Cargo.toml
113+
$(RUSTC) clean --manifest-path=$(KERNEL_DIR)/Cargo.toml
114+
$(RUSTC) clean --manifest-path=$(EFI_DIR)/Cargo.toml

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)