Flashing Modified Device OS with Buildscript 1.15.0

I need to flash a modified device os (4.2.0) and was trying to use buildscript 1.15.0.

Based on the script target flash-all, which does the job in script 1.13.0, it looks like either the flash-all-steps or flash-all-source-steps will fire.

They both use particle flash --local to do the job, but it looks like only flash-all-source-steps will flash the modified os, flash-all-steps flashes a downloaded binary instead of whatever's compiled locally.

What does the comparison between DEVICE_OS_VERSION and source means? It seems like flash-all-source-steps will only fire if the device os version I am flashing is different than what's currently on the device. Is this correct?

Also, I found that after using flash-all-source-steps as the target instead of flash-all, the wild card to flash the system-part would not fire, which was the result of me only supplying PLATFORM and not PLATFORM_ID. I thought only one was needed, not really a problem, just an inconvenience.

Hi @radek !

I need to flash a modified device os (4.2.0) and was trying to use buildscript 1.15.0.

We've recently made changes to the buildscript makefile in order to support some changes with local flashing. See the notes about that here

Are you using the buildscript makefile directly with make? If so can you share the command you are using?

I should note that the toolchain makefile is not intended to be invoked directly. The make targets you see here are essentially invoked by the Workbench IDE, which will provide all the appropriate parameters based on your project settings.
The makefile will work if invoked directly, but as you are finding out, it can be a bit difficult to get it to do exactly what you intend.

I think the easiest way to build and flash device OS with your own local modification is through Workbench using the Custom Device OSLocation setting.
More information on that is available here

What does the comparison between DEVICE_OS_VERSION and source means?

It's a literal comparison to the string source. Invoking the makefile with DEVICE_OS_VERSION set to source is the way Workbench gets the toolchain to compile the local Device OS source.

It seems like flash-all-source-steps will only fire if the device os version I am flashing is different than what's currently on the device. Is this correct?

No, the target flash-app-and-source-os will unconditionally flash the locally compiled Device OS. It does not check the device for its running version.

Also, I found that after using flash-all-source-steps as the target instead of flash-all, the wild card to flash the system-part would not fire, which was the result of me only supplying PLATFORM and not PLATFORM_ID. I thought only one was needed, not really a problem, just an inconvenience.

Yes, the flash-app-and-source-os target relies on $(PLATFORM_ID) to find the locally compiled Device OS binary path. When the makefile is invoked via Workbench commands (ie Particle: Compile application & DeviceOS (local)) all of the necessary variables will be set according to your project settings.
If you are invoking the script manually, you will have to supply that variable as well.

2 Likes

I understand, I mostly use vim + a wrapper makefile around the buildscript, after setting DEVICE_OS to the string source and PLATFORM_ID, I am able to flash the custom os.

The command I use is:

flash-all:
make -f $(PARTICLE_MAKEFILE) -s flash-all PARTICLE_CLI_PATH=$(PARTICLE_CLI) DEVICE_OS_PATH=$(DEVICE_OS_PATH) DEVICE_OS_VERSION=$(OS_VERSION) APPDIR=$(APPDIR) PLATFORM=$(PLATFORM) PLATFORM_ID=$(PLATFORM_ID) PARTICLE_DEVICE_ID=$(PARTICLE_DEVICE_ID) CC=$(PARTICLE_CC)

Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.