|
|
@ -1,19 +1,26 @@
|
|
|
|
# Examples:
|
|
|
|
# Commands:
|
|
|
|
# make run Run in debug
|
|
|
|
# make build Build
|
|
|
|
# make justrun Run in debug without build
|
|
|
|
# make run Build and run in QEMU
|
|
|
|
# make run int=1 Run with interrupt info by QEMU
|
|
|
|
# make justrun Run the last build
|
|
|
|
# make run mode=release Run in release
|
|
|
|
|
|
|
|
# make run LOG=error Run with log level: error
|
|
|
|
|
|
|
|
# LOG = off | error | warn | info | debug | trace
|
|
|
|
|
|
|
|
# make doc Generate docs
|
|
|
|
# make doc Generate docs
|
|
|
|
# make asm Open the deassemble file of the last build
|
|
|
|
# make asm Open the deassemble file of the last build
|
|
|
|
|
|
|
|
# make elf-h Open 'objdump -h' of the last build
|
|
|
|
# make clean Clean
|
|
|
|
# make clean Clean
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Options:
|
|
|
|
|
|
|
|
# arch = x86_64 | riscv32
|
|
|
|
|
|
|
|
# d = int | in_asm | ... QEMU debug info
|
|
|
|
|
|
|
|
# mode = debug | release
|
|
|
|
|
|
|
|
# LOG = off | error | warn | info | debug | trace
|
|
|
|
|
|
|
|
# board Only available on riscv32, build without bbl, run on board
|
|
|
|
|
|
|
|
|
|
|
|
arch ?= riscv32
|
|
|
|
arch ?= riscv32
|
|
|
|
|
|
|
|
mode ?= debug
|
|
|
|
|
|
|
|
LOG ?= debug
|
|
|
|
|
|
|
|
|
|
|
|
kernel := build/$(arch)/kernel.bin
|
|
|
|
kernel := build/$(arch)/kernel.bin
|
|
|
|
iso := build/$(arch)/os.iso
|
|
|
|
iso := build/$(arch)/os.iso
|
|
|
|
target ?= $(arch)-blog_os
|
|
|
|
target := $(arch)-blog_os
|
|
|
|
mode ?= debug
|
|
|
|
|
|
|
|
rust_lib := target/$(target)/$(mode)/ucore
|
|
|
|
rust_lib := target/$(target)/$(mode)/ucore
|
|
|
|
|
|
|
|
|
|
|
|
boot_src := src/arch/$(arch)/boot
|
|
|
|
boot_src := src/arch/$(arch)/boot
|
|
|
@ -34,7 +41,9 @@ qemu_opts := -machine virt -kernel $(iso) -nographic
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
features := use_apic
|
|
|
|
features := use_apic
|
|
|
|
|
|
|
|
|
|
|
|
LOG ?= debug
|
|
|
|
ifdef board
|
|
|
|
|
|
|
|
features := $(features) no_bbl
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Link user binaries at ../user
|
|
|
|
# Link user binaries at ../user
|
|
|
|
ifdef link_user
|
|
|
|
ifdef link_user
|
|
|
@ -111,8 +120,23 @@ build/x86_64/os.iso: $(kernel) $(grub_cfg)
|
|
|
|
@rm -r build/isofiles
|
|
|
|
@rm -r build/isofiles
|
|
|
|
|
|
|
|
|
|
|
|
build/riscv32/os.iso: kernel
|
|
|
|
build/riscv32/os.iso: kernel
|
|
|
|
@cp $(rust_lib) $@
|
|
|
|
|
|
|
|
@cp $(rust_lib) $(kernel)
|
|
|
|
@cp $(rust_lib) $(kernel)
|
|
|
|
|
|
|
|
ifdef board
|
|
|
|
|
|
|
|
@cp $(rust_lib) $@
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@mkdir -p build/riscv32
|
|
|
|
|
|
|
|
@cd ../riscv-pk && \
|
|
|
|
|
|
|
|
mkdir -p build && \
|
|
|
|
|
|
|
|
cd build && \
|
|
|
|
|
|
|
|
../configure \
|
|
|
|
|
|
|
|
--enable-32bit \
|
|
|
|
|
|
|
|
--enable-logo \
|
|
|
|
|
|
|
|
--disable-fp-emulation \
|
|
|
|
|
|
|
|
--host=riscv64-unknown-elf \
|
|
|
|
|
|
|
|
--with-payload=$(abspath $(rust_lib)) && \
|
|
|
|
|
|
|
|
make && \
|
|
|
|
|
|
|
|
cp bbl ../../kernel/$@
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
$(kernel): kernel $(assembly_object_files) $(linker_script)
|
|
|
|
$(kernel): kernel $(assembly_object_files) $(linker_script)
|
|
|
|
@$(ld) -n --gc-sections -T $(linker_script) -o $(kernel) \
|
|
|
|
@$(ld) -n --gc-sections -T $(linker_script) -o $(kernel) \
|
|
|
|