|
|
@ -22,8 +22,9 @@ grub_cfg := $(boot_src)/grub.cfg
|
|
|
|
assembly_source_files := $(wildcard $(boot_src)/*.asm)
|
|
|
|
assembly_source_files := $(wildcard $(boot_src)/*.asm)
|
|
|
|
assembly_object_files := $(patsubst $(boot_src)/%.asm, \
|
|
|
|
assembly_object_files := $(patsubst $(boot_src)/%.asm, \
|
|
|
|
build/arch/$(arch)/boot/%.o, $(assembly_source_files))
|
|
|
|
build/arch/$(arch)/boot/%.o, $(assembly_source_files))
|
|
|
|
user_image_files := $(wildcard ../user/*.img)
|
|
|
|
user_bin_path := ../user/target/$(arch)-ucore/debug
|
|
|
|
user_object_files := $(patsubst ../user/%.img, build/user/%.o, $(user_image_files))
|
|
|
|
user_obj_path := build/arch/$(arch)/user
|
|
|
|
|
|
|
|
user_object_files := $(patsubst $(user_bin_path)/%.d, $(user_obj_path)/%.o, $(wildcard $(user_bin_path)/*.d))
|
|
|
|
SFSIMG := ../user/ucore32.img
|
|
|
|
SFSIMG := ../user/ucore32.img
|
|
|
|
qemu_opts := -cdrom $(iso) -smp 4 -serial mon:stdio -drive file=$(SFSIMG),media=disk,cache=writeback
|
|
|
|
qemu_opts := -cdrom $(iso) -smp 4 -serial mon:stdio -drive file=$(SFSIMG),media=disk,cache=writeback
|
|
|
|
ifeq ($(arch), riscv32)
|
|
|
|
ifeq ($(arch), riscv32)
|
|
|
@ -103,6 +104,9 @@ build: iso
|
|
|
|
asm:
|
|
|
|
asm:
|
|
|
|
@$(objdump) -dS $(kernel) | less
|
|
|
|
@$(objdump) -dS $(kernel) | less
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elf-h:
|
|
|
|
|
|
|
|
@$(objdump) -h $(kernel)
|
|
|
|
|
|
|
|
|
|
|
|
build/os-x86_64.iso: $(kernel) $(grub_cfg)
|
|
|
|
build/os-x86_64.iso: $(kernel) $(grub_cfg)
|
|
|
|
@mkdir -p build/isofiles/boot/grub
|
|
|
|
@mkdir -p build/isofiles/boot/grub
|
|
|
|
@cp $(kernel) build/isofiles/boot/kernel.bin
|
|
|
|
@cp $(kernel) build/isofiles/boot/kernel.bin
|
|
|
@ -139,10 +143,11 @@ build/arch/riscv32/boot/%.o: $(boot_src)/%.asm
|
|
|
|
@mkdir -p $(shell dirname $@)
|
|
|
|
@mkdir -p $(shell dirname $@)
|
|
|
|
@$(as) -march=rv32i $< -o $@
|
|
|
|
@$(as) -march=rv32i $< -o $@
|
|
|
|
|
|
|
|
|
|
|
|
# make .o from .img file
|
|
|
|
# make .o from binary files
|
|
|
|
build/user/%.o: ../user/%.img
|
|
|
|
$(user_obj_path)/%.o: $(user_bin_path)/%
|
|
|
|
@mkdir -p $(shell dirname $@)
|
|
|
|
@mkdir -p $(user_obj_path)
|
|
|
|
@$(ld) -r -b binary $< -o $@
|
|
|
|
@cd $(user_bin_path) && \
|
|
|
|
|
|
|
|
$(ld) -b binary $(notdir $<) -o $(abspath $@)
|
|
|
|
|
|
|
|
|
|
|
|
# patch Rust core for RISCV32I atomic
|
|
|
|
# patch Rust core for RISCV32I atomic
|
|
|
|
patch-core:
|
|
|
|
patch-core:
|
|
|
|