Ingen beskrivning

Rebecca Chang Swee Fun b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
archive b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
nwjs-nw64 1f2bbb2b6a rebase patch to latest upstream 1 år sedan
third_party 6c9f8cacf4 disable x264 in ffmpeg 1 år sedan
.gitattributes 09788fdf84 initialize git lfs for sysroot tarball 2 år sedan
0001-sandbox-add-riscv-arch-definition-and-define-syscall.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0002-chrome-installer-add-riscv64-as-one-of-the-target-ar.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0003-components-update_client-add-riscv64-arch-definition.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0004-skia-add-riscv64-architecture-detection.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0005-sql-make-VirtualCursor-standard-layout-type.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0006-tflite_support-add-cflags-to-resolve-build-issues.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0007-tflite_support-fix-absolute-value-function-abs-when-.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0008-tflite_support-fix-Wdefaulted-function-deleted-warni.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0009-tools-clang-scripts-add-RISCV-as-one-of-the-llvm-tar.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0010-tools-clang-script-add-atomic-build-flag-for-native-.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0011-tools-clang-scripts-update-clang-triple-for-riscv64.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0012-ui-gl-enable-swiftshader-for-riscv64.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0013-third_party-dav1d-enable-riscv64-build.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0014-third_party-boringssl-update-gn-for-latest-src-tree.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0015-third_party-libaom-enable-riscv64-build-as-generic.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0016-DEPS-bump-swiftshader-to-latest.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0017-DEPS-update-boringssl-to-latest-HEAD.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0018-base-process-add-riscv64-arch-definition.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0019-DEPS-change-some-third_party-repos-to-fetch-from-dev.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0020-DEPS-update-lss-to-latest.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0021-DEPS-use-DEPS-to-pull-in-v8-source-tree.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0022-DEPS-use-DEPS-to-pull-in-nwjs-forked-repo.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0023-DEPS-update-commit-hash-for-ffmpeg.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0024-build-config-linux-workaround-for-files-not-found-wi.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0025-build-config-compiler-add-build-flags-for-clang.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0026-build-config-compiler-set-generic-riscv64-flags.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0027-build-toolchain-linux-enable-clang-toolchain-for-ris.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0028-build-config-BUILD.gn-add-atomic-build-flag.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0029-build-config-compiler-skip-warnings-treated-as-error.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0030-build-config-add-v8-target-cpu-for-riscv64.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0031-build-toolchain-linux-do-not-use-lld-by-default.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0032-reduce-warnings-flag-as-error.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0033-build-config-compiler-skip-warning-for-ffmpeg.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0034-third_party-libzip-resolve-macro-redefined-issue.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0035-third_party-pffft-add-riscv64-arch-detection.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0036-BUILD.gn-disable-chrome-related-test.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0037-add-workaround-to-avoid-rebuild-sysroot.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0038-add-path-to-riscv64-sysroot.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0039-pkg-config.py-add-riscv-sysroot-path-to-system_libdi.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0040-GN-Wayland-build-overrides.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0041-DEPS-update-commit-hash-for-angle.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0042-third_party-crashpad-port-for-RISC-V.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0043-BUILD.gn-remove-dependency-to-breakpad.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0044-tools-perf-chrome_telemetry_build-remove-dependency-.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0045-chrome-test-remove-dependency-to-breakpad.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0046-content-shell-remove-dependency-to-breakpad.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0047-third_party-libvpx-enable-riscv64-build-as-generic.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0048-DEPS-update-commit-hash-for-ffmpeg.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0049-third_party-breakpad-fix-undefined-reference.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0050-build-config-compiler-add-march-for-riscv64.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
0051-build-config-compiler-add-rpath-link-for-rv64.patch b09ffc7feb rebase to Chromium 101.0.4951.67 1 år sedan
README.md 71536691a9 rebase patchset to tag 104.0.5070.0 2 år sedan

README.md

Chromium Development / Porting for RISC-V

Build host

Ubuntu 20.04.4 LTS

