How to compile NAS200 firmware from source?

Discussion in 'Cisco/Linksys Network Storage Devices' started by aspoon, Jun 9, 2008.

  1. aspoon

    aspoon LI Guru Member

    I tried compiling the NAS200 firmware from the official Linksys v34R62 source code on my newly installed Fedora 9. This is the output I got:

    make -C ./linux-2.6.19 bzImage
    make[1]: Entering directory `.../NAS200_V34R62_GPL/linux-2.6.19'
      CHK     include/linux/version.h
      CHK     include/linux/utsrelease.h
      HOSTCC  scripts/basic/fixdep
      HOSTCC  scripts/basic/docproc
      CC      arch/i386/kernel/asm-offsets.s
      GEN     include/asm-i386/asm-offsets.h
      HOSTCC  scripts/genksyms/genksyms.o
      HOSTCC  scripts/genksyms/lex.o
    scripts/genksyms/lex.c:1230: warning: ‘input’ defined but not used
      HOSTCC  scripts/genksyms/parse.o
      HOSTLD  scripts/genksyms/genksyms
      CC      scripts/mod/empty.o
      HOSTCC  scripts/mod/mk_elfconfig
      MKELF   scripts/mod/elfconfig.h
      HOSTCC  scripts/mod/file2alias.o
      HOSTCC  scripts/mod/modpost.o
      HOSTCC  scripts/mod/sumversion.o
    scripts/mod/sumversion.c: In function ‘get_src_version’:
    scripts/mod/sumversion.c:384: error: ‘PATH_MAX’ undeclared (first use in this function)
    scripts/mod/sumversion.c:384: error: (Each undeclared identifier is reported only once
    scripts/mod/sumversion.c:384: error: for each function it appears in.)
    scripts/mod/sumversion.c:384: warning: unused variable ‘filelist’
    make[3]: *** [scripts/mod/sumversion.o] Error 1
    make[2]: *** [scripts/mod] Error 2
    make[1]: *** [scripts] Error 2
    make[1]: Leaving directory `.../NAS200_V34R62_GPL/linux-2.6.19'
    make: *** [linux] Error 2
    Something to do with my gcc being too new (4.3.0), or perhaps I need to tweak it to use the compiler included in the toolchain?
  2. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    To be honest, I'm not sure why it would build on my Gentoo machine and not on yours. But a quick Google for the error message (scripts/mod/sumversion.c:384: error: ‘PATH_MAX’ undeclared) reveals that others have had this problem in other projects. Simply modify the scripts/mod/sumversion.c file to have the following near the top should do the trick.

    #include <limits.h>

    PS By the way if you're ever going to build the boot loader from source, you will need to edit the ecos/ script so that line near the bottom reads "_POSIX2_VERSION=200111 make" instead of "make".
  3. aspoon

    aspoon LI Guru Member

    Weird... I figured the official source code should give me something similar to the official firmware release without having to modify anything. Anyway, thanks! I'll give that a go tonight.
  4. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    The problem is not in the sources, the problem is (I believe) that the kernel needs some sources to be compiled for the host system, which depends on the include files on your system. And apparently there has been a subtle change to some headers which broke the compilation of this module. For all the programs that actually are compiled to run on the NAS200, it should really be smooth sailing.

  5. aspoon

    aspoon LI Guru Member

    As a follow-up, merely changing sumversion.c didn't work -- the "make all" failed as it was trying to make the squashfs -- couldn't locate Fedora 9 only had

    Just for the sake of fun, I extracted the Gentoo 2007.0 stage3 tarball into a directory on my Fedora 9 and chroot'd into it. The source still didn't compile until I emerged libstdc++-v3.
  6. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Thanks for that info, aspoon. I guess I'm going to have to keep an older Linux distro around to compile the NAS200 sources, or at least keep the binaries that the kernel needs to run on the host.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice