OpenWrt Forum Archive

Topic: Help with OpenWRT on e4200v2

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

OpenWRT developers have already tackled loading OpenWRT on Marvell based routers. I'm hoping I can get a bit more guidance on loading an appropriate image (I don't care if it doesn't work perfectly, just proof of concept) on a LinkSys e4200v2.

I have already posted my notes on the dd-wrt forum at:

http://www.dd-wrt.com/phpBB2/viewtopic. … 786#901786

And all I need is suggestions on replacing the u-boot image (if required) and where I should flash remaining firmware to (I'm guessing 0x2000000 but haven't had success yet).

I can pull an image in via tftp and can boot that image, but my boot parameters seem to be off.

Later on if I can get the kernel versions close enough, I can use the binary Marvell wireless driver that has shipped with source.

(Last edited by paklids on 20 Jun 2014, 23:17)

I've actually used menuconfig to build a generic kirkwood image (both attitude_adjustment and backfire) but neither seems to load. I could totally be giving it wrong boot commands.

At the U-Boot prompt I have been able to edit the nfsboot env variables and it does load whatever files I provide (via tftp) into memory. When I try to boot from the uImage file, I get to "...booting the kernel." and no further.

I'm looking at the /usr/bin/update file now to see how Linksys flashes new images:

# cat /usr/bin/update
#!/bin/sh

VERBOSE="no"
PRIMARY="no"
PRIROOTFSMTD=
AlTROOTFSMTD=
MOUNTEDMTD=

check_error() {
        if [ $? -ne 0 ]; then
                echo -e "Failed, exiting..."
                exit 1
        else
                echo -e "OK!"
        fi
}

# return 0 if booted via nfs
# else return 1
check_mountnfs() {
        if `cat /proc/mounts  | grep "\/dev\/root" | grep "nfs" 2>&1 > /dev/null`
        then
                return 0
        fi
        return 1
}

# return 0 if booted via nfs
# else return 1
check_mountjffs2() {
        if `cat /proc/mounts  | grep "\/dev\/root" | grep "jffs2" 2>&1 > /dev/null`
        then
                return 0
        fi
        return 1
}

# return 0 if booted via primary NAND partition
# return 1 if booted via alternate NAND partition
check_mount() {
        # get primary and alternate
        PRIROOTFSMTD=`cat /proc/mtd | grep "rootfs" | grep -v "alt_" | cut -d':' -f1 | cut -f2 -d"d"`
        ALTROOTFSMTD=`cat /proc/mtd | grep "alt_rootfs" | cut -d':' -f1 | cut -f2 -d"d"`

        # get the MTD of the current mounted rootfs
        MOUNTEDMTD=`cat /proc/self/mountinfo | grep "\/dev\/root" | cut -f3 -d' ' | cut -f2 -d':'`

        if [ "$MOUNTEDMTD" -eq "$PRIROOTFSMTD" ]
        then
                return 0
        fi
        if [ "$MOUNTEDMTD" -eq "$ALTROOTFSMTD" ]
        then
                return 1
        fi
        return 255
}

erase_and_program() {
        if [ -c /dev/$2 ] && [ ! -z $3 ] && [ -e $3 ]; then
                FLASH_TYPE=`mtd_debug info /dev/$2 | grep "mtd.type" | cut -d' ' -f3`
                echo -e "updating $1"
                if [ ${FLASH_TYPE} = "MTD_NORFLASH" ]; then
                        #echo -ne "\tErasing...\t"
                        #flash_eraseall -q /dev/$2
                        #check_error
                        echo -ne "\tProgramming NOR flash (takes a long, long while, please wait)...\t"
                        if [ "$VERBOSE" = "yes" ]; then
                                flashcp -v $3 /dev/$2
                        else
                                flashcp $3 /dev/$2
                        fi
                        check_error
                fi
                if [ ${FLASH_TYPE} = "MTD_NANDFLASH" ]; then
                        echo -ne "\tErasing...\t"
                        if [ "$VERBOSE" = "yes" ]; then
                                flash_eraseall -j /dev/$2
                        else
                                flash_eraseall -q -j /dev/$2
                        fi
                        check_error
                        echo -ne "\tProgramming...\t"
                        if [ "$VERBOSE" = "yes" ]; then
                                nandwrite -m -a -p /dev/$2 $3
                        else
                                nandwrite -q -m -a -p /dev/$2 $3
                        fi
                        check_error
                fi
        fi
}

