openwrtv4/target/linux/lantiq/base-files/lib/functions/lantiq.sh
John Crispin 332b4d556f lantiq: generate /tmp/sysinfo/lantiq_board_name if missing
Run lantiq_board_detect from lantiq_board_name and lantiq_board_model.

This was the one thing missing from r41474 for sysupgrade board
detection to work properly.

Signed-off-by: Ben Mulvihill <ben.mulvihill@gmail.com>

SVN-Revision: 41567
2014-07-10 19:16:43 +00:00

31 lines
845 B
Bash

#!/bin/sh
lantiq_board_detect() {
name=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"`
model=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g"`
[ -z "$name" ] && name="unknown"
[ -z "$model" ] && model="unknown"
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
echo $name > /tmp/sysinfo/board_name
echo $model > /tmp/sysinfo/model
}
lantiq_board_model() {
local model
[ -f /tmp/sysinfo/model ] || lantiq_board_detect
[ -f /tmp/sysinfo/model ] && model=$(cat /tmp/sysinfo/model)
[ -z "$model" ] && model="unknown"
echo "$model"
}
lantiq_board_name() {
local name
[ -f /tmp/sysinfo/board_name ] || lantiq_board_detect
[ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
[ -z "$name" ] && name="unknown"
echo "$name"
}