llvm / clang

  1. Build a cross-compile toolchain for llvm and clang.

    $ sudo apt-get -y install binutils build-essential libtool \
    texinfo gzip zip unzip patchutils curl git make cmake \
    ninja-build automake bison flex gperf grep sed gawk \
    python bc zlib1g-dev libexpat1-dev libmpc-dev \
    libglib2.0-dev libfdt-dev libpixman-1-dev 
    $ mkdir ~/riscv
    $ cd ~/riscv
    $ mkdir _install
    $ export PATH=`pwd`/_install/bin:$PATH
    $ hash -r
    # gcc, binutils, newlib, qemu
    $ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
    $ pushd riscv-gnu-toolchain
    $ ./configure --prefix=`pwd`/../_install --enable-multilib
    $ make -j`nproc` linux
    $ make -j`nproc` build-qemu
    $ popd
    # llvm
    $ git clone https://github.com/llvm/llvm-project.git riscv-llvm
    $ pushd riscv-llvm
    $ ln -s ../../clang llvm/tools || true
    $ mkdir _build
    $ cd _build
    $ cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" \
    -DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True \
    -DCMAKE_INSTALL_PREFIX="../../_install" \
    -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False \
    -DDEFAULT_SYSROOT="../../_install/riscv64-unknown-linux-gnu" \
    -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" \
    -DLLVM_TARGETS_TO_BUILD="RISCV" \
    ../llvm
    $ cmake --build . --target install
    $ popd
    

Chromium

  1. Follow the Chromium official build instruction for Linux host to get the source code. https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/linux/build_instructions.md

  2. Install additional build dependencies (by using the script available within the source code.)

  3. Edit the .gclient file in //chromium top level. This is to disable gclient from syncing NaCL code base.

    solutions = [
    {
    "name": "src",
    "url": "https://chromium.googlesource.com/chromium/src.git",
    "managed": False,
    "custom_deps": {},
    "custom_vars": { "checkout_nacl": False },
    },
    ]
    
  4. Checkout to 104.0.5070.0 tag where the patchset are based on.

    $ cd ~/chromium/src
    $ git checkout 104.0.5070.0
    
    
  5. Run the Chromium-specific hooks, this will download additional toolchain / binaries that we might need for the build later.

    $ cd ~/chromium/src
    $ gclient runhooks
    
  6. Set up the build configurations in args.gn

    $ mkdir -p out/riscv64
    $ vim out/riscv64/args.gn
    target_os="linux"
    target_cpu="riscv64"
    
    use_custom_libcxx=false
    use_custom_libcxx_for_host=true
    
    is_component_build = true
    is_debug=false
    symbol_level=0
    v8_symbol_level=0
    blink_symbol_level=0
    
    enable_swiftshader=true
    enable_libaom=true
    
    # Disable broken features
    use_gnome_keyring=false
    enable_nacl=false
    treat_warnings_as_errors=false
    fatal_linker_warnings=false
    enable_dav1d_decoder = false
    enable_reading_list=false
    enable_vr=false
    supports_subzero=false
    enable_openscreen=false
    enable_jxl_decoder=false
    
    # For clang
    is_clang = true
    clang_base_path=getenv("HOME") + "/riscv/_install"
    clang_use_chrome_plugins=false
    use_lld=true
    #use_thin_lto=false
    
  7. Apply the patches from this repository.

    $ cd ~/chromium/src
    $ git am <patch>
    
  8. Apply the patches in the untracked folder. This is due to third_party components are not tracked under the same git history.

NOTE: There is no script to help in this yet. So we have to run patch command manually in the respective folders.

TODO: Add a script to help user to patch these patches for third_party components.

$ cd third_party/<component>
$ patch -p1 < ~/riscv64-chromium-patch/third_party/XXX.patch
  1. Setup ffmpeg.

    $ cd third_party/ffmpeg
    $ ./chromium/scripts/build_ffmpeg.py linux riscv64
    $ ./chromium/scripts/generate_gn.py
    $ ./chromium/scripts/copy_config.sh
    
  2. Run the build and start resolving build issues.

    $ autoninja -C out/riscv64 chrome
    

Debugging

  1. Generate dependency tree from GN.

    $ gn desc out/risc64 chrome --tree
    
  2. Launch chromium browser on headless server.

    # Print screenshot and save as PDF
    $ chrome --headless --disable-gpu --print-to-pdf https://www.google.com
    
    # Capture screenshot
    $ chrome --headless --disable-gpu --screenshot https://www.google.com
    

Note: Running with –screenshot will produce a file named screenshot.png in the current working directory.

Credits

  1. PPC Porting Guide: https://wiki.raptorcs.com/wiki/Porting/Chromium
  2. SUSE Chromium Port: https://build.opensuse.org/package/show/network:chromium/chromium?expand=1
  3. Fedora rawhide Chromium Port: https://src.fedoraproject.org/rpms/chromium/tree/rawhide
  4. Github User: https://github.com/felixonmars/archriscv-packages/tree/master/chromium