move some things to d2-common

Change-Id: Icdc65b01eb93e5577d60d6909f774a69c297021e