print_under_construction()
{
        echo -e "\t$1 update not supported at this time."
        exit 1
}

usage()
{
        cat << EOF

              |           |
            .|||.       .|||.
        ..:|||||||:...:|||||||:..
        C i s c o   S y s t e m s

        usage: $0 options

        OPTIONS:
        -f rootfs (optional) Specify path to rootfs image (usually: jffs2.rootfs.img)
        -u u-boot (optional) Specify path to u-boot image (usually: u-boot.img)
        -k kernel (optional) Specify path to kernel image (usually: uImage.img)
        -h --help Print this help message

EOF
}

if [ -z "$1" ]; then
        usage
        exit 1
fi

while getopts ":h:pf:k:u::v" OPTION
do
        case $OPTION in
        h)
                usage
                exit 1
                ;;
        c)
                CONFIG_IMAGE=$OPTARG
                ;;
        f)
                FIRMWARE_IMAGE=$OPTARG
                ;;
        r)
                RESCUE_IMAGE=$OPTARG
                ;;
        u)
                print_under_construction "u-boot image"
                UBOOT_IMAGE=$OPTARG
                ;;
        k)
                KERNEL_IMAGE=$OPTARG
                ;;
        d)
                DTB_IMAGE=$OPTARG
                ;;
        p)
                PRIMARY="yes"
                ;;
        v)
                VERBOSE="yes"
                ;;
        ?)
                usage
                exit 1
        esac
done

if [ -e /proc/mtd ]; then
        CONFIG_BLKDEV=`cat /proc/mtd | grep "config img" | cut -d':' -f1`
        DTB_BLKDEV=`cat /proc/mtd | grep "device tree img" | cut -d':' -f1`

        # check if trying to update the partition you are currently mounted on
        check_mountjffs2
        RET=$?
        # if mounted JFFS2 mtd, then check if trying to update a mounted mtd
        if [ $RET -eq 0 ]; then
                check_mount
                RET=$?
                # if booted on primary mtd && trying to update primary mtd
                if [ $RET -eq 0 ] && [ "$PRIMARY" = "yes" ]; then
                        echo -e "Failed.  Cannot update a currently mounted root file system..."
                        exit 1
                fi
                # if booted on alternate mtd && trying to update alternate mtd
                if [ $RET -eq 1 ] && [ "$PRIMARY" = "no" ]; then
                        echo -e "Failed.  Cannot update a currently mounted root file system..."
                        exit 1
                fi
        fi

        if [ "$PRIMARY" = "yes" ]; then
                FIRMWARE_BLKDEV=`cat /proc/mtd | grep "rootfs" | grep -v "alt_" | cut -d':' -f1`
                KERNEL_BLKDEV=`cat /proc/mtd | grep "kernel" | grep -v "alt_" | cut -d':' -f1`
        else
                FIRMWARE_BLKDEV=`cat /proc/mtd | grep "alt_rootfs" | cut -d':' -f1`
                KERNEL_BLKDEV=`cat /proc/mtd | grep "alt_kernel" | cut -d':' -f1`
        fi
        RESCUE_BLKDEV=`cat /proc/mtd | grep "rescue img" | cut -d':' -f1`
        UBOOT_BLKDEV=`cat /proc/mtd | grep "u-boot img" | cut -d':' -f1`
fi

