Skip to content

Instantly share code, notes, and snippets.

@lool
Last active October 9, 2023 07:50
Show Gist options
  • Save lool/acfa4d74aa5f8dc8cda721536f230b6f to your computer and use it in GitHub Desktop.
Save lool/acfa4d74aa5f8dc8cda721536f230b6f to your computer and use it in GitHub Desktop.
Build ONIE VM image
#!/bin/sh
set -e
PACKAGES="git qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-manager git realpath autoconf bison flex texinfo libtool libtool-bin libncurses5-dev gawk gperf stgit build-essential fakeroot libexpat1-dev python-dev xorriso mtools dosfstools"
ONIE_URL="https://github.com/opencomputeproject/onie.git"
# needed to locate mkdosfs
export PATH=$PATH:/sbin:/usr/sbin
sudo apt-get -y install --no-install-recommends $PACKAGES
if [ -z "`git config --global user.email`" ]; then
git config --global user.email "john.doe@example.com"
fi
if [ -z "`git config --global user.name`" ]; then
git config --global user.name "John Doe"
fi
onie_dir="`basename $ONIE_URL .git`"
if ! [ -d "$onie_dir" ]; then
git clone "$ONIE_URL"
fi
cd "$onie_dir"
cd build-config
sed -i 's/\<libtool-bin\>//' Makefile
sed -i 's/\<apt-get install \$\>/apt-get install -y $/' Makefile
#sed -i 's/apt-get install \$/apt-get install -y $/' Makefile
make debian-prepare-build-host
make distclean
make clean
# makes onie
make -j $(grep -c "^processor" /proc/cpuinfo) MACHINE=kvm_x86_64 all recovery-iso
make demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment