Changeset 35850


Ignore:
Timestamp:
2013-03-03T13:47:02+01:00 (5 years ago)
Author:
juhosg
Message:

ramips: enhance user-space board detection

Similar to ar71xx, detect only once and cache the strings in
/tmp/sysinfo/model and /tmp/sysinfo/boardname.

Signed-off-by: Daniel Golle <dgolle@…>
Signed-off-by: Gabor Juhos <juhosg@…>

Location:
trunk/target/linux/ramips/base-files/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh

    r21635 r35850  
    33do_ramips() { 
    44        . /lib/ramips.sh 
     5 
     6        ramips_board_detect 
    57} 
    68 
  • trunk/target/linux/ramips/base-files/lib/ramips.sh

    r35849 r35850  
    11#!/bin/sh 
    22# 
    3 # Copyright (C) 2010 OpenWrt.org 
     3# Copyright (C) 2010-2013 OpenWrt.org 
    44# 
    55 
    6 ramips_board_name() { 
     6RAMIPS_BOARD_NAME= 
     7RAMIPS_MODEL= 
     8 
     9 
     10ramips_board_detect() { 
    711        local machine 
    812        local name 
     
    190194        esac 
    191195 
    192         echo $name 
     196        [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name" 
     197        [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine" 
     198 
     199        [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" 
     200 
     201        echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name 
     202        echo "$RAMIPS_MODEL" > /tmp/sysinfo/model 
    193203} 
     204 
     205ramips_board_name() { 
     206        local name 
     207 
     208        [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) 
     209        [ -z "$name" ] && name="unknown" 
     210 
     211        echo "$name" 
     212} 
Note: See TracChangeset for help on using the changeset viewer.