Homepage Johann Hanne 
Valid XHTML 1.0 Strict
About | Projects | Gadgets | Photos | Links
Projects - Actiontec DPCM stuff - Userland 

Version 0.1.1 of the DPCM GPL firmware is largely based on the uClinux-dist package (version 0.1.0 was not publically released and just was missing the uClinux-dist-20060803-DPCM-ppp-resolv_conf patch). Only a few changes/additions are included and rebuilding the complete firmware from source is easy:

  • Download and untar uClinux-dist-20060803, buttond, ledctl, truncate, dpcm-boa-config and dnsmasq-2.33 (all into the same directory)
  • cd uClinux-dist
  • Before doing anything, make six changes:
  • run "make CROSS_COMPILE=arm-elf- xconfig"
  • Click on "Vendor/Product Selection"
  • Choose Vendor "Actiontec" and Product "DPCM"
  • Click on "Next"
  • Choose Kernel Version "linux-2.4.x"
  • Click on "Main Menu"
  • Click on "Save and Exit"
  • run "make CROSS_COMPILE=arm-elf- dep"
  • run "make CROSS_COMPILE=arm-elf-"
  • cd ..
  • cd dnsmasq-2.33
  • open bld/Makefile and add three lines to the top of the file:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -D__uClinux__ \
             -D__UCLIBC__
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
  • run "make"
  • cd ..
  • cd buttond;make;cd ..
  • cd ledctl;make;cd ..
  • cd truncate;make;cd ..
  • cp dnsmasq-2.33/src/dnsmasq buttond/buttond ledctl/ledctl truncate/truncate uClinux-dist/romfs/bin
  • cp -a dpcm-boa-config-0.1.0/* uClinux-dist/romfs
  • cd uClinux-dist
  • make CROSS_COMPILE=arm-elf- image
  • cd ..
  • Your kernel and romdisk images are now in uClinux-dist/images
Projects - Actiontec DPCM stuff - Userland 

The following describes some very tiny tools written by me specifically for the DPCM because I didn't find other programs which did what I needed:

  • buttond: This is the userspace counterpart for the DPCM reset button: If the reset button is pressed, this is notified by the kernel (arch/armnommu/mach-cx821xx/tiburon-softreset.c). The kernel sends a SIGINT to PID 1 once a second as long as the button remains pressed. The buttond program is supposed to run as PID 1 (as a init replacement). If the button is pressed for 5 seconds or more it calls /bin/clear_config_and_reboot (which is supposed to set the DPCM configuration to the defaults and reboot it). If it's pressed for less then 5 seconds it calls /sbin/reboot.
  • truncate: This tool reads a maximum number (which must be given as the first parameter) of bytes from stdin. It writes these bytes to stdout as long as the maximum number is not exceeded (all further bytes are simply ignored). If there were more bytes than allowed, it will exit(1), otherwise it will exit(0). The purpose of this program is to limit the configuration in /var/etc as the config flash partition (/dev/mtd3) can only contain a maximum of 16384 bytes. So if this limit is exceeded, truncate will output "Configuration is too big" and saving the configuration fails.
  • ledctl: This tool can be used to control the modem LED on the DPCM. It can also be used to control the three additional LEDs on the DPCM which are not mounted when shipped but which you can mount yourself (you will see the solder points when you open up the modem). It can not be used to control the power and the ethernet LEDs because these are hardware controlled.
Projects - Actiontec DPCM stuff - Userland 

Version 0.0.0 of the DPCM GPL firmware was based on several single packages. Compiling these is described in the following (not everything listed was included in the final release though). These steps are also good hints for compiling other packages if you want to play around with it.

busybox (Verified with version 1.00)

  • apply the patch to make it compile
  • edit libbb/messages.c: replace
    #define PASSWD_FILE "/etc/passwd"
    
    by
    #define PASSWD_FILE "/var/etc/passwd"
    
  • either use my config file (rename it to .config) or make your own config; in the latter case you should use "/usr/local/arm-elf/bin/" (or your path) as cross compiler prefix and "-D__PIC__ -fpic -msingle-pic-base -D__uClinux__" as CFLAGS (Build options in make menuconfig)
  • run make:
    LDFLAGS="-fpic -msingle-pic-base -Wl,-elf2flt=-d" make
  • Ignore the strip error at the end of the build; there is nothing to strip in the flat binary

openssl (Verified with version 0.9.6m)

  • run "./Configure linux-elf-arm no-shared"
  • edit Makefile:
    • replace "CC= gcc" by "CC= arm-elf-gcc"
    • within the "CFLAG=" line, replace "-O3" by "-O2" and add "-D__PIC__ -fpic -msingle-pic-base -Wl,-elf2flt=-z"
  • run make
  • copy *.a to you cross-toolchain lib/fpic/msingle-pic-base directory (e.g. /usr/local/arm-elf/lib/fpic/msingle-pic-base)

flex (Verified with version 2.5.31)

  • run configure:
    CC="arm-elf-gcc" CFLAGS="-D__PIC__ -fpic -msingle-pic-base -Wl,-elf2flt=-z" ./configure --host=arm-elf-linux
  • run make
  • copy libfl.a to you cross-toolchain lib/fpic/msingle-pic-base directory (e.g. /usr/local/arm-elf/lib/fpic/msingle-pic-base)

ipsec-tools (Verified with version 0.5.2, earlier versions will not cross compile)

  • requires openssl (libcrypto.a) and flex (libfl.a)
  • requires openssl source code (path must be given to configure with "--with-openssl=")
  • apply the patch
  • run configure:
    CC="arm-elf-gcc" CFLAGS="-O2 -D__PIC__ -fpic -msingle-pic-base" LDFLAGS="-fpic -msingle-pic-base -Wl,-elf2flt=-z" ./configure --disable-readline --with-pic --disable-ipv6 --with-kernel-headers=/path/to/linux-2.4.29/include/ --with-openssl=/path/to/openssl-0.9.6m/ --host=arm-elf-linux --prefix=''
  • in config.h: replace "#define WITH_SHA2" by "#undef WITH_SHA2" to save some space
  • run make

iptables (Verified with version 1.3.3)

  • In Makefile replace "CFLAGS:=" by "CFLAGS+=" (replace the colon by a plus sign), otherwise it will completely ignore our CFLAGS from the command line and produce an useless binary
  • Do the same thing for "LDFLAGS", but be careful that you get the correct line: there are two "LDFLAGS=" lines in the Makefile, one within a "ifndef NO_SHARED_LIBS" block, the other in the "else" part of this block; we need the latter one, i.e. you have to replace "LDFLAGS = -static" by "LDFLAGS += -static"
  • run make:
    CC="arm-elf-gcc" CFLAGS="-D__PIC__ -fpic -msingle-pic-base" LDFLAGS="-fpic -msingle-pic-base -Wl,-elf2flt=-z" make KERNEL_DIR=/path/to/linux-kernel-sources/ NO_SHARED_LIBS=1
  • make will probably fail with "undefined reference to `in6addr_any'" - don't worry, this is related to the build of ip6tables, which we don't need, because we only want iptables which has already been built at this time

pppd (part of http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.bz2, directory user/pppd/pppd)

  • Go into the pppd subdirectory (uClinux-dist/user/pppd/pppd, i.e. "pppd" twice!)
  • cp Makefile.linux Makefile
  • Put the following lines at the beginning of Makefile:
    CC = arm-elf-gcc
    CCFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    DEFS = -DEMBED -D__uClinux__ -DPLUGIN -DPLUGIN_PPPOE
    LDLIBS = /usr/local/arm-elf/lib/fpic/msingle-pic-base/libcrypt.a \
            /usr/local/arm-elf/lib/fpic/msingle-pic-base/libutil.a \
            plugins/pppoe/pppoe.o \
            plugins/pppoe/libpppoe.a
    
  • Comment out the "MPPE=y" line in Makefile
  • In Makefile, within the "EXINCS =" line, replace "-I../linux" by "-I/usr/local/arm-elf"
  • cp plugins/pppoe/Makefile.linux plugins/pppoe/Makefile
  • Put the following lines at the beginning of plugins/pppoe/Makefile:
    CC = arm-elf-gcc
    AR = arm-elf-ar
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -D_linux_ -DEMBED
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    
  • Comment out the "#include <config/autoconf.h>" line in plugins/pppoe/pppoe.c
  • Compile the PPPoE plugin: "(cd plugins/pppoe;make pppoe.o libpppoe.a)"
  • run make
  • run "arm-elf-flthdr -s 8192 pppd"

chat (part of http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.bz2, directory user/pppd/chat)

  • Put the following lines at the beginning of Makefile:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -DEMBED
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    
  • run make

diald (part of http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.bz2, directory user/diald)

  • Put the following lines at the beginning of Makefile:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -DEMBED \
            -DCONFIG_USER_NET_TOOLS_IFCONFIG -DCONFIG_USER_NET_TOOLS_ROUTE
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    
  • Comment out the "#include <config/autoconf.h>" line in diald.h
  • adjust some paths in config.h: replace
    #define DIALD_CONFIG_FILE "/etc/config/diald.conf"
    #define DIALD_DEFS_FILE "/etc/diald.defs"
    
    by
    #define DIALD_CONFIG_FILE "/etc/ppp/diald.conf"
    #define DIALD_DEFS_FILE "/etc/ppp/diald.defs"
    
    and
    #define PATH_PPPD       "/bin/pppd"
    
    by
    #define PATH_PPPD       "/sbin/pppd"
    
  • run make
  • run "arm-elf-flthdr -s 8192 diald"

inetd (part of http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.bz2, directory user/inetd)

  • Put the following lines at the beginning of Makefile:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -DEMBED
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    
  • run make

telnetd (part of http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.bz2, directory user/telnetd)

  • Put the following lines at the beginning of Makefile:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -DEMBED \
            -DCONFIG_USER_TELNETD_DOES_NOT_USE_OPENPTY
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    
  • run make

boa (part of http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.bz2, directory user/boa)

  • Put the following lines at the beginning of src/Makefile:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -DEMBED -D__UC_LIBC__
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    LIBCRYPT = /usr/local/arm-elf/lib/fpic/msingle-pic-base/libcrypt.a
    
  • Comment out the "#include <config/autoconf.h>" line in src/auth.c
  • Comment out the "#include <config/autoconf.h>" line in src/syslog.h
  • Apply the patch which fixes CGI-redirects via "Location:" header
  • run make

dnsmasq (Verified with version 2.22)

  • Put the following lines at the beginning of src/Makefile:
    CC = arm-elf-gcc
    CFLAGS = -O2 -pipe -Wall -D__PIC__ -fpic -msingle-pic-base -D__uClinux__ \
             -D__UCLIBC__
    LDFLAGS = -fpic -msingle-pic-base -Wl,-elf2flt=-z
    
  • In the last line of src/Makefile, put "$(LDFLAGS)" after "$(CC)":
    $(CC) $(LDFLAGS) -o $@  $(OBJS) $(LIBS)
    
  • run make

brctl (from the bridge-utils package, verified with version 1.0.6)

  • run configure:
    CC="arm-elf-gcc" CFLAGS="-O2 -D__PIC__ -fpic -msingle-pic-base" LDFLAGS="-fpic -msingle-pic-base -Wl,-elf2flt=-z" ./configure --with-linux-headers=/path/to/linux-kernel-sources/include/ --host=arm-elf-linux
  • run make

mtd-utils (verified with CVS version of 2005-03-04, which is the last version for 2.4 kernels, as described on the linux-mtd homepage)

  • cd mtd/util
  • edit flash_eraseall.c: replace "bbtest = 1" by "bbtest = 0"
  • edit Makefile: replace "CFLAGS :=" by "CFLAGS +="
  • run make:
    CROSS="arm-elf-" CFLAGS="-D__PIC__ -fpic -msingle-pic-base -Wl,-elf2flt=-z" LDFLAGS="-fpic -msingle-pic-base -Wl,-elf2flt=-z" make
  • compiling will fail at some point, but that doesn't matter as we only want the flash_eraseall program

netkit-tftp (verified with version 0.17)

  • cd into the tftpd subdirectory
  • edit Makefile: comment out "#include ../MCONFIG" and "#include ../MRULES"
  • apply the patch which adds/changes a few things:
    • Allow upload of files which don't yet exist (otherwise only existing files may be overwritten which doesn't make sense for us)
    • Do not check for any permissions; uClinux always is a single user environment, so permission checking doesn't make sense
    • The tftpd directory is change from /tftpboot to /var/files
    • If a file named "tiburon.rbt" is uploaded, the program /bin/upgrade_firmware is launched which is supposed to upgrade the firmware; this makes firmware updates a little more convenient and matches the original DPCM firmware behavior
  • run make:
    CC="arm-elf-gcc" CFLAGS="-O2 -D__PIC__ -fpic -msingle-pic-base" LDFLAGS="-fpic -msingle-pic-base -Wl,-elf2flt=-z" make

vconfig (verified with version 1.9)

  • rm -f vconfig *.o
  • make CC="arm-elf-gcc" CCFLAGS="-D__PIC__ -fpic -msingle-pic-base" LDFLAGS="-D__PIC__ -fpic -msingle-pic-base -Wl,-elf2flt=-z"
  • ignore the strip error