# README
#
# rmaladi@cisco.com, Mar 2016
#
# Copyright (c) 2015 by Cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
Source code
==========
Source code is present in git and can be cloned (pulled) using below command
    git clone ssh://wwwin-git-sjc/git/ngos/ngos-grub2.git

Image information:
==================
"bootx64.efi" is the grub2 image file that will be integrated into XR image as os-sdk tar ball file.

For building GRUB2, GCC needs to support "-mcmodel=large" option which is not present in the current version of GCC in the lineup.
So GRUB2 is being built in an external location and binary is being checked in.

Original version of the binary was built in Ubuntu 10.10, gcc version 4.4.5
Current grub2 is built on 'Cent OS 64-bit 3' machine, using gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC).

Code Changes:
============
Oct 2016 - GRuB fix for Fretta LC non-secure boot - CSCvb93390
==============================================================
  Do not call grub_ccc_update on non-NCS6K/4K platforms

Oct 2016 - NCS6K/NCS4K non-secure boot
======================================
  Added code support non-secure boot on NCS6K/NCS4K

Sep 2016 - NCS6K/NCS4K secure boot and fix build issue 
======================================================
  Added code support for secure boot on NCS6K/NCS4K
  Fixed code compilation issue due to defined but not-used variable  
  Build done on 32-bit Ubuntu 12.04 LTS, GCC 4.6.3

Apr 2016 - Taihu secure boot and message cleanup 
================================================
  Added code support for new flash location for common taihu for NXOS and XR
  Messages cleanup for USBboot 
 
Mar 2016 - Zermatt/Turin/Taihu XR platform code changes
=======================================================
  Added code support for new flash location for Zermatt/Turin/Taihu XR platforms
which use AMI Aptio 5 code base

Jan 2016 - Fretta Phase2 LC changes
===================================
  Added code support for new flash location for phase2 LCs which use AMI Aptio 5 code base

Dec 2015 - ASR9K changes
========================
  Added for ASR9K secure boot code changes

Nov 2015 - Fretta changes
=========================
  1. Added support for fretta secure boot
	- fretta uses BIOS flash to store secure boot public key. 
	  So, key retrieval is enhanced.
	- Provided backward compatibility for secure boot public 
	  keys for spirit platforms.
  2. In case of secure boot verification fail, and grub reboots the board. 
  3. Grub reboot causes immediate reboot not allowing grub to send failure post code to RP
     Fixed this by invoking iofpga power cycler register and with a 1 second delay

Steps to build
===============
export EFI_ARCH=x86_64
./configure --with-platform=efi --target=$EFI_ARCH --program-prefix=""
make
cd grub-core/
../grub-mkimage -d . -O x86_64-efi -o bootx64.efi -p "" boot linux part_msdos part_gpt fat ext2 normal configfile lspci ls reboot datetime loadenv search help cat search_fs_uuid search_label efi_gop echo acpi lsacpi lsefimmap lsmmap terminal terminfo relocator serial loopback net efinet tftp iso9660 lvm codesign

The resulting bootx64.efi image is taken as tar ball file (precompiled-grub2-secure.tgz) along 
with grub configuration files and this README file. 

NOTE:
This shall be signed in using below command via build scripts
  /ws/adithyas-sjc/cert/code-sign/scripts/IOSXR-sign.sh -i bootx64.efi -c /ws/adithyas-sjc/bin/cert/panini_dev_cert.cer
Result of above is signed file which is bootx64.efi.signed, that will be packaged in to <platform>-mini-x.iso image.
