1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-21 23:56:18 +04:00

Separate SFSIMG and SFSQCOW2 and fix aarch64 qemu boot

This commit is contained in:
Jiajie Chen 2019-06-16 00:03:32 +08:00
parent 81c77586c6
commit 164e94a146
4 changed files with 10 additions and 20 deletions

View File

@ -97,7 +97,7 @@ minimum-image-size = 0 # The minimum output file size (in MiB)
# (the "{}" will be replaced with the path to the bootable disk image)
run-command = ["qemu-system-x86_64",
"-drive", "format=raw,file={}",
# TODO: use SFSIMG environment variable
# TODO: use USER_IMG environment variable
"-drive", "format=raw,file=../user/img/ucore-i386-pic.img,media=disk,cache=writeback",
"-serial", "mon:stdio",
"-device", "isa-debug-exit",

View File

@ -19,7 +19,7 @@
# d = int | in_asm | ... QEMU debug info
# mode = debug | release
# LOG = off | error | warn | info | debug | trace
# SFSIMG = <sfsimg> SFS image path of user programs
# USER_IMG = <sfsimg> image path of user programs
# smp = 1 | 2 | ... SMP core number
# graphic = on | off | console Enable/disable qemu graphical output, or print console to graphic output
# board = none Running on QEMU
@ -56,18 +56,8 @@ user_dir := ../user
### export environments ###
ifeq ($(arch), $(filter $(arch), aarch64 mipsel))
#link user img, so use original image
export SFSIMG = $(user_dir)/build/$(arch).img
else
# board is pc or qemu?
ifeq ($(board), $(filter $(board), pc u540 k210 rocket_chip))
#link user img, so use original image
export SFSIMG = $(user_dir)/build/$(arch).img
else
export SFSIMG = $(user_dir)/build/$(arch).qcow2
endif # pc or qemu
endif # aarch64 mipsel
export USER_IMG = $(user_dir)/build/$(arch).img
export USER_QCOW2 = $(user_dir)/build/$(arch).qcow2
ifeq ($(arch), aarch64)
board := raspi3
@ -107,7 +97,7 @@ qemu_opts += \
-device isa-debug-exit
ifeq ($(board), none)
qemu_opts += \
-drive format=qcow2,file=$(SFSIMG),media=disk,cache=writeback,id=sfsimg,if=none \
-drive format=qcow2,file=$(USER_QCOW2),media=disk,cache=writeback,id=sfsimg,if=none \
-device ahci,id=ahci0 \
-device ide-drive,drive=sfsimg,bus=ahci0.0
endif
@ -135,7 +125,7 @@ qemu_opts += \
-serial mon:stdio \
-kernel ../tools/opensbi/virt_rv32.elf \
-device loader,addr=0x80400000,file=$(kernel_img) \
-drive file=$(SFSIMG),format=qcow2,id=sfs \
-drive file=$(USER_QCOW2),format=qcow2,id=sfs \
-device virtio-blk-device,drive=sfs
qemu_net_opts += \
-netdev type=tap,id=net0,script=no,downscript=no \
@ -157,7 +147,7 @@ qemu_opts += \
-serial mon:stdio \
-kernel ../tools/opensbi/virt_rv64.elf \
-device loader,addr=0x80200000,file=$(kernel_img) \
-drive file=$(SFSIMG),format=qcow2,id=sfs \
-drive file=$(USER_QCOW2),format=qcow2,id=sfs \
-device virtio-blk-device,drive=sfs
endif
qemu_net_opts += \
@ -172,7 +162,7 @@ qemu_opts += \
-machine $(board) \
-serial null -serial mon:stdio \
-kernel $(kernel_img) \
-sd $(kernel_img)
-drive file=$(USER_QCOW2),format=qcow2,id=sfs
else ifeq ($(arch), mipsel)
ifeq ($(board), malta)

View File

@ -7,7 +7,7 @@ use std::path::Path;
fn main() {
println!("cargo:rerun-if-env-changed=LOG");
println!("cargo:rerun-if-env-changed=BOARD");
println!("cargo:rerun-if-env-changed=SFSIMG");
println!("cargo:rerun-if-env-changed=USER_IMG");
let arch: String = std::env::var("ARCH").unwrap();
let board: String = std::env::var("BOARD").unwrap();

View File

@ -31,7 +31,7 @@ global_asm!(concat!(
.global _user_img_end
_user_img_start:
.incbin ""#,
env!("SFSIMG"),
env!("USER_IMG"),
r#""
_user_img_end:
"#