#!/bin/bash
-# Kernel configration options.
+# Kernel configuration options.
OPTIONS=" IPV6 IPV6_ROUTER_PREF IPV6_MULTIPLE_TABLES IPV6_ROUTE_INFO"
OPTIONS="$OPTIONS TUN SYN_COOKIES IP_ADVANCED_ROUTER IP_MULTIPLE_TABLES"
OPTIONS="$OPTIONS NETFILTER NETFILTER_ADVANCED NETFILTER_XTABLES"
OPTIONS="$OPTIONS NETFILTER_XT_MARK NETFILTER_XT_TARGET_MARK"
OPTIONS="$OPTIONS IP_NF_IPTABLES IP_NF_MANGLE"
OPTIONS="$OPTIONS IP6_NF_IPTABLES IP6_NF_MANGLE INET6_IPCOMP"
+OPTIONS="$OPTIONS IPV6_PRIVACY IPV6_OPTIMISTIC_DAD"
# For 3.1 kernels, where devtmpfs is not on by default.
OPTIONS="$OPTIONS DEVTMPFS DEVTMPFS_MOUNT"
+# These two break the flo kernel due to differences in -Werror on recent GCC.
+DISABLE_OPTIONS=" CONFIG_REISERFS_FS CONFIG_ANDROID_PMEM"
+
# How many tap interfaces to create.
NUMTAPINTERFACES=2
# The root filesystem disk image we'll use.
-ROOTFS=$(dirname $0)/net_test.rootfs
+ROOTFS=net_test.rootfs.20150203
+COMPRESSED_ROOTFS=$ROOTFS.xz
+URL=https://dl.google.com/dl/android/$COMPRESSED_ROOTFS
# Figure out which test to run.
if [ -z "$1" ]; then
# Check if we need to uncompress the disk image.
# We use xz because it compresses better: to 42M vs 72M (gzip) / 62M (bzip2).
-if [ $ROOTFS.xz -nt $ROOTFS ]; then
- echo "Deleting $ROOTFS" >&2
- rm -f $ROOTFS
- echo "Uncompressing $ROOTFS.xz" >&2
- unxz --keep $ROOTFS.xz
+cd $(dirname $0)
+if [ ! -f $ROOTFS ]; then
+ echo "Deleting $COMPRESSED_ROOTFS" >&2
+ rm -f $COMPRESSED_ROOTFS
+ echo "Downloading $URL" >&2
+ wget $URL
+ echo "Uncompressing $COMPRESSED_ROOTFS" >&2
+ unxz $COMPRESSED_ROOTFS
fi
-
+echo "Using $ROOTFS"
+cd -
# Create NUMTAPINTERFACES tap interfaces on the host, and prepare UML command
# line params to use them. The interfaces are called <user>TAP0, <user>TAP1,
cmdline=${OPTIONS// / -e }
./scripts/config $cmdline
+# Disable the kernel config options listed in $DISABLE_OPTIONS.
+cmdline=${DISABLE_OPTIONS// / -d }
+./scripts/config $cmdline
+
# olddefconfig doesn't work on old kernels.
if ! make olddefconfig ARCH=um SUBARCH=x86_64 CROSS_COMPILE= ; then
cat >&2 << EOF
fi
# Compile the kernel.
-make -j12 linux ARCH=um SUBARCH=x86_64 CROSS_COMPILE=
+make -j32 linux ARCH=um SUBARCH=x86_64 CROSS_COMPILE=
# Get the absolute path to the test file that's being run.
dir=/host$(dirname $(readlink -f $0))
# Start the VM.
-exec ./linux umid=net_test ubda=$(dirname $0)/net_test.rootfs \
+exec ./linux umid=net_test ubda=$(dirname $0)/$ROOTFS \
mem=512M init=/sbin/net_test.sh net_test=$dir/$test \
$netconfig