erase_and_program "u-boot image" ${UBOOT_BLKDEV} ${UBOOT_IMAGE}
if [ "$PRIMARY" = "yes" ]; then
        erase_and_program "primary firmware image" ${FIRMWARE_BLKDEV} ${FIRMWARE_IMAGE}
        erase_and_program "primary kernel image" ${KERNEL_BLKDEV} ${KERNEL_IMAGE}
else
        erase_and_program "alternate firmware image" ${FIRMWARE_BLKDEV} ${FIRMWARE_IMAGE}
        erase_and_program "alternate kernel image" ${KERNEL_BLKDEV} ${KERNEL_IMAGE}
fi

This might help:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "uboot"
mtd1: 00020000 00020000 "u_env"
mtd2: 00020000 00020000 "s_env"
mtd3: 01a00000 00020000 "kernel"
mtd4: 01760000 00020000 "rootfs"
mtd5: 01a00000 00020000 "alt_kernel"
mtd6: 01760000 00020000 "alt_rootfs"
mtd7: 04a00000 00020000 "syscfg"

Now that WRT1900AC with Marvell is supported, any chance E4200v2/EA4500 (also Marvell) will be supported in the future?

(Last edited by ricktendo on 20 Oct 2014, 20:42)

ricktendo wrote:

Now that WRT1900AC with Marvell is supported, any chance E4200v2/EA4500 (also Marvell) will be supported in the future?

The WRT1900AC is not really supported. Some forum users have it sort of working, but the main OpenWrt devs don't support it and Belkin/Linksys certainly isn't helping them.

Hey paklids you mentioned over on DD-WRT forum you were going to post the JTAG pinout for the E4200v2/EA4500 that you got with your JTAGulator.

I could really use this!!!

Also, any progress getting this working?

(Last edited by ricktendo on 25 Dec 2014, 06:19)

Thanks obsy, still could use those jtag pinouts (want to to a full flash backup with my Blackcat USB)

I'm also interested to get the JTAG working on E4200v2.

Has anyone made in progress getting OpenWrt running on this router?


Thanks

Same here, patiently waiting smile

I would love to see some official OpenWRT support for this router!

Confirmed,  e4200v2 works with images ea4500

Havent tried that but I have been using a build of my own for months without issue. It is based off trunk. I can post a link if you want it?

That's great fin!  Please do post a link to it.

I assume this info is good enough to get it installed   - https://wiki.openwrt.org/toh/linksys/ea4500

This will be my first attempt to install OpenWRT.

Thanks

samurai123 wrote:

I assume this info is good enough to get it installed   - https://wiki.openwrt.org/toh/linksys/ea4500

my ea4500 is on the trunk mar 24 build (r49083) and it's stable.

wrtboy wrote:
samurai123 wrote:

I assume this info is good enough to get it installed   - https://wiki.openwrt.org/toh/linksys/ea4500

my ea4500 is on the trunk mar 24 build (r49083) and it's stable.


Thanks. I will give a try this weekend.

i wish more work is being done with the mwl8k driver so we can get DFS channels on the 5ghz radio.  i posed the question here https://forum.openwrt.org/viewtopic.php?id=63802 but have not seen any feedback.

my ea4500 appears stable so a shout-out to all folks who have contributed and brought openwrt to ea4500v1 / e4200v2.

I got trunk build r49114  installed now. I would like to set this as Wireless client to connect to WRT1200ac running stock firmware.  This is my first OpenWRT build and trying to find the docs to set it up using CLI.

Does it work if someone has already done it ?

Thanks

(Last edited by samurai123 on 6 Apr 2016, 22:52)

samurai123 wrote:

Does it work if someone has already done it ?

i don't really have a need to set up a wireless client bridge but i got curious so i tried it last night and set up the ea4500 as wireless client utilizing luCI.  main router is a wndr3700v2 with the ea4500 as the wireless client.  the ea4500 joined the wndr3700v2 and successfully relayd via a stabridge interface despite having a different chipset.

The discussion might have continued from here.