introduce '-2' commandline option for second BS-11

Using this option, you can use two BS-11 connected to the same E1
link.  The first BS-11 needs to have BPORT0 and BPORT1 objects created with E1
Line Configuration attribute "multi-drop".  The second BS-11 is configured with
only BPORT0 in star configuration, and needs to have the OML signalling on TS6
instead of TS1.  Also, a kernel patch providing a second virtual E1 interface
is needed.
diff --git a/openbsc/src/bsc_hack.c b/openbsc/src/bsc_hack.c
index 27c2c25..82cb788 100644
--- a/openbsc/src/bsc_hack.c
+++ b/openbsc/src/bsc_hack.c
@@ -62,6 +62,7 @@
 static int cardnr = 0;
 static int release_l2 = 0;
 static int bs11_has_trx1 = 0;
+static int bs11_has_bts1 = 0;
 static enum gsm_bts_type BTS_TYPE = GSM_BTS_TYPE_BS11;
 static enum gsm_band BAND = GSM_BAND_900;
 static const char *database_name = "hlr.sqlite3";
@@ -1061,6 +1062,8 @@
 
 static int bootstrap_network(void)
 {
+	int rc;
+
 	switch(BTS_TYPE) {
 	case GSM_BTS_TYPE_NANOBTS_1800:
 		if (ARFCN < 512 || ARFCN > 885) {
@@ -1114,11 +1117,26 @@
 			trx1 = gsm_bts_trx_alloc(bts);
 			trx1->arfcn = ARFCN + 2;
 		}
-
 		bootstrap_bts(bts);
+		rc = e1_config(bts, cardnr, release_l2);
+		if (rc < 0) {
+			fprintf(stderr, "Error during E1 config of BTS 0\n");
+			return rc;
+		}
 
-		gsmnet->num_bts = 1;
-		return e1_config(bts, cardnr, release_l2);
+		if (bs11_has_bts1) {
+			bts = gsm_bts_alloc(gsmnet, BTS_TYPE, TSC, BSIC);
+			if (bs11_has_trx1) {
+				struct gsm_bts_trx *trx1;
+				trx1 = gsm_bts_trx_alloc(bts);
+				trx1->arfcn = ARFCN + 2;
+			}
+			bootstrap_bts(bts);
+			rc = e1_config(bts, cardnr+1, release_l2);
+			if (rc < 0)
+				fprintf(stderr, "Error during E1 config of BTS 1\n");
+		}
+		return rc;
 	} else {
 		struct nano_bts_id *bts_id;
 		struct gsm_bts *bts;
@@ -1174,6 +1192,7 @@
 	printf("  -i --bts-id=NUMBER The known nanoBTS device numbers. Can be specified multiple times.\n");
 	printf("  -C --cardnr number  For bs11 select E1 card number other than 0\n");
 	printf("  -R --release-l2 Releases mISDN layer 2 after exit, to unload driver.\n");
+	printf("  -2 --second-bs11 Configure + Use a second BS-11\n");
 	printf("  -h --help this text\n");
 }
 
@@ -1203,10 +1222,11 @@
 			{"bsic", 1, 0, 'B'},
 			{"rtp-proxy", 0, 0, 'P'},
 			{"trx1", 0, 0, '1'},
+			{"second-bs11", 0, 0, '2'},
 			{0, 0, 0, 0}
 		};
 
-		c = getopt_long(argc, argv, "hc:n:d:sar:p:f:t:C:RL:l:Tb:i:S:B:P1",
+		c = getopt_long(argc, argv, "hc:n:d:sar:p:f:t:C:RL:l:Tb:i:S:B:P12",
 				long_options, &option_index);
 		if (c == -1)
 			break;
@@ -1283,6 +1303,9 @@
 		case '1':
 			bs11_has_trx1 = 1;
 			break;
+		case '2':
+			bs11_has_bts1 = 1;
+			break;
 		}
 		default:
 			/* ignore */