+ Reply to Thread
Page 1 of 18 1 2 3 11 ... LastLast
Results 1 to 10 of 174

Thread: Openwrt on HomeHub V1/V1.5

  1. #1
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137

    Openwrt on HomeHub V1/V1.5

    11/04/12

    Select between V1 and V1.5 in kernel_menuconfig under machine selection -> board support.

    The patch:
    Trunk: (Attitude Adjustment)
    hhpatch.zip
    Drop it in "target/linux/brcm63xx/patches-2.6.39"

    Backfire:
    patch_backfire.zip
    Drop it in "target/linux/brcm63xx/patches-2.6.32"??

    To flush old changes and apply the new patch,
    make target/linux/{clean,prepare}

    Heres my configs. It should provide a good starting point. Note, the openwrt ip address will be 192.168.1.11
    config.zip

    Installation

    When you have installed redboot and power cycled the router, you should be able to either,

    Log in by telnet to 192.168.1.11 9000. You could set things up from here but the configuration values set here (ip, mac) will not be read by openwrt anyway. You can still load and flash firmware images here.

    Hold the wireless button while powering up. Redboot will then attempt to load a script called "factory_script" from the root of a tftp server at 192.168.1.100. The script contains commands to create the filesystem, download firmware images from the tftp server, and write them to flash. When entering factory mode the upgrade led turns orange then to red or green depending on whether the script was found.

    The following script will create a "factory script" specific to you firmware image. You can use it two ways,

    When you have finished your openwrt compile, just put it in the root of your tftp server, point it towards your openwrt trunk base directory eg, ./mkfscript.sh/home/user/openwrt/trunk. It will take the needed parts from openwrt, move them to the same directry and create "factory_script" to fit.
    or,
    You can place the two needed files: gzipped linux kernel named "vmlinux.gz" and a squashfs filesystem named "root.squashfs". Run the script with --use-current parameter and it will create "factory_script".


    mkfscript.sh
    Code:
    #!/bin/sh
    
    if [ "$1" = "" ]||[ "$1" = "--help"  ]
      then
      echo "
    #############################################
    # Fetches openwrt images and creates script #
    # to upload them.                           #
    # Usage:                                    #
    # Drop this script into tftp directory,     #
    # mkfscript.sh <path_to_openwrt_base_dir>   #
    # eg, mkfscript.sh /home/user/openwrt/trunk #
    #                                           #
    # You can give '--use-current' instead of   #
    # a path to to openwrt this will use        #
    # vmlinux.gz and root.squashfs that are     #
    # already in the same dir as this script.   #
    #############################################"
    exit 1
    fi
    usecurr=0
    if [ "$1" = "--use-current" ]
      then
      usecurr=1
    fi
    # Get files
    if [ "$usecurr" = "0" ]
    then
    if [ -f "$1"/build_dir/linux-*/vmlinux.bin.gz ]
    then
      echo "Fetch kernel"
      cp -i "$1"/build_dir/linux-*/vmlinux.bin.gz ./vmlinux.gz
      if [ -f vmlinux.gz ]
      then
        echo -n ""
      else 
        echo "Can't fetch kernel, can't continue"
        exit 1
      fi
    else
      echo "Can't find kernel"
      exit 1
    fi
    if [ -f "$1"/build_dir/linux-*/root.squashfs ]
    then
      echo "Fetch rootfs"
      cp -i "$1"/build_dir/linux-*/root.squashfs ./root.squashfs
      if [ -f root.squashfs ]
      then
        echo -n ""
      else
        echo "Can't fetch rootfs, can't continue"
        exit 1
      fi
    else
      echo "Can't find rootfs"
      exit 1
    fi
    else
    echo Using current vmlinux.gz and root.squashfs.
    fi
    # Calculation
    flash_start=BE400000
    redboot_size=00020000
    redboot_config=00010000
    flash_size=00800000
    echo "calculating kernel size and offset..."
    kernel_start=`printf "%X\n" $((0x$flash_start+\
                          0x$redboot_size))`
    kernel_size_not_round=`du -b vmlinux.gz |awk '{printf("%X\n",$1)}'`
    kernel_end_not_round=`printf "%X\n" $((0x$flash_start+\
                          0x$redboot_size+\
                          0x$kernel_size_not_round))`
    kernel_end_round=$kernel_start
    while  [ 0x$kernel_end_not_round '>' 0x$kernel_end_round ]
      do
        kernel_end_round=`printf "%X\n" $((0x$kernel_end_round+\
                      0x00010000))`
    done
    kernel_size_round=`printf "%X\n" $((0x$kernel_end_round-\
                      0x$flash_start-\
                      0x$redboot_size))`
    echo "calculating root_fs size and offset..."
    rootfs_start=$kernel_end_round
    rootfs_size_not_round=`du -b root.squashfs |awk '{printf("%X\n",$1)}'`
    rootfs_end_not_round=`printf "%X\n" $((0x$kernel_end_round+\
                          0x$rootfs_size_not_round))`
    rootfs_end_round=$rootfs_start
    while  [ 0x$rootfs_end_not_round '>' 0x$rootfs_end_round ]
      do
        rootfs_end_round=`printf "%X\n" $((0x$rootfs_end_round+\
                      0x00010000))`
    done
    rootfs_size_round=`printf "%X\n" $((0x$rootfs_end_round-\
                      0x$flash_start-\
                      0x$redboot_size-\
                      0x$kernel_size_round))`
    echo "calculating rootfs_data size and offset..."
    rootdata_start=$rootfs_end_round
    rootdata_size=`printf "%X\n" $((0x$flash_size-\
                      0x$redboot_size-\
                      0x$kernel_size_round-\
                      0x$rootfs_size_round-\
                      0x$redboot_config))`
    rootdata_end=`printf "%X\n" $((0x$rootdata_start+\
                      0x$rootdata_size))`
    # Sanity check size
    if [ 0x$rootdata_start '>' 0xBEC00000 ]
    then
      echo "Your Image is too big!
    Try reducing the size of your vmlinux or rootfs."
      die=1
    fi
    
    echo "name              start       size"
    echo "Kernel            0x$kernel_start   0x$kernel_size_round"
    echo "rootfs            0x$rootfs_start   0x$rootfs_size_round"
    echo "rootfs_data       0x$rootdata_start   0x$rootdata_size"
    
    if [ "$die" = "1" ]
    then
      exit 1
    fi
    # is there an old factory_script? is the jffs2 partition the same size?
    # there is some give in this so minor changes might not require a reformat.
    if [ -f factory_script ]
      then
      old_rootdata_start=`grep -r rootfs_data factory_script|awk '{printf($4)}'`
      if [ "$old_rootdata_start" = "0x$rootdata_start" ]
        then
        echo "
    New rootfs_data partition matches old script.
    This means you can upgrade without loosing
    your old settings.
    Would you like to skip creation of new rootfs_data
    partition and keep old settings"
        keep_old_rootfs_data=
        while [ "$keep_old_rootfs_data" = "" ]
          do
        read -p"y/n? " keep_old_rootfs_data
        echo
        case $keep_old_rootfs_data in
        y)
          keep_old_rootfs_data=y
        ;;
        n)
          keep_old_rootfs_data=n
        ;;
        *)
          keep_old_rootfs_data=
          echo "invalid input, try again"
        ;;
        esac
         done
    else
    # jffs2 isnt the same size
    echo "
    Size of rootfs_data partiton has changed.
    A new partition will have to be made,
    you will not be able to keep your old settings.
    Create a new rootfs_data partition or abort"
    loose_old_rootfs_data=
        while [ "$loose_old_rootfs_data" = "" ]
          do
        read -p"y(es)/a(bort)? " loose_old_rootfs_data
        echo
        case $loose_old_rootfs_data in
        y)
          loose_old_rootfs_data=y
        ;;
        a)
          echo
          exit 1
        ;;
        *)
          loose_old_rootfs_data=
          echo "invalid input, try again"
        ;;
        esac
        done
      fi
    fi
    
    # create script
    echo "create factory_script"
    if [ "$keep_old_rootfs_data" = "y" ]
      then
      echo "#fis init">factory_script
    else
      echo "fis init">factory_script
    fi
    
    echo "load -r -v -m tftp -h 192.168.1.100 -b 0x80800000 vmlinux.gz
    fis create -b 0x80800000 -e 0x80010000 -f 0x$kernel_start -l 0x$kernel_size_round kernel_fs
    load -r -v -m tftp -h 192.168.1.100 -b 0x80800000 root.squashfs
    fis create -b 0x80800000 -f 0x$rootfs_start -l 0x$rootfs_size_round root_fs">>factory_script
    
    if [ "$keep_old_rootfs_data" = "y" ]
      then
      echo "#fis create -b 0x$rootdata_start -l 0x$rootdata_size rootfs_data">>factory_script
    else
      echo "fis create -b 0x$rootdata_start -l 0x$rootdata_size rootfs_data">>factory_script
    fi
    
    echo "fconfig boot_script true
    fconfig boot_script_timeout 10
    fconfig boot_script_data
    fis load -b 0x80010000 -d kernel_fs
    exec
    
    eopp">>factory_script
    echo "done"
    # NOTE: make sure the empty line stays between exec and eopp
    # eopp is only here to flash the led's when the procedure is complete
    # eop never returns, be aware of this if you enter the above commands manually

    Notes:
    1, Openwrt is set up by default to use ethernet port 1 as wan and port 2 as lan. Telnet is not allowed on the wan port. Plug your cable into ethernet 2.
    2, If you have flashed a firmware image that wont boot, don't worry, you can always load a new kernel by holding the wifi button while powering up the hub.
    3, Still no adsl driver.

    Here's a couple of precompiled images with script for tftp installation.

    Let me know if there's anything missing or any other problems.

    V1 openwrt_bthh1.zip

    V1.5 openwrt_bthh15.zip
    Last edited by Ant; 11-04-2012 at 08:18 PM.

  2. #2
    Administrator PsiDOC's Avatar
    Join Date
    Dec 2010
    Location
    Pembrokeshire
    Posts
    520
    All I can say is... WOW! Keep it up please Ant. Openwrt running on anything is IMO awesome! That's what I used to use for long range wifi backhaul links on WRT54G's a few years ago when I was in the trade.
    Thanks again for all your efforts.

    Psi

  3. #3
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137
    messed up like an idiot...oops
    Last edited by Ant; 16-12-2010 at 12:45 PM. Reason: major brain fart

  4. #4
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137
    Thanks si, i enjoy doing it really. Its just a shame some companies wont be more open.

    /** GPIO stuff
    * ************* V1 ***********************************
    * GPIO_00-GPIO_04 : GREEN_LED_00->GREEN_LED_04 : OUT
    * GPIO_05 : ? (unused)
    * GPIO_06 : AC101L_RST_N : OUT
    * GPIO_07 : ? (unused)
    * GPIO_08-GPIO_15 : MII BLK : IN
    * GPIO_16-GPIO_27 : PCI PCCARD BLK : IN
    * GPIO_28 : PCD80705_RSTN : IN (out=reset)
    * GPIO_29-GPIO_31 : ? (unused)
    * GPIO_32 : MII BLK : IN
    * GPIO_33 : PCD80705_INT : IN
    * GPIO_34 : CHARGER COM : OUT (0 charge, 1 serial)
    * GPIO_35 : ? (unused)
    * GPIO_36 : BUTTON : IN
    *
    *************** V1.5 ********************************
    * GPIO_00-GPIO_04 : GREEN_LED_00->GREEN_LED_04 : OUT
    * GPIO_05 : RED_LED_00 : OUT
    * GPIO_06 : AC101L_RST_N : OUT
    * GPIO_07 : RED_LED_02 : OUT
    * GPIO_08-GPIO_15 : MII BLK : IN
    * GPIO_16-GPIO_21 : ? (unused)
    * GPIO_22 : RED_LED_01 : OUT
    * GPIO_23-GPIO_27 : ? (unused)
    * GPIO_28 : PCD80705_RSTN : IN (out=reset)
    * GPIO_29 : RED_LED_03 : OUT
    * GPIO_31 : RED_LED_04 : OUT
    * GPIO_32 : MII BLK : IN
    * GPIO_33 : PCD80705_INT : IN
    * GPIO_34 : CHARGER COM : OUT (0 charge, 1 serial)
    * GPIO_35 : BUTTON : IN
    * GPIO_36 : BUTTON : IN
    ************************************************** ***/

    More later....Im going get an ocilloscope out on a standard V1, see whats going on in there.

    One more thing actually, can anyone translate this?

    le DECT n'est pas resetter pour un redémarrage
    le DECT fonctionne en autonome et s'il y a besoin (version soft à programmer)
    le GPIO est mis en sortie et le DECT resetter

    I can only get a rough translation saying somthing about dect being automatic.
    Last edited by Ant; 21-07-2011 at 09:16 PM.

  5. #5
    Administrator PsiDOC's Avatar
    Join Date
    Dec 2010
    Location
    Pembrokeshire
    Posts
    520
    le DECT n'est pas resetter pour un redémarrage - DECT is not reset on restart
    le DECT fonctionne en autonome et s'il y a besoin (version soft à programmer) - DECT operates independently and there is a need (to program software versio )
    le GPIO est mis en sortie et le DECT resetter - The GPIO output is set and the DECT resetter (DECT Reset)

    If my schoolboy french doesn't fail me.

    PSi

  6. #6
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137
    Yes that makes sense now.

    le DECT n'est pas resetter pour un redémarrage - DECT is not reset on restart: no its not, or it would make the click noise when the hub is reset/rebooted.

    le DECT fonctionne en autonome et s'il y a besoin (version soft à programmer) - DECT operates independently and there is a need (to program software versio ): hmm, that sounds a bit contradictory

    le GPIO est mis en sortie et le DECT resetter - The GPIO output is set and the DECT resetter (DECT Reset): makes sense, the relay clicks on when i set this as an input and clicks off when set as out.

    Thanks m8

  7. #7
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137
    The PCD80705 is connected to the bcm6348 via spi. All the info i can find on the openwrt spi implementation is incomplete and or contradictory.
    I cant even find any proper docs on the PCD80705, some small info sheet i found says it is a DECT baseband processor. Anyway that chip looks like it controls all the telephony stuff, the dect radio, the si3230 slic, that clicky relay and the 74hct4066 switch.

    I need to find out if the hub makes use of its bcm6348 AC97 codec, First though. i have to get the spi bus working.

    If i could get a high res photo of both sides of a depopulated board board it would be a real help.

    I think he spi test points are:
    TP43 SPI_MOSI
    TP26 SPI_SSB
    TP45 SPI_MISO
    TP40 SPI_CLK
    Last edited by Ant; 18-12-2010 at 04:59 PM. Reason: more info

  8. #8
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137
    All changes have been updated to the first post
    Last edited by Ant; 10-09-2011 at 06:48 AM.

  9. #9
    Junior Member
    Join Date
    Dec 2010
    Location
    Birmingham
    Posts
    2
    Hi Ant,

    Wow you work is amazing. Im very interested in getting open wrt running on a 1.5 hub. Thus far I have managed to get the redboot loader flashed and i can now successfully telnet into the RedBoot prompt.

    Im a bit lost now what to do with the four files in the first post. I beleive I need to build an image from the openwrt source files + your four files, but I have no idea how to do this yet. Can this be done in windows? Alternatively do you have a precompiled image i could use?

    Cheers,
    Kash.
    Last edited by kashavsehra; 19-12-2010 at 10:14 AM.

  10. #10
    Super Moderator Ant's Avatar
    Join Date
    Dec 2010
    Location
    Stoke on Trent
    Posts
    137
    Hi and welcome kashavsehra,

    Openwrt has to be compiled under linux, you could probably try running it in a virtual machine under windows but that usually ends up being more trouble than its worth. If you really want to use linux, for the beginner, to save you damaging your windows install, i would get hold of a small ~10GB hard drive and swap it in place of your windows one. I would do this just to save you the hassle and aggro of 'dual booting', which sometimes can be a real pain.

    You could also use what is called a 'live cd' you just pop it into your cd/dvd drive and go from there. This is good for beginners as there is no permanent changes but also has a few drawbacks like, you would have to save your linux config somewhere. This is all the 'packages' you have downloaded, system settings you have changed and files that have been modified. If your computer was to go down while you were busy using it and before you saved any changes, you would loose all your work since the last save. These live cds usually come with an option to install to your hard drive too though.

    If you want to use a full on (but don't worry, you wont need a degree in computer science) Linux system i personally recommend debian, it's what i use.
    http://en.wikipedia.org/wiki/Debian
    http://www.debian.org/

    If its a live cd your are looking for, id go with ubuntu or kubuntu.
    http://en.wikipedia.org/wiki/Ubuntu_...ting_system%29
    http://www.ubuntu.com/

    http://en.wikipedia.org/wiki/Kubuntu
    http://www.kubuntu.org/

    To answer your seccond question, Support is still very limited, working so far is,
    usb host (flash drives, webcams, keyboards, etc)
    ethernet #1
    ethernet #2
    wireless
    LED's (definitly v1.5, not sure of the order or labels for v1)
    buttons (again, this might be different for the v1)
    flash storage works but i wouldnt trust it too much yet

    With my current configuration you need Linux and you need a usb drive. As i havn't got round to using the flash for storage (it can only be written so many times so to stop it from getting worn out with experimentation), i use redboot to load the linux kernel via tftp then use a usb drive as the rootfs.
    Give me a couple of hours and ill reconfigure and post a couple of images and instructions for you or anybody else that wants to play.
    for now,

    This is a good windows tftpd (tftp server) http://tftpd32.jounin.net/

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts