Add create-fw-bundle command

Replacement for fw_meta.py commands and also supports unbundling .hex files.

General syntax is:

```
 $ mos create-fw-bundle -o fw.zip part1:prop1=val1,prop2=val2,... part2:...
```

Example of building a mos fw bundle for ESP8266:
```
 $ mos create-fw-bundle -o fw.zip --platform esp8266 --build-info=build_info.json \
    boot:addr=0x0,src=rboot.bin,update=false \
    boot_cfg:addr=0x7000,size=0x1000,fill=0xff \
    fw:addr=0x100000,src=demo-c.bin \
    fs:src=fs.bin,type=fs,addr=0x8000,fs_size=262144,fs_block_size=4096,fs_page_size=256,fs_erase_size=4096
```

Example of converting a HEX file to a bundle:
```
 $ mos create-fw-bundle -o fw.zip host:type=host,src=hostfw.hex
```

CL: mos: Add create-fw-bundle command

PUBLISHED_FROM=35f52ea53e4b5900463415257323a4c08cf45deb
This commit is contained in:
Deomid Ryabkov 2018-11-28 19:44:11 +00:00 committed by Cesanta Bot
parent 15b361fbac
commit 139c2061a8

View File

@ -11,7 +11,7 @@ import (
"time"
"unsafe"
"cesanta.com/mos/flash/common"
"cesanta.com/common/go/fwbundle"
"github.com/cesanta/errors"
)
@ -20,7 +20,7 @@ type FlashOpts struct {
Timeout time.Duration
}
func Flash(fw *common.FirmwareBundle, opts *FlashOpts) error {
func Flash(fw *fwbundle.FirmwareBundle, opts *FlashOpts) error {
data, err := fw.GetPartData("boot")
if err != nil {
return errors.Annotatef(err, "invalid manifest")