Package cvd_host_package.zip using soong

This change adds a new Soong module type cvd_host_package and its
instance cvd_host_package (the names are the same). The module is
expected to replace cvd-host-package.tar.gz which is built in
host_package.mk.

The need for doing this in Soong are as follows:

1) We had to track transitive dependencies (like the shared libs used by
the host tools), which is very error-prone. The soong module tracks
transitive dependencies automatically, so we need to specify the
dependencies to the top-level host tools.

2) We had mixture of x86 and arm64 binaries in the same package. This
not only increases the size of the package, but also made the structure
of the package complicated as binaries had to be stored in different sub
directories (e.g. aarch64-linux-gnu v.s. x86_64-linux-gnu) to avoid
conflict. With the new Soong module, the package is created for each
target and each pacakge has only the artifacts for the target.

One notable change is that the format has changed from tar.gz to zip.
The change was needed because the tar that we use in Soong doesn't
support appending files to an existing archive. Appending is necessary
because we have to gathe files from different base directories:

For the Linux/arm64 target, arch-specific files are gathered from under
out/soong/host/linux_bionic-arm64, while common-arch files are gathered
from out/soong/host/linux-x86. (Note: it actually has to be
out/soong/host/linux_bionic-common, but we keep the old path for compat
reason). soong_zip supports the use case.

WARNING: this does NOT yet replace cvd-host_package.tar.gz with the new
cvd_host_package.zip. The switch will be made later.

Bug: 168086242
Test: m out/soong/host/linux_bionic-arm64/cvd_host_package.zip
out/soong/host/linux-x86/cvd_host_package.zip

Change-Id: I4c60b0095431e9a47d7318b7d78c7172e08a9f97
2 files changed
tree: 924a3d8e1a941294d80eabd3f00c6d8f7c733cf7
  1. build/
  2. common/
  3. guest/
  4. host/
  5. recovery/
  6. shared/
  7. tests/
  8. tools/
  9. vsoc_arm64/
  10. vsoc_arm64_only/
  11. vsoc_x86/
  12. vsoc_x86_64/
  13. vsoc_x86_64_only/
  14. vsoc_x86_noapex/
  15. vsoc_x86_only/
  16. Android.bp
  17. Android.mk
  18. AndroidProducts.mk
  19. CleanSpec.mk
  20. default-permissions.xml
  21. dtb.img
  22. fetcher.mk
  23. host_package.mk
  24. METADATA
  25. OWNERS
  26. README.md
  27. required_images
  28. TEST_MAPPING
README.md

Cuttlefish Getting Started

Try Cuttlefish

  1. Make sure virtualization with KVM is available.

     grep -c -w "vmx\|svm" /proc/cpuinfo
    

    This should return a non-zero value. If running on a cloud machine, this may take cloud-vendor-specific steps to enable. For Google Compute Engine specifically, see the GCE guide.

  2. Download, build, and install the host debian package:

    git clone https://github.com/google/android-cuttlefish
    cd android-cuttlefish
    debuild -i -us -uc -b
    sudo dpkg -i ../cuttlefish-common_*_amd64.deb || sudo apt-get install -f
    sudo reboot
    

    The reboot will trigger installing additional kernel modules and applying udev rules.

  3. Go to http://ci.android.com/

  4. Enter a branch name. Start with aosp-master if you don't know what you're looking for

  5. Navigate to aosp_cf_x86_phone and click on userdebug for the latest build

  6. Click on Artifacts

  7. Scroll down to the OTA images. These packages look like aosp_cf_x86_phone-img-xxxxxx.zip -- it will always have img in the name. Download this file

  8. Scroll down to cvd-host_package.tar.gz. You should always download a host package from the same build as your images.

  9. On your local system, combine the packages:

    mkdir cf
    cd cf
    tar xvf /path/to/cvd-host_package.tar.gz
    unzip /path/to/aosp_cf_x86_phone-img-xxxxxx.zip
    
  10. Launch cuttlefish with:

$ HOME=$PWD ./bin/launch_cvd

  1. Stop cuttlefish with:

$ HOME=$PWD ./bin/stop_cvd

Debug Cuttlefish

You can use adb to debug it, just like a physical device:

$ ./bin/adb -e shell

Launch Viewer

You can use the TightVNC JViewer. Once you have downloaded the TightVNC Java Viewer JAR in a ZIP archive, run it with

$ java -jar tightvnc-jviewer.jar -ScalingFactor=50 -Tunneling=no -host=localhost -port=6444

Click "Connect" and you should see a lock screen!