User Tools

Site Tools


developers:env_buildtest

This is an old revision of the document!


Cross-compile a default Linux kernel

Now that you have a toolchain in place let's start by cross-compiling the Linux kernel with the default configuration. First clone the riscv-linux repository…

git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux.git

Then configure it with the default configuration. That includes virtio support so that you can use this kernel with QEMU later on.

cd riscv-linux
ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- make defconfig

And finally build the kernel…

ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- make

You should now have the kernel image as vmlinux, you may verify its compiled for RISC-V using the file command

vmlinux: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, BuildID[sha1]=..., not stripped
developers/env_buildtest.1540668745.txt.gz · Last modified: 2018/10/27 22:32 by mick