How to create a bitstream cache for a manually downloaded bitstream
- If you are building a bitstream manually using Vivado, run:
./bazelisk.sh build //hw/bitstream/vivado:earlgrey_cw340_archive
then use
./bazelisk.sh cquery //hw/bitstream/vivado:earlgrey_cw340_archive
to the get the path to the bitstream archive. copy it somewhere safe, outside of the bazel cache.
- Download/Build a bitstream and extract it somewhere. The content should look like this:
$ ls -R
.:
chip_earlgrey_cw340 manifest.json
./chip_earlgrey_cw340:
lowrisc_systems_chip_earlgrey_cw340_0.1.bit memories.mmi
Note that if you download a bitstream build from a pull request, it is will typically be deeply nested inside a build-bin/hw/top_earlgrey/chip_earlgrey_cw340 directly.
In what follows, we will refer to $BITSTREAM_MANIFEST the absolute path to the file manifest.json above.
- Create an empty directory somewhere which will hold the cache itself. Denote it by
$BITCACHE_DIRand make sure that it exists:
BITCACHE_DIR=/tmp/bitstream_cache
mkdir "$BITCACHE_DIR"- Run at least one bazel command to force the existence of a stamp file:
$ ./bazelisk.sh build //util/py/scripts:bitstream_cache_create- Create the cache:
./bazelisk.sh run //util/py/scripts:bitstream_cache_create.py -- \
--schema rules/scripts/bitstreams_manifest.schema.json \
--stamp-file bazel-out/volatile-status.txt \
--out "$BITCACHE_DIR"
"$BITSTREAM_MANIFEST"- Now you can run any command using the cache as follows:
BITSTREAM="--cache /tmp/bitstream_cache/ --offline" ./bazelisk.sh query @bitstreams//...