aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/base-files/lib/preinit
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-07-30 08:36:26 +0200
committerJo-Philipp Wich <jo@mein.io>2018-07-30 11:11:21 +0200
commitc8e8ff1c9fbf699d04e2dc9e01d3349878ef7883 (patch)
tree47adfa2011539158aa47d683c14503ba37dee957 /target/linux/brcm47xx/base-files/lib/preinit
parentca0c649a380c4bd1d356bf5518f4da47b2b163c1 (diff)
downloadupstream-c8e8ff1c9fbf699d04e2dc9e01d3349878ef7883.tar.gz
upstream-c8e8ff1c9fbf699d04e2dc9e01d3349878ef7883.tar.bz2
upstream-c8e8ff1c9fbf699d04e2dc9e01d3349878ef7883.zip
brcm47xx: rework model detection
On brcm47xx boards, the model ID is the combination of the "boardtype" nvram variable and an optional supplemental "boardnum" variable while the human readable model name is usually exposed in the "machine" field of the /proc/cpuinfo file. Move the extraction of the board nvram variables and model name string into the 01_sysinfo file and rework the 01_detect board configuration script to solely use the prepared sysinfo values without performing own detection logic. As a consequence, we can drop the ucidef_set_board_id() and ucidef_set_model_name() invocations in favor to the generic behaviour which copies the /tmp/sysinfo/{board_name,model} values into the board.json "id" and "name" fields respectively. Since "01_detect" only contains network configuration logic after this change, move it to "01_network" and rename the contained "detect_by_xxx" functions to "configure_by_xxx" instead, to avoid potential confusion. Fixes FS#1576 Acked-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit d7d10f2c1e8511fe07c9760e85f2272a85168f8d)
Diffstat (limited to 'target/linux/brcm47xx/base-files/lib/preinit')
-rw-r--r--target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo12
1 files changed, 8 insertions, 4 deletions
diff --git a/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo b/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo
index 8a2de67bc5..a3b0c38437 100644
--- a/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo
+++ b/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo
@@ -1,12 +1,16 @@
#!/bin/sh
do_sysinfo_brcm47xx() {
- local name="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)"
- [ -z "$name" ] && name="unknown"
+ 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 "$name" > /tmp/sysinfo/board_name
- echo "unknown" > /tmp/sysinfo/model
+ echo "$boardtype${boardnum:+:$boardnum}" > /tmp/sysinfo/board_name
+ echo "$model" > /tmp/sysinfo/model
}
boot_hook_add preinit_main do_sysinfo_brcm47xx