# Building ARTIQ-6 and earlier Pre-flake ARTIQ (that is 6 and earlier) requires slightly different steps for building. ## Initial setup The following steps need to be done only once. First we will need to specify older nixpkg version - 21.05. Open ``~/.nix-channels`` with your favorite text editor. If there are any ``nixpkgs`` present already, comment them out with ``#``. Then add the following line: ``` https://nixos.org/channels/nixos-21.05 nixpkgs ``` Save and exit. Now, we need special ``nix-scripts`` to configure building environment, and a local copy of the artiq repository, in legacy release. ```shell mkdir artiq-legacy cd artiq-legacy git clone https://git.m-labs.hk/M-Labs/nix-scripts git clone https://github.com/m-labs/artiq/ cd artiq git checkout release-6 # or release-5... cd .. ``` ## Setting up the environment and building firmware Within ``fish`` shell (others may not work correctly), set up the ARTIQ build environment: ```shell nix-shell -I artiqSrc= nix-scripts/artiq-fast/shell-dev.nix ``` Then build the required firmware as usual: ```shell python -m artiq.gateware.targets.kasli_generic .json ``` If you are building legacy ARTIQ for local use and you want to flash it, use: ```shell artiq_flash -V -d artiq_kasli --srcbuild ``` There's a slight discrepancy from usual command - ``-V `` option is not present in ARTIQ-7+, but it is necessary here. If you want to send the binaries to a customer, there's no need packing up the whole build directory - only ``top.bit``, ``bootloader.bin`` and ``runtime.elf/fbi`` or ``satman.elf/fbi`` are necessary. You can use the ``prep_pkg.py`` script from extras to package them up neatly into a zip file for distributions: ```shell python prep_pkg.py -v -d artiq_kasli/ ``` Then the customer can use ``artiq_flash`` easily, after extracting the contents: ```shell artiq_flash -V -d . ```