Skip to content

Commit e9dbc9e

Browse files
authored
Merge pull request #20 from autowarefoundation/docs/update_to_add_switch_kmod
docs: update to add `switch_kmod.bash`
2 parents 1c0be56 + 242c917 commit e9dbc9e

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

docs/environment-setup/scripts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Neither script requires `agnocast.ko` to be loaded or `libagnocast_heaphook.so`
1313
| `dds_config.bash` | Apply CycloneDDS runtime settings (`net.core.rmem_max`, loopback multicast) required for Agnocast over CycloneDDS. Guarded by `/tmp/cycloneDDS_configured` so it runs only once per boot. |
1414
| `setup_thread_configurator.bash` | Grant `CAP_SYS_NICE` to `thread_configurator_node` and register library paths in `/etc/ld.so.conf.d/agnocast-cie.conf`. Automates the manual steps described in [CallbackIsolatedExecutor → Integration Guide, Step 2](../callback-isolated-executor/integration-guide.md#step-2-set-up-the-thread-configurator). |
1515

16+
## Kernel module management
17+
18+
| Script | Purpose |
19+
|---|---|
20+
| `switch_kmod.bash` | Swap the host's `agnocast-kmod-v<ver>` to another version. For container-based setups where the heaphook travels with the container image and only the host-side kmod needs to be replaced independently. See [Running in Containers → Swapping the host kernel module](../tips/containers.md#swapping-the-host-kernel-module) for details. |
21+
1622
## Sample application launchers
1723

1824
Each `sample_application/run_*.bash` script is a thin wrapper that runs `source install/setup.bash` followed by `ros2 launch agnocast_sample_application <name>.launch.xml`. All launch files set `LD_PRELOAD=libagnocast_heaphook.so` automatically, so every sample below requires both `agnocast.ko` to be loaded and `libagnocast_heaphook.so` to be available (via apt or a local source build).

docs/tips/containers.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,30 @@ services:
9999
devices:
100100
- /dev/agnocast
101101
```
102+
103+
## Swapping the host kernel module
104+
105+
When you need to change the host's `agnocast-kmod` version independently of the heaphook bundled in the container (for example, after rolling the container image to a new version, or to reproduce a bug on an older kmod), use [`switch_kmod.bash`](https://github.com/autowarefoundation/agnocast/blob/main/scripts/switch_kmod.bash):
106+
107+
```bash
108+
sudo ./scripts/switch_kmod.bash <VERSION>
109+
# e.g.
110+
sudo ./scripts/switch_kmod.bash 2.4.0
111+
```
112+
113+
The script unloads the current module, purges every installed `agnocast-kmod-v*` package, cleans any leftover DKMS state, installs the target from apt, and verifies the new load via `dmesg`.
114+
115+
!!! warning
116+
All Agnocast containers and ROS nodes must be stopped before running this script — the module cannot be unloaded while `/dev/agnocast` is held open.
117+
118+
!!! warning
119+
The kmod version on the host and the `libagnocast_heaphook.so` version inside the container must share the same ioctl ABI. Mismatched versions cause runtime errors. This script does not touch the container; it is the operator's responsibility to roll the container to a matching version.
120+
121+
After the swap, verify that the host kmod, the in-container `libagnocast_heaphook.so`, and the in-container `agnocastlib` are on compatible versions by running
122+
123+
```bash
124+
source <your-workspace>/install/setup.bash # must include the ros2agnocast package
125+
ros2 agnocast -v
126+
```
127+
128+
**inside the container** where your Agnocast application actually runs. The command prints the detected kmod / heaphook / agnocastlib versions and flags any incompatibility.

0 commit comments

Comments
 (0)