-
Notifications
You must be signed in to change notification settings - Fork 2
Chromium Browser for RISC V
- A 64-bit build machine with at least 8GB of RAM. More than 16GB is highly recommended.
- At least 100GB of free disk space.
- You must have Git and Python v3.6+ installed already (and python3 must point to a Python v3.6+ binary).
Clone the depot_tools repository:
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
Add depot_tools to the end of your PATH (you will probably want to put this in your ~/.bashrc). Assuming you cloned depot_tools to /path/to/depot_tools:
$ export PATH="$PATH:/path/to/depot_tools"
When cloning depot_tools to your home directory do not use ~ on PATH, otherwise gclient runhooks will fail to run. Rather, you should use either $HOME or the absolute path:
$ export PATH="$PATH:${HOME}/depot_tools"
Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):
$ mkdir ~/chromium && cd ~/chromium
Download the gclient configuration file:
$ wget https://raw.githubusercontent.com/rebeccasf/nwjs.config/master/gclient_main -O .gclient
Run gclient sync to sync the source code into the directory:
$ gclient sync
Once you have checked out the code, and assuming you're using Ubuntu, run:
$ ./src/build/install-build-deps.sh
You may need to adjust the build dependencies for other distros. Refer to Chromium guide for other distros.
Download the pre-built sysroot based on RISC-V Debian sid: StarFive RISC-V Debian Sysroot
Setup a folder to store a pre-built RISC-V Debian sysroot for cross-compilation libraries:
$ cd src/build/linux
$ mkdir debian_sid_riscv64-sysroot && cd debian_sid_riscv64-sysroot
Extract the sysroot tarball into //build/linux/debian_sid_riscv64-sysroot:
$ tar -xvzf debian_starfive_chroot.tar.gz --strip-components=1
Update the sysroot file and folder permission settings:
$ sudo chown --from=root <user> * -R
NOTE: <user> should be replaced with your own user account on the build machine OS.
We need to rebuild the llvm/clang toolchain with RISC-V enabled as one of the target:
$ cd ~/chromium/src/build/tools/clang/script
$ ./build.py --without-android --without-fuchsia
Chromium uses Ninja as its main build tool along with a tool called GN to generate .ninja files. You can create any number of build directories with different configurations. To create a build directory, run:
$ cd ~/chromium/src
$ gn gen out/Default --args='target_cpu="riscv64" target_os="linux" is_debug=false is_component_ffmpeg=true symbol_level=1 blink_symbol_level=0 use_gnome_keyring=false is_clang=true use_lld=false use_gold=false enable_nacl=false is_component_build=true enable_swiftshader=true v8_use_external_startup_data=false v8_target_cpu="riscv64"'
Build Chromium (the “chrome” target) with Ninja using the command:
$ autoninja -C out/Default chrome
(autoninja is a wrapper that automatically provides optimal values for the arguments passed to ninja.)
Once it is built, you can transfer the out/Default directory into StarFive VisionFive board and run the browser on target:
$ out/Default/chrome