Index: abi/include/abi/proc/uarg.h
===================================================================
--- abi/include/abi/proc/uarg.h	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ abi/include/abi/proc/uarg.h	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -36,4 +36,6 @@
 #define ABI_PROC_UARG_H_
 
+#include <stddef.h>
+
 /** Structure passed to uinit kernel thread as argument. */
 typedef struct uspace_arg {
Index: boot/arch/riscv64/Makefile.inc
===================================================================
--- boot/arch/riscv64/Makefile.inc	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ boot/arch/riscv64/Makefile.inc	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -40,5 +40,6 @@
 	arch/$(BARCH)/src/ucb.c \
 	arch/$(BARCH)/src/putchar.c \
-	$(COMPS_C) \
+	$(COMPS).s \
+	$(COMPS)_desc.c \
 	generic/src/memstr.c \
 	generic/src/printf_core.c \
@@ -48,2 +49,4 @@
 	generic/src/version.c \
 	generic/src/inflate.c
+
+PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c
Index: boot/arch/riscv64/_link.ld.in
===================================================================
--- boot/arch/riscv64/_link.ld.in	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ boot/arch/riscv64/_link.ld.in	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -17,4 +17,5 @@
 		*(.bss);        /* uninitialized static variables */
 		*(COMMON);      /* global variables */
+		*(.components);
 	}
 	
Index: boot/arch/riscv64/src/main.c
===================================================================
--- boot/arch/riscv64/src/main.c	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ boot/arch/riscv64/src/main.c	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -39,5 +39,5 @@
 #include <halt.h>
 #include <inflate.h>
-#include <arch/_components.h>
+#include "../../components.h"
 
 #define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
@@ -60,9 +60,9 @@
 	
 	for (size_t i = 0; i < COMPONENTS; i++) {
-		printf(" %p: %s image (%zu/%zu bytes)\n", components[i].start,
+		printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr,
 		    components[i].name, components[i].inflated,
 		    components[i].size);
 		
-		uintptr_t tail = (uintptr_t) components[i].start +
+		uintptr_t tail = (uintptr_t) components[i].addr +
 		    components[i].size;
 		if (tail > top)
@@ -112,5 +112,5 @@
 		printf("%s ", components[i - 1].name);
 		
-		int err = inflate(components[i - 1].start, components[i - 1].size,
+		int err = inflate(components[i - 1].addr, components[i - 1].size,
 		    dest[i - 1], components[i - 1].inflated);
 		
Index: kernel/arch/riscv64/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/riscv64/include/arch/istate_struct.ag	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ kernel/arch/riscv64/include/arch/istate_struct.ag	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -36,5 +36,9 @@
                 },
                 {
-                        negative-guard: KERNEL,
+                        negative-guard : KERNEL,
+                        include : <stddef.h>
+                },
+                {
+                        negative-guard : KERNEL,
                         include : <stdint.h>
                 }
Index: kernel/arch/riscv64/include/arch/mm/km.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/km.h	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ kernel/arch/riscv64/include/arch/mm/km.h	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -36,5 +36,6 @@
 #define KERN_riscv64_KM_H_
 
-#include <typedefs.h>
+#include <stdbool.h>
+#include <stddef.h>
 
 extern void km_identity_arch_init(void);
Index: kernel/arch/riscv64/src/userspace.c
===================================================================
--- kernel/arch/riscv64/src/userspace.c	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ kernel/arch/riscv64/src/userspace.c	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -34,5 +34,4 @@
 
 #include <abi/proc/uarg.h>
-#include <stdbool.h>
 #include <userspace.h>
 
Index: uspace/lib/c/arch/riscv64/Makefile.common
===================================================================
--- uspace/lib/c/arch/riscv64/Makefile.common	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
+++ uspace/lib/c/arch/riscv64/Makefile.common	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2005 Martin Decky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
+
+ENDIANESS = LE
+
+BFD_NAME = elf64-littleriscv
+BFD_ARCH = riscv
Index: uspace/lib/c/arch/riscv64/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/config.h	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
+++ uspace/lib/c/arch/riscv64/include/libarch/config.h	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libcamd64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_riscv64_CONFIG_H_
+#define LIBC_riscv64_CONFIG_H_
+
+#define PAGE_WIDTH  12
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/arch/riscv64/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/syscall.h	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ uspace/lib/c/arch/riscv64/include/libarch/syscall.h	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -37,5 +37,7 @@
 #define LIBC_riscv64_SYSCALL_H_
 
+#include <stdint.h>
 #include <abi/syscall.h>
+#include <libarch/types.h>
 
 #define __syscall0  __syscall
Index: uspace/lib/c/arch/riscv64/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/tls.h	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ uspace/lib/c/arch/riscv64/include/libarch/tls.h	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -51,5 +51,5 @@
 static inline tcb_t *__tcb_get(void)
 {
-	return NULL;
+	return (void *) 0;
 }
 
Index: uspace/lib/c/arch/riscv64/src/entry.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/entry.c	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ uspace/lib/c/arch/riscv64/src/entry.c	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -35,5 +35,5 @@
 void __entry(void)
 {
-	__main(NULL);
+	__main((void *) 0);
 }
 
Index: uspace/lib/c/arch/riscv64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/stacktrace.c	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ uspace/lib/c/arch/riscv64/src/stacktrace.c	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -55,10 +55,10 @@
 uintptr_t stacktrace_fp_get(void)
 {
-	return (uintptr_t) NULL;
+	return 0;
 }
 
 uintptr_t stacktrace_pc_get(void)
 {
-	return (uintptr_t) NULL;
+	return 0;
 }
 
Index: uspace/lib/c/arch/riscv64/src/thread_entry.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/thread_entry.c	(revision 239e32b8559ac435fb7cf9f8377d70fddc986ddf)
+++ uspace/lib/c/arch/riscv64/src/thread_entry.c	(revision c09ff7bd1b88585eb4f2aaba5b1a2d603a5979c7)
@@ -30,9 +30,10 @@
  */
 
+#include <libarch/types.h>
 #include "../../../generic/private/thread.h"
 
 void __thread_entry(void)
 {
-	__thread_main(NULL);
+	__thread_main((void *) 0);
 }
 
