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


Reply With Quote
