Skip to content

How to export NDAS source for different architectures

iocellnetworks edited this page Oct 17, 2012 · 1 revision

The code needs to be exported primarily based on system architecture. There are several other options that can be set too. Try `make help` first to see a list of all the architecture and options that can be assigned on the export command.

After exporting the module source code there will be a build_ARCH_linux folder in which you may further build the kernel modules for testing.

Table of Contents

Pre-requisites:

  • gcc
  • git
  • ssh
  • make
  • kernel-headers (or kernel source which had a config and make config)

Different kernel version

If your kernel version does not exist, copy the nearest folder and rename it to your running kernel version. Then open the version.mk file and change the kernel identifiers to match.

Exporting a build folder

The basic command goes like so:

 make [release or debug] [architecture specific options]

There two working options for x86 and x86_64 which don't need any specific options. There many more build targets predefined in the arch folder as well. For now, you can try one of the following to see how it works.

For x86:

 make linux-rel 
 or 
 make linux-dev

For x86_64:

 make linux64-rel
 or
 make linux64-dev
  • rel = release, the log messages will be very few
  • dev = development or debugger version with many many log messages.
Note: After exporting the dev version, you need to turn on debug messages in the build folder Makefile.
 vi Makefile 
 Change NDAS_DEBUG= to NDAS_DEBUG=y
 Save and exit.

Here is an example download and build for x86 32bit on Fedora 16:

1) Download and export a build folder.

 $ git://github.com/iocellnetworks/ndas4linux.git
 $ cd ndas4linux/3.4.4
 $ make linux-rel

This creates a working build folder and tarball of what is in the main source. To see what you have, try:

 $ ls build_x86_linux/dist
 libndas.a	ndas-3.4-4.x86.tar.gz

The library file is made mostly of the folders on the top level. The tarball includes the library and the platform sources.

 $ ls build_x86_linux/ndas-3.4-4.x86
 admin        debuglevel.mk  ipkg ... ... 

This is the working build folder. It is the source for /dist/ndas-3.4-4.tar.gz

Build the exported modules

 $ cd build_x86_linux/ndas-3.4-4.x86

Turn on debugging

If you chose the dev (debug) version, now you should edit that Makefile to turn on debug messages.

 $ make
 $ sudo make install
 $ sudo /etc/init.d/ndas start

If the modules load you then can test the usage with the ndasadmin tool.

 $ sudo ndasadmin help

Test and distribute

If you can mount disks and use them for stable transfer, then it is all set. The distribution tarball (3.4.4/dist/ndas-3.4-4.x86.tar.gz) can be used to build rpm or deb packages if you need them. Otherwise, NDAS should now be running on your system when you reboot.

If you like to share, please send the working exported tarball and any distribution packages to IOCELL Networks to be added to the download section.

Clean up (Optional)

If you will build and use installer packages, stop the current ndas, clean up all the files, then read how_to_build_rpm.txt or how_to_build_deb.txt. You may also need to clean up if you find a bug and need to fix then rebuild the modules.

 $ sudo ndasadmin disable -s `N` <- N is each slot that was enabled.
 $ sudo /etc/init.d/ndas stop
 $ make linux-clean

Error handling

If there are compile errors or if something fails in the modules or ndasadmin program, it can probably be fixed in the build_x86_linux/ndas-#.#.#.x folder. When all is fixed and the build is stable, the changed files should be written into the original export folder. There are some other files in the build folder, so be careful only to copy what is already in the original location.

This rsync command is one way to move the changes. It excludes the spec and Makefiles because their content can change based on what is exported.

 $ cd ~/ndas4linux/3.4.4
 $ rsync -rvi --existing --size-only --exclude=ndas.spec \
     --exclude=Makefile \
     build_x86_linux/ndas-3.4.4.x86 \
     platform/linux/tarball-tag

New kernel version

If you will build NDAS for a kernel that does not already exist in the reopsitory, you can just copy the nearest main folder, then change version.mk to match the kernel you want to build for.

Example:

 $ cd ~/ndas4linux
 $ cp -r 3.3.4  3.3.5
 $ cd 3.3.5
 $ vi version.mk
 Change as needed:
   NDAS_VER_MAJOR=3
   NDAS_VER_MINOR=3
   NDAS_VER_BUILD=5  
  Save and quit

More about dev and rel

The rel sends out a very quiet version. It only shows a few printk reports to the system logs, and just a few messages to the cli. Also, the library code is obfuscated.

The dev options will export a "dbg" tarball and source folder. This version will create very large log files of everything that is happening as the driver is running. You can tweak the output of the dbg version by first editing x.x.x/inc/dbgcfg.h then running make linux-dev.

See also

  • how_to_use_ndasadmin.txt
  • how_to_build.txt
  • how_to_build_rpm.txt
  • how_to_build_deb.txt