add Makefile option `graphic` & cargo feature `nographic`

master
equation314 6 years ago
parent b0915b102a
commit a55f3b61e6

@ -12,6 +12,7 @@ no_mmu = []
# Kernel in M-mode (for riscv32) # Kernel in M-mode (for riscv32)
m_mode = ["no_mmu"] m_mode = ["no_mmu"]
# (for aarch64 RaspberryPi3) # (for aarch64 RaspberryPi3)
nographic = []
board_raspi3 = ["bcm2837"] board_raspi3 = ["bcm2837"]
raspi3_use_generic_timer = ["bcm2837/use_generic_timer"] raspi3_use_generic_timer = ["bcm2837/use_generic_timer"]

@ -1,22 +1,23 @@
# Commands: # Commands:
# make build Build # make build Build
# make run Build and run in QEMU # make run Build and run in QEMU
# make justrun Run the last build # make justrun Run the last build
# 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 header Open 'objdump -h' of the last build # make header Open 'objdump -h' of the last build
# make clean Clean # make clean Clean
# #
# Options: # Options:
# arch = x86_64 | riscv32 | aarch64 # arch = x86_64 | riscv32 | aarch64
# d = int | in_asm | ... QEMU debug info # d = int | in_asm | ... QEMU debug info
# mode = debug | release # mode = debug | release
# LOG = off | error | warn | info | debug | trace # LOG = off | error | warn | info | debug | trace
# SFSIMG = SFS image path of user programs # SFSIMG = <sfsimg> SFS image path of user programs
# smp = 1 | 2 | ... SMP core number # smp = 1 | 2 | ... SMP core number
# board = fpga Only available on riscv32, build without bbl, run on board # graphic = on | off enable/disable qemu graphical output
# | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+ # board = fpga Only available on riscv32, build without bbl, run on board
# m_mode Only available on riscv32, build for M-Mode, without MMU # | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+
# m_mode Only available on riscv32, build for M-Mode, without MMU
arch ?= riscv32 arch ?= riscv32
board ?= raspi3 board ?= raspi3
@ -24,7 +25,7 @@ mode ?= debug
LOG ?= debug LOG ?= debug
smp ?= 4 smp ?= 4
# NOTE: crate 'process' use this name 'm_mode' as an environment # NOTE: crate 'process' use this name 'm_mode' as an environment
# to set interrupt (MIE or SIE) # to set interrupt (MIE or SIE)
m_mode ?= m_mode ?=
target := $(arch)-blog_os target := $(arch)-blog_os
@ -40,10 +41,15 @@ user_obj := build/$(arch)/user.o
export ARCH = $(arch) export ARCH = $(arch)
export SFSIMG = $(user_dir)/build/user-$(arch).img export SFSIMG = $(user_dir)/build/user-$(arch).img
ifeq ($(arch), aarch64)
graphic ?= on
else
graphic ?= off
endif
### qemu options ### ### qemu options ###
qemu_opts := \ qemu_opts := \
-smp cores=$(smp) \ -smp cores=$(smp)
-nographic
ifeq ($(arch), x86_64) ifeq ($(arch), x86_64)
qemu_opts += \ qemu_opts += \
@ -67,6 +73,10 @@ qemu_opts += \
-kernel $(bin) -kernel $(bin)
endif endif
ifneq ($(graphic), on)
qemu_opts += -nographic
endif
ifdef d ifdef d
qemu_opts += -d $(d) qemu_opts += -d $(d)
endif endif
@ -78,6 +88,10 @@ features += no_bbl
endif endif
endif endif
ifneq ($(graphic), on)
features += nographic
endif
ifeq ($(board), raspi3) ifeq ($(board), raspi3)
# qemu only has generic timer # qemu only has generic timer
# TODO: configure system/generic timer automatically # TODO: configure system/generic timer automatically

@ -22,6 +22,7 @@ pub fn init_serial_early() {
/// Initialize raspi3 drivers /// Initialize raspi3 drivers
pub fn init_driver() { pub fn init_driver() {
#[cfg(not(feature = "nographic"))]
fb::init(); fb::init();
timer::init(); timer::init();
} }

Loading…
Cancel
Save