#!/bin/sh

source ./variables.sh

set -ex

cd src/linux-stable
make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm V=$V sunxi_defconfig

cat >> .config <<__EOF
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_VIRT=y
CONFIG_ARM_LPAE=y
CONFIG_BLK_DEV_DM=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BRIDGE=y
CONFIG_DM_UEVENT=y
CONFIG_KVM=y
CONFIG_KVM_ARM_HOST=y
CONFIG_MD=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_SCSI_VIRTIO=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SYN_COOKIES=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_TUN=y
CONFIG_VHOST=y
CONFIG_VHOST_NET=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTUALIZATION=y
CONFIG_XEN=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_GRANT_DEV_ALLOC=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_XEN_SCSI_FRONTEND=y
CONFIG_XEN_WDT=y
__EOF

make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm V=$V olddefconfig
make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm V=$V all -j$J
