| #! /bin/sh |
| |
| # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| # |
| # This script obtains platform information through mosys : |
| # - the memory info from SPD data |
| # - the platform name/version/variant |
| |
| MEMORY_SPD_INFO_FILE="/var/log/memory_spd_info.txt" |
| PLATFORM_INFO_FILE="/var/log/platform_info.txt" |
| |
| # Attempts to insert i2c-dev as it may not be done during init on all platforms |
| if ! modprobe i2c-dev; then |
| exit 0 |
| fi |
| |
| if ! mosys -l memory spd print all > ${MEMORY_SPD_INFO_FILE} 2> /dev/null; then |
| # If a sub-command is not available on a platform, mosys will fail with |
| # a non-zero exit code (EXIT_FAILURE) and print the help menu. If mosys |
| # fails, delete the output file to avoid placing non-relevent or confusing |
| # output in /var/log. |
| rm -f ${MEMORY_SPD_INFO_FILE} |
| fi |
| |
| # Record available platform parameters from mosys |
| (mosys -l platform vendor || echo -n "") > ${PLATFORM_INFO_FILE} |
| (mosys -l platform name || echo -n "") >> ${PLATFORM_INFO_FILE} |
| (mosys -l platform version || echo -n "") >> ${PLATFORM_INFO_FILE} |
| (mosys -l platform family || echo -n "") >> ${PLATFORM_INFO_FILE} |
| (mosys -l platform variant || echo -n "") >> ${PLATFORM_INFO_FILE} |