Skip to content

Commit 5cdc3da

Browse files
committed
Add Partition Manager CLI docs
1 parent ff7995f commit 5cdc3da

1 file changed

Lines changed: 60 additions & 1 deletion

File tree

docs/lib.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ of the manifest header.
2121

2222

2323
On success, zero is returned. If the image does not contain a valid 'magic number' at the beginning
24-
of the manifest, or if the size of the image is bigger than `WOLFBOOT_PARTITION_SIZE`, -1 is returned.
24+
of the manifest, or if the size of the image is bigger than `WOLFBOOT_PARTITION_SIZE`, -1 is returned.
2525

2626

2727
If the `open_image_address` operation is successful, two other functions can be invoked:
@@ -123,3 +123,62 @@ Firmware Valid
123123
booting 0x5609e3526590(actually exiting)
124124
```
125125

126+
## Library mode: Partition Manager CLI Example
127+
128+
An example application using filesystem access is provided in `hal/library_fs.c`.
129+
130+
The CLI application `lib-fs` allow querying partition states, triggering updates, and marking the boot partition as successful.
131+
132+
### Building the lib-fs example
133+
134+
Step 1: use the example configuration to compile wolfBoot in library mode:
135+
136+
```
137+
cp config/examples/library_fs.config .config
138+
```
139+
140+
Step 2: Adjust the configuration to fit your partition layout and file path.
141+
142+
Step 3: Build the CLI application:
143+
144+
```
145+
make lib-fs
146+
```
147+
148+
This will produce the `lib-fs` executable.
149+
150+
### Using the Partition Manager CLI
151+
152+
The example configuration points the binary to access `/dev/mtd0` for partition data. You can simulate this file path with `modprobe mtdram total_size=16384 erase_size=128`. You may need to adjust the file permissions to allow read/write access.
153+
154+
Run the application with one of the supported commands:
155+
156+
```
157+
./lib-fs <command>
158+
```
159+
160+
Available commands:
161+
162+
- `status` : Show state of all partitions
163+
- `get-boot` : Get BOOT partition state
164+
- `get-update` : Get UPDATE partition state
165+
- `update-trigger` : Trigger an update (sets UPDATE partition to UPDATING)
166+
- `success` : Mark BOOT partition as SUCCESS
167+
- `help` : Show usage information
168+
169+
#### Example usage
170+
171+
Show all partition states:
172+
```
173+
./lib-fs status
174+
```
175+
176+
Trigger an update:
177+
```
178+
./lib-fs update-trigger
179+
```
180+
181+
Mark the boot partition as successful:
182+
```
183+
./lib-fs success
184+
```

0 commit comments

Comments
 (0)