B2G/Updating: Difference between revisions

Jump to navigation Jump to search
2,692 bytes added ,  10 December 2012
Line 25: Line 25:
== Building updates for multiple software versions ==
== Building updates for multiple software versions ==


* Initially, use the <tt>gecko-update-full</tt> target to generate a complete update MAR for the last successful b2g build. This will place the MAR in <tt>$GECKO_OBJDIR/dist/b2g-update/b2g-gecko-update.mar</tt>:
Since we support both OTA and FOTA updates in FirefoxOS, we have tools to help in the generation of both. At a high level, the process looks like this for each build:
 
# Generate a complete OTA update MAR for the contents of /system/b2g
# Generate an incremental OTA update MAR by providing the previous version's complete OTA update MAR
# Generate a complete FOTA update zip and target files zip for the device partitions
# Generate an incremental FOTA update zip by providing the previous version's target files zip
# Wrap the complete (and/or) incremental FOTA update zips in a MAR for FxOS delivery
# Deploy OTA / FOTA MAR(s) to appropriate locations for hosting
 
=== Generating a complete OTA update MAR ===
Use the <tt>gecko-update-full</tt> target to generate a complete update MAR for the last successful b2g build. This will place the MAR in <tt>$GECKO_OBJDIR/dist/b2g-update/b2g-gecko-update.mar</tt>:


<pre>
<pre>
Line 32: Line 42:
</pre>
</pre>


* For a complete FOTA update.zip, use the standard AOSP build hooks:
=== Generating an incremental OTA update MAR ===
** Make sure the kernel binary is in the appropriate place under <tt>vendor</tt> to enable boot image, recovery image, and update.zip generation
Pass the previous build complete OTA update MAR (<tt>$FROM_MAR</tt>) along with the current complete OTA update MAR (<tt>$TO_MAR</tt>) to <tt>build-gecko-mar.py</tt>, and it will generate an incremental MAR at <tt>$DEST_MAR</tt>:
** Copy the update.zip that lives under <tt>out/target/product/$DEVICE/*.zip</tt>
 
<pre>
$ ./tools/update-tools/build-gecko-mar.py --from $FROM_MAR --to $TO_MAR $DEST_MAR
</pre>
 
=== Generating a complete FOTA update zip and target files zip ===
When performing a "standard" build, the AOSP build system will automatically generate an FOTA update.zip / target files zip, provided the kernel binary has been copied to the appropriate place under <tt>vendor</tt>. This enables boot image, recovery image, and update.zip generation.
 
The complete FOTA update zip lives under <tt>out/target/product/$DEVICE/$DEVICE-ota-$VARIANT.$USER.zip</tt><br>
The target files zip lives under <tt>out/target/product/$DEVICE/obj/PACKAGING/target_files_intermediates/$DEVICE-target_files-$VARIANT.$USER.zip</tt>
 
Variable values:
<table border="1" style="background-color: #eeeeee">
<tr><td>$DEVICE</td><td>Device name for the AOSP product</td></tr>
<tr><td>$VARIANT</td><td><tt>eng</tt>, <tt>user</tt>, or <tt>userdebug</tt></td></tr>
<tr><td>$USER</td><td>The build username</td></tr>
</table>


* To generate an incremental MAR update, you simply need two complete update MARs to generate it from. Pass their paths to the gecko MAR generation tool:
=== Generating an incremental FOTA update zip ===
Pass the previous build FOTA target files zip (<tt>$FROM_ZIP</tt>) and the current FOTA target files zip (<tt>$TO_ZIP</tt>) to <tt>build/tools/releasetools/ota_from_target_files</tt>:


<pre>
<pre>
$ ./tools/update-tools/build-gecko-mar.py --from $FROM_MAR --to $TO_MAR $DEST_MAR
$ ./build/tools/releasetools/ota_from_target_files -v \
    -i $FROM_ZIP \
    -p out/host/$HOST_ARCH \
    -k $FOTA_SIGNING_KEY \
    $TO_ZIP \
    $DEST_ZIP
</pre>
</pre>


* TODO: generate FOTA incremental zip
Variable values:
* TODO: signing packages
<table border="1" style="background-color: #eeeeee">
* this doc covers "linear updates"; can generate more if desired
<tr><td>$FROM_ZIP</td><td>The previous FOTA target files zip</td></tr>
<tr><td>$TO_ZIP</td><td>The current FOTA target files zip</td></tr>
<tr><td>$DEST_ZIP</td><td>The destination incremental update zip</td></tr>
<tr><td>$HOST_ARCH</td><td>The host and arch combo (i.e. <tt>linux-x86</tt> or <tt>darwin-x86</tt>)</td></tr>
<tr><td>$FOTA_SIGNING_KEY</td><td>Path to the prefix for a private key and public cert for signing the update zip. <tt>$FOTA_SIGNING_ZIP.pk8</tt> and <tt>$FOTA_SIGNING_ZIP.x509.pem</tt> should both exist on the filesystem</td></tr>
</table>
 
=== Wrapping a FOTA update zip in a MAR ===
FxOS uses MARs to deliver all updates, whether they are complete or incremental. To wrap a FOTA update zip (<tt>$UPDATE_ZIP</tt>) in a MAR (<tt>$WRAPPED_MAR</tt>), use <tt>tools/update-tools/build-fota-mar.py</tt>:
 
<pre>
$ ./tools/update-tools/build-fota-mar.py $UPDATE_ZIP --output=$WRAPPED_MAR
</pre>


== Hosting updates (respectively, polling for updates on the client side) ==
== Hosting updates (respectively, polling for updates on the client side) ==
23

edits

Navigation menu