3 # This script is used to set up a ubuntu-based live image to be used
4 # with coreboot's board_status script. It modifies the system so that
5 # board_status can connect over SSH and run cbmem. This script is NOT
6 # meant to be run on an installed system, and changes the configuration
7 # in ways that would be dangerous to security on an installed system.
9 # Make sure we're on a ubuntu live image
10 if [ ! -e /usr
/bin
/ubiquity
]; then
11 echo "Error: This doesn't appear to be a ubuntu based live image. Exiting."
17 NC
='\033[0m' # No Color
19 # shellcheck disable=SC2059
22 printf "${RED}ERROR: $1 ${NC}\n" >&2
23 if [ -n "$2" ]; then printf "${RED}Removing $2 ${NC}\n"; rm -rf "./$2"; fi
27 # shellcheck disable=SC2059
30 printf "${GREEN}${1}${NC}"
33 # Install and configure the ssh server for the board-status script to connect to.
34 status
"Installing and configuring ssh server\n"
35 sudo
rm -f /etc
/apt
/sources.list
36 sudo apt-get update || \
37 error
"Could not update packages"
38 sudo apt-get
install -y openssh-server || \
39 error
"Could not install openssh-server"
40 sudo
sed -i.bak
's/PermitRootLogin.*/PermitRootLogin yes/' /etc
/ssh
/sshd_config || \
41 error
"Could not update sshd.config to allow root login."
42 sudo sudo service
ssh restart || \
43 error
"Could not restart ssh server"
45 # Set the root password so it can be used to log in
46 status
"Setting root password to 'coreboot'\n"
47 echo -e "root:coreboot" | sudo chpasswd || \
48 error
"Could not reset root password"
50 # Download the coreboot tree
51 status
"Installing git and clone the coreboot repo\n"
52 sudo apt-get
install -y git build-essential || \
53 error
"Could not install git"
54 git clone
--depth 1 https
://review.coreboot.org
/coreboot || \
55 error
"Could not download coreboot repository"
57 # Build and install cbmem
58 status
"Building and installing cbmem\n"
59 make -C coreboot
/util
/cbmem || \
60 error
"Could not build cbmem"
61 sudo
make -C coreboot
/util
/cbmem
install || \
62 error
"Could not instll cbmem"
64 error
"cbmem did not run correctly"
67 # Identify the ip address that board-status will connect to
68 IP_ADDR
=$
(ifconfig
-a |
grep 'inet addr' |
grep -v '127.0.0.1' | \
69 sed 's|.*inet addr:||' |
sed 's|Bcast.*||')
70 status
"\nAddress or addresses for this board: $IP_ADDR\n"