Move kernel to a new directory

master
WangRunji 6 years ago
parent 02586cdb98
commit 4faa8a65ae

@ -18,7 +18,7 @@ Available on DockerHub: `wangrunji0408/riscv-rust`
```bash ```bash
git clone https://github.com/wangrunji0408/RustOS.git -b riscv --recursive git clone https://github.com/wangrunji0408/RustOS.git -b riscv --recursive
cd RustOS cd RustOS/kernel
# Pull docker image and enter docker interactive shell # Pull docker image and enter docker interactive shell
make docker_riscv make docker_riscv
# Inside docker ... # Inside docker ...

@ -34,8 +34,8 @@ bitflags = "1.0"
bit_field = "0.9.0" bit_field = "0.9.0"
volatile = "0.1.0" volatile = "0.1.0"
lazy_static = { version = "1.0.0", features = ["spin_no_std"] } lazy_static = { version = "1.0.0", features = ["spin_no_std"] }
bit-allocator = { path = "crate/bit-allocator" } bit-allocator = { path = "../crate/bit-allocator" }
ucore-memory = { path = "crate/memory" } ucore-memory = { path = "../crate/memory" }
[target.x86_64-blog_os.dependencies] [target.x86_64-blog_os.dependencies]
@ -48,8 +48,8 @@ simple-filesystem = { git = "https://github.com/wangrunji0408/SimpleFileSystem-R
[target.riscv32-blog_os.dependencies] [target.riscv32-blog_os.dependencies]
linked_list_allocator = "0.5" # due to rust version linked_list_allocator = "0.5" # due to rust version
riscv = { path = "crate/riscv" } riscv = { path = "../crate/riscv" }
bbl = { path = "crate/bbl" } bbl = { path = "../crate/bbl" }
[build-dependencies] [build-dependencies]
cc = "1.0" cc = "1.0"

@ -22,9 +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_image_files := $(wildcard ../user/*.img)
user_object_files := $(patsubst user/%.img, build/user/%.o, $(user_image_files)) user_object_files := $(patsubst ../user/%.img, build/user/%.o, $(user_image_files))
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)
qemu_opts := -machine virt -kernel $(iso) -nographic qemu_opts := -machine virt -kernel $(iso) -nographic
@ -111,7 +111,7 @@ build/os-x86_64.iso: $(kernel) $(grub_cfg)
@rm -r build/isofiles @rm -r build/isofiles
build/os-riscv32.iso: $(kernel) build/os-riscv32.iso: $(kernel)
@cd riscv-pk && \ @cd ../riscv-pk && \
mkdir -p build && \ mkdir -p build && \
cd build && \ cd build && \
../configure \ ../configure \
@ -119,9 +119,9 @@ build/os-riscv32.iso: $(kernel)
--prefix=$(RISCV) \ --prefix=$(RISCV) \
--disable-fp-emulation \ --disable-fp-emulation \
--host=riscv32-unknown-elf \ --host=riscv32-unknown-elf \
--with-payload=../../build/kernel-riscv32.bin && \ --with-payload=../../kernel/build/kernel-riscv32.bin && \
make && \ make && \
cp bbl ../../$@ cp bbl ../../kernel/$@
$(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) \
@ -140,7 +140,7 @@ build/arch/riscv32/boot/%.o: $(boot_src)/%.asm
@$(as) -march=rv32i $< -o $@ @$(as) -march=rv32i $< -o $@
# make .o from .img file # make .o from .img file
build/user/%.o: user/%.img build/user/%.o: ../user/%.img
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
@$(ld) -r -b binary $< -o $@ @$(ld) -r -b binary $< -o $@

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save