No Description

Rebecca Chang Swee Fun 09788fdf84 initialize git lfs for sysroot tarball 1 year ago
archive 09788fdf84 initialize git lfs for sysroot tarball 1 year ago
third_party cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
.gitattributes 09788fdf84 initialize git lfs for sysroot tarball 1 year ago
0001-linux-sysroot-script-to-create-riscv-sysroot-from-De.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0002-sandbox-add-riscv-arch-definition-and-define-syscall.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0003-sandbox-linux-pass-fPIE-to-compiler.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0004-skia-add-riscv64.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0005-base-allocator-partition_allocator-add-riscv64-suppo.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0006-base-process-add-riscv64-arch-definition.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0007-remoting-fix-missing-cstring-header.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0008-remoting-codec-fix-missing-cmath-header.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0009-components-update_client-add-riscv64-arch-definition.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0010-build-config-compiler-use_gold-linker-option.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0011-build-config-compiler-remove-flags-not-available-in-.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0012-build-config-add-atomic-build-flag.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0013-build-config-compiler-set-generic-riscv64-flags.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0014-chrome-common-remove-unrar-code.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0015-third_party-libaom-add-riscv-target.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0016-third_party-libvpx-add-riscv-target.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0017-third_party-crashpad-add-support-for-riscv.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0018-third_party-lzma_sdk-add-riscv-arch-definition.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0019-build-linux-sysroot-create-a-sysroot-for-riscv.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0020-workaround-for-files-not-found-in-sysroot.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0021-v8-settings.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
0022-compiler-workaround.patch cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago
README.md cf53f2ee40 rebase patchset to 99ce2ebd79dc6 1 year ago

README.md

Chromium Development / Porting for RISC-V

Build host

Ubuntu 20.04.4 LTS

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 specific commits where the patchset are based on.

    $ cd ~/chromium/src
    $ git checkout 99ce2ebd79dc6
    
    
  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"
    
    is_component_build = true
    is_debug=false
    symbol_level=0
    v8_symbol_level=0
    blink_symbol_level=0
    
    # 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
    enable_swiftshader=false
    supports_subzero=false
    enable_libaom=false
    enable_openscreen=false
    enable_jxl_decoder=false
    
    # For clang
    is_clang = true
    
  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