How to cross-compile Chromium for ARM

来源:互联网 发布:网络建设与管理论文 编辑:程序博客网 时间:2024/05/18 00:39

How to cross-compile Chromium for ARM

本文转载自:chrome - How do I cross-compile Chromium for ARM

先做个记号,尚未试验。

Steps

  1. mkdir -pv ~/chromium
  2. cd ~/chromium
  3. git config --global user.name "Joel Maranhao"
  4. git config --global user.email "youremail@example.com"
  5. git config --global core.autocrlf false
  6. git config --global core.filemode false
  7. git config --global color.ui true
  8. git clone https://chromium.googlesource.com/chromium/tools/depot_tools
  9. export PATH=$PATH:~/chromium/depot_tools See Update Notes 1
  10. mkdir -v ~/chromium/buildhost See Update Note 2
  11. cd ../buildhost See Update Note 2
  12. fetch --nohooks chromium
  13. cd src && ./build/install-build-deps.sh See Note 3
  14. sudo apt-get install gcc-arm-linux-gnueabihf
  15. sudo apt-get install g++-4.8-multilib-arm-linux-gnueabihf
  16. ./build/install-build-deps.sh --arm See Note 3
  17. gclient sync
  18. GYP_CROSSCOMPILE=1
    GYP_DEFINES=target_arch=arm arm_float_abi=hard component=shared_library linux_use_gold_flags=1
    See Note 4
  19. gclient runhooks
  20. ninja -C out/Debug chrome

Notice Steps 17 - 19. Step 18 replaces the Export Statements from Recipe 2 in the file chromium.gyp_env (This effectively switches the build Compiler to clang). Step 19 imports the chromium.gyp_env settings, and will run the proper buildscripts in the proper order.

Warning: Testing Steps

I’ll test these steps on my XUbuntu VM and report back/update etc.

Update Notes

1. Making the change permanent to the PATH variable is advisable if you are gong to do this more than once. Find the following:

# set PATH so it includes user's private bin if it existsif [ -d "$HOME/bin" ] ; then   PATH="$HOME/bin:$PATH"fi

in $HOME.profile. Add PATH=$PATH:~/chromium/depot_tools, so that the final if looks like:

# set PATH so it includes user's private bin if it existsif [ -d "$HOME/bin" ] ; then    PATH="$HOME/bin:$PATH"    PATH=$PATH:~/chromium/depot_toolsfi

If Needed, create a $HOME/bin directory (It did not exist on my VM), then logout and back in again.

2. From Studying your Post, while downloading the Gigs and Gigs of data from the repository, I see that you ran the fetch script and downloaded the Source Code into the depot_tools directory. This is a common mistake and is easily remedied by creating a separate directory, as I’ve done. This keeps the tools needed to manage and manipulate the build files separate from the items you are building. This also ensures that the items you are building aren’t polluted by the tools used to build them.

3. The first pass of build-deps.sh downloads all the build tools regardless of cross-compiling or not. Step 14 and 15 are needed in case the script complains about Held Packages. The 2nd Pass(Step 16), sets up the cross compile. I’ll update this note as the build progresses.

4. For some reason the OP and I both had trouble with the gyp_env file. Because of this, I have updated Step 18 to include the needed exports. If interested in using the gyp_env file, see the Gyp User Documentation, Configuring the Builds, and Common Gyp Build Parameters

0 0