HowToCompile: Contents
  How To Compile MicroLua v4.0.1
    Introduction
    Make the default.arm7 to use Nifi
    Windows
      Details
      Folders
      Notes
    Linux
      Details
      Folders
      Notes

How To Compile

How to compile MicroLua.

How To Compile MicroLua v4.0.1

Introduction

This page will guide you on how to setup the development environment for building the source of MicroLua. There are several steps and several packages to install, but should be relatively straightforward.

Make the default.arm7 to use Nifi

see the wiki page : Make_ARM7

Windows

First download everything here and then follow the instructions below.

Details

DevKitPro

Start with DevKitPro, using the "Updater", that is an automatic downloader. You will only need msys and devkitARM, so you can uncheck the others unless you plan to make homebrews for PSP, NGC or Wii, or you want to use the utilities. This package is the compiler and binary tools for compiling ARM source code. Recommend to install to 'c:\devkitpro'. Just don't use spaces in any folder names. Hereafter we refer to your devkitpro install folder as simply '\devkitpro'. You might have troubles in downloading some packages, like senseless connection drop-out at the end of a download. In this case you can download all you need on the devkitPro Sourceforge.

uLibrary

uLibrary is a lib for low level 'OS' like stuff for ARM processors. This is built next. If you didn't installed devkitPro to 'c:\devkitpro', you have first to change paths in each bat files you will use here.
  • Unpack to '\devkitpro\'
  • rename "uLibrary - 1.12" to uLibrary
  • cd to '\devkitpro\uLibrary\Source\'
  • Run 'build.bat'
  • Run 'Install.bat'
  • cd .. to '\devkitpro\uLibrary\'
  • Run 'Install.bat' here also (yes they do 2 different tasks!)

MicroLua Source

  • Extract the MicroLua source to folder '\devkitpro\', or GetTheCurrentSourceCode. You only need the 'luads' directory.
  • Copy '\devkitpro\luads\img\fcsr.dldi' file to '\devkitpro\devkitarm\bin\dldi\' (make the dldi folder). This is only used to compile the No$GBA version, so if you don't care about it, you don't need to do this.

Launch the compilation

Now use \devkitpro\luads\Compile All.bat\devkitpro\luads\Compile All.bat file to build. Either double click it of launch it from the command line (recommended). Note you need admin rights to install the Lua library after its compilation. You can launch 'Compile All.bat' as admin by right-clicking on it and choosing "Run as administrator", or throught a CMD that is already in administrator mode. === Folders === {{{ \devkitPro \devkitARM \examples \insight (only if you installed it) \libgba \libmirko \libnds \luads \Examples \Fat \img \lua-5.1.3 \source \Utilities \msys \Other Libs \Programmers Notepad (only if you installed it) \uLibrary-1.12 }}} === Notes === ==== Libs ==== Once the DevKitPro, uLibrary and Lua are setup you don't have to recompile those unless one of these components is updated. The setup is complete. To compile only uLua (that is to say, 'source/main.c' and other files you may add here), just use 'Compile DS.bat'. ==== Environment variables ==== DevKitPro uses 2 environment variables. They are: {{{ DEVKITPRO=c:\devkitpro DEVKITARM=c:\devkitpro\devkitarm }}} To do it manually: Start->Control Panel->System
Then click on 'Advanced' tab
Then click the button at the bottom 'Environment Variables'
They should be in the bottom list, System Variables
==== Reference Package ==== We should probably make a big package for win32 that contains all this stuff already done. This way newbies can get just one package to unzip and go. Such a package would be about 70Mb zipped. ---- == Linux == First download everything here and then follow the instructions below. * Several archives are in the 7z format, so you will need [http://www.7-zip.org/ 7-zip] For debian/ubuntu use
file to build. Either double click it of launch it from the command line (recommended). Note you need admin rights to install the Lua library after its compilation. You can launch 'Compile All.bat' as admin by right-clicking on it and choosing "Run as administrator", or throught a CMD that is already in administrator mode.

Folders

\devkitPro
        \devkitARM
        \examples
        \insight (only if you installed it)
        \libgba
        \libmirko
        \libnds
        \luads
                \Examples
                \Fat
                \img
                \lua-5.1.3
                \source
                \Utilities
        \msys
        \Other Libs
        \Programmers Notepad (only if you installed it)
        \uLibrary-1.12
\devkitPro
\devkitARM\examples\insight (only if you installed it)\libgba\libmirko\libnds\luads\Examples\Fat\img\lua-5.1.3\source\Utilities\msys\Other Libs\Programmers Notepad (only if you installed it)\uLibrary-1.12
}}}

