mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-22 01:16:26 +04:00
Bump rustsbi to 0.1.1 && make config of qemu/k210 different
This commit is contained in:
parent
07467287da
commit
eb5ef8e956
Binary file not shown.
Binary file not shown.
14
os/Makefile
14
os/Makefile
@ -3,7 +3,6 @@ TARGET := riscv64gc-unknown-none-elf
|
||||
MODE := release
|
||||
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
||||
KERNEL_BIN := $(KERNEL_ELF).bin
|
||||
KERNEL_ENTRY_PA := 0x80020000
|
||||
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
|
||||
FS_IMG := ../user/target/$(TARGET)/$(MODE)/fs.img
|
||||
SDCARD := /dev/sdb
|
||||
@ -13,6 +12,14 @@ APPS := ../user/src/bin
|
||||
BOARD ?= qemu
|
||||
SBI ?= rustsbi
|
||||
BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
|
||||
K210_BOOTLOADER_SIZE := 131072
|
||||
|
||||
# KERNEL ENTRY
|
||||
ifeq ($(BOARD), qemu)
|
||||
KERNEL_ENTRY_PA := 0x80200000
|
||||
else ifeq ($(BOARD), k210)
|
||||
KERNEL_ENTRY_PA := 0x80020000
|
||||
endif
|
||||
|
||||
# Run K210
|
||||
K210-SERIALPORT = /dev/ttyUSB0
|
||||
@ -48,7 +55,10 @@ $(FS_IMG): $(APPS)
|
||||
$(APPS):
|
||||
|
||||
kernel:
|
||||
@echo Platform: $(BOARD)
|
||||
@cp src/linker-$(BOARD).ld src/linker.ld
|
||||
@cargo build --release --features "board_$(BOARD)"
|
||||
@rm src/linker.ld
|
||||
|
||||
clean:
|
||||
@cargo clean
|
||||
@ -74,7 +84,7 @@ ifeq ($(BOARD),qemu)
|
||||
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
||||
else
|
||||
@cp $(BOOTLOADER) $(BOOTLOADER).copy
|
||||
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=131072 seek=1
|
||||
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=$(K210_BOOTLOADER_SIZE) seek=1
|
||||
@mv $(BOOTLOADER).copy $(KERNEL_BIN)
|
||||
@sudo chmod 777 $(K210-SERIALPORT)
|
||||
python3 $(K210-BURNER) -p $(K210-SERIALPORT) -b 1500000 $(KERNEL_BIN)
|
||||
|
50
os/src/linker-qemu.ld
Normal file
50
os/src/linker-qemu.ld
Normal file
@ -0,0 +1,50 @@
|
||||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
BASE_ADDRESS = 0x80200000;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = BASE_ADDRESS;
|
||||
skernel = .;
|
||||
|
||||
stext = .;
|
||||
.text : {
|
||||
*(.text.entry)
|
||||
. = ALIGN(4K);
|
||||
strampoline = .;
|
||||
*(.text.trampoline);
|
||||
. = ALIGN(4K);
|
||||
*(.text .text.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
etext = .;
|
||||
srodata = .;
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
erodata = .;
|
||||
sdata = .;
|
||||
.data : {
|
||||
*(.data .data.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
edata = .;
|
||||
sbss_with_stack = .;
|
||||
.bss : {
|
||||
*(.bss.stack)
|
||||
sbss = .;
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
ebss = .;
|
||||
ekernel = .;
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user