[Tutorial] How to Sync & Compile Luma3DS

Discussion in '3DS - Tutorials' started by fr3quency, Mar 27, 2016.

  1. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    There were some users that wanted to compile Luma3DS themselves but run into problems. There is already a guide that explains how to sync and compile rxTools, so most of the stuff here is stolen from this guide: https://gbatemp.net/threads/noob-proof-guide-to-compile-rxtools-source.392242/ (thanks btw @capito27. Your guide helped me compile rxTools back then and made me understand some of this shi-- stuff. :P).

    I try to keep the guide simple is both glossary/terms and images. That means I will use the same picture over and over as well as the same sentence to keep it noob-friendly.


    Follow the guide TO THE LETTER. Double check and triple check. IT JUST WORKS!™
    Seriously, if it won't work with the first try you did something wrong. "You're holding it wrong™".


    So, you want to sync & compile Luma3DS. Here's what you have to do:



    Start here:
    1. Navigate to "C:\" and create a new folder with the name "Nintendo3DS" or whatever you like. Now open this folder that you created.
      !!!!!!!!!! TIP: Don't add spaces in THAT folder's name. For example: if you want the folder to be named "Nintendo 3DS" then you will have to name it "Nintendo3DS" or "Nintendo_3DS(the difference is that there is NO space) !!!!!!!!!!

    2. Create 2 new folders inside with the names "Programs" and "Sources"
      Programs = the folder in which you install all the needed programs
      Sources = the folder in which you will sync the code.
      It should look like this:
      [​IMG]

      !!!!!!!!!! Now install all of the following programs to "C:\Nintendo3DS\Programs" !!!!!!!!!!

    3. Download Git for your operating system from here: https://git-scm.com/downloads (When you install it, just click on "Next" to everything it says).

    4. Download latest Python 3.x from here: https://www.python.org/downloads/

    5. Install devkitPro from here: https://sourceforge.net/projects/devkitpro/

    6. Download MinGW from here: https://sourceforge.net/projects/mingw/ When installation is over, it will show you a window and ask you which package to install. Choose "mingw32-base" and "msys-base", wait for the installation to finish and close the window.

    7. After you are done installing the programs from STEP 3, 4, 5 & 6, your "C:\Nintendo3DS\Programs" should look like this:
      [​IMG]

    8. Go to Luma3DS's GitHub page which can be found here: https://github.com/AuroraWright/Luma3DS and download "armips" from the description at the bottom. (If you're clueless, just press on your keyboard CTRL+F and type "armips").
      Place the file inside "C:\Nintendo3DS\Programs\devkitPro\devkitARM\bin"

    9. Download Visual C++ Redistributable 2015 x86 (EVEN IF YOU HAVE A x64(64-bit) OS) from Microsoft: https://www.microsoft.com/en-us/download/details.aspx?id=48145

    10. Download the latest MAKEROM.EXE for your OS from here: https://github.com/Steveice10/buildtools/tree/master/3ds, rename it to just "makerom.exe" and paste it in "C:\Nintendo3DS\Programs\devkitPro\devkitARM\bin"

    11. You will have to edit your PATH. Don't freak out, it's easy:
      Right click on your Computer ICON --> Properties --> Advanced system settings --> Environment Variables... --> System variables --> FIND "Path" --> Edit.
      If you did it right, you should be looking at this window:
      [​IMG]

      Now add the locations that are inside the red rectangle THEY HAVE TO BE AT THE TOP!

    12. Navigate to "C:\Nintendo3DS\Sources\" - As I said at the beginning of the guide, this is the folder that we will sync in everything we need in order to compile Luma3DS (Luma3DS will also be synced in this folder)

    13. We need to sync & compile CTRULIB first.

    14. On your keyboard press SHIFT and right click with your mouse. The right click context menu will show you a new option "Open command window here". Click it.
      This is how it should look like:
      [​IMG]

    15. Now type "git clone --recursive https://github.com/smealum/ctrulib.git"
      This is how it should look like:
      [​IMG]

    16. Navigate to "C:\Nintendo3DS\Sources\ctrulib\libctru"

    17. On your keyboard press SHIFT and right click with your mouse. The right click context menu will show you a new option "Open command window here". Click it.
      This is how it should look like:
      [​IMG]

    18. Now simply type "make" and wait to compile.
      This is how it should look like:
      [​IMG]

    19. Navigate to "C:\Nintendo3DS\Sources\ctrulib" and COPY the folder with the name "libctru"
      This is how it looks like:
      [​IMG]

    20. Navigate to "C:\Nintendo3DS\PROGRAMS\devkitPro". In here, you will see an OLDER version of the "libctru" folder. First rename this folder to "OLD_libctru" and THEN paste the folder you had previously copied.
      If you did it right, you must be looking at this:
      [​IMG]

    21. Go back to "C:\Nintendo3DS\Sources\". You will have to sync firmtool. https://github.com/TuxSH/firmtool
      On your keyboard press SHIFT and right click with your mouse. The right click context menu will show you a new option "Open command window here". Click it.
      This is how it should look like:
      [​IMG]
    22. Now type "git clone --recursive https://github.com/TuxSH/firmtool"
      Open the folder you just synced. On your keyboard press SHIFT and right click with your mouse. The right click context menu will show you a new option "Open command window here". Click it.
      This is how it should look like:
      [​IMG]
    23. Now type "pip install cryptography" and when it's done type "pip install git+https://github.com/TuxSH/firmtool.git"
    24. Navigate to 'C:\Nintendo3DS\Sources"
      It time to sync Luma3DS. You're 95% done.

    25. On your keyboard press SHIFT and right click with your mouse. The right click context menu will show you a new option "Open command window here". Click it.
      This is how it should look like:
      [​IMG]

    26. Now type "git clone --recursive https://github.com/AuroraWright/Luma3DS.git", press enter and wait for it to sync the sources.
      This is how it should look like:
      [​IMG]

    27. After it is done, you will see a newly created folder named "Luma3DS". Open this new folder.
      This is how it should look like:
      [​IMG]

    28. On your keyboard press SHIFT and right click with your mouse. The right click context menu will show you a new option "Open command window here". Click it.
      This is how it should look like:
      [​IMG]

    29. Now simply type "make" and wait for it to do its job.
      This how it should look like:
      [​IMG]

    30. After you type the "make" command, you will see a NEW folder named "out" inside Luma3DS's folder(C:\Nintendo3DS\Sources\Luma3DS\out)
      This is how it looks like:
      [​IMG]




    Congratulation, you have successfully compiled Luma3DS! Now transfer the boot.firm file that you FINALLY created to your 3DS and have fun. :)

    Credits go to @Aurora Wright for creating Luma3DS, @TuxSH, @Supster131, @astronautlevel and @Madridi for helping me out with every noob question I had and, of course, @capito27 for creating the original guide to compile rxTools(it really really helped me and sparked my desire to learn about all this stuff. Thanks a lot @capito27 !). And of course to all those that have helped build what we have now on our 3DS systems. If anyone feels I left them out, PM me so I can add your name here. <3




    -----------> This guide can also be used to compile GodMode9/Decrypt9/SafeB9SInstsller if you ever wish to do so; you just need to replace the git page with the one where GodMode9/Decrypt9/SafeB9SInstsller is found in.
     
    Last edited by fr3quency, Jul 13, 2017


  2. capito27

    capito27 GBAtemp Advanced Fan

    Member
    873
    1,005
    Jan 19, 2015
    Swaziland
    protip for people, stop reading "armips" as "armpits" early on, it helps later on :)
     
  3. Supster131

    Supster131 (づ。◕‿‿◕。)づ *:・゚✧

    Member
    3,160
    2,176
    Jan 19, 2016
    United States
    My Computer
    Nah, armpits for life! ( ͡° ͜ʖ ͡°)
    It's funny, tbh.
     
  4. DjoeN

    DjoeN Captain Haddock!

    Member
    5,118
    1,475
    Oct 21, 2005
    Belgium
    Somewhere in this potatoland!
    @fr3quency

    Another protip:
    Once everything is setup properlly, use the next code in a batch file (call it whatever you like, mine is named build_AuReiNand.bat)
    Place the batch file in your SOURCES folder and run it, wait till it ends and everything should be there :)
    This script is originally made by @WhoAmI? to compile rxTools, but i changed it a bit for AuReiNand

    [NOTE]
    You can run the script from whatever folder or root you want once everything is setup properlly.

    Code:
    @echo off
    Title = Building AuReiNand...
    cls
    %~d0
    cd %~dp0
    if exist "AuReiNand" (
        cd AuReiNand
        Title = Building AuReiNand ^(Update^)...
        echo Updating repo...
        git pull origin master
        git submodule update --init --recursive
    ) else (
        Title = Building AuReiNand ^(Clone^)...
        echo Cloning repo...
        git clone --recursive https://github.com/AuroraWright/AuReiNand.git
        cd AuReiNand
    )
    echo Building...
    Title = Building AuReiNand ^(Clean^)...
    make clean
    Title = Building AuReiNand ^(Release^)...
    make
    Title =  Building AuReiNand ^(Done^)
    echo.
    echo ################################################
    color A
    echo Done. Files are in the "/AuReiNand/out" folder.
    cd ..
    pause >nul
    goto :EOF
     
    Madridi and fr3quency like this.
  5. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    Wow this is awesome. Where have you been all this time? :P Why doesn't everyone know about this script? :P


    Edit: tested it and it works as expected. I prefer doing things manually, but users in here might find it more convenient. Do you mind if I add a link that links to your post? Of course proper credits will be given(don't look at me Reisyukaku, I can feel your glare. xD <3)
     
    Last edited by fr3quency, Mar 28, 2016
    WhoAmI? and DjoeN like this.
  6. DjoeN

    DjoeN Captain Haddock!

    Member
    5,118
    1,475
    Oct 21, 2005
    Belgium
    Somewhere in this potatoland!
    Cause in that time, once @WhoAmI? stopped compiling, the script got a bit lost in all the posts :P
    but i still use it to compile all cfw's, and most of @d0k3 homebrew (decrypt9/emunand9/etc...)
     
    WhoAmI? likes this.
  7. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    You got a script that compiles CTRXplorer? I can compile Decrypt9 using this guide, but CTRXplorer fails on me because it needs additional tools.
     
    Michierusama likes this.
  8. Ericjwg

    Ericjwg Good

    Member
    2,822
    676
    Jul 2, 2015
    Canada
    git on windows? :lol:
     
  9. SomeGamer

    SomeGamer GBAtemp Guru

    Member
    5,695
    2,658
    Dec 19, 2014
    Hungary
    Someone should make a script collection. Or some kind of master script which can do it all.
     
  10. DjoeN

    DjoeN Captain Haddock!

    Member
    5,118
    1,475
    Oct 21, 2005
    Belgium
    Somewhere in this potatoland!
    for CTRXplorer you need to install "citrus" etc... and to build "citrus" you need "picasso"
    The script is nothing, you need to install all needed libs :D

    I don't have a pre-compiled version of citrus (i wish i could provide you one, but i haven't looked for it anyway)
     
    Last edited by DjoeN, Mar 28, 2016
  11. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    I synced citrus but I have no idea what to do next. I typed "make" in a CMD window inside the citrus folder and copied the compiled stuff to CTRXplorer folder. I tried other things as well but I never managed to compile it(CTRXplorer).
     
  12. cots

    cots GBAtemp Fan

    Member
    476
    305
    Dec 29, 2014
    United States
    Thanks for the guide. You should write more of them and be an example of how to make guides (you included pictures).
     
    fr3quency likes this.
  13. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    Thanks for the kind words. I think I'll create a guide on how to compile Aurora Wright's arm9loaderhax(both screen-init and non-screen-init versions) so you can get "payload_stage1.bin" and "payload_stage2.bin".
     
  14. urherenow

    urherenow GBAtemp Addict

    Member
    2,762
    789
    Mar 8, 2009
    United States
    Japan
    Decent guide. There should be a note on #2 to tick the ckeckbox to add python to your path when installing though (needed for many other projects). Also for other projects, devkitARM/bin should be in your path BEFORE 'Program Files....' because certain ways of making makefiles make devkitpro throw up if there is a space in the path. Similar guide was written long ago for rxtools and has been in my sig.
     
    fr3quency likes this.
  15. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    For Python, what do we need to add to PATH? Is it "C:\Program Files\Python27\" or a sub-folder?
     
  16. urherenow

    urherenow GBAtemp Addict

    Member
    2,762
    789
    Mar 8, 2009
    United States
    Japan
    When you run the installer, there is a checkbox that you can tick. Done. Most people don't notice that it's there...

    But... to do it manually, you just use whatever path you used to install (not everyone uses the default). For me, it's c:\Python27.
    For some reason (can't remember why now) I also put c:\Python27\Scripts in there as well.
     
  17. D34DL1N3R

    D34DL1N3R Nephilim

    Member
    1,702
    197
    Dec 6, 2008
    United States
    No idea why, but checking the box has never worked for me on any Windows install. Every time I look it's never there & I have to add it manually. Not saying don't do it, just check to make sure it worked. :)
     
  18. Omegapsy

    Omegapsy Advanced Member

    Newcomer
    79
    19
    Feb 20, 2012
    United States
    Thanks for this. The setup fixed the build enviroments for some other programs I was trying to compile. Good clean guide sir!!
     
    fr3quency likes this.
  19. DjoeN

    DjoeN Captain Haddock!

    Member
    5,118
    1,475
    Oct 21, 2005
    Belgium
    Somewhere in this potatoland!
    Ok, i managed to compile CTRXplorer :)

    Once you compile citrus, you are left with a zip file in the output folder.
    Unzip this in c:\devkitPro\citrus (make the folder)
    You should have:
    c:\devkitPro\citrus\include
    c:\devkitPro\citrus\include\citrus
    c:\devkitPro\citrus\include\citrus\*.hpp
    c:\devkitPro\citrus\lib\
    c:\devkitPro\citrus\lib\libcitrus.a

    Now you should be able to compile CTRXplorer
     
    Michierusama and fr3quency like this.
  20. fr3quency
    OP

    fr3quency GBAtemp Advanced Fan

    Member
    781
    332
    Jan 11, 2016
    Greece
    Wherever my imagination decides.
    Thanks! I'll try in some hours because I'm traveling ATM. I might also create a guide on how to compile stage1 and stage2 for the different a9lh forks, but I will see if the other guides(if any) offer more things or if they are complicated.