Notes

Libs

Once the DevKitPro, uLibrary and Lua are setup you don't have to recompile those unless one of these components is updated. The setup is complete. To compile only uLua (that is to say, 'source/main.c' and other files you may add here), just use 'Compile DS.bat'.

Environment variables

DevKitPro uses 2 environment variables. They are:
 DEVKITPRO=c:\devkitpro
 DEVKITARM=c:\devkitpro\devkitarm
DEVKITPRO=c:\devkitproDEVKITARM=c:\devkitpro\devkitarm
}}}

To do it manually:
Start->Control Panel->System
Then click on 'Advanced' tab
Then click the button at the bottom 'Environment Variables'
They should be in the bottom list, System Variables

Reference Package

We should probably make a big package for win32 that contains all this stuff already done. This way newbies can get just one package to unzip and go. Such a package would be about 70Mb zipped.

----

Linux

First download everything here and then follow the instructions below.

  • Several archives are in the 7z format, so you will need 7-zip
For debian/ubuntu use apt-get install p7zipapt-get install p7zip or try or try yum install 7zyum install 7z. * [http://sourceforge.net/projects/devkitpro/files/ Go here to get devkitpro packages] Click on "View All Files" to see the folders listed below. Many packages are listed at the SourceForge site. I've listed the folders and the versions I used. || *Folder* || *Package* || || devkitARM/previous/DevkitARM release 30 || devkitARM_r30-i686-linux.tar.bz2 || || dswifi/previous/dswiki 0.3.12 || dswifi-0.3.12.tar.bz2 || || libnds/previous/libnds-1.4.3 || libnds-1.4.3.tar.bz2 || || filesystem/filesystem-0.9.6 || libfilesystem-0.9.6.tar.bz2 || || default arm7/previous || default_arm7-0.5.12.tar.bz2 || || maxmod/maxmod 1.0.6 || maxmod-nds-1.0.6.tar.bz2 || || libfat || libfat-nds-1.0.7.tar.bz2 || * [http://brunni.palib.info/new/dl/nds/uLibrary.7z uLibrary] * GetTheCurrentSourceCode === Details === ==== DevKitPro ==== I used 'root' to build my pkgs, you may use your user account under your home folder, just change the devkitpro path as needed. Make a folder to work in. I used .
Many packages are listed at the SourceForge site. I've listed the folders and the versions I used.
Folder Package
devkitARM/previous/DevkitARM release 30 devkitARM_r30-i686-linux.tar.bz2
dswifi/previous/dswiki 0.3.12 dswifi-0.3.12.tar.bz2
libnds/previous/libnds-1.4.3 libnds-1.4.3.tar.bz2
filesystem/filesystem-0.9.6 libfilesystem-0.9.6.tar.bz2
default arm7/previous default_arm7-0.5.12.tar.bz2
maxmod/maxmod 1.0.6 maxmod-nds-1.0.6.tar.bz2
libfat libfat-nds-1.0.7.tar.bz2

Details

DevKitPro

I used 'root' to build my pkgs, you may use your user account under your home folder, just change the devkitpro path as needed.

Make a folder to work in. I used /opt/devkitpro//opt/devkitpro/. {{{ mkdir /opt/devkitpro cd /opt/devkitpro }}} Just don't use spaces in any folder names. Hereafter we refer to your devkitpro install folder as simply '/devkitpro'. ==== Unpack packages ==== Unpack the devkitARM_r30-i686-linux.tar.bz2 package into '/devkitpro'. {{{ tar -jxvf devkitARM_r30-i686-linux.tar.bz2 -C /opt/devkitpro/ tar -jxvf dswifi-0.3.12.tar.bz2 -C /opt/devkitpro/ tar -jxvf libnds-1.4.3.tar.bz2 -C /opt/devkitpro/ tar -jxvf libfilesystem-0.9.6.tar.bz2 -C /opt/devkitpro/ tar -jxvf default_arm7-0.5.12.tar.bz2 -C /opt/devkitpro/ tar -jxvf maxmod-nds-1.0.6.tar.bz2 -C /opt/devkitpro/ tar -jxvf libfat-nds-1.0.7.tar.bz2 -C /opt/devkitpro/ p7zip -d uLibrary.7z mv uLibrary\ -\ 1.12/ /opt/devkitpro/uLibrary }}} Copy files. {{{ cp /opt/devkitpro/default.arm7 /opt/devkitpro/libnds/ cp /opt/devkitpro/default.elf /opt/devkitpro/libnds/ }}} ==== MicroLua Source ==== * Extract the MicroLua source to folder '/devkitpro', or GetTheCurrentSourceCode. * You can skip this item if you only need a .
 mkdir /opt/devkitpro
 cd /opt/devkitpro
mkdir /opt/devkitprocd /opt/devkitpro
}}} Just don't use spaces in any folder names.

