From a6ecb0c4e9bb06c6348d51dfa2bc2aa8a602d2b1 Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Sun, 15 Dec 2024 00:02:05 +0800 Subject: [PATCH 1/5] Bring up Linux kernel The 8250 UART and PLIC peripherals, defined in src/devices/uart.[ch] and src/devices/plic.[ch], have been integrated. Modifications to src/system.c enable MMIO read and write operations for these peripherals. The minimal device tree source file is also integrated in src/devices/minimal.dts. Default termios control flags are set to ICANON | ECHO | ISIG, allowing all keyboard input to be captured by the guestOS. The CLI parser has been updated to support custom Linux Kernel Images, rootfs, and Device Tree Blobs. The ELF_LOADER has been introduced to support test suites involving single ELF files that use the rv32emu built-in syscall. It helps to choose the right executable loader and requires differentiation from guestOS syscalls. The csrrw instruction is now branchable since it may overwrite the SATP CSR during guestOS process scheduling. last_pc and is_branch_taken are now updated only when not in a trapped state, otherwise might lost the original state of them. A system make target has been added to simplify running system emulation. Misc changes: - Rename 'ARRAYS_SIZE' to 'ARRAY_SIZE' for better readability - Move JIT related variables to proper conditional build flag --- Makefile | 35 +++-- mk/artifact.mk | 36 ++++- mk/system.mk | 28 ++++ src/common.h | 59 +++++++- src/decode.h | 2 +- src/devices/minimal.dts | 69 +++++++++ src/devices/plic.c | 91 ++++++++++++ src/devices/plic.h | 41 ++++++ src/devices/uart.c | 151 +++++++++++++++++++ src/devices/uart.h | 51 +++++++ src/emulate.c | 130 ++++++++++++++-- src/feature.h | 5 + src/io.h | 1 + src/jit.c | 18 +-- src/main.c | 58 ++++++-- src/riscv.c | 317 ++++++++++++++++++++++++++++++---------- src/riscv.h | 89 ++++++----- src/riscv_private.h | 4 +- src/rv32_template.c | 271 ++++++++++++++++++++++++---------- src/system.c | 295 +++++++++++++++++++++++++++---------- tools/rv_histogram.c | 4 +- 21 files changed, 1431 insertions(+), 324 deletions(-) create mode 100644 mk/system.mk create mode 100644 src/devices/minimal.dts create mode 100644 src/devices/plic.c create mode 100644 src/devices/plic.h create mode 100644 src/devices/uart.c create mode 100644 src/devices/uart.h diff --git a/Makefile b/Makefile index 7feca7e3..79253124 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,16 @@ CONFIG_FILE := $(OUT)/.config CFLAGS = -std=gnu99 -O2 -Wall -Wextra CFLAGS += -Wno-unused-label -CFLAGS += -include src/common.h +CFLAGS += -include src/common.h -Isrc/ +# In the system test suite, the executable is an ELF file (e.g., MMU). +# However, the Linux kernel emulation includes the Image, DT, and +# root filesystem (rootfs). Therefore, the test suite needs this +# flag to load the ELF and differentiate it from the kernel emulation. +ENABLE_ELF_LOADER ?= 0 +$(call set-feature, ELF_LOADER) + +# Enable system emulation ENABLE_SYSTEM ?= 0 $(call set-feature, SYSTEM) @@ -45,10 +53,6 @@ CFLAGS += $(CFLAGS_NO_CET) OBJS_EXT := -ifeq ($(call has, SYSTEM), 1) -OBJS_EXT += system.o -endif - # Integer Multiplication and Division instructions ENABLE_EXT_M ?= 1 $(call set-feature, EXT_M) @@ -71,7 +75,14 @@ src/softfloat/build/Linux-RISCV-GCC/Makefile: SOFTFLOAT_LIB := $(SOFTFLOAT_OUT)/softfloat.a $(SOFTFLOAT_LIB): src/softfloat/build/Linux-RISCV-GCC/Makefile $(MAKE) -C $(dir $<) BUILD_DIR=$(SOFTFLOAT_OUT) CC=$(CC) AR=$(AR) -$(OUT)/decode.o $(OUT)/riscv.o: $(SOFTFLOAT_LIB) +ifeq ($(call has, SYSTEM), 1) +DEV_OUT := $(OUT)/devices +endif +OBJS_NEED_SOFTFLOAT := $(OUT)/decode.o \ + $(OUT)/riscv.o \ + $(DEV_OUT)/uart.o \ + $(DEV_OUT)/plic.o +$(OBJS_NEED_SOFTFLOAT): $(SOFTFLOAT_LIB) LDFLAGS += $(SOFTFLOAT_LIB) LDFLAGS += -lm endif @@ -204,8 +215,9 @@ $(OUT)/emulate.o: CFLAGS += -foptimize-sibling-calls -fomit-frame-pointer -fno-s include mk/external.mk include mk/artifact.mk include mk/wasm.mk +include mk/system.mk -all: config $(BIN) +all: config $(BUILD_DTB) $(BIN) OBJS := \ map.o \ @@ -222,7 +234,7 @@ OBJS := \ main.o OBJS := $(addprefix $(OUT)/, $(OBJS)) -deps := $(OBJS:%.o=%.o.d) +deps += $(OBJS:%.o=%.o.d) # mk/system.mk includes prior this line, so declare deps at there ifeq ($(call has, EXT_F), 1) $(OBJS): $(SOFTFLOAT_LIB) @@ -236,7 +248,7 @@ $(OUT)/%.o: src/%.c $(deps_emcc) $(VECHO) " CC\t$@\n" $(Q)$(CC) -o $@ $(CFLAGS) $(CFLAGS_emcc) -c -MMD -MF $@.d $< -$(BIN): $(OBJS) +$(BIN): $(OBJS) $(DEV_OBJS) $(VECHO) " LD\t$@\n" $(Q)$(CC) -o $@ $(CFLAGS_emcc) $^ $(LDFLAGS) @@ -333,9 +345,10 @@ endif endif clean: - $(RM) $(BIN) $(OBJS) $(HIST_BIN) $(HIST_OBJS) $(deps) $(WEB_FILES) $(CACHE_OUT) src/rv32_jit.c + $(RM) $(BIN) $(OBJS) $(DEV_OBJS) $(BUILD_DTB) $(HIST_BIN) $(HIST_OBJS) $(deps) $(WEB_FILES) $(CACHE_OUT) src/rv32_jit.c distclean: clean - -$(RM) $(DOOM_DATA) $(QUAKE_DATA) + -$(RM) $(DOOM_DATA) $(QUAKE_DATA) $(BUILDROOT_DATA) $(LINUX_DATA) + $(RM) -r $(OUT)/linux-image $(RM) -r $(TIMIDITY_DATA) $(RM) -r $(OUT)/id1 $(RM) -r $(DEMO_DIR) diff --git a/mk/artifact.mk b/mk/artifact.mk index b49d237d..99db11ff 100644 --- a/mk/artifact.mk +++ b/mk/artifact.mk @@ -34,10 +34,14 @@ TEST_BENCHES += \ SCIMARK2_URL := https://math.nist.gov/scimark2/scimark2_1c.zip SCIMARK2_SHA1 := de278c5b8cef84ab6dda41855052c7bfef919e36 -SHELL_HACK := $(shell mkdir -p $(BIN_DIR)/linux-x86-softfp $(BIN_DIR)/riscv32) +SHELL_HACK := $(shell mkdir -p $(BIN_DIR)/linux-x86-softfp $(BIN_DIR)/riscv32 $(BIN_DIR)/linux-image) ifeq ($(call has, PREBUILT), 1) - LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases/latest -O- | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') +ifeq ($(call has, SYSTEM), 1) + LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "Linux-Image" | head -n 1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') +else + LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "ELF" | head -n 1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') +endif else # Since rv32emu only supports the dynamic binary translation of integer instruction in tiered compilation currently, # we disable the hardware floating-point and the related SIMD operation of x86. @@ -53,11 +57,20 @@ endif artifact: fetch-checksum ieeelib scimark2 ifeq ($(call has, PREBUILT), 1) $(Q)$(PRINTF) "Checking SHA-1 of prebuilt binaries ... " + $(Q)$(eval RES := 0) + +ifeq ($(call has, SYSTEM), 1) + $(Q)$(eval PREBUILT_LINUX_IMAGE_FILENAME := $(shell cat $(BIN_DIR)/sha1sum-linux-image | awk '{ print $$2 };')) + $(Q)$(eval $(foreach FILE,$(PREBUILT_LINUX_IMAGE_FILENAME), \ + $(call verify,$(shell grep -w $(FILE) $(BIN_DIR)/sha1sum-linux-image | awk '{ print $$1 };'),$(BIN_DIR)/linux-image/$(FILE),RES) \ + )) + + $(Q)$(eval RV32EMU_PREBUILT_TARBALL := rv32emu-linux-image-prebuilt.tar.gz) +else $(Q)$(eval PREBUILT_X86_FILENAME := $(shell cat $(BIN_DIR)/sha1sum-linux-x86-softfp | awk '{ print $$2 };')) $(Q)$(eval PREBUILT_RV32_FILENAME := $(shell cat $(BIN_DIR)/sha1sum-riscv32 | awk '{ print $$2 };')) - $(Q)$(eval RES := 0) $(Q)$(eval $(foreach FILE,$(PREBUILT_X86_FILENAME), \ $(call verify,$(shell grep -w $(FILE) $(BIN_DIR)/sha1sum-linux-x86-softfp | awk '{ print $$1 };'),$(BIN_DIR)/linux-x86-softfp/$(FILE),RES) \ )) @@ -65,12 +78,19 @@ ifeq ($(call has, PREBUILT), 1) $(call verify,$(shell grep -w $(FILE) $(BIN_DIR)/sha1sum-riscv32 | awk '{ print $$1 };'),$(BIN_DIR)/riscv32/$(FILE),RES) \ )) + $(Q)$(eval RV32EMU_PREBUILT_TARBALL := rv32emu-prebuilt.tar.gz) +endif + $(Q)if [ "$(RES)" = "1" ]; then \ $(PRINTF) "\n$(YELLOW)SHA-1 verification fails! Re-fetching prebuilt binaries from \"rv32emu-prebuilt\" ...\n$(NO_COLOR)"; \ - wget -q --show-progress https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)/rv32emu-prebuilt.tar.gz -O- | tar -C build --strip-components=1 -xz; \ + wget -q --show-progress https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)/$(RV32EMU_PREBUILT_TARBALL) -O- | tar -C build --strip-components=1 -xz; \ else \ $(call notice, [OK]); \ fi +else +ifeq ($(call has, SYSTEM), 1) + $(Q)(cd $(BIN_DIR) && $(SHA1SUM) Image >> sha1sum-linux-image) + $(Q)(cd $(BIN_DIR) && $(SHA1SUM) rootfs.cpio >> sha1sum-linux-image) else git submodule update --init $(addprefix ./tests/,$(foreach tb,$(TEST_SUITES),$(tb))) $(Q)for tb in $(TEST_SUITES); do \ @@ -103,17 +123,24 @@ else $(Q)(cd $(BIN_DIR)/linux-x86-softfp; for fd in *; do $(SHA1SUM) "$$fd"; done) >> $(BIN_DIR)/sha1sum-linux-x86-softfp $(Q)(cd $(BIN_DIR)/riscv32; for fd in *; do $(SHA1SUM) "$$fd"; done) >> $(BIN_DIR)/sha1sum-riscv32 endif +endif fetch-checksum: ifeq ($(call has, PREBUILT), 1) $(Q)$(PRINTF) "Fetching SHA-1 of prebuilt binaries ... " +ifeq ($(call has, SYSTEM), 1) + $(Q)wget -q -O $(BIN_DIR)/sha1sum-linux-image https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)/sha1sum-linux-image + $(Q)$(call notice, [OK]) +else $(Q)wget -q -O $(BIN_DIR)/sha1sum-linux-x86-softfp https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)/sha1sum-linux-x86-softfp $(Q)wget -q -O $(BIN_DIR)/sha1sum-riscv32 https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)/sha1sum-riscv32 $(Q)$(call notice, [OK]) endif +endif scimark2: ifeq ($(call has, PREBUILT), 0) +ifeq ($(call has, SYSTEM), 0) $(Q)$(call prologue,"scimark2") $(Q)$(call download,$(SCIMARK2_URL)) $(Q)$(call verify,$(SCIMARK2_SHA1),$(notdir $(SCIMARK2_URL))) @@ -126,6 +153,7 @@ ifeq ($(call has, PREBUILT), 0) $(Q)$(MAKE) -C ./tests/scimark2 CC=$(CROSS_COMPILE)gcc CFLAGS="-march=rv32imf -mabi=ilp32 -O2" $(Q)cp ./tests/scimark2/scimark2 $(BIN_DIR)/riscv32/scimark2 endif +endif ieeelib: ifeq ($(call has, PREBUILT), 0) diff --git a/mk/system.mk b/mk/system.mk new file mode 100644 index 00000000..4f696064 --- /dev/null +++ b/mk/system.mk @@ -0,0 +1,28 @@ +# Peripherals for system emulation +ifeq ($(call has, SYSTEM), 1) + +DEV_SRC := src/devices + +DTC ?= dtc +$(OUT)/minimal.dtb: $(DEV_SRC)/minimal.dts + $(VECHO) " DTC\t$@\n" + $(Q)$(DTC) $^ -o $@ +BUILD_DTB := $(OUT)/minimal.dtb + +$(DEV_OUT)/%.o: $(DEV_SRC)/%.c $(deps_emcc) + $(Q)mkdir -p $(DEV_OUT) + $(VECHO) " CC\t$@\n" + $(Q)$(CC) -o $@ $(CFLAGS) $(CFLAGS_emcc) -c -MMD -MF $@.d $< +DEV_OBJS := $(patsubst $(DEV_SRC)/%.c, $(DEV_OUT)/%.o, $(wildcard $(DEV_SRC)/*.c)) +deps := $(DEV_OBJS:%.o=%.o.d) + +OBJS_EXT += system.o + +# system target execution by using default dependencies +LINUX_IMAGE_DIR := linux-image +system_action := ($(BIN) -k $(OUT)/$(LINUX_IMAGE_DIR)/Image -i $(OUT)/$(LINUX_IMAGE_DIR)/rootfs.cpio -b $(OUT)/minimal.dtb) +system_deps += artifact $(BUILD_DTB) $(BIN) +system: $(system_deps) + $(system_action) + +endif diff --git a/src/common.h b/src/common.h index da84ebdb..535299da 100644 --- a/src/common.h +++ b/src/common.h @@ -5,6 +5,9 @@ #pragma once +#include +#include + #include "feature.h" #if defined(__GNUC__) || defined(__clang__) @@ -23,10 +26,64 @@ #endif #endif -#define ARRAYS_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define MASK(n) (~((~0U << (n)))) +#if defined(_MSC_VER) +#include +static inline int rv_clz(uint32_t v) +{ + /* 0 is considered as undefined behavior */ + assert(v); + + uint32_t leading_zero = 0; + _BitScanReverse(&leading_zero, v); + return 31 - leading_zero; +} +#elif defined(__GNUC__) || defined(__clang__) +static inline int rv_clz(uint32_t v) +{ + /* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ + /* 0 is considered as undefined behavior */ + assert(v); + + return __builtin_clz(v); +} +#else /* generic implementation */ +static inline int rv_clz(uint32_t v) +{ + /* 0 is considered as undefined behavior */ + assert(v); + + /* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn */ + static const uint8_t mul_debruijn[] = { + 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, + 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31, + }; + + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + + return mul_debruijn[(uint32_t) (v * 0x07C4ACDDU) >> 27]; +} +#endif + +/* + * Integer log base 2 + * + * The input x must not be zero. + * Otherwise, the result is undefined on some platform. + * + */ +static inline uint8_t ilog2(uint32_t x) +{ + return 31 - rv_clz(x); +} + /* Alignment macro */ #if defined(__GNUC__) || defined(__clang__) #define __ALIGNED(x) __attribute__((aligned(x))) diff --git a/src/decode.h b/src/decode.h index 865ba7cf..e2b2984c 100644 --- a/src/decode.h +++ b/src/decode.h @@ -90,7 +90,7 @@ enum op_field { ) \ /* RV32 Zicsr Standard Extension */ \ IIF(RV32_HAS(Zicsr))( \ - _(csrrw, 0, 4, 0, ENC(rs1, rd)) \ + _(csrrw, 1, 4, 0, ENC(rs1, rd)) \ _(csrrs, 0, 4, 0, ENC(rs1, rd)) \ _(csrrc, 0, 4, 0, ENC(rs1, rd)) \ _(csrrwi, 0, 4, 0, ENC(rs1, rd)) \ diff --git a/src/devices/minimal.dts b/src/devices/minimal.dts new file mode 100644 index 00000000..b682473b --- /dev/null +++ b/src/devices/minimal.dts @@ -0,0 +1,69 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + model = "rv32emu"; + + aliases { + serial0 = "/soc@F0000000/serial@4000000"; + }; + + chosen { + bootargs = "earlycon console=ttyS0"; + stdout-path = "serial0"; + linux,initrd-start = <0x1f700000>; /* @403 MiB (503 * 1024 * 1024) */ + linux,initrd-end = <0x1fefffff>; /* @511 MiB (511 * 1024 * 1024 - 1) */ + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + timebase-frequency = <65000000>; + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "riscv"; + reg = <0>; + riscv,isa = "rv32ima"; + mmu-type = "riscv,sv32"; + cpu0_intc: interrupt-controller { + #interrupt-cells = <1>; + #address-cells = <0>; + interrupt-controller; + compatible = "riscv,cpu-intc"; + }; + }; + }; + + sram: memory@0 { + device_type = "memory"; + reg = <0x00000000 0x20000000>; + reg-names = "sram0"; + }; + + soc: soc@F0000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges = <0x0 0xF0000000 0x10000000>; + interrupt-parent = <&plic0>; + + plic0: interrupt-controller@0 { + #interrupt-cells = <1>; + #address-cells = <0>; + compatible = "sifive,plic-1.0.0"; + reg = <0x0000000 0x4000000>; + interrupt-controller; + interrupts-extended = <&cpu0_intc 9>; + riscv,ndev = <31>; + }; + + serial@4000000 { + compatible = "ns16550"; + reg = <0x4000000 0x100000>; + interrupts = <1>; + no-loopback-test; + clock-frequency = <5000000>; /* the baudrate divisor is ignored */ + }; + }; +}; diff --git a/src/devices/plic.c b/src/devices/plic.c new file mode 100644 index 00000000..06e47acf --- /dev/null +++ b/src/devices/plic.c @@ -0,0 +1,91 @@ +/* + * rv32emu is freely redistributable under the MIT License. See the file + * "LICENSE" for information on usage and redistribution of this file. + */ + +#include +#include + +#include "plic.h" +#include "riscv.h" +#include "riscv_private.h" + +void plic_update_interrupts(plic_t *plic) +{ + riscv_t *rv = (riscv_t *) plic->rv; + + /* Update pending interrupts */ + plic->ip |= plic->active & ~plic->masked; + plic->masked |= plic->active; + /* Send interrupt to target */ + if (plic->ip & plic->ie) + rv->csr_sip |= SIP_SEIP; + else + rv->csr_sip &= ~SIP_SEIP; +} + +uint32_t plic_read(plic_t *plic, const uint32_t addr) +{ + uint32_t plic_read_val = 0; + + switch (addr) { + case PLIC_INTR_PENDING: + plic_read_val = plic->ip; + break; + case PLIC_INTR_ENABLE: + plic_read_val = plic->ie; + break; + case PLIC_INTR_PRIORITY_THRESHOLD: + /* no priority support: target priority threshold hardwired to 0 */ + plic_read_val = 0; + break; + case PLIC_INTR_CLAIM_OR_COMPLETE: + /* claim */ + { + uint32_t intr_candidate = plic->ip & plic->ie; + if (intr_candidate) { + plic_read_val = ilog2(intr_candidate); + plic->ip &= ~(1U << (plic_read_val)); + } + break; + } + default: + return 0; + } + + return plic_read_val; +} + +void plic_write(plic_t *plic, const uint32_t addr, uint32_t value) +{ + switch (addr) { + case PLIC_INTR_ENABLE: + plic->ie = (value & ~1); + break; + case PLIC_INTR_PRIORITY_THRESHOLD: + /* no priority support: target priority threshold hardwired to 0 */ + break; + case PLIC_INTR_CLAIM_OR_COMPLETE: + /* completion */ + if (plic->ie & (1U << value)) + plic->masked &= ~(1U << value); + break; + default: + break; + } + + return; +} + +plic_t *plic_new() +{ + plic_t *plic = calloc(1, sizeof(plic_t)); + assert(plic); + + return plic; +} + +void plic_delete(plic_t *plic) +{ + free(plic); +} diff --git a/src/devices/plic.h b/src/devices/plic.h new file mode 100644 index 00000000..2385db66 --- /dev/null +++ b/src/devices/plic.h @@ -0,0 +1,41 @@ +/* + * rv32emu is freely redistributable under the MIT License. See the file + * "LICENSE" for information on usage and redistribution of this file. + */ + +#pragma once + +#include + +enum PLIC_REG { + PLIC_INTR_PENDING = 0x1000, + PLIC_INTR_ENABLE = 0x2000, + PLIC_INTR_PRIORITY_THRESHOLD = 0x200000, + PLIC_INTR_CLAIM_OR_COMPLETE = 0x200004, +}; + +/* PLIC */ +typedef struct { + uint32_t masked; + uint32_t ip; + uint32_t ie; + /* state of input interrupt lines (level-triggered), set by environment */ + uint32_t active; + /* RISC-V instance to receive PLIC interrupt */ + void *rv; +} plic_t; + +/* update PLIC status */ +void plic_update_interrupts(plic_t *plic); + +/* read a word from PLIC */ +uint32_t plic_read(plic_t *plic, const uint32_t addr); + +/* write a word to PLIC */ +void plic_write(plic_t *plic, const uint32_t addr, uint32_t value); + +/* create a PLIC instance */ +plic_t *plic_new(); + +/* delete a PLIC instance */ +void plic_delete(plic_t *plic); diff --git a/src/devices/uart.c b/src/devices/uart.c new file mode 100644 index 00000000..f4cfa892 --- /dev/null +++ b/src/devices/uart.c @@ -0,0 +1,151 @@ +/* + * rv32emu is freely redistributable under the MIT License. See the file + * "LICENSE" for information on usage and redistribution of this file. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "uart.h" + +/* Emulate 8250 (plain, without loopback mode support) */ + +#define U8250_INTR_THRE 1 + +void u8250_update_interrupts(u8250_state_t *uart) +{ + /* Some interrupts are level-generated. */ + /* TODO: does it also generate an LSR change interrupt? */ + if (uart->in_ready) + uart->pending_intrs |= 1; + else + uart->pending_intrs &= ~1; + + /* Prevent generating any disabled interrupts in the first place */ + uart->pending_intrs &= uart->ier; + + /* Update current interrupt (higher bits -> more priority) */ + if (uart->pending_intrs) + uart->current_intr = ilog2(uart->pending_intrs); +} + +void u8250_check_ready(u8250_state_t *uart) +{ + if (uart->in_ready) + return; + + struct pollfd pfd = {uart->in_fd, POLLIN, 0}; + poll(&pfd, 1, 0); + if (pfd.revents & POLLIN) + uart->in_ready = true; +} + +static void u8250_handle_out(u8250_state_t *uart, uint8_t value) +{ + if (write(uart->out_fd, &value, 1) < 1) + fprintf(stderr, "failed to write UART output: %s\n", strerror(errno)); +} + +static uint8_t u8250_handle_in(u8250_state_t *uart) +{ + uint8_t value = 0; + u8250_check_ready(uart); + if (!uart->in_ready) + return value; + + if (read(uart->in_fd, &value, 1) < 0) + fprintf(stderr, "failed to read UART input: %s\n", strerror(errno)); + uart->in_ready = false; + u8250_check_ready(uart); + + if (value == 1) { /* start of heading (Ctrl-a) */ + if (getchar() == 120) { /* keyboard x */ + printf("\n"); /* end emulator with newline */ + exit(0); + } + } + + return value; +} + +uint32_t u8250_read(u8250_state_t *uart, uint32_t addr) +{ + uint8_t ret = 0; + + switch (addr) { + case U8250_THR_RBR_DLL: + if (uart->lcr & (1 << 7)) /* DLAB */ + return uart->dll; + return u8250_handle_in(uart); + case U8250_IER_DLH: + if (uart->lcr & (1 << 7)) /* DLAB */ + return uart->dlh; + return uart->ier; + case U8250_IIR_FCR: + ret = (uart->current_intr << 1) | (uart->pending_intrs ? 0 : 1); + if (uart->current_intr == U8250_INTR_THRE) + uart->pending_intrs &= ~(1 << uart->current_intr); + return ret; + case U8250_LCR: + return uart->lcr; + case U8250_MCR: + return uart->mcr; + break; + case U8250_LSR: + /* LSR = no error, TX done & ready */ + return (0x60 | (uint8_t) uart->in_ready); + case U8250_MSR: + /* MSR = carrier detect, no ring, data ready, clear to send. */ + return 0xb0; + /* no scratch register, so we should be detected as a plain 8250. */ + default: + break; + } + + return (uint32_t) (int8_t) ret; +} + +void u8250_write(u8250_state_t *uart, uint32_t addr, uint32_t value) +{ + switch (addr) { + case U8250_THR_RBR_DLL: + if (uart->lcr & (1 << 7)) { /* DLAB */ + uart->dll = value; + break; + } + u8250_handle_out(uart, value); + uart->pending_intrs |= 1 << U8250_INTR_THRE; + break; + case U8250_IER_DLH: + if (uart->lcr & (1 << 7)) { /* DLAB */ + uart->dlh = value; + break; + } + uart->ier = value; + break; + case U8250_LCR: + uart->lcr = value; + break; + case U8250_MCR: + uart->mcr = value; + break; + } +} + +u8250_state_t *u8250_new() +{ + u8250_state_t *uart = calloc(1, sizeof(u8250_state_t)); + assert(uart); + + return uart; +} + +void u8250_delete(u8250_state_t *uart) +{ + free(uart); +} diff --git a/src/devices/uart.h b/src/devices/uart.h new file mode 100644 index 00000000..50a477a1 --- /dev/null +++ b/src/devices/uart.h @@ -0,0 +1,51 @@ +/* + * rv32emu is freely redistributable under the MIT License. See the file + * "LICENSE" for information on usage and redistribution of this file. + */ + +#pragma once + +#include +#include + +#define IRQ_UART_SHIFT 1 +#define IRQ_UART_BIT (1 << IRQ_UART_SHIFT) + +enum UART_REG { + U8250_THR_RBR_DLL = 0, + U8250_IER_DLH, + U8250_IIR_FCR, + U8250_LCR, + U8250_MCR, + U8250_LSR, + U8250_MSR, + U8250_SR, +}; + +typedef struct { + uint8_t dll, dlh; /* divisor (ignored) */ + uint8_t lcr; /* UART config */ + uint8_t ier; /* interrupt config */ + uint8_t current_intr, pending_intrs; /* interrupt status */ + uint8_t mcr; /* other output signals, loopback mode (ignored) */ + int in_fd, out_fd; /* I/O handling */ + bool in_ready; +} u8250_state_t; + +/* update UART status */ +void u8250_update_interrupts(u8250_state_t *uart); + +/* poll UART status */ +void u8250_check_ready(u8250_state_t *uart); + +/* read a word from UART */ +uint32_t u8250_read(u8250_state_t *uart, uint32_t addr); + +/* write a word to UART */ +void u8250_write(u8250_state_t *uart, uint32_t addr, uint32_t value); + +/* create a UART instance */ +u8250_state_t *u8250_new(); + +/* delete a UART instance */ +void u8250_delete(u8250_state_t *uart); diff --git a/src/emulate.c b/src/emulate.c index 5c54c1bb..6d2669d1 100644 --- a/src/emulate.c +++ b/src/emulate.c @@ -41,6 +41,13 @@ extern struct target_ops gdbstub_ops; #define IF_rs2(i, r) (i->rs2 == rv_reg_##r) #define IF_imm(i, v) (i->imm == v) +#if RV32_HAS(SYSTEM) +static bool need_clear_block_map = false; +static uint32_t reloc_enable_mmu_jalr_addr; +static bool reloc_enable_mmu = false; +bool need_retranslate = false; +#endif + static void rv_trap_default_handler(riscv_t *rv) { rv->csr_mepc += rv->compressed ? 2 : 4; @@ -70,15 +77,12 @@ static void __trap_handler(riscv_t *rv); return false; \ } -/* get current time in microseconds and update csr_time register */ +/* FIXME: use more precise methods for updating time, e.g., RTC */ +static uint64_t ctr = 0; static inline void update_time(riscv_t *rv) { - struct timeval tv; - rv_gettimeofday(&tv); - - uint64_t t = (uint64_t) tv.tv_sec * 1e6 + (uint32_t) tv.tv_usec; - rv->csr_time[0] = t & 0xFFFFFFFF; - rv->csr_time[1] = t >> 32; + rv->csr_time[0] = ctr & 0xFFFFFFFF; + rv->csr_time[1] = ctr >> 32; } #if RV32_HAS(Zicsr) @@ -177,6 +181,20 @@ static uint32_t csr_csrrw(riscv_t *rv, uint32_t csr, uint32_t val) *c = val; +#if !RV32_HAS(JIT) && RV32_HAS(SYSTEM) + /* + * guestOS's process might have same VA, so block map cannot be reused + * + * Instead of calling block_map_clear() directly here, + * a flag is set to indicate that the block map should be cleared, + * and the clearing occurs after the corresponding 'code' of RVOP + * has executed. This prevents the 'code' of RVOP from potentially + * accessing a NULL ir. + */ + if (c == &rv->csr_satp) + need_clear_block_map = true; +#endif + return out; } @@ -349,18 +367,31 @@ static set_t pc_set; static bool has_loops = false; #endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +extern void emu_update_uart_interrupts(riscv_t *rv); +static uint32_t peripheral_update_ctr = 64; +#endif + /* Interpreter-based execution path */ #define RVOP(inst, code, asm) \ static bool do_##inst(riscv_t *rv, rv_insn_t *ir, uint64_t cycle, \ uint32_t PC) \ { \ - cycle++; \ + IIF(RV32_HAS(SYSTEM))(ctr++;, ) cycle++; \ code; \ nextop: \ PC += __rv_insn_##inst##_len; \ - if (unlikely(RVOP_NO_NEXT(ir))) { \ + IIF(RV32_HAS(SYSTEM)) \ + (IIF(RV32_HAS(JIT))( \ + , if (unlikely(need_clear_block_map)) { \ + block_map_clear(rv); \ + need_clear_block_map = false; \ + rv->csr_cycle = cycle; \ + rv->PC = PC; \ + return false; \ + }), ); \ + if (unlikely(RVOP_NO_NEXT(ir))) \ goto end_op; \ - } \ const rv_insn_t *next = ir->next; \ MUST_TAIL return next->impl(rv, next, cycle, PC); \ end_op: \ @@ -522,6 +553,7 @@ FORCE_INLINE bool insn_is_unconditional_branch(uint8_t opcode) case rv_insn_jal: case rv_insn_jalr: case rv_insn_mret: + case rv_insn_csrrw: #if RV32_HAS(SYSTEM) case rv_insn_sret: #endif @@ -568,6 +600,7 @@ FORCE_INLINE bool insn_is_indirect_branch(uint8_t opcode) static void block_translate(riscv_t *rv, block_t *block) { +retranslate: block->pc_start = block->pc_end = rv->PC; rv_insn_t *prev_ir = NULL; @@ -580,7 +613,17 @@ static void block_translate(riscv_t *rv, block_t *block) prev_ir->next = ir; /* fetch the next instruction */ - const uint32_t insn = rv->io.mem_ifetch(rv, block->pc_end); + uint32_t insn = rv->io.mem_ifetch(rv, block->pc_end); + +#if RV32_HAS(SYSTEM) + if (!insn && need_retranslate) { + memset(block, 0, sizeof(block_t)); + need_retranslate = false; + goto retranslate; + } +#endif + + assert(insn); /* decode the instruction */ if (!rv_decode(ir, insn)) { @@ -589,8 +632,7 @@ static void block_translate(riscv_t *rv, block_t *block) break; } ir->impl = dispatch_table[ir->opcode]; - ir->pc = block->pc_end; - /* compute the end of pc */ + ir->pc = block->pc_end; /* compute the end of pc */ block->pc_end += is_compressed(insn) ? 2 : 4; block->n_insn++; prev_ir = ir; @@ -908,6 +950,14 @@ static bool runtime_profiler(riscv_t *rv, block_t *block) } #endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +static bool rv_has_plic_trap(riscv_t *rv) +{ + return ((rv->csr_sstatus & SSTATUS_SIE || !rv->priv_mode) && + (rv->csr_sip & rv->csr_sie)); +} +#endif + void rv_step(void *arg) { assert(arg); @@ -921,6 +971,41 @@ void rv_step(void *arg) /* loop until hitting the cycle target */ while (rv->csr_cycle < cycles_target && !rv->halt) { +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + /* check for any interrupt after every block emulation */ + + if (peripheral_update_ctr-- == 0) { + peripheral_update_ctr = 64; + + u8250_check_ready(PRIV(rv)->uart); + if (PRIV(rv)->uart->in_ready) + emu_update_uart_interrupts(rv); + } + + if (ctr > attr->timer) + rv->csr_sip |= RV_INT_STI; + else + rv->csr_sip &= ~RV_INT_STI; + + if (rv_has_plic_trap(rv)) { + uint32_t intr_applicable = rv->csr_sip & rv->csr_sie; + uint8_t intr_idx = ilog2(intr_applicable); + switch (intr_idx) { + case (SUPERVISOR_SW_INTR & 0xf): + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, SUPERVISOR_SW_INTR, 0); + break; + case (SUPERVISOR_TIMER_INTR & 0xf): + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, SUPERVISOR_TIMER_INTR, 0); + break; + case (SUPERVISOR_EXTERNAL_INTR & 0xf): + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, SUPERVISOR_EXTERNAL_INTR, 0); + break; + default: + break; + } + } +#endif /* RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) */ + if (prev && prev->pc_start != last_pc) { /* update previous block */ #if !RV32_HAS(JIT) @@ -1025,7 +1110,7 @@ void rv_step(void *arg) #if RV32_HAS(SYSTEM) static void __trap_handler(riscv_t *rv) { - rv_insn_t *ir = mpool_alloc(rv->block_ir_mp); + rv_insn_t *ir = mpool_calloc(rv->block_ir_mp); assert(ir); /* set to false by sret implementation */ @@ -1034,10 +1119,14 @@ static void __trap_handler(riscv_t *rv) assert(insn); rv_decode(ir, insn); + reloc_enable_mmu_jalr_addr = rv->PC; + ir->impl = dispatch_table[ir->opcode]; rv->compressed = is_compressed(insn); ir->impl(rv, ir, rv->csr_cycle, rv->PC); } + + prev = NULL; } #endif /* RV32_HAS(SYSTEM) */ @@ -1132,9 +1221,18 @@ void ebreak_handler(riscv_t *rv) void ecall_handler(riscv_t *rv) { assert(rv); -#if RV32_HAS(SYSTEM) - syscall_handler(rv); + +#if RV32_HAS(ELF_LOADER) rv->PC += 4; + syscall_handler(rv); +#elif RV32_HAS(SYSTEM) + if (rv->priv_mode == RV_PRIV_U_MODE) { + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, ECALL_U, 0); + } else if (rv->priv_mode == + RV_PRIV_S_MODE) { /* trap to SBI syscall handler */ + rv->PC += 4; + syscall_handler(rv); + } #else SET_CAUSE_AND_TVAL_THEN_TRAP(rv, ECALL_M, 0); syscall_handler(rv); diff --git a/src/feature.h b/src/feature.h index 93eb6160..6c33110a 100644 --- a/src/feature.h +++ b/src/feature.h @@ -68,5 +68,10 @@ #define RV32_FEATURE_SYSTEM 0 #endif +/* Use ELF loader */ +#ifndef RV32_FEATURE_ELF_LOADER +#define RV32_FEATURE_ELF_LOADER 0 +#endif + /* Feature test macro */ #define RV32_HAS(x) RV32_FEATURE_##x diff --git a/src/io.h b/src/io.h index cfceee2f..2f9f537b 100644 --- a/src/io.h +++ b/src/io.h @@ -8,6 +8,7 @@ #include #include +/* main memory */ typedef struct { uint8_t *mem_base; uint64_t mem_size; diff --git a/src/jit.c b/src/jit.c index a26efae6..da5eb079 100644 --- a/src/jit.c +++ b/src/jit.c @@ -253,7 +253,7 @@ static struct host_reg register_map[] = { #endif static const int n_host_regs = - ARRAYS_SIZE(register_map); /* the number of avavliable host register */ + ARRAY_SIZE(register_map); /* the number of avavliable host register */ static inline void set_dirty(int reg_idx, bool is_dirty) { @@ -1237,7 +1237,7 @@ static void prepare_translate(struct jit_state *state) { #if defined(__x86_64__) /* Save platform non-volatile registers */ - for (uint32_t i = 0; i < ARRAYS_SIZE(nonvolatile_reg); i++) + for (uint32_t i = 0; i < ARRAY_SIZE(nonvolatile_reg); i++) emit_push(state, nonvolatile_reg[i]); /* Assuming that the stack is 16-byte aligned just before the call @@ -1247,7 +1247,7 @@ static void prepare_translate(struct jit_state *state) * registers were pushed onto the stack during state saving (see above), * an additional 8 bytes must be added to regain 16-byte alignment. */ - if (!(ARRAYS_SIZE(nonvolatile_reg) % 2)) + if (!(ARRAY_SIZE(nonvolatile_reg) % 2)) emit_alu64_imm32(state, 0x81, 5, RSP, 0x8); /* Set JIT R10 (the way to access the frame in JIT) to match RSP. */ @@ -1272,17 +1272,17 @@ static void prepare_translate(struct jit_state *state) /* Deallocate stack space by restoring RSP from JIT R10. */ emit_mov(state, RBP, RSP); - if (!(ARRAYS_SIZE(nonvolatile_reg) % 2)) + if (!(ARRAY_SIZE(nonvolatile_reg) % 2)) emit_alu64_imm32(state, 0x81, 0, RSP, 0x8); /* Restore platform non-volatile registers */ - for (uint32_t i = 0; i < ARRAYS_SIZE(nonvolatile_reg); i++) - emit_pop(state, nonvolatile_reg[ARRAYS_SIZE(nonvolatile_reg) - i - 1]); + for (uint32_t i = 0; i < ARRAY_SIZE(nonvolatile_reg); i++) + emit_pop(state, nonvolatile_reg[ARRAY_SIZE(nonvolatile_reg) - i - 1]); /* Return */ emit1(state, 0xc3); #elif defined(__aarch64__) - uint32_t register_space = ARRAYS_SIZE(callee_reg) * 8 + 2 * 8; + uint32_t register_space = ARRAY_SIZE(callee_reg) * 8 + 2 * 8; state->stack_size = align_up(STACK_SIZE + register_space, 16); emit_addsub_imm(state, true, AS_SUB, SP, SP, state->stack_size); @@ -1292,7 +1292,7 @@ static void prepare_translate(struct jit_state *state) emit_addsub_imm(state, true, AS_ADD, R29, SP, 0); /* Save callee saved registers */ - for (size_t i = 0; i < ARRAYS_SIZE(callee_reg); i += 2) { + for (size_t i = 0; i < ARRAY_SIZE(callee_reg); i += 2) { emit_loadstorepair_imm(state, LSP_STPX, callee_reg[i], callee_reg[i + 1], SP, (i + 2) * 8); } @@ -1302,7 +1302,7 @@ static void prepare_translate(struct jit_state *state) state->exit_loc = state->offset; /* Restore callee-saved registers). */ - for (size_t i = 0; i < ARRAYS_SIZE(callee_reg); i += 2) { + for (size_t i = 0; i < ARRAY_SIZE(callee_reg); i += 2) { emit_loadstorepair_imm(state, LSP_LDPX, callee_reg[i], callee_reg[i + 1], SP, (i + 2) * 8); } diff --git a/src/main.c b/src/main.c index d9b261e6..bf1c5fbb 100644 --- a/src/main.c +++ b/src/main.c @@ -16,7 +16,9 @@ #include "utils.h" /* enable program trace mode */ +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) static bool opt_trace = false; +#endif #if RV32_HAS(GDBSTUB) /* enable program gdbstub mode */ @@ -40,7 +42,7 @@ static char *opt_prog_name; /* target argc and argv */ static int prog_argc; static char **prog_args; -static const char *optstr = "tgqmhpd:a:"; +static const char *optstr = "tgqmhpd:a:k:i:b:"; /* enable misaligned memory access */ static bool opt_misaligned = false; @@ -49,15 +51,29 @@ static bool opt_misaligned = false; static bool opt_prof_data = false; static char *prof_out_file; +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +/* Linux kernel data */ +static char *opt_kernel_img; +static char *opt_rootfs_img; +static char *opt_dtb; +#endif + static void print_usage(const char *filename) { fprintf(stderr, "RV32I[MAFC] Emulator which loads an ELF file to execute.\n" "Usage: %s [options] [filename] [arguments]\n" "Options:\n" +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) " -t : print executable trace\n" +#endif #if RV32_HAS(GDBSTUB) " -g : allow remote GDB connections (as gdbstub)\n" +#endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + " -k : use as kernel image\n" + " -i : use as rootfs\n" + " -b : use as device tree blob\n" #endif " -d [filename]: dump registers as JSON to the " "given file or `-` (STDOUT)\n" @@ -79,13 +95,29 @@ static bool parse_args(int argc, char **args) emu_argc++; switch (opt) { +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) case 't': opt_trace = true; break; +#endif #if RV32_HAS(GDBSTUB) case 'g': opt_gdbstub = true; break; +#endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + case 'k': + opt_kernel_img = optarg; + emu_argc++; + break; + case 'i': + opt_rootfs_img = optarg; + emu_argc++; + break; + case 'b': + opt_dtb = optarg; + emu_argc++; + break; #endif case 'q': opt_quiet_outputs = true; @@ -194,6 +226,12 @@ void indirect_rv_halt() } #endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +/* forcely undefine MEM_SIZE to prevent any define in Makefile */ +#undef MEM_SIZE +#define MEM_SIZE 512 * 1024 * 1024 +#endif + int main(int argc, char **args) { if (argc == 1 || !parse_args(argc, args)) { @@ -202,7 +240,9 @@ int main(int argc, char **args) } int run_flag = 0; +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) run_flag |= opt_trace; +#endif #if RV32_HAS(GDBSTUB) run_flag |= opt_gdbstub << 1; #endif @@ -217,20 +257,15 @@ int main(int argc, char **args) .log_level = 0, .run_flag = run_flag, .profile_output_file = prof_out_file, -#if RV32_HAS(SYSTEM) - .data.system = malloc(sizeof(vm_system_t)), -#else - .data.user = malloc(sizeof(vm_user_t)), -#endif .cycle_per_step = CYCLE_PER_STEP, .allow_misalign = opt_misaligned, }; -#if RV32_HAS(SYSTEM) - assert(attr.data.system); - attr.data.system->elf_program = opt_prog_name; +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + attr.data.system.kernel = opt_kernel_img; + attr.data.system.initrd = opt_rootfs_img; + attr.data.system.dtb = opt_dtb; #else - assert(attr.data.user); - attr.data.user->elf_program = opt_prog_name; + attr.data.user.elf_program = opt_prog_name; #endif /* create the RISC-V runtime */ @@ -257,7 +292,6 @@ int main(int argc, char **args) printf("inferior exit code %d\n", attr.exit_code); end: - free(attr.data.user); free(prof_out_file); return attr.exit_code; } diff --git a/src/riscv.c b/src/riscv.c index df84bac1..a06a2f33 100644 --- a/src/riscv.c +++ b/src/riscv.c @@ -4,9 +4,17 @@ */ #include +#include +#include #include #include #include +#include +#include + +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +#include +#endif #if !defined(_WIN32) && !defined(_WIN64) #include @@ -174,6 +182,7 @@ void rv_remap_stdstream(riscv_t *rv, fd_stream_pair_t *fsp, uint32_t fsp_size) (memory_##op(addr, (uint8_t *) &data), return memory_##op(addr)); \ } +#if !RV32_HAS(SYSTEM) #define R 0 #define W 1 @@ -188,6 +197,7 @@ IO_HANDLER_IMPL(byte, write_b, W) #undef R #undef W +#endif #if RV32_HAS(T2C) static pthread_t t2c_thread; @@ -211,6 +221,104 @@ static void *t2c_runloop(void *arg) } #endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +static void map_file(char **ram_loc, const char *name) +{ + int fd = open(name, O_RDONLY); + if (fd < 0) + goto fail; + + /* get file size */ + struct stat st; + fstat(fd, &st); + +#if HAVE_MMAP + /* remap to a memory region */ + *ram_loc = mmap(*ram_loc, st.st_size, PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_PRIVATE, fd, 0); + if (*ram_loc == MAP_FAILED) + goto cleanup; +#else + /* calloc and load data to a memory region */ + *ram_loc = calloc(st.st_size, sizeof(uint8_t)); + if (!*ram_loc) + goto cleanup; + if (read(fd, *ram_loc, st.st_size) != st.st_size) { + free(*ram_loc); + goto cleanup; + } +#endif + + /* + * The kernel selects a nearby page boundary and attempts to create + * the mapping. + */ + *ram_loc += st.st_size; + return; + +cleanup: + close(fd); +fail: + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(EXIT_FAILURE); +} + +/* + * The control mode flag for keyboard. + * + * ICANON: Enable canonical mode. + * ECHO: Echo input characters. + * ISIG: When any of the characters INTR, QUIT, + * SUSP, or DSUSP are received, generate the + * corresponding signal. + * + * It is essential to re-enable ISIG upon exit. + * Otherwise, the default signal handler will + * not catch the signal. E.g., SIGINT generated by + * CTRL + c. + * + */ +#define TERMIOS_C_CFLAG (ICANON | ECHO | ISIG) +static void reset_keyboard_input() +{ + struct termios term; + tcgetattr(0, &term); + term.c_lflag |= TERMIOS_C_CFLAG; + tcsetattr(0, TCSANOW, &term); +} + +/* Asynchronous communication to capture all keyboard input for the VM. */ +static void capture_keyboard_input() +{ + /* Hook exit, because we want to re-enable default control modes. */ + atexit(reset_keyboard_input); + + struct termios term; + tcgetattr(0, &term); + term.c_lflag &= ~TERMIOS_C_CFLAG; + tcsetattr(0, TCSANOW, &term); +} +#endif + +/* + * + * atexit() registers void (*)(void) callbacks, so no parameters can be passed. + * Memory must be freed at runtime. block_map_clear() requires a RISC-V instance + * and runs in interpreter mode. Instead of modifying its signature, access the + * global RISC-V instance in main.c with external linkage. + * + */ +extern riscv_t *rv; +static void rv_async_block_clear() +{ +#if !RV32_HAS(JIT) + if (rv && rv->block_map.size) + block_map_clear(rv); +#else /* TODO: JIT mode */ + return; +#endif /* !RV32_HAS(JIT) */ +} + riscv_t *rv_create(riscv_user_t rv_attr) { assert(rv_attr); @@ -218,85 +326,24 @@ riscv_t *rv_create(riscv_user_t rv_attr) riscv_t *rv = calloc(1, sizeof(riscv_t)); assert(rv); + /* register cleaning callback for CTRL+a+x exit */ + atexit(rv_async_block_clear); + /* copy over the attr */ rv->data = rv_attr; vm_attr_t *attr = PRIV(rv); attr->mem = memory_new(attr->mem_size); assert(attr->mem); + assert(!(((uintptr_t) attr->mem) & 0b11)); /* reset */ rv_reset(rv, 0U); - if (attr->data.user) { - elf_t *elf = elf_new(); - assert(elf && elf_open(elf, (attr->data.user)->elf_program)); - - const struct Elf32_Sym *end; - if ((end = elf_get_symbol(elf, "_end"))) - attr->break_addr = end->st_value; - - assert(elf_load(elf, attr->mem)); - - /* set the entry pc */ - const struct Elf32_Ehdr *hdr = get_elf_header(elf); - assert(rv_set_pc(rv, hdr->e_entry)); - - elf_delete(elf); - - /* install the I/O handlers */ - const riscv_io_t io = { - /* memory read interface */ - .mem_ifetch = MEMIO(ifetch), - .mem_read_w = MEMIO(read_w), - .mem_read_s = MEMIO(read_s), - .mem_read_b = MEMIO(read_b), - - /* memory write interface */ - .mem_write_w = MEMIO(write_w), - .mem_write_s = MEMIO(write_s), - .mem_write_b = MEMIO(write_b), - - /* system services or essential routines */ - .on_ecall = ecall_handler, - .on_ebreak = ebreak_handler, - .on_memcpy = memcpy_handler, - .on_memset = memset_handler, - .on_trap = trap_handler, - }; - memcpy(&rv->io, &io, sizeof(riscv_io_t)); - } -#if RV32_HAS(SYSTEM) - else { - /* TODO: Implement the essential functions for system emulation. - * e.g., kernel image, dtb, rootfs - * - * The test suite is compiled into a single ELF file, so load it as - * an ELF executable, just like a userspace ELF. - */ - elf_t *elf = elf_new(); - assert(elf && elf_open(elf, (attr->data.system)->elf_program)); - - const struct Elf32_Sym *end; - if ((end = elf_get_symbol(elf, "_end"))) - attr->break_addr = end->st_value; - - assert(elf_load(elf, attr->mem)); - - /* set the entry pc */ - const struct Elf32_Ehdr *hdr = get_elf_header(elf); - assert(rv_set_pc(rv, hdr->e_entry)); - - elf_delete(elf); - - /* this variable has external linkage to mmu_io defined in system.c */ - extern riscv_io_t mmu_io; - memcpy(&rv->io, &mmu_io, sizeof(riscv_io_t)); - } -#endif /* SYSTEM */ - - /* default standard stream. - * rv_remap_stdstream can be called to overwrite them + /* + * default standard stream. + * rv_remap_stdstream() can be called to overwrite them + * */ attr->fd_map = map_init(int, FILE *, map_cmp_int); rv_remap_stdstream(rv, @@ -307,6 +354,101 @@ riscv_t *rv_create(riscv_user_t rv_attr) }, 3); +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) + elf_t *elf = elf_new(); + assert(elf && elf_open(elf, attr->data.user.elf_program)); + + const struct Elf32_Sym *end; + if ((end = elf_get_symbol(elf, "_end"))) + attr->break_addr = end->st_value; + + assert(elf_load(elf, attr->mem)); + + /* set the entry pc */ + const struct Elf32_Ehdr *hdr = get_elf_header(elf); + assert(rv_set_pc(rv, hdr->e_entry)); + + elf_delete(elf); + +/* combine with USE_ELF for system test suite */ +#if RV32_HAS(SYSTEM) + /* this variable has external linkage to mmu_io defined in system.c */ + extern riscv_io_t mmu_io; + /* install the MMU I/O handlers */ + memcpy(&rv->io, &mmu_io, sizeof(riscv_io_t)); +#else + /* install the I/O handlers */ + const riscv_io_t io = { + /* memory read interface */ + .mem_ifetch = MEMIO(ifetch), + .mem_read_w = MEMIO(read_w), + .mem_read_s = MEMIO(read_s), + .mem_read_b = MEMIO(read_b), + + /* memory write interface */ + .mem_write_w = MEMIO(write_w), + .mem_write_s = MEMIO(write_s), + .mem_write_b = MEMIO(write_b), + + /* system services or essential routines */ + .on_ecall = ecall_handler, + .on_ebreak = ebreak_handler, + .on_memcpy = memcpy_handler, + .on_memset = memset_handler, + .on_trap = trap_handler, + }; + memcpy(&rv->io, &io, sizeof(riscv_io_t)); +#endif /* RV32_HAS(SYSTEM) */ + +#else + /* *-----------------------------------------* + * | Memory layout | + * *----------------*----------------*-------* + * | kernel image | initrd image | dtb | + * *----------------*----------------*-------* + */ + + char *ram_loc = (char *) attr->mem->mem_base; + map_file(&ram_loc, attr->data.system.kernel); + + uint32_t dtb_addr = attr->mem->mem_size - (1 * 1024 * 1024); + ram_loc = ((char *) attr->mem->mem_base) + dtb_addr; + map_file(&ram_loc, attr->data.system.dtb); + /* + * Load optional initrd image at last 8 MiB before the dtb region to + * prevent kernel from overwritting it + */ + if (attr->data.system.initrd) { + uint32_t initrd_addr = dtb_addr - (8 * 1024 * 1024); + ram_loc = ((char *) attr->mem->mem_base) + initrd_addr; + map_file(&ram_loc, attr->data.system.initrd); + } + + /* this variable has external linkage to mmu_io defined in system.c */ + extern riscv_io_t mmu_io; + memcpy(&rv->io, &mmu_io, sizeof(riscv_io_t)); + + /* setup RISC-V hart */ + rv_set_reg(rv, rv_reg_a0, 0); + rv_set_reg(rv, rv_reg_a1, dtb_addr); + + /* setup timer */ + attr->timer = 0xFFFFFFFFFFFFFFF; + + /* setup PLIC */ + attr->plic = plic_new(); + assert(attr->plic); + attr->plic->rv = rv; + + /* setup UART */ + attr->uart = u8250_new(); + assert(attr->uart); + attr->uart->in_fd = attr->fd_stdin; + attr->uart->out_fd = attr->fd_stdout; + + capture_keyboard_input(); +#endif /* !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) */ + /* create block and IRs memory pool */ rv->block_mp = mpool_create(sizeof(block_t) << BLOCK_MAP_CAPACITY_BITS, sizeof(block_t)); @@ -336,15 +478,19 @@ riscv_t *rv_create(riscv_user_t rv_attr) return rv; } +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) +/* + * TODO: enable to trace Linux kernel symbol + */ static void rv_run_and_trace(riscv_t *rv) { assert(rv); vm_attr_t *attr = PRIV(rv); - assert(attr && attr->data.user && attr->data.user->elf_program); + assert(attr && attr->data.user.elf_program); attr->cycle_per_step = 1; - const char *prog_name = attr->data.user->elf_program; + const char *prog_name = attr->data.user.elf_program; elf_t *elf = elf_new(); assert(elf && elf_open(elf, prog_name)); @@ -359,6 +505,7 @@ static void rv_run_and_trace(riscv_t *rv) elf_delete(elf); } +#endif #if RV32_HAS(GDBSTUB) /* Run the RISC-V emulator as gdbstub */ @@ -373,20 +520,16 @@ void rv_run(riscv_t *rv) vm_attr_t *attr = PRIV(rv); assert(attr && -#if RV32_HAS(SYSTEM) - attr->data.system && attr->data.system->elf_program +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + attr->data.system.kernel && attr->data.system.initrd && + attr->data.system.dtb #else - attr->data.user && attr->data.user->elf_program + attr->data.user.elf_program #endif ); + attr->cycle_per_step = 100000000; - if (attr->run_flag & RV_RUN_TRACE) - rv_run_and_trace(rv); -#if RV32_HAS(GDBSTUB) - else if (attr->run_flag & RV_RUN_GDBSTUB) - rv_debug(rv); -#endif - else { + if (!(attr->run_flag & (RV_RUN_TRACE | RV_RUN_GDBSTUB))) { #ifdef __EMSCRIPTEN__ emscripten_set_main_loop_arg(rv_step, (void *) rv, 0, 1); #else @@ -395,6 +538,14 @@ void rv_run(riscv_t *rv) rv_step(rv); /* step instructions */ #endif } +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) + else if (attr->run_flag & RV_RUN_TRACE) + rv_run_and_trace(rv); +#endif +#if RV32_HAS(GDBSTUB) + else if (attr->run_flag & RV_RUN_GDBSTUB) + rv_debug(rv); +#endif if (attr->run_flag & RV_RUN_PROFILE) { assert(attr->profile_output_file); @@ -430,6 +581,10 @@ void rv_delete(riscv_t *rv) #endif jit_state_exit(rv->jit_state); cache_free(rv->block_cache); +#endif +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + u8250_delete(attr->uart); + plic_delete(attr->plic); #endif free(rv); } diff --git a/src/riscv.h b/src/riscv.h index 24e036a7..9486a43a 100644 --- a/src/riscv.h +++ b/src/riscv.h @@ -12,6 +12,11 @@ #include "io.h" #include "map.h" +#if RV32_HAS(SYSTEM) +#include "devices/plic.h" +#include "devices/uart.h" +#endif /* RV32_HAS(SYSTEM) */ + #if RV32_HAS(EXT_F) #define float16_t softfloat_float16_t #define bfloat16_t softfloat_bfloat16_t @@ -149,6 +154,7 @@ enum { #define RV_PRIV_S_MODE 1 #define RV_PRIV_M_MODE 3 +typedef uint32_t pte_t; #define PTE_V (1U) #define PTE_R (1U << 1) #define PTE_W (1U << 2) @@ -169,6 +175,8 @@ enum SV32_PTE_PERM { RESRV_PAGE1 = 0b0101, RESRV_PAGE2 = 0b1101, }; +#define RV_INT_STI_SHIFT 5 +#define RV_INT_STI (1 << RV_INT_STI_SHIFT) /* * SBI functions must return a pair of values: @@ -273,16 +281,20 @@ enum SV32_PTE_PERM { /* clang-format off */ enum TRAP_CODE { #if !RV32_HAS(EXT_C) - INSN_MISALIGNED = 0, /* Instruction address misaligned */ + INSN_MISALIGNED = 0, /* Instruction address misaligned */ #endif /* !RV32_HAS(EXT_C) */ - ILLEGAL_INSN = 2, /* Illegal instruction */ - BREAKPOINT = 3, /* Breakpoint */ - LOAD_MISALIGNED = 4, /* Load address misaligned */ - STORE_MISALIGNED = 6, /* Store/AMO address misaligned */ + ILLEGAL_INSN = 2, /* Illegal instruction */ + BREAKPOINT = 3, /* Breakpoint */ + LOAD_MISALIGNED = 4, /* Load address misaligned */ + STORE_MISALIGNED = 6, /* Store/AMO address misaligned */ #if RV32_HAS(SYSTEM) - PAGEFAULT_INSN = 12, /* Instruction page fault */ - PAGEFAULT_LOAD = 13, /* Load page fault */ - PAGEFAULT_STORE = 15, /* Store page fault */ + PAGEFAULT_INSN = 12, /* Instruction page fault */ + PAGEFAULT_LOAD = 13, /* Load page fault */ + PAGEFAULT_STORE = 15, /* Store page fault */ + SUPERVISOR_SW_INTR = (1U << 31) | 1, /* Supervisor software interrupt */ + SUPERVISOR_TIMER_INTR = (1U << 31) | 5, /* Supervisor timer interrupt */ + SUPERVISOR_EXTERNAL_INTR = (1U << 31) | 9, /* Supervisor external interrupt */ + ECALL_U = 8, /* Environment call from U-mode */ #endif /* RV32_HAS(SYSTEM) */ #if !RV32_HAS(SYSTEM) ECALL_M = 11, /* Environment call from M-mode */ @@ -295,23 +307,25 @@ enum TRAP_CODE { * into a cause and tval identifier respectively. */ /* clang-format off */ -#define SET_CAUSE_AND_TVAL_THEN_TRAP(rv, cause, tval) \ - { \ - /* \ - * To align rv32emu behavior with Spike \ - * \ - * If not in system mode, the __trap_handler \ - * should be be invoked \ - */ \ - IIF(RV32_HAS(SYSTEM))(rv->is_trapped = true;, ); \ - if(RV_PRIV_IS_U_OR_S_MODE()){ \ - rv->csr_scause = cause; \ - rv->csr_stval = tval; \ - } else { \ - rv->csr_mcause = cause; \ - rv->csr_mtval = tval; \ - } \ - rv->io.on_trap(rv); \ +#define SET_CAUSE_AND_TVAL_THEN_TRAP(rv, cause, tval) \ + { \ + /* \ + * To align rv32emu behavior with Spike \ + * \ + * If not in system mode, the __trap_handler \ + * should be be invoked \ + * \ + * FIXME: ECALL_U cannot be trap directly to __trap_handler \ + */ \ + IIF(RV32_HAS(SYSTEM))(if (cause != ECALL_U) rv->is_trapped = true;, ); \ + if (RV_PRIV_IS_U_OR_S_MODE()) { \ + rv->csr_scause = cause; \ + rv->csr_stval = tval; \ + } else { \ + rv->csr_mcause = cause; \ + rv->csr_mtval = tval; \ + } \ + rv->io.on_trap(rv); \ } /* clang-format on */ @@ -514,23 +528,32 @@ typedef struct { char *elf_program; } vm_user_t; -/* FIXME: replace with kernel image, dtb, etc */ #if RV32_HAS(SYSTEM) typedef struct { - char *elf_program; + char *kernel; + char *initrd; + char *dtb; } vm_system_t; -#endif /* SYSTEM */ +#endif /* RV32_HAS(SYSTEM) */ typedef struct { - vm_user_t *user; - -#if RV32_HAS(SYSTEM) - vm_system_t *system; -#endif /* SYSTEM */ +#if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) + vm_user_t user; +#else + vm_system_t system; +#endif /* !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) */ } vm_data_t; typedef struct { +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + /* uart object */ + u8250_state_t *uart; + + /* plic object */ + plic_t *plic; +#endif /* RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) */ + /* vm memory object */ memory_t *mem; diff --git a/src/riscv_private.h b/src/riscv_private.h index a0388844..0ae6f279 100644 --- a/src/riscv_private.h +++ b/src/riscv_private.h @@ -178,11 +178,11 @@ struct riscv_internal { pthread_mutex_t wait_queue_lock, cache_lock; volatile bool quit; /**< Determine the main thread is terminated or not */ #endif + void *jit_state; + void *jit_cache; #endif struct mpool *block_mp, *block_ir_mp; - void *jit_state; - void *jit_cache; #if RV32_HAS(GDBSTUB) /* gdbstub instance */ gdbstub_t gdbstub; diff --git a/src/rv32_template.c b/src/rv32_template.c index 0093b804..e0e41cf6 100644 --- a/src/rv32_template.c +++ b/src/rv32_template.c @@ -173,8 +173,25 @@ RVOP( if (cache_hot(rv->block_cache, PC)) goto end_op; #endif - last_pc = PC; - MUST_TAIL return taken->impl(rv, taken, cycle, PC); +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + /* + * The last_pc should only be updated when not in the trap path. + * Updating it during the trap path could lead to incorrect + * block chaining in rv_step(). Specifically, an interrupt might + * occur before locating the previous block with last_pc, and + * since __trap_handler() uses the same RVOP, the last_pc could + * be updated incorrectly during the trap path. + * + * This rule also applies to same statements elsewhere in this + * file. + */ + last_pc = PC; + + MUST_TAIL return taken->impl(rv, taken, cycle, PC); + } } goto end_op; }, @@ -197,26 +214,34 @@ RVOP( * table to link he indirect jump targets. */ #if !RV32_HAS(JIT) -#define LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE() \ - /* lookup branch history table */ \ - IIF(RV32_HAS(SYSTEM)(if (!rv->is_trapped), )) \ - { \ - for (int i = 0; i < HISTORY_SIZE; i++) { \ - if (ir->branch_table->PC[i] == PC) { \ - MUST_TAIL return ir->branch_table->target[i]->impl( \ - rv, ir->branch_table->target[i], cycle, PC); \ - } \ - } \ - block_t *block = block_find(&rv->block_map, PC); \ - if (block) { \ - /* update branch history table */ \ - ir->branch_table->PC[ir->branch_table->idx] = PC; \ - ir->branch_table->target[ir->branch_table->idx] = block->ir_head; \ - ir->branch_table->idx = \ - (ir->branch_table->idx + 1) % HISTORY_SIZE; \ - MUST_TAIL return block->ir_head->impl(rv, block->ir_head, cycle, \ - PC); \ - } \ +#define LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE() \ + /* \ + * lookup branch history table \ + * \ + * When handling trap, the branch history table should not be lookup since \ + * it causes return from the trap_handler. \ + * \ + * In addition, before relocate_enable_mmu, the block maybe retranslated, \ + * thus the branch history lookup table should not be updated too. \ + */ \ + IIF(RV32_HAS(SYSTEM)(if (!rv->is_trapped && !reloc_enable_mmu), )) \ + { \ + for (int i = 0; i < HISTORY_SIZE; i++) { \ + if (ir->branch_table->PC[i] == PC) { \ + MUST_TAIL return ir->branch_table->target[i]->impl( \ + rv, ir->branch_table->target[i], cycle, PC); \ + } \ + } \ + block_t *block = block_find(&rv->block_map, PC); \ + if (block) { \ + /* update branch history table */ \ + ir->branch_table->PC[ir->branch_table->idx] = PC; \ + ir->branch_table->target[ir->branch_table->idx] = block->ir_head; \ + ir->branch_table->idx = \ + (ir->branch_table->idx + 1) % HISTORY_SIZE; \ + MUST_TAIL return block->ir_head->impl(rv, block->ir_head, cycle, \ + PC); \ + } \ } #else #define LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE() \ @@ -269,6 +294,29 @@ RVOP( RV_EXC_MISALIGN_HANDLER(pc, INSN, false, 0); #endif LOOKUP_OR_UPDATE_BRANCH_HISTORY_TABLE(); + +#if RV32_HAS(SYSTEM) + /* + * relocate_enable_mmu is the first function called to set up the MMU. + * Inside the function, at address 0x98, an invalid PTE is accessed, + * causing a fetch page fault and trapping into the trap_handler, and + * it will not return via sret. + * + * After the jalr instruction at physical address 0xc00000b4 + * (the final instruction of relocate_enable_mmu), the MMU becomes + * available. + * + * Based on this, we need to manually escape from the trap_handler after + * the jalr instruction is executed. + */ + if (!reloc_enable_mmu && reloc_enable_mmu_jalr_addr == 0xc00000b4) { + reloc_enable_mmu = true; + need_retranslate = true; + rv->is_trapped = false; + } + +#endif /* RV32_HAS(SYSTEM) */ + goto end_op; }, GEN({ @@ -294,45 +342,72 @@ RVOP( (type) x cond (type) y /* clang-format on */ -#define BRANCH_FUNC(type, cond) \ - IIF(RV32_HAS(EXT_C))(, const uint32_t pc = PC;); \ - if (BRANCH_COND(type, rv->X[ir->rs1], rv->X[ir->rs2], cond)) { \ - is_branch_taken = false; \ - struct rv_insn *untaken = ir->branch_untaken; \ - if (!untaken) \ - goto nextop; \ - IIF(RV32_HAS(JIT)) \ - ( \ - { \ - cache_get(rv->block_cache, PC + 4, true); \ - if (!set_add(&pc_set, PC + 4)) \ - has_loops = true; \ - if (cache_hot(rv->block_cache, PC + 4)) \ - goto nextop; \ - }, ); \ - PC += 4; \ - last_pc = PC; \ - MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \ - } \ - is_branch_taken = true; \ - PC += ir->imm; \ - /* check instruction misaligned */ \ - IIF(RV32_HAS(EXT_C)) \ - (, RV_EXC_MISALIGN_HANDLER(pc, INSN, false, 0);); \ - struct rv_insn *taken = ir->branch_taken; \ - if (taken) { \ - IIF(RV32_HAS(JIT)) \ - ( \ - { \ - cache_get(rv->block_cache, PC, true); \ - if (!set_add(&pc_set, PC)) \ - has_loops = true; \ - if (cache_hot(rv->block_cache, PC)) \ - goto end_op; \ - }, ); \ - last_pc = PC; \ - MUST_TAIL return taken->impl(rv, taken, cycle, PC); \ - } \ +#define BRANCH_FUNC(type, cond) \ + IIF(RV32_HAS(EXT_C))(, const uint32_t pc = PC;); \ + if (BRANCH_COND(type, rv->X[ir->rs1], rv->X[ir->rs2], cond)) { \ + IIF(RV32_HAS(SYSTEM)) \ + ( \ + { \ + if (!rv->is_trapped) { \ + is_branch_taken = false; \ + } \ + }, \ + is_branch_taken = false;); \ + struct rv_insn *untaken = ir->branch_untaken; \ + if (!untaken) \ + goto nextop; \ + IIF(RV32_HAS(JIT)) \ + ( \ + { \ + cache_get(rv->block_cache, PC + 4, true); \ + if (!set_add(&pc_set, PC + 4)) \ + has_loops = true; \ + if (cache_hot(rv->block_cache, PC + 4)) \ + goto nextop; \ + }, ); \ + PC += 4; \ + IIF(RV32_HAS(SYSTEM)) \ + ( \ + { \ + if (!rv->is_trapped) { \ + last_pc = PC; \ + MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \ + } \ + }, ); \ + goto end_op; \ + } \ + IIF(RV32_HAS(SYSTEM)) \ + ( \ + { \ + if (!rv->is_trapped) { \ + is_branch_taken = true; \ + } \ + }, \ + is_branch_taken = true;); \ + PC += ir->imm; \ + /* check instruction misaligned */ \ + IIF(RV32_HAS(EXT_C)) \ + (, RV_EXC_MISALIGN_HANDLER(pc, INSN, false, 0);); \ + struct rv_insn *taken = ir->branch_taken; \ + if (taken) { \ + IIF(RV32_HAS(JIT)) \ + ( \ + { \ + cache_get(rv->block_cache, PC, true); \ + if (!set_add(&pc_set, PC)) \ + has_loops = true; \ + if (cache_hot(rv->block_cache, PC)) \ + goto end_op; \ + }, ); \ + IIF(RV32_HAS(SYSTEM)) \ + ( \ + { \ + if (!rv->is_trapped) { \ + last_pc = PC; \ + MUST_TAIL return taken->impl(rv, taken, cycle, PC); \ + } \ + }, ); \ + } \ goto end_op; /* In RV32I and RV64I, if the branch is taken, set pc = pc + offset, where @@ -512,8 +587,8 @@ RVOP( RVOP( lb, { - rv->X[ir->rd] = - sign_extend_b(rv->io.mem_read_b(rv, rv->X[ir->rs1] + ir->imm)); + uint32_t addr = rv->X[ir->rs1] + ir->imm; + rv->X[ir->rd] = sign_extend_b(rv->io.mem_read_b(rv, addr)); }, GEN({ mem; @@ -561,7 +636,10 @@ RVOP( /* LBU: Load Byte Unsigned */ RVOP( lbu, - { rv->X[ir->rd] = rv->io.mem_read_b(rv, rv->X[ir->rs1] + ir->imm); }, + { + uint32_t addr = rv->X[ir->rs1] + ir->imm; + rv->X[ir->rd] = rv->io.mem_read_b(rv, addr); + }, GEN({ mem; rald, VR0, rs1; @@ -597,7 +675,10 @@ RVOP( /* SB: Store Byte */ RVOP( sb, - { rv->io.mem_write_b(rv, rv->X[ir->rs1] + ir->imm, rv->X[ir->rs2]); }, + { + const uint32_t addr = rv->X[ir->rs1] + ir->imm; + rv->io.mem_write_b(rv, addr, rv->X[ir->rs2]); + }, GEN({ mem; rald, VR0, rs1; @@ -1023,6 +1104,7 @@ RVOP( rv->csr_sstatus |= SSTATUS_SPIE; rv->PC = rv->csr_sepc; + return true; }, GEN({ @@ -2003,8 +2085,14 @@ RVOP( if (cache_hot(rv->block_cache, PC)) goto end_op; #endif - last_pc = PC; - MUST_TAIL return taken->impl(rv, taken, cycle, PC); + +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + last_pc = PC; + MUST_TAIL return taken->impl(rv, taken, cycle, PC); + } } goto end_op; }, @@ -2164,8 +2252,13 @@ RVOP( if (cache_hot(rv->block_cache, PC)) goto end_op; #endif - last_pc = PC; - MUST_TAIL return taken->impl(rv, taken, cycle, PC); +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + last_pc = PC; + MUST_TAIL return taken->impl(rv, taken, cycle, PC); + } } goto end_op; }, @@ -2198,8 +2291,15 @@ RVOP( goto nextop; #endif PC += 2; - last_pc = PC; - MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + last_pc = PC; + MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); + } + + goto end_op; } is_branch_taken = true; PC += ir->imm; @@ -2212,8 +2312,13 @@ RVOP( if (cache_hot(rv->block_cache, PC)) goto end_op; #endif - last_pc = PC; - MUST_TAIL return taken->impl(rv, taken, cycle, PC); +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + last_pc = PC; + MUST_TAIL return taken->impl(rv, taken, cycle, PC); + } } goto end_op; }, @@ -2255,8 +2360,15 @@ RVOP( goto nextop; #endif PC += 2; - last_pc = PC; - MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + last_pc = PC; + MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); + } + + goto end_op; } is_branch_taken = true; PC += ir->imm; @@ -2269,8 +2381,13 @@ RVOP( if (cache_hot(rv->block_cache, PC)) goto end_op; #endif - last_pc = PC; - MUST_TAIL return taken->impl(rv, taken, cycle, PC); +#if RV32_HAS(SYSTEM) + if (!rv->is_trapped) +#endif + { + last_pc = PC; + MUST_TAIL return taken->impl(rv, taken, cycle, PC); + } } goto end_op; }, diff --git a/src/system.c b/src/system.c index b2ce11d4..62ecbc11 100644 --- a/src/system.c +++ b/src/system.c @@ -7,8 +7,103 @@ #error "Do not manage to build this file unless you enable system support." #endif +#include + +#include "devices/plic.h" +#include "devices/uart.h" #include "riscv_private.h" +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) +void emu_update_uart_interrupts(riscv_t *rv) +{ + vm_attr_t *attr = PRIV(rv); + u8250_update_interrupts(attr->uart); + if (attr->uart->pending_intrs) + attr->plic->active |= IRQ_UART_BIT; + else + attr->plic->active &= ~IRQ_UART_BIT; + plic_update_interrupts(attr->plic); +} + +#define MMIO_R 1 +#define MMIO_W 0 + +enum SUPPORTED_MMIO { + MMIO_PLIC, + MMIO_UART, +}; + +/* clang-format off */ +#define MMIO_OP(io, rw) \ + switch(io){ \ + case MMIO_PLIC: \ + IIF(rw)( /* read */ \ + mmio_read_val = plic_read(PRIV(rv)->plic, addr & 0x3FFFFFF); \ + plic_update_interrupts(PRIV(rv)->plic); \ + return mmio_read_val; \ + , /* write */ \ + plic_write(PRIV(rv)->plic, addr & 0x3FFFFFF, val); \ + plic_update_interrupts(PRIV(rv)->plic); \ + return; \ + ) \ + break; \ + case MMIO_UART: \ + IIF(rw)( /* read */ \ + mmio_read_val = u8250_read(PRIV(rv)->uart, addr & 0xFFFFF); \ + emu_update_uart_interrupts(rv); \ + return mmio_read_val; \ + , /* write */ \ + u8250_write(PRIV(rv)->uart, addr & 0xFFFFF, val); \ + emu_update_uart_interrupts(rv); \ + return; \ + ) \ + break; \ + default: \ + fprintf(stderr, "unknown MMIO type %d\n", io); \ + break; \ + } +/* clang-format on */ + +#define MMIO_READ() \ + do { \ + uint32_t mmio_read_val; \ + if ((addr >> 28) == 0xF) { /* MMIO at 0xF_______ */ \ + /* 256 regions of 1MiB */ \ + switch ((addr >> 20) & MASK(8)) { \ + case 0x0: \ + case 0x2: /* PLIC (0 - 0x3F) */ \ + MMIO_OP(MMIO_PLIC, MMIO_R); \ + break; \ + case 0x40: /* UART */ \ + MMIO_OP(MMIO_UART, MMIO_R); \ + break; \ + default: \ + __UNREACHABLE; \ + break; \ + } \ + } \ + } while (0) + +#define MMIO_WRITE() \ + do { \ + if ((addr >> 28) == 0xF) { /* MMIO at 0xF_______ */ \ + /* 256 regions of 1MiB */ \ + switch ((addr >> 20) & MASK(8)) { \ + case 0x0: \ + case 0x2: /* PLIC (0 - 0x3F) */ \ + MMIO_OP(MMIO_PLIC, MMIO_W); \ + break; \ + case 0x40: /* UART */ \ + MMIO_OP(MMIO_UART, MMIO_W); \ + break; \ + default: \ + __UNREACHABLE; \ + break; \ + } \ + } \ + } while (0) +#endif + static bool ppn_is_valid(riscv_t *rv, uint32_t ppn) { vm_attr_t *attr = PRIV(rv); @@ -42,7 +137,7 @@ static uint32_t *mmu_walk(riscv_t *rv, const uint32_t addr, uint32_t *level) *level = 2 - i; uint32_t vpn = (addr >> RV_PG_SHIFT >> (i * (RV_PG_SHIFT - 2))) & MASK(10); - uint32_t *pte = page_table + vpn; + pte_t *pte = page_table + vpn; uint8_t XWRV_bit = (*pte & MASK(4)); switch (XWRV_bit) { @@ -83,65 +178,65 @@ static uint32_t *mmu_walk(riscv_t *rv, const uint32_t addr, uint32_t *level) /* FIXME: handle access fault, addr out of range check */ #define MMU_FAULT_CHECK(op, rv, pte, addr, access_bits) \ mmu_##op##_fault_check(rv, pte, addr, access_bits) -#define MMU_FAULT_CHECK_IMPL(op, pgfault) \ - static bool mmu_##op##_fault_check(riscv_t *rv, uint32_t *pte, \ - uint32_t addr, uint32_t access_bits) \ - { \ - uint32_t scause; \ - uint32_t stval = addr; \ - switch (access_bits) { \ - case PTE_R: \ - scause = PAGEFAULT_LOAD; \ - break; \ - case PTE_W: \ - scause = PAGEFAULT_STORE; \ - break; \ - case PTE_X: \ - scause = PAGEFAULT_INSN; \ - break; \ - default: \ - __UNREACHABLE; \ - break; \ - } \ - if (pte && (!(*pte & PTE_V))) { \ - SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ - return false; \ - } \ - if (!(pte && (*pte & access_bits))) { \ - SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ - return false; \ - } \ - /* \ - * (1) When MXR=0, only loads from pages marked readable (R=1) will \ - * succeed. \ - * \ - * (2) When MXR=1, loads from pages marked either readable or \ - * executable (R=1 or X=1) will succeed. \ - */ \ - if (pte && ((!(SSTATUS_MXR & rv->csr_sstatus) && !(*pte & PTE_R) && \ - (access_bits == PTE_R)) || \ - ((SSTATUS_MXR & rv->csr_sstatus) && \ - !((*pte & PTE_R) | (*pte & PTE_X)) && \ - (access_bits == PTE_R)))) { \ - SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ - return false; \ - } \ - /* \ - * When SUM=0, S-mode memory accesses to pages that are accessible by \ - * U-mode will fault. \ - */ \ - if (pte && rv->priv_mode == RV_PRIV_S_MODE && \ - !(SSTATUS_SUM & rv->csr_sstatus) && (*pte & PTE_U)) { \ - SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ - return false; \ - } \ - /* PTE not found, map it in handler */ \ - if (!pte) { \ - SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ - return false; \ - } \ - /* valid PTE */ \ - return true; \ +#define MMU_FAULT_CHECK_IMPL(op, pgfault) \ + static bool mmu_##op##_fault_check(riscv_t *rv, pte_t *pte, uint32_t addr, \ + uint32_t access_bits) \ + { \ + uint32_t scause; \ + uint32_t stval = addr; \ + switch (access_bits) { \ + case PTE_R: \ + scause = PAGEFAULT_LOAD; \ + break; \ + case PTE_W: \ + scause = PAGEFAULT_STORE; \ + break; \ + case PTE_X: \ + scause = PAGEFAULT_INSN; \ + break; \ + default: \ + __UNREACHABLE; \ + break; \ + } \ + if (pte && (!(*pte & PTE_V))) { \ + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ + return false; \ + } \ + if (!(pte && (*pte & access_bits))) { \ + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ + return false; \ + } \ + /* \ + * (1) When MXR=0, only loads from pages marked readable (R=1) will \ + * succeed. \ + * \ + * (2) When MXR=1, loads from pages marked either readable or \ + * executable (R=1 or X=1) will succeed. \ + */ \ + if (pte && ((!(SSTATUS_MXR & rv->csr_sstatus) && !(*pte & PTE_R) && \ + (access_bits == PTE_R)) || \ + ((SSTATUS_MXR & rv->csr_sstatus) && \ + !((*pte & PTE_R) | (*pte & PTE_X)) && \ + (access_bits == PTE_R)))) { \ + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ + return false; \ + } \ + /* \ + * When SUM=0, S-mode memory accesses to pages that are accessible by \ + * U-mode will fault. \ + */ \ + if (pte && rv->priv_mode == RV_PRIV_S_MODE && \ + !(SSTATUS_SUM & rv->csr_sstatus) && (*pte & PTE_U)) { \ + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ + return false; \ + } \ + /* PTE not found, map it in handler */ \ + if (!pte) { \ + SET_CAUSE_AND_TVAL_THEN_TRAP(rv, scause, stval); \ + return false; \ + } \ + /* valid PTE */ \ + return true; \ } MMU_FAULT_CHECK_IMPL(ifetch, pagefault_insn) @@ -152,6 +247,7 @@ MMU_FAULT_CHECK_IMPL(write, pagefault_store) uint32_t ppn; \ uint32_t offset; \ do { \ + assert(pte); \ ppn = *pte >> (RV_PG_SHIFT - 2) << RV_PG_SHIFT; \ offset = level == 1 ? addr & MASK((RV_PG_SHIFT + 10)) \ : addr & MASK(RV_PG_SHIFT); \ @@ -173,17 +269,22 @@ MMU_FAULT_CHECK_IMPL(write, pagefault_store) * - mmu_write_s * - mmu_write_b */ +extern bool need_retranslate; static uint32_t mmu_ifetch(riscv_t *rv, const uint32_t addr) { if (!rv->csr_satp) return memory_ifetch(addr); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(ifetch, rv, pte, addr, PTE_X); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); + if (need_retranslate) { + return 0; + } + get_ppn_and_offset(); return memory_ifetch(ppn | offset); } @@ -194,13 +295,24 @@ static uint32_t mmu_read_w(riscv_t *rv, const uint32_t addr) return memory_read_w(addr); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(read, rv, pte, addr, PTE_R); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); - get_ppn_and_offset(); - return memory_read_w(ppn | offset); + { + get_ppn_and_offset(); + const uint32_t addr = ppn | offset; + const vm_attr_t *attr = PRIV(rv); + if (addr < attr->mem->mem_size) + return memory_read_w(addr); + +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + MMIO_READ(); +#endif + } + + __UNREACHABLE; } static uint16_t mmu_read_s(riscv_t *rv, const uint32_t addr) @@ -209,7 +321,7 @@ static uint16_t mmu_read_s(riscv_t *rv, const uint32_t addr) return memory_read_s(addr); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(read, rv, pte, addr, PTE_R); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); @@ -224,13 +336,24 @@ static uint8_t mmu_read_b(riscv_t *rv, const uint32_t addr) return memory_read_b(addr); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(read, rv, pte, addr, PTE_R); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); - get_ppn_and_offset(); - return memory_read_b(ppn | offset); + { + get_ppn_and_offset(); + const uint32_t addr = ppn | offset; + const vm_attr_t *attr = PRIV(rv); + if (addr < attr->mem->mem_size) + return memory_read_b(addr); + +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + MMIO_READ(); +#endif + } + + __UNREACHABLE; } static void mmu_write_w(riscv_t *rv, const uint32_t addr, const uint32_t val) @@ -239,13 +362,24 @@ static void mmu_write_w(riscv_t *rv, const uint32_t addr, const uint32_t val) return memory_write_w(addr, (uint8_t *) &val); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(write, rv, pte, addr, PTE_W); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); - get_ppn_and_offset(); - memory_write_w(ppn | offset, (uint8_t *) &val); + { + get_ppn_and_offset(); + const uint32_t addr = ppn | offset; + const vm_attr_t *attr = PRIV(rv); + if (addr < attr->mem->mem_size) { + memory_write_w(addr, (uint8_t *) &val); + return; + } + +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + MMIO_WRITE(); +#endif + } } static void mmu_write_s(riscv_t *rv, const uint32_t addr, const uint16_t val) @@ -254,7 +388,7 @@ static void mmu_write_s(riscv_t *rv, const uint32_t addr, const uint16_t val) return memory_write_s(addr, (uint8_t *) &val); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(write, rv, pte, addr, PTE_W); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); @@ -269,13 +403,24 @@ static void mmu_write_b(riscv_t *rv, const uint32_t addr, const uint8_t val) return memory_write_b(addr, (uint8_t *) &val); uint32_t level; - uint32_t *pte = mmu_walk(rv, addr, &level); + pte_t *pte = mmu_walk(rv, addr, &level); bool ok = MMU_FAULT_CHECK(write, rv, pte, addr, PTE_W); if (unlikely(!ok)) pte = mmu_walk(rv, addr, &level); - get_ppn_and_offset(); - memory_write_b(ppn | offset, (uint8_t *) &val); + { + get_ppn_and_offset(); + const uint32_t addr = ppn | offset; + const vm_attr_t *attr = PRIV(rv); + if (addr < attr->mem->mem_size) { + memory_write_b(addr, (uint8_t *) &val); + return; + } + +#if RV32_HAS(SYSTEM) && !RV32_HAS(ELF_LOADER) + MMIO_WRITE(); +#endif + } } riscv_io_t mmu_io = { diff --git a/tools/rv_histogram.c b/tools/rv_histogram.c index 4c946f83..4ae67490 100644 --- a/tools/rv_histogram.c +++ b/tools/rv_histogram.c @@ -302,7 +302,7 @@ int main(int argc, const char *args[]) used_col = get_used_col(); if (show_reg) { - qsort(rv_reg_stats, ARRAYS_SIZE(rv_reg_stats), sizeof(rv_hist_t), + qsort(rv_reg_stats, ARRAY_SIZE(rv_reg_stats), sizeof(rv_hist_t), ascending_order ? cmp_asc : cmp_dec); printf("+--------------------------------------+\n"); @@ -311,7 +311,7 @@ int main(int argc, const char *args[]) find_max_freq(rv_reg_stats, N_RV_REGS); print_hist_stats(rv_reg_stats, N_RV_REGS); } else { - qsort(rv_insn_stats, ARRAYS_SIZE(rv_insn_stats), sizeof(rv_hist_t), + qsort(rv_insn_stats, ARRAY_SIZE(rv_insn_stats), sizeof(rv_hist_t), ascending_order ? cmp_asc : cmp_dec); printf("+---------------------------------------------+\n"); From e701b40957ac97fac78234d6447a8553a7d3b2c9 Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Sun, 15 Dec 2024 00:10:39 +0800 Subject: [PATCH 2/5] Enable to build custom Linux image All Buildroot, BusyBox, and Linux configuration files are saved in the assets directory to allow someone to build on their own. The mk/external.mk functions has been updated to enable downloading via 'git clone' and verifying the downloaded files excluding the git-related files. The Linux kernel image and Buildroot version are controlled in mk/external.mk, when the LINUX_VERSION or BUILDROOT_VERSION changes, the new Linux kernel image and rootfs.cpio are built and pushed to the rv32emu-prebuilt repository, the user ELF executables and system image are identified by suffix 'ELF' and 'Linux-Image' at release of rv32emu-prebuilt repository. Additionally, a 'build-linux-image' make target has been introduced to simplify the cloning and automatic building process. --- .github/workflows/build-artifact.yml | 60 +- assets/system/configs/buildroot.config | 47 + assets/system/configs/busybox.config | 1218 +++++++++++++++ assets/system/configs/linux.config | 1806 +++++++++++++++++++++++ assets/wasm/html/index.html | 243 +++ assets/wasm/js/coi-serviceworker.min.js | 2 + assets/wasm/js/pre.js | 9 + mk/external.mk | 41 +- mk/tools.mk | 8 +- mk/wasm.mk | 2 +- tools/build-linux-image.sh | 55 + 11 files changed, 3479 insertions(+), 12 deletions(-) create mode 100644 assets/system/configs/buildroot.config create mode 100644 assets/system/configs/busybox.config create mode 100644 assets/system/configs/linux.config create mode 100644 assets/wasm/html/index.html create mode 100644 assets/wasm/js/coi-serviceworker.min.js create mode 100644 assets/wasm/js/pre.js create mode 100755 tools/build-linux-image.sh diff --git a/.github/workflows/build-artifact.yml b/.github/workflows/build-artifact.yml index 49fa6c15..770cdd65 100644 --- a/.github/workflows/build-artifact.yml +++ b/.github/workflows/build-artifact.yml @@ -27,6 +27,12 @@ jobs: tests/quake/** tests/scimark2/** tests/*.c + - name: Test file change of Linux image + id: test-linux-image-version-change + uses: tj-actions/changed-files@v45 + with: + files: | + mk/external.mk - name: Set alias id: has_changed_files run: | @@ -35,8 +41,60 @@ jobs: else echo "has_changed_files=false" >> $GITHUB_OUTPUT fi + if [[ ${{ steps.test-linux-image-version-change.outputs.any_modified }} == true ]]; then + # Determine if the changes are from Buildroot or the Linux version (The Linux might have several patches, so also need to check the SHA value) + echo -n $(git --no-pager diff HEAD^ HEAD | grep -e "+BUILDROOT_VERSION" -e "+LINUX_VERSION" -e "+LINUX_DATA_SHA1") >> linux-image-version-change + if [[ -s linux-image-version-change ]]; then + echo "has_changed_linux_image_version=true" >> $GITHUB_OUTPUT + else + echo "has_changed_linux_image_version=false" >> $GITHUB_OUTPUT + fi + else + echo "has_changed_linux_image_version=false" >> $GITHUB_OUTPUT + fi outputs: has_changed_files: ${{ steps.has_changed_files.outputs.has_changed_files }} + has_changed_linux_image_version: ${{ steps.has_changed_files.outputs.has_changed_linux_image_version }} + + build-linux-image-artifact: + needs: [detect-file-change] + if: ${{ needs.detect-file-change.outputs.has_changed_linux_image_version == 'true' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Install dependencies + run: | + sudo apt-get update -q -y + sudo apt-get upgrade -q -y + sudo apt-get install -q -y build-essential git + - name: Build Linux image + run: | + make build-linux-image + make artifact ENABLE_PREBUILT=0 ENABLE_SYSTEM=1 + mkdir -p /tmp/rv32emu-linux-image-prebuilt/linux-image + mv build/linux-image/Image /tmp/rv32emu-linux-image-prebuilt/linux-image + mv build/linux-image/rootfs.cpio /tmp/rv32emu-linux-image-prebuilt/linux-image + mv build/sha1sum-linux-image /tmp + - name: Create tarball + run: | + cd /tmp + tar -zcvf rv32emu-linux-image-prebuilt.tar.gz rv32emu-linux-image-prebuilt + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }} + run: | + RELEASE_TAG=$(date +'%Y.%m.%d'-Linux-Image) + cd /tmp + gh release create $RELEASE_TAG \ + --repo sysprog21/rv32emu-prebuilt \ + --title "$RELEASE_TAG""-nightly" + gh release upload $RELEASE_TAG \ + rv32emu-linux-image-prebuilt.tar.gz \ + sha1sum-linux-image \ + --repo sysprog21/rv32emu-prebuilt build-artifact: needs: [detect-file-change] @@ -83,7 +141,7 @@ jobs: env: GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }} run: | - RELEASE_TAG=$(date +'%Y.%m.%d') + RELEASE_TAG=$(date +'%Y.%m.%d'-ELF) cd /tmp gh release create $RELEASE_TAG \ --repo sysprog21/rv32emu-prebuilt \ diff --git a/assets/system/configs/buildroot.config b/assets/system/configs/buildroot.config new file mode 100644 index 00000000..df36a175 --- /dev/null +++ b/assets/system/configs/buildroot.config @@ -0,0 +1,47 @@ +BR2_riscv=y +BR2_ARCH="riscv32" +BR2_NORMALIZED_ARCH="riscv" +BR2_ENDIAN="LITTLE" +BR2_GCC_TARGET_ABI="ilp32" +BR2_READELF_ARCH_NAME="RISC-V" +BR2_RISCV_ISA_RVI=y +BR2_RISCV_ISA_RVM=y +BR2_RISCV_ISA_RVA=y +# BR2_riscv_g is not set +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +# BR2_RISCV_ISA_CUSTOM_RVF is not set +# BR2_RISCV_ISA_CUSTOM_RVC is not set +BR2_RISCV_32=y +# BR2_RISCV_64 is not set +BR2_RISCV_ABI_ILP32=y +BR2_BINFMT_ELF=y +BR2_TOOLCHAIN_BUILDROOT_VENDOR="buildroot" +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y +BR2_TOOLCHAIN_BUILDROOT_LIBC="glibc" +# BR2_TOOLCHAIN_BUILDROOT_CXX is not set +BR2_KERNEL_HEADERS_6_1=y +BR2_BINUTILS_VERSION_2_42_X=y +# BR2_BINUTILS_GPROFNG is not set +BR2_GCC_VERSION_14_X=y +BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-softfloat" +BR2_TOOLCHAIN_HEADERS_AT_LEAST="6.1" +BR2_TOOLCHAIN_GCC_AT_LEAST_14=y +BR2_TOOLCHAIN_GCC_AT_LEAST="14" +BR2_SSP_NONE=y +# BR2_SSP_REGULAR is not set +# BR2_SSP_STRONG is not set +BR2_RELRO_NONE=y +# BR2_RELRO_PARTIAL is not set +# BR2_RELRO_FULL is not set +BR2_FORTIFY_SOURCE_1=y +# BR2_PACKAGE_URANDOM_SCRIPTS is not set +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_FULL=y +# BR2_TARGET_ROOTFS_CPIO_DRACUT is not set +BR2_TARGET_ROOTFS_CPIO_NONE=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_PACKAGE_BUSYBOX_CONFIG="busybox.config" +BR2_PACKAGE_COREMARK=y +BR2_PACKAGE_DHRYSTONE=y diff --git a/assets/system/configs/busybox.config b/assets/system/configs/busybox.config new file mode 100644 index 00000000..bf7958d0 --- /dev/null +++ b/assets/system/configs/busybox.config @@ -0,0 +1,1218 @@ +CONFIG_HAVE_DOT_CONFIG=y + +# +# Settings +# +CONFIG_DESKTOP=y +# CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEDORA_COMPAT is not set +# CONFIG_INCLUDE_SUSv2 is not set +CONFIG_LONG_OPTS=y +CONFIG_SHOW_USAGE=y +CONFIG_FEATURE_VERBOSE_USAGE=y +# CONFIG_FEATURE_COMPRESS_USAGE is not set +CONFIG_LFS=y +# CONFIG_PAM is not set +CONFIG_FEATURE_DEVPTS=y +CONFIG_FEATURE_UTMP=y +CONFIG_FEATURE_WTMP=y +# CONFIG_FEATURE_PIDFILE is not set +CONFIG_PID_FILE_PATH="" +CONFIG_BUSYBOX=y +CONFIG_FEATURE_SHOW_SCRIPT=y +CONFIG_FEATURE_INSTALLER=y +# CONFIG_INSTALL_NO_USR is not set +CONFIG_FEATURE_SUID=y +# CONFIG_FEATURE_SUID_CONFIG is not set +# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set +# CONFIG_FEATURE_PREFER_APPLETS is not set +CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_CLEAN_UP is not set +CONFIG_FEATURE_SYSLOG_INFO=y +CONFIG_FEATURE_SYSLOG=y + +# +# Build Options +# +# CONFIG_STATIC is not set +# CONFIG_PIE is not set +# CONFIG_NOMMU is not set +# CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set +# CONFIG_FEATURE_INDIVIDUAL is not set +# CONFIG_FEATURE_SHARED_BUSYBOX is not set +CONFIG_CROSS_COMPILER_PREFIX="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_CFLAGS="" +CONFIG_EXTRA_LDFLAGS="" +CONFIG_EXTRA_LDLIBS="" +# CONFIG_USE_PORTABLE_CODE is not set +# CONFIG_STACK_OPTIMIZATION_386 is not set +CONFIG_STATIC_LIBGCC=y + +# +# Installation Options ("make install" behavior) +# +CONFIG_INSTALL_APPLET_SYMLINKS=y +# CONFIG_INSTALL_APPLET_HARDLINKS is not set +# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set +# CONFIG_INSTALL_APPLET_DONT is not set +# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set +# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set +# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set +CONFIG_PREFIX="./_install" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +# CONFIG_WARN_SIMPLE_MSG is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Library Tuning +# +# CONFIG_FEATURE_USE_BSS_TAIL is not set +CONFIG_FLOAT_DURATION=y +CONFIG_FEATURE_RTMINMAX=y +CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_PASSWORD_MINLEN=6 +CONFIG_MD5_SMALL=1 +CONFIG_SHA1_SMALL=3 +CONFIG_SHA1_HWACCEL=y +CONFIG_SHA256_HWACCEL=y +CONFIG_SHA3_SMALL=1 +CONFIG_FEATURE_NON_POSIX_CP=y +# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set +CONFIG_FEATURE_USE_SENDFILE=y +CONFIG_FEATURE_COPYBUF_KB=4 +CONFIG_MONOTONIC_SYSCALL=y +CONFIG_IOCTL_HEX2STR_ERROR=y +CONFIG_FEATURE_EDITING=y +CONFIG_FEATURE_EDITING_MAX_LEN=1024 +CONFIG_FEATURE_EDITING_VI=y +CONFIG_FEATURE_EDITING_HISTORY=999 +CONFIG_FEATURE_EDITING_SAVEHISTORY=y +# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set +CONFIG_FEATURE_REVERSE_SEARCH=y +CONFIG_FEATURE_TAB_COMPLETION=y +# CONFIG_FEATURE_USERNAME_COMPLETION is not set +CONFIG_FEATURE_EDITING_FANCY_PROMPT=y +CONFIG_FEATURE_EDITING_WINCH=y +# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +# CONFIG_LOCALE_SUPPORT is not set +# CONFIG_UNICODE_SUPPORT is not set +# CONFIG_UNICODE_USING_LOCALE is not set +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=0 +CONFIG_LAST_SUPPORTED_WCHAR=0 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set +# CONFIG_LOOP_CONFIGURE is not set +# CONFIG_NO_LOOP_CONFIGURE is not set +CONFIG_TRY_LOOP_CONFIGURE=y + +# +# Applets +# + +# +# Archival Utilities +# +# CONFIG_FEATURE_SEAMLESS_XZ is not set +# CONFIG_FEATURE_SEAMLESS_LZMA is not set +# CONFIG_FEATURE_SEAMLESS_BZ2 is not set +# CONFIG_FEATURE_SEAMLESS_GZ is not set +# CONFIG_FEATURE_SEAMLESS_Z is not set +CONFIG_AR=y +# CONFIG_FEATURE_AR_LONG_FILENAMES is not set +CONFIG_FEATURE_AR_CREATE=y +# CONFIG_UNCOMPRESS is not set +CONFIG_GUNZIP=y +CONFIG_ZCAT=y +CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y +CONFIG_BUNZIP2=y +CONFIG_BZCAT=y +CONFIG_UNLZMA=y +CONFIG_LZCAT=y +CONFIG_LZMA=y +CONFIG_UNXZ=y +CONFIG_XZCAT=y +CONFIG_XZ=y +# CONFIG_BZIP2 is not set +CONFIG_BZIP2_SMALL=0 +CONFIG_FEATURE_BZIP2_DECOMPRESS=y +CONFIG_CPIO=y +# CONFIG_FEATURE_CPIO_O is not set +# CONFIG_FEATURE_CPIO_P is not set +# CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set +# CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +CONFIG_GZIP=y +# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set +CONFIG_GZIP_FAST=0 +# CONFIG_FEATURE_GZIP_LEVELS is not set +CONFIG_FEATURE_GZIP_DECOMPRESS=y +# CONFIG_LZOP is not set +CONFIG_UNLZOP=y +CONFIG_LZOPCAT=y +# CONFIG_LZOP_COMPR_HIGH is not set +# CONFIG_RPM is not set +# CONFIG_RPM2CPIO is not set +CONFIG_TAR=y +CONFIG_FEATURE_TAR_LONG_OPTIONS=y +CONFIG_FEATURE_TAR_CREATE=y +# CONFIG_FEATURE_TAR_AUTODETECT is not set +CONFIG_FEATURE_TAR_FROM=y +# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set +# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +CONFIG_FEATURE_TAR_TO_COMMAND=y +# CONFIG_FEATURE_TAR_UNAME_GNAME is not set +# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set +# CONFIG_FEATURE_TAR_SELINUX is not set +CONFIG_UNZIP=y +CONFIG_FEATURE_UNZIP_CDF=y +CONFIG_FEATURE_UNZIP_BZIP2=y +CONFIG_FEATURE_UNZIP_LZMA=y +CONFIG_FEATURE_UNZIP_XZ=y +# CONFIG_FEATURE_LZMA_FAST is not set + +# +# Coreutils +# +CONFIG_FEATURE_VERBOSE=y + +# +# Common options for date and touch +# +CONFIG_FEATURE_TIMEZONE=y + +# +# Common options for cp and mv +# +CONFIG_FEATURE_PRESERVE_HARDLINKS=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y +CONFIG_BASENAME=y +CONFIG_CAT=y +CONFIG_FEATURE_CATN=y +CONFIG_FEATURE_CATV=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set +CONFIG_CHROOT=y +CONFIG_CKSUM=y +CONFIG_CRC32=y +# CONFIG_COMM is not set +CONFIG_CP=y +# CONFIG_FEATURE_CP_LONG_OPTIONS is not set +# CONFIG_FEATURE_CP_REFLINK is not set +CONFIG_CUT=y +CONFIG_FEATURE_CUT_REGEX=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +# CONFIG_FEATURE_DATE_NANO is not set +CONFIG_FEATURE_DATE_COMPAT=y +CONFIG_DD=y +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y +# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set +CONFIG_FEATURE_DD_IBS_OBS=y +CONFIG_FEATURE_DD_STATUS=y +CONFIG_DF=y +# CONFIG_FEATURE_DF_FANCY is not set +CONFIG_FEATURE_SKIP_ROOTFS=y +CONFIG_DIRNAME=y +CONFIG_DOS2UNIX=y +CONFIG_UNIX2DOS=y +CONFIG_DU=y +CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +# CONFIG_EXPAND is not set +# CONFIG_UNEXPAND is not set +CONFIG_EXPR=y +CONFIG_EXPR_MATH_SUPPORT_64=y +# CONFIG_FACTOR is not set +CONFIG_FALSE=y +# CONFIG_FOLD is not set +CONFIG_HEAD=y +CONFIG_FEATURE_FANCY_HEAD=y +CONFIG_HOSTID=y +CONFIG_ID=y +# CONFIG_GROUPS is not set +CONFIG_INSTALL=y +CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y +CONFIG_LINK=y +CONFIG_LN=y +CONFIG_LOGNAME=y +CONFIG_LS=y +CONFIG_FEATURE_LS_FILETYPES=y +CONFIG_FEATURE_LS_FOLLOWLINKS=y +CONFIG_FEATURE_LS_RECURSIVE=y +CONFIG_FEATURE_LS_WIDTH=y +CONFIG_FEATURE_LS_SORTFILES=y +CONFIG_FEATURE_LS_TIMESTAMPS=y +CONFIG_FEATURE_LS_USERNAME=y +CONFIG_FEATURE_LS_COLOR=y +CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y +CONFIG_MD5SUM=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +# CONFIG_SHA512SUM is not set +# CONFIG_SHA3SUM is not set + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y +CONFIG_MKDIR=y +CONFIG_MKFIFO=y +CONFIG_MKNOD=y +CONFIG_MKTEMP=y +CONFIG_MV=y +CONFIG_NICE=y +# CONFIG_NL is not set +CONFIG_NOHUP=y +CONFIG_NPROC=y +# CONFIG_OD is not set +# CONFIG_PASTE is not set +CONFIG_PRINTENV=y +CONFIG_PRINTF=y +CONFIG_PWD=y +CONFIG_READLINK=y +CONFIG_FEATURE_READLINK_FOLLOW=y +CONFIG_REALPATH=y +CONFIG_RM=y +CONFIG_RMDIR=y +CONFIG_SEQ=y +CONFIG_SHRED=y +# CONFIG_SHUF is not set +CONFIG_SLEEP=y +CONFIG_FEATURE_FANCY_SLEEP=y +CONFIG_SORT=y +# CONFIG_FEATURE_SORT_BIG is not set +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set +# CONFIG_SPLIT is not set +# CONFIG_FEATURE_SPLIT_FANCY is not set +# CONFIG_STAT is not set +# CONFIG_FEATURE_STAT_FORMAT is not set +# CONFIG_FEATURE_STAT_FILESYSTEM is not set +CONFIG_STTY=y +# CONFIG_SUM is not set +CONFIG_SYNC=y +# CONFIG_FEATURE_SYNC_FANCY is not set +# CONFIG_FSYNC is not set +# CONFIG_TAC is not set +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y +CONFIG_TEE=y +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TEST=y +CONFIG_TEST1=y +CONFIG_TEST2=y +CONFIG_FEATURE_TEST_64=y +# CONFIG_TIMEOUT is not set +CONFIG_TOUCH=y +CONFIG_FEATURE_TOUCH_SUSV3=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y +CONFIG_TRUE=y +CONFIG_TRUNCATE=y +# CONFIG_TSORT is not set +CONFIG_TTY=y +CONFIG_UNAME=y +CONFIG_UNAME_OSNAME="GNU/Linux" +CONFIG_BB_ARCH=y +CONFIG_UNIQ=y +CONFIG_UNLINK=y +CONFIG_USLEEP=y +# CONFIG_UUDECODE is not set +# CONFIG_BASE32 is not set +CONFIG_BASE64=y +# CONFIG_UUENCODE is not set +CONFIG_WC=y +# CONFIG_FEATURE_WC_LARGE is not set +CONFIG_WHO=y +CONFIG_W=y +# CONFIG_USERS is not set +CONFIG_WHOAMI=y +CONFIG_YES=y + +# +# Console Utilities +# +CONFIG_CHVT=y +CONFIG_CLEAR=y +CONFIG_DEALLOCVT=y +# CONFIG_DUMPKMAP is not set +# CONFIG_FGCONSOLE is not set +# CONFIG_KBD_MODE is not set +# CONFIG_LOADFONT is not set +# CONFIG_SETFONT is not set +# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set +CONFIG_DEFAULT_SETFONT_DIR="" +# CONFIG_FEATURE_LOADFONT_PSF2 is not set +# CONFIG_FEATURE_LOADFONT_RAW is not set +# CONFIG_LOADKMAP is not set +CONFIG_OPENVT=y +CONFIG_RESET=y +CONFIG_RESIZE=y +CONFIG_FEATURE_RESIZE_PRINT=y +CONFIG_SETCONSOLE=y +# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set +# CONFIG_SETKEYCODES is not set +# CONFIG_SETLOGCONS is not set +# CONFIG_SHOWKEY is not set + +# +# Debian Utilities +# +CONFIG_PIPE_PROGRESS=y +CONFIG_RUN_PARTS=y +CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y +# CONFIG_FEATURE_RUN_PARTS_FANCY is not set +CONFIG_START_STOP_DAEMON=y +CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y +CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y +CONFIG_WHICH=y + +# +# klibc-utils +# +# CONFIG_MINIPS is not set +# CONFIG_NUKE is not set +# CONFIG_RESUME is not set +CONFIG_RUN_INIT=y + +# +# Editors +# +CONFIG_AWK=y +# CONFIG_FEATURE_AWK_LIBM is not set +CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y +CONFIG_CMP=y +CONFIG_DIFF=y +# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set +CONFIG_FEATURE_DIFF_DIR=y +# CONFIG_ED is not set +# CONFIG_PATCH is not set +CONFIG_SED=y +CONFIG_VI=y +CONFIG_FEATURE_VI_MAX_LEN=4096 +CONFIG_FEATURE_VI_8BIT=y +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_COLON_EXPAND=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_SEARCH=y +# CONFIG_FEATURE_VI_REGEX_SEARCH is not set +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_ASK_TERMINAL=y +CONFIG_FEATURE_VI_UNDO=y +CONFIG_FEATURE_VI_UNDO_QUEUE=y +CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256 +CONFIG_FEATURE_VI_VERBOSE_STATUS=y +CONFIG_FEATURE_ALLOW_EXEC=y + +# +# Finding Utilities +# +CONFIG_FIND=y +CONFIG_FEATURE_FIND_PRINT0=y +CONFIG_FEATURE_FIND_MTIME=y +CONFIG_FEATURE_FIND_ATIME=y +CONFIG_FEATURE_FIND_CTIME=y +CONFIG_FEATURE_FIND_MMIN=y +CONFIG_FEATURE_FIND_AMIN=y +CONFIG_FEATURE_FIND_CMIN=y +CONFIG_FEATURE_FIND_PERM=y +CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_EXECUTABLE=y +CONFIG_FEATURE_FIND_XDEV=y +CONFIG_FEATURE_FIND_MAXDEPTH=y +CONFIG_FEATURE_FIND_NEWER=y +# CONFIG_FEATURE_FIND_INUM is not set +CONFIG_FEATURE_FIND_SAMEFILE=y +CONFIG_FEATURE_FIND_EXEC=y +CONFIG_FEATURE_FIND_EXEC_PLUS=y +CONFIG_FEATURE_FIND_USER=y +CONFIG_FEATURE_FIND_GROUP=y +CONFIG_FEATURE_FIND_NOT=y +CONFIG_FEATURE_FIND_DEPTH=y +CONFIG_FEATURE_FIND_PAREN=y +CONFIG_FEATURE_FIND_SIZE=y +CONFIG_FEATURE_FIND_PRUNE=y +CONFIG_FEATURE_FIND_QUIT=y +# CONFIG_FEATURE_FIND_DELETE is not set +CONFIG_FEATURE_FIND_EMPTY=y +CONFIG_FEATURE_FIND_PATH=y +CONFIG_FEATURE_FIND_REGEX=y +# CONFIG_FEATURE_FIND_CONTEXT is not set +# CONFIG_FEATURE_FIND_LINKS is not set +CONFIG_GREP=y +CONFIG_EGREP=y +CONFIG_FGREP=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y +# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y +CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y +CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y + +# +# Init Utilities +# +# CONFIG_BOOTCHARTD is not set +# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set +# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set +CONFIG_HALT=y +CONFIG_POWEROFF=y +CONFIG_REBOOT=y +CONFIG_FEATURE_WAIT_FOR_INIT=y +# CONFIG_FEATURE_CALL_TELINIT is not set +CONFIG_TELINIT_PATH="" +CONFIG_INIT=y +CONFIG_LINUXRC=y +CONFIG_FEATURE_USE_INITTAB=y +CONFIG_FEATURE_KILL_REMOVED=y +CONFIG_FEATURE_KILL_DELAY=0 +CONFIG_FEATURE_INIT_SCTTY=y +CONFIG_FEATURE_INIT_SYSLOG=y +CONFIG_FEATURE_INIT_QUIET=y +# CONFIG_FEATURE_INIT_COREDUMPS is not set +CONFIG_INIT_TERMINAL_TYPE="linux" +CONFIG_FEATURE_INIT_MODIFY_CMDLINE=y + +# +# Login/Password Management Utilities +# +CONFIG_FEATURE_SHADOWPASSWDS=y +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_USE_BB_SHADOW is not set +CONFIG_USE_BB_CRYPT=y +CONFIG_USE_BB_CRYPT_SHA=y +# CONFIG_ADD_SHELL is not set +# CONFIG_REMOVE_SHELL is not set +CONFIG_ADDGROUP=y +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set +CONFIG_ADDUSER=y +# CONFIG_FEATURE_CHECK_NAMES is not set +CONFIG_LAST_ID=60000 +CONFIG_FIRST_SYSTEM_ID=100 +CONFIG_LAST_SYSTEM_ID=999 +# CONFIG_CHPASSWD is not set +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="md5" +# CONFIG_CRYPTPW is not set +CONFIG_MKPASSWD=y +CONFIG_DELUSER=y +CONFIG_DELGROUP=y +# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set +CONFIG_GETTY=y +CONFIG_LOGIN=y +# CONFIG_LOGIN_SESSION_AS_CHILD is not set +# CONFIG_LOGIN_SCRIPTS is not set +CONFIG_FEATURE_NOLOGIN=y +CONFIG_FEATURE_SECURETTY=y +CONFIG_PASSWD=y +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y +CONFIG_SU=y +CONFIG_FEATURE_SU_SYSLOG=y +CONFIG_FEATURE_SU_CHECKS_SHELLS=y +# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set +CONFIG_SULOGIN=y +# CONFIG_VLOCK is not set + +# +# Linux Ext2 FS Progs +# +CONFIG_CHATTR=y +CONFIG_FSCK=y +CONFIG_LSATTR=y +# CONFIG_TUNE2FS is not set + +# +# Linux Module Utilities +# +# CONFIG_MODPROBE_SMALL is not set +# CONFIG_DEPMOD is not set +CONFIG_INSMOD=y +CONFIG_LSMOD=y +CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y +# CONFIG_MODINFO is not set +CONFIG_MODPROBE=y +# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set +CONFIG_RMMOD=y + +# +# Options common to multiple modutils +# +CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS=y +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +# CONFIG_FEATURE_2_4_MODULES is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set +CONFIG_FEATURE_CHECK_TAINTED_MODULE=y +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set +CONFIG_FEATURE_MODUTILS_ALIAS=y +CONFIG_FEATURE_MODUTILS_SYMBOLS=y +CONFIG_DEFAULT_MODULES_DIR="/lib/modules" +CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" + +# +# Linux System Utilities +# +# CONFIG_ACPID is not set +# CONFIG_FEATURE_ACPID_COMPAT is not set +# CONFIG_BLKDISCARD is not set +CONFIG_BLKID=y +# CONFIG_FEATURE_BLKID_TYPE is not set +# CONFIG_BLOCKDEV is not set +# CONFIG_CAL is not set +CONFIG_CHRT=y +CONFIG_DMESG=y +CONFIG_FEATURE_DMESG_PRETTY=y +# CONFIG_EJECT is not set +# CONFIG_FEATURE_EJECT_SCSI is not set +# CONFIG_FALLOCATE is not set +# CONFIG_FATATTR is not set +CONFIG_FBSET=y +CONFIG_FEATURE_FBSET_FANCY=y +CONFIG_FEATURE_FBSET_READMODE=y +# CONFIG_FDFORMAT is not set +CONFIG_FDISK=y +# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set +CONFIG_FEATURE_FDISK_WRITABLE=y +# CONFIG_FEATURE_AIX_LABEL is not set +# CONFIG_FEATURE_SGI_LABEL is not set +# CONFIG_FEATURE_SUN_LABEL is not set +# CONFIG_FEATURE_OSF_LABEL is not set +CONFIG_FEATURE_GPT_LABEL=y +CONFIG_FEATURE_FDISK_ADVANCED=y +# CONFIG_FINDFS is not set +CONFIG_FLOCK=y +CONFIG_FDFLUSH=y +CONFIG_FREERAMDISK=y +# CONFIG_FSCK_MINIX is not set +CONFIG_FSFREEZE=y +CONFIG_FSTRIM=y +CONFIG_GETOPT=y +CONFIG_FEATURE_GETOPT_LONG=y +CONFIG_HEXDUMP=y +# CONFIG_HD is not set +CONFIG_XXD=y +# CONFIG_HWCLOCK is not set +# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +# CONFIG_IONICE is not set +# CONFIG_IPCRM is not set +# CONFIG_IPCS is not set +CONFIG_LAST=y +# CONFIG_FEATURE_LAST_FANCY is not set +CONFIG_LOSETUP=y +CONFIG_LSPCI=y +CONFIG_LSUSB=y +CONFIG_MDEV=y +CONFIG_FEATURE_MDEV_CONF=y +CONFIG_FEATURE_MDEV_RENAME=y +# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set +CONFIG_FEATURE_MDEV_EXEC=y +# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set +CONFIG_FEATURE_MDEV_DAEMON=y +# CONFIG_MESG is not set +# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set +CONFIG_MKE2FS=y +# CONFIG_MKFS_EXT2 is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_FEATURE_MINIX2 is not set +# CONFIG_MKFS_REISER is not set +CONFIG_MKDOSFS=y +# CONFIG_MKFS_VFAT is not set +# CONFIG_MKSWAP is not set +# CONFIG_FEATURE_MKSWAP_UUID is not set +CONFIG_MORE=y +CONFIG_MOUNT=y +# CONFIG_FEATURE_MOUNT_FAKE is not set +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +# CONFIG_FEATURE_MOUNT_HELPERS is not set +# CONFIG_FEATURE_MOUNT_LABEL is not set +# CONFIG_FEATURE_MOUNT_NFS is not set +CONFIG_FEATURE_MOUNT_CIFS=y +CONFIG_FEATURE_MOUNT_FLAGS=y +CONFIG_FEATURE_MOUNT_FSTAB=y +CONFIG_FEATURE_MOUNT_OTHERTAB=y +CONFIG_MOUNTPOINT=y +CONFIG_NOLOGIN=y +# CONFIG_NOLOGIN_DEPENDENCIES is not set +# CONFIG_NSENTER is not set +CONFIG_PIVOT_ROOT=y +# CONFIG_RDATE is not set +# CONFIG_RDEV is not set +# CONFIG_READPROFILE is not set +CONFIG_RENICE=y +# CONFIG_REV is not set +# CONFIG_RTCWAKE is not set +# CONFIG_SCRIPT is not set +# CONFIG_SCRIPTREPLAY is not set +# CONFIG_SETARCH is not set +# CONFIG_LINUX32 is not set +# CONFIG_LINUX64 is not set +# CONFIG_SETPRIV is not set +# CONFIG_FEATURE_SETPRIV_DUMP is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set +CONFIG_SETSID=y +# CONFIG_SWAPON is not set +# CONFIG_FEATURE_SWAPON_DISCARD is not set +# CONFIG_FEATURE_SWAPON_PRI is not set +# CONFIG_SWAPOFF is not set +# CONFIG_FEATURE_SWAPONOFF_LABEL is not set +CONFIG_SWITCH_ROOT=y +# CONFIG_TASKSET is not set +# CONFIG_FEATURE_TASKSET_FANCY is not set +# CONFIG_FEATURE_TASKSET_CPULIST is not set +CONFIG_UEVENT=y +CONFIG_UMOUNT=y +CONFIG_FEATURE_UMOUNT_ALL=y +# CONFIG_UNSHARE is not set +# CONFIG_WALL is not set + +# +# Common options for mount/umount +# +CONFIG_FEATURE_MOUNT_LOOP=y +CONFIG_FEATURE_MOUNT_LOOP_CREATE=y +# CONFIG_FEATURE_MTAB_SUPPORT is not set +CONFIG_VOLUMEID=y + +# +# Filesystem/Volume identification +# +# CONFIG_FEATURE_VOLUMEID_BCACHE is not set +# CONFIG_FEATURE_VOLUMEID_BTRFS is not set +# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set +CONFIG_FEATURE_VOLUMEID_EROFS=y +CONFIG_FEATURE_VOLUMEID_EXFAT=y +CONFIG_FEATURE_VOLUMEID_EXT=y +CONFIG_FEATURE_VOLUMEID_F2FS=y +CONFIG_FEATURE_VOLUMEID_FAT=y +# CONFIG_FEATURE_VOLUMEID_HFS is not set +# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set +# CONFIG_FEATURE_VOLUMEID_JFS is not set +# CONFIG_FEATURE_VOLUMEID_LFS is not set +# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set +# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set +# CONFIG_FEATURE_VOLUMEID_LUKS is not set +CONFIG_FEATURE_VOLUMEID_MINIX=y +# CONFIG_FEATURE_VOLUMEID_NILFS is not set +# CONFIG_FEATURE_VOLUMEID_NTFS is not set +# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set +# CONFIG_FEATURE_VOLUMEID_REISERFS is not set +# CONFIG_FEATURE_VOLUMEID_ROMFS is not set +# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set +# CONFIG_FEATURE_VOLUMEID_SYSV is not set +CONFIG_FEATURE_VOLUMEID_UBIFS=y +# CONFIG_FEATURE_VOLUMEID_UDF is not set +# CONFIG_FEATURE_VOLUMEID_XFS is not set + +# +# Miscellaneous Utilities +# +# CONFIG_ADJTIMEX is not set +# CONFIG_ASCII is not set +# CONFIG_BBCONFIG is not set +# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set +CONFIG_BC=y +CONFIG_DC=y +CONFIG_FEATURE_DC_BIG=y +# CONFIG_FEATURE_DC_LIBM is not set +CONFIG_FEATURE_BC_INTERACTIVE=y +CONFIG_FEATURE_BC_LONG_OPTIONS=y +# CONFIG_BEEP is not set +CONFIG_FEATURE_BEEP_FREQ=0 +CONFIG_FEATURE_BEEP_LENGTH_MS=0 +# CONFIG_CHAT is not set +# CONFIG_FEATURE_CHAT_NOFAIL is not set +# CONFIG_FEATURE_CHAT_TTY_HIFI is not set +# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set +# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set +# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set +# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set +# CONFIG_FEATURE_CHAT_CLR_ABORT is not set +# CONFIG_CONSPY is not set +# CONFIG_CROND is not set +# CONFIG_FEATURE_CROND_D is not set +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set +CONFIG_FEATURE_CROND_DIR="" +# CONFIG_CRONTAB is not set +# CONFIG_DEVFSD is not set +# CONFIG_DEVFSD_MODLOAD is not set +# CONFIG_DEVFSD_FG_NP is not set +# CONFIG_DEVFSD_VERBOSE is not set +# CONFIG_FEATURE_DEVFS is not set +CONFIG_DEVMEM=y +# CONFIG_FBSPLASH is not set +# CONFIG_FLASH_ERASEALL is not set +# CONFIG_FLASH_LOCK is not set +# CONFIG_FLASH_UNLOCK is not set +# CONFIG_FLASHCP is not set +# CONFIG_HDPARM is not set +# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set +# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set +# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set +# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set +# CONFIG_HEXEDIT is not set +# CONFIG_I2CGET is not set +# CONFIG_I2CSET is not set +# CONFIG_I2CDUMP is not set +# CONFIG_I2CDETECT is not set +# CONFIG_I2CTRANSFER is not set +# CONFIG_INOTIFYD is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_TRUNCATE=y +# CONFIG_FEATURE_LESS_MARKS is not set +CONFIG_FEATURE_LESS_REGEXP=y +# CONFIG_FEATURE_LESS_WINCH is not set +# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set +CONFIG_FEATURE_LESS_DASHCMD=y +# CONFIG_FEATURE_LESS_LINENUMS is not set +CONFIG_FEATURE_LESS_RAW=y +CONFIG_FEATURE_LESS_ENV=y +# CONFIG_LSSCSI is not set +CONFIG_MAKEDEVS=y +# CONFIG_FEATURE_MAKEDEVS_LEAF is not set +CONFIG_FEATURE_MAKEDEVS_TABLE=y +# CONFIG_MAN is not set +# CONFIG_MICROCOM is not set +# CONFIG_MIM is not set +# CONFIG_MT is not set +# CONFIG_NANDWRITE is not set +# CONFIG_NANDDUMP is not set +# CONFIG_PARTPROBE is not set +# CONFIG_RAIDAUTORUN is not set +# CONFIG_READAHEAD is not set +# CONFIG_RFKILL is not set +CONFIG_RUNLEVEL=y +# CONFIG_RX is not set +# CONFIG_SEEDRNG is not set +CONFIG_SETFATTR=y +# CONFIG_SETSERIAL is not set +CONFIG_STRINGS=y +CONFIG_TIME=y +CONFIG_TREE=y +# CONFIG_TS is not set +# CONFIG_TTYSIZE is not set +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set +# CONFIG_UBIMKVOL is not set +# CONFIG_UBIRMVOL is not set +# CONFIG_UBIRSVOL is not set +# CONFIG_UBIUPDATEVOL is not set +# CONFIG_UBIRENAME is not set +# CONFIG_VOLNAME is not set +# CONFIG_WATCHDOG is not set +# CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set + +# +# Networking Utilities +# +CONFIG_FEATURE_IPV6=y +# CONFIG_FEATURE_UNIX_LOCAL is not set +CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y +# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set +# CONFIG_FEATURE_ETC_NETWORKS is not set +# CONFIG_FEATURE_ETC_SERVICES is not set +# CONFIG_FEATURE_HWIB is not set +# CONFIG_FEATURE_TLS_SHA1 is not set +CONFIG_ARP=y +CONFIG_ARPING=y +# CONFIG_BRCTL is not set +# CONFIG_FEATURE_BRCTL_FANCY is not set +# CONFIG_FEATURE_BRCTL_SHOW is not set +# CONFIG_DNSD is not set +# CONFIG_ETHER_WAKE is not set +# CONFIG_FTPD is not set +# CONFIG_FEATURE_FTPD_WRITE is not set +# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set +# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set +# CONFIG_FTPGET is not set +# CONFIG_FTPPUT is not set +# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set +CONFIG_HOSTNAME=y +# CONFIG_DNSDOMAINNAME is not set +# CONFIG_HTTPD is not set +CONFIG_FEATURE_HTTPD_PORT_DEFAULT=0 +# CONFIG_FEATURE_HTTPD_RANGES is not set +# CONFIG_FEATURE_HTTPD_SETUID is not set +# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set +# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set +# CONFIG_FEATURE_HTTPD_CGI is not set +# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set +# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set +# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set +# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set +# CONFIG_FEATURE_HTTPD_PROXY is not set +# CONFIG_FEATURE_HTTPD_GZIP is not set +# CONFIG_FEATURE_HTTPD_ETAG is not set +# CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set +# CONFIG_FEATURE_HTTPD_DATE is not set +# CONFIG_FEATURE_HTTPD_ACL_IP is not set +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +CONFIG_FEATURE_IFCONFIG_SLIP=y +CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y +CONFIG_FEATURE_IFCONFIG_HW=y +# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set +# CONFIG_IFENSLAVE is not set +# CONFIG_IFPLUGD is not set +CONFIG_IFUP=y +CONFIG_IFDOWN=y +CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" +CONFIG_FEATURE_IFUPDOWN_IP=y +CONFIG_FEATURE_IFUPDOWN_IPV4=y +CONFIG_FEATURE_IFUPDOWN_IPV6=y +CONFIG_FEATURE_IFUPDOWN_MAPPING=y +# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set +# CONFIG_INETD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set +# CONFIG_FEATURE_INETD_RPC is not set +CONFIG_IP=y +CONFIG_IPADDR=y +CONFIG_IPLINK=y +CONFIG_IPROUTE=y +CONFIG_IPTUNNEL=y +CONFIG_IPRULE=y +CONFIG_IPNEIGH=y +CONFIG_FEATURE_IP_ADDRESS=y +CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_ROUTE=y +CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" +CONFIG_FEATURE_IP_TUNNEL=y +CONFIG_FEATURE_IP_RULE=y +CONFIG_FEATURE_IP_NEIGH=y +# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set +# CONFIG_IPCALC is not set +# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set +# CONFIG_FEATURE_IPCALC_FANCY is not set +# CONFIG_FAKEIDENTD is not set +# CONFIG_NAMEIF is not set +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +# CONFIG_NBDCLIENT is not set +# CONFIG_NC is not set +# CONFIG_NETCAT is not set +# CONFIG_NC_SERVER is not set +# CONFIG_NC_EXTRA is not set +# CONFIG_NC_110_COMPAT is not set +CONFIG_NETSTAT=y +# CONFIG_FEATURE_NETSTAT_WIDE is not set +# CONFIG_FEATURE_NETSTAT_PRG is not set +CONFIG_NSLOOKUP=y +CONFIG_FEATURE_NSLOOKUP_BIG=y +CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y +# CONFIG_NTPD is not set +# CONFIG_FEATURE_NTPD_SERVER is not set +# CONFIG_FEATURE_NTPD_CONF is not set +# CONFIG_FEATURE_NTP_AUTH is not set +CONFIG_PING=y +# CONFIG_PING6 is not set +CONFIG_FEATURE_FANCY_PING=y +# CONFIG_PSCAN is not set +CONFIG_ROUTE=y +# CONFIG_SLATTACH is not set +# CONFIG_SSL_CLIENT is not set +# CONFIG_TC is not set +# CONFIG_FEATURE_TC_INGRESS is not set +# CONFIG_TCPSVD is not set +# CONFIG_UDPSVD is not set +CONFIG_TELNET=y +CONFIG_FEATURE_TELNET_TTYPE=y +CONFIG_FEATURE_TELNET_AUTOLOGIN=y +CONFIG_FEATURE_TELNET_WIDTH=y +# CONFIG_TELNETD is not set +# CONFIG_FEATURE_TELNETD_STANDALONE is not set +CONFIG_FEATURE_TELNETD_PORT_DEFAULT=0 +# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set +# CONFIG_TFTP is not set +# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set +# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set +# CONFIG_TFTPD is not set +# CONFIG_FEATURE_TFTP_GET is not set +# CONFIG_FEATURE_TFTP_PUT is not set +# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set +# CONFIG_TFTP_DEBUG is not set +# CONFIG_TLS is not set +CONFIG_TRACEROUTE=y +# CONFIG_TRACEROUTE6 is not set +# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set +# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set +# CONFIG_TUNCTL is not set +# CONFIG_FEATURE_TUNCTL_UG is not set +# CONFIG_VCONFIG is not set +CONFIG_WGET=y +CONFIG_FEATURE_WGET_LONG_OPTIONS=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_FTP=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_TIMEOUT=y +# CONFIG_FEATURE_WGET_HTTPS is not set +# CONFIG_FEATURE_WGET_OPENSSL is not set +# CONFIG_WHOIS is not set +# CONFIG_ZCIP is not set +# CONFIG_UDHCPD is not set +# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set +CONFIG_DHCPD_LEASES_FILE="" +# CONFIG_DUMPLEASES is not set +# CONFIG_DHCPRELAY is not set +CONFIG_UDHCPC=y +CONFIG_FEATURE_UDHCPC_ARPING=y +CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y +CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" +CONFIG_UDHCPC6_DEFAULT_SCRIPT="" +# CONFIG_UDHCPC6 is not set +# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set +# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set + +# +# Common options for DHCP applets +# +CONFIG_UDHCPC_DEFAULT_INTERFACE="eth0" +# CONFIG_FEATURE_UDHCP_PORT is not set +CONFIG_UDHCP_DEBUG=0 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 +# CONFIG_FEATURE_UDHCP_RFC3397 is not set +# CONFIG_FEATURE_UDHCP_8021Q is not set +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-t1 -A3 -b -R -O search -O staticroutes" + +# +# Print Utilities +# +# CONFIG_LPD is not set +# CONFIG_LPR is not set +# CONFIG_LPQ is not set + +# +# Mail Utilities +# +CONFIG_FEATURE_MIME_CHARSET="" +# CONFIG_MAKEMIME is not set +# CONFIG_POPMAILDIR is not set +# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set +# CONFIG_REFORMIME is not set +# CONFIG_FEATURE_REFORMIME_COMPAT is not set +# CONFIG_SENDMAIL is not set + +# +# Process Utilities +# +CONFIG_FEATURE_FAST_TOP=y +# CONFIG_FEATURE_SHOW_THREADS is not set +CONFIG_FREE=y +CONFIG_FUSER=y +# CONFIG_IOSTAT is not set +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y +CONFIG_LSOF=y +# CONFIG_MPSTAT is not set +# CONFIG_NMETER is not set +# CONFIG_PGREP is not set +# CONFIG_PKILL is not set +CONFIG_PIDOF=y +CONFIG_FEATURE_PIDOF_SINGLE=y +CONFIG_FEATURE_PIDOF_OMIT=y +# CONFIG_PMAP is not set +# CONFIG_POWERTOP is not set +# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set +CONFIG_PS=y +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +# CONFIG_FEATURE_PS_TIME is not set +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set +# CONFIG_PSTREE is not set +# CONFIG_PWDX is not set +# CONFIG_SMEMCAP is not set +CONFIG_BB_SYSCTL=y +CONFIG_TOP=y +CONFIG_FEATURE_TOP_INTERACTIVE=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y +# CONFIG_FEATURE_TOP_SMP_CPU is not set +# CONFIG_FEATURE_TOP_DECIMALS is not set +# CONFIG_FEATURE_TOP_SMP_PROCESS is not set +# CONFIG_FEATURE_TOPMEM is not set +CONFIG_UPTIME=y +# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set +CONFIG_WATCH=y + +# +# Runit Utilities +# +# CONFIG_CHPST is not set +# CONFIG_SETUIDGID is not set +# CONFIG_ENVUIDGID is not set +# CONFIG_ENVDIR is not set +# CONFIG_SOFTLIMIT is not set +# CONFIG_RUNSV is not set +# CONFIG_RUNSVDIR is not set +# CONFIG_FEATURE_RUNSVDIR_LOG is not set +# CONFIG_SV is not set +CONFIG_SV_DEFAULT_SERVICE_DIR="" +# CONFIG_SVC is not set +CONFIG_SVOK=y +# CONFIG_SVLOGD is not set +# CONFIG_CHCON is not set +# CONFIG_GETENFORCE is not set +# CONFIG_GETSEBOOL is not set +# CONFIG_LOAD_POLICY is not set +# CONFIG_MATCHPATHCON is not set +# CONFIG_RUNCON is not set +# CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set +# CONFIG_SETENFORCE is not set +# CONFIG_SETFILES is not set +# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set +# CONFIG_SETSEBOOL is not set + +# +# Shells +# +CONFIG_SH_IS_ASH=y +# CONFIG_SH_IS_HUSH is not set +# CONFIG_SH_IS_NONE is not set +# CONFIG_BASH_IS_ASH is not set +# CONFIG_BASH_IS_HUSH is not set +CONFIG_BASH_IS_NONE=y +CONFIG_SHELL_ASH=y +CONFIG_ASH=y +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +CONFIG_ASH_INTERNAL_GLOB=y +CONFIG_ASH_BASH_COMPAT=y +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +CONFIG_ASH_BASH_NOT_FOUND_HOOK=y +CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_RANDOM_SUPPORT=y +CONFIG_ASH_EXPAND_PRMT=y +CONFIG_ASH_IDLE_TIMEOUT=y +# CONFIG_ASH_MAIL is not set +CONFIG_ASH_ECHO=y +CONFIG_ASH_PRINTF=y +CONFIG_ASH_TEST=y +CONFIG_ASH_SLEEP=y +CONFIG_ASH_HELP=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_CMDCMD=y +# CONFIG_CTTYHACK is not set +# CONFIG_HUSH is not set +# CONFIG_SHELL_HUSH is not set +# CONFIG_HUSH_BASH_COMPAT is not set +# CONFIG_HUSH_BRACE_EXPANSION is not set +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_INTERACTIVE is not set +# CONFIG_HUSH_SAVEHISTORY is not set +# CONFIG_HUSH_JOB is not set +# CONFIG_HUSH_TICK is not set +# CONFIG_HUSH_IF is not set +# CONFIG_HUSH_LOOPS is not set +# CONFIG_HUSH_CASE is not set +# CONFIG_HUSH_FUNCTIONS is not set +# CONFIG_HUSH_LOCAL is not set +# CONFIG_HUSH_RANDOM_SUPPORT is not set +# CONFIG_HUSH_MODE_X is not set +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set +# CONFIG_HUSH_MEMLEAK is not set + +# +# Options common to all shells +# +CONFIG_FEATURE_SH_MATH=y +CONFIG_FEATURE_SH_MATH_64=y +CONFIG_FEATURE_SH_MATH_BASE=y +CONFIG_FEATURE_SH_EXTRA_QUIET=y +# CONFIG_FEATURE_SH_STANDALONE is not set +# CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_READ_FRAC=y +# CONFIG_FEATURE_SH_HISTFILESIZE is not set +CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y + +# +# System Logging Utilities +# +CONFIG_KLOGD=y +CONFIG_FEATURE_KLOGD_KLOGCTL=y +CONFIG_LOGGER=y +# CONFIG_LOGREAD is not set +# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +# CONFIG_FEATURE_SYSLOGD_DUP is not set +# CONFIG_FEATURE_SYSLOGD_CFG is not set +# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 +# CONFIG_FEATURE_IPC_SYSLOG is not set +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 +# CONFIG_FEATURE_KMSG_SYSLOG is not set diff --git a/assets/system/configs/linux.config b/assets/system/configs/linux.config new file mode 100644 index 00000000..fc3584e0 --- /dev/null +++ b/assets/system/configs/linux.config @@ -0,0 +1,1806 @@ +CONFIG_CC_VERSION_TEXT="riscv32-buildroot-linux-gnu-gcc.br_real (Buildroot 2023.05.1) 12.3.0" +CONFIG_CC_IS_GCC=y +CONFIG_GCC_VERSION=120300 +CONFIG_CLANG_VERSION=0 +CONFIG_AS_IS_GNU=y +CONFIG_AS_VERSION=23900 +CONFIG_LD_IS_BFD=y +CONFIG_LD_VERSION=23900 +CONFIG_LLD_VERSION=0 +CONFIG_CC_CAN_LINK=y +CONFIG_CC_CAN_LINK_STATIC=y +CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y +CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y +CONFIG_CC_HAS_ASM_INLINE=y +CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y +CONFIG_PAHOLE_VERSION=0 +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_TABLE_SORT=y +CONFIG_THREAD_INFO_IN_TASK=y + +# +# General setup +# +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_COMPILE_TEST is not set +# CONFIG_WERROR is not set +CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y +CONFIG_BUILD_SALT="" +CONFIG_DEFAULT_INIT="" +CONFIG_DEFAULT_HOSTNAME="(none)" +# CONFIG_SYSVIPC is not set +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_WATCH_QUEUE is not set +# CONFIG_CROSS_MEMORY_ATTACH is not set +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +# CONFIG_GENERIC_IRQ_DEBUGFS is not set +# end of IRQ subsystem + +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_ARCH_CLOCKSOURCE_INIT=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_HZ_PERIODIC=y +# CONFIG_NO_HZ_IDLE is not set +# CONFIG_NO_HZ is not set +CONFIG_HIGH_RES_TIMERS=y +# end of Timers subsystem + +CONFIG_BPF=y +CONFIG_HAVE_EBPF_JIT=y + +# +# BPF subsystem +# +# CONFIG_BPF_SYSCALL is not set +# CONFIG_BPF_JIT is not set +# end of BPF subsystem + +CONFIG_PREEMPT_NONE_BUILD=y +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT is not set + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set +# CONFIG_PSI is not set +# end of CPU/Task time and stats accounting + +# +# RCU Subsystem +# +CONFIG_TINY_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +CONFIG_TINY_SRCU=y +# end of RCU Subsystem + +# CONFIG_IKCONFIG is not set +# CONFIG_IKHEADERS is not set +CONFIG_LOG_BUF_SHIFT=16 +CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12 +# CONFIG_PRINTK_INDEX is not set +CONFIG_GENERIC_SCHED_CLOCK=y + +# +# Scheduler features +# +# end of Scheduler features + +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_CC_NO_ARRAY_BOUNDS=y +# CONFIG_CGROUPS is not set +# CONFIG_NAMESPACES is not set +# CONFIG_CHECKPOINT_RESTORE is not set +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_RD_GZIP is not set +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_RD_ZSTD=y +# CONFIG_BOOT_CONFIG is not set +CONFIG_INITRAMFS_PRESERVE_MTIME=y +# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_EXPERT=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SYSFS_SYSCALL is not set +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +# CONFIG_AIO is not set +# CONFIG_IO_URING is not set +CONFIG_ADVISE_SYSCALLS=y +CONFIG_MEMBARRIER=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y +# CONFIG_KCMP is not set +# CONFIG_RSEQ is not set +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +# CONFIG_PC104 is not set + +# +# Kernel Performance Events And Counters +# +# CONFIG_PERF_EVENTS is not set +# end of Kernel Performance Events And Counters + +# CONFIG_PROFILING is not set +# end of General setup + +CONFIG_32BIT=y +CONFIG_RISCV=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=17 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17 +CONFIG_RISCV_SBI=y +CONFIG_MMU=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_ARCH_FLATMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_AS_HAS_INSN=y + +# +# SoC selection +# +# CONFIG_SOC_MICROCHIP_POLARFIRE is not set +# CONFIG_SOC_SIFIVE is not set +# CONFIG_SOC_STARFIVE is not set +# CONFIG_SOC_VIRT is not set +# end of SoC selection + +# +# CPU errata selection +# +# CONFIG_ERRATA_SIFIVE is not set +# CONFIG_ERRATA_THEAD is not set +# end of CPU errata selection + +# +# Platform type +# +CONFIG_NONPORTABLE=y +CONFIG_ARCH_RV32I=y +# CONFIG_ARCH_RV64I is not set +# CONFIG_CMODEL_MEDLOW is not set +CONFIG_CMODEL_MEDANY=y +CONFIG_MODULE_SECTIONS=y +# CONFIG_SMP is not set +CONFIG_TUNE_GENERIC=y +# CONFIG_RISCV_ISA_C is not set +CONFIG_TOOLCHAIN_HAS_ZICBOM=y +# CONFIG_RISCV_ISA_ZICBOM is not set +CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y +CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI=y +# CONFIG_FPU is not set +# end of Platform type + +# +# Kernel features +# +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_HZ_300 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=250 +CONFIG_SCHED_HRTICK=y +# CONFIG_RISCV_SBI_V01 is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +# end of Kernel features + +# +# Boot options +# +CONFIG_CMDLINE="" +# CONFIG_EFI is not set +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +# CONFIG_PHYS_RAM_BASE_FIXED is not set +# end of Boot options + +# +# Power management options +# +# CONFIG_PM is not set +# end of Power management options + +# +# CPU Power Management +# + +# +# CPU Idle +# +# CONFIG_CPU_IDLE is not set +# end of CPU Idle +# end of CPU Power Management + +# CONFIG_VIRTUALIZATION is not set + +# +# General architecture-dependent options +# +# CONFIG_KPROBES is not set +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KPROBES_ON_FTRACE=y +CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_ARCH_HAS_SET_DIRECT_MAP=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_HAVE_ASM_MODVERSIONS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y +CONFIG_HAVE_ARCH_SECCOMP=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +# CONFIG_SECCOMP is not set +CONFIG_HAVE_STACKPROTECTOR=y +# CONFIG_STACKPROTECTOR is not set +CONFIG_LTO_NONE=y +CONFIG_HAVE_CONTEXT_TRACKING_USER=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOVE_PUD=y +CONFIG_HAVE_MOVE_PMD=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_STRICT_KERNEL_RWX=n +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_STRICT_MODULE_RWX=y +# CONFIG_LOCK_EVENT_COUNTS is not set +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +# end of GCOV-based kernel profiling + +CONFIG_HAVE_GCC_PLUGINS=y +# CONFIG_GCC_PLUGINS is not set +# end of General architecture-dependent options + +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +CONFIG_MODULE_COMPRESS_NONE=y +# CONFIG_MODULE_COMPRESS_GZIP is not set +# CONFIG_MODULE_COMPRESS_XZ is not set +# CONFIG_MODULE_COMPRESS_ZSTD is not set +# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set +CONFIG_MODPROBE_PATH="/sbin/modprobe" +# CONFIG_TRIM_UNUSED_KSYMS is not set +CONFIG_BLOCK=y +# CONFIG_BLOCK_LEGACY_AUTOLOAD is not set +# CONFIG_BLK_DEV_BSGLIB is not set +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_ZONED is not set +# CONFIG_BLK_WBT is not set +# CONFIG_BLK_DEBUG_FS is not set +# CONFIG_BLK_SED_OPAL is not set +# CONFIG_BLK_INLINE_ENCRYPTION is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_EFI_PARTITION=y +# end of Partition Types + +CONFIG_BLK_MQ_VIRTIO=y + +# +# IO Schedulers +# +# CONFIG_MQ_IOSCHED_DEADLINE is not set +# CONFIG_MQ_IOSCHED_KYBER is not set +# CONFIG_IOSCHED_BFQ is not set +# end of IO Schedulers + +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_ARCH_HAS_MMIOWB=y +CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +CONFIG_ELFCORE=y +CONFIG_BINFMT_SCRIPT=y +CONFIG_ARCH_HAS_BINFMT_FLAT=y +# CONFIG_BINFMT_FLAT is not set +# CONFIG_BINFMT_MISC is not set +# CONFIG_COREDUMP is not set +# end of Executable file formats + +# +# Memory Management options +# +# CONFIG_SWAP is not set + +# +# SLAB allocator options +# +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLAB_MERGE_DEFAULT=y +# CONFIG_SLAB_FREELIST_RANDOM is not set +# CONFIG_SLAB_FREELIST_HARDENED is not set +# CONFIG_SLUB_STATS is not set +# end of SLAB allocator options + +# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set +CONFIG_COMPAT_BRK=y +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_FLATMEM_MANUAL=y +# CONFIG_SPARSEMEM_MANUAL is not set +CONFIG_FLATMEM=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 +# CONFIG_PAGE_REPORTING is not set +CONFIG_MIGRATION=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_NEED_PER_CPU_KM=y +# CONFIG_CMA is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y +CONFIG_VM_EVENT_COUNTERS=y +# CONFIG_PERCPU_STATS is not set +# CONFIG_GUP_TEST is not set +CONFIG_ARCH_HAS_PTE_SPECIAL=y +# CONFIG_ANON_VMA_NAME is not set +# CONFIG_USERFAULTFD is not set +# CONFIG_LRU_GEN is not set +CONFIG_LOCK_MM_AND_FIND_VMA=y + +# +# Data Access Monitoring +# +# CONFIG_DAMON is not set +# end of Data Access Monitoring +# end of Memory Management options + +CONFIG_NET=y + +# +# Networking options +# +# CONFIG_PACKET is not set +CONFIG_UNIX=y +CONFIG_UNIX_SCM=y +CONFIG_AF_UNIX_OOB=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_TLS is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_IPVTI is not set +# CONFIG_NET_FOU is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +CONFIG_INET_TABLE_PERTURB_ORDER=16 +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +# CONFIG_IPV6 is not set +# CONFIG_MPTCP is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +# CONFIG_NETFILTER is not set +# CONFIG_BPFILTER is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +# CONFIG_BRIDGE is not set +# CONFIG_NET_DSA is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_LLC2 is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_NET_NSH is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +# CONFIG_QRTR is not set +# CONFIG_NET_NCSI is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# end of Network testing +# end of Networking options + +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +# CONFIG_MCTP is not set +# CONFIG_WIRELESS is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_PSAMPLE is not set +# CONFIG_NET_IFE is not set +# CONFIG_LWTUNNEL is not set +CONFIG_FAILOVER=y +# CONFIG_ETHTOOL_NETLINK is not set + +# +# Device Drivers +# +CONFIG_HAVE_PCI=y +# CONFIG_PCI is not set +# CONFIG_PCCARD is not set + +# +# Generic Driver Options +# +# CONFIG_UEVENT_HELPER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_DEVTMPFS_SAFE is not set +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y + +# +# Firmware loader +# +# CONFIG_FW_LOADER is not set +# end of Firmware loader + +CONFIG_ALLOW_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +# end of Generic Driver Options + +# +# Bus devices +# +# CONFIG_MHI_BUS is not set +# CONFIG_MHI_BUS_EP is not set +# end of Bus devices + +# CONFIG_CONNECTOR is not set + +# +# Firmware Drivers +# + +# +# ARM System Control and Management Interface Protocol +# +# end of ARM System Control and Management Interface Protocol + +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# Tegra firmware driver +# +# end of Tegra firmware driver +# end of Firmware Drivers + +# CONFIG_GNSS is not set +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_KOBJ=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +CONFIG_OF_DMA_DEFAULT_COHERENT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_VIRTIO_BLK=y +# CONFIG_BLK_DEV_RBD is not set +# CONFIG_BLK_DEV_UBLK is not set + +# +# NVME Support +# +# CONFIG_NVME_FC is not set +# CONFIG_NVME_TCP is not set +# end of NVME Support + +# +# Misc devices +# +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_SRAM is not set +# CONFIG_XILINX_SDFEC is not set +# CONFIG_OPEN_DICE is not set +# CONFIG_VCPU_STALL_DETECTOR is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_93CX6 is not set +# end of EEPROM support + +# +# Texas Instruments shared transport line discipline +# +# end of Texas Instruments shared transport line discipline + +# +# Altera FPGA firmware download module (requires I2C) +# +# CONFIG_ECHO is not set +# CONFIG_PVPANIC is not set +# end of Misc devices + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +# CONFIG_SCSI is not set +# end of SCSI device support + +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_WIREGUARD is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +# CONFIG_MACVLAN is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_GENEVE is not set +# CONFIG_BAREUDP is not set +# CONFIG_GTP is not set +# CONFIG_AMT is not set +# CONFIG_MACSEC is not set +# CONFIG_NETCONSOLE is not set +# CONFIG_TUN is not set +# CONFIG_TUN_VNET_CROSS_LE is not set +# CONFIG_VETH is not set +CONFIG_VIRTIO_NET=y +# CONFIG_NLMON is not set +# CONFIG_ETHERNET is not set +# CONFIG_PHYLIB is not set +# CONFIG_PSE_CONTROLLER is not set +# CONFIG_MDIO_DEVICE is not set + +# +# PCS device drivers +# +# end of PCS device drivers + +# CONFIG_PPP is not set +# CONFIG_SLIP is not set + +# +# Host-side USB support is needed for USB Network Adapter support +# +# CONFIG_WLAN is not set +# CONFIG_WAN is not set + +# +# Wireless WAN +# +# CONFIG_WWAN is not set +# end of Wireless WAN + +# CONFIG_NETDEVSIM is not set +CONFIG_NET_FAILOVER=y +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set +# CONFIG_RMI4_CORE is not set + +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set +# end of Hardware I/O ports +# end of Input device support + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LDISC_AUTOLOAD=y + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_16550A_VARIANTS=y +# CONFIG_SERIAL_8250_FINTEK is not set +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_OF_PLATFORM=y + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SIFIVE is not set +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_FSL_LINFLEXUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_SPRD is not set +# end of Serial drivers + +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_NULL_TTY is not set +# CONFIG_SERIAL_DEV_BUS is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_VIRTIO_CONSOLE is not set +# CONFIG_IPMI_HANDLER is not set +# CONFIG_HW_RANDOM is not set +CONFIG_DEVMEM=y +# CONFIG_TCG_TPM is not set +# CONFIG_XILLYBUS is not set +# CONFIG_RANDOM_TRUST_CPU is not set +# CONFIG_RANDOM_TRUST_BOOTLOADER is not set +# end of Character devices + +# +# I2C support +# +# CONFIG_I2C is not set +# end of I2C support + +# CONFIG_I3C is not set +# CONFIG_SPI is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set +# CONFIG_PPS is not set + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set +CONFIG_PTP_1588_CLOCK_OPTIONAL=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +# end of PTP clock support + +# CONFIG_PINCTRL is not set +# CONFIG_GPIOLIB is not set +# CONFIG_W1 is not set +# CONFIG_POWER_RESET is not set +# CONFIG_POWER_SUPPLY is not set +# CONFIG_HWMON is not set +# CONFIG_THERMAL is not set +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_MADERA is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_SM501 is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_TQMX86 is not set +# end of Multifunction device drivers + +# CONFIG_REGULATOR is not set +# CONFIG_RC_CORE is not set + +# +# CEC support +# +# CONFIG_MEDIA_CEC_SUPPORT is not set +# end of CEC support + +# CONFIG_MEDIA_SUPPORT is not set + +# +# Graphics support +# +# CONFIG_DRM is not set +# CONFIG_DRM_DEBUG_MODESET_LOCK is not set + +# +# ARM devices +# +# end of ARM devices + +# +# Frame buffer Devices +# +# CONFIG_FB is not set +# end of Frame buffer Devices + +# +# Backlight & LCD device support +# +# CONFIG_LCD_CLASS_DEVICE is not set +# CONFIG_BACKLIGHT_CLASS_DEVICE is not set +# end of Backlight & LCD device support + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +# end of Console display driver support +# end of Graphics support + +# CONFIG_SOUND is not set + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +# CONFIG_HIDRAW is not set +# CONFIG_UHID is not set +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +# CONFIG_HID_A4TECH is not set +# CONFIG_HID_ACRUX is not set +# CONFIG_HID_AUREAL is not set +# CONFIG_HID_BELKIN is not set +# CONFIG_HID_CHERRY is not set +# CONFIG_HID_COUGAR is not set +# CONFIG_HID_MACALLY is not set +# CONFIG_HID_CMEDIA is not set +# CONFIG_HID_CYPRESS is not set +# CONFIG_HID_DRAGONRISE is not set +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_EZKEY is not set +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_GLORIOUS is not set +# CONFIG_HID_VIVALDI is not set +# CONFIG_HID_KEYTOUCH is not set +# CONFIG_HID_KYE is not set +# CONFIG_HID_WALTOP is not set +# CONFIG_HID_VIEWSONIC is not set +# CONFIG_HID_VRC2 is not set +# CONFIG_HID_XIAOMI is not set +# CONFIG_HID_GYRATION is not set +# CONFIG_HID_ICADE is not set +# CONFIG_HID_ITE is not set +# CONFIG_HID_JABRA is not set +# CONFIG_HID_TWINHAN is not set +# CONFIG_HID_KENSINGTON is not set +# CONFIG_HID_LCPOWER is not set +# CONFIG_HID_LENOVO is not set +# CONFIG_HID_MAGICMOUSE is not set +# CONFIG_HID_MALTRON is not set +# CONFIG_HID_MAYFLASH is not set +# CONFIG_HID_REDRAGON is not set +# CONFIG_HID_MICROSOFT is not set +# CONFIG_HID_MONTEREY is not set +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTI is not set +# CONFIG_HID_ORTEK is not set +# CONFIG_HID_PANTHERLORD is not set +# CONFIG_HID_PETALYNX is not set +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PXRC is not set +# CONFIG_HID_RAZER is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_SAITEK is not set +# CONFIG_HID_SEMITEK is not set +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEAM is not set +# CONFIG_HID_STEELSERIES is not set +# CONFIG_HID_SUNPLUS is not set +# CONFIG_HID_RMI is not set +# CONFIG_HID_GREENASIA is not set +# CONFIG_HID_SMARTJOYPLUS is not set +# CONFIG_HID_TIVO is not set +# CONFIG_HID_TOPSEED is not set +# CONFIG_HID_TOPRE is not set +# CONFIG_HID_UDRAW_PS3 is not set +# CONFIG_HID_XINMO is not set +# CONFIG_HID_ZEROPLUS is not set +# CONFIG_HID_ZYDACRON is not set +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_ALPS is not set +# end of Special HID drivers +# end of HID support + +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +# CONFIG_USB_SUPPORT is not set +# CONFIG_MMC is not set +# CONFIG_MEMSTICK is not set +# CONFIG_NEW_LEDS is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_SUPPORT=y +# CONFIG_RTC_CLASS is not set +# CONFIG_DMADEVICES is not set + +# +# DMABUF options +# +# CONFIG_SYNC_FILE is not set +# CONFIG_DMABUF_HEAPS is not set +# end of DMABUF options + +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VFIO is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRTIO_ANCHOR=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_MENU=y +# CONFIG_VIRTIO_BALLOON is not set +# CONFIG_VIRTIO_INPUT is not set +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set +# CONFIG_VDPA is not set +# CONFIG_VHOST_MENU is not set + +# +# Microsoft Hyper-V guest support +# +# end of Microsoft Hyper-V guest support + +# CONFIG_GREYBUS is not set +# CONFIG_COMEDI is not set +# CONFIG_STAGING is not set +# CONFIG_GOLDFISH is not set +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y +# CONFIG_COMMON_CLK_AXI_CLKGEN is not set +# CONFIG_COMMON_CLK_FIXED_MMIO is not set +# CONFIG_XILINX_VCU is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_HWSPINLOCK is not set + +# +# Clock Source drivers +# +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_RISCV_TIMER=y +# CONFIG_MICROCHIP_PIT64B is not set +# end of Clock Source drivers + +# CONFIG_MAILBOX is not set +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers +# +# CONFIG_REMOTEPROC is not set +# end of Remoteproc drivers + +# +# Rpmsg drivers +# +# CONFIG_RPMSG_VIRTIO is not set +# end of Rpmsg drivers + +# CONFIG_SOUNDWIRE is not set + +# +# SOC (System On Chip) specific Drivers +# + +# +# Amlogic SoC drivers +# +# end of Amlogic SoC drivers + +# +# Broadcom SoC drivers +# +# end of Broadcom SoC drivers + +# +# NXP/Freescale QorIQ SoC drivers +# +# end of NXP/Freescale QorIQ SoC drivers + +# +# fujitsu SoC drivers +# +# end of fujitsu SoC drivers + +# +# i.MX SoC drivers +# +# end of i.MX SoC drivers + +# +# Enable LiteX SoC Builder specific drivers +# +# CONFIG_LITEX_SOC_CONTROLLER is not set +# end of Enable LiteX SoC Builder specific drivers + +# +# Qualcomm SoC drivers +# +# end of Qualcomm SoC drivers + +# CONFIG_SOC_TI is not set + +# +# Xilinx SoC drivers +# +# end of Xilinx SoC drivers +# end of SOC (System On Chip) specific Drivers + +# CONFIG_PM_DEVFREQ is not set +# CONFIG_EXTCON is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +# CONFIG_PWM is not set + +# +# IRQ chip support +# +CONFIG_IRQCHIP=y +# CONFIG_AL_FIC is not set +# CONFIG_XILINX_INTC is not set +CONFIG_RISCV_INTC=y +CONFIG_SIFIVE_PLIC=y +# end of IRQ chip support + +# CONFIG_IPACK_BUS is not set +# CONFIG_RESET_CONTROLLER is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_CAN_TRANSCEIVER is not set + +# +# PHY drivers for Broadcom platforms +# +# CONFIG_BCM_KONA_USB2_PHY is not set +# end of PHY drivers for Broadcom platforms + +# CONFIG_PHY_CADENCE_TORRENT is not set +# CONFIG_PHY_CADENCE_DPHY is not set +# CONFIG_PHY_CADENCE_DPHY_RX is not set +# CONFIG_PHY_CADENCE_SALVO is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_PHY_LAN966X_SERDES is not set +# CONFIG_PHY_OCELOT_SERDES is not set +# end of PHY Subsystem + +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set +# CONFIG_RAS is not set + +# +# Android +# +# CONFIG_ANDROID_BINDER_IPC is not set +# end of Android + +# CONFIG_DAX is not set +# CONFIG_NVMEM is not set + +# +# HW tracing support +# +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set +# end of HW tracing support + +# CONFIG_FPGA is not set +# CONFIG_FSI is not set +# CONFIG_SIOX is not set +# CONFIG_SLIMBUS is not set +# CONFIG_INTERCONNECT is not set +# CONFIG_COUNTER is not set +# CONFIG_PECI is not set +# CONFIG_HTE is not set +# end of Device Drivers + +# +# File systems +# +# CONFIG_VALIDATE_FS_PARSER is not set +CONFIG_FS_IOMAP=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +# CONFIG_EXT4_USE_FOR_EXT2 is not set +CONFIG_EXT4_FS_POSIX_ACL=y +# CONFIG_EXT4_FS_SECURITY is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_GFS2_FS is not set +# CONFIG_BTRFS_FS is not set +# CONFIG_NILFS2_FS is not set +# CONFIG_F2FS_FS is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +# CONFIG_EXPORTFS_BLOCK_OPS is not set +# CONFIG_FILE_LOCKING is not set +# CONFIG_FS_ENCRYPTION is not set +# CONFIG_FS_VERITY is not set +CONFIG_FSNOTIFY=y +# CONFIG_DNOTIFY is not set +CONFIG_INOTIFY_USER=y +# CONFIG_FANOTIFY is not set +# CONFIG_QUOTA is not set +CONFIG_AUTOFS4_FS=y +CONFIG_AUTOFS_FS=y +# CONFIG_FUSE_FS is not set +# CONFIG_OVERLAY_FS is not set + +# +# Caches +# +# CONFIG_FSCACHE is not set +# end of Caches + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set +# end of CD-ROM/DVD Filesystems + +# +# DOS/FAT/EXFAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_EXFAT_FS is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS3_FS is not set +# end of DOS/FAT/EXFAT/NT Filesystems + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PROC_CHILDREN=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +CONFIG_ARCH_SUPPORTS_HUGETLBFS=y +# CONFIG_HUGETLBFS is not set +CONFIG_MEMFD_CREATE=y +CONFIG_ARCH_HAS_GIGANTIC_PAGE=y +# CONFIG_CONFIGFS_FS is not set +# end of Pseudo filesystems + +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +# CONFIG_NLS_UTF8 is not set +# CONFIG_UNICODE is not set +# end of File systems + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_FORTIFY_SOURCE is not set +# CONFIG_STATIC_USERMODEHELPER is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,integrity,bpf" + +# +# Kernel hardening options +# + +# +# Memory initialization +# +CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y +CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y +CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y +CONFIG_INIT_STACK_NONE=y +# CONFIG_INIT_STACK_ALL_PATTERN is not set +# CONFIG_INIT_STACK_ALL_ZERO is not set +# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set +# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set +CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y +# CONFIG_ZERO_CALL_USED_REGS is not set +# end of Memory initialization + +CONFIG_RANDSTRUCT_NONE=y +# end of Kernel hardening options +# end of Security options + +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +# CONFIG_CRYPTO_MANAGER is not set +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set +# end of Crypto core or helper + +# +# Public-key cryptography +# +# CONFIG_CRYPTO_RSA is not set +# CONFIG_CRYPTO_DH is not set +# CONFIG_CRYPTO_ECDH is not set +# CONFIG_CRYPTO_ECDSA is not set +# CONFIG_CRYPTO_ECRDSA is not set +# CONFIG_CRYPTO_SM2 is not set +# CONFIG_CRYPTO_CURVE25519 is not set +# end of Public-key cryptography + +# +# Block ciphers +# +# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_AES_TI is not set +# CONFIG_CRYPTO_ARIA is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SM4_GENERIC is not set +# CONFIG_CRYPTO_TWOFISH is not set +# end of Block ciphers + +# +# Length-preserving ciphers and modes +# +# CONFIG_CRYPTO_ADIANTUM is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_CFB is not set +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_HCTR2 is not set +# CONFIG_CRYPTO_KEYWRAP is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_OFB is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# end of Length-preserving ciphers and modes + +# +# AEAD (authenticated encryption with associated data) ciphers +# +# CONFIG_CRYPTO_AEGIS128 is not set +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_SEQIV is not set +# CONFIG_CRYPTO_ECHAINIV is not set +# CONFIG_CRYPTO_ESSIV is not set +# end of AEAD (authenticated encryption with associated data) ciphers + +# +# Hashes, digests, and MACs +# +# CONFIG_CRYPTO_BLAKE2B is not set +# CONFIG_CRYPTO_CMAC is not set +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_HMAC is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_POLY1305 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_SHA1 is not set +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_SHA3 is not set +# CONFIG_CRYPTO_SM3_GENERIC is not set +# CONFIG_CRYPTO_STREEBOG is not set +# CONFIG_CRYPTO_VMAC is not set +# CONFIG_CRYPTO_WP512 is not set +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_XXHASH is not set +# end of Hashes, digests, and MACs + +# +# CRCs (cyclic redundancy checks) +# +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32 is not set +# CONFIG_CRYPTO_CRCT10DIF is not set +# end of CRCs (cyclic redundancy checks) + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set +# CONFIG_CRYPTO_ZSTD is not set +# end of Compression + +# +# Random number generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRYPTO_DRBG_MENU is not set +# CONFIG_CRYPTO_JITTERENTROPY is not set +# end of Random number generation + +# +# Userspace interface +# +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +# end of Userspace interface + +# CONFIG_CRYPTO_HW is not set + +# +# Certificates for signature checking +# +# end of Certificates for signature checking + +# +# Library routines +# +# CONFIG_PACKING is not set +CONFIG_BITREVERSE=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +# CONFIG_CORDIC is not set +# CONFIG_PRIME_NUMBERS is not set +CONFIG_RATIONAL=y +CONFIG_GENERIC_PCI_IOMAP=y + +# +# Crypto library routines +# +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +# CONFIG_CRYPTO_LIB_CHACHA is not set +# CONFIG_CRYPTO_LIB_CURVE25519 is not set +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1 +# CONFIG_CRYPTO_LIB_POLY1305 is not set +# CONFIG_CRYPTO_LIB_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_LIB_SHA1=y +# end of Crypto library routines + +# CONFIG_CRC_CCITT is not set +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +# CONFIG_CRC64_ROCKSOFT is not set +# CONFIG_CRC_ITU_T is not set +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC64 is not set +# CONFIG_CRC4 is not set +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZSTD_COMMON=y +CONFIG_ZSTD_DECOMPRESS=y +# CONFIG_XZ_DEC is not set +CONFIG_DECOMPRESS_ZSTD=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_DMA_DECLARE_COHERENT=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMA_MAP_BENCHMARK is not set +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_GENERIC_ATOMIC64=y +# CONFIG_IRQ_POLL is not set +CONFIG_LIBFDT=y +CONFIG_SG_POOL=y +CONFIG_ARCH_STACKWALK=y +CONFIG_SBITMAP=y +# end of Library routines + +CONFIG_GENERIC_IOREMAP=y +CONFIG_GENERIC_LIB_ASHLDI3=y +CONFIG_GENERIC_LIB_ASHRDI3=y +CONFIG_GENERIC_LIB_LSHRDI3=y +CONFIG_GENERIC_LIB_UCMPDI2=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +# CONFIG_PRINTK_CALLER is not set +# CONFIG_STACKTRACE_BUILD_ID is not set +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_CONSOLE_LOGLEVEL_QUIET=4 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set +# CONFIG_DYNAMIC_DEBUG_CORE is not set +CONFIG_SYMBOLIC_ERRNAME=y +CONFIG_DEBUG_BUGVERBOSE=y +# end of printk and dmesg options + +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_MISC is not set + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_NONE is not set +# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +CONFIG_DEBUG_INFO_DWARF5=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_COMPRESSED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +# CONFIG_GDB_SCRIPTS is not set +CONFIG_FRAME_WARN=2048 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_HEADERS_INSTALL is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_FRAME_POINTER=y +# CONFIG_VMLINUX_MAP is not set +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# end of Compile-time checks and compiler options + +# +# Generic Kernel Debugging Instruments +# +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_KGDB_QXFER_PKT=y +# CONFIG_KGDB is not set +CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y +# CONFIG_UBSAN is not set +CONFIG_HAVE_KCSAN_COMPILER=y +# end of Generic Kernel Debugging Instruments + +# +# Networking Debugging +# +# CONFIG_NET_DEV_REFCNT_TRACKER is not set +# CONFIG_NET_NS_REFCNT_TRACKER is not set +# CONFIG_DEBUG_NET is not set +# end of Networking Debugging + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_SLUB_DEBUG is not set +# CONFIG_PAGE_OWNER is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_RODATA_TEST is not set +CONFIG_ARCH_HAS_DEBUG_WX=y +# CONFIG_DEBUG_WX is not set +CONFIG_GENERIC_PTDUMP=y +# CONFIG_PTDUMP_DEBUGFS is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SHRINKER_DEBUG is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_VM_PGTABLE is not set +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +CONFIG_CC_HAS_KASAN_GENERIC=y +CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y +# end of Memory Debugging + +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Oops, Lockups and Hangs +# +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SOFTLOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_TEST_LOCKUP is not set +# end of Debug Oops, Lockups and Hangs + +# +# Scheduler Debugging +# +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# end of Scheduler Debugging + +# CONFIG_DEBUG_TIMEKEEPING is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +CONFIG_LOCK_DEBUGGING_SUPPORT=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_RWSEMS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_SCF_TORTURE_TEST is not set +# end of Lock Debugging (spinlocks, mutexes, etc...) + +# CONFIG_DEBUG_IRQFLAGS is not set +# CONFIG_STACKTRACE is not set +# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set +# CONFIG_DEBUG_KOBJECT is not set + +# +# Debug kernel data structures +# +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PLIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# CONFIG_DEBUG_MAPLE_TREE is not set +# end of Debug kernel data structures + +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_RCU_SCALE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# end of RCU Debugging + +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_LATENCYTOP is not set +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set +# CONFIG_SAMPLES is not set +# CONFIG_STRICT_DEVMEM is not set + +# +# riscv Debugging +# +# end of riscv Debugging + +# +# Kernel Testing and Coverage +# +# CONFIG_KUNIT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_ARCH_HAS_KCOV=y +CONFIG_CC_HAS_SANCOV_TRACE_PC=y +# CONFIG_KCOV is not set +# CONFIG_RUNTIME_TESTING_MENU is not set +CONFIG_ARCH_USE_MEMTEST=y +# CONFIG_MEMTEST is not set +# end of Kernel Testing and Coverage + +# +# Rust hacking +# +# end of Rust hacking +# end of Kernel hacking diff --git a/assets/wasm/html/index.html b/assets/wasm/html/index.html new file mode 100644 index 00000000..5beae7e6 --- /dev/null +++ b/assets/wasm/html/index.html @@ -0,0 +1,243 @@ + + + + + + Emscripten-Generated Code + + + + + +
+
Downloading...
+ + + Resize canvas + Lock/hide mouse pointer     + + + + + + + +
+ +
+ +
+ +
+ + + + + + + + diff --git a/assets/wasm/js/coi-serviceworker.min.js b/assets/wasm/js/coi-serviceworker.min.js new file mode 100644 index 00000000..117f9f89 --- /dev/null +++ b/assets/wasm/js/coi-serviceworker.min.js @@ -0,0 +1,2 @@ +/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */ +let coepCredentialless=!1;"undefined"==typeof window?(self.addEventListener("install",(()=>self.skipWaiting())),self.addEventListener("activate",(e=>e.waitUntil(self.clients.claim()))),self.addEventListener("message",(e=>{e.data&&("deregister"===e.data.type?self.registration.unregister().then((()=>self.clients.matchAll())).then((e=>{e.forEach((e=>e.navigate(e.url)))})):"coepCredentialless"===e.data.type&&(coepCredentialless=e.data.value))})),self.addEventListener("fetch",(function(e){const o=e.request;if("only-if-cached"===o.cache&&"same-origin"!==o.mode)return;const s=coepCredentialless&&"no-cors"===o.mode?new Request(o,{credentials:"omit"}):o;e.respondWith(fetch(s).then((e=>{if(0===e.status)return e;const o=new Headers(e.headers);return o.set("Cross-Origin-Embedder-Policy",coepCredentialless?"credentialless":"require-corp"),coepCredentialless||o.set("Cross-Origin-Resource-Policy","cross-origin"),o.set("Cross-Origin-Opener-Policy","same-origin"),new Response(e.body,{status:e.status,statusText:e.statusText,headers:o})})).catch((e=>console.error(e))))}))):(()=>{const e=window.sessionStorage.getItem("coiReloadedBySelf");window.sessionStorage.removeItem("coiReloadedBySelf");const o="coepdegrade"==e,s={shouldRegister:()=>!e,shouldDeregister:()=>!1,coepCredentialless:()=>!0,coepDegrade:()=>!0,doReload:()=>window.location.reload(),quiet:!1,...window.coi},r=navigator,t=r.serviceWorker&&r.serviceWorker.controller;t&&!window.crossOriginIsolated&&window.sessionStorage.setItem("coiCoepHasFailed","true");const i=window.sessionStorage.getItem("coiCoepHasFailed");if(t){const e=s.coepDegrade()&&!(o||window.crossOriginIsolated);r.serviceWorker.controller.postMessage({type:"coepCredentialless",value:!(e||i&&s.coepDegrade())&&s.coepCredentialless()}),e&&(!s.quiet&&console.log("Reloading page to degrade COEP."),window.sessionStorage.setItem("coiReloadedBySelf","coepdegrade"),s.doReload("coepdegrade")),s.shouldDeregister()&&r.serviceWorker.controller.postMessage({type:"deregister"})}!1===window.crossOriginIsolated&&s.shouldRegister()&&(window.isSecureContext?r.serviceWorker?r.serviceWorker.register(window.document.currentScript.src).then((e=>{!s.quiet&&console.log("COOP/COEP Service Worker registered",e.scope),e.addEventListener("updatefound",(()=>{!s.quiet&&console.log("Reloading page to make use of updated COOP/COEP Service Worker."),window.sessionStorage.setItem("coiReloadedBySelf","updatefound"),s.doReload()})),e.active&&!r.serviceWorker.controller&&(!s.quiet&&console.log("Reloading page to make use of COOP/COEP Service Worker."),window.sessionStorage.setItem("coiReloadedBySelf","notcontrolling"),s.doReload())}),(e=>{!s.quiet&&console.error("COOP/COEP Service Worker failed to register:",e)})):!s.quiet&&console.error("COOP/COEP Service Worker not registered, perhaps due to private mode."):!s.quiet&&console.log("COOP/COEP Service Worker not registered, a secure context is required."))})(); \ No newline at end of file diff --git a/assets/wasm/js/pre.js b/assets/wasm/js/pre.js new file mode 100644 index 00000000..c541967e --- /dev/null +++ b/assets/wasm/js/pre.js @@ -0,0 +1,9 @@ +Module['noInitialRun'] = true; +Module['onRuntimeInitialized'] = function(target_elf) { + if(target_elf === undefined){ + console.warn("target elf executable is undefined"); + return; + } + + callMain([target_elf]); +}; diff --git a/mk/external.mk b/mk/external.mk index 7f6893f9..05f5576c 100644 --- a/mk/external.mk +++ b/mk/external.mk @@ -21,21 +21,32 @@ define epilogue endef # $(1): compressed source URL +# if URL contains git command, then use git define download - $(eval _ := $(shell wget -q --show-progress --continue "$(strip $(1))")) + $(eval _ := \ + $(if $(findstring git,$(1)), \ + ($(eval _ := $(shell $(1)))), \ + ($(eval _ := $(shell wget -q --show-progress --continue "$(strip $(1))"))) \ + )) endef # $(1): destination directory # $(2): compressed source(.zip or.gz) +# For Buildroot and Linux kernel, no need to extract define extract $(eval COMPRESSED_SUFFIX := $(suffix $(2))) $(eval COMPRESSED_IS_ZIP := $(filter $(COMPRESSED_SUFFIX),.zip)) - $(eval _ := \ - $(if $(COMPRESSED_IS_ZIP), \ - ($(eval EXTRACTOR := unzip -d $(1) $(2))), \ - ($(eval EXTRACTOR := tar -xf $(2) -C $(1))) \ - )) - $(eval _ := $(shell $(EXTRACTOR))) + $(eval _ := \ + $(if $(findstring git,$(2)), \ + (# git is used, do nothing), \ + ($(eval _ := \ + $(if $(COMPRESSED_IS_ZIP), \ + ($(eval EXTRACTOR := unzip -d $(1) $(2))), \ + ($(eval EXTRACTOR := tar -xf $(2) -C $(1))) \ + )) \ + $(eval _ := $(shell $(EXTRACTOR)))) + ) \ + ) endef # $(1): correct SHA1 value @@ -51,7 +62,7 @@ define verify $(if $(filter 1,$(COMPRESSED_IS_DIR)), \ ($(eval VERIFIER := \ echo $(1) > $(SHA1_FILE1) \ - | find $(2) -type f -print0 \ + | find $(2) -type f -not -path '*/.git/*' -print0 \ | sort -z \ | xargs -0 $(SHA1SUM) \ | sort \ @@ -91,6 +102,18 @@ TIMIDITY_DATA_URL = http://www.libsdl.org/projects/mixer/timidity/timidity.tar.g TIMIDITY_DATA = $(OUT)/timidity TIMIDITY_DATA_SHA1 = cf6217a5d824b717ec4a07e15e6c129a4657ca25 +# Buildroot +BUILDROOT_VERSION = 2024.11 +BUILDROOT_DATA = /tmp/buildroot +BUILDROOT_DATA_URL = git clone https://github.com/buildroot/buildroot $(BUILDROOT_DATA) -b $(BUILDROOT_VERSION) --depth=1 +BUILDROOT_DATA_SHA1 = e678801287ab68369af1731dcf1acc39e4adccff + +# Linux kernel +LINUX_VERSION = linux-6.1.y +LINUX_DATA = /tmp/linux +LINUX_DATA_URL = git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git $(LINUX_DATA) -b $(LINUX_VERSION) --depth=1 +LINUX_DATA_SHA1 = 43b6b7fbf9231656d7b65f118445996172250fc0 + define download-extract-verify $($(T)_DATA): $(Q)$$(call prologue,$$@) @@ -100,5 +123,5 @@ $($(T)_DATA): $(Q)$$(call epilogue,$(notdir $($(T)_DATA_URL)),$(SHA1_FILE1),$(SHA1_FILE2)) endef -EXTERNAL_DATA = DOOM QUAKE TIMIDITY +EXTERNAL_DATA = DOOM QUAKE TIMIDITY BUILDROOT LINUX $(foreach T,$(EXTERNAL_DATA),$(eval $(download-extract-verify))) diff --git a/mk/tools.mk b/mk/tools.mk index 65577483..aefe0bba 100644 --- a/mk/tools.mk +++ b/mk/tools.mk @@ -21,6 +21,12 @@ $(OUT)/%.o: tools/%.c # GDBSTUB is disabled to exclude the mini-gdb during compilation. $(HIST_BIN): $(HIST_OBJS) $(VECHO) " LD\t$@\n" - $(Q)$(CC) -o $@ -D RV32_FEATURE_GDBSTUB=0 $^ $(LDFLAGS) + $(Q)$(CC) -o $@ -D RV32_FEATURE_GDBSTUB=0 $^ $(LDFLAGS) TOOLS_BIN += $(HIST_BIN) + +# Build Linux image +LINUX_IMAGE_SRC = $(BUILDROOT_DATA) $(LINUX_DATA) +build-linux-image: $(LINUX_IMAGE_SRC) + $(Q)./tools/build-linux-image.sh + $(Q)$(PRINTF) "Build done.\n" diff --git a/mk/wasm.mk b/mk/wasm.mk index 8043fb6a..ee59a865 100644 --- a/mk/wasm.mk +++ b/mk/wasm.mk @@ -1,6 +1,6 @@ CFLAGS_emcc ?= deps_emcc := -ASSETS := assets +ASSETS := assets/wasm WEB_HTML_RESOURCES := $(ASSETS)/html WEB_JS_RESOURCES := $(ASSETS)/js EXPORTED_FUNCS := _main,_indirect_rv_halt diff --git a/tools/build-linux-image.sh b/tools/build-linux-image.sh new file mode 100755 index 00000000..b6ee4e20 --- /dev/null +++ b/tools/build-linux-image.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +function ASSERT +{ + $* + RES=$? + if [ $RES -ne 0 ]; then + echo 'Assert failed: "' $* '"' + exit $RES + fi +} + +PASS_COLOR='\e[32;01m' +NO_COLOR='\e[0m' +function OK +{ + printf " [ ${PASS_COLOR} OK ${NO_COLOR} ]\n" +} + +SRC_DIR=/tmp + +PARALLEL="-j$(nproc)" + +OUTPUT_DIR=./build/linux-image/ + +function do_buildroot +{ + cp -f assets/system/configs/buildroot.config $SRC_DIR/buildroot/.config + cp -f assets/system/configs/busybox.config $SRC_DIR/buildroot/busybox.config + # Otherwise, the error below raises: + # You seem to have the current working directory in your + # LD_LIBRARY_PATH environment variable. This doesn't work. + unset LD_LIBRARY_PATH + pushd $SRC_DIR/buildroot + ASSERT make olddefconfig + ASSERT make $PARALLEL + popd + cp -f $SRC_DIR/buildroot/output/images/rootfs.cpio $OUTPUT_DIR +} + +function do_linux +{ + cp -f assets/system/configs/linux.config $SRC_DIR/linux/.config + export PATH="$SRC_DIR/buildroot/output/host/bin:$PATH" + export CROSS_COMPILE=riscv32-buildroot-linux-gnu- + export ARCH=riscv + pushd $SRC_DIR/linux + ASSERT make olddefconfig + ASSERT make $PARALLEL + popd + cp -f $SRC_DIR/linux/arch/riscv/boot/Image $OUTPUT_DIR +} + +do_buildroot && OK +do_linux && OK From 27157856eb25260d0c4fbc3cb5c9730eb54546ad Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Sun, 15 Dec 2024 00:11:36 +0800 Subject: [PATCH 3/5] CI: Add Linux booting verification The .ci/boot-linux.sh script has been introduced to automatically run booting verification. --- .ci/boot-linux.sh | 46 ++++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 11 ++++++--- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100755 .ci/boot-linux.sh diff --git a/.ci/boot-linux.sh b/.ci/boot-linux.sh new file mode 100755 index 00000000..df619ad0 --- /dev/null +++ b/.ci/boot-linux.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +function cleanup { + sleep 1 + pkill -9 rv32emu +} + +function ASSERT { + $* + local RES=$? + if [ $RES -ne 0 ]; then + echo 'Assert failed: "' $* '"' + exit $RES + fi +} + +cleanup + +TIMEOUT=50 +OPTS=" -k build/linux-image/Image " +OPTS+=" -i build/linux-image/rootfs.cpio " +OPTS+=" -b build/minimal.dtb " +RUN_LINUX="build/rv32emu ${OPTS}" + +ASSERT expect <> $GITHUB_PATH wget https://apt.llvm.org/llvm.sh @@ -67,11 +67,11 @@ jobs: - name: misalignment test in block emulation run: | make -C tests/system/alignment/ - make distclean && make ENABLE_EXT_C=0 ENABLE_SYSTEM=1 misalign-in-blk-emu -j$(nproc) + make distclean && make ENABLE_ELF_LOADER=1 ENABLE_EXT_C=0 ENABLE_SYSTEM=1 misalign-in-blk-emu -j$(nproc) - name: MMU test run: | make -C tests/system/mmu/ - make distclean && make ENABLE_SYSTEM=1 mmu-test -j$(nproc) + make distclean && make ENABLE_ELF_LOADER=1 ENABLE_SYSTEM=1 mmu-test -j$(nproc) - name: gdbstub test run: | make distclean && make ENABLE_GDBSTUB=1 gdbstub-test -j$(nproc) @@ -85,6 +85,11 @@ jobs: run: | make clean && make ENABLE_UBSAN=1 check -j$(nproc) make ENABLE_JIT=1 clean && make ENABLE_JIT=1 ENABLE_UBSAN=1 check -j$(nproc) + - name: boot Linux kernel test + run: | + make clean && make ENABLE_SYSTEM=1 && make ENABLE_SYSTEM=1 artifact -j$(nproc) + .ci/boot-linux.sh + make ENABLE_SYSTEM=1 clean host-arm64: needs: [detect-code-related-file-changes] From cdc7e2f97841febe00ac4ca6a04ea82810c47745 Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Sun, 15 Dec 2024 04:15:55 +0800 Subject: [PATCH 4/5] Introduce ablation study feature Block chaining and macro-operation (MOP) fusion are accelerator techniques designed to enhance performance. To conduct further ablation studies, two feature options, MOP_FUSION and BLOCK_CHAINING, are introduced. These features can be freely combined with the other emulator features. Ablation study of these two techniques in system emulation: | Metric | Block Chaining & | Block Chaining | MOP fusion | | | MOP fusion | | | |--------------------|------------------|----------------|------------| | Dhrystone (DMIPS) | 175 | 123 | 175 | | (1000000 runs) | | | | | | | | | | Coremark (Iter/s) | 222 | 204 | 222 | --- Makefile | 8 ++++++++ src/emulate.c | 4 ++++ src/feature.h | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/Makefile b/Makefile index 79253124..f0928fde 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,14 @@ CFLAGS += -include src/common.h -Isrc/ ENABLE_ELF_LOADER ?= 0 $(call set-feature, ELF_LOADER) +# Enable MOP fusion, easier for ablation study +ENABLE_MOP_FUSION ?= 1 +$(call set-feature, MOP_FUSION) + +# Enable block chaining, easier for ablation study +ENABLE_BLOCK_CHAINING ?= 1 +$(call set-feature, BLOCK_CHAINING) + # Enable system emulation ENABLE_SYSTEM ?= 0 $(call set-feature, SYSTEM) diff --git a/src/emulate.c b/src/emulate.c index 6d2669d1..293ce031 100644 --- a/src/emulate.c +++ b/src/emulate.c @@ -865,8 +865,10 @@ static block_t *block_find_or_translate(riscv_t *rv) #if RV32_HAS(GDBSTUB) if (likely(!rv->debug_mode)) #endif +#if RV32_HAS(MOP_FUSION) /* macro operation fusion */ match_pattern(rv, next_blk); +#endif #if !RV32_HAS(JIT) /* insert the block into block map */ @@ -1027,6 +1029,7 @@ void rv_step(void *arg) * the previous block. */ +#if RV32_HAS(BLOCK_CHAINING) if (prev) { rv_insn_t *last_ir = prev->ir_tail; /* chain block */ @@ -1042,6 +1045,7 @@ void rv_step(void *arg) } } } +#endif last_pc = rv->PC; #if RV32_HAS(JIT) #if RV32_HAS(T2C) diff --git a/src/feature.h b/src/feature.h index 6c33110a..a8956b47 100644 --- a/src/feature.h +++ b/src/feature.h @@ -73,5 +73,15 @@ #define RV32_FEATURE_ELF_LOADER 0 #endif +/* MOP fusion */ +#ifndef RV32_FEATURE_MOP_FUSION +#define RV32_FEATURE_MOP_FUSION 1 +#endif + +/* Block chaining */ +#ifndef RV32_FEATURE_BLOCK_CHAINING +#define RV32_FEATURE_BLOCK_CHAINING 1 +#endif + /* Feature test macro */ #define RV32_HAS(x) RV32_FEATURE_##x From 3ef4675e535c60b66697d281ceaf495771d08374 Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Sun, 15 Dec 2024 00:11:44 +0800 Subject: [PATCH 5/5] Update README Mention experimental system emulation and explain how to build custom Linux image. In addition, introduce the ablation study features for performance analysis. --- README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d27edf33..e1251de3 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,34 @@ If you don't want the JIT compilation feature, simply build with the following: $ make ``` +### Experimental system emulation +Device Tree compiler (dtc) is required. To install it on Debian/Ubuntu Linux, enter the following command: +``` +$ sudo apt install device-tree-compiler +``` +For macOS, use the following command: +``` +$ brew install dtc +``` + +#### Build and run system emulation +Build and run using default images (the default images will be fetched from [rv32emu-prebuilt](https://github.com/sysprog21/rv32emu-prebuilt) before running): +```shell +$ make ENABLE_SYSTEM=1 system +``` + +Build using run using specified images: +```shell +$ make ENABLE_SYSTEM=1 +$ build/rv32emu -k -i -b +``` + +#### Build Linux image +An automated build script is provided to compile the RISC-V cross-compiler, Busybox, and Linux kernel from source. Please note that it only supports the Linux host environment. It can be found at tools/build-linux-image.sh. +``` +$ make build-linux-img +``` + ### Verify with prebuilt RISC-V ELF files Run sample RV32I[M] programs: @@ -98,7 +126,9 @@ The image containing all the necessary tools for development and testing can be * `ENABLE_FULL4G` : Full access to 4 GiB address space * `ENABLE_SDL` : Experimental Display and Event System Calls * `ENABLE_JIT` : Experimental JIT compiler -* `ENABLE_SYSTEM` : Experimental system emulation, allowing booting Linux kernel +* `ENABLE_SYSTEM`: Experimental system emulation, allowing booting Linux kernel. To enable this feature, additional features must also be enabled. However, by default, when `ENABLE_SYSTEM` is enabled, CSR, fence, integer multiplication/division, and atomic Instructions are automatically enabled +* `ENABLE_MOP_FUSION` : Macro-operation fusion +* `ENABLE_BLOCK_CHAINING` : Block chaining of translated blocks e.g., run `make ENABLE_EXT_F=0` for the build without floating-point support. @@ -145,7 +175,7 @@ For macOS users, installing `sdiff` might be required: $ brew install diffutils ``` -To run the tests for specific extension, set the environmental variable `RISCV_DEVICE` to one of `I`, `M`, `A`, `F`, `C`, `Zifencei`, `privilege`. +To run the tests for specific extension, set the environmental variable `RISCV_DEVICE` to one of `I`, `M`, `A`, `F`, `C`, `Zifencei`, `privilege`, `SYSTEM`. ```shell $ make arch-test RISCV_DEVICE=I ```