Home‎ > ‎Actiontec MI424WR Rev-f‎ > ‎

Attempt to Compile the Source code


Setup of Build System

In summary, you will need a 32-bit Fedora 10, 11, or 12 system for the GPL code released by ActionTec.

I created a Ubuntu 64 (v12.10), virtual machine, since I primarily run Windows 7. The instructions from Actiontec require Linux. The instructions from Actiontec calls for "recent versions of Fedora, like versions 10, 11 or 12". Interestingly, at the time that I am trying this, Fedora is on version 17. Following bootup of Ubuntu I updates its packages and I decided to remove stuff that I would not need such as image and multimedia software packages to reduce the Virt's footprint. Then I used Ubuntu's software center to install the build-essential package. Followed by sudo aprt-get update and sudo aprt-get upgrade. At this point gcc -v and make -v are returning stuff, which tells me I have a system ready for development.  --- Looking at Actiontec's download list again, it looks like that I did not really need to get GCC, since i386-jungo-linux-gnu.tar.gz package that they provide looks to have GCC.

I created a folder named Actiontec in my home folder since I wanted to put all of the Actiontec stuff in one place, and then copied jpkg and tar files that I had downloaded from Actiontec to that folder.
Per instructions I untar the source code:
tar zxvf actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8.tar.gz

Followed by 
sudo mkdir /usr/local/openrg
sudo mv i386-jungo-linux-gnu.tar.gz /usr/local/openrg
sudo mv jpkg.tar.gz /usr/local/openrg
sudo mv toolchain-mips64-octeon_20070905.jpkg /usr/local/openrg

cd /usr/local/openrg
sudo tar zxvf i386-jungo-linux-gnu.tar.gz 
sudo tar zxvf jpkg.tar.gz
sudo ./jpkg -x -C / toolchain-mips64-octeon_20070905.jpkg

Then went back to [my home]/opensource-mi424wr-rev-ef/rg
Per instructions, I run the following make command to create the new image:
make config CONFIG_RG_GPL=y DIST=MC524WR LIC=../jpkg_actiontec_gpl.lic && make

Then I realized that the build process needs root access:
please enter root's password (needed by exec_as_root):
Password: 
su: Authentication failure
make: *** [exec_as_root] Error 1

So, I enabled the root account in my Ubunto installation by:
username1@ubuntu:~/Actiontec/opensource-mi424wr-rev-ef/rg$ sudo -i
[sudo] password for username1: 
root@ubuntu:~# sudo passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@ubuntu:~# exit

Then I tried to recompile:
username1@ubuntu:~/Actiontec/opensource-mi424wr-rev-ef/rg$ make config CONFIG_RG_GPL=y DIST=MC524WR LIC=../jpkg_actiontec_gpl.lic && make

I hot the following, which in short it didn't work:

          /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/host_config.h \
          /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/host_config.mk \
          /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/host_config.sh
mkdir -p /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build
please enter root's password (needed by exec_as_root):
Password: 
mkdir -p /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build
. /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/host_config.sh ; \
          $CC \
          -DUSE_BASIC_HOST_CONFIG=1 -I/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR -I/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/ -I/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/include -I/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/util -Wall -Werror -g -Wstrict-prototypes --static -DENTITY_ID=LOG_ENTITY_OTHER -DLIC_RG_APP=\"\" -DIS_DISTRIBUTION -DCONFIG_RG_GPL  -o /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/create_config /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/util/rg_error.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/util/rg_print.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/util/alloc.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/util/str.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/util/rg_version.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/create_config.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/dist_config.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/hw_config.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/config_opt.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/major_features.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/config_host.c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/config_target_os.c \
          
mkdir -p /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/main/
mkdir -p /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/util/
BUILDDIR=/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR RGSRC=/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg CONFIG_LOG=/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/config.log \
          /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/create_config \
            -d "MC524WR" -f LIC=../jpkg_actiontec_gpl.lic -f CONFIG_RG_GPL=y -m /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/rg_config.mk \
            -e /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/main/device_conf.set \
            -M /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/openrg_features.txt \
            -F /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/features.c \
            -i /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/rg_config.h -c /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/util/rg_c_config.c \
            >/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/config.log \
            2>&1 ; RET=$? ; cat /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/build.MC524WR/config.log ; exit $RET
