-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds bootloader as a secondary dependency to Photon/P1/Electron system-part2 #1306
Adds bootloader as a secondary dependency to Photon/P1/Electron system-part2 #1306
Conversation
… down the boot process
@avtolstoy to help the Cloud team develop the support for this feature in the Safe Mode Healer, would you please post an example of what the describe message would look like with the new bootloader dependency, and also provide binaries of the bootloader, and system modules? That would be super helpful for testing. |
system-part2 now depends both on system-part1 and bootloader
Binaries: https://drive.google.com/drive/folders/0BySBnweX26fwRldJVGFuU0RJRU0?usp=sharing Note: system-module binaries provided here are version 107, bootloader is 13 Bootloader is now a second dependency of system-part2 both on Electron and Photon/P1 (binary inspector probably needs support for this). ElectronOn develop (or 0.6.2-rc.1): {
"p": 10,
"imei": "XXXXXXXXXXXXX",
"iccid": "YYYYYYYYYYYYYYY",
"m": [
{
"s": 16384,
"l": "m",
"vc": 30,
"vv": 30,
"f": "b",
"n": "0",
"v": 12,
"d": []
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "1",
"v": 106,
"d": [
{
"f": "s",
"n": "3",
"v": 106,
"_": ""
}
]
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "2",
"v": 106,
"d": [
{
"f": "s",
"n": "1",
"v": 106,
"_": ""
}
]
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "3",
"v": 106,
"d": []
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"u": "25DC0C3F1769382A0494BE93AC6491F5918DB252912CC0E91B29BD28D27C44CE",
"f": "u",
"n": "1",
"v": 4,
"d": [
{
"f": "s",
"n": "2",
"v": 106,
"_": ""
}
]
},
{
"s": 131072,
"l": "f",
"vc": 30,
"vv": 0,
"d": []
}
]
} After updating system-part1, system-part2, system-part3, but not bootloader (device is in safe mode): {
"p": 10,
"imei": "XXXXXXXXXXX",
"iccid": "YYYYYYYYYYYYYYY",
"m": [
{
"s": 16384,
"l": "m",
"vc": 30,
"vv": 30,
"f": "b",
"n": "0",
"v": 12,
"d": []
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "1",
"v": 107,
"d": [
{
"f": "s",
"n": "3",
"v": 107,
"_": ""
}
]
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 26,
"f": "s",
"n": "2",
"v": 107,
"d": [
{
"f": "s",
"n": "1",
"v": 107,
"_": ""
},
{
"f": "b",
"n": "0",
"v": 13,
"_": ""
}
]
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "3",
"v": 107,
"d": []
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"u": "3FE3D246AB659DC01C4CFE030B89EE23FFBF54EDBAA402957CBC47078E631341",
"f": "u",
"n": "1",
"v": 4,
"d": [
{
"f": "s",
"n": "2",
"v": 107,
"_": ""
}
]
},
{
"s": 131072,
"l": "f",
"vc": 30,
"vv": 0,
"d": []
}
]
}
Updated bootloader: {
"p": 10,
"imei": "XXXXXXXXX",
"iccid": "YYYYYYYYYYY",
"m": [
{
"s": 16384,
"l": "m",
"vc": 30,
"vv": 30,
"f": "b",
"n": "0",
"v": 13,
"d": []
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "1",
"v": 107,
"d": [
{
"f": "s",
"n": "3",
"v": 107,
"_": ""
}
]
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "2",
"v": 107,
"d": [
{
"f": "s",
"n": "1",
"v": 107,
"_": ""
},
{
"f": "b",
"n": "0",
"v": 13,
"_": ""
}
]
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"f": "s",
"n": "3",
"v": 107,
"d": []
},
{
"s": 131072,
"l": "m",
"vc": 30,
"vv": 30,
"u": "3FE3D246AB659DC01C4CFE030B89EE23FFBF54EDBAA402957CBC47078E631341",
"f": "u",
"n": "1",
"v": 4,
"d": [
{
"f": "s",
"n": "2",
"v": 107,
"_": ""
}
]
},
{
"s": 131072,
"l": "f",
"vc": 30,
"vv": 0,
"d": []
}
]
}
PhotonOn develop (or 0.6.2-rc.1):
After updating system-part1, system-part2, but not bootloader (device is in safe mode):
Updated bootloader:
|
Thanks Andrey! I see that bootloader shows up in the dependencies when running inspector and I also created a test case for binary-version-reader: particle-iot/binary-version-reader#15 so that part should be sorted. I'll move to testing SMH itself |
Rather than adding a 2nd dependency, why not make the bootloader the root dependency (a dependency of system-part1 on the photon.) |
Just to duplicate what we discussed earlier: it is not possible to have bootloader as a dependency of system-part1 as I initially intended, as it will fail the dependency check when upgrading OTA/Ymodem. Whereas if we add it as a secondary dependency of system-part2, which is flashed last, we can safely let SMH upgrade the bootloader for us. |
Second check in SMH itself also confirms this should work: https://github.com/spark/workerd/pull/70 Once we have a ready bootloader image (I assumed the one Andrey posted isn't final yet), we can add it to the database and test it live. |
Just an FYI, 0.6.2-rc.2 will be v107, and v0.7.0-rc.1 will be v200. |
#define MODULAR_FIRMWARE 1 | ||
#include "../../../hal/src/photon/ota_module_bounds.c" | ||
|
||
#define SYSTEM_PART2_MIN_MODULE_VERSION 107 // 0.7.0-rc.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v0.7.0-rc.1 will start at module version 200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ca75375
const module_bounds_t* bounds = NULL; | ||
hal_module_t mod; | ||
bool module_fetched = false; | ||
bool valid = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we initialize valid = false
in case of a rogue PC jump over the actual valid assignment below?
This exists in hal/src/stm32f2xx/ota_flash_hal_stm32f2xx.cpp:92
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in eedde55, however the default in validate_module_dependencies_full
has to be left true
.
…pendency Adds bootloader as a secondary dependency to Photon/P1/Electron system-part2
Problem
Bootloader needs to be a dependency of some system-module.
Solution
This PR is based on
feature/bootloader_dct
branch and #1289.HAL_Core_Validate_Modules
functionSteps to Test
N/A
Example App
N/A
References
https://github.com/spark/firmware/tree/feature/bootloader_dct
Completeness
Enhancement
[PR #1306]
Bootloader module dependency and integrity checks have been added to system-part2. If they fail, the device is forced into safe mode and a new bootloader will be OTA transferred to the device.