[coreboot-gerrit] Patch set updated for coreboot: board_status: Add script that will set up a ubuntu live image
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Sun Feb 14 23:38:05 CET 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13648
-gerrit
commit 8c651a9ae19017422428c9cf0e4ceb9037abebed
Author: Martin Roth <martinroth at google.com>
Date: Tue Feb 9 12:20:32 2016 -0700
board_status: Add script that will set up a ubuntu live image
This is a pretty basic script that can be downloaded with wget to a
ubuntu-based live image, and will set it up so that the board_status
script can connect and run cbmem.
1) Verify that this is being run on a ubuntu-based live image by
checking for the installer.
2) Install and configure the ssh server.
3) Set a root password 'coreboot' so that root can log in.
4) download and build cbmem.
5) find and print the IP(s) that should be used to connect.
Change-Id: I068423c9f5501b156f25371d89559f4a206916b5
Signed-off-by: Martin Roth <martinroth at google.com>
---
util/board_status/set_up_live_image.sh | 70 ++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/util/board_status/set_up_live_image.sh b/util/board_status/set_up_live_image.sh
new file mode 100755
index 0000000..d80434e
--- /dev/null
+++ b/util/board_status/set_up_live_image.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+# This script is used to set up a ubuntu-based live image to be used
+# with coreboot's board_status script. It modifies the system so that
+# board_status can connect over SSH and run cbmem. This script is NOT
+# meant to be run on an installed system, and changes the configuration
+# in ways that would be dangerous to security on an installed system.
+
+# Make sure we're on a ubuntu live image
+if [ ! -e /usr/bin/ubiquity ]; then
+ echo "Error: This doesn't appear to be a ubuntu based live image. Exiting."
+ exit 1
+fi
+
+RED='\033[1;31m'
+GREEN='\033[1;32m'
+NC='\033[0m' # No Color
+
+# shellcheck disable=SC2059
+error ()
+{
+ printf "${RED}ERROR: $1 ${NC}\n" >&2
+ if [ -n "$2" ]; then printf "${RED}Removing $2 ${NC}\n"; rm -rf "./$2"; fi
+ exit 1
+}
+
+# shellcheck disable=SC2059
+status ()
+{
+ printf "${GREEN}${1}${NC}"
+}
+
+# Install and configure the ssh server for the board-status script to connect to.
+status "Installing and configuring ssh server\n"
+sudo rm -f /etc/apt/sources.list
+sudo apt-get update || \
+ error "Could not update packages"
+sudo apt-get install -y openssh-server || \
+ error "Could not install openssh-server"
+sudo sed -i.bak 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config || \
+ error "Could not update sshd.config to allow root login."
+sudo sudo service ssh restart || \
+ error "Could not restart ssh server"
+
+# Set the root password so it can be used to log in
+status "Setting root password to 'coreboot'\n"
+echo -e "root:coreboot" | sudo chpasswd || \
+ error "Could not reset root password"
+
+# Download the coreboot tree
+status "Installing git and clone the coreboot repo\n"
+sudo apt-get install -y git build-essential || \
+ error "Could not install git"
+git clone --depth 1 https://review.coreboot.org/coreboot || \
+ error "Could not download coreboot repository"
+
+# Build and install cbmem
+status "Building and installing cbmem\n"
+make -C coreboot/util/cbmem || \
+ error "Could not build cbmem"
+sudo make -C coreboot/util/cbmem install || \
+ error "Could not instll cbmem"
+sudo cbmem || \
+ error "cbmem did not run correctly"
+rm -rf coreboot
+
+# Identify the ip address that board-status will connect to
+IP_ADDR=$(ifconfig -a | grep 'inet addr' | grep -v '127.0.0.1' | \
+ sed 's|.*inet addr:||' | sed 's|Bcast.*||')
+status "\nAddress or addresses for this board: $IP_ADDR\n"
More information about the coreboot-gerrit
mailing list