OBSW Update Commands #302
@ -211,8 +211,8 @@ Some context information about the used commands:
|
||||
|
||||
- Chip 0 Copy 0: `/tmp/mntupdate-xdi-qspi0-nom-rootfs`
|
||||
- Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-rootfs`
|
||||
- Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs`
|
||||
- Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-gold-rootfs`
|
||||
- Slot 1 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs`
|
||||
- Slot 1 Copy 1: `/tmp/mntupdate-xdi-qspi1-gold-rootfs`
|
||||
|
||||
2. Writing the file with a regular `cp <source> <target>` command
|
||||
3. Enabling the writeprotection using the `writeprotect <chip> <copy> 1` utility.
|
||||
|
@ -207,18 +207,31 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
if (size < 2) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
if (data[0] > 1 or data[1] > 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
auto chip = static_cast<xsc::Chip>(data[0]);
|
||||
auto copy = static_cast<xsc::Copy>(data[1]);
|
||||
path archivePath =
|
||||
path(config::SD_0_MOUNT_POINT) / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME);
|
||||
if (not exists(archivePath)) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
std::ostringstream cmd("tar -xJvf");
|
||||
ostringstream cmd("tar -xJvf");
|
||||
cmd << " " << archivePath;
|
||||
int result = std::system(cmd.str().c_str());
|
||||
int result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result,
|
||||
"CoreController::executeAction: SW Update Decompression");
|
||||
}
|
||||
cmd.clear();
|
||||
cmd << "xsc_mount_copy " << data[0] << " " << data[1];
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
std::string ctxString =
|
||||
"CoreController::executeAction: SW Update Mounting " + data[0] + " " + data[1];
|
||||
utility::handleSystemError(result, ctxString);
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (SWITCH_IMG_LOCK): {
|
||||
@ -1868,6 +1881,24 @@ void CoreController::readHkData() {
|
||||
}
|
||||
}
|
||||
|
||||
const char *CoreController::getXscMountDir(xsc::Chip chip, xsc::Copy copy) {
|
||||
if (chip == xsc::Chip::CHIP_0) {
|
||||
if (copy == xsc::Copy::COPY_0) {
|
||||
return CHIP_0_COPY_0_MOUNT_DIR;
|
||||
} else if (copy == xsc::Copy::COPY_1) {
|
||||
return CHIP_0_COPY_1_MOUNT_DIR;
|
||||
}
|
||||
} else if (chip == xsc::Chip::CHIP_1) {
|
||||
if (copy == xsc::Copy::COPY_0) {
|
||||
return CHIP_1_COPY_0_MOUNT_DIR;
|
||||
} else if (copy == xsc::Copy::COPY_1) {
|
||||
return CHIP_1_COPY_1_MOUNT_DIR;
|
||||
}
|
||||
}
|
||||
sif::error << "Invalid chip or copy passed to CoreController::getXscMountDir" << std::endl;
|
||||
return CHIP_0_COPY_0_MOUNT_DIR;
|
||||
}
|
||||
|
||||
bool CoreController::isNumber(const std::string &s) {
|
||||
return !s.empty() && std::find_if(s.begin(), s.end(),
|
||||
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
||||
|
@ -119,6 +119,7 @@ class CoreController : public ExtendedControllerBase {
|
||||
static ReturnValue_t generateChipStateFile();
|
||||
static ReturnValue_t incrementAllocationFailureCount();
|
||||
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
|
||||
static const char* getXscMountDir(xsc::Chip chip, xsc::Copy copy);
|
||||
|
||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user