Replacing CONFIG_BLK_DEV_SD=y (from /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/dist_config.c:5441) with CONFIG_BLK_DEV_SD=m from (/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:674)
Replacing CONFIG_USB=y (from /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/hw_config.c:1125) with CONFIG_USB=m from (/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:675)
Replacing CONFIG_USB_STORAGE=y (from /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/dist_config.c:5443) with CONFIG_USB_STORAGE=m from (/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:676)
Replacing CONFIG_USB=m (from /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:675) with CONFIG_USB=y from (/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:3860)
Replacing CONFIG_BLK_DEV_SD=m (from /home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:674) with CONFIG_BLK_DEV_SD=y from (/home/username1/Actiontec/opensource-mi424wr-rev-ef/rg/pkg/build/feature_config.c:4015)
OS '
' not supported ($OSTYPE)
make: *** [config_files] Error 1




         
I am guessing there are two potential issues here.  
1) There is something wrong in the scripts or the tool chain and it is not setting the right OS in the configs and the rest of the tool chain chokes on it.
2) Ubunto is at fault and it is not supported by the tools.

Just a quick check to see what OS I am running:

@ubuntu:~/Actiontec/opensource-mi424wr-rev-ef/rg$ uname -mrsn
Linux ubuntu 3.5.0-19-generic x86_64

@ubuntu:~/Actiontec/opensource-mi424wr-rev-ef/rg$ echo $OSTYPE
linux-gnu

Did a grep for OSTYPE, and among many sources, I saw the statement in /rg/pkg/build/config_host.c and I added some debug code and realized Line 127 of this file is where it is outputting the OS not supported message. The function that chokes is the following, and the highlighted line is where ostype is returned as an empty string, instead of linux-gnu.
static void conf_ostype(void)
{
    char *ostype = NULL;
    int ret;

    /* Host OS: Set CONFIG_RG_HOST_xxx */
    ostype = sys_get(&ret, "echo $OSTYPE");
    if (ret)
conf_err("$OSTYPE not defined\n");
4.
    /* the gcc has built-in */
    if (!strcmp(ostype, "cygwin"))
    {
token_set_y("CONFIG_RG_HOST_CYGWIN");
token_set_y("CONFIG_RG_WINDOWS_HOST"); /* backwards compatibility */
    }
    else if (!strncmp(ostype, "linux", 5))
token_set_y("CONFIG_RG_HOST_LINUX");
    else
conf_err("OS '%s' not supported ($OSTYPE)\n", ostype);
    str_free(&ostype);
}

OK, lets force it to be linux by setting ostype="linux-gnu";  But, wait not so fast since that will just make it blew up:
Segmentation fault (core dumped)
make: *** [config_files] Error 139


To see if there is an issue with Ubuntu, I downloaded Fedora 11, then followed the instructions word by word.  This time the make file failed again.  It looks like that rg_gcc is failing to build which results in all of the other builds failing.  Tracing the error messages I found the following:

