Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
generate coreboot dev info
#!/bin/bash
command -v lspci >/dev/null 2>&1 || { echo "lspci (pkg pciutils) required for this script" >&2 ; exit 1 ; }
command -v lsusb >/dev/null 2>&1 || { echo "lsusb (pkg usbutils) required for this script" >&2 ; exit 1 ; }
command -v dmidecode >/dev/null 2>&1 || { echo "dmidecode (pkg dmidecode) required for this script" >&2 ; exit 1 ; }
command -v biosdecode >/dev/null 2>&1 || { echo "biosdecode (pkg dmidecode) required for this script" >&2 ; exit 1 ; }
command -v dmesg >/dev/null 2>&1 || { echo "dmesg (pkg util-linux) required for this script" >&2 ; exit 1 ; }
command -v git >/dev/null 2>&1 || { echo "git (pkg git-core) required for this script" >&2 ; exit 1 ; }
command -v svn >/dev/null 2>&1 || { echo "svn (pkg subversion) required for this script" >&2 ; exit 1 ; }
command -v make >/dev/null 2>&1 || { echo "make (pkg build-essential base-devel ...) required for this script" >&2 ; exit 1 ; }
topdir="`pwd`"
corebootsrc="$topdir/coreboot"
machinedump="$topdir/`date +%F`-`hostname`"
flashromsrc="$topdir/flashrom"
pushd $topdir
mkdir -p "$machinedump"
(
if [ ! -d "$corebootsrc" ]; then
echo "## retrieving coreboot source"
cd "$topdir"
git clone http://review.coreboot.org/p/coreboot $corebootsrc
else
echo "## updating coreboot source"
cd "$corebootsrc"
git pull
fi
if [ ! -d "$flashromsrc" ]; then
echo "## retrieving flashrom source"
cd "$topdir"
svn co svn://coreboot.org/flashrom/trunk $flashromsrc
else
echo "## updating flashrom source"
cd "$flashromsrc"
svn up
fi
echo "## generating inteltool info"
cd $corebootsrc/util/inteltool ; make
if [ -f inteltool ]; then
sudo ./inteltool -a > $machinedump/inteltool.log
else
echo "inteltool bin missing" >&2
fi
echo "## generating ectool info"
cd $corebootsrc/util/ectool ; make
if [ -f ectool ]; then
sudo ./ectool > $machinedump/ectool.log
else
echo "ectool bin missing" >&2
fi
echo "## generating msrtool info"
cd $corebootsrc/util/msrtool ; ./configure ; make
if [ -f msrtool ]; then
sudo modprobe msr
sudo ./msrtool -l -s $machinedump/msrtool.log
else
echo "msrtool bin missing" >&2
fi
echo "## generating nvramtool info"
cd $corebootsrc/util/nvramtool ; make
if [ -f nvramtool ]; then
sudo ./nvramtool -x > $machinedump/nvramtool.log
else
echo "nvramtool bin missing" >&2
fi
echo "## generating superiotool info"
cd $corebootsrc/util/superiotool ; make
if [ -f superiotool ]; then
sudo ./superiotool -deV > $machinedump/superiotool.log
else
echo "superiotool bin missing" >&2
fi
echo "## generating lspci info"
sudo lspci -nnvvvxxxx > $machinedump/lscpi.log
echo "## generating lsusb info"
sudo lsusb -vvv > $machinedump/lsusb.log
echo "## generating dmidecode info"
sudo dmidecode > $machinedump/dmidecode.log
echo "## generating biosdecode info"
sudo biosdecode > $machinedump/biosdecode.log
echo "## generating dmesg info"
sudo dmesg > $machinedump/dmesg.log
echo "## generating lspnp info"
if command -v lspnp ; then
sudo lspnp -vv > $machinedump/lspnp.log
else
echo "lspnp bin missing" >&2
fi
echo "## generating flashrom info"
cd $flashromsrc ; make
if [ -f flashrom ]; then
sudo ./flashrom -V -p internal:laptop=force_I_want_a_brick > $machinedump/flashrom_info.log
sudo ./flashrom -V -p internal:laptop=force_I_want_a_brick -r $machinedump/rom.bin > $machinedump/flashrom_read.log
else
echo "flashrom bin missing" >&2
fi
) 2>&1 | tee $machinedump/generation.log
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.