#!/usr/bin/perl
use strict;
use warnings;
use FindBin qw($Bin);
use lib "$Bin/../../PerlLib";
use BRCM::GenConfig;

# $p will allow us to GET values from the PROFILE
# $c will allow us to SET (and GET and DRIVER_SETUP) on the config
# file as we transform it from a template to the final config

# arguments
# * profile file
# * config  file
my $p    = new BRCM::GenConfig(shift);
my $chip = $p->get('BRCM_CHIP');
my $c    = new BRCM::GenConfig( shift, Chip => $chip, Profile => $p );


if ( $p->get("BUILD_GRE_TUNNEL") ) {
    $c->set( "CONFIG_NET_IPGRE", "m" );
    $c->set( "CONFIG_NET_IPGRE_DEMUX", "m" );
    $c->set( "CONFIG_NET_IPGRE_BROADCAST", "y" );
    $c->set( "CONFIG_NF_CT_PROTO_IPGRE", "m" );
    $c->set( "CONFIG_NF_NAT_PROTO_IPGRE", "m" );    
    if ( $p->get("BUILD_IPV6") ) {
        $c->set( "CONFIG_IPV6_GRE", "y" );
    }
}


$c->write();

