#!/bin/sh

do_sysinfo_brcm47xx() {
	local boardtype="$(nvram get boardtype)"
	local boardnum="$(nvram get boardnum)"
	local model="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)"

	[ -z "$model" ] && model="unknown"
	[ -z "$boardtype" ] && boardtype="unknown"

	[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
	echo "$boardtype${boardnum:+:$boardnum}" > /tmp/sysinfo/board_name
	echo "$model" > /tmp/sysinfo/model
}

boot_hook_add preinit_main do_sysinfo_brcm47xx
