RISC-V Meaty Skeleton with QEMU virt board: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
No edit summary
Line 25:
 
You ''must'' configure your cross-binutils with the <tt>--with-sysroot</tt> option, otherwise linking will mysteriously fail with the ''this linker was not configured to use sysroots'' error message. If you forgot to configure your cross-binutils with that option, you'll have to rebuild it, but you can keep your cross-gcc.
 
==Building a Cross-Debugger (optional)==
 
:''Main article:'' [[GDB|GDB]]
 
If you wish to debug your kernel with [[GDB|GDB]], you'll need to build it separately with <code>riscv64-elf</code> as the target, since it's not included by default with GCC and Binutils. Otherwise, if <code>printf</code> debugging is your style, you may safely skip this section.
 
The process is similar to building a cross-GCC or cross-binutils, and you may refer to the [https://www.linuxfromscratch.org/blfs/view/svn/general/gdb.html GDB page in BLFS] for most details sans cross-debugging support, but we'll go through the process in detail here anyway.
 
Fetch the latest version of GDB through [https://ftp.gnu.org/gnu/gdb/ https://ftp.gnu.org/gnu/gdb/]. The latest version at the time of writing is 12.1:
 
<source lang="bash">
$ export GDB_VERSION="12.1"
$ wget https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz
</source>
 
Unpack the archive:
 
<source lang="bash">
$ tar xvf gdb-${GDB_VERSION}.tar.xz
</source>
 
Now move into the source directory:
 
<source lang="bash">
$ pushd gdb-${GDB_VERSION}/
</source>