Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
quiet boot
Browse files Browse the repository at this point in the history
  • Loading branch information
u8cat committed Jun 28, 2022
1 parent 5ccd4bc commit 02b1aff
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "opensbi"]
path = opensbi
url = https://github.com/riscv-software-src/opensbi
5 changes: 3 additions & 2 deletions lib/rkplat/src/drivers/device_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use core::ptr::addr_of;
use super::uart;
#[cfg(feature="driver_virtio")]
use super::virtio;
use log::{info, warn};
use rkalloc::{RKalloc,alloc_type};
use crate::console;
use crate::drivers::virtio::GPU_DEIVCE;
Expand Down Expand Up @@ -290,7 +291,7 @@ fn parse_device(a: &dyn RKalloc, name: &str, props: &[(&str,&[u8])], props_size:
&mut *(prop_u64(props, props_size, "reg").
unwrap() as *mut virtio::VirtIOHeader)
};
println_bios!("Detected virtio device with vendor id {:#X}",header.vendor_id());
info!("Detected virtio device with vendor id {:#X}",header.vendor_id());
match header.device_type() {
#[cfg(feature="driver_virtio_blk")]
virtio::DeviceType::Block => {todo!()},
Expand All @@ -306,7 +307,7 @@ fn parse_device(a: &dyn RKalloc, name: &str, props: &[(&str,&[u8])], props_size:
virtio::DeviceType::Input => {todo!()},
#[cfg(feature="driver_virtio_net")]
virtio::DeviceType::Network => {todo!()},
t => println_bios!("WARNING: Unrecognized virtio device: {:?}",t),
t => warn!("Unrecognized virtio device: {:?}",t),
}
},
_ => {}
Expand Down
4 changes: 3 additions & 1 deletion lib/rkplat/src/drivers/uart/ns16550.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#![allow(dead_code)]

use core::{str, slice};
use log::info;

use super::UartDevice;
use crate::drivers::Device;
use crate::device::{ioreg_read8,ioreg_write8};
Expand Down Expand Up @@ -69,7 +71,7 @@ impl Ns16550 {
for i in 0..name.len() {
name1[i] = name.as_bytes()[i];
}
println_bios!("Init ns16550 device, name={},addr=0x{:x},irq={}.",name,addr,irq);
info!("Init ns16550 device, name={},addr=0x{:x},irq={}.",name,addr,irq);

Self {
addr,irq,
Expand Down
12 changes: 9 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export REPORT_ROOT_DIR := $(PWD)/report
export TEST_ROOT_DIR := $(PWD)/test
export SRC_ROOT_DIR := $(PWD)
export MAKE_BUILD_TYPE := debug
export OBJCOPY_PREFIX := rust-
export CROSS_COMPILE := riscv64-linux-gnu-
TEST_LIST := @all
IGNORED_LIST :=

Expand All @@ -59,12 +59,18 @@ $(MAKE_ROOT_DIR)/report/makefile: makefiles/report.mk
cp makefiles/report.mk "$(MAKE_ROOT_DIR)/report/makefile"

.PHONY: test build_test $(MAKE_ROOT_DIR)/test/makefile
test: $(MAKE_ROOT_DIR)/test/makefile
test: $(MAKE_ROOT_DIR)/test/makefile opensbi
cd "$(MAKE_ROOT_DIR)/test" && $(MAKE)

build_test: $(MAKE_ROOT_DIR)/test/makefile
cd "$(MAKE_ROOT_DIR)/test" && $(MAKE) build

$(MAKE_ROOT_DIR)/test/makefile: makefiles/test.mk.sh makefiles/test.mk.0 makefiles/test.mk.1
-mkdir --parents "$(MAKE_ROOT_DIR)/test"
makefiles/test.mk.sh makefiles/test.mk "$(MAKE_ROOT_DIR)/test/makefile" "$(TEST_ROOT_DIR)" "$(TEST_LIST)" "$(IGNORED_LIST)"
makefiles/test.mk.sh makefiles/test.mk "$(MAKE_ROOT_DIR)/test/makefile" "$(TEST_ROOT_DIR)" "$(TEST_LIST)" "$(IGNORED_LIST)" "$(MAKE_ROOT_DIR)/opensbi/platform/generic/firmware/fw_jump.bin"

.PHONY: opensbi
opensbi:
#FW_OPTIONS=1 indicates quiet boot
-mkdir --parents "$(MAKE_ROOT_DIR)/opensbi"
cd opensbi && $(MAKE) PLATFORM=generic FW_OPTIONS=1 FW_DYNAMIC=n FW_JUMP=y FW_PAYLOAD=n O="$(MAKE_ROOT_DIR)/opensbi"
2 changes: 1 addition & 1 deletion makefiles/test.mk.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ else
endif
endif
@rm $(TEST_ROOT_DIR)/@testname@/Cargo.lock
@$(OBJCOPY_PREFIX)objcopy --strip-all $(TEST_BUILD_DIR)/test-@testname@ -O binary @[email protected]
@$(CROSS_COMPILE)objcopy --strip-all $(TEST_BUILD_DIR)/test-@testname@ -O binary @[email protected]
13 changes: 5 additions & 8 deletions makefiles/test.mk.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
#usage: test.mk.sh <输入> <输出> <test> <测试列表> <忽略列表>
#usage: test.mk.sh <输入> <输出> <test> <测试列表> <忽略列表> <BIOS>

#如果测试列表是@all,则测试test目录下的所有文件夹
if [ "$4" = @all ]
Expand Down Expand Up @@ -55,25 +55,22 @@ QEMU_VERSION=$(qemu-system-riscv64 -version | grep --basic-regexp 'version *[0-9

echo "" >> $2
echo "run: build" >> $2
if [ -z "$RISCV_BIOS" ]
then
RISCV_BIOS=default
fi

for TEST in $TEST_LIST
do
# old QEMU versions do not support `-kernel` option
if [ QEMU_VERSION>=6 ]
if [ $QEMU_VERSION -ge 6 ]
then
KERNEL="-kernel $TEST.bin"
else
KERNEL="-device loader,file=$TEST.bin,addr=0x80200000"
fi

echo " @echo Running $TEST..." >> $2
if [ -f $3/$TEST/run_flags.txt ]
then
echo " qemu-system-riscv64 -machine virt $(cat $3/$TEST/run_flags.txt) -bios $RISCV_BIOS $KERNEL" >> $2
echo " @qemu-system-riscv64 -machine virt $(cat $3/$TEST/run_flags.txt) -bios \"$6\" $KERNEL" >> $2
else
echo " qemu-system-riscv64 -machine virt -nographic -bios $RISCV_BIOS $KERNEL" >> $2
echo " @qemu-system-riscv64 -machine virt -nographic -bios $6 $KERNEL" >> $2
fi
done
1 change: 1 addition & 0 deletions opensbi
Submodule opensbi added at 448987

0 comments on commit 02b1aff

Please sign in to comment.