make -f /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/ulibc//Makefile   -C /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/ulibc/ archconfig  
/bin/sh: /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/rg_gcc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
make[2]: /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/rg_gcc: Command not found
make[2]: Entering directory `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/ulibc'
make[2]: /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/rg_gcc: Command not found


This error is because in the 64-bit version of Fedora that I am running the libraries have moved to /lib64 hence /live/ld-linux does not exist!  Time to get another virt up and running.  This time with Fedora 11, 32-bit.


GPL Source Generated Binary

Step 14 will generate vmlinux at /home/[username]/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux-2.6.  The file that got generated is 29.2 MB, much larger than the 16 MB flash that the device has.
I did a LZMA compression to see how compressible this file is

tar -cv vmlinux |lzma -z >vmlinux.lzma

And that resulted in a 4.6 MB file.  For reference, (stock ?) firmware that is available at http://upgrade.actiontec.com/MI424WR2/MI424WR2.rmt  is 4.91 MB in size.

Signature scan of the rmt file for MI424WR-Gen2 (Rev E, F) only shows a single GZIP region, while the vmlinux has three zlib sections, a GZIP block and a CRC32.  
@fedora linux-2.6]# sigscan vmlinux

vmlinux: 
0x002227b0: [type: code, len: 1024]  CRC32

0x00222d43: [type: code, len: 0120]  zlib

0x00222e33: [type: code, len: 0116]  zlib

0x00223063: [type: code, len: 0116]  zlib

0x002b3000 GZIP compressed data {
  method:    deflate
  type:      binary
  OS type:   Unix
  date:      Wed Dec 12 00:05:38 2012
}

# sigscan MI424WR2.rmt 

MI424WR2.rmt: 
0x004106d2 GZIP compressed data {
  method:    deflate
  type:      binary
  OS type:   [unknown: 194]
  date:      Tue Oct 16 10:54:41 1945
}


The Makefile has instructions for making .rmt file as well.  The vmlinux file that we created is the Network Boot Image, while .rmt file is the update image.

# To create the image, after we did all subdirs, we need to create modules, 
# make ramdisk and create the os.
$(OPENRG_RMT_UPDATE_IMG): $(OPENRG_IMG) $(if $(CONFIG_RG_JPKG),,$(UPD_UTIL))
ifndef CONFIG_RG_JPKG
ifneq ($(CONFIG_RG_NETWORK_BOOT_IMAGE),y)
@$(UPD_UTIL) -C -f $@ -i $(OPENRG_IMG)
@$(UPD_UTIL) -A -f $@ -h $(CONFIG_RG_HW) -d $(CONFIG_RG_DIST) \
  -n $(ACTION_TEC_VENDOR_NAME) -v `pkg/build/rg_version_info -c` $(EXT_VER)
@ln -fs $(OPENRG_RMT_UPDATE_IMG) \
            openrg-`pkg/build/rg_version_info -f`-$(CONFIG_RG_DIST).rmt
@echo Remote-update file: $@
endif
endif

Using the process from Rev A/C/D and Rev I GPL Source

For comparison, I also downloaded the GPL codes for Rev A/C/D and Rev I and went through their compile process.  Interestingly I learned a few things.  
  1. The Rev E and Rev F seem to be the only versions that have the vmlinux load process instead of the process for generating an image that can be burnt to the flash chip.
  2. The codes seem to be cumulative from a distance, however compile attempts shows that there are some differences between them.  For example, the Rev I code has packages for Cavium processes.  However when I try to use the same make config and make commands as Rev E/F, it fails to generate the vmlinux image.
Another interesting thing is that Rev A/C/D require Make Config, Make, Make RamDisk and Make OS to generate the .IMG file for the flash chip.  However, Rev I has enough logic to incorporate all of these in just the Make Config and Make, like Rev E/F code, but it actually generates the .IMG for Rev I (while it fails for Rev E/F).

Using the process for generating Rev A/C/D IMG, Make Ramdisk failed by following (full log is here)

cp: target `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/pkg/build/disk_image/ramdisk_mount_point' is not a directory

Indeed, ramdisk_mount_point is a 0 byte file.  It looks like that a bug in one of the scripts created a file instead of a folder.  I cleared up the make using make clean, manually created the ramdisk_mount_point folder, and went through the steps again. Make ramdisk seem to complete its build with no errors.  However "make -C os openrg.img" failes with the following messages:

touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/ramdisk/mod.img': No such file or directory
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/ramdisk/ramdisk.gz': No such file or directory
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/cramdisk/cramfs.img': No such file or directory
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/cramdisk/cramfs_init.img': No such file or directory
make: Entering directory `/home/username/opensource-mi424wr-rev-ef/rg/os'
umask 022 && \
mkdir -p /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os  && \
make -C /home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os -f /home/username/opensource-mi424wr-rev-ef/rg/os/Makefile \
openrg.img RGSRC=/home/username/opensource-mi424wr-rev-ef/rg
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/ramdisk/mod.img': No such file or directory
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/ramdisk/ramdisk.gz': No such file or directory
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/cramdisk/cramfs.img': No such file or directory
touch: cannot touch `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os/linux/arch/mips/cramdisk/cramfs_init.img': No such file or directory
make[1]: Entering directory `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os'
make[1]: *** No rule to make target `openrg.img'.  Stop.
make[1]: Leaving directory `/home/username/opensource-mi424wr-rev-ef/rg/build.MC524WR/os'
make: *** [cd_to_builddir] Error 2
make: Leaving directory `/home/username/opensource-mi424wr-rev-ef/rg/os'