Skip to content

Commit

Permalink
[Bouffalolab] Generate Bouffalolab format OTA image after compile don…
Browse files Browse the repository at this point in the history
…e. (#27337)

* generate bouffalolab format ota image after compile done

* fix spell

* fix restyle
  • Loading branch information
wy-hh authored and pull[bot] committed Jul 20, 2023
1 parent b2b4b9d commit 5964577
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
25 changes: 16 additions & 9 deletions examples/lighting-app/bouffalolab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,23 @@ After successful commissioning, cluster commands available to control the board.
Please take [guide](../../ota-provider-app/linux/README.md) for more detail on
ota-provider-app build and usage.

### Create the Matter OTA with Bouffalolab OTA bin `FW_OTA.bin.xz.hash`
### Create the Matter OTA image with Bouffalolab OTA `bin.xz.hash` format image

- Build `Bouffalo Lab` OTA image as following execution using python script
`*.flash.py` under firmware build out folder,
```shell
./<output_firmware_name>.flash.py --build
```
After script executed, a folder `ota_images` and an image
`FW_OTA.bin.xz.hash` will be generated. `FW_OTA.bin.xz.hash` is compressed
with hash verification for build out firmware.
- `Bouffalo Lab` OTA `bin.xz.hash` format image

- Build `Bouffalo Lab` OTA image as following execution using python
script `*.flash.py` under firmware build out folder,
`shell ./<output_firmware_name>.flash.py --build` After script executed,
a folder `ota_images` and an image `FW_OTA.bin.xz.hash` will be
generated. `FW_OTA.bin.xz.hash` is compressed with hash verification for
build out firmware.

- `bin.xz.hash` image

After compile done, the build script will call
`<output_firmware_name>.flash.py` to generate `Bouffalo Lab` OTA format
image as above, and put it under out folder with name likes
`<output_firmware_name>.bin.xz.hash`

* Build Matter `*.ota` OTA image with `Bouffalo Lab` OTA image under
**connectedhomeip** repo folder
Expand Down
24 changes: 24 additions & 0 deletions scripts/build/builders/bouffalolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,27 @@ def build_outputs(self):
}

return items

def PostBuildCommand(self):

# Generate Bouffalo Lab format OTA image for development purpose.

ota_images_folder_path = self.output_dir + "/ota_images"
ota_images_dev_image = self.output_dir + "/" + self.app.AppNamePrefix(self.chip_name) + ".bin.xz.hash"
ota_images_image = self.output_dir + "/ota_images/FW_OTA.bin.xz.hash"
ota_images_firmware = self.output_dir + "/" + self.app.AppNamePrefix(self.chip_name) + ".bin"

ota_images_flash_tool = self.output_dir + "/" + self.app.AppNamePrefix(self.chip_name) + ".flash.py"

os.system("rm -rf " + ota_images_folder_path)
os.system("rm -rf " + ota_images_dev_image)

if not os.path.isfile(ota_images_firmware):
return

os.system("python " + ota_images_flash_tool + " --build")

if not os.path.isfile(ota_images_image):
return

os.system("cp " + ota_images_image + " " + ota_images_dev_image)

0 comments on commit 5964577

Please sign in to comment.