-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
2 changed files
with
25 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |