Changeset 34350


Ignore:
Timestamp:
2012-11-25T17:22:33+01:00 (5 years ago)
Author:
juhosg
Message:

AA: ar71xx: enable sysupgrade for the OpenMesh MR600

Backport of r34235.

Signed-off-by: Marek Lindner <lindner_marek@…>
Signed-off-by: Gabor Juhos <juhosg@…>

Location:
branches/attitude_adjustment/target/linux/ar71xx/base-files/lib/upgrade
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/attitude_adjustment/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh

    r34349 r34350  
    1 # The U-Boot loader of the OM2P requires image sizes and checksums to be 
    2 # provided in the U-Boot environment. 
    3 # The OM2P comes with 2 main partitions - while one is active sysupgrade 
    4 # will flash the other. The boot order is changed to boot the newly 
    5 # flashed partition. If the new partition can't be booted due to upgrade 
    6 # failures the previously used partition is loaded. 
     1# The U-Boot loader of the OpenMesh devices requires image sizes and 
     2# checksums to be provided in the U-Boot environment. 
     3# The OpenMesh devices come with 2 main partitions - while one is active 
     4# sysupgrade will flash the other. The boot order is changed to boot the 
     5# newly flashed partition. If the new partition can't be booted due to 
     6# upgrade failures the previously used partition is loaded. 
    77 
    88trim() 
     
    3535append sysupgrade_pre_upgrade platform_add_ramfs_ubootenv 
    3636 
    37 platform_check_image_om2p() 
     37platform_check_image_openmesh() 
    3838{ 
    3939        local img_magic=$1 
     
    5757        case "$img_board_target" in 
    5858                OM2P) 
     59                        [ "$board" = "om2p" ] && break 
     60                        [ "$board" = "om2p-lc" ] && break 
     61                        [ "$board" = "om2p-hs" ] && break 
     62                        echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" 
     63                        return 1 
     64                        ;; 
     65                MR600) 
     66                        [ "$board" = "mr600" ] && break 
     67                        echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" 
     68                        return 1 
    5969                        ;; 
    6070                *) 
     
    103113} 
    104114 
    105 platform_do_upgrade_om2p() 
     115platform_do_upgrade_openmesh() 
    106116{ 
    107         local img_path=$1 
    108         local kernel_start_addr= kernel_size= kernel_md5= 
     117        local img_path=$1 img_board_target= 
     118        local kernel_start_addr= kernel_start_addr1= kernel_start_addr2= 
     119        local kernel_size= kernel_md5= 
    109120        local rootfs_size= rootfs_checksize= rootfs_md5= 
    110121        local kernel_bsize= total_size=7340032 
    111         local data_offset=$((64 * 1024)) block_size=$((256 * 1024)) offset= 
     122        local data_offset=$((64 * 1024)) block_size= offset= 
    112123        local uboot_env_upgrade="/tmp/fw_env_upgrade" 
    113124        local cfg_size= kernel_size= rootfs_size= 
     
    120131        rootfs_size=$(dd if="$img_path" bs=2 skip=107 count=4 2>/dev/null) 
    121132 
     133        img_board_target=$(trim $(dd if="$img_path" bs=4 skip=1 count=8 2>/dev/null)) 
    122134        cfg_content=$(dd if="$img_path" bs=1 skip=$data_offset count=$(echo $((0x$cfg_size))) 2>/dev/null) 
     135 
     136        case $img_board_target in 
     137                OM2P) 
     138                        block_size=$((256 * 1024)) 
     139                        kernel_start_addr1=0x9f1c0000 
     140                        kernel_start_addr2=0x9f8c0000 
     141                        ;; 
     142                MR600) 
     143                        block_size=$((64 * 1024)) 
     144                        kernel_start_addr1=0x9f0b0000 
     145                        kernel_start_addr2=0x9f850000 
     146                        ;; 
     147        esac 
    123148 
    124149        kernel_md5=$(cfg_value_get "$cfg_content" "vmlinux" "md5sum") 
     
    148173                        printf "rootfs_size_1 %u\n" $((($total_size - $kernel_bsize) / 1024)) >> $uboot_env_upgrade 
    149174                        printf "bootseq 1,2\n" >> $uboot_env_upgrade 
    150                         kernel_start_addr=0x9f1c0000 
     175                        kernel_start_addr=$kernel_start_addr1 
    151176                else 
    152177                        printf "kernel_size_2 %u\n" $(($kernel_bsize / 1024)) >> $uboot_env_upgrade 
    153178                        printf "rootfs_size_2 %u\n" $((($total_size - $kernel_bsize) / 1024)) >> $uboot_env_upgrade 
    154179                        printf "bootseq 2,1\n" >> $uboot_env_upgrade 
    155                         kernel_start_addr=0x9f8c0000 
     180                        kernel_start_addr=$kernel_start_addr2 
    156181        fi 
    157182 
  • branches/attitude_adjustment/target/linux/ar71xx/base-files/lib/upgrade/platform.sh

    r34342 r34350  
    141141                ;; 
    142142 
     143        mr600 | \ 
    143144        om2p | \ 
    144145        om2p-hs | \ 
    145146        om2p-lc) 
    146                 platform_check_image_om2p "$magic_long" "$1" && return 0 
     147                platform_check_image_openmesh "$magic_long" "$1" && return 0 
    147148                return 1 
    148149                ;; 
     
    270271                platform_do_upgrade_dir825b "$ARGV" 
    271272                ;; 
     273        mr600 | \ 
    272274        om2p | \ 
    273275        om2p-hs | \ 
    274276        om2p-lc) 
    275                 platform_do_upgrade_om2p "$ARGV" 
     277                platform_do_upgrade_openmesh "$ARGV" 
    276278                ;; 
    277279        *) 
Note: See TracChangeset for help on using the changeset viewer.