aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/init/init.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
commit3ace1ddd76b9c04f3ed23883de6279b4485612e8 (patch)
tree2f4af69d70967c2455cb83d8c18a5416c8d1b54d /arch/riscv64/init/init.c
parentb7f53b9a9001708dea5303faf52f1b508eefb712 (diff)
downloadkmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.tar.gz
kmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.zip
start trying to boot on visionfive 2
+ Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested.
Diffstat (limited to 'arch/riscv64/init/init.c')
-rw-r--r--arch/riscv64/init/init.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/riscv64/init/init.c b/arch/riscv64/init/init.c
index 92f8053..278b9db 100644
--- a/arch/riscv64/init/init.c
+++ b/arch/riscv64/init/init.c
@@ -54,7 +54,8 @@ static void init_bootmem(uintptr_t load_addr, uintptr_t ram_base)
extern char *__kernel;
extern char *__kernel_size;
- uintptr_t top = load_addr + (uintptr_t)&__kernel + (uintptr_t)&__kernel_size;
+ uintptr_t top = load_addr + (uintptr_t)&__kernel +
+ (uintptr_t)&__kernel_size;
/* this could be risky, as we might overwrite some bits of initrd or fdt
* if they're allocated too close to the kernel payload.
@@ -119,3 +120,17 @@ void init(void *fdt, pm_t load_addr)
jump_to_kernel(fdt, ram_base, (void *)VM_KERN);
}
+
+#if GENERIC_UBOOT
+void init_go(int argc, char **argv, pm_t load_addr)
+{
+ if (argc != 2)
+ return;
+
+ void *fdt = (void *)strtouintptr(argv[1]);
+
+ /* fdt is passed as second argument, load address first but since we
+ * already have it due to our ingenious _start, no need to parse it */
+ init(fdt, load_addr);
+}
+#endif