Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Identifying machines with common CPU modules
This patch adds support for machines that use a common CPU module. These modules provide a common CPU, memory and storage system for switching platforms. The CPU module can be plugged into a variety of base boards where the switching elements reside. The idea is to have a single ONIE "machine" for the CPU module and detect at run time what the baseboard is. The platform identification originates from /etc/machine.conf, a portion of which is now derived at run time. Along with this a new configuration variable, "onie_build_machine" is introduced. /etc/machine.conf ================= Previously this file was completely built at compile time. This file is now a small wrapper script that sources two new files, /etc/machine-build.conf and /etc/machine-live.conf. /etc/machine-build.conf -- this file is completely built at compile time and only contains information known at build time. This file introduces a new configuration variable, "onie_build_machine", which is the ONIE machine specified at compile time. For example this would be the ONIE machine name of the common CPU module. /etc/machine-live.conf -- this file is built at run time. A boot time init script sources a platform specific file if it exists, executes the gen_live_config() function and stores the output in /etc/machine-live.conf. By default this function outputs nothing, but a platform can override it produce a runtime ONIE machine name. Using this mechanism, a machine can redefine 'onie_machine' and 'onie_switch_asic' at run time. To do this, a machine defines a small script in the source tree at machine/<vendor>/rootconf/sysroot-lib-onie/gen-config-platform, which include a definition of the gen_live_config() function. If a machine does not define gen-config-platform, i.e. /etc/machine-live.conf is empty, then the contents of 'onie_build_machine' is used to set 'onie_machine'. This is backwardly compatible with how ONIE worked previously. Updating ONIE ============= When ONIE updates itself, it will now check that the running 'onie_build_machine' matches the 'onie_build_machine' of the proposed update image. Previously it checked that 'onie_machine' matched between runtime and the image. Closes: #570 Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
- Loading branch information
Curt Brune
committed
Aug 31, 2017
1 parent
e0fe278
commit 3cbcb9e
Showing
10 changed files
with
83 additions
and
31 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
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
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (C) 2017 Curt Brune <curt@cumulusnetworks.com> | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
# If necessary, generate run-time ONIE configuration variables in | ||
# /etc/machine-live.conf. | ||
|
||
cmd="$1" | ||
|
||
gen_live_config() | ||
{ | ||
# NO-OP | ||
true | ||
} | ||
|
||
[ -r /lib/onie/gen-config-platform ] && . /lib/onie/gen-config-platform | ||
|
||
case $cmd in | ||
start) | ||
gen_live_config > /etc/machine-live.conf | ||
;; | ||
*) | ||
|
||
esac |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# /etc/machine.conf for onie | ||
|
||
# Copyright (C) 2017 Curt Brune <curt@cumulusnetworks.com> | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
# Source build-time machine configuration | ||
. /etc/machine-build.conf | ||
|
||
# Source run-time machine configuration if available | ||
[ -r /etc/machine-live.conf ] && . /etc/machine-live.conf | ||
|
||
# Use onie_machine if set, otherwise use build_machine | ||
onie_machine=${onie_machine:-$onie_build_machine} | ||
|
||
onie_platform="${onie_arch}-${onie_machine}-r${onie_machine_rev}" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../init.d/gen-config.sh |