#!/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 );

    $c->set( [qw[
CONFIG_EXT2_FS_XATTR
CONFIG_EXT2_FS_POSIX_ACL
CONFIG_EXT2_FS_SECURITY
CONFIG_EXT3_FS_POSIX_ACL
CONFIG_EXT3_FS_SECURITY
CONFIG_ARM_PTDUMP
CONFIG_ANTFS_FS
CONFIG_AVM_USB_SUSPEND
CONFIG_USB_ANNOUNCE_NEW_DEVICES
CONFIG_USB_DEFAULT_PERSIST
CONFIG_BCM_PRINTK_INT_ENABLED
CONFIG_FSNOTIFY_RECURSIVE
]], 'y' );

if ( $chip =~ /^(63138)$/ ) {
    $c->set( [qw[
CONFIG_AVM_FASTIRQ
CONFIG_AVM_FASTIRQ_ARCH_ARM_COMMON
CONFIG_AVM_FASTIRQ_DEBUG
]], 'y' );

}

if ( $chip =~ /^(63178)$/ ) {
    $c->set( [qw[
CONFIG_OF_AVM_DT
CONFIG_OF_AVM_DT_ENV
]], 'y' );

}
    $c->set( [qw[
CONFIG_USB_COMMON
CONFIG_USB
CONFIG_USB_SERIAL
CONFIG_USB_SERIAL_WWAN
CONFIG_USB_SERIAL_OPTION
CONFIG_USB_NET_CDC_MBIM
CONFIG_USB_WDM
CONFIG_EXT2_FS
CONFIG_FAT_FS
CONFIG_MSDOS_FS
CONFIG_VFAT_FS
CONFIG_NETFILTER_XT_MATCH_LENGTH
CONFIG_NETFILTER_XT_MATCH_U32
CONFIG_NETFILTER_XT_MATCH_CONNBYTES
CONFIG_NET_SCH_FQ_CODEL
CONFIG_NET_SCH_LLQ
CONFIG_AVM_ETH_OAM
]], 'm' );


    $c->set( [qw[
CONFIG_AUDIT
CONFIG_SECURITY
CONFIG_SECURITYFS
CONFIG_SECURITY_NETWORK
CONFIG_SECURITY_PATH
CONFIG_SECURITY_APPARMOR
CONFIG_SECURITY_APPARMOR_HASH
CONFIG_SECURITY_APPARMOR_HASH_DEFAULT
CONFIG_DEFAULT_SECURITY_APPARMOR
CONFIG_AUDIT_GENERIC
]], 'y' );

    $c->set( [qw[
CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE
]], '1' );
    $c->set( [qw[
CONFIG_DEFAULT_SECURITY
]], '"apparmor"' );
$c->write();
