Build Chromium for Chromium OS and Deploy to real device. (deprecated)
- See Build Chromium for Chromium OS and Deploy to real device
- This doc includes some useful hack, so I remain it.
- my opinion: It's so burdensome. After this course, you might like Tizen more...
- Major reasons:
- you can not launch your custom chrome in command line. What you can do is to replace chrome files and reboot.
- There is not nice tool to build chromium in chroot.
- You need to hack linux filesystem to replace your custom chrome on device, because every mount is read-only.
- target listener: chromium dev to want to test their changes on real device.
- why this wiki is needed?: Build Chromium for Chromium OS covers only generic x86/amd64/arm, not real device. and there is no document about it.
- Although Ryan Cui improve ChromeSDK and --sdk-path option, there is not official document.
- I explain for peppy (Acer C720/C720P) but it can be applied for all devices.
- I made it on Ubuntu 14.04. I guess above 12.04 is fine.
- follow Chromium OS Developer Guide until installing Chromium OS on your Device. It works well for peppy also.
- Don't read Quick Start Guide. It makes you confused.
- Intel employee: Don't read Intel 'Getting Started With Chrome OS' Guide. The internal repo seems to be not maintained. It wastes my 1 day.
- you probably runs following commands in chroot.
# make your image
export BOARD=peppy
./setup_board --board=${BOARD}
./set_shared_user_password.sh
./build_packages --board=peppy --nowithdebug
./build_image --board=${BOARD} --noenable_rootfs_verification dev
# optional: check if the image is good
./get_latest_image.sh --board=${BOARD}
./mount_gpt_image.sh --board=${BOARD} -f $(./get_latest_image.sh --board=${BOARD})
./mount_gpt_image.sh --board=${BOARD} -u
# optional: make qemu image to run it on your pc.
./image_to_vm.sh --board=${BOARD}
./cros_start_vm --image_path /home/dshwang/chromiumos/src/build/images/peppy/R37-5875.0.2014_05_21_1624-a1/chromiumos_qemu_image.bin
# make booting usb
cros flash usb:// $(./get_latest_image.sh --board=${BOARD})/chromiumos_image.bin
- See Running a Chromium OS image under KVM
- In summary
- Enabling native virtualization in BIOS
sudo apt-get install qemu-kvm libvirt-bin virt-manager virtinst python-libvirt
./bin/cros_start_vm --image_path ../build/images/peppy/latest/chromiumos_qemu_image.bin
- trouble shooting
- I encountered following error: "Could not initialize SDL(No available video device) - exiting"
- The solution is to add "Defaults env_keep+="DISPLAY XAUTHORITY" after executing 'sudo visudo'.
- Both env variables should be passed to sudo. I don't know why.
- you don't need to setup_board again, although it's really small part.
~/trunk/src/scripts/update_chroot
export BOARD=peppy
./build_packages --board=peppy --nowithdebug
...
I guess there is better way but it is the best among what I found.
-
chrome os build system does not build chromium actually. It just downloads pre-built chromium from gs server during
./build_package
. -
this file include your chrome.
~/chromiumos/chroot/build/peppy/packages/chromeos-base/chromeos-chrome-37.0.2006.4_rc-r1.tbz2
-
If wanna know more, see Portage Build FAQ
-
If you want to build your own change, you need to touch cros_workon.
-
I gave up understanding this, because it requires to know how Gentoo distribution is packaged.
- parse ebuild files in
~/chromiumos/src/third_party/chromiumos-overlay/chromeos-base/chromeos-chrome
manually.
- Building Chromium for Chromium OS (simple chrome) explains how to build chromium to amd64 generic target.
- I guess that other real device's GYP_DEFINES is almost same to generic's.
- you can get the GYP_DEFINES as follows
# run at 22/May/2014, you need to get it by yourself
chromium> cros chrome-sdk --board=amd64-generic --nogoma
(sdk amd64-generic R37-5863.0.0-b13527) dshwang@dshwang-X230: ~/workspace/chromium $ env | grep GYP
GYP_DEFINES=use_ozone=0 remoting=1 use_brlapi=1 linux_use_gold_flags=1 chromeos=1 target_arch=x64 use_vtable_verify=0 use_xi2_mt=2 use_cups=0 use_evdev_gestures=0 release_extra_cflags=-g system_libdir=lib64 use_gnome_keyring=0 sysroot=/home/dshwang/workspace/chromium/blink/.cros_cache/chrome-sdk/tarballs/amd64-generic+5863.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz linux_link_libbrlapi=1 enable_smooth_scrolling=1 use_cras=1 linux_sandbox_path=/opt/google/chrome/chrome-sandbox linux_use_bundled_binutils=0 swig_defines=-DOS_CHROMEOS clang=0 linux_use_bundled_gold=0 icu_use_data_file_flag=1 remove_webcore_debug_symbols=1 strip_tests=1 internal_pdf=0 pkg-config=pkg-config-amd64-generic
GYP_GENERATOR_FLAGS=output_dir=out_amd64-generic
GYP_GENERATORS=ninja
- change following variables
- sysroot=/build/peppy
- pkg-config=pkg-config-peppy
- so you can get GYP_DEFINES for peppy. See next section.
- you can mount your chromium source into chroot. How to share files for inside and outside chroot
- I build as follows
$ cd <your src>
$ export GYP_DEFINES="use_ozone=0 remoting=1 use_brlapi=1 linux_use_gold_flags=1 chromeos=1 target_arch=x64 use_vtable_verify=0 use_xi2_mt=2 use_cups=0 use_evdev_gestures=0 system_libdir=lib64 use_gnome_keyring=0 linux_link_libbrlapi=1 enable_smooth_scrolling=1 use_cras=1 linux_sandbox_path=/opt/google/chrome/chrome-sandbox linux_use_bundled_binutils=0 swig_defines=-DOS_CHROMEOS clang=0 linux_use_bundled_gold=0 icu_use_data_file_flag=1 remove_webcore_debug_symbols=1 strip_tests=1 internal_pdf=0 sysroot=/build/peppy pkg-config=pkg-config-peppy"
$ export GYP_GENERATOR_FLAGS=output_dir=out_peppy
$ export GYP_GENERATORS=ninja
$ ./build/gyp_chromium
$ ninja -C out_peppy/Release -j10 chrome chrome_sandbox
- Deploying Chrome to the device doesn't work for some reason.
- Although my chroot can ssh to device, deploy_chrome script doesn't recognize my device. WTF
- You need to replace /opt/google/chrome with your built binary. BUT
- / is mounted as Read-only
- you can not launch any X11 based executable on shell.
- reuse your usb that you flash the image.
- ROOT-A partition is chromeos's
/
- copy your custom chrome to ROOT-A
sudo mv /media/dshwang/ROOT-A/opt/google/chrome /media/dshwang/ROOT-A/opt/google/chrome_bak
sudo cp -r <your chrome> /media/dshwang/ROOT-A/opt/google/
sudo chmod 4755 /media/dshwang/ROOT-A/opt/google/chrome/chrome-sandbox
- boot usb chromeos via ctrl+u
-
Make the same layout to
/opt/google/chrome
using yourout_peppy/Release
by yourself. There is not script only for this. -
you can see the layout in ~/chromiumos/chroot/build/peppy/opt/google/chrome/
-
Copy the dir to usb
-
go to shell in your device
# remount your root for rw
chronos@localhost $ sudo mount -o remount,rw /dev/root /
# mount your usb
chronos@localhost $ sudo mount -t ext4 /dev/sdb1 /media/removable/
# backup your chrome and kill chrome
chronos@localhost $ sudo mv /opt/google/chrome /opt/google/chrome_bak
chronos@localhost $ sudo killall -9 chrome
# copy & reboot
chronos@localhost $ sudo cp -r /media/removable/chrome /opt/google/
chronos@localhost $ sudo chmod 4755 /opt/google/chrome/chrome-sandbox
chronos@localhost $ sudo reboot
Send dongseong.hwang(at)intel.com mail if you know better way.