By Eddie Lau GPL v3.0

Plugin: azwplugin
-----------------
An output plugin that output azw-format ebooks. It uses the original Calibre routine to generate typical ebooks, but uses external Kindlegen to produce periodicals. Before use, please put the kindlegen executable into this plugin zip file. The default .mobi generation routine in Calibre does not produce periodicals that point to the last-read article in the section/article view when one reads an article and uses the "back" button on kindle to go to section/article view.
This plugin approach allows you to use both the calibre graphical interface and command line (ebook-convert) to generate periodicals with kindlegen.

=== Install instruction ===
1) Download kindlegen matching your operating system at Amazon website.http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621. Extract the kindlegen executable there ("kindlegen" for Linux and "kindlegen.exe" for windows). Insert that executable into azwplugin.zip. (You may do so by decompressing azwplugin.zip, put the executable into the decompressed folder, and zip the whole folder as azwplugin.zip afterwards. Make sure the .py files are directly under the zip folder.)
2) Install the plugin azwplugin.zip into Calibre. If you do it with the graphical interface, go to "Preferences" (at the top toolbar of the Calibre window), in "Advanced" section click on "Plugins", then click on the "Add a new plugin" button. Select "azwplugin.zip". You will then see the AZW plugin is installed under "Conversion Output plugins" section.
3) Now when you use the command line "ebook-convert" to generate your periodical, you can simply specify the extension of the output to be .azw to use this azw plugin. To make Calibre Graphical Interface use the AZW plugin to generate ebooks/periodicals, go to "Preferences" (at the top toolbar of the Calibre window) again. Visit "Behavior" in the "Interface" section. Change the "default output format" to "AZW". 

=== Developer note ===
You may see what I've done to make this plugin after unzipping azwplugin.zip.

=== Change log ===
v1.0.0 [2011/07/20]
v1.0.1 [2011/07/21]: Fix a few typesetting problems and works with one-feed recipe
v1.0.2 [2011/07/22]: Use kindlestrip (by Paul Durrant) to trim down the result file
v1.0.3 [2011/07/22]: Remove sections that are without any articles
v1.0.4 [2011/07/23]: Make its ebook mobi output compatiable with change of MobiWriter API in Calibre 0.8.11+.