summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2018-04-08 11:16:17 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-04-08 11:16:17 +0100
commit65b25cd0f268e989dfa5f1efcfca1e75ca38af64 (patch)
tree3b0b4bf6f1189402dea0a26d386a4e9328e4e916 /target
parent0bddc7e755f67b8918c379c715b2f4fe00ef5913 (diff)
riscv: fix kernel boot in qemu
Diffstat (limited to 'target')
-rw-r--r--target/linux/config/Config.in.serial6
-rw-r--r--target/riscv32/Makefile18
-rw-r--r--target/riscv64/Makefile22
-rw-r--r--target/riscv64/kernel/qemu-riscv641
-rw-r--r--target/riscv64/systems/qemu-riscv641
5 files changed, 38 insertions, 10 deletions
diff --git a/target/linux/config/Config.in.serial b/target/linux/config/Config.in.serial
index 482b15f80..3944c50d6 100644
--- a/target/linux/config/Config.in.serial
+++ b/target/linux/config/Config.in.serial
@@ -96,6 +96,8 @@ config ADK_LINUX_KERNEL_SERIAL_8250
|| ADK_TARGET_SYSTEM_QEMU_MICROBLAZE_ML605 \
|| ADK_TARGET_SYSTEM_QEMU_NIOS2 \
|| ADK_TARGET_SYSTEM_QEMU_OR1K \
+ || ADK_TARGET_SYSTEM_QEMU_RISCV32 \
+ || ADK_TARGET_SYSTEM_QEMU_RISCV64 \
|| ADK_TARGET_SYSTEM_ANDES_AG101P \
|| ADK_TARGET_SYSTEM_ORANGE_PI0 \
|| ADK_TARGET_SYSTEM_SOM_C6745
@@ -123,6 +125,8 @@ config ADK_LINUX_KERNEL_SERIAL_8250
|| ADK_TARGET_SYSTEM_QEMU_OR1K \
|| ADK_TARGET_SYSTEM_QEMU_PPC_BAMBOO \
|| ADK_TARGET_SYSTEM_QEMU_PPC_MPC8544DS \
+ || ADK_TARGET_SYSTEM_QEMU_RISCV32 \
+ || ADK_TARGET_SYSTEM_QEMU_RISCV64 \
|| ADK_TARGET_SYSTEM_QEMU_X86 \
|| ADK_TARGET_SYSTEM_QEMU_X86_64 \
|| ADK_TARGET_SYSTEM_QEMU_XTENSA \
@@ -155,6 +159,8 @@ config ADK_LINUX_KERNEL_SERIAL_8250
default y if ADK_TARGET_SYSTEM_QEMU_OR1K
default y if ADK_TARGET_SYSTEM_QEMU_PPC_BAMBOO
default y if ADK_TARGET_SYSTEM_QEMU_PPC_MPC8544DS
+ default y if ADK_TARGET_SYSTEM_QEMU_RISCV32
+ default y if ADK_TARGET_SYSTEM_QEMU_RISCV64
default y if ADK_TARGET_SYSTEM_QEMU_X86
default y if ADK_TARGET_SYSTEM_QEMU_X86_64
default y if ADK_TARGET_SYSTEM_QEMU_XTENSA
diff --git a/target/riscv32/Makefile b/target/riscv32/Makefile
index 30099fb55..9b268093a 100644
--- a/target/riscv32/Makefile
+++ b/target/riscv32/Makefile
@@ -29,15 +29,25 @@ 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 $(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).bbl
# filesystem specific targets
ifeq ($(ADK_TARGET_FS),initramfs)
-imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
+imageinstall: kernel-install bbl $(FW_DIR)/$(INITRAMFS) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfsarchive)
-imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+imageinstall: kernel-install bbl $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfspiggyback)
-imageinstall: createinitramfs targethelp
+imageinstall: createinitramfs bbl targethelp
endif
diff --git a/target/riscv64/Makefile b/target/riscv64/Makefile
index 4796d939b..9b022f98e 100644
--- a/target/riscv64/Makefile
+++ b/target/riscv64/Makefile
@@ -16,12 +16,12 @@ targethelp:
@echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
ifeq ($(ADK_TARGET_QEMU),y)
@echo "Start qemu with following command line:"
- @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
+ @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL).bbl -initrd ${FW_DIR}/${INITRAMFS}'
endif
endif
ifeq ($(ADK_TARGET_FS),initramfsarchive)
targethelp:
- @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}.bbl'
@echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
endif
ifeq ($(ADK_TARGET_FS),initramfspiggyback)
@@ -29,7 +29,7 @@ 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-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
+ @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL).bbl'
endif
endif
@@ -39,13 +39,23 @@ kernel-strip:
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).bbl
+
# filesystem specific targets
ifeq ($(ADK_TARGET_FS),initramfs)
-imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
+imageinstall: kernel-install bbl $(FW_DIR)/$(INITRAMFS) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfsarchive)
-imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+imageinstall: kernel-install bbl $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
endif
ifeq ($(ADK_TARGET_FS),initramfspiggyback)
-imageinstall: createinitramfs targethelp
+imageinstall: createinitramfs bbl targethelp
endif
diff --git a/target/riscv64/kernel/qemu-riscv64 b/target/riscv64/kernel/qemu-riscv64
index 85e4c59d5..5246f62aa 100644
--- a/target/riscv64/kernel/qemu-riscv64
+++ b/target/riscv64/kernel/qemu-riscv64
@@ -1,2 +1,3 @@
CONFIG_RISCV=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 70d91645e..ae8401447 100644
--- a/target/riscv64/systems/qemu-riscv64
+++ b/target/riscv64/systems/qemu-riscv64
@@ -2,6 +2,7 @@ config ADK_TARGET_SYSTEM_QEMU_RISCV64
bool "Qemu Emulator"
select ADK_TARGET_QEMU
select ADK_TARGET_CPU_RISCV64
+ select ADK_TARGET_KERNEL_WITH_COMPRESSION
help
Qemu Emulator for RISCV64 architecture.