Hereafter we refer to your devkitpro install folder as simply '/devkitpro'.

Unpack packages

Unpack the devkitARM_r30-i686-linux.tar.bz2 package into '/devkitpro'.
 tar -jxvf devkitARM_r30-i686-linux.tar.bz2 -C /opt/devkitpro/
 tar -jxvf dswifi-0.3.12.tar.bz2 -C /opt/devkitpro/
 tar -jxvf libnds-1.4.3.tar.bz2 -C /opt/devkitpro/
 tar -jxvf libfilesystem-0.9.6.tar.bz2 -C /opt/devkitpro/
 tar -jxvf default_arm7-0.5.12.tar.bz2 -C /opt/devkitpro/
 tar -jxvf maxmod-nds-1.0.6.tar.bz2 -C /opt/devkitpro/
 tar -jxvf libfat-nds-1.0.7.tar.bz2 -C /opt/devkitpro/
 p7zip -d uLibrary.7z
 mv uLibrary\ -\ 1.12/ /opt/devkitpro/uLibrary
 
tar -jxvf devkitARM_r30-i686-linux.tar.bz2 -C /opt/devkitpro/tar -jxvf dswifi-0.3.12.tar.bz2 -C /opt/devkitpro/tar -jxvf libnds-1.4.3.tar.bz2 -C /opt/devkitpro/tar -jxvf libfilesystem-0.9.6.tar.bz2 -C /opt/devkitpro/tar -jxvf default_arm7-0.5.12.tar.bz2 -C /opt/devkitpro/tar -jxvf maxmod-nds-1.0.6.tar.bz2 -C /opt/devkitpro/tar -jxvf libfat-nds-1.0.7.tar.bz2 -C /opt/devkitpro/p7zip -d uLibrary.7zmv uLibrary\ -\ 1.12/ /opt/devkitpro/uLibrary}}}
Copy files.
 cp /opt/devkitpro/default.arm7 /opt/devkitpro/libnds/
 cp /opt/devkitpro/default.elf /opt/devkitpro/libnds/
cp /opt/devkitpro/default.arm7 /opt/devkitpro/libnds/cp /opt/devkitpro/default.elf /opt/devkitpro/libnds/
}}}

MicroLua Source

  • Extract the MicroLua source to folder '/devkitpro', or GetTheCurrentSourceCode.
  • You can skip this item if you only need a .nds.nds for you hardware. If you want a for you hardware. If you want a .nds.nds to test on _No$GBA_ you'll have to rename the resulting source folder (the one containing to test on No$GBA you'll have to rename the resulting source folder (the one containing ExamplesExamples, , FatFat...) to 'luads'. This is because the name of a compiled file is the same as the source folder and a ...) to 'luads'. This is because the name of a compiled file is the same as the source folder and a luads.imgluads.img will be needed. Note that if you track the code in our repository, you'll have to rename it again to will be needed. Note that if you track the code in our repository, you'll have to rename it again to trunktrunk before updates, unless you only checked out the trunk. ==== Makefiles for Linux ==== Some changes had to be made to get the build system to work in Linux. However they are very minor. These have been checked into svn here. * Locate the Makefile at luads/ folder, and comment out the win32 line and uncomment the linux line. {{{ #if windows uncomment this #EXPORT_DIR := /c/ndsexamples/ #if linux uncomment this EXPORT_DIR := ./nds_examples/ }}} * Locate the Makefile in the luads/lua-5.1.3/src folder. Add 2 includes '-I. -I.. ' {{{ LIBDIRS := $(DEVKITPRO)/libnds export INCLUDE := -I. -I.. $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include/nds) \ }}} ==== Environment Variables ==== export env vars: (shell dependant, BASH use export) {{{ DEVKITPRO=/opt/devkitpro DEVKITARM=$DEVKITPRO/devkitARM }}} ==== Launch the compilation ==== First we need to make a folder that mimics the win32 setup. Then we need to make 2 symbolic links so everything will match up. {{{ mkdir /opt/devkitpro/libnds cd /opt/devkitpro/libnds ln -s ../include include ln -s ../lib lib }}} ===== uLibrary ===== Change to uLibrary and build the package. {{{ cd /opt/devkitpro/uLibrary/Source make make install }}} Rename before updates, unless you only checked out the trunk.

Makefiles for Linux

Some changes had to be made to get the build system to work in Linux. However they are very minor. These have been checked into svn here.

  • Locate the Makefile at luads/ folder, and comment out the win32 line and uncomment the linux line.
 
         #if windows uncomment this 
         #EXPORT_DIR := /c/ndsexamples/ 
         #if linux uncomment this
         EXPORT_DIR := ./nds_examples/
  1. if windows uncomment this
  2. EXPORT_DIR := /c/ndsexamples/
  3. if linux uncomment this
EXPORT_DIR := ./nds_examples/
}}}

  • Locate the Makefile in the luads/lua-5.1.3/src folder. Add 2 includes '-I. -I.. '
  LIBDIRS :=      $(DEVKITPRO)/libnds
  export INCLUDE  :=      -I. -I.. $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
                                   $(foreach dir,$(LIBDIRS),-I$(dir)/include/nds) \

LIBDIRS := $(DEVKITPRO)/libndsexport INCLUDE := -I. -I.. $(foreach dir,$(LIBDIRS),-I$(dir)/include) \$(foreach dir,$(LIBDIRS),-I$(dir)/include/nds) \
}}}

Environment Variables

export env vars: (shell dependant, BASH use export)
 DEVKITPRO=/opt/devkitpro
 DEVKITARM=$DEVKITPRO/devkitARM
DEVKITPRO=/opt/devkitproDEVKITARM=$DEVKITPRO/devkitARM
}}}

Launch the compilation

First we need to make a folder that mimics the win32 setup. Then we need to make 2 symbolic links so everything will match up.
 mkdir /opt/devkitpro/libnds
 cd /opt/devkitpro/libnds
 ln -s ../include include
 ln -s ../lib lib
