Skip to content

Instantly share code, notes, and snippets.

@rschmied
Created November 3, 2017 16:01
Show Gist options
  • Select an option

  • Save rschmied/3571fdf0771949a4e44e65562bd9c296 to your computer and use it in GitHub Desktop.

Select an option

Save rschmied/3571fdf0771949a4e44e65562bd9c296 to your computer and use it in GitHub Desktop.
Modify CSR 1000v ISO to activate serial console instead of VGA
#!/bin/bash
#set -x
[[ ! "$1" =~ .*\.iso ]] && { echo ".iso file name needed"; exit; }
TEMP=$(mktemp -d)
PDIR=$(pwd)
if [[ "$1" =~ ^/ ]]; then
SRC=$1
else
SRC=$PDIR/$1
fi
pushd $TEMP
mkdir mnt && mkdir iso
sudo mount -o loop $SRC mnt
cp -a mnt/* iso
sed -i '/^default/s/0/1/' iso/boot/grub/menu.lst
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o "new-$(basename $1)" iso
sudo umount mnt
mv *.iso $PDIR
popd
rm -rf $TEMP
@rschmied

rschmied commented Nov 3, 2017

Copy link
Copy Markdown
Author

Previous CSR1000v releases had the console automatically on the serial port. Which helped to automate the installation of the CSR into a vagrant box using https://github.com/ios-xr/iosxrv-x64-vbox/blob/master/iosxe_iso2vbox.py. However, 16.06.01 has the console on the VGA screen which breaks the script... meh.

This little bash script takes the original ISO, unwraps it and then builds a new one with a modified Grub menu that has the serial console again as the default. Works for me...

@hpreston

hpreston commented Nov 3, 2017

Copy link
Copy Markdown

Nice! I hit this issue myself and talked with the devs about why they weren't offering a "serial" version of the ISO like they do with other formats. I thought they were going to start doing that again, but looks like they haven't yet.. let me shake that tree again..

@hpreston

Copy link
Copy Markdown

@rschmied - Where are you running this script from? Trying to get it to run on OS X and having some issues... curious whether you ran down the proper pre-reqs on OS X vs a Linux distro

@rschmied

rschmied commented Nov 30, 2017

Copy link
Copy Markdown
Author

@hpreston Ugh... apparently missed this. Some of this is Linux specific... especially mounting a loop file system. You could try to replace the mount with hdiutil mount $SRC. You'd still need the mkisofs which can be installed using MacPorts or Brew. The rest is pretty vanilla. The hdiutil will also mount into /Volumes... so there's some more tweaking needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment