diff --git a/Makefile b/Makefile index 6e6f1fc..8f1c091 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,10 @@ ifdef OTAVERSION EXTRA_CFLAGS += -DOTAVERSION=\"$(OTAVERSION)\" endif +ifdef OTABETA +EXTRA_CFLAGS += -DOTABETA +endif + include $(SDK_PATH)/common.mk monitor: diff --git a/deploy.md b/deploy.md index da56dc6..6142199 100644 --- a/deploy.md +++ b/deploy.md @@ -7,32 +7,43 @@ cd life-cycle-manager ``` #initial steps to be expanded -mkdir versions/0.1.10v -cp versions/certs.sector versions/0.1.10v +#create/update a file versions/latest-pre-release with this version, but no new-line +mkdir versions/0.1.11v +cp versions/certs.sector versions/0.1.11v #set local.mk to the ota-main program -make -j6 rebuild OTAVERSION=0.1.10 -mv firmware/otamain.bin versions/0.1.10v +make -j6 rebuild OTAVERSION=0.1.11 +mv firmware/otamain.bin versions/0.1.11v #set local.mk back to ota-boot program -make -j6 rebuild OTAVERSION=0.1.10 -cp firmware/otaboot.bin versions/0.1.10v +make -j6 rebuild OTAVERSION=0.1.11 +mv firmware/otaboot.bin versions/0.1.11v +make -j6 rebuild OTAVERSION=0.1.11 OTABETA=1 +cp firmware/otaboot.bin versions/0.1.11v/otabootbeta.bin #remove the older versions files -#commit this as version 0.1.10 -#set up a new github release 0.1.10 as a pre-release using the just commited master... +#commit this as version 0.1.11 +#set up a new github release 0.1.11 as a pre-release using the just commited master... +#upload the certs and binaries to the pre-release assets on github #erase the flash and upload the privatekey ``` esptool.py -p /dev/cu.usbserial-* --baud 230400 erase_flash esptool.py -p /dev/cu.usbserial-* --baud 230400 write_flash 0xf5000 privatekey.der ``` -#upload the ota-boot program to the device that contains the private key -make flash OTAVERSION=0.1.10 +#upload the ota-boot BETA program to the device that contains the private key +make flash OTAVERSION=0.1.11 OTABETA=1 #power cycle to prevent the bug for software reset after flash #create the 3 signature files next to the bin file and upload to github one by one #verify the hashes on the computer -openssl sha384 versions/0.1.10v/otamain.bin -xxd versions/0.1.10v/otamain.bin.sig +openssl sha384 versions/0.1.11v/otamain.bin +xxd versions/0.1.11v/otamain.bin.sig + +#upload the file versions/latest-pre-release to the 'latest release' assets on github + +#test the release with several devices that have the beta flag set +#if bugs are found, leave this release at pre-release and start a new version + +#if the results are 100% stable #make the release a production release on github #remove the private key ``` diff --git a/esp-wifi-config b/esp-wifi-config index e42cf64..35af368 160000 --- a/esp-wifi-config +++ b/esp-wifi-config @@ -1 +1 @@ -Subproject commit e42cf64f0fbfe20d1f69447496620c046a2a3e0e +Subproject commit 35af368943320144577614020df2807498ac875f diff --git a/ota.c b/ota.c index 7aa7943..8b5c76a 100644 --- a/ota.c +++ b/ota.c @@ -34,9 +34,21 @@ void MyLoggingCallback(const int logLevel, const char* const logMessage) { } #endif +bool userbeta=0; +bool otabeta=0; + void ota_init() { UDPLGP("--- ota_init\n"); + //using beta = pre-releases? + #ifdef OTABETA + sysparam_set_bool("ota_self-use_pre-release", 1); + #endif + sysparam_get_bool("ota_self-use_pre-release", &otabeta); + sysparam_get_bool("ota_use_pre-release", &userbeta); + + UDPLGP("userbeta=\'%d\' otabeta=\'%d\'\n",userbeta,otabeta); + //rboot setup rboot_config conf; conf=rboot_get_config(); @@ -396,10 +408,12 @@ void ota_set_verify(int onoff) { printf("--- end_set_verify...\n"); } +int ota_get_file_ex(char * repo, char * version, char * file, int sector, byte * buffer, int bufsz); //prototype needed char* ota_get_version(char * repo) { UDPLGP("--- ota_get_version\n"); char* version=NULL; + char prerelease[64]; int retc, ret=0; WOLFSSL* ssl; int socket; @@ -434,7 +448,7 @@ char* ota_get_version(char * repo) { location=strstr(location,"tag/"); version=malloc(strlen(location+4)); strcpy(version,location+4); - UDPLOG("%s@version:\"%s\"\n",repo,version); + UDPLGP("%s@version:\"%s\"\n",repo,version); } else { UDPLOG("failed, return [-0x%x]\n", -ret); ret=wolfSSL_get_error(ssl,ret); @@ -461,6 +475,20 @@ char* ota_get_version(char * repo) { // if (ret <= 0) return ret; if (ota_boot() && ota_compare(version,OTAVERSION)<0) strcpy(version,OTAVERSION); + + //find latest-pre-release if joined beta program + if ( (userbeta && strcmp(OTAREPO,repo)) || (otabeta && !strcmp(OTAREPO,repo)) ) { + prerelease[63]=0; + ret=ota_get_file_ex(repo,version,"latest-pre-release",0,(byte *)prerelease,63); + if (ret>0) { + prerelease[ret]=0; + free(version); + version=malloc(strlen(prerelease)+1); + strcpy(version,prerelease); + } + } + + UDPLGP("%s@version:\"%s\"\n",repo,version); printf("--- end_get_version\n"); return version; } diff --git a/versions/0.1.10v/certs.sector b/versions/0.1.11v/certs.sector similarity index 100% rename from versions/0.1.10v/certs.sector rename to versions/0.1.11v/certs.sector diff --git a/versions/0.1.10v/otaboot.bin b/versions/0.1.11v/otaboot.bin similarity index 61% rename from versions/0.1.10v/otaboot.bin rename to versions/0.1.11v/otaboot.bin index e419e1d..d316fe1 100644 Binary files a/versions/0.1.10v/otaboot.bin and b/versions/0.1.11v/otaboot.bin differ diff --git a/versions/0.1.11v/otabootbeta.bin b/versions/0.1.11v/otabootbeta.bin new file mode 100644 index 0000000..3b6ebe5 Binary files /dev/null and b/versions/0.1.11v/otabootbeta.bin differ diff --git a/versions/0.1.10v/otamain.bin b/versions/0.1.11v/otamain.bin similarity index 61% rename from versions/0.1.10v/otamain.bin rename to versions/0.1.11v/otamain.bin index cf44c2b..fbbb428 100644 Binary files a/versions/0.1.10v/otamain.bin and b/versions/0.1.11v/otamain.bin differ diff --git a/versions/latest-pre-release b/versions/latest-pre-release new file mode 100644 index 0000000..a34eaa5 --- /dev/null +++ b/versions/latest-pre-release @@ -0,0 +1 @@ +0.1.11 \ No newline at end of file