mkdir /opt/devkitpro/libndscd /opt/devkitpro/libndsln -s ../include includeln -s ../lib lib
}}}
uLibrary
Change to uLibrary and build the package.
 cd /opt/devkitpro/uLibrary/Source
 make
 make install
cd /opt/devkitpro/uLibrary/Sourcemakemake install
}}} Rename include/uLibinclude/uLib to to include/ulibinclude/ulib (lower case L !) {{{ mv /opt/devkitpro/include/uLib/ /opt/devkitpro/include/ulib }}} ===== Lua-5.1.3 ===== Build the core Lua code and the Microlua extension code. I had to do this as root user. {{{ cd /path/to/sources/lua-5.1.3 make make install }}} ===== Microlua binaries ===== ====== Test versions ====== You can skip this section if you only need a (lower case L !)
 mv /opt/devkitpro/include/uLib/ /opt/devkitpro/include/ulib
mv /opt/devkitpro/include/uLib/ /opt/devkitpro/include/ulib
}}}
Lua-5.1.3
Build the core Lua code and the Microlua extension code. I had to do this as root user.
 cd /path/to/sources/lua-5.1.3
 make
 make install
cd /path/to/sources/lua-5.1.3makemake install
}}}
Microlua binaries
Test versions
You can skip this section if you only need a .nds.nds for you hardware. If you want a for you hardware. If you want a .nds.nds to test on _No$GBA_ your source folder will need to be named 'luads', and you'll need to do this: {{{ mkdir /opt/devkitpro/devkitARM/bin/dldi/ cp /path/to/sources/img/fcsr.dldi /opt/devkitpro/devkitARM/bin/dldi/fcsr.dldi cd /path/to/sources/ cp ./img/luads.img luads.img [hack, until someone figures the way to make this image in linux] make }}} ======= Hardware versions ====== {{{ cd /path/to/sources/ make }}} * Copy xxxx.nds to your linker and run. === Folders === {{{ /opt /devkitpro /devkitARM /include /lib /libnds /luads /Examples /Fat /img /lua-5.1.3 /source /uLibrary }}} === Notes === ==== Tested Linux Versions ==== Lets list the tested Linux OS (and OSX10.?) here. * Ubuntu LTS 8.04 * Ubuntu LTS 9.10 * Debian Squeeze as of December 4th 2009 ==== Libs ==== Once the DevARM- to test on No$GBA your source folder will need to be named 'luads', and you'll need to do this:
 mkdir /opt/devkitpro/devkitARM/bin/dldi/
 cp /path/to/sources/img/fcsr.dldi /opt/devkitpro/devkitARM/bin/dldi/fcsr.dldi
 cd /path/to/sources/
 cp ./img/luads.img luads.img [hack, until someone figures the way to make this image in linux]
 make
mkdir /opt/devkitpro/devkitARM/bin/dldi/cp /path/to/sources/img/fcsr.dldi /opt/devkitpro/devkitARM/bin/dldi/fcsr.dldicd /path/to/sources/cp ./img/luads.img luads.img [hack, until someone figures the way to make this image in linux]make
}}}
Hardware versions ======

 cd /path/to/sources/
 make
cd /path/to/sources/make
}}}

  • Copy xxxx.nds to your linker and run.

Folders

/opt
   /devkitpro
        /devkitARM
        /include
        /lib
        /libnds
        /luads
                /Examples
                /Fat
                /img
                /lua-5.1.3
                /source
        /uLibrary
/opt
/devkitpro/devkitARM/include/lib/libnds/luads/Examples/Fat/img/lua-5.1.3/source/uLibrary
}}}

Notes

Tested Linux Versions

Lets list the tested Linux OS (and OSX10.?) here.
  • Ubuntu LTS 8.04
  • Ubuntu LTS 9.10
  • Debian Squeeze as of December 4th 2009

Libs

Once the DevARM-r30r30, uLibrary are setup you don't have to recompile those unless one of these components is updated. The setup is complete.