  We show that string duality relates M-theory on a local Calabi-Yau fourfold
singularity X4 to type IIA string theory on a Calabi-Yau threefold X3 fibered
over a real line, with RR 2-form fluxes turned on. The RR flux encodes how the
M-theory circle is fibered over the IIA geometry. The theories on N D2 branes
probing X3 are the well-known quiver theories with N=2 supersymmetry in three
dimensions. We show that turning on fluxes, and fibering the X3 over a
direction transverse to the branes, corresponds to turning on N=2 Chern-Simons
couplings. String duality implies that, in the strong coupling limit, the N D2
branes on X3 in this background become N M2 branes on X4. This provides a
string theory derivation for the recently conjectured description of the M2
brane theories on Calabi-Yau fourfolds in terms of N=2 quiver Chern-Simons
theories. We also provide a new N=2 Chern-Simons theory dual to AdS_4 x
Q^{1,1,1}. Type IIA/M-theory duality also relates IIA string theory on X3 with
only the RR fluxes turned on, to M-theory on a G2 holonomy manifold. We show
that this implies that the N M2 branes probing the G2 manifold are described by
the quiver Chern-Simons theory originating from the D2 branes probing X3,
except that now Chern-Simons terms preserve only N=1 supersymmetry in three
dimensions.
