Skip to content

Get the Source

Brice Dobry edited this page Aug 12, 2020 · 20 revisions

The V8 project uses Google's depot_tools to manage the source code. For this fork, we will first follow the instructions from v8 and use these tools to retrieve all of the required source from the core project. Then we will use git directly to retrieve the branch with the RISC-V port.

Installing depot_tools

Clone the depot_tools repository to your system:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:/path/to/depot_tools

You may also want to add export PATH=$PATH:/path/to/depot_tools into your shell configuration file (ex. ~/.bashrc) to ensure that this directory is always in your path.

Now, check that depot_tools is correctly installed:

gclient

If this shows the usage information, then your installation is successful.

Checkout V8 Source from Google

Assuming V8_ROOT is defined to some root directory for your v8 work:

mkdir $V8_ROOT
cd $V8_ROOT
fetch v8

You can now browse the original v8 code under $V8_ROOT/v8. For now, we checkout the tag 8.1.268 until we rebase the RISC-V changes on top of a newer version of the upstream code.

Checkout the RISC-V Branch

Since the RISC-V port is not yet upstream, we need to pull it from this repository.

cd $V8_ROOT/v8
git remote add riscv https://github.com/v8-riscv/v8.git
# or alternatively using ssh
git remote add riscv [email protected]:v8-riscv/v8.git
git fetch riscv
git checkout riscv-porting-dev

Patch the Chromium Build Toolchain

Since this port is not yet upstream, we will also need to apply one patch to the build files which have been fetched from a separate repository. We have added a patchfile under patches/build.patch to simplify this step. Apply this patch in the build/ directory:

cp $V8_ROOT/v8/patches/build.patch $V8_ROOT/v8/build/
cd $V8_ROOT/v8/build
git apply build.patch

Next, continue to Simulator Build or Cross-compiled Build

Clone this wiki locally