|
| 1 | +# Building the Chameleon Mini RevG firmware from source |
| 2 | + |
| 3 | +Users that are preparing to reflash their older generation RevE devices should |
| 4 | +see [this software](https://github.com/iceman1001/ChameleonMini-rebooted) |
| 5 | +for the latest sources to compile fresh binaries to flash onto their Chameleon Mini. |
| 6 | +Because the AVR chips on the Chameleon Mini RevE devices have less memory, the configurations |
| 7 | +such as those for |
| 8 | +[DESFire tags](https://github.com/emsec/ChameleonMini/blob/master/Doc/DESFireSupportReadme.md) |
| 9 | +will (most likely) not work if the firmware binaries are built |
| 10 | +using the source code in this repository. |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +Users need to install ``avr-gcc`` developer packages and GNU ``make`` to compile the sources. |
| 15 | +To flash the firmware onto the Chameleon over USB, users will need to install software such as |
| 16 | +``avrdude``. On Linux and Unix systems, users will likely need to setup extra ``udev`` rules on their |
| 17 | +system so the Chameleon Mini is recognized as a USB device in bootloader (flash) and runtime modes. |
| 18 | +Details on this configuration are found on the |
| 19 | +[getting started WIKI](https://rawgit.com/emsec/ChameleonMini/master/Doc/Doxygen/html/_page__getting_started.html). |
| 20 | + |
| 21 | +## Cloning |
| 22 | + |
| 23 | +```bash |
| 24 | +$ git clone ttps://@github.com/emsec/ChameleonMini.git |
| 25 | +$ cd ChameleonMini/Firmware/ChameleonMini |
| 26 | +``` |
| 27 | +If you are working from an older cloned source, make sure to update to the latest by running |
| 28 | +```bash |
| 29 | +$ git pull |
| 30 | +``` |
| 31 | + |
| 32 | +## Customizing the build |
| 33 | + |
| 34 | +The complexity and memory requirements needed to have all possible |
| 35 | +[configurations](https://rawgit.com/emsec/ChameleonMini/master/Doc/Doxygen/html/_page__configurations.html) |
| 36 | +(list not comprehensive) |
| 37 | +enabled for use on the Chameleon are too demanding for the onboard AVR chip. |
| 38 | +Users will have to choose a subset that includes support for only a few configurations at |
| 39 | +a time (reflash to use firmware built with others). |
| 40 | +There are several custom targets that make building specialized firmware possible. |
| 41 | +They include one of the following strings (henceforth ``BUILD_TARGET``): |
| 42 | +```bash |
| 43 | +mifare, mifare-classic, desfire, desfire-dev, iso-modes, ntag215, vicinity, sls2s2002, titagit, em4233, misc-tags |
| 44 | +``` |
| 45 | +Precise up-to-date information about which configurations are supported by each build variant are found by reviewing the |
| 46 | +[build script source](https://github.com/emsec/ChameleonMini/blob/master/Firmware/Chameleon-Mini/BuildScripts/custom_build_targets.mk). |
| 47 | +The per-build configuration lists are currently as follows: |
| 48 | + |
| 49 | +* ``mifare``: ``MF_CLASSIC_MINI_4B``, ``MF_CLASSIC_1K``, ``MF_CLASSIC_1K_7B``, ``MF_CLASSIC_4K``, ``MF_CLASSIC_4K_7B`` and ``MF_ULTRALIGHT`` |
| 50 | +* ``mifare-classic``: ``MF_CLASSIC_MINI_4B``, ``MF_CLASSIC_1K``, ``MF_CLASSIC_1K_7B``, ``MF_CLASSIC_4K`` and ``MF_CLASSIC_4K_7B`` |
| 51 | +* ``desfire``, ``desfire-dev``: ``MF_DESFIRE``, ``MF_DESFIRE_2KEV1``, ``MF_DESFIRE_4KEV1`` and ``MF_DESFIRE_4KEV2`` |
| 52 | +* ``iso-modes``: ``ISO14443A_SNIFF``, ``ISO14443A_READER``, ``ISO15693_SNIFF`` and ``MF_ULTRALIGHT`` |
| 53 | +* ``ntag215``: ``NTAG215`` |
| 54 | +* ``vicinity``: ``VICINITY`` |
| 55 | +* ``sl2s2002``: ``SL2S2002`` |
| 56 | +* ``titagit``: ``TITAGITSTANDARD`` and ``TITAGITPLUS`` |
| 57 | +* ``em4233``: ``EM4233`` |
| 58 | +* ``misc-tags``: ``NTAG215``, ``VICINITY``, ``SL2S2002``, ``TITAGITSTANDARD``, ``TITAGITPLUS`` and ``EM4233`` |
| 59 | + |
| 60 | +### Choosing prepacakaged firmware binaries |
| 61 | + |
| 62 | +Latest builds supporting ISO14443, ISO1593 and DESFire (non development) are generated automatically on the |
| 63 | +main Chameleon Mini firmware repository |
| 64 | +(see [this listing](https://github.com/emsec/ChameleonMini/actions)). |
| 65 | + |
| 66 | +### More customized builds |
| 67 | + |
| 68 | +Users that wish to build a hybrid of any of the above ``make`` targets may edit the |
| 69 | +``Makefile`` in the current working directory (as set in the cloning step above) and set the |
| 70 | +``BUILD_TARGET`` varaible to empty (i.e., build the source by just running ``make`` below). |
| 71 | +*Caveat emptor*: the warning is again that enabling too much functionality in the firmware build may cause |
| 72 | +errors due to memory restrictions. |
| 73 | + |
| 74 | +## Compiling the source |
| 75 | + |
| 76 | +Build the source by running |
| 77 | +```bash |
| 78 | +$ make $BUILD_TARGET |
| 79 | +``` |
| 80 | +For example, to build the firmware with DESFire support and extra printing of debugging information that |
| 81 | +can be printed with ``LOGMODE=LIVE`` and viewed with the |
| 82 | +[Chameleon Mini Live Debugger](https://github.com/maxieds/ChameleonMiniLiveDebugger) |
| 83 | +application for Android phones, we run |
| 84 | +```bash |
| 85 | +$ make desfire-dev |
| 86 | +``` |
| 87 | + |
| 88 | +## Flashing the firmware |
| 89 | + |
| 90 | +See the [getting started documentation](https://rawgit.com/emsec/ChameleonMini/master/Doc/Doxygen/html/_page__getting_started.html) |
| 91 | +for more information. The flash command using ``avrdude`` on Linux is the following: |
| 92 | +```bash |
| 93 | +$ export FIRMWARE_TARGET=Chameleon-Mini |
| 94 | +$ sudo avrdude -c flip2 -p ATXMega128A4U -B 60 -P usb -U application:w:$FIRMWARE_TARGET.hex:i -U eeprom:w:$FIRMWARE_TARGET.eep:i |
| 95 | +``` |
| 96 | +More information about flashing Chameleon devices on odd platforms and hardware setups is |
| 97 | +[found here (Linux/Unix)](https://github.com/iceman1001/ChameleonMini-rebooted/wiki/Flashing-Linux-(Unix)) and [here (Mac OSX)](https://github.com/iceman1001/ChameleonMini-rebooted/wiki/Flashing-OSX). |
| 98 | + |
| 99 | +## Getting up and running with the Chameleon Mini over serial USB |
| 100 | + |
| 101 | +Users can install ``minicom`` to interface to the Chameleon Mini. |
| 102 | +Configuration details are OS specific and are found elsewhere. |
| 103 | +Alternately, if users wish to use a portable interface and log viewer on their |
| 104 | +Android device with Google Play Store, see the |
| 105 | +[CMLD application WIKI](https://github.com/maxieds/ChameleonMiniLiveDebugger/wiki/GettingStarted). |
| 106 | +Python-based software to download and view the logs on the Chameleon is located |
| 107 | +[in this directory](https://github.com/emsec/ChameleonMini/tree/master/Software/ChamTool). |
| 108 | +Sample dumps for several configuration types that can be uploaded onto the running |
| 109 | +Chameleon device are [located here](https://github.com/emsec/ChameleonMini/tree/master/Dumps). |
0 commit comments