[iwlwifi] Package iwlwifi driver

Change-Id: I5481bf8b5e815be482a06dcdb9218466d07f2dbf
Reviewed-on: https://fuchsia-review.googlesource.com/c/drivers/wlan/intel/iwlwifi/+/651686
Fuchsia-Auto-Submit: Sakthi Vignesh Radhakrishnan <rsakthi@google.com>
Reviewed-by: Renato Mangini Dias <mangini@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
4 files changed
tree: adeabf3cf944c232efb385a0fae8ad7350b7f962
  1. external/
  2. scripts/
  3. third_party/
  4. vendor/
  5. .bazelrc
  6. .gitignore
  7. .gitmodules
  8. AUTHORS
  9. CONTRIBUTING.md
  10. LICENSE
  11. PATENTS
  12. README.md
  13. WORKSPACE.bazel
README.md

Intel Wifi driver

This repository contains instructions and source code to build, package and run the Intel Wifi driver for Fuchsia using the Fuchsia Bazel SDK.

Prepare your environment

Create the SDK and emulator images

You will need the SDK with the driver development tools and libraries. Currently this is produced manually in the Fuchsia tree. You can reproduce them with one build for qemu.x64 with the SDK archives:

fx --dir=out/qemu set core.qemu-x64 --args=build_sdk_archives=true \
  --args='dev_bootfs_labels=["//products/kernel_cmdline:devmgr.enable-ephemeral--true"]'

fx build :default sdk sdk:ddk

And a different build is currently required for creating the product bundle:

fx --dir=out/qemupbm set core.qemu-x64 \
  --args='dev_bootfs_labels=["//products/kernel_cmdline:devmgr.enable-ephemeral--true"]'

fx build :default sdk

Bootstrap your development environment

This is not yet a complete nor maintained Bazel integration, and it is not guaranteed to work beyond the samples in this repository. It is also not the final developer experience and should not be mirrored in another repository as it will change quite often until it settles.

scripts/bootstrap.sh \
  --sdk-local ~/fuchsia/out/qemu \
  --product-bundle-local ~/fuchsia/out/qemupbm

Adjust the paths above accordingly.

Repeat the step above whenever you want to use a new version of the SDK/DDK and emulator images. It is harmless to execute it repeatedly.

Start an emulator

tools/ffx emu start --net tap -H

Let the emulator know where are the system packages for on-demand loading:

tools/ffx repository add-from-pm bazel-iwlwifi/external/fuchsia_sdk/amber-files
tools/ffx target repository register --alias fuchsia.com --repository devhost

TODO(fxbug.dev/92055): the emulator should register the sdk packages automatically. Manual add-from-pm and target repository register should not be needed.

Build and package the driver

  1. Build the driver:
scripts/build.sh third_party/iwlwifi:driver_repository

This command will build the driver and make it available as a package on a local Fuchsia repository.

  1. Register the package repository
tools/ffx repository add-from-pm -r fuchsiadrivers.com bazel-bin/third_party/iwlwifi/fuchsiadrivers.com.repo
tools/ffx target repository register -r fuchsiadrivers.com

TODO(fxbug.dev/92052): ffx does not play nice with the repository created by Bazel, probably because Bazel removes the write permission so that external players don't break the hermeciticy of the build. As a consequence, ffx requires ‘add-from-pm’ and ‘target repository register’ every time a new package is published.

  1. (optional) watch the device log in a separate window
tools/ffx log
  1. Load the driver

Now you are ready to register the driver.

tools/ffx driver register fuchsia-pkg://fuchsiadrivers.com/iwlwifi_driver#lib/libiwlwifi_driver.so

Run tests

  1. Build the tests:
scripts/build.sh third_party/iwlwifi:driver_repository

This command will build the driver and make it available as a package on a local Fuchsia repository.

  1. Register the package repository
tools/ffx repository add-from-pm -r fuchsiadrivers.com bazel-bin/third_party/iwlwifi/fuchsiadrivers.com.repo
tools/ffx target repository register -r fuchsiadrivers.com

TODO(fxbug.dev/92052): ffx does not play nice with the repository created by Bazel, probably because Bazel removes the write permission so that external players don't break the hermeciticy of the build. As a consequence, ffx requires ‘add-from-pm’ and ‘target repository register’ every time a new package is published.

  1. Execute the tests

Example,

tools/ffx test run fuchsia-pkg://fuchsiadrivers.com/test_hello_pkg#meta/driver_inspector_test.cm