summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2020-02-16 12:28:47 (GMT)
committerWaldemar Brodkorb <wbx@openadk.org>2020-02-17 12:20:23 (GMT)
commitbc6956f08c225304cfb62b7314a660f52701d30c (patch)
tree9ad4f384be743de2a152a1fa81503978d7a5f58a
parent7025cc5131adbafb70a7f6715cb8d17f0446ec58 (diff)
riscv64: use upstream Linux kernel
-rw-r--r--mk/linux-ver.mk6
-rw-r--r--target/config/Config.in.abi16
-rw-r--r--target/config/Config.in.cpu37
-rw-r--r--target/linux/Config.in.kernelversion20
-rw-r--r--target/linux/patches/5.4.18/or1k-more-ram.patch (renamed from target/linux/patches/5.3.6/or1k-more-ram.patch)0
-rw-r--r--target/riscv32/Makefile47
-rw-r--r--target/riscv32/systems/qemu-riscv321
-rw-r--r--target/riscv32/uclibc-ng.config241
-rw-r--r--target/riscv64/Makefile31
-rw-r--r--target/riscv64/kernel/qemu-riscv642
-rw-r--r--target/riscv64/systems/qemu-riscv641
11 files changed, 336 insertions, 66 deletions
diff --git a/mk/linux-ver.mk b/mk/linux-ver.mk
index b61c109..9815e5a 100644
--- a/mk/linux-ver.mk
+++ b/mk/linux-ver.mk
@@ -15,11 +15,11 @@ KERNEL_FILE_VER:= $(ADK_TARGET_LINUX_KERNEL_GIT)
KERNEL_RELEASE:= 1
KERNEL_VERSION:= $(ADK_TARGET_LINUX_KERNEL_GIT_VER)-$(KERNEL_RELEASE)
endif
-ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_5_3),y)
-KERNEL_FILE_VER:= 5.3.6
+ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_5_4),y)
+KERNEL_FILE_VER:= 5.4.18
KERNEL_RELEASE:= 1
KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE)
-KERNEL_HASH:= e84021a94784de7bb10e4251fb1a87859a8d1c97bd78fb55ad47ab6ce475ec1f
+KERNEL_HASH:= 92e9f1fd69543e9ce2a9e6eb918823b1846d2dd99246a74456263cd5ad234d89
endif
ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_4_19),y)
KERNEL_FILE_VER:= 4.19.99
diff --git a/target/config/Config.in.abi b/target/config/Config.in.abi
index 1b34ec6..14a2dcc 100644
--- a/target/config/Config.in.abi
+++ b/target/config/Config.in.abi
@@ -67,11 +67,11 @@ config ADK_TARGET_ABI_RISCV
depends on ADK_TARGET_ARCH_RISCV32 || ADK_TARGET_ARCH_RISCV64
string
default "lp64" if ADK_TARGET_ABI_LP64
- default "lp64d" if ADK_TARGET_ABI_LP64D
default "lp64f" if ADK_TARGET_ABI_LP64F
- default "ilp32" if ADK_TARGET_ABI_ILP64
- default "ilp32d" if ADK_TARGET_ABI_ILP64D
- default "ilp32f" if ADK_TARGET_ABI_ILP64F
+ default "lp64d" if ADK_TARGET_ABI_LP64D
+ default "ilp32" if ADK_TARGET_ABI_ILP32
+ default "ilp32f" if ADK_TARGET_ABI_ILP32F
+ default "ilp32d" if ADK_TARGET_ABI_ILP32D
config ADK_TARGET_ABI_MIPS64
depends on ADK_TARGET_ARCH_MIPS64
@@ -94,11 +94,11 @@ config ADK_TARGET_LIBC_PATH
config ADK_TARGET_LIBC_ABI_PATH
string
default "lib/lp64" if ADK_TARGET_ABI_LP64
- default "lib/lp64d" if ADK_TARGET_ABI_LP64D
default "lib/lp64f" if ADK_TARGET_ABI_LP64F
- default "lib/ilp32" if ADK_TARGET_ABI_ILP64
- default "lib/ilp32d" if ADK_TARGET_ABI_ILP64D
- default "lib/ilp32f" if ADK_TARGET_ABI_ILP64F
+ default "lib/lp64d" if ADK_TARGET_ABI_LP64D
+ default "lib/ilp32" if ADK_TARGET_ABI_ILP32
+ default "lib/ilp32f" if ADK_TARGET_ABI_ILP32F
+ default "lib/ilp32d" if ADK_TARGET_ABI_ILP32D
default "lib"
config ADK_TARGET_ABI_CFLAGS
diff --git a/target/config/Config.in.cpu b/target/config/Config.in.cpu
index be8cdb1..59cc636 100644
--- a/target/config/Config.in.cpu
+++ b/target/config/Config.in.cpu
@@ -1093,29 +1093,29 @@ config ADK_TARGET_CPU_PPC64_POWERPC64
depends on ADK_TARGET_BIG_ENDIAN
# riscv
-config ADK_TARGET_CPU_RISCV32_RV32IMAFDC
- bool "rv32imafdc"
+config ADK_TARGET_CPU_RISCV32_RV32IMAC
+ bool "rv32imac"
select ADK_TARGET_SUPPORTS_THREADS
select ADK_TARGET_SUPPORTS_NPTL
select ADK_TARGET_WITH_MMU
- select ADK_TARGET_ABI_ILP32D
+ select ADK_TARGET_ABI_ILP32
depends on ADK_TARGET_ARCH_RISCV32
-config ADK_TARGET_CPU_RISCV32_RV32IMAC
- bool "rv32imac"
+config ADK_TARGET_CPU_RISCV32_RV32IMAFC
+ bool "rv32imafc"
select ADK_TARGET_SUPPORTS_THREADS
select ADK_TARGET_SUPPORTS_NPTL
select ADK_TARGET_WITH_MMU
- select ADK_TARGET_ABI_ILP32
+ select ADK_TARGET_ABI_ILP32F
depends on ADK_TARGET_ARCH_RISCV32
-config ADK_TARGET_CPU_RISCV64_RV64IMAFDC
- bool "rv64imafdc"
+config ADK_TARGET_CPU_RISCV32_RV32IMADC
+ bool "rv32imadc"
select ADK_TARGET_SUPPORTS_THREADS
select ADK_TARGET_SUPPORTS_NPTL
select ADK_TARGET_WITH_MMU
- select ADK_TARGET_ABI_LP64D
- depends on ADK_TARGET_ARCH_RISCV64
+ select ADK_TARGET_ABI_ILP32D
+ depends on ADK_TARGET_ARCH_RISCV32
config ADK_TARGET_CPU_RISCV64_RV64IMAC
bool "rv64imac"
@@ -1125,6 +1125,23 @@ config ADK_TARGET_CPU_RISCV64_RV64IMAC
select ADK_TARGET_ABI_LP64
depends on ADK_TARGET_ARCH_RISCV64
+config ADK_TARGET_CPU_RISCV64_RV64IMAFC
+ bool "rv64imafc"
+ select ADK_TARGET_SUPPORTS_THREADS
+ select ADK_TARGET_SUPPORTS_NPTL
+ select ADK_TARGET_WITH_MMU
+ select ADK_TARGET_ABI_LP64F
+ depends on ADK_TARGET_ARCH_RISCV64
+
+config ADK_TARGET_CPU_RISCV64_RV64IMADC
+ bool "rv64imadc"
+ select ADK_TARGET_SUPPORTS_THREADS
+ select ADK_TARGET_SUPPORTS_NPTL
+ select ADK_TARGET_WITH_MMU
+ select ADK_TARGET_ABI_LP64D
+ depends on ADK_TARGET_ARCH_RISCV64
+
+
# rx
config ADK_TARGET_CPU_RX
bool "rx"
diff --git a/target/linux/Config.in.kernelversion b/target/linux/Config.in.kernelversion
index 33bfbc1..b67ec66 100644
--- a/target/linux/Config.in.kernelversion
+++ b/target/linux/Config.in.kernelversion
@@ -14,8 +14,6 @@ default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_SYSTEM_KINETIS_K70
default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_SYSTEM_ADSP_BF537
default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_SYSTEM_PHYTEC_WEGA
default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_ARCH_LM32
-default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_ARCH_RISCV32
-default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_ARCH_RISCV64
default ADK_TARGET_LINUX_KERNEL_VERSION_4_4 if ADK_TARGET_ARCH_CRIS
default ADK_TARGET_LINUX_KERNEL_VERSION_4_4 if ADK_TARGET_ARCH_H8300
default ADK_TARGET_LINUX_KERNEL_VERSION_4_4 if ADK_TARGET_ARCH_METAG
@@ -25,7 +23,9 @@ default ADK_TARGET_LINUX_KERNEL_VERSION_4_9 if ADK_TARGET_ARCH_FRV
default ADK_TARGET_LINUX_KERNEL_VERSION_4_9 if ADK_TARGET_CPU_ARM_ARM11MPCORE
default ADK_TARGET_LINUX_KERNEL_VERSION_4_9 if ADK_TARGET_CPU_ARM_CORTEX_A53
default ADK_TARGET_LINUX_KERNEL_VERSION_4_14 if ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB
-default ADK_TARGET_LINUX_KERNEL_VERSION_5_3 if ADK_TARGET_ARCH_CSKY
+default ADK_TARGET_LINUX_KERNEL_VERSION_5_4 if ADK_TARGET_ARCH_CSKY
+default ADK_TARGET_LINUX_KERNEL_VERSION_5_4 if ADK_TARGET_ARCH_RISCV32
+default ADK_TARGET_LINUX_KERNEL_VERSION_5_4 if ADK_TARGET_ARCH_RISCV64
default ADK_TARGET_LINUX_KERNEL_VERSION_4_19
config ADK_TARGET_LINUX_KERNEL_VERSION_GIT
@@ -39,8 +39,8 @@ config ADK_TARGET_LINUX_KERNEL_VERSION_GIT
select ADK_TARGET_LINUX_KERNEL_IMAGE if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
select ADK_TARGET_LINUX_KERNEL_IMAGE if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
-config ADK_TARGET_LINUX_KERNEL_VERSION_5_3
- bool "5.3.6"
+config ADK_TARGET_LINUX_KERNEL_VERSION_5_4
+ bool "5.4.18"
select ADK_TARGET_LINUX_KERNEL_NEW
depends on !ADK_TARGET_ARCH_AVR32
depends on !ADK_TARGET_ARCH_BFIN
@@ -167,8 +167,6 @@ config ADK_TARGET_LINUX_KERNEL_GIT_REPO
default "https://github.com/beagleboard/linux.git" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
default "https://git.phytec.de/git/linux-ti.git" if ADK_TARGET_SYSTEM_PHYTEC_WEGA
default "https://github.com/shenki/linux-lm32.git" if ADK_TARGET_ARCH_LM32
- default "https://github.com/riscv/riscv-linux.git" if ADK_TARGET_ARCH_RISCV32
- default "https://github.com/riscv/riscv-linux.git" if ADK_TARGET_ARCH_RISCV64
default "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
help
GIT repository to use.
@@ -177,8 +175,6 @@ config ADK_TARGET_LINUX_KERNEL_GIT_REPO_NAME
string
depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT
default "lm32" if ADK_TARGET_ARCH_LM32
- default "riscv" if ADK_TARGET_ARCH_RISCV32
- default "riscv" if ADK_TARGET_ARCH_RISCV64
default "rpi" if ADK_TARGET_BOARD_BCM28XX
default "ad" if ADK_TARGET_SYSTEM_ADSP_BF537
default "bb" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
@@ -198,15 +194,11 @@ config ADK_TARGET_LINUX_KERNEL_GIT
default "902739f3353150ac9eb69ad995098f3079d862a3" if ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG
default "c85fbc86c61a8c8fd45ab1fe3d1bdd2df12f7962" if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
default "8624998967676862843aed1f8ee2141e98987f81" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
- default "riscv-linux-4.18" if ADK_TARGET_ARCH_RISCV32
- default "riscv-linux-4.18" if ADK_TARGET_ARCH_RISCV64
default "v4.4.52-phy" if ADK_TARGET_SYSTEM_PHYTEC_WEGA
config ADK_TARGET_LINUX_KERNEL_GIT_VER
string "kernel version"
depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT
- default "4.18.0" if ADK_TARGET_ARCH_RISCV32
- default "4.18.0" if ADK_TARGET_ARCH_RISCV64
default "4.14.43" if ADK_TARGET_BOARD_BCM28XX
default "4.4.37" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
default "4.4.52" if ADK_TARGET_SYSTEM_PHYTEC_WEGA
@@ -217,8 +209,6 @@ config ADK_TARGET_LINUX_KERNEL_GIT_VER
config ADK_TARGET_LINUX_KERNEL_GIT_TYPE
string
depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT
- default "branch" if ADK_TARGET_ARCH_RISCV32
- default "branch" if ADK_TARGET_ARCH_RISCV64
default "branch" if ADK_TARGET_SYSTEM_PHYTEC_WEGA
default "hash"
diff --git a/target/linux/patches/5.3.6/or1k-more-ram.patch b/target/linux/patches/5.4.18/or1k-more-ram.patch
index de848c8..de848c8 100644
--- a/target/linux/patches/5.3.6/or1k-more-ram.patch
+++ b/target/linux/patches/5.4.18/or1k-more-ram.patch
diff --git a/target/riscv32/Makefile b/target/riscv32/Makefile
index 9b26809..37750d7 100644
--- a/target/riscv32/Makefile
+++ b/target/riscv32/Makefile
@@ -5,15 +5,35 @@ include $(ADK_TOPDIR)/rules.mk
include $(ADK_TOPDIR)/mk/kernel-build.mk
include $(ADK_TOPDIR)/mk/image.mk
-KERNEL:=$(LINUX_DIR)/vmlinux
-OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
-QEMU_ARGS:=-nographic
+KERNEL:=$(LINUX_DIR)/arch/riscv/boot/Image
+QEMU_ARGS:=-M virt -m 256 -nographic -device loader,file=$(FW_DIR)/$(TARGET_KERNEL),addr=0x80200000
+ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
+QEMU_ARGS+=-netdev user,id=eth0 -device virtio-net-device,netdev=eth0
+endif
+ifeq ($(ADK_TARGET_FS),archive)
+QEMU_ARGS+=-device virtio-blk-device,drive=vda -drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=none,id=vda,format=raw
+endif
# target helper text
+ifeq ($(ADK_TARGET_FS),archive)
+targethelp:
+ @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
+ifeq ($(ADK_TARGET_QEMU),y)
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo "Use following command to create a QEMU Image:"
+ @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
+ @echo "Start qemu with following options:"
+ @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/fw_jump.elf'
+endif
+endif
ifeq ($(ADK_TARGET_FS),initramfs)
targethelp:
@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
@echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
+ifeq ($(ADK_TARGET_QEMU),y)
+ @echo "Start qemu with following command line:"
+ @echo 'qemu-system-riscv32 ${QEMU_ARGS} -kernel $(FW_DIR)/fw_jump.elf -initrd ${FW_DIR}/${INITRAMFS}'
+endif
endif
ifeq ($(ADK_TARGET_FS),initramfsarchive)
targethelp:
@@ -23,23 +43,24 @@ endif
ifeq ($(ADK_TARGET_FS),initramfspiggyback)
targethelp:
@echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
+ifeq ($(ADK_TARGET_QEMU),y)
+ @echo "Start qemu with following command line:"
+ @echo 'qemu-system-riscv32 ${QEMU_ARGS} -kernel $(FW_DIR)/fw_jump.elf'
+endif
endif
kernel-strip:
- $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
kernel-install: kernel-strip
- @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
+ @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
bbl:
- @mkdir -p $(BUILD_DIR)/bbl
- @rm -rf $(BUILD_DIR)/riscv-pk
- (cd $(BUILD_DIR)/ && git clone https://github.com/riscv/riscv-pk.git)
- (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' ../riscv-pk/configure \
- --host=$(GNU_TARGET_NAME) --target=$(GNU_TARGET_NAME) \
- --with-payload=$(FW_DIR)/$(TARGET_KERNEL))
- (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' make)
- cp $(BUILD_DIR)/bbl/bbl $(FW_DIR)/$(TARGET_KERNEL).bbl
+ @rm -rf $(BUILD_DIR)/opensbi
+ (cd $(BUILD_DIR)/ && git clone https://github.com/riscv/opensbi.git)
+ (cd $(BUILD_DIR)/opensbi && PATH='$(HOST_PATH)' \
+ CROSS_COMPILE=$(GNU_TARGET_NAME)- \
+ PLATFORM=qemu/virt make)
+ cp $(BUILD_DIR)/opensbi/build/platform/qemu/virt/firmware/fw_jump.elf $(FW_DIR)
# filesystem specific targets
ifeq ($(ADK_TARGET_FS),initramfs)
diff --git a/target/riscv32/systems/qemu-riscv32 b/target/riscv32/systems/qemu-riscv32
index 28f4000..a9f1d9c 100644
--- a/target/riscv32/systems/qemu-riscv32
+++ b/target/riscv32/systems/qemu-riscv32
@@ -2,6 +2,7 @@ config ADK_TARGET_SYSTEM_QEMU_RISCV32
bool "Qemu Emulator"
select ADK_TARGET_QEMU
select ADK_TARGET_CPU_RISCV32
+ select ADK_TARGET_KERNEL_IMAGE
help
Qemu Emulator for RISCV32 architecture.
diff --git a/target/riscv32/uclibc-ng.config b/target/riscv32/uclibc-ng.config
new file mode 100644
index 0000000..520ff6f
--- /dev/null
+++ b/target/riscv32/uclibc-ng.config
@@ -0,0 +1,241 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# uClibc-ng 1.0.32 C Library Configuration
+#
+# TARGET_aarch64 is not set
+# TARGET_alpha is not set
+# TARGET_arc is not set
+# TARGET_arm is not set
+# TARGET_avr32 is not set
+# TARGET_bfin is not set
+# TARGET_c6x is not set
+# TARGET_cris is not set
+# TARGET_csky is not set
+# TARGET_frv is not set
+# TARGET_h8300 is not set
+# TARGET_hppa is not set
+# TARGET_i386 is not set
+# TARGET_ia64 is not set
+# TARGET_lm32 is not set
+# TARGET_m68k is not set
+# TARGET_metag is not set
+# TARGET_microblaze is not set
+# TARGET_mips is not set
+# TARGET_nds32 is not set
+# TARGET_nios2 is not set
+# TARGET_or1k is not set
+# TARGET_powerpc is not set
+TARGET_riscv32=y
+# TARGET_riscv64 is not set
+# TARGET_sh is not set
+# TARGET_sparc is not set
+# TARGET_sparc64 is not set
+# TARGET_tile is not set
+# TARGET_x86_64 is not set
+# TARGET_xtensa is not set
+
+#
+# Target Architecture Features and Options
+#
+TARGET_ARCH="riscv32"
+FORCE_OPTIONS_FOR_ARCH=y
+TARGET_SUBARCH=""
+
+#
+# Using ELF file format
+#
+ARCH_LITTLE_ENDIAN=y
+
+#
+# Using Little Endian
+#
+ARCH_HAS_MMU=y
+ARCH_USE_MMU=y
+UCLIBC_HAS_FLOATS=y
+UCLIBC_HAS_FPU=y
+DO_C99_MATH=y
+DO_XSI_MATH=y
+UCLIBC_HAS_LONG_DOUBLE_MATH=y
+KERNEL_HEADERS=""
+HAVE_DOT_CONFIG=y
+
+#
+# General Library Settings
+#
+DOPIC=y
+HAVE_SHARED=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+LDSO_PRELOAD_ENV_SUPPORT=y
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+# LDSO_STANDALONE_SUPPORT is not set
+# LDSO_PRELINK_SUPPORT is not set
+UCLIBC_STATIC_LDCONFIG=y
+LDSO_RUNPATH=y
+# LDSO_RUNPATH_OF_EXECUTABLE is not set
+LDSO_SAFE_RUNPATH=y
+LDSO_SEARCH_INTERP_PATH=y
+LDSO_LD_LIBRARY_PATH=y
+UCLIBC_CTOR_DTOR=y
+# LDSO_GNU_HASH_SUPPORT is not set
+# HAS_NO_THREADS is not set
+# UCLIBC_HAS_LINUXTHREADS is not set
+UCLIBC_HAS_THREADS_NATIVE=y
+UCLIBC_HAS_THREADS=y
+UCLIBC_HAS_TLS=y
+# PTHREADS_DEBUG_SUPPORT is not set
+UCLIBC_HAS_SYSLOG=y
+UCLIBC_HAS_LFS=y
+# MALLOC is not set
+# MALLOC_SIMPLE is not set
+MALLOC_STANDARD=y
+UCLIBC_DYNAMIC_ATEXIT=y
+UCLIBC_HAS_UTMPX=y
+UCLIBC_HAS_UTMP=y
+UCLIBC_SUSV2_LEGACY=y
+UCLIBC_SUSV3_LEGACY=y
+# UCLIBC_SUSV3_LEGACY_MACROS is not set
+UCLIBC_SUSV4_LEGACY=y
+# UCLIBC_STRICT_HEADERS is not set
+# UCLIBC_HAS_STUBS is not set
+UCLIBC_HAS_SHADOW=y
+UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
+UCLIBC_HAS___PROGNAME=y
+UCLIBC_HAS_PTY=y
+ASSUME_DEVPTS=y
+UNIX98PTY_ONLY=y
+UCLIBC_HAS_GETPT=y
+UCLIBC_HAS_LIBUTIL=y
+UCLIBC_HAS_TM_EXTENSIONS=y
+UCLIBC_HAS_TZ_CACHING=y
+UCLIBC_HAS_TZ_FILE=y
+UCLIBC_HAS_TZ_FILE_READ_MANY=y
+UCLIBC_TZ_FILE_PATH="/etc/TZ"
+UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
+
+#
+# Advanced Library Settings
+#
+UCLIBC_PWD_BUFFER_SIZE=256
+UCLIBC_GRP_BUFFER_SIZE=256
+
+#
+# Support various families of functions
+#
+UCLIBC_LINUX_SPECIFIC=y
+UCLIBC_HAS_GNU_ERROR=y
+UCLIBC_BSD_SPECIFIC=y
+UCLIBC_HAS_BSD_ERR=y
+UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
+# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
+# UCLIBC_NTP_LEGACY is not set
+UCLIBC_SV4_DEPRECATED=y
+UCLIBC_HAS_REALTIME=y
+UCLIBC_HAS_ADVANCED_REALTIME=y
+UCLIBC_HAS_EPOLL=y
+UCLIBC_HAS_XATTR=y
+# UCLIBC_HAS_PROFILING is not set
+UCLIBC_HAS_CRYPT_IMPL=y
+UCLIBC_HAS_SHA256_CRYPT_IMPL=y
+UCLIBC_HAS_SHA512_CRYPT_IMPL=y
+UCLIBC_HAS_CRYPT=y
+UCLIBC_HAS_NETWORK_SUPPORT=y
+UCLIBC_HAS_SOCKET=y
+UCLIBC_HAS_IPV4=y
+UCLIBC_HAS_IPV6=y
+UCLIBC_USE_NETLINK=y
+UCLIBC_SUPPORT_AI_ADDRCONFIG=y
+UCLIBC_HAS_BSD_RES_CLOSE=y
+UCLIBC_HAS_COMPAT_RES_STATE=y
+# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
+UCLIBC_HAS_RESOLVER_SUPPORT=y
+
+#
+# String and Stdio Support
+#
+UCLIBC_HAS_STRING_GENERIC_OPT=y
+UCLIBC_HAS_STRING_ARCH_OPT=y
+UCLIBC_HAS_STDIO_FUTEXES=y
+UCLIBC_HAS_CTYPE_TABLES=y
+UCLIBC_HAS_CTYPE_SIGNED=y
+# UCLIBC_HAS_CTYPE_UNSAFE is not set
+UCLIBC_HAS_CTYPE_CHECKED=y
+# UCLIBC_HAS_CTYPE_ENFORCED is not set
+UCLIBC_HAS_WCHAR=y
+# UCLIBC_HAS_LIBICONV is not set
+# UCLIBC_HAS_LIBINTL is not set
+# UCLIBC_HAS_LOCALE is not set
+# UCLIBC_HAS_HEXADECIMAL_FLOATS is not set
+UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
+UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
+# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
+UCLIBC_HAS_STDIO_BUFSIZ_4096=y
+# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
+UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
+# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
+UCLIBC_HAS_STDIO_GETC_MACRO=y
+UCLIBC_HAS_STDIO_PUTC_MACRO=y
+UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
+# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
+UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
+UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE=y
+UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
+UCLIBC_HAS_PRINTF_M_SPEC=y
+UCLIBC_HAS_ERRNO_MESSAGES=y
+# UCLIBC_HAS_SYS_ERRLIST is not set
+UCLIBC_HAS_SIGNUM_MESSAGES=y
+# UCLIBC_HAS_SYS_SIGLIST is not set
+UCLIBC_HAS_GNU_GETOPT=y
+UCLIBC_HAS_GETOPT_LONG=y
+UCLIBC_HAS_GNU_GETSUBOPT=y
+UCLIBC_HAS_ARGP=y
+
+#
+# Big and Tall
+#
+UCLIBC_HAS_REGEX=y
+UCLIBC_HAS_FNMATCH=y
+UCLIBC_HAS_WORDEXP=y
+UCLIBC_HAS_NFTW=y
+UCLIBC_HAS_FTW=y
+UCLIBC_HAS_FTS=y
+UCLIBC_HAS_GLOB=y
+UCLIBC_HAS_GNU_GLOB=y
+
+#
+# Library Installation Options
+#
+RUNTIME_PREFIX="/"
+DEVEL_PREFIX="/usr/"
+MULTILIB_DIR="lib"
+HARDWIRED_ABSPATH=y
+
+#
+# Security options
+#
+# UCLIBC_HAS_SSP is not set
+UCLIBC_BUILD_RELRO=y
+# UCLIBC_BUILD_NOW is not set
+UCLIBC_BUILD_NOEXECSTACK=y
+
+#
+# Development/debugging options
+#
+CROSS_COMPILER_PREFIX=""
+UCLIBC_EXTRA_CFLAGS=""
+# DODEBUG is not set
+# DOSTRIP is not set
+# DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
+# UCLIBC_MALLOC_DEBUGGING is not set
+# UCLIBC_HAS_BACKTRACE is not set
+WARNINGS="-Wall"
+# EXTRA_WARNINGS is not set
diff --git a/target/riscv64/Makefile b/target/riscv64/Makefile
index bc31d62..892b88e 100644
--- a/target/riscv64/Makefile
+++ b/target/riscv64/Makefile
@@ -5,8 +5,7 @@ include $(ADK_TOPDIR)/rules.mk
include $(ADK_TOPDIR)/mk/kernel-build.mk
include $(ADK_TOPDIR)/mk/image.mk
-KERNEL:=$(LINUX_DIR)/vmlinux
-OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
+KERNEL:=$(LINUX_DIR)/arch/riscv/boot/Image
QEMU_ARGS:=-M virt -m 256 -nographic
ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
QEMU_ARGS+=-netdev user,id=eth0 -device virtio-net-device,netdev=eth0
@@ -51,31 +50,29 @@ endif
endif
kernel-strip:
- $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
kernel-install: kernel-strip
- @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
-bbl:
- @mkdir -p $(BUILD_DIR)/bbl
- @rm -rf $(BUILD_DIR)/riscv-pk
- (cd $(BUILD_DIR)/ && git clone https://github.com/riscv/riscv-pk.git)
- (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' ../riscv-pk/configure \
- --host=$(GNU_TARGET_NAME) --target=$(GNU_TARGET_NAME) \
- --with-payload=$(FW_DIR)/$(TARGET_KERNEL))
- (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' make)
- cp $(BUILD_DIR)/bbl/bbl $(FW_DIR)/$(TARGET_KERNEL)
+boot:
+ @rm -rf $(BUILD_DIR)/opensbi
+ (cd $(BUILD_DIR)/ && git clone https://github.com/riscv/opensbi.git)
+ (cd $(BUILD_DIR)/opensbi && PATH='$(HOST_PATH)' \
+ CROSS_COMPILE=$(GNU_TARGET_NAME)- \
+ FW_PAYLOAD_PATH=$(KERNEL) \
+ PLATFORM=qemu/virt make)
+ cp $(BUILD_DIR)/opensbi/build/platform/qemu/virt/firmware/fw_payload.elf \
+ $(FW_DIR)/$(TARGET_KERNEL)
# filesystem specific targets
ifeq ($(ADK_TARGET_FS),archive)
-imageinstall: kernel-install bbl $(FW_DIR)/$(ROOTFSTARBALL) targethelp
+imageinstall: kernel-install boot $(FW_DIR)/$(ROOTFSTARBALL) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfs)
-imageinstall: kernel-install bbl $(FW_DIR)/$(INITRAMFS) targethelp
+imageinstall: kernel-install boot $(FW_DIR)/$(INITRAMFS) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfsarchive)
-imageinstall: kernel-install bbl $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+imageinstall: kernel-install boot $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfspiggyback)
-imageinstall: createinitramfs bbl targethelp
+imageinstall: createinitramfs boot targethelp
endif
diff --git a/target/riscv64/kernel/qemu-riscv64 b/target/riscv64/kernel/qemu-riscv64
index 4991fbd..019e13c 100644
--- a/target/riscv64/kernel/qemu-riscv64
+++ b/target/riscv64/kernel/qemu-riscv64
@@ -1,5 +1,7 @@
CONFIG_RISCV=y
CONFIG_SIFIVE_PLIC=y
+CONFIG_HVC_DRIVER=y
CONFIG_HVC_RISCV_SBI=y
+CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
CONFIG_CMDLINE_BOOL=y
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
diff --git a/target/riscv64/systems/qemu-riscv64 b/target/riscv64/systems/qemu-riscv64
index ae84014..99fbfd0 100644
--- a/target/riscv64/systems/qemu-riscv64
+++ b/target/riscv64/systems/qemu-riscv64
@@ -3,6 +3,7 @@ config ADK_TARGET_SYSTEM_QEMU_RISCV64
select ADK_TARGET_QEMU
select ADK_TARGET_CPU_RISCV64
select ADK_TARGET_KERNEL_WITH_COMPRESSION
+ select ADK_TARGET_KERNEL_IMAGE
help
Qemu Emulator for RISCV64 architecture.